standard: Standardize variables.

View source: R/BAT.R

standardR Documentation

Standardize variables.

Description

Standardize (or normalize) variables in different ways.

Usage

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

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.

Value

A matrix with variables standardized.

Examples

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")

BAT documentation built on May 29, 2024, 7:35 a.m.

Related to standard in BAT...