0

My question is really similar to below:

R shiny: display “loading…” message while table is being rendered

Sorry I don't have enough reputation to comment it so I create a new question. My Shiny page has a renderGvis() and a renderDataTable() to display a graph and a table. Because it has to load() a 5 million rows table first, it takes a while to show up. And I have to have something to show it is loading, otherwise the users might leave. I found above post very useful but the loading message disappear too fast. The gap between it disappears and the table shows up is about 20s.

Before I saw above post, I did try below methodology:

#server.R   firstData is a reactive function to get the data for 1st table
output$firstTable = reactive({
return(is.null(firstData()))
})
#ui.R
  conditionalPanel(
      condition = "output.firstTable",
      box(width = 12,
              h1("The data is loading..."))) 

However, it also disappears too fast. And I don't know the reason. Does anyone have any suggestions?

Thank you in advance.

Community
  • 1
  • 1
Z. Zhang
  • 501
  • 8
  • 20

1 Answers1

2

You may interested in withProgress i used this method in several app for big data loadings and long computations.

I used data loading in server function as:

stockdata<-withProgress(expr = {readRDS("sample.RDS")}
                        ,message = "Loading... Please wait")

http://shiny.rstudio.com/articles/progress.html

vck
  • 827
  • 5
  • 10
  • Thanks for your answer. Could you please explain more about how you used withProgress to wrap those big data loadings? Isn't it be outside the server function? Appreciate if you could share some sample codes. – Z. Zhang Feb 23 '16 at 17:34
  • @Z.Zhang i have added the lines i used – vck Feb 26 '16 at 08:36
  • thanks so so so much for your help. that's what I am looking for for a long time – Z. Zhang Feb 26 '16 at 19:25
  • could you please take a look this question? wondering if you have experience with it.http://stackoverflow.com/questions/35664657/r-shiny-optimize-page-loading-time-with-updateselectizeinput – Z. Zhang Feb 29 '16 at 23:35