You have two problems. First, you missed some quotes in your data. However, the fix did not change the result. I copied your code, fixed the quotation marks, and unrolled it and got the same results (worked locally, but not on shinyapps.io).
The second (and more important issue) relates to how different operating systems handle dates. I changed the .R server data part as follows:
text_date <- c("2006-03-09", "2008-10-31", "2008-09-24", "2009-02-27", "2014-05-19", "2013-08-07", "2014-12-08", "2010-02-02", "2014-12-22", "2011-12-20", "2009-09-04", "2013-12-19", "2007-10-10", "2008-09-19")
This worked both locally and on shinyapps.io. Thus, the problem is not with your program, but with how the dates are handled.
I thought the problem could be due to leading zeros required for single-digit dates, but with a change that doesn't fix the problem. However, when I replaced the month names with double-digit numbers, it again worked both locally and on shinyapps.io. Therefore, it seems that shinyapps.io has some difficulty converting month names to date values. However, I do not know why this will happen.
Update : Following the leader provided by Fereshteh Karimeddini , I changed the files by entering the following code: In server.R:
output$dates = renderText({format(num_date, format = "%d %B %Y")}) output$location = renderText({Sys.getlocale(category = "LC_ALL")})
In ui.R:
textOutput("dates") textOutput("location")
Interestingly, I got exactly the same results for outputting "dates", regardless of whether I was running locally or on shinyapps.io. I thought I would get the monthly names in French or something else. However, for the output of "location" I had different results. Locally:
LC_COLLATE = English_United States. 1252;
LC_CTYPE = English_United States. 1252;
LC_MONETARY = English_United States. 1252;
LC_NUMERIC = C;
LC_TIME = English_United States. 125
On shinyapps.io:
LC_CTYPE = C.UTF-8;
LC_NUMERIC = C;
LC_TIME = C.UTF-8;
LC_COLLATE = C.UTF-8;
LC_MONETARY = C.UTF-8;
LC_MESSAGES = C.UTF-8;
LC_PAPER = C.UTF-8;
Lc_name = C;
LC_ADDRESS = C;
LC_TELEPHONE = C;
LC_MEASUREMENT = C.UTF-8;
LC_IDENTIFICATION = C
Note: carriages have been added for readability.
There was an error report on the debian forum (I don’t know the relationship with Ubuntu, which uses shinyapps.io) that C.UTF-8 does not contain monthly names. However, this has been since 2012, and the bug report said that it was fixed in a recent release. In addition, if the C.UTF-8 language on shinyapps.io really did not have the names of the months, then it should not have displayed the names of the months (which was done perfectly). It made me wonder if he can give out the names of the months, why can't he read the monthly names? So I tried to get this to do just that. In server.R:
text_date = c("09 03 2006") num_date <- as.Date(text_date, format = "%d %m %Y") x = format(num_date, format = "%d %B %Y") output$dates = renderText({x}) renum_date = as.Date(x, format = "%d %B %Y") output$redates = renderText({format(renum_date, format = "%d %B %Y")})
In ui.R:
sidebarPanel(textOutput("dates")), mainPanel(textOutput("redates"))
Locally, sidebarPanel and mainPanel showed exactly the same thing: March 9, 2006. However, on shinyapps.io, mainPanel showed NA. Thus, it would seem that shinyapps.io can wash it, but cannot accept it, at least until the names of the months disappear. How strange is that?