Figure 1: Evolution of the

Weaving process PDF

R includes a powerful and flexible system (Sweave) for creating dynamic reports and reproducible research using LaTeX. Sweave enables the embedding of R code within LaTeX documents to generate a PDF file that includes narrative and analysis, graphics, code, and the results of computations.

To use Sweave and knitr to create PDF reports, you will need to have LaTeX installed on your system. LaTeX can be installed following the directions on the LaTeX project page.

Creating a New Document

To start a new Sweave document, go to File | New and select "R Sweave". This will provide a basic Sweave template. From here, you can enter text and LaTeX commands. R chunks can also be inserted to interweave R commands and output into your document. To insert an R chunk, use the Chunks menu at the top right of the source editor.

You can compile the Sweave document into a PDF using the Compile PDF button on the toolbar. Note that for reproducibility purposes, this compile runs in a separate process and environment (rather than using the current workspace). This is to ensure the script will always produce the same result and not be effected by (or pollute) your regular R environment.

PDF Preview and SyncTeX

  • Click on a line of code within a source file to navigate the PDF viewer to the corresponding location in the PDF.
  • Click on a location within a PDF file to open the source editor to the corresponding line of source code.

RStudio includes a built-in PDF viewer that natively supports SyncTeX. On some platforms RStudio also integrates with a native PDF viewer that supports SyncTeX (the default PDF previewing configuration on each platform is described below). For additional information on SyncTeX, see the documentation on

Customizing LaTeX Options

The RStudio Compile PDF command typesets the current TeX or Rnw source file into a PDF. There are a number of options you can specify to control this process, the most important of which is which LaTeX program you want to use for typesetting. See the Customizing LaTeX Options documentation for additional details.

Spell Checking

Spell checking is available for Rnw files. To check your document, click the spell checking icon on the source editor toolbar. Alternatively you can select "Check Spelling..." off the Edit menu. The shortcut key is F7. For additional information on language dictionaries and spell checking, see the Spelling Dictionaries documentation.

Working with Multiple Rnw Files

In some cases you may wish to break a larger Sweave document into multiple Rnw input files. To support this RStudio allows for the specification of a root Rnw file that is always used as the target for PDF compilation. The root file can be specified on a per-file or per-project basis. RStudio also uses the concordance file generated by Sweave to ensure that both Synctex and TeX error log navigation work correctly in the presence of multiple Rnw files. For more information, see the Working with Multiple Rnw Files documentation.

Share this article

Related Posts

Weaving process
Weaving process
What is weaving process?
What is weaving process?
Textile weaving process
Textile weaving process

Latest Posts
Cheetah Print Upholstery Fabric
Cheetah Print…
Leopard Print Fabric - Leopard Print…
Stretch Brocade Fabric
Stretch Brocade…
Synopsis: Designs with best practices…
Yellow Brocade Fabric
Yellow Brocade…
Silk Crepe De Chine Solid Fabric,good…
Light Blue Brocade Fabric
Light Blue Brocade…
1+ ideas about Brokatstoff on Pinterest…
China textile industry Statistics
China textile…
According to the newly released World…
Featured posts
  • Weaving process
  • What is weaving process?
  • Textile weaving process
  • Types of Textile printing PDF
  • Twill weaving patterns
  • Brocade Weaving
  •  Methodology for organization operations optimization within the powerful design for organization processes enhancement
  • Textile industry production process
  • Printing process in textile industry
Copyright © 2024 l All rights reserved.