Learn R Programming

BAT (version 2.9.6)

standard: Standardize variables.

Description

Standardize (or normalize) variables in different ways.

Usage

standard(trait, method = "standard", convert = NULL)

Value

A matrix with variables standardized.

Arguments

trait

A species x traits matrix or data.frame.

method

One of "standard" (standardize to mean = 0 and sd = 1, i.e., use z-score), "range" (rescale with range 0-1), or "rank" (rescale with range 0-1 after ranking).

convert

A vector of column numbers to be standardized. If NULL all will be standardized.

Details

Standardizing values allows to directly compare variables of interest with inherently different ranges, avoiding artificial distortions of distances between observations.

Examples

Run this code
trait = data.frame(body = c(20,40,60,30,10), beak = c(NA,4,6,3,1))
standard(trait)
standard(trait, method = "range")
standard(trait, method = "rank")

Run the code above in your browser using DataLab