Sorry I don't have a reproducible example yet, as my script is already quite complex, but here is a description what it is doing: Basically it it imports some files, does some calculations and rearrangements on the data and generates some tables that are exported. In the end it will generate some plots.
Step 1:
input1 = read.csv(rawfile1)
table1 = reactive(input1) %>% some calculations %>% write.csv(export1)
table2 = reactive(Input1) %>% some other calculations %>% write.csv(export2)
Step 2:
input2 = read.csv(rawfile2)
table3 = reactive(input2) %>% some calculations --> write.csv(export3)
table4 = reactive(input1) + some calculations with reactive(input2)
table5 = reactive(table4)
%>% some transformations --> write.csv(export4)
%>% some more transformations --> write.csv(export5)
plot1 = reactive(table5)
Step3....
Then I have an UI with a navbar panel for Step1, Step2, etc, in each I have some tabsets to see the different outputs (renderdataTable, renderPlot, etc). The main purpose is to show the intermediate steps, to see that the processing went well and no problems occured.
So far everthing is working fine. But then I noticed that some of the intermediate steps are only called when I check the results in the UI. So for example when I click on the tab that renders the table2 - the table2 seems to be calculated and export2.csv is found in the results folder, but not when I jump directly to Step2 (because I know it works well as I loaded exactly the same file earlier)
Similarily export4 and 5 are created when I click on the tab that shows table4 or the one showing plot1, but then I may miss export3.csv
I started to work with shiny very recently, I can see that this might be not a bug, but a feature to distribute the calculation load to the time when the tables are needed.
But I expected the calculation in the background to be independent from showing the results in the UI?
Especially in this case I want the tables to be calculated in the background even if I don't click on each and every tab. Showing the intermediate steps is meant here for validation purposes.
Can I force to run all calculations at once?
Or can I define blocks of code that should be evaluated together, e.g. everything in step1 and everything in step2? But I think I need to generate different intermediate dataframes, as parts of these dataframes (e.g. numbers of entries in col. x, list of entries in col y) are used and combined in other parts of the script, so I need to be able to adress them independently.
Thanks in advance!
Matthias