standardize: Standardize

Description Usage Arguments Value Examples

View source: R/scaling.R

Description

Currently implemented for numeric vectors, numeric matrices and data.frame standardization.

Usage

1
standardize(x, margin = 1L)

Arguments

x

numeric, matrix or dataframe input vector.

margin

1 - standardize by rows and 2 - standardize by columns. Default is 1.

Value

A standardize numeric or data.frame.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
df <- data.frame("V1" = 1:3, "V2" = 3:5, "V3" = 5:7)
standardize(df, margin = 1L)
standardize(df, margin = 2L)

m <- matrix(c(1,2,3,3,4,5,5,6,7), ncol = 3, byrow = FALSE)
standardize(m, margin = 1L)
standardize(m, margin = 2L)

v <- c(1, 3, 5)
standardize(v)

AnderEhu/sme documentation built on Jan. 31, 2022, 12:01 a.m.