Be able to insert an R code chunk, and show the output in the rendered document.
macro for quick insert
2+2
[1] 4
mac - “option-command-i” windows - Ctrl-Alt-I
Running R code chunks in a qmd
pressing play
copy/paste into console
highlight then command-enter (mac)
precedence issues (first to last)
Be aware of R code chunk options, and how to use eval, messages, error, warning, and echo.
hist(mtcars$mpg)
"b"+5
Error in "b" + 5: non-numeric argument to binary operator
library(dplyr)
hist(mtcars$mpg)
Be able to set code chunk options per chunk, and/or for the whole document. Understand rules for precedence (which options will apply if both are set.)
Yes! Use execute in top-level yml, chunk options have precedence over global options.
Write inline r code.
2
a <-54b <-100c <- a+b
The value of c is 154.
Explain how the rendering environment is different from the Rstudio environment.
c <- a+bc
[1] 154
Be aware of more advanced quarto options for html documents, and try some of the options.