ReScaling: Re-scales a set of continuous values into a new range using a...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/utils.R

Description

Function for normalizing the range of values of a continuous variable into a new interval using a linear scaling.

Usage

1
ReScaling(x, t.mn, t.mx, d.mn = min(x,na.rm=T), d.mx = max(x,na.rm=T))

Arguments

x

A vector with numeric values

t.mn

The minimum value in the new scale

t.mx

The maximum value in the new scale

d.mn

The minimum value of the continuous variable being normalized (defaults to the minimum of the values in x).

d.mx

The maximum value of the continuous variable being normalized (defaults to the maximum of the values in x).

Details

The re-scaling consist in transforming the value x into

sc*x + t.mn - sc*d.mn

where sc = (t.mx-t.mn)/(d.mx-d.mn)

Value

An object with the same dimensions as x but with the values normalized

Author(s)

Luis Torgo ltorgo@dcc.fc.up.pt

References

Torgo, L. (2010) Data Mining using R: learning with case studies, CRC Press (ISBN: 9781439810187).

http://www.dcc.fc.up.pt/~ltorgo/DataMiningWithR

See Also

scale, SoftMax, LinearScaling

Examples

1
2
3
## A simple example with the algae data set
summary(LinearScaling(algae[,'NO3']))
summary(ReScaling(LinearScaling(algae[,'NO3']),-10,10))

Example output

Loading required package: lattice
Loading required package: grid
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
0.00000 0.02732 0.05757 0.07089 0.09641 1.00000       2 
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
-10.000  -9.454  -8.849  -8.582  -8.072  10.000       2 

DMwR documentation built on May 1, 2019, 9:17 p.m.