Learn R Programming

compositions (version 0.9-11)

scale: Normalizing datasets by centering and scaling

Description

The dataset is standardized by optional scaling and centering.

Usage

## S3 method for class 'acomp':
scale(x,center=TRUE, scale=TRUE)
## S3 method for class 'rcomp':
scale(x,center=TRUE, scale=TRUE)
## S3 method for class 'aplus':
scale(x,center=TRUE, scale=TRUE)
## S3 method for class 'rplus':
scale(x,center=TRUE, scale=TRUE)
## S3 method for class 'rmult':
scale(x,center=TRUE, scale=TRUE)

Arguments

x
a dataset or a single vector of some type
center
logical value
scale
logical value

Value

  • a vector or data matrix, as x and with the same class, but acordingly transformed.

Details

scaling is defined in various ways for the different data types. It is always performed as an operation in the enclosing vector space. Not in all cases an independent scaling of the different coordinates is appropriate. This is only done for rplus and rmult.

See Also

split{base}

Examples

Run this code
data(SimulatedAmounts)
  plot(scale(acomp(sa.groups)))
  plot(scale(rcomp(sa.groups)))
  plot(scale(aplus(sa.groups)))
  plot(scale(rplus(sa.groups)))
  plot(scale(rmult(sa.groups)))

Run the code above in your browser using DataLab