gower_traits: Transforms a traits matrix to conform to Gower dissimilarity...

View source: R/gower_traits.R

gower_traitsR Documentation

Transforms a traits matrix to conform to Gower dissimilarity calculations

Description

Creates dummy variables for multi-level factor/character traits, binary variables for bi-level factor/character traits and scales all variables by their range. Furthermore this function supplies weights, which are inversely proportional to the number of dummy variables created for a given trait.

Usage

gower_traits(x, hasNames = F, NA.tolerance = 0.25)

Arguments

x

numeric matrix. Species-trait matrix.

hasNames

a logical. Does the first column contain species names/codes?

NA.tolerance

a number between 0 and 1. Subset species which have a lower proportion of missing traits than 'NA.tolerance'.

Value

a list which includes the transformed trait table and the weights for each column in the table.

Details

This functions performs automatic transformations of a trait-matrix/-table, to "Gower variables". This means that the variables are appropriate for usage in Gower Dissimilarity calculations, without further transformations. Combined with the weights, which are also automatically calculated, and in conjunction with the function "gowerDissimilarity" (also found in this package), this makes the calculation of diverse Gower Dissimilarities for all other purposes than pairwise dissimilarities, much easier than what was previously available in R.


asgersvenning/bachelor documentation built on May 2, 2023, 7:06 a.m.