...I'm new to R Shiny. I have a dataset and I'm looking to create some barcharts based on user selection from a drop down menu. I'm having difficulties reading the data from the file and passing it to the appropriate function. Any help is appreciated.
Hi @tammy
Could you share an reproducible example of the dataset and the code that is not working?
Warm Regards,
Pritish
Hi @Pritishd,
I have two columns in my data set named "year" and "month"
I want to see years in the drop down and months and their count on the bargraph.
My code could be totally wrong.
Thanks in advance!
library(shiny)
shinyUI(fluidPage(
titlePanel("years 2010-2013"),
sidebarLayout(
sidebarPanel(
selectInput("variable", "Select a year", choices = c("2010","2011","2012","2013"))
),
mainPanel(
plotOutput("distPlot")
)
)
)
)
shinyServer(function(input, output){
data <- read.csv("crime.csv")
years <- subset(data, YEAR==input$variable)
tbl <- with(years, table(year, month))
output$distPlot <- renderPlot({
barplot(tbl)
})
})
This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.