I'm trying to put together a R + Shiny app that, at least initially, plots a histogram of date data. I have it working just fine on my local system in RStudio, but in shinyapps.io it doesn't work.
The app, at the moment, is very simple - the user interface doesn't really do anything, and the data is just a small sample of test data.
Works fine in RStudio (draws a nice little histogram). When loaded on shinyapps.io, the 'title panel' text and sidebar display but after a second or two either it - reports the error "'from' cannot be NA, NaN or infinite" or - the screen greys out and the script stops (?) in both cases without producing a histogram.
Has me baffled; would be interested to hear if anyone has any suggestions for where I've gone wrong. Perhaps it's to do with as.Date - a possibly similar problem is reported here, without any solution.
My two shiny files are:
# ui.R
shinyUI(fluidPage(
titlePanel("title panel"),
sidebarLayout(
sidebarPanel(
),
mainPanel(
plotOutput("distPlot")
)
)
))
and
# server.R
library(shiny)
shinyServer(function(input, output){
output$distPlot <- renderPlot({
text_date <- c("9 March 2006", "31 October 2008", "24 September 2008", "27 February 2009", "19 May 2014", "11 December 2009", "7 August 2013", "8 December 2014", "2 February 2010", "22 December 2014", "20 December 2011", "4 September 2009", "19 December 2013", "10 October 2007", "19 September 2008")
num_date <- as.Date(text_date, format = "%d %B %Y")
#plot a histogram
hist(num_date,
breaks = "years",
format = "%Y",
freq = TRUE)
})
})
There are no errors (or anything other than versions, starting and listening on...) reported by showLogs():
2015-02-22T10:00:50.507273+00:00 shinyapps[32851]: R version: 3.1.2
2015-02-22T10:00:50.509043+00:00 shinyapps[32851]: rmarkdown version: 0.0.0
2015-02-22T10:00:50.507340+00:00 shinyapps[32851]: Shiny version: 0.11.1
2015-02-22T10:00:50.509508+00:00 shinyapps[32851]: knitr version: 0.0.0
2015-02-22T10:00:50.784283+00:00 shinyapps[32851]:
2015-02-22T10:00:50.784285+00:00 shinyapps[32851]: Starting Shiny with process ID: '14'
2015-02-22T10:00:50.792403+00:00 shinyapps[32851]:
2015-02-22T10:00:50.792405+00:00 shinyapps[32851]: Listening on http://0.0.0.0:57429