Learn R Programming

liminal (version 0.1.2)

clamp: Rescale all columns of a matrix

Description

Rescale all columns of a matrix

Usage

clamp(.data)

clamp_robust(.data)

clamp_sd(.data, sd = 1)

clamp_standardize(.data, sd = 1)

Arguments

.data

A numeric matrix

sd

the value of each columns standard deviation (default is 1)

Value

A matrix with the same dimension as .data where each column has been rescaled.

Details

These functions are used internally by the tour to rescale all columns of .data.

  • clamp() rescales so all values for each column lie in the unit interval

  • clamp_robust() rescales by first centering by the median and then scaling by the median absolute deviation.

  • clamp_sd() rescales all columns to have a fixed standard deviation.

  • clamp_standardize() rescales all columns to have zero mean and unit variance.

Examples

Run this code
# NOT RUN {
mv <- matrix(rnorm(30), ncol = 3)

clamp(mv)

clamp_robust(mv)

clamp_sd(mv)

clamp_standardize(mv)
# }

Run the code above in your browser using DataLab