Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/mastifFunctions.R
Annotates treeData
for mastif
to include covariates.
1 2  mastClimate(file, plots, years, months, FUN = 'mean',
vname = '', lastYear = 2021)

file 

plots 

years 

months 

FUN 

vname 
name to use for a variable in the model that comes from 
lastYear 
last data year to include. 
The version of treeData
used in mastif
can have additional tree years included when there are seed trap years that were not censused or when AR(p) effects extend observations to impute the p years before and after a tree was observed. The function mastFillCensus
makes this version of treeData
available to the user. The function mastClimate
provides a quick way to add plotyear covariates to treeData
.
A covariate like minimum monthly temperature is stored in a plot
by year_month
format, where rownames
of file
are plot names matching treeData$plot
, and colnames
of file
could be 2012_1, 2012_2, ...
for the 12 months in the year. The numeric vector months
holds the months to be included in the annual values, e.g., c(3, 4)
for minimum winter temperatures during the period from March through April. To find the minimum for this period, set FUN
to 'min'
.
More detailed vignettes can be obtained with: browseVignettes('mastif')
A numeric vector
equal in length to the number of rows in treeData
that can be added as a column
and included in formulaFec
.
James S Clark, jimclark@duke.edu
Clark, J.S., C. Nunes, and B. Tomasek. 2019. Foodwebs based on unreliable foundations: spatiotemporal masting merged with consumer movement, storage, and diet. Ecological Monographs, e01381.
mastFillCensus
to fill tree census
mastif
for analysis
A more detailed vignette is can be obtained with:
website 'http://sites.nicholas.duke.edu/clarklab/code/'.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31  d < "https://github.com/jimclarkatduke/mast/blob/master/liriodendronExample.rData?raw=True"
repmis::source_data(d)
inputs < list( specNames = specNames, seedNames = seedNames,
treeData = treeData, seedData = seedData,
xytree = xytree, xytrap = xytrap)
# interpolate census, add years for AR(p) model
inputs < mastFillCensus(inputs, p = 3)
treeData < inputs$treeData #now includes additional years
# include minimum spring temperature of previous year
cfile < tempfile(fileext = '.csv')
d < "https://github.com/jimclarkatduke/mast/blob/master/tmin.csv?raw=True"
download.file(d, destfile=cfile)
tyears < treeData$year  1
tplots < treeData$plot
tmp < mastClimate( file = cfile, plots = tplots,
years = tyears, months = 1:4, FUN = 'min')
treeData$tminSprAnomaly < tmp$x[,3]
inputs$treeData < treeData
formulaRep < as.formula( ~ diam )
formulaFec < as.formula( ~ diam + tminSprAnomaly )
yearEffect < list(groups ='species', p = 3) # AR(3) model, species are lag groups
output < mastif(inputs = inputs, formulaFec, formulaRep,
yearEffect = yearEffect, ng = 2000, burnin = 1000)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.