Learn R Programming

apaStyle (version 0.3)

apa.descriptives: Generic method to generate an APA style table with descriptives for MS Word.

Description

Generic method to generate an APA style table with descriptives for MS Word.

Usage

apa.descriptives(data = data.frame(), variables = NULL, report = "", title = "APA Table", filename = "APA Table.docx", note = NULL, position = "lower", merge = FALSE, landscape = FALSE, save = TRUE)

Arguments

data
Raw dataset with variables.
variables
The variable names for in the table.
report
(optional) Specify which descriptive statistics to report. Use a subset from c("M", "SD", "r").
title
(optional) Name of the table.
filename
(optional) Specify the filename (including valid '.docx' extension).
note
(optional) Add a footnote to the bottom of the table.
position
(optional) Specify whether the correlations should be displayed in the upper, or lower diagonal of the table.
merge
(optional) Set (TRUE) if the mean and standard deviation columns should be merged into one column.
landscape
(optional) Set (TRUE) if the table should be generated in landscape mode.
save
(optional) Set (FALSE) if the table should not be saved in a document.

Value

apa.descriptives object; a list consisting of
succes
message in case of an error
save
flag which indicates whther the document is saved
data
dataset with descriptive statistics
table
FlexTable {ReporteRs} object

Examples

Run this code
# Use apa.descriptives function
apa.descriptives(
  data = data.frame(
    rnorm(100, mean = 0, sd = 1),
    rnorm(100, mean = 0, sd = 1),
    rnorm(100, mean = 0, sd = 1),
    rnorm(100, mean = 0, sd = 1)
  ),
  variables = c("Column 1", "Column 2", "Column 3", "Column 4")
)

Run the code above in your browser using DataLab