# 阿好伯陪你一起玩 Node-Red 與 MQTT相關資料
[TOC]
{%hackmd NMKfZcKwTaKWGaraPMQeKw %}
{%hackmd mPHSY53ZS1GSGTmrqZbr6Q %}
{%hackmd IZ2k09W8TSumVdrA-NBLsw %}
{%hackmd jJiRlZ9tQXGfV9D9aSTixQ %}
# Rstudio Cloud
https://login.rstudio.cloud/login
# Shiny App
```r=
#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(googlesheets4)
library(ggplot2)
library(plotly)
library(ggeasy)
sheetur <- "https://docs.google.com/spreadsheets/d/1cSShs9p66lZx4WkUXIFVPhozC-gSRFR6WFKlz60hnCE/edit#gid=0"
gs4_deauth()
df <- read_sheet(sheetur,sheet = "data2")
df <- df[c(1:4)]
names(df) <- c("ID","Date", "type", "Value")
dataplot <- function(){
p1 <- df %>% ggplot(aes(x= Date, y = Value)) +
facet_wrap(~type, scales="free_y") +
geom_line() +
theme_bw() +
easy_rotate_x_labels(-45)
ggplotly(p1)
}
library(shiny)
# Define UI for application that draws a histogram
ui <- fluidPage(
# Application title
titlePanel("Old Faithful Geyser Data"),
plotlyOutput("distPlot")
# Sidebar with a slider input for number of bins
)
# Define server logic required to draw a histogram
server <- function(input, output) {
output$distPlot <- renderPlotly(
dataplot
)
}
# Run the application
shinyApp(ui = ui, server = server)
```