

Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!


learn more at rmarkdown.rstudio.com
input - file to render output_format output_options - List of render options (as in YAML) output_file output_dir params - list of params to use envir - environment to evaluate code chunks in encoding - of input file
RStudio® is a trademark of RStudio, Inc. • CC BY RStudio • [email protected] • 844-448-1212 • rstudio.com More cheat sheets at http://www.rstudio.com/resources/cheatsheets/ Learn more at rmarkdown.rstudio.com • RStudio IDE 0.99.879 • Updated: 02/1 6
Rmd
Modify chunk options Run all previous chunks Run current chunk Insert code chunk Go to code chunk Run code chunk(s) Set preview location Open in window Save Find and replace
Use the wizard that opens to pre-populate the file with a template
Spell Check Publish Show outline
Reload document Find in document File path to output document Synch publish button to accounts at
Optional section of render (e.g. pandoc) options written as key:value pairs (YAML).
Narration formatted with markdown, mixed with:
Chunks of embedded code. Each chunk:
***** Your report will rendered as a Shiny app, which means you must choose an html output format, like html_document, and serve it with an active R Session.
output: html_document runtime: shiny
numericInput("n", "How many cars?", 5) renderTable({ head(cars, input$n) })Embed a complete app into your document with shiny:: shinyAppDir()
Insert with r. Results appear as text without code. Built with r getRversion()
Set with knitr:: opts_chunk$set() , e.g.
knitr::opts_chunk$set(echo = TRUE) getRversion()One or more lines surrounded with {r}** and **. Place chunk options within curly braces, after r. Insert with
params: n: 100 d: !r Sys.Date()
Today’s date is r params$d
Indent 2 spaces Options not listed above: R.options, aniopts, autodep, background, cache.comments, cache.lazy, cache.rebuild, cache.vars, dev, dev.args, dpi, engine.opts, engine.path, fig.asp, fig.env, fig.ext, fig.keep, fig.lp, fig.path, fig.pos, fig.process, fig.retina, fig.scap, fig.show, fig.showtext, fig.subcap, interval, out.extra, out.height, out.width, prompt, purl, ref.label, render, size, split, tidy.opts
RStudio® is a trademark of RStudio, Inc. • CC BY RStudio • [email protected] • 844-448-1212 • rstudio.com More cheat sheets at http://www.rstudio.com/resources/cheatsheets/
Plain text End a line with two spaces to start a new paragraph. italics and bold verbatim code sub/superscript^2^~2~ strikethrough escaped: * _ \ endash: --, emdash: --- equation: $A = \pi*r^{2}$ equation block: $$E = mc^{2}$$ > block quote
\textbf{Tex ignored in HTML} HTML ignored in pdfs
link Jump to Header 1 image:
A footnote [1]
(^1) file (optional) in the YAML header
2
3^ of document
Smith cited [@smith04]. Smith cited without author [-@smith04]. @smith04 cited in line.
bibliography: refs.bib csl: style.csl
1
2
template.yaml Write with syntax on the left to create effect on right (after render)
data <- faithful[1:4, ]
print(xtable:: **xtable(** data, caption = "Table with xtable" **)** , type = "html", html.table.attributes = "border=0")) stargazer:: **stargazer(** data, type = "html", title = "Table with stargazer" **)** knitr:: **kable(** data, caption = "Table with kable" **)**sub-option description citation_package The LaTeX package to process citations, natbib, biblatex or none X X X code_folding Let readers to toggle the display of R code, "none", "hide", or "show" X colortheme Beamer color theme to use X css CSS file to use to style document X X X dev Graphics device to use for figure output (e.g. "png") X X X X X X X duration Add a countdown timer (in minutes) to footer of slides X fig_caption Should figures be rendered with captions? X X X X X X X fig_height, fig_width (^) Default figure height and width (in inches) for document X X X X X X X X X X highlight Syntax highlighting:^ "tango",^ "pygments",^ "kate","zenburn",^ "textmate"^ X X X X X includes File of content to place in document^ (in_header, before_body, after_body)^ X X X X X X X X incremental Should bullets appear one at a time (on presenter mouse clicks)? X X X keep_md Save a copy of .md file that contains knitr output X X X X X X keep_tex Save a copy of .tex file that contains knitr output X X latex_engine Engine to render latex, "pdflatex", "xelatex", or "lualatex" X X lib_dir Directory of dependency files to use (Bootstrap, MathJax, etc.) X X X mathjax Set to local or a URL to use a local/URL version of MathJax to render X X X md_extensions Markdown extensions to add to default definition or R Markdown X X X X X X X X X X number_sections Add section numbering to headers X X pandoc_args Additional arguments to pass to Pandoc X X X X X X X X X X preserve_yaml Preserve YAML front matter in final document? X reference_docx docx file whose styles should be copied when producing docx output X self_contained Embed dependencies into the doc X X X slide_level The lowest heading level that defines individual slides X smaller Use the smaller font size in the presentation? X smart Convert straight quotes to curly, dashes to em-dashes, … to ellipses, etc. X X X template Pandoc template to use when rendering file X X X X X theme Bootswatch or Beamer theme to use for page X X toc Add a table of contents at start of document X X X X X X X toc_depth The lowest level of headings to add to table of contents X X X X X X toc_float Float the table of contents to the left of the main content X html^ pdf word^ odt^ rtf^ md ioslides slidy beamer Options not listed: extra_dependencies, fig_crop, fig_retina, font_adjustment, font_theme, footer, logo, html_preview, reference_odt, transition, variant, widescreen When you render, R Markdown
output: html_document: code_folding: hide toc_float: TRUE
Indent 2 spaces Indent 4 spaces
text 1
text 2
html tabsets gituhb Learn more in the stargazer, xtable , and knitr packages. Learn more at rmarkdown.rstudio.com • RStudio IDE 0.99.879 • Updated: 02/1 6
Here is the footnote. ↩