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 chunks


In all of the markup systems supported by RStudio, chunks of R code can be embedded and executed. There are many options controlling how the code andits results are shown in the report, how resulting figures should be displayed, and so on.

Chunk syntax and options

Each markup system has its own syntax to distinguish R code from regular text, but in every system it is possible to label code chunks and to pass processing options. Both labeling and optioning are not mandatory and can be left out, so default settings will be used. The following is an overview of the code chunk denominators. You do not have to remember any of them; for each file type, the Chunks menu has the Insert chunk option.

RMarkdown: .Rmd files

Code chunks are indicated with triple backticks:

'''{r <label>, <option>=<value>,... }
# Your R code here
'''

Inline code is enclosed in single backticks:

'r <R code>'

Rhtml: .Rhtml files

Code chunks are indicated as special HTML comment sections:

<...
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}