I am using RStudio and I want to stop the execution of code on a specific line.
The functions are defined in the first script file and are called from the second.
I send the first file to the second using source("C:/R/script1.R")
I used the run from start to line: where I run the second script that has function calls, and highlighted the line in the first script where the function definitions are located.
Then I use browser() to view the variables. However, this is not ideal, as there are some large matrices. Is there a way to turn these variables into an RStudio workspace?
In addition, when I restart the use of run from line to end, it runs only until the end of the first script file called, it does not return to the calling function and does not shut down the second file.
How can I achieve these goals in RStudio?
Ok, here is a trivial example: the function adder is defined below in one script
adder<-function(a,b) { browser() return(a+b) }
I than the call from the second script
x=adder(3,4)
When the adder is called in the second script, it launches the browser () in the first. From here I can use get ("a") to get the value of a, but the values โโof a and b do not appear in the workspace in RStudio?
In this example, this does not really matter, but when you have several large matrices, it does.