[1] 0.32390743 0.06535182 -0.80656924 2.53931845 1.31392195 -0.45027681
[7] 0.05767462 0.91495836 1.44091161 2.16574114
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] 0.32390743 0.06535182 -0.80656924 2.53931845 1.31392195 -0.45027681
[7] 0.05767462 0.91495836 1.44091161 2.16574114
```{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