calc_presenceabsence: Convert To Presence-Absence

View source: R/functional_dissimilarity.R

calc_presenceabsenceR Documentation

Convert To Presence-Absence

Description

Converts a continuous numeric vector into a presence- absence vector. Two methods can be chosen from : "max5" (Soliveres, 2016) and "quantile". The first calculates the mean of the top five values. From that new maximum, the threshold percentage is taken, e.g. if threshold = 0.5, half of the newly calculated maximum serves as threshold. All values higher than that new threshold are considered to be present (1) and all values below are considered to be absent (0). Limitation : is influenced by outliers, however for the use of multifunctionality, this makes sense, because it is possible that a given function is only present at high levels in very few plots, while all other plots show low levels. The "quantile" method takes the threshold-quantile, e.g. the 50 be present, all below are considered to be absent. Limitation: will always classify the same amount of values to be present than to be absent - inherent to quantile function.

Usage

calc_presenceabsence(x, threshold = 0.5, type = "max5")

Arguments

x

input vector

threshold

the threshold for calculation, between 0 and 1, e.g. 0.5

type

is either "max5" or "quantile". "max5" calculates the mean of the maximum 5 values, whereas "quantile" calculates the threshold - quantile.

Value

a vector of scaled values to be between 0 and 1.

Examples

x <- c(0,0.1,0.4,0.5,0.8,0.9,1)
calc_presenceabsence(x,treshold=0.3)


allanecology/multiFunBetadivLuiGDM documentation built on Nov. 12, 2023, 6:16 a.m.