Scoping rules in R markdown

There are scoping rules in Shiny.
I know the variables defined in Global.R will be stored in the memory and shared for all sessions/servers once R shiny app is running. For example, pulling data from SQL or reading data from csv file could be done in Global.R once, then being shared by all shiny sessions/servers.

I am just wondering what are the similar settings like Global.R for R markdown. I am using some shiny elements in R markdown report, and would like to have every users of the Rmarkdown report use the same data stored in the memory instead of reading the same data into the memory individually.

Note - I am using Rconnect for deployment.

There are some useful info in the Rmarkdown book

I think the scoping rules are the same. Any element calculated in the rmarkdown document outside the shiny will be available to all.

Especially, see shiny prerendered document and special chunk
https://rmarkdown.rstudio.com/authoring_shiny_prerendered.html#context=‘data’

Hope it helps !

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.