year <- 2024
R
R
is an Interpreted LanguageR
interpreter that translates your codeR
involves functional programmingmean()
dplyr::summarize()
numeric objects (e.g., 2024
, 21.2
)
strings/character objects:
"Sam"
, "Male"
, "21"
)vector objects:
c("18", "23", "20")
)data frames:
ages <- c("18", "23", "20")
as.numeric(ages)
ages <- as.numeric(ages)
ages
[1] 18 23 20
mean(ageas.numeric(ages))
[1] 20.33333
RStudio
R
consoleR
consoleRStudio
Beyond the console
RStudio
R
R Markdown
R Markdown
Markdown is a lightweight markup language used for adding formatting elements to plain text text
R Markdown
is a markdown language create for R
and RStudio
Allows you to dress up text, embed and render code, reference hyperlinks, etc. within a written document
Libraries like {rmarkdown} and {knitr} help you build HTML
, pdf
, and Word
documents that update automatically with new data
R Markdown
Filefods24
my_first_markdown.Rmd
/fods24
R Markdown
FileMy name is X and the year I start learning R is Y.
*
**
***
```{r}
```
Windows: CLTR+ALT+I
Mac: COMMAND+ALT+I
year
```{r}
year <- 2024
```
```{r}
band <- "your favorite band"
state <- "the state in which you grew up"
name <- "your name"
```
R
R
The year is `r year`!
R
The year is `r year`!
The year is 2024!
R Markdown
File# About me
## My favorite band
### My favorite band from the 1990s
[message](url)
[cheatsheet](https://gabrielcook.xyz/fods24/cheatsheets/rmarkdown-2.0.pdf)
R Markdown
FilesHTML
pdf
Word
HTML
file my_first_markdown.html