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)
})
})