简体   繁体   中英

Shinyapp not working on shinyapps.io like locally

I'm developing a R + Shiny application. Initially I load a dataset into my memory and slice it depending on the user's input dates.

For example: I download observations for the last 90 days. If the user chooses to see the last 20 days as diagram, I only update the slice of the dataframe the diagram is using for it's calculations.

I'm trying to accomplish this by finding the start-index and end-index of this date and slice accordingly.

startIndex <- grep(startDate, datesVector)
endIndex <- grep(endDate, datesVector)

print(startIndex)
print(endIndex)

data <- data[startIndex:endIndex, ]

Is just working fine locally on my machine. But running on shinyapps.io the print statement will return:

integer(0)
integer(0)

And my app will crash because it can't slice to 0:0. Do you have any advice why grep is behaving differently on these platforms?

[EDIT]: It seems like the conversion of dates from this format

Fri. 22 Aug. 2014

to this one

2014-08-22

with

datesVector <- as.Date(data$Date, "%a. %d %b. %Y")

is working in RStudio and my local browser. However it's not working on shinyapps.io and returning only NAs

Regards

There seems to be a problem with the way that shinyapps.io handles month names. It can take numerical month values and properly display the month name, but it cannot convert month names to numerical values. See more here .

Within the Shinyapps.io website, you can click on the application that you are running and click on "Logs" to get more specific details about what is causing the error.

Additionally, you can use:

shinyapps::showLogs() 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM