# Use apa.table function with a minimum of parameters
# Specify statistics
example <- data.frame(
c("Column 1", "Column 2", "Column 3"),
c(3.45, 5.21, 2.64),
c(1.23, 1.06, 1.12)
)
# Create table
apa.table(data = example, level1.header = c("Variable", "M", "SD"))
# Create a table with two headers
# Specify statistics
example <- data.frame(
c("Column 1", "Column 2", "Column 3"),
c(3.45, 5.21, 2.64),
c(1.23, 1.06, 1.12),
c(8.22, 25.12, 30.27),
c("+", "**", "***")
)
# Run method and preview table
apa.table(
data = example,
level1.header = c("", "Descriptives", "Inferential"),
level1.colspan = c(1, 2, 2),
level2.header = c("Variable", "M", "SD", "t-value", "*")
)$table
Run the code above in your browser using DataLab