O'Reilly logo

Data Analysis with R - Second Edition by Tony Fischetti

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Running R scripts

There are a few ways to run saved R scripts, like nothing.R. First - and this is RStudio-specific - is to click the button labeled Source (component h). This is roughly equivalent to highlighting the entire document and clicking Run.

Of course, we would like to run R scripts without being dependent on RStudio. One way to do this is to use the source function in the interactive R console: either RStudio's console, the console that ships with R from CRAN, or your operating system's command prompt running R. The source function takes a filename as it's first and only required argument. The filename specified will be executed, and when it's done, it will return you to the prompt with all the objects from the R script now in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required