Returns an S7 object that contains a list of column_format objects that can be used to format parameters in APA style.
Usage
column_formats(
.data = NULL,
accuracy = NULL,
labels = character(0),
custom_columns = NULL,
variable_labels,
intercept_text,
starred_columns
)Arguments
- .data
list of
column_formatobjects- accuracy
rounding accuracy of the formatters (e.g.,
.01for two decimals). IfNULL(default), theaccuracyset withapa7_defaults().- labels
named character vector of variable labels, named by the variables (e.g.,
c(parental_income = "Parental Income", n_siblings = "Number of Siblings")), as inapa_descriptives()andapa_chisq(). Reserved for a future version, in which these labels will be the defaultlabelsof every table function. For now, they are stored in thelabelsproperty, and no table function uses them; passlabelstoapa_descriptives()orapa_chisq()instead.- custom_columns
named list of
column_format()objects that are added, or that replace the formats of the same name- variable_labels
deprecated; use
labels, with the variables as the names and the labels as the values- intercept_text, starred_columns
deprecated, and never used. Set the label of the intercept row for all tables with
apa7_defaults(intercept_text = ), and the columns that get stars with thestarredargument of each table function.
Details
Each column_format() in the list is named by the column it formats.
Formats are read, added, replaced, and removed with $ (e.g.,
my_formats$beta, my_formats$Predictor <- column_format("Predictor"), or
my_formats$beta <- NULL), and the properties of a single format are read
and changed with @ (e.g., my_formats$p@header). The get_ properties
listed under Slots return the names, headers, formatters, and so on of all
the formats at once (e.g., my_formats@get_tibble).
Use the object with the column_formats argument of apa_flextable(),
apa_format_columns(), and the table functions, or set it for every table
with apa7_defaults(column_formats = my_formats).
Slots
get_column_namesgetter for column names
get_headersgetter for column headers
get_latexgetter for column latex headers
get_formattersgetter for column formatters
get_header_renamegetter for column names with headers as names
get_header_rename_latexgetter for column names with latex headers as names
get_tibblegetter for tibble with column names, headers, latex headers, and formatters
get_abbreviationsgetter for the abbreviations defined by the column formats, as a character vector of definitions named by the term defined
Examples
my_formats <- column_formats()
my_formats$Coefficient@formatter <- \(x) round(x, 2)
my_formats$Coefficient@formatter(2.214)
#> [1] 2.21