MF2_multiple | R Documentation |
MF2_multiple
computes alpha, beta and gamma multifuctionality measures of orders q = 0, 1 and 2 for given function weights in multiple ecosystems separately for two cases
(i) correlations between functions are not corrected for, and (ii) correlations between functions are corrected for. Species alpha, beta and gamma diversity of orders q = 0, 1, and 2 will also
be computed if species abundance data are provided.
MF2_multiple(
func_data,
species_data = NULL,
weight = 1,
q = c(0, 1, 2),
by_group = NULL,
by_pair = TRUE
)
func_data |
ecosystem function data should be input as a data.frame (ecosystems by functions for multiple ecosystems). All function values must be normalized between 0 and 1. |
species_data |
species abundance data should be input as a data.frame and must include three columns: "plotID", "species" and "abundance". Default is |
weight |
a constant number (if all weights are equal) or a numerical vector specifying weights for ecosystem functions.
In the latter case, the length of |
q |
a numerical vector specifying the multifunctionality and diversity orders. Default is q = 0, 1 and 2. |
by_group |
the column name of the stratifying variable that is used to group data for performing decomposition.
For example, if |
by_pair |
a logical variable specifying whether to perform multifunctionality decomposition for all pairs of ecosystems or not. If |
a data.frame with columns "plotID" (combinations of plot pairs, if calculating not by pairs, then there is no such column), "Order.q" , "Type" (corr_uncorrected or corr_corrected) , "Scale" (gamma, alpha or beta) and "qMF" (multifunctionality of order q).
When by_group
is not NULL
(i.e., the column name of the stratifying variable is specified),
an additional column with stratification variable (e.g., "country" of the plot pairs) is also shown after the plotID column. For species_data
is not NULL
,
the data.frame will show an additional column contain "Species.diversity" in the last column.
library(dplyr)
### Use data from plots in five countries (data in Finland are excluded) to decompose MF
### for all pairs of plots
data("forest_function_data_normalized")
data("forest_biodiversity_data")
forest_function_data_normalized <- filter(forest_function_data_normalized, country != "FIN")
forest_biodiversity_data <- forest_biodiversity_data[-(1:48),]
MF2_multiple(func_data = forest_function_data_normalized[,6:32],
species_data = forest_biodiversity_data,
weight = 1,
by_group = "country")
### Use partial data to quickly obtain output
### (Take the first 18 plots in Germany and the last 18 plots in Italy)
### BF decomposition for all pairs of plots
data("forest_function_data_raw")
data("forest_biodiversity_data")
GER_ITA_forest_function_raw <- filter(forest_function_data_raw,
country=="GER"|country=="ITA")[c(1:18,57:74),]
GER_ITA_forest_function_normalized <- function_normalization(data = GER_ITA_forest_function_raw,
fun_cols = 6:31,
negative = c("soil_cn_ff_10","wue"),
by_group = "country")
GER_ITA_forest_biodiversity <- forest_biodiversity_data[c(49:82,181:229),]
MF2_multiple(func_data = GER_ITA_forest_function_normalized[,6:32],
species_data = GER_ITA_forest_biodiversity,
weight = 1,
by_group = "country")
### Use partial data to decompose multifunctionality based on 3 plots in each country, not by pairs
### (Take the first 3 plots in each country)
data("forest_function_data_raw")
data("forest_biodiversity_data")
forest_function_data_raw_3plots <- forest_function_data_raw[c(1:3,29:31,67:69,103:105,
146:148,174:176),]
forest_function_data_normalized_3plots <-
function_normalization(data = forest_function_data_raw_3plots,
fun_cols = 6:31,
negative = c("soil_cn_ff_10","wue"),
by_group = "country")
forest_biodiversity_data_3plots <-
forest_biodiversity_data[c(1:6,49:52,141:148,230:232,351:355,411:417),]
MF2_multiple(func_data = forest_function_data_normalized_3plots[,6:32],
species_data = forest_biodiversity_data_3plots,
weight = 1,
by_group = "country", by_pair = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.