Insert inline LaTex between dollar signs, e.g. \(\mu\). A great online equation editor for LaTex may be found at CodeCogs (https://latex.codecogs.com/eqneditor/editor.php)
Can insert LaTex on its own line between double dollar signs, e.g.
$$
$$
Text between double stars is bold. Bulleted Lists have a - in front
List item 1
List item 2
Add a new R code chunk by clicking the Insert Chunk button on the toolbar
head(cars)
## speed dist
## 1 4 2
## 2 4 10
## 3 7 4
## 4 7 22
## 5 8 16
## 6 9 10
If knitting to html, dataframes with many columns may be paged with rmarkdown:paged_table. Will not work with Word or PDF
#rmarkdown::paged_table(head(cars))
Dataframes in Word and PDF (as well at html) may be alternatively formatted with knitr::kable.
knitr::kable(head(cars))
| speed | dist |
|---|---|
| 4 | 2 |
| 4 | 10 |
| 7 | 4 |
| 7 | 22 |
| 8 | 16 |
| 9 | 10 |
Output may be displayed without code using echo=FALSE. This is not recommended unless you show the complete code at the end of the document.
## [1] 15.4
Graphics/Plots may be displayed as well
plot(cars)
dat <- data.frame(name = c("Frank","Bob","Sally","Susan","Joan"), age = c(34,28,19,28,30), BMI = c(24.2,18.3,15.4,22.7,29.2))
dat$name <- as.character(dat$name)
dat$log.age <- log(dat$age)
dat$BMI.sqrt <- sqrt(dat$BMI)
dat$smoking <- factor(c("yes","no","no","yes","yes"))
saveRDS(dat,"BMI,rds")
str(dat)
## 'data.frame': 5 obs. of 6 variables:
## $ name : chr "Frank" "Bob" "Sally" "Susan" ...
## $ age : num 34 28 19 28 30
## $ BMI : num 24.2 18.3 15.4 22.7 29.2
## $ log.age : num 3.53 3.33 2.94 3.33 3.4
## $ BMI.sqrt: num 4.92 4.28 3.92 4.76 5.4
## $ smoking : Factor w/ 2 levels "no","yes": 2 1 1 2 2
sampleparts <- "https://raw.githubusercontent.com/tmatis12/datafiles/main/diameter.csv"
dat5 <- read.csv(sampleparts)
dat5$log.dat5 <- log(dat5$Diameter)
write.csv(dat5,file = "diameter_log.csv")