scale_vector: Scale a vector

Description Usage Arguments Value Examples

View source: R/scale_vector.R

Description

From every element in a vector, subtract center and divide by scale.

Usage

1
scale_vector(y, center = mean, scale = sd)

Arguments

y

A numeric vector.

center

Either a function that computes center of data (such as mean) or a single numeric value.

scale

Either a function that computes variability of data (such as sd) or a single numeric value.

Value

The same object as y just with every element scaled

Examples

1
2
3
4
5
6
y <- 1:10
scale_vector(y)

scale_vector(y, center = median, scale = IQR)

scale_vector(y, center = 10, scale = 2)

GegznaV/BioStat documentation built on Aug. 14, 2020, 9:30 p.m.