Set up the size of plots in the output

A few additional options: warning=FALSE and message=FALSE suppress any R warnings or messages from being included in the final document; fig.width=5, fig.height=4) set up the size of plots.

I. Headings: There are six levels of headings.

Header 1

Header 2

Header 3

Header 4

Header 5
Header 6

II. Emphasis

Italic Italic Bold Bold

III. Lists

  • Mean

  • Variance

  • SD

  • Mean

  • Variance

  • SD

  1. Mean
  2. Variance
  3. SD
  4. s.e.

V. Images

VI. Code Chunks: Import data and summarize data

tips <- read.csv("http://www.ggobi.org/book/data/tips.csv")
library(knitr)
kable(summary(tips))
obs totbill tip sex smoker day time size
Min. : 1.00 Min. : 3.07 Min. : 1.000 Length:244 Length:244 Length:244 Length:244 Min. :1.00
1st Qu.: 61.75 1st Qu.:13.35 1st Qu.: 2.000 Class :character Class :character Class :character Class :character 1st Qu.:2.00
Median :122.50 Median :17.80 Median : 2.900 Mode :character Mode :character Mode :character Mode :character Median :2.00
Mean :122.50 Mean :19.79 Mean : 2.998 NA NA NA NA Mean :2.57
3rd Qu.:183.25 3rd Qu.:24.13 3rd Qu.: 3.562 NA NA NA NA 3rd Qu.:3.00
Max. :244.00 Max. :50.81 Max. :10.000 NA NA NA NA Max. :6.00

VII. Including Plots

You can also embed plots, for example:

library(ggplot2)
p<-ggplot(data=tips,aes(smoker,fill=time))
p + geom_bar(width=0.5)

Note that the echo = FALSE parameter can be added to the code chunk to prevent printing of the R code that generated the plot. - Add bibliographies (Xie, Dervieux, and Riederer 2020). - Add bibliographies: R Core Team (2016).

References

R Core Team. 2016. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.
Xie, Yihui, Christophe Dervieux, and Emily Riederer. 2020. R Markdown Cookbook. Boca Raton, Florida: Chapman; Hall/CRC. https://bookdown.org/yihui/rmarkdown-cookbook.