Admittedly, I am a newbie using shiny, however I have a strange error that seems to be coming from ggplot invoked via the SERVER.R
file.
The error is Error in exists(name, envir = env, mode = mode) :
argument "env" is missing, with no default
I did some searching and found most of the errors attrubuted to faulty ggplot specification... but I cannot find the bug.
Here is my UI.R
file:
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("Applications"),
sidebarPanel(
dateRangeInput('dateRange',
label = 'Date range input: yyyy-mm-dd',
start = Sys.Date() - 6, end = Sys.Date()
)
),
mainPanel(plotOutput("monthGraph"))
))
Here is my SERVER.R
file:
library("shiny")
library("RMySQL")
library("ggplot2")
#con <- dbConnect(MySQL(), host="***", port= 3306, user="***", password = "****", dbname="data")
#query <- dbGetQuery(con, "select date(datetime_var) as date , value
#from table
#where value= 1")
query <- data.frame(date=seq(as.Date("2014-01-01"), as.Date("2014-01-07"), 1), value=c(1:7))
shinyServer(function(input, output, session) {
passData <- reactive({
query <- query[query$date %in% seq.Date(input$dateRange[1], input$dateRange[2], by="days"),]
query
})
output$monthGraph <- renderPlot({
graphData <- passData()
theGraph <- ggplot(graphData,
aes(x=date)) +
geom_bar(stat="bin") +
ylab("Count")
print(theGraph)
})
})
So, I'm attempting to create a shiny app that dynamically updates based a simple bar graph on the users input of dateRange
...