EcoGenetics (version 1.2.1-5)

aue.rescale: 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

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].

Examples

Run this code
# NOT RUN {
# }
# 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")

# }
# NOT RUN {
# }

Run the code above in your browser using DataCamp Workspace