Skip to content

Instantly share code, notes, and snippets.

View crsh's full-sized avatar

Frederik Aust crsh

View GitHub Profile
@crsh
crsh / variable_labels_apa_table.R
Created January 18, 2019 20:52
Use variable labels to italicize column headers with apa_table()
my_table <- data.frame(t(apply(cars, 2, function(x) # Create data
round(c(Mean = mean(x), SD = sd(x), Min = min(x), Max = max(x)), 2)
)))
variable_labels(my_table) <- c("Mean" = "$\\textit{Mean}$", "SD" = "$\\textit{SD}$")
apa_table(
my_table
, align = c("l", rep("r", 3))
, caption = "A summary table of the cars dataset."