background preloader

R

Facebook Twitter

Code Externalization: Use an external R script with your document. You do not have to put the R code in the input document; with knitr, you can separate your input document with the R script (think the reverse of Stangle).

Code Externalization: Use an external R script with your document

There are several advantages of separating the main document with the R script(s), e.g., R code can be reusable across several documents, and you can run the R code continuously in a separate file (if you embed the code in the document, you often have to jump through texts); this feature is especially useful for LyX users, and it saves a huge amount of time since you do not have to re-compile the whole document to see the results; instead, you can tune your R code freely in another R session. The function read_chunk() was designed for this feature. For example, if the R code is in Stat579-HW8-Xie.R, you can use read_chunk('Stat579-HW8-Xie.R') to read the code into the input document in an early chunk. Note this function should only be used in an uncached chunk, e.g. <<external-code, cache=FALSE>>= read_chunk('foo-bar.R')@ Some examples:

Markdown Cheat Sheet - Writing content. Markdown is a wonderfully simple approach to creating web pages, written by John Gruber of Daring Fireball.

Markdown Cheat Sheet - Writing content

You get on with the business of writing (without any fancy code) and Markdown takes care of producing clean, web standards compliant HTML. The Daring Fireball site provides full documentation for Markdown, but the following examples should get you started. Section Headings You can define headings of different levels when creating a web page. The most important heading (which typically only occurs once on each page – at the top) is heading 1. To create a secondary heading (such as the one for this section) you just use two ’#’ characters, like so: You can use up to six ’#’ characters to create a level 6 heading, but you will probably find that you don’t need to nest your headings quite so deeply!

Paragraphs Paragraphs are very easy; separate them with a blank line. This section was marked up like so: Paragraphs are very easy; separate them with a blank line. Bold and Italics [Nesta CMS]( Knitr: Elegant, flexible and fast dynamic report generation with R. Overview The knitr package was designed to be a transparent engine for dynamic report generation with R, solve some long-standing problems in Sweave, and combine features in other add-on packages into one package (knitr ≈ Sweave + cacheSweave + pgfSweave + weaver + animation::saveLatex + R2HTML::RweaveHTML + highlight::HighlightWeaveLatex + 0.2 * brew + 0.1 * SweaveListingUtils + more).

knitr: Elegant, flexible and fast dynamic report generation with R

This package is developed on GitHub; for installation instructions and FAQ’s, see README. This website serves as the full documentation of knitr, and you can find the main manual, the graphics manual and other demos / examples here. For a more organized reference, see the knitr book. Motivation One of the difficulties with extending Sweave is we have to copy a large amount of code from the utils package (the file SweaveDrivers.R has more than 700 lines of R code), and this is what the two packages mentioned above have done. Features Acknowledgements. RでSVG素敵生活はじめませんか - sheephead.