sr:run
sr:run R-statement sr:run R-statement anything...
Runs the given R statements in the current session. To make multi-line R code easier to run, this command will take multiple strings, each of which will be interpreted as a separate line of R code. This requires putting the command in parentheses.
For instance:
(sr:run
"domain <- seq(-3.14, 3.14, 0.01)"
"range <- sin(domain)"
"png('my_file.png')"
"plot(domain, range, "
" pch = 20,"
" main = 'y = sin(x)',"
" xlab = 'x',"
" ylab = 'y')"
"dev.off()"
)
sr:run
will wait for the statements to finish before continuing. If you have long-running R code, NetLogo may freeze for a bit while it runs.
Take me to the full Simple R Extension Dictionary