R/PRE_FATE.speciesClustering_step3.R
PRE_FATE.speciesClustering_step3.RdThis script is designed to calculate PFG traits values based on determinant species traits values. Either the mean or the median is used depending on the trait class (i.e. numeric or categorical).
PRE_FATE.speciesClustering_step3(mat.traits, opt.mat.PA = NULL)a data.frame with at least 3 columns :
speciesthe ID of each determinant species (see
PRE_FATE.speciesClustering_step2)
PFGthe corresponding Plant Functional Group (see
PRE_FATE.speciesClustering_step2)
...one column for each functional trait (see
Details)
(optional) default NULL.
a data.frame with sites in rows and species in columns,
containing either NA, 0 or 1 (see
PRE_FATE.selectDominant)
A list containing one or two data.frame with the
following columns, and one list with as many ggplot2 objects
as functional traits given in mat.traits :
PFGthe concerned plant functional group
no.speciesthe number of species contained in this PFG
...one column for each functional trait, computed as the
mean (for numeric traits) or the median (for categorical
traits) of the values of the determinant species of this PFG
table containing counts of presences for all PFG (sites in rows, PFG in columns)
...one for each functional trait, 'specific' cases
excepted (see
Details)
The information is written in PRE_FATE_PFG_TABLE_traits.csv,
PRE_FATE_PFG_TABLE_sitesXPFG_PA.csv and
PRE_FATE_CLUSTERING_STEP_3_PFGtraitsValues.pdf files.
This .csv file can be used to build parameter files to run a
FATE simulation (e.g. PRE_FATE.params_PFGsuccession).
This function allows to obtain 'average' functional trait
values for each Plant Functional Group, based on values at the determinant
species level.
A graphic is automatically produced for each functional
trait given, with boxplot representing the values of determinant species,
and colored points the values calculated for each PFG.
However, some traits can have 'specific' representation, as long as their
names within mat.traits match one of the configuration detailed
below :
maturity, longevityto visualize the difference
between these two values, for the maturity time has an impact on the
fecundity of the PFG within FATE (see
CORE module)
If there is NO values for longevity within one PFG, and some
maturity values are available, some values might be inferred as
\(\text{maturity} * 2\). If there is NO values for maturity within
one PFG, and some longevity values are available, some values might be
inferred as \(\text{longevity} / 2\).
height, lightto visualize the PFG light
preference, and help decide and understand the choice of the height
limits of strata in FATE (see
LIGHT
interaction module)
soil_contrib, soil_tol_min, soil_tol_maxto visualize the PFG soil preference, and help
parameterize the global parameters of the soil interaction module
within FATE (see
SOIL
interaction module)
soil_contrib, soil_tolerancesame as the
previous one, but soil_tol_min and soil_tol_max values
are obtained by adding or removing soil_tolerance to
soil_contrib
If a sites x species table is provided (opt.mat.PA), a sites x PFG
table (containing NA, 0 or 1) is also returned.
## Load example data
Champsaur_PFG = .loadData('Champsaur_PFG', 'RData')
## Species traits
tab.traits = Champsaur_PFG$sp.traits
str(tab.traits)
## Determinant species
tab.PFG = Champsaur_PFG$PFG.species
str(tab.PFG)
## Merge traits and PFG informations
mat.traits = merge(tab.PFG[which(tab.PFG$DETERMINANT==TRUE), c('species','PFG')]
, tab.traits
, by = 'species', all.x = TRUE)
str(mat.traits)
## Keep only traits of interest
mat.traits = mat.traits[, c('PFG', 'species', 'MATURITY', 'LONGEVITY'
, 'HEIGHT', 'LIGHT', 'DISPERSAL'
, 'NITROGEN', 'NITROGEN_TOLERANCE', 'LDMC', 'LNC')]
colnames(mat.traits) = c('PFG', 'species', 'maturity', 'longevity'
, 'height', 'light', 'dispersal'
, 'soil_contrib', 'soil_tolerance', 'LDMC', 'LNC')
mat.traits$soil_contrib = as.numeric(mat.traits$soil_contrib)
mat.traits$soil_tolerance = ifelse(mat.traits$soil_tolerance == 1, 0.5, 1)
## Compute traits per PFG : with one specific graphic ------------------------
PFG.traits = PRE_FATE.speciesClustering_step3(mat.traits = mat.traits)
names(PFG.traits)
str(PFG.traits$tab.PFG.traits)
str(PFG.traits$tab.PFG.PA)
names(PFG.traits$plot)
plot(PFG.traits$plot$maturity_longevity)
plot(PFG.traits$plot$height_light)
plot(PFG.traits$plot$soil)