rstudio / learnr

Interactive Tutorials with R Markdown
https://pkgs.rstudio.com/learnr
Apache License 2.0
710 stars 240 forks source link

Using global environment to pass variables between code chunks #715

Open ethelpruss opened 2 years ago

ethelpruss commented 2 years ago

As I understand the code chunks being independent is a policy decision, however, for our application (student use during live statistics lectures) it is very limiting as we want students to see the results of their own code between different exercises not what we have hard-coded (which is what the setup chunks / chaines setup chunks currently allow for) and the exercises are complex enough that several different approaches with different output should be possible.

We did find a workaround to save variables in a global environment in local files using a checker function but this seems to not work once uploaded on shiny.io. In a previous thread about this it was mentioned that allowing passing variables between code chunks would not be technically difficult - would it then be possible to let me know how I can maybe modify / overwrite that bit of the learnr package's code for our project if there is still no interest in making this a generally available option?

beachemu commented 1 month ago

Any update on this? Have a very hacky solution that I would prefer not to use....