center_matrix: Simple function to center data

View source: R/transformations.R

center_matrixR Documentation

Simple function to center data

Description

Simple function to center data

Usage

center_matrix(mat, centers = NULL)

Arguments

mat

a transformed data matrix.

centers

a vector of centering values. Length must be equal to the number of columns in mat. If NULL (default) then centering values are determined by the function (see Details).

Details

Centering is done by means for continuous variables (i.e. more than 2 distinct values), and the minimum for binary variables.

It is assumed all categorical variables in the data are represented by binary dummy variables.

Value

Transformed data matrix. Has an attribute scaled:center that stores values used for centering.

Examples

mat = matrix(1:100, nrow = 10)
center_matrix(mat)


mfp2 documentation built on Nov. 15, 2023, 1:06 a.m.