This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
Markdown is technically a scripting language (really??)
italics and italics
bold and bold
superscript2
strikethrough
endash: –
emdash: —
ellipsis: …
inline equation: \(A = \pi*r^{2}\)
image:
horizontal rule (or slide break):
block quote
unordered list
ordered list
| Table Header | Second Header |
|---|---|
| Table Cell | Cell 2 |
| Cell 3 | Cell 4 |
Place code inline with a single back ticks. The first back tick must be followed by an R, like a=2,abd b=3 then a+b is equal to 5.
Add chunk options within braces. For example, echo=FALSE will prevent source code from being displayed, if eval=FALSE, knitr will not run the code in the code chunk:
## [1] "Hello World!"
If collapse=TRUE, knitr will collapse all the source and output blocks created by the chunk into a single block.
paste("Hello", "World!")
## [1] "Hello World!"
There are many other R code chunck options which may also be extermely helpful such as warnings. Google R Markdown Chunk option for more details
Couple of more examples from the RMarkdown default file in R studio:
str(cars)
## 'data.frame': 50 obs. of 2 variables:
## $ speed: num 4 4 7 7 8 9 10 10 10 11 ...
## $ dist : num 2 10 4 22 16 10 18 26 34 17 ...
You can also embed plots, for example:
Through markdown there is a functionality to create presentation embedding R code and LaTeX.
Here is one example I created for a project