centreAndScale: Centre and scale a dataframe.

View source: R/auxBiplot.R

centreAndScaleR Documentation

Centre and scale a dataframe.

Description

centreAndScale allows column-wise mean centring and standard-deviation scaling for a dataframe or matrix. The extra features of this function are the following:

Usage

centreAndScale(grid, centre, scale, message = TRUE)

Arguments

grid

dataframe or matrix.

centre

logical. If TRUE, then each column has its own mean subtracted

scale

logical. If TRUE, then each column is divided by its own standard deviation. If a column has zero standard deviation, then it is returned as is.

message

logical. If TRUE, then

Details

  • If a column has zero standard deviation, then scaling has no effect. A message is outputted to inform the user.

  • A dataframe may be provided with character columns. These are simply ignored for the purposes of centring and scaling.

  • A dataframe or a matrix may be provided. If the input was a matrix, then the output is also a matrix. If the input inherits from the dataframe class, then the output is a tibble.

Value

A tibble or a matrix, depending on whether grid inherited from the dataframe class or was a matrix.


MiguelRodo/ggboot documentation built on Nov. 9, 2023, 5:45 p.m.