aue.rescale: Scaling a data frame or matrix to [0, 1] or [-1, 1] ranges

Description Usage Arguments Author(s) Examples

View source: R/auxiliar.R

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 learoser@gmail.com

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)

EcoGenetics documentation built on July 8, 2020, 5:46 p.m.