normalize: Normalize

Description Usage Arguments Value Examples

View source: R/scaling.R

Description

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

Usage

1
normalize(x, margin = 1L)

Arguments

x

numeric, matrix or dataframe input vector.

margin

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

Value

A normalized numeric or data.frame.

Examples

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

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

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

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