I have been using shinyAce as an editor in a shiny app where users can enter R-markdown or R-code and run it (as least when the app is installed locally). ShinyAce allows you to select chunks of code and you can use this to only evaluate the selected lines of code. I use knitr to evaluate the code and print the output. This works fine unless data/variables were defined in a previously evaluate chunk of code. To illustrate, if the lines below are selected together you get `3` as the result. However, if you run the first and second line separately you of course get `Error in print(x) : object 'x' not found`.
So here is the is the question: Is there an option for knitr to 'remember' values from previously executed lines of code. I am not looking for cache = TRUE. That would work if you are rerunning the *same* lines of code. I looking for something similar to executing lines of code one-by-one in, for example, R-studio.
You can see the app here:
https://vnijs.shinyapps.io/marketing/ (go to R > Code). Unfortunately you cannot evaluate code on the server so if you want to see this working you will have to install locally with the command below.