Learn R Programming

imagefx (version 0.4.1)

range01: Scale Object Values Between Zero and One

Description

Force the minimum value and maximum value of an object to 0 and 1, respectively.

Usage

range01(x)

Arguments

x

Matrix, vector, or other R object.

Value

An object with same dimensions as x and whose values range between zero and one.

Examples

Run this code
# NOT RUN {
## generate a signal to normalize
sig <- 10*sin(2*pi*5*seq(0,1,by=0.001))

## normalize between 0 and 1
sig01 <- range01(sig)

## check the ranges
range(sig)
##[1] -10 10
range(sig01)
##[1] 0 1
# }

Run the code above in your browser using DataLab