Trigger a data refresh in shiny

0 votes

I have a shiny application that queries data from SQL into data frames, and then those data frames are referenced from my shinyServer() block. I've been running it only in RStudio thus far, and so whenever I needed new data I'd just restart the application and before the server loads it would grab all new data.

I'd like to transition the app to the shiny server, but I'm not sure how I can induce it to get new data periodically. For the sake of the interface, I'd like it to be automatic rather than have a user click a button to initiate the loading. Is there an idiomatic solution for this?

EDIT:

I think I found a solution that works for me.

shinyServer(function(input,output,session){
    sourceData <- reactive({
        invalidateLater(1000000,session)

        functionThatGetsData()
    })
})
May 30, 2018 in Data Analytics by DataKing99
• 8,130 points
933 views

1 answer to this question.

0 votes

You're looking for invalidateLater. Put this, with the appropriate interval, in the reactive expression that retrieves data from the database.

answered May 30, 2018 by darklord
• 6,140 points

Related Questions In Data Analytics

0 votes
1 answer
0 votes
1 answer

How to convert a list to data frame in R?

Let's assume your list of lists is ...READ MORE

answered Apr 12, 2018 in Data Analytics by nirvana
• 3,060 points

edited Apr 12, 2018 by nirvana 2,566 views
0 votes
1 answer

How can I drop columns by name in a data frame ?

We can Drop Columns by name in ...READ MORE

answered Apr 13, 2018 in Data Analytics by zombie
• 3,690 points
36 views
0 votes
1 answer

How to drop factor levels in a subsetted data frame?

You can use factor(ff) to drop levels ...READ MORE

answered Apr 17, 2018 in Data Analytics by kappa3010
• 2,020 points

edited Apr 17, 2018 by kappa3010 819 views
0 votes
1 answer

How to refresh shiny dataset?

When you refresh the page in the ...READ MORE

answered May 30, 2018 in Data Analytics by darklord
• 6,140 points
295 views
0 votes
0 answers

Shiny app - tabs refresh content

Shiny refresh or execute the r script ...READ MORE

Aug 1 in Data Analytics by asha
30 views
0 votes
1 answer

Big Data transformations with R

Dear Koushik, Hope you are doing great. You can ...READ MORE

answered Dec 17, 2017 in Data Analytics by Sudhir
• 1,610 points
47 views
0 votes
2 answers

Transforming a key/value string into distinct rows in R

We would start off by loading the ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,550 points
63 views
0 votes
2 answers

How to sort a data frame by columns in R?

You can use dplyr function arrange() like ...READ MORE

answered Aug 21 in Data Analytics by anonymous
• 25,900 points
121 views
0 votes
2 answers

How to remove rows with missing values (NAs) in a data frame?

Hi, The below code returns rows without ...READ MORE

answered Aug 20 in Data Analytics by anonymous
• 25,900 points
4,524 views