normalize_to_range: Range normalization

View source: R/others.R

normalize_to_rangeR Documentation

Range normalization

Description

Normalize a vector, matrix or data.frame of numeric values in a specified range.

Usage

normalize_to_range(x, range = c(0, 1))

Arguments

x

vector, matrix or data.frame with at least two different elements

range

vector of two elements specifying the desired normalized range. Default value is c(0,1)

Value

the normalized data

Examples

vec = 1:10
normalize_to_range(vec)
normalize_to_range(vec, range = c(-1,1))

mat = matrix(c(0,2,1), ncol = 3, nrow = 4)
normalize_to_range(mat, range = c(-5,5))


usefun documentation built on Sept. 15, 2024, 1:06 a.m.