Scaling a data frame or matrix to [0, 1] or [-1, 1] ranges

Description

This program scales each column of a data frame or a matrix to [0,1] range, computing ((X)ij - (Xmin)i) / range((X)i) for each individual j of the variable i or to [-1,1] range computing 2 *((X)ij - (Xmin)i) / range((X)i) -1

Usage

1
aue.rescale(dfm, method = c("zero.one", "one.one"))

Arguments

dfm

Data frame, matrix or vector to scale.

method

Scaling method: "zero.one" for scaling to [0, 1], "one-one" for scaling to [-1,1].

Author(s)

Leandro Roser leandroroser@ege.fcen.uba.ar

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 

data(eco.test)
require(adegenet)
pc <- dudi.pca(eco[["P"]], scannf = FALSE, nf = 3)
pc <- pc$li
pc <- aue.rescale(pc)
plot(eco[["XY"]][, 1], eco[["XY"]][, 2], col = rgb(pc), pch = 16, 
cex = 1.5, xlab ="X", ylab= "Y")


## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.