Learn R Programming

RPMG (version 2.2-2)

RESCALE: Rescale a vector to fit in a certain range

Description

Rescale a vector to fit in a certain range

Usage

RESCALE(x, nx1=0, nx2=1, minx=0, maxx=1)

Arguments

x

vector

nx1

new minimum

nx2

new maximum

minx

old min

maxx

old max

Value

Scale version of x vector is returned.

Details

Rescaling a vector, mostly used for graphics. If x does not vary, i.e. it is constant or minx and max are identical, the mean value of nx1 and nx2 is returned.

Examples

Run this code
# NOT RUN {
x = rnorm(10)
RESCALE(x, 3, 9, min(x), max(x) )
# }

Run the code above in your browser using DataLab