0

Is there a way to only run only part of a script in R? For instance, give the following example saved in Myfile.R

x <- rnorm(10)
y <- rnorm(10)
plot(x, y)
plot(x, y*y)

source('Myfile.R') from within R will execute everything (the same does Rscript 'Myfile.R' in the terminal) but is there a way to run, say, the first three lines of the script only?

Saurabh Chauhan
  • 3,161
  • 2
  • 19
  • 46

0 Answers0