getStdAndMeanFunctions
creates an average function multifunctionality index.
getStdAndMeanFunctions(data, vars, standardizeFunction = standardizeUnitScale)
A data frame with functions.
The column names of the functions to be assessed.
A function to standardize each individual
function to the same scale, such as standardizeUnitScale
or
standardizeZScore
Returns a data frame with standardized values for each function and an averaged index.
iterates over all functions and standardizes them between 0 and 1. Then it creates an averaged multifunctionality index by averaging over all standardized functions
data(all_biodepth)
allVars <- qw(biomassY3, root3, N.g.m2, light3, N.Soil, wood3, cotton3)
germany <- subset(all_biodepth, all_biodepth$location == "Germany")
vars <- whichVars(germany, allVars)
# re-normalize N.Soil so that everything is on the same
# sign-scale (e.g. the maximum level of a function is
# the "best" function)
germany$N.Soil <- -1 * germany$N.Soil + max(germany$N.Soil, na.rm = TRUE)
germany <- cbind(germany, getStdAndMeanFunctions(germany, vars))