standardize: Standardize data

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/standardize.R

Description

Standardize each column of a data matrix and return the results as an object of class coords.

Usage

1
  standardize(x, compute.scores = TRUE)

Arguments

x

A data matrix, rows are observations, columns are variables.

compute.scores

Whether to compute the scores (i.e. x in the new basis).

Details

This function standardizes the columns of x by subtracting the mean of each column and then dividing by the standard deviation. The transformed data is stored in the $y field of the returned coords object.

If compute.scores is set to FALSE, only the information required for the toCoords() and fromCoords() to work is stored in the returned coords object; otherwise the scores (transformed data) will be stored in the $y field of the coords object.

Value

An object of class coords, with the following additional components added:

y

if compute.scores==TRUE, this is x expressed in the new basis

Author(s)

Jochen Voss <voss@seehuhn.de>

See Also

coords; alternative implementation scale

Examples

1
2
3
  w <- standardize(iris[, 1:4])
  colMeans(w$y)
  apply(w$y, 2, sd)

jvcoords documentation built on June 5, 2021, 5:06 p.m.