[1] 1.12841984 0.03195549 -0.59306961 -0.73694361 0.22088117 -2.07956967
[7] -0.20294310 -1.56613168 0.74975957 0.18914804
2023-02-01
Only characters with no formatting
Viewable in text editor
Used for plain text storage (.txt
, .csv
) and coding (.R
, .Rmd
, .py
, .m
, .cpp
)
1s and 0s are converted to images, audio, formatted text
WSYIWYG
Binary document files: .docx
, .xlsx
, .pptx
, .pdf
, .png
, .jpg
Console
R scripts (.R
)
R Markdown files (.Rmd
)
Ctrl/Cmd+Enter
Ctrl/Cmd+Alt/Opt+B
Ctrl/Cmd+Alt/Opt+E
Ctrl/Cmd+Shift+S
Open course RStudio project.
Create new R script and save as test.R
.
Type library(palmerpenguins)
.
Is palmerpenguins
loaded? How can you check?
Run the line to load palmerpenguins
.
Type print(penguins)
.
Source the whole script.
Comment out the print(penguins)
line.
Source the script.
An article [. . . ] in a scientific publication is not the scholarship itself, it is merely advertising of the scholarship. The actual scholarship is the complete software development environment and the complete set of instructions which generated the figures — Buckheit & Donoho (1995)
Direct connection between computations and presentation
Updating presentation is a breeze
Transparent and reproducible
Plain text less corruptable
Easily create different kinds of output styles and files
Easily switch between different templates
Markdown uses HTML syntax for comments
<!-- comment here -->
`r `
The answer to 2 + 2 is `r 2 + 2`
The answer to 2 + 2 is 4.
```{r}
rnorm(10, mean = 0, sd = 1)
```
[1] 1.12841984 0.03195549 -0.59306961 -0.73694361 0.22088117 -2.07956967
[7] -0.20294310 -1.56613168 0.74975957 0.18914804
```{r}
plot(1:10, 2:11)
```
Create new R Markdown file.
Type “The mean of the first 9 digits is `r mean(1:9)`.
”
Knit/render the document.
Create a new code chunk.
Inside the code chunk, load the palmerpenguins
package and print the penguins
data set.
Run the code chunk without knitting the file.
Knit/render the file.
Comments
Comments are not executed by R