Problem
This is my first time writing shiny-R. Really sorry for being way off on this.
I have a dataset about Covid-19 Community Mobility in Thailand. I want to create multiple line graph (with difference color) from choosing dateRangeInput and checkboxGroupInput.But now I can't interact the data with the input.How can I write the code?
Data
This is my data structure : https://i.stack.imgur.com/xR2j0.png
This is my data on Googlesheet
The data contain date(from 15-02-20 to 08-01-22),6 place categories.There are 7 column and 694 rows
My current code
library(shiny)
library(ggplot2)
library(shinyWidgets)
library(dslabs)
library(tidyverse)
library(plotly)
data(Data)
# Define UI ----
ui <- fluidPage(
titlePanel("Covid-19 Community Mobility in Thailand"),
sidebarLayout(
sidebarPanel(
dateRangeInput("Input$dateInput", h3("Date range"),
start = '2020-02-15',end = '2022-01-08',
min = '2020-02-15',max = '2022-01-08'),
checkboxGroupInput("Input$placeInput",
h3("Place categories"),
choices = list("Retail & recreation" = Data$retail_and_recreation,
"Grocery & pharmacy" = Data$grocery_and_pharmacy,
"Parks" = Data$parks,
"Transit stations" = Data$Transit_stations,
"Workplaces" = Data$workplaces,
"Residential" = Data$residential),
selected = Data$retail_and_recreation)),
mainPanel(
plotOutput("Placeplot")
)
)
)
# Define server logic ----
server <- function(input, output) {
output$Placeplot <- renderPlot({
ggplot(Data,aes(x=Input$dateInput,y=Input$PlaceInput))+geom_line(color="Blue")+theme_classic()
})
}
# Run the app ----
shinyApp(ui = ui, server = server)
Thank you very much for helping.