standardize_column_order: Standardize column order

View source: R/standardize_column_order.R

standardize_column_orderR Documentation

Standardize column order

Description

Standardizes order of columns for dataframes and other objects from easystats and broom ecosystem packages.

Usage

standardize_column_order(data, ...)

## S3 method for class 'parameters_model'
standardize_column_order(data, style = c("easystats", "broom"), ...)

Arguments

data

A data frame. In particular, objects from easystats package functions like parameters::model_parameters() or effectsize::effectsize() are accepted, but also data frames returned by broom::tidy() are valid objects.

...

Currently not used.

style

Standardization can either be based on the naming conventions from the easystats-project, or on broom's naming scheme.

Value

A data frame, with standardized column order.

Examples

# easystats conventions
df1 <- cbind.data.frame(
  CI_low      = -2.873,
  t           = 5.494,
  CI_high     = -1.088,
  p           = 0.00001,
  Parameter   = -1.980,
  CI          = 0.95,
  df          = 29.234,
  Method      = "Student's t-test"
)

standardize_column_order(df1, style = "easystats")

# broom conventions
df2 <- cbind.data.frame(
  conf.low   = -2.873,
  statistic  = 5.494,
  conf.high  = -1.088,
  p.value    = 0.00001,
  estimate   = -1.980,
  conf.level = 0.95,
  df         = 29.234,
  method     = "Student's t-test"
)

standardize_column_order(df2, style = "broom")

insight documentation built on Nov. 26, 2023, 5:08 p.m.