- https://yihui.org
- first language: Chinese
- second language: R (10 years)
- third language: English
May 30, 2014 @ Great Plains R-Users Group Conference
Please do that again! (sorry we made a mistake in the data, want to change a parameter, and yada yada)
i.e. computing languages + authoring languages
We built a linear regression model. ```{r} fit <- lm(dist ~ speed, data = cars) b <- coef(fit) plot(fit) ``` The slope of the regression is `r b[1]`.
an example
install.packages('knitr')
)\section{Introduction} We did a \emph{cool} study, and our main findings: \begin{enumerate} \item You can never remember how to escape backslashes. \item A dollar sign is \$, an ampersand \&, and a \textbackslash{}. \item How about ~? Use $\sim$. \end{enumerate}
# Introduction We did a _cool_ study, and our main findings: 1. You do not need to remember a lot of rules. 2. A dollar sign is $, an ampersand is &, and a backslash \. 3. A tilde is ~. Write content instead of markup languages.
LaTeX
Markdown
# headers
, > blockquotes
_emphasis_
- lists
[links](url)
![images](url)
We used to tell them "go to Pandoc".
Now we go to Pandoc and solve the problem directly.
$\sum_{i=1}^n \alpha_i$
= \(\sum_{i=1}^n \alpha_i\)raw HTML/LaTeX
<div class="my-class"> ![image](url) </div> _emphasis_ and \emph{emphasis}
^[A footnote here.]
citations [@joe2014]
can be used as a standalone package as well (require separate Pandoc installation)
library(rmarkdown) render('input.Rmd') render('input.Rmd', pdf_document()) render('input.Rmd', word_document()) render('input.Rmd', beamer_presentation()) render('input.Rmd', ioslides_presentation())
--- title: "Sample Document" output: html_document: toc: true theme: united ---
This is equivalent to:
rmarkdown::render('input.Rmd', html_document(toc = TRUE, theme = 'united'))
shiny::runExample('01_hello')
You have done the hard work of research, data collection, and analysis, etc. We hope the last step can be easier.