compositions (version 1.40-2)

scale: Normalizing datasets by centering and scaling

Description

The dataset is standardized by optional scaling and centering.

Usage

scale(x, center = TRUE, scale = TRUE,…)
# S3 method for default
scale(x,center=TRUE, scale=TRUE,…)
# S3 method for acomp
scale(x,center=TRUE, scale=TRUE,...,robust=getOption("robust"))
# S3 method for rcomp
scale(x,center=TRUE, scale=TRUE,...,robust=getOption("robust"))
# S3 method for aplus
scale(x,center=TRUE, scale=TRUE,...,robust=getOption("robust"))
# S3 method for rplus
scale(x,center=TRUE, scale=TRUE,...,robust=getOption("robust"))
# S3 method for rmult
scale(x,center=TRUE, scale=TRUE,...,robust=getOption("robust"))

Arguments

x

a dataset or a single vector of some type

center

logical value or the center to be substracted.

scale

logical value or a scaling factor to for multiplication.

robust

A robustness description. See robustnessInCompositions for details.

added for generic generality

Value

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

Details

scaling is defined in different ways for the different data types. It is always performed as an operation in the enclosing vector space. In all cases an independent scaling of the different coordinates is not always appropriate. This is only done for rplus and rmult geometries. The other three geometries are treated with a global scaling, keeping the relative variations of every part/amount.

The scaling factors can be a matrix (for cdt or idt space), a scalar, or for the r* geometries vector for scaling the entries individually. However scaling the entries individually does not make sense in the a* geometries. The operation achieve in the r*-geometries is indeed the centering of the a*-geometries.

See Also

split{base}

Examples

Run this code
# NOT RUN {
  data(SimulatedAmounts)
  plot(scale(acomp(sa.groups)))
  
# }
# NOT RUN {
plot(scale(rcomp(sa.groups)))
# }
# NOT RUN {
  plot(scale(aplus(sa.groups)))
  
# }
# NOT RUN {
plot(scale(rplus(sa.groups)))
# }
# NOT RUN {
  plot(scale(rmult(sa.groups)))

# }

Run the code above in your browser using DataLab