Skip to content

Instantly share code, notes, and snippets.

@crsh
Created January 18, 2019 20:52
Show Gist options
  • Save crsh/0ef3cb0f397cdd687d9392400c27a7dd to your computer and use it in GitHub Desktop.
Save crsh/0ef3cb0f397cdd687d9392400c27a7dd to your computer and use it in GitHub Desktop.
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."
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment