knitr::opts_chunk$set(echo = TRUE)

Embed a plot

Here's an embedded plot

library(ggplot2)
ggplot(data = mpg, aes(x = drv, 
                       y = hwy, 
                       colour = drv)) + 
  geom_boxplot()

Embed a table

Here's an embedded table

library(BristolVis)
library(arsenal)
table_one <- tableby(diet ~ bmi + sex, 
                     data = bmi, 
                     test=TRUE, # include tests of associations between diet and exposures
                     total=TRUE, # include a total column
                     control=tableby.control(digits=1)) # to control how many decimal places are in the table
summary(table_one)

Inline R code

We included r nrow(bmi) people from the BMI dataset in our analyses. The mean BMI of people in this study was r round(mean(bmi$bmi), 1)kg/m^2^ (sd = r round(sd(bmi$bmi), 1)kg/m^2^).



statcourses/BristolVis documentation built on Jan. 31, 2021, 9:24 p.m.