How to Deal With Functional Entities"


1. Why Functional Entities (FEs)?


mFD allows gathering species into functional entities (FEs) i.e. groups of species with same trait values when many species are described with a few categorical or ordinal traits. It is particularly useful when using large datasets with "functionally similar" species. FEs also allow to understand the links between functional diversity and ecological processes as redundant species that are supposed to have similar ecological roles are clustered in this method.


2. Tutorial's data


DATA The dataset used to illustrate this tutorial is a fruits dataset based on 25 types of fruits (i.e. species) distributed in 10 fruit baskets (i.e. assemblages). Each fruit is characterized by six trait values summarized in the following table:


| Trait name | Trait measurement | Trait type | Number of classes | Classes code | Unit | |:-------------:|:------------------:|:-------------:|:-------------------:|:----------------------:|:-----:| | Size | Maximal diameter | Ordinal | 5 | small ; medium ; large | cm | | Plant | Growth form | Categorical | 4 | tree ; not tree | NA | | Climate | Climatic niche | Ordinal | 3 | temperate ; tropical | NA | | Seed | Seed type | Ordinal | 3 | none ; pip ; pit | NA |


NOTE We reduced the dataset used in mFD General Workflow to only keep ordinal and categorical traits. Categorical traits are restrained to 2 or 3 modalities per traits to limit the number of unique combinations.


The following data frame and matrix are needed:


data("fruits_traits", package = "mFD")

fruits_traits <- fruits_traits[ , 1:4]      # only keep the first 4 traits to illustrate FEs

# Decrease the number of modalities per trait for convenience ...
# ... (to have less unique combinations of trait values):

# Size grouped into only 3 categories:
fruits_traits[ , "Size"] <- as.character(fruits_traits[ , "Size"])

fruits_traits[which(fruits_traits[ , "Size"] %in% c("0-1cm", "1-3cm", "3-5cm")), "Size"] <- "small"
fruits_traits[which(fruits_traits[ , "Size"] == "5-10cm"), "Size"]  <- "medium"
fruits_traits[which(fruits_traits[ , "Size"] == "10-20cm"), "Size"] <- "large"

fruits_traits[ , "Size"] <- factor(fruits_traits[, "Size"], levels = c("small", "medium", "large"), ordered = TRUE)

# Plant type grouped into only 2 categories:
fruits_traits[ , "Plant"] <- as.character(fruits_traits[, "Plant"])

fruits_traits[which(fruits_traits[ , "Plant"] != "tree"), "Plant"] <- "Not_tree"
fruits_traits[ , "Plant"] <- factor(fruits_traits[ , "Plant"], levels = c("Not_tree", "tree"), ordered = TRUE)

# Plant Origin grouped into only 2 categories:
fruits_traits[ , "Climate"] <- as.character(fruits_traits[ , "Climate"])

fruits_traits[which(fruits_traits[ , "Climate"] != "temperate"), "Climate"] <- "tropical"
fruits_traits[ , "Climate"] <- factor(fruits_traits[, "Climate"], levels = c("temperate", "tropical"), ordered = TRUE)

# Display the table:
knitr::kable(head(fruits_traits), caption = "Species x traits dataframe based on *fruits* dataset")



data("baskets_fruits_weights", package = "mFD")

knitr::kable(as.data.frame(baskets_fruits_weights[1:6, 1:6]), 
             caption = "Species x assemblages dataframe based on *fruits* dataset")



data("fruits_traits_cat", package = "mFD")

# only keep traits 1 - 4:
fruits_traits_cat <- fruits_traits_cat[1:4, ]

knitr::kable(head(fruits_traits_cat), 
             caption = "Traits types based on *fruits & baskets* dataset")


Using the mFD::asb.sp.summary() function, we can sum up the assemblages data and retrieve species occurrence data:


# summarize species assemblages: 
asb_sp_fruits_summ <- mFD::asb.sp.summary(baskets_fruits_weights)

# retrieve species occurrences for the first 3 assemblages (fruits baskets):
head(asb_sp_fruits_summ$asb_sp_occ, 3)

asb_sp_fruits_occ <- asb_sp_fruits_summ$"asb_sp_occ"


3. Gather species into FEs


mFD allows you to gather species into FEs using the mFD::sp.to.fe() function. It uses the following arguments:


USAGE

mFD::sp.to.fe(
  sp_tr       = fruits_traits, 
  tr_cat      = fruits_traits_cat, 
  fe_nm_type  = "fe_rank", 
  check_input = TRUE) 


Let's use this function with the fruits dataset:


sp_to_fe_fruits <- mFD::sp.to.fe(
  sp_tr       = fruits_traits, 
  tr_cat      = fruits_traits_cat, 
  fe_nm_type  = "fe_rank", 
  check_input = TRUE) 


mFD::sp.to.fe() returns:

sp_to_fe_fruits$"fe_nm"


sp_fe <- sp_to_fe_fruits$"sp_fe"
sp_fe



fe_tr <- sp_to_fe_fruits$"fe_tr"
fe_tr



fe_nb_sp <- sp_to_fe_fruits$"fe_nb_sp"
fe_nb_sp



sp_to_fe_fruits$"details_fe"


4. Compute alpha and beta functional indices


Then based on the data frame containing the value of traits for each FE, the workflow is the same as the one listed in mFD General Workflow to compute functional trait based distance, multidimensional functional space and associated plots and compute alpha and beta functional indices (step 3 till the end). It will thus not be summed up in this tutorial.


mFD also allows to compute functional indices based on FEs following the framework proposed in Mouillot et al. 2014) using the mFD::alpha.fd.fe() function. It computes:


mFD::alpha.fd.fe() function is used as follows:


USAGE

mFD::alpha.fd.fe(
  asb_sp_occ       = asb_sp_fruits_occ, 
  sp_to_fe         = sp_to_fe_fruits,
  ind_nm           = c("fred", "fored", "fvuln"),
  check_input      = TRUE,
  details_returned = TRUE) 


It takes as inputs:


Let's apply this function with the fruits dataset:


alpha_fd_fe_fruits <- mFD::alpha.fd.fe(
  asb_sp_occ       = asb_sp_fruits_occ, 
  sp_to_fe         = sp_to_fe_fruits,
  ind_nm           = c("fred", "fored", "fvuln"),
  check_input      = TRUE,
  details_returned = TRUE) 


This function returns a dataframe of indices values for each assemblage and a detailed list containing a matrix gathering the number of species per FE in each assemblage:


# dataframe with indices values for each assemblage:
alpha_fd_fe_fruits$"asb_fdfe"

# a matrix gathering the number of species per FE in each assemblage
alpha_fd_fe_fruits$"details_fdfe"


5. Plot functional indices based on FEs


Then, it is possible to have a graphical representation of FE-based indices for a given assemblage using the mFD::alpha.fe.fd.plot() function:


USAGE

mFD::alpha.fd.fe.plot(
  alpha_fd_fe       = alpha_fd_fe_fruits,
  plot_asb_nm       = c("basket_1"),
  plot_ind_nm       = c("fred", "fored", "fvuln"),
  name_file         = NULL,
  color_fill_fored  = "darkolivegreen2",
  color_line_fred   = "darkolivegreen4",
  color_fill_bar    = "grey80",
  color_fill_fvuln  = "lightcoral",
  color_arrow_fvuln = "indianred4",
  size_line_fred    = 1.5,
  size_arrow_fvuln  = 1,
  check_input       = TRUE)


This function takes as inputs:


For the studied example, the plot looks as follows:


{r, fig.height = 7, fig.width = 12, fig.align = "center"} mFD::alpha.fd.fe.plot( alpha_fd_fe = alpha_fd_fe_fruits, plot_asb_nm = c("basket_1"), plot_ind_nm = c("fred", "fored", "fvuln"), name_file = NULL, color_fill_fored = "darkolivegreen2", color_line_fred = "darkolivegreen4", color_fill_bar = "grey80", color_fill_fvuln = "lightcoral", color_arrow_fvuln = "indianred4", size_line_fred = 1.5, size_arrow_fvuln = 1, check_input = TRUE)


All FE except "fe_3" contain only one species thus FRed and FVuln are close to 1. Only "fe_3" has more species than the average number of species thus the proportion of species in excess in FE richer than average is quite low (FORed = 0.107).


References




Try the mFD package in your browser

Any scripts or data that you put into this service are public.

mFD documentation built on May 29, 2024, 7:25 a.m.