tr.cont.fspace {mFD}R Documentation

Build a functional space based on continuous traits only

Description

This function computes a functional space based on continuous standardized traits or continuous raw traits matrix. User can either choose to compute functional space based on PCA analysis or using one trait for one functional axis. For PCA analysis, center and scale arguments are considered FALSE: if you want to center, scale or standardize by any mean your data, please use tr.cont.scale function. Option makes it possible to compute correlation between traits.

Usage

tr.cont.fspace(
  sp_tr,
  pca = TRUE,
  nb_dim = 7,
  scaling = "scale_center",
  compute_corr = "pearson"
)

Arguments

sp_tr

a data frame of traits values (columns) for each species (rows). Note that species names must be specified in the row names and traits must be continuous (raw or standardized).

pca

a logical value. If TRUE a PCA analysis is computed, elsewhere the functional space is computed with one trait for each dimension. Default is TRUE.

nb_dim

an integer referring to the maximum number of dimensions for multidimensional functional spaces. Final number of dimensions depends on the number of positive eigenvalues obtained with the PCA. High value for nb_dim can increase computation time. Default is nb_dim = 7.

scaling

a string value to compute (or not) scaling of traits using the tr.cont.scale function. Possible options are: range (standardize by the range), center (use the center transformation: x' = x - mean(x)), scale (use the scale transformation: x' = \frac{x}{sd(x)}), scale_center (use the scale-center transformation: x' = \frac{x - mean(x)}{sd(x)}), or no_scale Default is scale_center.

compute_corr

a string value to compute Pearson correlation coefficients between traits (compute_corr = 'pearson'). You can choose not to compute correlation coefficient by setting compute_corr to none.

Value

A list containing a matrix with mAD and mSD values for each functional space to assess the quality of functional spaces), a matrix containing eigenvalues for each axis, the percentage of variance explained by each axis and the cumulative percentage of variance, a data frame containing species coordinates on each functional axis, list of distance matrices in the functional space (Euclidean distances based on trait values and coordinates in the functional spaces), a dist object containing initial euclidean distances based on traits and a matrix of correlation coefficients between traits (if required).

Author(s)

Camille Magneville and Sebastien Villeger

Examples

load(system.file('extdata', 'sp_tr_cestes_df', package = 'mFD'))

mFD::tr.cont.fspace(
    sp_tr        = sp_tr, 
    pca          = TRUE, 
    nb_dim       = 7, 
    scaling      = 'scale_center',
    compute_corr = 'pearson')

[Package mFD version 1.0.7 Index]