yaml
yaml
---title: "The title of your document"name: "Your name"output: pdf_document---
yaml
---title: "The title of your document"name: "Your name"output: pdf_document fontsize: 12pt---
yaml
---title: "The title of your document"name: "Your name"output: pdf_document fontsize: 12ptlinestretch: 2---
```{r, echo = FALSE}library(knitr)opts_chunk$set(echo = FALSE)```
```{r, echo = FALSE}library(knitr)opts_chunk$set(echo = FALSE)```
```{r ref.label=knitr::all_labels(), echo = TRUE, eval = FALSE}```
```{r, echo = FALSE}library(knitr)opts_chunk$set(echo = FALSE, message = FALSE, warning = FALSE)```
R
, it will print in your output, even if you hide the code with echo = FALSE
. For example:glimpse(iris)
## Observations: 150## Variables: 5## $ Sepal.Length <dbl> 5.1, 4.9, 4.7, 4.6, 5.0, 5.4, 4.6, 5.0, 4.4, 4.9, 5…## $ Sepal.Width <dbl> 3.5, 3.0, 3.2, 3.1, 3.6, 3.9, 3.4, 3.4, 2.9, 3.1, 3…## $ Petal.Length <dbl> 1.4, 1.4, 1.3, 1.5, 1.4, 1.7, 1.4, 1.5, 1.4, 1.5, 1…## $ Petal.Width <dbl> 0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.3, 0.2, 0.2, 0.1, 0…## $ Species <fct> setosa, setosa, setosa, setosa, setosa, setosa, set…
R
, it will print in your output, even if you hide the code with echo = FALSE
. For example:glimpse(iris)
## Observations: 150## Variables: 5## $ Sepal.Length <dbl> 5.1, 4.9, 4.7, 4.6, 5.0, 5.4, 4.6, 5.0, 4.4, 4.9, 5…## $ Sepal.Width <dbl> 3.5, 3.0, 3.2, 3.1, 3.6, 3.9, 3.4, 3.4, 2.9, 3.1, 3…## $ Petal.Length <dbl> 1.4, 1.4, 1.3, 1.5, 1.4, 1.7, 1.4, 1.5, 1.4, 1.5, 1…## $ Petal.Width <dbl> 0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.3, 0.2, 0.2, 0.1, 0…## $ Species <fct> setosa, setosa, setosa, setosa, setosa, setosa, set…
results = "hide"
in the chunk options to hide it.```{r, results = "hide"}glimpse(iris)```
tidy()
and glance()
functions to print tables of our model output.tidy()
and glance()
functions to print tables of our model output.library(knitr)
kable()
function to output a pretty tablelibrary(knitr)lm(wt ~ am, data = mtcars) %>% tidy() %>% kable()
term | estimate | std.error | statistic | p.value |
---|---|---|---|---|
(Intercept) | 3.77 | 0.165 | 22.89 | 0 |
am | -1.36 | 0.258 | -5.26 | 0 |
library(knitr) lm(wt ~ am, data = mtcars) %>% tidy() %>% kable(caption = "Predicting Car's weight from transmission type")
term | estimate | std.error | statistic | p.value |
---|---|---|---|---|
(Intercept) | 3.77 | 0.165 | 22.89 | 0 |
am | -1.36 | 0.258 | -5.26 | 0 |
R
chunck that produces a Figure, you can caption it using the fig.cap
chunk option. For example:ggplot(mtcars, aes(x = mpg, y = disp)) + geom_point()
```{r, fig.cap = "Scatterplot of Miles per gallon by Displacement"}ggplot(mtcars, aes(x = mpg, y = disp)) + geom_point()```
R
objectsR
object, p
p <- ggplot(mtcars, aes(mpg, disp)) + geom_point()
R
object, p
p <- ggplot(mtcars, aes(mpg, disp)) + geom_point()
R
object, p
in a chunk at the beginning of your Appendix```{r, fig.cap = "Scatterplot of Miles per gallon by Displacement"}p```
citations.bib
file with citations, and then reference them using [@citation]
citations.bib
file in your RStudio projectcitations.bib
file in your RStudio projectcitations.bib
BibTex
, which is a certain way citations are saved in Latexcitations.bib
is going to be a file with multiple BibTex
entriesBibtex
entries from Google Scholar"
, click thatBibTex
, which is a certain way citations are saved in Latexcitations.bib
is going to be a file with multiple BibTex
entriesBibtex
entries from Google Scholar"
, click thatBibTex
on the bottomBibTex
, which is a certain way citations are saved in Latexcitations.bib
is going to be a file with multiple BibTex
entriesBibtex
entries from Google Scholar"
, click thatBibTex
on the bottomcitations.bib
file in RStudioroumie2017comparative
@article{roumie2017comparative, title={Comparative safety of sulfonylurea and metformin monotherapy on the risk of heart failure: a cohort study}, author={Roumie, Christianne L and Min, Jea Young and D'Agostino McGowan, Lucy and Presley, Caroline and Grijalva, Carlos G and Hackstadt, Amber J and Hung, Adriana M and Greevy, Robert A and Elasy, Tom and Griffin, Marie R}, journal={Journal of the American Heart Association}, volume={6}, number={4}, pages={e005379}, year={2017}, publisher={Am Heart Assoc}}
citations.bib
file to your yaml
---title: "The title of your document"name: "Your name"output: pdf_document fontsize: 12ptlinestretch: 2 bibliography: citations.bib---
citations.bib
file to your yaml
[@roumie2017comparative]
## References
BibTex
object here:http://www.citationmachine.net/bibtex/cite-a-website
print(citation("tidyverse"), bibtex = TRUE)
Make sure there is a reference *key, if not add one..small[
@Manual{, title = {tidyverse: Easily Install and Load the 'Tidyverse'}, author = {Hadley Wickham}, year = {2017}, note = {R package version 1.2.1}, url = {https://CRAN.R-project.org/package=tidyverse}, }
]
[@tidyverse]
and then cite the R packages you used.print(citation("tidyverse"), bibtex = TRUE)
.small[
@Manual{tidyverse, title = {tidyverse: Easily Install and Load the 'Tidyverse'}, author = {Hadley Wickham}, year = {2017}, note = {R package version 1.2.1}, url = {https://CRAN.R-project.org/package=tidyverse}, }
]
[@tidyverse; @broom]
and then cite the R packages you used.;
print(citation("broom"), bibtex = TRUE)
yaml
to include 12 pt font, double spacing, and a bibliographycitations.bib
fileyaml
Keyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
Number + Return | Go to specific slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
t | Restart the presentation timer |
?, h | Toggle this help |
Esc | Back to slideshow |