Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learning RStudio for R Statistical Computing

You're reading from  Learning RStudio for R Statistical Computing

Product type Book
Published in Dec 2012
Publisher Packt
ISBN-13 9781782160601
Pages 126 pages
Edition 1st Edition
Languages
Concepts

Code execution


There are several ways to execute code in the script editing window. Most of them literally copy the lines with R script to the console window and execute them.

To execute the current line or selection use Ctrl+Enter. The previous command can be rerun using Ctrl+Shift+P.

Tip

Code completion of your code in the editor window will only work if the objects are available in your workspace. Make sure that you execute the assignment of objects in the editor.

Executing a script file line by line is tedious. So RStudio makes it easy to execute (or source) all the lines of a script file with Ctrl+Shift+Enter. This will copy all the lines to the console and execute them. The output of the script is printed in the console windows. Note that RStudio treats the execution of all the lines as one statement.

It is also possible to source the current file without printing statements in the console. This can be done with Ctrl+Shift+S . RStudio makes this even easier with the Source on Save option...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}