##Multilevel ecological data series (MEDS) of tree-ring widths:
data(Prings05,envir = environment())
## Radial increments measured on 2003:
data(Pradii03,envir = environment())
## MEDS of monthly precipitation sums and average temperatures:
data(PTclim05,envir = environment())
##Time units in Prings05 object are sinchronized at tree level
##with 'rtimes' function:
dfm1 <- ringApply(Prings05,lv = 2,fn = 'rtimes')
str(dfm1)
##time units from time 1 to time 9:
subset(dfm1,time%in%c(1:9,NA))
## Cummulative radial increments are processed at 'sample' level:
dfm2 <- ringApply(dfm1,lv = 'sample',y = Pradii03,fn = 'scacum')
str(dfm2)
##Allometric modeling at 'sample' level:
dfm3 <- ringApply(dfm2,lv = 'sample',fn = 'amod',
MoreArgs = list(mp = c(1,1,0.25 * pi,2),
un = c('mm','m')))
str(dfm3)
## seasonal years from 'October' to 'September':
cl1 <- ringApply(PTclim05,lv = 'year',fn = 'moveYr')
tail(cl1,15)
##using ringApply() function to compute multilevel aridity indexes
##('wlai' function) at 'year' level:
wl <- ringApply(cl1,lv = 'year',fn = 'wlai')
str(wl)#only time units with 12 months are evaluated
## A plot of the modeled fluctuations of aridity
d <- groupedData(lmeForm(wl),wl)
plot(d)
Run the code above in your browser using DataLab