rmarkdown
TLDR
Render R Markdown to HTML
$ Rscript -e "rmarkdown::render('[file.Rmd]')"
Render to PDF$ Rscript -e "rmarkdown::render('[file.Rmd]', output_format='pdf_document')"
Render to Word$ Rscript -e "rmarkdown::render('[file.Rmd]', output_format='word_document')"
Render with parameters$ Rscript -e "rmarkdown::render('[file.Rmd]', params=list(year=2024))"
SYNOPSIS
R Markdown document processing
DESCRIPTION
R Markdown combines R code with Markdown text to create dynamic documents. It can produce HTML, PDF, Word documents, presentations, dashboards, and more.
EXAMPLES
$ # In R
library(rmarkdown)
render("report.Rmd")
# Specify output
render("report.Rmd", output_format = "pdf_document")
# With parameters
render("report.Rmd", params = list(data = "sales.csv"))
library(rmarkdown)
render("report.Rmd")
# Specify output
render("report.Rmd", output_format = "pdf_document")
# With parameters
render("report.Rmd", params = list(data = "sales.csv"))
YAML HEADER
$ ---
title: "My Report"
author: "Name"
date: "`r Sys.Date()`"
output:
html_document:
toc: true
theme: united
---
title: "My Report"
author: "Name"
date: "`r Sys.Date()`"
output:
html_document:
toc: true
theme: united
---
CODE CHUNKS
$
knitr::opts_chunk$set(echo = TRUE)$
plot(cars)$
OUTPUT FORMATS
$ html_document
pdf_document (requires LaTeX)
word_document
ioslides_presentation
beamer_presentation
flexdashboard
pdf_document (requires LaTeX)
word_document
ioslides_presentation
beamer_presentation
flexdashboard
CAVEATS
Requires R and rmarkdown package. PDF needs LaTeX (tinytex). Processing can be slow.
HISTORY
R Markdown was developed by RStudio (now Posit) building on knitr by Yihui Xie.


