Text can decorated with bold or italics. It is also possible to
Be sure to put a space after the * when you are creating bullets and a space after # when creating section headers, but not between $ and the mathematical formulas.
If the code of an R chunk produces a plot, this plot can be displayed in the resulting file.
source("http://www.openintro.org/stat/data/arbuthnot.R")
plot(arbuthnot$girls)
Other forms of R output are also displayed as they are produced.
head(arbuthnot$girls)
## [1] 4683 4457 4102 4590 4839 4820
You can also use “chunk options” to modify how your R chunks work. We can hide the code:
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 2720 4460 5720 5530 7150 7780
Or we can hide the output:
summary(arbuthnot$girls)
In a similar vein, you can refer to R code in a paragraph by setting it off with single ticks, say if we wanted to mentioned that we had used the summary()
function. You can also put R output directly into text, as in: the mean number of births was 5534.6463.
This file can be knit to HTML, PDF, or Word. In RStudio, just select the desired output file type and click on Knit HTML
, Knit PDF
, or Knit Word
. Use the dropdown menu next to that to change the desired file type.
Please do not run the following code until the very end of class.