# 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), ]
# Gather species into FEs:
## gathering species into FEs (FEs named according to the decreasing...
## ... number of species they gather):
sp_FEs <- mFD::sp.to.fe(
sp_tr = fruits_traits,
tr_cat = fruits_traits_cat,
fe_nm_type = "fe_rank")
## display FEs names:
sp_FEs$fe_nm
## display for each species the name of the FE it belongs to:
sp_FEs$sp_fe
## display trait values for each FE:
sp_FEs$fe_tr
## display the number of species per FEs:
sp_FEs$fe_nb_sp
Run the code above in your browser using DataLab