center: Create a column of centered variables

View source: R/center.R

centerR Documentation

Create a column of centered variables

Description

This function centers a variable around the mean. To create z-scores, specify 'standardize=TRUE' A new column will be created with the centered values. There is also the option to center within context.

Usage

center(
  x,
  variables = c(colnames(x)),
  standardize = FALSE,
  drop = FALSE,
  suffix = NULL
)

Arguments

x

dataframe

variables

c() of columns to standardize

standardize

Logical. Do you want to calculate zscores? (Default = FALSE)

drop

Drop original non-centered variables

suffix

Suffix to add at the end of the column names. Default = NULL


dr-JT/datawrangling documentation built on June 25, 2022, 7:47 p.m.