Embed a plot

Here’s an embedded plot

library(ggplot2)
ggplot(data = mpg, aes(x = drv, 
                       y = hwy, 
                       colour = drv)) + 
  geom_boxplot()
Miles per gallon by drive type

Miles per gallon by drive type

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)
0 (N=9) 1 (N=11) Total (N=20) p value
bmi 0.618
   Mean (SD) 30.7 (3.0) 30.2 (1.1) 30.4 (2.1)
   Range 25.0 - 33.3 28.0 - 31.8 25.0 - 33.3
sex 0.423
   F 5 (55.6%) 8 (72.7%) 13 (65.0%)
   M 4 (44.4%) 3 (27.3%) 7 (35.0%)

Inline R code

We included 20 people from the BMI dataset in our analyses. The mean BMI of people in this study was 30.4kg/m2 (sd = 2.1kg/m2).