-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathBasic.Rmd
More file actions
65 lines (42 loc) · 1.47 KB
/
Basic.Rmd
File metadata and controls
65 lines (42 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
title: "Basic"
author: "EE Holmes"
output:
pdf_document: default
html_document: default
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents.
Reference sheets:
* In RStudio, click 'Help' menu and then 'Markdown Quick Reference'
* https://www.rstudio.com/wp-content/uploads/2015/03/rmarkdown-reference.pdf
## Knit
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.
## Adding code
You can embed an R code chunk like this:
```{r cars}
summary(cars)
```
## Including Plots
You can also embed plots, for example:
```{r pressure, echo=FALSE}
plot(pressure)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
## Hiding code
Sometimes you want to compute something and only show the finished calculation in your report.
```{r dontshow, echo=FALSE}
x <- mtcars$mpg
y <- mtcars$wt
y2 <- y^2
```
The values are stored and now I can reference them later.
```{r plot2}
plot(x, y2)
```
## Troubleshooting
The bit after `r` is a label. You can leave it blank but if you include, you cannot duplicate labels in your report.
Line feeds are important. If you are having trouble, make sure you have line feeds before and after headers and code.