Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
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

LaTeX


The workflow for building a LaTeX-based report is very similar to creating Markdown or HTML reports, but of course you need to know how to work with LaTeX. Create a new .Rnw file through File | New | R Sweave. RStudio will open a LaTeX template in the article document format. Code chunks are delimited by the <<>>=@ syntax (see the Code chunks section for options) and you can compile the .Rnw file to pdf via File | Compile pdf, by clicking on the PDF menu button on the file editor tab, or by hitting Ctrl + Shift + I. Inline R code should be enclosed in the \Sexp{} command. Here's a minimal example of a .Rnw file and its result:

\documentclass{article}
\begin{document}
One plus one according to \texttt{R}:
<<>>=
1+1
@
\end{document}

This results in the following pdf file:

The extensive example given in the section on Markdown is also available in a LaTeX version from the github repository, go to https://github.com/rstudiobook/abalone.git.

Tip

When creating slides with...

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}