Data object not found when deploying shiny app

前端 未结 3 425
一生所求
一生所求 2021-01-05 04:27

I am working on my first shiny app and am running into an issue where the data that is used to render my data table is not being picked up by shinyapps.io.

The app

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-05 05:08

    Oh! I think it's that you're not loading the pitchers file as part of the ui.R script. So when you're defining the year input it's not able to find Pitchers$year. Can you try reading the pitchers file in the ui script above the shinyUI() call?

    Some stuff about data injest in shiny: If your data's not going to change regularly, you don't need your data-ingest to be reactive. Just put it at the very beginning of the server file before the shinyServer() call. That part of the code gets run just once, when you deploy the app so it's a good place to do any library() calls, data injest, or pre-processing stuff that doesn't depend upon the user in any way. You can just use read.csv() in the same was as you would in regular R, it's also sometimes good to save a binay of the dataframe because read.csv can be a bit slow.

    If it is going to change (like an updated csv is going to be put in the file regularly) then put the read.csv() call below the shinyServer() call but again shouldn't need to be reactive.

    Hope that helps!

提交回复
热议问题