Skip to contents

Format data columns

Usage

apa_format_columns(
  data,
  parameter_formatter = NULL,
  columns = NULL,
  rename_headers = TRUE,
  latex_headers = FALSE,
  format_separated_headers = TRUE,
  sep = "_",
  accuracy = NULL
)

Arguments

data

data set (data.frame or tibble)

parameter_formatter

apa_parameter_formatter object. If NULL, the current default formatter set with apa7_defaults() will be used.

columns

(optional) vector of columns to format

rename_headers

if TRUE, rename headers with markdown or latex

latex_headers

if TRUE, rename headers with latex instead of markdown

format_separated_headers

if TRUE, format headers with separated names. For example, if the formatter formats column R2 as *R*^2^, then Model 1_R2 becomes Model 1_*R*^2^)

sep

separator for separated headers (default is "_")

accuracy

numeric (default: NULL, uses the current default accuracy set with apa7_defaults()). If not NULL, sets the accuracy for the formatter.

Value

tibble

Examples

lm(mpg ~ cyl + wt, data = mtcars) |>
  parameters::parameters() |>
  apa_format_columns() |>
  apa_flextable()

Variable

B

SE

95% CI

t

p

Constant

39.69

1.71

[36.18, 43.19]

23.14

<.001

Cyl

−1.51

0.41

[−2.36, −0.66]

−3.64

 .001

Wt

−3.19

0.76

[−4.74, −1.64]

−4.22

<.001