Reload data on page refresh

831 views
Skip to first unread message

Cory N

unread,
Jun 27, 2013, 4:11:33 PM6/27/13
to shiny-...@googlegroups.com
I run a refresh script and load my data in my server.R file... https://github.com/corynissen/cook-county-tweet-dashboard/blob/master/cctweets/server.R

I also put in a button to refresh the data on command. This works.

The problem is that when I press the refresh button, my data file (data.Rdata) is in fact refreshed and the web page reflects the changes. But, if I refresh the whole page using the browser refresh button, it reverts back to the older data. data.Rdata is still up to date, however. 

So, how should I configure my server.R file such that on refresh or first page load, it updates the data.Rdata file and loads the new data?

Thanks for your help.

cn
Message has been deleted

Joe Cheng

unread,
Jul 18, 2013, 12:59:53 PM7/18/13
to shiny-...@googlegroups.com
Ack, no! There are very few occasions where you should programmatically touch restart.txt.

In this case you just want to move the two lines that load your data to be inside your server function. It's this function that executes each time the page loads. You might also consider doing load("data.Rdata", envir=.GlobalEnv) if the data should be the same for everyone.


On Thu, Jul 18, 2013 at 8:52 AM, <gregd...@gmail.com> wrote:
Every time you update your data set, you should do a "touch appName/restart.txt". Then every new visit to the app (including a refresh) will "know" to re-load things from scratch, including the data.
--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages