library(dplyr)
# \donttest{
### 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)
Run the code above in your browser using DataLab