View source: R/calcInteractionIntensity.r
The function uses the body mass in Kg of predator/consumer and prey/resources and the dimensionality of the interaction as source data,
then the interacion intensity is estimated with all the coeficients from 1 as
alpha is the search rate
the resource density,
mR the resource body mass and
mC the consumer body mass.
If available the resource density is not known (parameter
res_den) you must set the column to a less than 0 value; and it
will be estimated according to the equation S18 and supplementary figures 2i & j (individuals/m2 - m3)
calc_interaction_intensity(da, res_mm, res_den, con_mm, int_dim, nsims = 1)
data.frame with the interactions body mass and type of interaction dimensionality
name of the column with the resource body mass mean
name of the column with the resource density in Individuals/m^2 in 2D or m^3 in 3D. If lower than 0 it uses the previously mentioned estimation.
name of the column with the consumer body mass mean
name of the column with the interaction dimensionality
For detritus or sediment the resource mass mean is not known (parameter
res_mm) it must be set as negative;
and the resource body mass (kg) will be calculated using the equation S9 and supplementary figures 2c & d of the paper.
If the parameter 'nsims > 1 ' the function will estimate the variability on each interaction strength. It takes random values from a normal distribution with mean and standard deviation given by the Pawar's regressions for the slopes of allometric exponents.
A data.frame based on
da with the following fields added
res_mm<0 is the resource mass calculated with the equations from ref 1,
res_mm>0 duplicates the value of
xR: calculated resource density or the same value as in the input data.frame.
alfa: calculated search rate.
qRC: calculated trophic interaction strength as
mC is the consumer body mass.
Pawar, S., Dell, A. I., & Van M. Savage. (2012). Dimensionality of consumer search space drives trophic interaction strengths. Nature, 486, 485. https://doi.org/10.1038/nature11131
## Not run: g <- netData[] require(dplyr) # build the data.frame with random values set.seed(7815) da <- as_long_data_frame(g) %>% dplyr::select(from:to) %>% mutate(con_mm=rlnorm(n(),5,2),res_mm=con_mm - 30 ,int_dim=sample(c("2D","3D"),n(),replace=TRUE), res_den = -999) calc_interaction_intensity(da,res_mm,res_den,con_mm,int_dim, nsims=1) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.