View source: R/FE_exploratory.R
from.spfe.to.feasb | R Documentation |
This function computes an occurrence data frame with assemblages in rows and
Functional Entities (FEs) in columns, from the dataframe of
assemblage-species and the output of the mFD::sp.to.fe()
function.
from.spfe.to.feasb(sp_fe, asb_sp_w)
sp_fe |
list gathering to which FE belongs eac species. It is the output of the mFD::sp.to.fe() function - $sp_fe. |
asb_sp_w |
the assemblage * species data frame with assemblages being rows and species being columns |
an occurrence dataframe with studied FEs in columns and assemblages in rows. Be careful: It's an occurrence data frame, not an abundance one
Camille Magneville
# Load species traits data:
data("fruits_traits", package = "mFD")
# Transform species traits data:
# Only keep the first 4 traits to illustrate FEs:
fruits_traits <- fruits_traits[ , c(1:4)]
# Load trait types data:
data("fruits_traits_cat", package = "mFD")
# Transform the trait types data to only keep traits 1 - 4:
fruits_traits_cat <- fruits_traits_cat[c(1:4), ]
# Load Assemblages*Species matrix:
data('baskets_fruits_weights', package = 'mFD')
# Gather species into FEs:
## gathering species into FEs (FEs named according to the decreasing...
## ... number of species they gather):
sp_FEs_fruits <- mFD::sp.to.fe(
sp_tr = fruits_traits,
tr_cat = fruits_traits_cat,
fe_nm_type = "fe_rank")
# Get the list which gather to which FE belongs each species:
sp_fes_list <- sp_FEs_fruits$sp_fe
# Build the Assemblages*FEs data frame:
asb_fes <- mFD::from.spfe.to.feasb(sp_fe = sp_fes_list,
asb_sp_w = baskets_fruits_weights)
asb_fes
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.