If you are reading this in HTML format, click here to see the original R markdown version, or to download it & view in a text editor.
Converting a R markdown file to HTML (or a different format, such as PDF) is called knitting. If we intend to knit this file to html (hypertext markdown to read in a web browser), we can use any applicable html tag, or their markdown equivalents.
However, we can also write in plain text sentences and paragraphs.
Whenever we want to show code, we can use the following markdown style:
This is a code chunk
However when we knit this markdown file, this will not be executed in R.
To write a code chunk that will be executed, we can use the following style:
##  5
Any function (other than interacting with plots, etc.) that we can realize in R, we can put in our markdown file & knit. For instance:
## Loading required package: ape
## Loading required package: maps
This includes reading and writing to file, although we must be sure that we are currently in the same directory as the file, or that we specify the full path to the file.
Code chunks that we do not want to evaluate we can write as follows:
library(devtools) install_github("liamrevell/phytools") ## install phytools from GitHub
To knit our file into .html we need to have the package knitr installed. Then we simply run:
substituting our own input & desired output filenames.
That's all there is to it.