2026-03-31
There are a variety of ways to run R code:
Send code to the R prompt from a source editor, for example in RStudio
Rscript to run an R script (or code) from the command line
R CMD BATCH to run an R script from the command line when you’re feeling retro
source()
to run an R script from another R script or the R prompt
RStudio background jobs to run an R script in the background
callr package to run R code in a separate process