Movatterモバイル変換


[0]ホーム

URL:


Encoding:UTF-8
Type:Package
Title:Dendrochronology Program Library in R
Version:1.7.8
Copyright:Authors and file inst/COPYRIGHTS
Depends:R (≥ 3.5.0)
Imports:graphics, grDevices, grid, stats, utils, lattice (≥ 0.13-6),Matrix (≥ 1.0-3), digest (≥ 0.2.3), matrixStats (≥ 0.50.2),png (≥ 0.1-2), R.utils (≥ 1.32.1), stringi (≥ 0.2-3),stringr (≥ 0.4), XML (≥ 2.1-0), signal, boot, lme4, lifecycle
Suggests:Cairo (≥ 1.5-0), dichromat (≥ 1.2-3), foreach, forecast (≥3.6), gmp (≥ 0.5-5), iterators, knitr, RColorBrewer,rmarkdown, testthat (≥ 0.8), tikzDevice, waveslim
Description:Perform tree-ring analyses such as detrending, chronology building, and cross dating. Read and write standard file formats used in dendrochronology.
LazyData:no
License:GPL-2 |GPL-3 [expanded from: GPL (≥ 2)]
URL:https://github.com/OpenDendro/dplR
NeedsCompilation:yes
Packaged:2025-01-30 01:42:40 UTC; andybunn
Author:Andy Bunn [aut, cph, cre, trl], Mikko Korpela [aut, cph, trl], Franco Biondi [aut, cph], Filipe Campelo [aut, cph], Stefan Klesse [aut, cph], Pierre Mérian [aut, cph], Fares Qeadan [aut, cph], Christian Zang [aut, cph], Allan Buras [ctb], Alice Cecile [ctb], Manfred Mudelsee [ctb], Michael Schulz [ctb], David Frank [ctb], Ronald Visser [ctb], Ed Cook [ctb], Kevin Anchukaitis [ctb]
Maintainer:Andy Bunn <bunna@wwu.edu>
Repository:CRAN
Date/Publication:2025-01-30 23:00:02 UTC

Dendrochronology Program Library inR

Description

This package contains functions for performing some standard tree-ringanalyses.

Details

Package: dplR
Type: Package
License:GPL (>= 2)

Main Functions

read.rwl

reads rwl files

detrend

detrends raw ring widths

chron

builds chronologies

corr.rwl.seg

crossdating function

Author(s)

Andy Bunnandy.bunn@wwu.edu with major additions from MikkoKorpela and other significant contributions from Franco Biondi, FilipeCampelo, Pierre Mérian, Fares Qeadan and ChristianZang. Functionredfit is an improved translation ofprogram REDFIT which is original work of Manfred Mudelsee and MichaelSchulz. Jacob Cecile contributed a bug fix todetrend.series. Allan Buras came up with the revisedformula ofglk in dplR >= 1.6.1.

References

Cook, E. R. and Kairiukstis, L. A., editors (1990)Methods ofDendrochronology: Applications in the Environmental Sciences.Springer.ISBN-13: 978-0-7923-0586-6.

Fritts, H. C. (2001)Tree Rings and Climate.Blackburn.ISBN-13: 978-1-930665-39-2.


Age-Dependent Spline

Description

Applies an age-dependent smoothing spline toy.

Usage

ads(y, nyrs0 = 50, pos.slope = TRUE)

Arguments

y

anumeric vector, typically a tree-ring series.

nyrs0

a number greater than one, affecting the rigidity of theinitial spline. A largernyrs0 produces a more rigid spline.

pos.slope

alogical flag. Will allow for a positiveslope at the end of fitted value. IfFALSE theline will be horizontal. See details.

Details

This implements the age-dependent smoothing spline similar to that described by Melvin (2004). In this implementation a cubic smoothing spline (caps) is fit toy with an initial stiffness ofnyrs0. For each succesive measurement, the siffness is incremented by that ring index. This results in a spline isnyrs0 flexible at the start of the series and grows progressively stiffer. This can help capture the initial fast growth of a juvinielle tree with a flexible spline that then progresses to a stiffer spline that can better model the constant growth commonly found in mature trees. In its details, the cubic smoothing spline follows the Cook and Peters (1981) spline with a 50% frequency cutoff. See Cook and Kairiukstis (1990) for more information.

The default setting fornyrs0 is 50 years which is approprite for trees with a classic growth model but a value of 10 or 20 might be more appropriate for a Hugershoff-like initial increase in growth. Cook (pers comm) suggests a value of 20 for RCS.

Ifpos.slope is TRUE, the function will attempt to prevent a postive slope at the end of the series. In some cases whenads is used for detrending, a postive slope can be considered considered biologically unlikely. In those cases, the user can contrain the positive slope in the slpine. This works by calculating the spline and taking the first difference. Then the function finds the last (outside) index where the spline changes slope and fixes the spline values from the that point to the end. Finally the spline is rerun along this contrained curve. See examples for details. The wisdom of contraining the slope in this manner depends very much on expert knowledge of the system.

Value

A filtered vector.

Author(s)

Fortran code provided by Ed Cook. Ported and adapted for dplR by Andy Bunn.

References

Cook, E. R. and Kairiukstis, L. A., editors (1990)Methods of Dendrochronology: Applications in the Environmental Sciences. Springer.ISBN-13: 978-0-7923-0586-6.

Melvin, T. M. (2004)Historical Growth Rates and Changing Climatic Sensitivity of Boreal Conifers. PhD Thesis, Climatic Research Unit, School of Environmental Sciences, University of East Anglia.

Cook, E. R. and Peters, K. (1981) The Smoothing Spline: A New Approach to Standardizing Forest Interior Tree-Ring Width Series for Dendroclimatic Studies. Tree-Ring Bulletin, 41, 45-53.

See Also

caps,detrend

Examples

# fit a curvedata(co021)aSeries <- na.omit(co021$`641114`)plot(aSeries,type="l",col="grey50")lines(ads(y = aSeries),col="blue",lwd=2)# show an artificial series with a Hugershoff-like curve.a <- 0.5b <- 1g <- 0.1d <- 0.25n <- 300x <- 1:ny <- I(a*x^b*exp(-g*x)+d)# add some noisey <- y + runif(n=length(y),min = 0,max = 0.5)# Plot with two different splines.plot(y,type="l",col="grey50")lines(ads(y,50),col="darkgreen",lwd=2) # badlines(ads(y,10),col="darkblue",lwd=2) # good# now repeat with a positive slope to constrainy <- I(a*x^b*exp(-g*x)+d)y[251:300] <- y[251:300] + seq(0,0.25,length.out=50)y <- y + runif(n=length(y),min = 0,max = 0.5)plot(y,type="l",col="grey50")lines(ads(y,10),col="darkgreen",lwd=2) #bad?lines(ads(y,10,pos.slope=FALSE),col="darkgreen",lwd=2,lty="dashed")

Rothenburg Tree Ring Widths

Description

This data set gives the raw ring widths for Norway sprucePiceaabies at Rothenburg ob der Tauber, Bavaria, Germany. There are 20series from 10 trees. Data set was created usingread.rwl and saved to an .rda file usingsave.

Usage

data(anos1)

Format

Adata.frame containing 20 tree-ring series from 10 treesin columns and 98 years in rows. The correct stc mask for use withread.ids isc(5, 2, 1).

References

Zang, C. (2010)Growth reaction of temperate forest tree speciesto summer drought – a multispecies tree-ring networkapproach. Ph.D. thesis, Technische UniversitätMünchen.


as.rwl

Description

Attempts to turn its argument into a rwl object.

Usage

as.rwl(x)

Arguments

x

adata.frame ormatrix with series as columns and years as rows

Details

This tries to coercex into classc("rwl","data.frame"). Failable.

Value

An object of classc("rwl", "data.frame") with the series incolumns and the years as rows. The seriesIDs are thecolumn names and the years are the row names.

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

Examples

library(graphics)library(stats)library(utils)## Toyn <- 100## Make a data.frame that is tree-ring likebase.series <- 0.75 + exp(-0.2 * 1:n)foo <- data.frame(x1 = base.series + abs(rnorm(n, 0, 0.25)),                  x2 = base.series + abs(rnorm(n, 0, 0.25)),                  x3 = base.series + abs(rnorm(n, 0, 0.25)),                  x4 = base.series + abs(rnorm(n, 0, 0.25)),                  x5 = base.series + abs(rnorm(n, 0, 0.25)),                  x6 = base.series + abs(rnorm(n, 0, 0.25)))# coerce to rwl and use plot and summary methodsfoo <- as.rwl(foo)class(foo)plot(foo, plot.type="spag")summary(foo)

Basal Area Increment (Inside Out)

Description

Convert multiple ring-width series to basal area increment (i.e., ringarea) going from the pith to the bark.

Usage

bai.in(rwl, d2pith = NULL)

Arguments

rwl

adata.frame with series as columns and years asrows such as that produced byread.rwl

d2pith

an optionaldata.frame containing two variables. Ifpresent, then variable one (series in the example below)gives the seriesID as eithercharacters orfactors. These must exactly matchcolnames(rwl). Variable two (d2pith inthe example below) gives the distance from the innermost measuredring to the pith of the tree in mm. Ifd2pith isNULL then the distance to pith is assumed to be zero for eachseries (column) inrwl.

Details

This converts ring-width series (mm) to ring-area series (mm squared)(aka basal area increments) based on the distance between theinnermost measured ring and the pith of the tree. It is related tobai.out, which calculates each ring area starting fromthe outside of the tree and working inward. Both methods assume acircular cross section (Biondi 1999). See the references below forfurther details.

Value

Adata.frame containing the ring areas for each series withcolumn names, row names and dimensions ofrwl.

Note

DendroLab website:https://dendrolaborg.wordpress.com/

Author(s)

Code by Andy Bunn based on work from DendroLab, University ofNevada Reno,USA. Patched and improved by Mikko Korpela.

References

Biondi, F. (1999) Comparing tree-ring chronologies and repeated timberinventories as forest monitoring tools.EcologicalApplications,9(1), 216–227.

Biondi, F. and Qeadan, F. (2008) A theory-driven approach to tree-ringstandardization: Defining the biological trend from expected basal areaincrement.Tree-Ring Research,64(2), 81–96.

See Also

bai.out

Examples

library(graphics)library(stats)library(utils)## Toyn <- 100## Make three fake tree-ring series to show that these funcs work on rwl objectsbase.series <- 0.75 + exp(-0.2 * 1:n)rwl <- data.frame(x1 = base.series + abs(rnorm(n, 0, 0.05)),                  x2 = base.series + abs(rnorm(n, 0, 0.05)),                  x3 = base.series + abs(rnorm(n, 0, 0.05)))## The inside out methodfoo <- bai.in(rwl = rwl)## The outside in methodbar <- bai.out(rwl = rwl)## Identicalhead(bar)head(foo)## Use gp datadata(gp.rwl)data(gp.d2pith)foo <- bai.in(rwl = gp.rwl, d2pith = gp.d2pith)foo.crn <- chron(foo)yrs <- time(foo.crn)plot(yrs, foo.crn[, 1], type = "n",     xlab = "Year", ylab = expression(mm^2))lines(yrs, foo.crn[, 1], col = "grey", lty = "dashed")lines(yrs, caps(foo.crn[, 1], nyrs = 32), col = "red", lwd = 2)

Basal Area Increment (Outside In)

Description

Convert multiple ring-width series to basal area increment (i.e., ringarea) going from the bark to the pith.

Usage

bai.out(rwl, diam = NULL)

Arguments

rwl

adata.frame with series as columns and years asrows such as that produced byread.rwl

diam

an optionaldata.frame containing two variables.If present, variable one (series in the example below)gives the seriesID as eithercharacters orfactors. These must exactly matchcolnames(rwl). Variable two (diam in theexample below) gives the diameter of the tree (in mm) up to theoutermost ring (e.g., the diameter of the tree where the core wastaken minus the thickness of the bark). Ifdiam isNULL then the diameter is taken as twice the sum of thewidths for each series (column) inrwl.

Details

This converts ring-width series (mm) to ring-area series (mm squared)(aka basal area increments) based on the diameter of the tree and thewidth of each ring moving towards the pith of the tree. It is relatedtobai.in, which calculates each ring area starting fromthe inside of the tree and working outward. Both methods assume acircular cross section (Biondi 1999). See the references below forfurther details.

Value

Adata.frame containing the ring areas for each series withcolumn names, row names and dimensions ofrwl.

Note

DendroLab website:https://dendrolaborg.wordpress.com/

Author(s)

Code by Andy Bunn based on work from DendroLab, University ofNevada Reno,USA. Patched and improved by Mikko Korpela.

References

Biondi, F. (1999) Comparing tree-ring chronologies and repeated timberinventories as forest monitoring tools.EcologicalApplications,9(1), 216–227.

Biondi, F. and Qeadan, F. (2008) A theory-driven approach to tree-ringstandardization: Defining the biological trend from expected basal areaincrement.Tree-Ring Research,64(2), 81–96.

See Also

bai.in

Examples

library(graphics)library(utils)## Not run: library(stats)## Toyn <- 100## Make three fake tree-ring series to show that these funcs work on rwl objectsbase.series <- 0.75 + exp(-0.2 * 1:n)rwl <- data.frame(x1 = base.series + abs(rnorm(n, 0, 0.05)),                  x2 = base.series + abs(rnorm(n, 0, 0.05)),                  x3 = base.series + abs(rnorm(n, 0, 0.05)))## The inside out methodfoo <- bai.in(rwl = rwl)## The outside in methodbar <- bai.out(rwl = rwl)## Identicalhead(bar)head(foo)## End(Not run)## Use gp datadata(gp.rwl)data(gp.dbh)## dbh (minus the bark) from cm to mm gp.dbh2 <- gp.dbh[, 1:2]gp.dbh2[, 2] <- (gp.dbh[, 2] - gp.dbh[, 3]) * 10bar <- bai.out(rwl = gp.rwl, diam = gp.dbh2)bar.crn <- chron(bar)yrs <- time(bar.crn)plot(yrs, bar.crn[, 1], type = "n",     xlab = "Year", ylab = expression(mm^2))lines(yrs, bar.crn[, 1], col = "grey", lty = "dashed")lines(yrs, caps(bar.crn[, 1], nyrs = 32), col = "red", lwd = 2)

Basal Area Increment (Bakker)

Description

Convert multiple ring-width series to basal area increment (i.e., ring area) following the proportional method of Bakker (2005).

Usage

  bakker(rwl, ancillary)

Arguments

rwl

adata.frame with series as columns and years as rows such as that produced byread.rwl

ancillary

Adata.frame containing four columns. Column one (series in the example below) gives the series ID as either characters or factors. These must exactly match colnames(rwl). Column two (PO) gives the number of rings estimated to be missing to the pith. Column three (d2pith) gives the estimated distance to the pith (mm). Column four (diam) gives the diameter at breast height (DBH) in cm.

Details

This converts ring-width series (mm) to ring-area series (mm squared) (aka basal area increments) based on the diameter of the tree, the missing distance to the pith and the missing number of rings to the pith, following the proportional method for reconstructing historical tree diameters by Bakker (2005).It preventsbai.out transformations from producing negative increments when the sum of all ring widths in a series is larger than DBH/2. It preventsbai.in transformations from producing too small values when the sum of all ring widths in a series is smaller than DBH/2.

Value

A list containing the following objects:

DBHhist_raw

data.frame with the reconstructed diameter for each series with column names, row names and dimensions of rwl.

baiBakker_raw

data.frame with the basal area increments for each series with column names, row names and dimensions of rwl.

Author(s)

Code by Stefan Klesse. Adapted for dplR by Andy Bunn.

References

Bakker, J.D., 2005. A new, proportional method for reconstructing historical tree diameters. Canadian Journal of Forest Research 35, 2515–2520. https://doi.org/10.1139/x05-136

Examples

  data(zof.rwl)data(zof.anc)zof.bakker <- bakker(rwl = zof.rwl,ancillary = zof.anc)zof.bai <- zof.bakker$baiBakker_raw# first series baiyrs <- time(zof.rwl)plot(yrs,zof.bai[,1],type="l",     xlab="Year",     ylab=expression(BAI~(mm^2)),     main = colnames(zof.bai)[1])

Campito Mountain Tree Ring Widths

Description

This data set gives the raw ring widths for bristlecone pinePinus longaeva at Campito Mountain in California,USA. There are 34 series. Data set was created usingread.rwl and saved to an .rda file usingsave.

Usage

data(ca533)

Format

Adata.frame containing 34 tree-ring series in columns and 1358years in rows.

Source

International tree-ring data bank, Accessed on 20-April-2021 athttps://www.ncei.noaa.gov/pub/data/paleo/treering/measurements/northamerica/usa/ca533.rwl

References

Graybill, D. A. and LaMarche, Jr., V. C. (1983) Campito Mountain DataSet.IGBPPAGES/World Data Center forPaleoclimatology Data Contribution Series 1983-CA533.RWL.NOAA/NCDC Paleoclimatology Program, Boulder,Colorado,USA.


Twisted Tree Heartrot Hill Standard Chronology

Description

This data set gives the standard chronology for white sprucePicea glauca at Twisted Tree Heartrot Hill in Yukon,Canada. Data set was created usingread.crn and saved toan .rda file usingsave.

Usage

data(cana157)

Format

Adata.frame containing the standard chronology in column oneand the sample depth in column two. There are 463 years(1530–1992) in the rows.

Source

International tree-ring data bank, Accessed on 20-April-2021 athttps://www.ncei.noaa.gov/pub/data/paleo/treering/chronologies/northamerica/canada/cana157.crn

References

Jacoby, G., D’Arrigo, R. and Buckley, B. (1992) Twisted TreeHeartrot Hill Data Set.IGBPPAGES/World DataCenter for Paleoclimatology Data Contribution Series 1992-CANA157.CRN.NOAA/NCDC Paleoclimatology Program, Boulder,Colorado,USA.


Cook and Peters Smoothing Spline with User-Specified Rigidity and Frequency Cutoff

Description

Applies a smoothing spline toy with rigidity determinedby two parameters: frequency responsef at a wavelengthofnyrs years.

Usage

caps(y, nyrs = 32, f = 0.5)

Arguments

y

anumeric vector, typically a tree-ring series.

nyrs

a number greater than zero, affecting the rigidity of the spline. Ifnyrs is between zero and one it will be treated as percentage of the length of the series. E.g., a value of 0.667 would 0.667 * length(y) or what is often called a 2/3 spline in the tree-ring literature. Whenf is kept constant, a largernyrs produces a more rigid spline.

f

a number between 0 and 1 giving the frequency response at a wavelength ofnyrs years. Whennyrs is kept constant, a smallerf produces a more rigid spline: At one extreme,f = 0 causes the function to return the least-squares straight line fit to the data. At the other extreme, asf approaches 1 the result approaches the natural spline, i.e. the function outputsy. The default value is 0.5 and shouldn't be changed without a good reason.

Details

This applies the classic smoothing spline from Cook and Peters (1981). The rigidity of the spline has a frequency response of 50% at a wavelength ofnyrs. The references, of course, have more information.

This function was introduced todplR in version 1.7.3 and replaces the now defunctffcsaps. Whereffcsaps was written entirely in R,caps is a wrapper for a Fortran subroutine from Ed Cook's ARSTAN program that is thousands of times faster.

The default value ofnyrs was changed to 32 from 2/3 length ofy in version 1.7.8 based on a suggestion from Klesse (2021).

Note:caps returnsNA if there are anyNA values iny. See examples.

Value

A filtered vector.

Author(s)

Fotran code provided by Ed Cook and adapted for dplR by Andy Bunn.

References

Cook, E. R. and Kairiukstis, L. A., editors (1990)Methods ofDendrochronology: Applications in the Environmental Sciences.Springer.ISBN-13: 978-0-7923-0586-6.

Cook, E. R. and Peters, K. (1981) The Smoothing Spline: A New Approach to Standardizing Forest Interior Tree-Ring Width Series for Dendroclimatic Studies. Tree-Ring Bulletin, 41, 45-53.

Klesse, S. (2021) Critical Note on the Application of the "Two-Third"" Spline. Dendrochronologia Volume 65: 125786

See Also

ads

Examples

library(graphics)library(utils)## Use first series from the Mesa Verde data setdata(co021)series <- co021[, 1]series <- series[!is.na(series)]plot(series, type = "l", ylab = "Ring Width (mm)", col = "grey")lines(caps(series, nyrs = 10), col = "red", lwd = 2)lines(caps(series, nyrs = 100), col = "green", lwd = 2)# A 2/3 spline, the default, 462.6667 yrs herelines(caps(series), col = "blue", lwd = 2)legend("topright",       c("Series", "nyrs=10", "nyrs=100",         paste("Default nyrs (", floor(length(series) * 2/3), ")", sep="")),       fill=c("grey", "red", "green", "blue"))## Note behavior when NA is encountered and## take appropriate measures as demonstrated abovey <- c(NA,NA,rnorm(100))caps(y)

Cross-Correlation between a Series and a Master Chronology

Description

Computes cross-correlations between a tree-ring series and a masterchronology built from a rwl object at user-specified lags and segments.

Usage

ccf.series.rwl(rwl, series, series.yrs = as.numeric(names(series)),               seg.length = 50, bin.floor = 100, n = NULL,               prewhiten = TRUE, biweight = TRUE, pcrit = 0.05,               lag.max = 5, make.plot = TRUE,               floor.plus1 = FALSE, series.x = FALSE, ...)

Arguments

rwl

adata.frame with series as columns and years as rowssuch as that produced byread.rwl.

series

anumeric orcharacter vector. Usually atree-ring series. If the length of the value is 1, thecorresponding column ofrwl is selected (by name orposition) as the series and ignored when building the masterchronology. Otherwise, the value must benumeric.

series.yrs

anumeric vector giving the years ofseries. Defaults toas.numeric(names(series)). Ignored ifseries is an index to a column ofrwl.

seg.length

an even integral value giving length of segments inyears (e.g., 20, 50, 100 years).

bin.floor

a non-negative integral value giving the base forlocating the first segment (e.g., 1600, 1700, 1800AD). Typically 0, 10, 50, 100, etc.

n

NULL or an integral value giving the filter lengthfor thehanning filter used for removal of lowfrequency variation.

prewhiten

logical flag. IfTRUE each series iswhitened usingar.

biweight

logical flag. IfTRUE then a robustmean is calculated usingtbrm.

pcrit

a number between 0 and 1 giving the critical value for thecorrelation test.

lag.max

an integral value giving the maximum lag at which tocalculate theccf.

make.plot

logical flag indicating whether to make aplot.

floor.plus1

logical flag. IfTRUE, one year isadded to the base location of the first segment (e.g., 1601, 1701,1801AD).

series.x

logical flag indicating whether to make theseriesthex argument toccf. See Details.

...

other arguments passed to plot.

Details

This function calculates the cross-correlation function between atree-ring series and a master chronology built fromrwllooking at correlations lagged positively and negatively usingccf at overlapping segments set byseg.length. For instance, withlag.max setto 5, cross-correlations would be calculated at for each segment withthe master lagged atk = -5:5 years.

The cross correlations are calculated callingccf as
ccf(x=master, y=series, lag.max=lag.max, plot=FALSE) ifseries.x isFALSE and asccf(x=series, y=master, lag.max=lag.max, plot=FALSE) ifseries.x isTRUE. This argument was introduced in dplR version 1.7.0.Different users have different expectations about how missing or extra rings are notated. Ifswitch.x = FALSE the behavior will be like COFECHA where a missing ring in a series produces a negative lag in the plot rather than a positive lag.

Correlations are calculated for the first segment, then thesecond segment and so on. Correlations are only calculated for segments withcomplete overlap with the master chronology.

Each series (including those in therwl object) isoptionally detrended as the residuals from ahanningfilter with weightn. The filter is not applied ifn isNULL. Detrending can also be done viaprewhitening where the residuals of anar model areadded to each series mean. This is the default. The master chronologyis computed as the mean of therwl object usingtbrm ifbiweight isTRUE androwMeans if not. Note that detrending typically changes thelength of the series. E.g., ahanning filter willshorten the series on either end byfloor(n/2). Theprewhitening default will change the series length based on thear model fit. The effects of detrending can be seen withseries.rwl.plot.

Value

Alist containing matricesccf andbins. Matrixccf contains the correlationsbetween the series and the master chronology at the lags window givenbylag.max. Matrixbins contains the yearsencapsulated by each bin.

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

References

Bunn, A. G. (2010) Statistical and visual crossdating in R using the dplR library.Dendrochronologia,28(4), 251–258.

See Also

corr.rwl.seg,corr.series.seg,skel.plot,series.rwl.plot

Examples

library(utils)data(co021)dat <- co021## Create a missing ring by deleting a year of growth in a random seriesflagged <- dat$"641143"flagged <- c(NA, flagged[-325])names(flagged) <- rownames(dat)dat$"641143" <- NULLccf.100 <- ccf.series.rwl(rwl = dat, series = flagged, seg.length = 100)## Not run: flagged2 <- co021$"641143"names(flagged2) <- rownames(dat)ccf.100.1 <- ccf.series.rwl(rwl = dat, seg.length = 100,                            series = flagged2)## Select series by name or column positionccf.100.2 <- ccf.series.rwl(rwl = co021, seg.length = 100,                            series = "641143")ccf.100.3 <- ccf.series.rwl(rwl = co021, seg.length = 100,                            series = which(colnames(co021) == "641143"))identical(ccf.100.1, ccf.100.2) # TRUEidentical(ccf.100.2, ccf.100.3) # TRUE## End(Not run)

Build Mean Value Chronology

Description

This function builds a mean value chronology, typically from adata.frame of detrended ring widths as produced bydetrend.

Usage

chron(x, biweight = TRUE, prewhiten = FALSE, ...)

Arguments

x

adata.frame of (usually detrended) ring widths withrownames(x) containing years andcolnames(x)containing each seriesID such as produced byread.rwl

biweight

logical flag. IfTRUE then a robustmean is calculated usingtbrm.

prewhiten

logical flag. IfTRUE each series iswhitened usingar prior to averaging.

...

Arguments passed toar whenprewhiten isTRUE. For example, useaicandorder.max to control the order of the AR model.

Details

This either averages the rows of thedata.frame using a mean ora robust mean (the so-called standard chronology) or can do so fromthe residuals of an AR process (the residual chronology).

Note that the residual chronology in this function will return differentvalues than the residual chronology fromchron.ars which usesa slightly different method for determining AR order.

Value

An object of of classcrn anddata.frame with the standard chronology, residual chronology (if prewhitening was performed), and the sample depth. The years are stored as row numbers.

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

References

Cook, E. R. and Kairiukstis, L. A., editors (1990)Methods ofDendrochronology: Applications in the Environmental Sciences.Springer.ISBN-13: 978-0-7923-0586-6.

Fritts, H. C. (2001)Tree Rings and Climate. Blackburn.ISBN-13: 978-1-930665-39-2.

See Also

read.rwl,detrend,ar,crn.plot

Examples

library(graphics)library(utils)data(ca533)ca533.rwi <- detrend(rwl = ca533, method = "ModNegExp")ca533.crn <- chron(ca533.rwi)plot(ca533.crn,xlab="Year",ylab="RWI")## With residual chronca533.crn2 <- chron(ca533.rwi, prewhiten = TRUE)plot(ca533.crn2,xlab="Year",ylab="RWI")

Build ARSTAN Chronology

Description

This function builds three varieties of the mean-value chronology, including the ARSTAN chronology, typically from adata.frame of detrended ring widths as produced bydetrend.

Usage

chron.ars(x, biweight=TRUE, maxLag=10, firstAICmin=TRUE,   verbose=TRUE, prewhitenMethod=c("ar.yw","arima.CSS-ML"))

Arguments

x

adata.frame of (usually detrended) ring widths withrownames(x) containing years andcolnames(x)containing each seriesID such as produced byread.rwl

biweight

logical flag. IfTRUE then a robustmean is calculated usingtbrm.

maxLag

aninteger giving the maximum lag to consider in the AR pooling.

firstAICmin

logical flag. IfTRUE the final AR order iselected using the first AIC minimum otherwise the order is selected by the overall minimum.

verbose

logical flag. IfTRUE the function prints information from the AR modeling to the screen.

prewhitenMethod

acharacter vector to determine the AR model fitting. See details below. Possible values are either "ar.yw" or "arima.CSS-ML". Can be abbreviated. Defaults to "ar.yw".

Details

This produces three mean-value chronologies: standard, residual, and ARSTAN. Users unfamiliar with the concept behind the ARSTAN method should look to Cook (1985) for background and inspiration.

The standard chronology is the (biweight) mean value across rows and identical tochron.

The residual chronology is the prewhitened chronology as described by Cook (1985) and uses uses multivariate autoregressive modeling to determine the order of the AR process. It's important to note that residual chronology produced here is different than the simple residual chronology produced bychron which returns the residuals of an AR process using a naive call toar. But in practice the results will be similar. For more on the residual chronology in this function, see pp. 153-154 in Cook's 1985 dissertation.

The ARSTAN chronology builds on the residual chronology but returns a re-whitened chronology where the pooled AR coefficients from the multivariate autoregressive modeling are reintroduced. See references for details.

The order of the AR model is selected from the pooled AR coefficients by AIC using either the first (local) AIC minimum otherwise or the overall minimum considering the maximum lag (argumentmaxLag).

Once the AR order is determined an AR(p) model is fit using eitherar via the Yule-Walker method or byarima via conditional-sum-of-squares to find starting values, then maximum likelihood. It is possible that the model will not converge in which case a warning is produced. The AR fitting is determined viaprewhitenMethod and defaults to usingar.

Value

Adata.frame with the standard, residual, and ARSTAN chronologies. The sample depth is also included.

Author(s)

Andy Bunn with contributions from Kevin Achukaitis and Ed Cook.Much of the function is a port of Cook's FORTRAN code.

References

Cook, E. R. and Kairiukstis, L. A., editors (1990)Methods ofDendrochronology: Applications in the Environmental Sciences.Springer.ISBN-13: 978-0-7923-0586-6.

Cook, E. R. (1985). A Time Series Analysis Approach to Tree Ring Standardization. PhD thesis, The University of Arizona.

See Also

chron,crn.plot,ar,arima

Examples

library(graphics)library(utils)data(co021)co021.rwi <- detrend(rwl = co021, method = "AgeDepSpline")co021.crn <- chron.ars(co021.rwi)plot(co021.crn,xlab="Year",ylab="RWI",add.spline=TRUE,nyrs=20)cor(co021.crn)

Build Mean Value Chronology with Confidence Intervals

Description

This function builds a mean value chronology with bootstrapped confidence intervals, typically from adata.frame of detrended ring widths as produced bydetrend.

Usage

chron.ci(x, biweight=TRUE, conf=0.95, R=100)

Arguments

x

adata.frame of (usually detrended) ring widths withrownames(x) containing years andcolnames(x)containing each seriesID such as produced byread.rwl

biweight

logical flag. IfTRUE then a robustmean is calculated usingtbrm.

conf

numeric. A scalar for the confidence level.

R

integer. The number of bootstrap replicates.

Details

This either averages the rows of thedata.frame using a mean ora robust mean (the so-called standard chronology) and calculates boostrapped confidence intervals using the normal approximation. The function will fail if there are any rows inx that contain only one sample and in practice there should be several samples in a row. One of the guiding principles of bootstrapping is that the population is to the sample as the sample is to the bootstrap samples.

Value

An object of of classdata.frame with the standard chronology, the upper and lower confidence interval, and the sample depth. The years are stored as row numbers.

Author(s)

Andy Bunn.

See Also

read.rwl,detrend,boot,boot.ci

Examples

library(graphics)library(utils)data(wa082)# truncate to a sample depth of fivewa082Trunc <- wa082[rowSums(!is.na(wa082))>4,]# detrendwa082RWI <- detrend(wa082Trunc, method="AgeDepSpline")# bootstrap the chronology andwa082Crn <- chron.ci(wa082RWI, biweight = TRUE, R = 100, conf = 0.99)head(wa082Crn)# plot (this is so much easier in ggplot!)wa082Crn$yrs <- time(wa082Crn)xx <- c(wa082Crn$yrs,rev(wa082Crn$yrs))yy <- c(wa082Crn$lowerCI,rev(wa082Crn$upperCI))plot(wa082Crn$yrs,wa082Crn$std,type="n",ylim=range(yy),     ylab="RWI",xlab="Year",main="Chronology with CI")polygon(x=xx,y=yy,col = "grey",border = NA)lines(wa082Crn$yrs,wa082Crn$std)

Build Mean Value Chronology with Stabilized Variance

Description

This function builds a variance stabilized mean-value chronology, typically from adata.frame of detrended ring widths as produced bydetrend.

Usage

chron.stabilized(x, winLength, biweight = TRUE, running.rbar = FALSE)

Arguments

x

adata.frame of ring widths withrownames(x) containing years andcolnames(x)containing each seriesID such as produced byread.rwl

winLength

a oddinteger specifying the window length.

biweight

logical flag. IfTRUE then a robustmean is calculated usingtbrm.

running.rbar

logical flag. IfTRUE the running interseries correlation is returned as well.

Details

The variance of a mean chronology depends on the variance of the individual samples, the number of series averaged together, and their interseries correlation (Wigley et al. 1984). As the number of series commonly decreases towards the beginning of a chronology averaging introduces changes in variance that are a solely an effect of changes in sample depth.

Additionally, time-dependent changes in interseries correlation can cause artificial variance changes of the final mean chronology. The functionchron.stabilized accounts for both temporal changes in the interseries correlation and sample depth to produce a mean value chronology with stabilized variance.

The basic correction centers around the use of the effective independent sample size,Neff, which considers sample replication and mean interseries correlation between the samples at every time. This is defined as:Neff = n(t) / 1+(n(t)-1)rbar(t)

wheren(t) is the number of series at timet, andrbar is the interseries correlation (seeinterseries.cor). Multiplication of the mean time series with the square root ofNeff at every timet theoretically results in variance that is independent of sample size. In the limiting cases, when therbar is zero or unity,Neff obtains values of the true sample size and unity, respectively.

Value

An object of of classcrn anddata.frame with the variance stabilized chronology, running interseries correlation ('ifrunning.bar=TRUE), and the sample depth.

Author(s)

Original code by David Frank and adapted for dplR by Stefan Klesse. Patched and improved by Andy Bunn.

References

Frank, D, Esper, J, Cook, E, (2006)On variance adjustments in tree-ring chronology development. Tree rings in archaeology, climatology and ecology, TRACE 4, 56–66

Frank, D, Esper, J, Cook, E, (2007)Adjustment for proxy number and coherence in a large-scale temperature reconstruction. Geophysical Research Letters 34

Wigley, T, Briffa K, Jones P (1984)On the Average Value of Correlated Time Series, with Applications in Dendroclimatology and Hydrometeorology. J. Climate Appl. Meteor., 23, 201–213

See Also

chron

Examples

library(graphics)library(utils)data(co021)co021.rwi <- detrend(co021,method = "Spline")co021.crn <- chron(co021.rwi)co021.crn2 <- chron.stabilized(co021.rwi,                                winLength=101,                                biweight = TRUE,                                running.rbar = FALSE)yrs <- time(co021)plot(yrs,co021.crn$std,type="l",col="grey")lines(yrs,co021.crn2$adj.crn,col="red")

C-Method Standardization

Description

Detrend multiple ring-width series simultaneously using the C-method.

Usage

cms(rwl, po, c.hat.t = FALSE, c.hat.i = FALSE)

Arguments

rwl

adata.frame with series as columns and years asrows such as that produced byread.rwl

po

adata.frame containing two variables. Variable one(series in the example below) gives the seriesID as eithercharacters orfactors. Thesemust exactly matchcolnames(rwl). Variable two(pith.offset in the example below) must be integralvalues and give the years from the beginning of the core to the pith(or center) of the tree.

c.hat.t

alogical indicating whether to export theC-curves for each tree by biological age.

c.hat.i

alogical indicating whether to export theexpected ring widths for each series.

Details

This method detrends and standardizes tree-ring series by calculatinga growth curve based on constant annual basal area increment. Themethod is based on the “assumption that constant growth isexpressed by a constant basal area increment distributed over agrowing surface” (Biondi and Qeadan 2008). The detrending is theestimation and removal of the tree’s natural biologicalgrowth trend. The standardization is done by dividing each series bythe growth trend to produce units in the dimensionless ring-widthindex (RWI).

This attempts to remove the low frequency variability that is due tobiological or stand effects.

See the reference below for further details.

Value

Adata.frame containing the dimensionless and detrendedring-width indices with column names, row names and dimensions ofrwl ifc.hat.t isFALSE andc.hat.i isFALSE.

Otherwise alist of length 2 or 3 containing theRWIdata.frame, adata.frame containing the C-curves foreach tree (c.hat.t), and/or a vector containing theC-values for each tree (c.hat.i) depending on the outputflags. See Eq. 12 in Biondi and Qeadan (2008) for more detail onc.hat.t, andc.hat.i.

Note

DendroLab website:https://dendrolaborg.wordpress.com/

Author(s)

Code provided by DendroLab based on programming by F. Qeadan andF. Biondi, University of Nevada Reno,USA and adapted fordplR by Andy Bunn. Patched and improved by Mikko Korpela.

References

Biondi, F. and Qeadan, F. (2008) A theory-driven approach to tree-ringstandardization: Defining the biological trend from expected basal areaincrement.Tree-Ring Research,64(2), 81–96.

See Also

detrend,chron,rcs

Examples

library(graphics)library(utils)data(gp.rwl)data(gp.po)gp.rwi <- cms(rwl = gp.rwl, po = gp.po)gp.crn <- chron(gp.rwi)crn.plot(gp.crn, add.spline = TRUE)## c.hatgp.rwi <- cms(rwl = gp.rwl, po = gp.po, c.hat.t = TRUE, c.hat.i = TRUE)dotchart(gp.rwi$c.hat.i, ylab = "Series", xlab = expression(hat(c)[i]))tmp <- gp.rwi$c.hat.tplot(tmp[, 1], type = "n", ylim = range(tmp, na.rm = TRUE),     xlab = "Cambial Age", ylab = expression(hat(c)[t]))apply(tmp, 2, lines)

Schulman Old Tree No. 1, Mesa Verde

Description

This data set gives the raw ring widths for Douglas firPseudotsuga menziesii at Mesa Verde in Colorado,USA.There are 35 series. Data set was created usingread.rwland saved to an .rda file usingsave.

Usage

data(co021)

Format

Adata.frame containing 35 tree-ring series in columns and 788years in rows.

Source

International tree-ring data bank, Accessed on 20-April-2021 athttps://www.ncei.noaa.gov/pub/data/paleo/treering/measurements/northamerica/usa/co021.rwl

References

Schulman, E. (1963) Schulman Old Tree No. 1 Data Set.IGBPPAGES/World Data Center for Paleoclimatology DataContribution Series 1983-CO021.RWL.NOAA/NCDCPaleoclimatology Program, Boulder, Colorado,USA.


Combine Tree-Ring Data Sets

Description

This function combines any number ofdata.frames oftree-ring data into onedata.frame.

Usage

combine.rwl(x, y = NULL)

Arguments

x

either adata.frame to be combined withy, or alist ofdata.frames to becombined.

y

adata.frame to be combined withdata.framex.

Details

The sequence of years in eachdata.frame must beincreasing and continuous. The output produced by the functionalso fulfills this condition. If the input is differently formatted,the result will be wrong.

Value

An object of classc("rwl", "data.frame") with the series in columns and the years asrows. The keycodes are the column names and the years are the rownames.

Author(s)

Christian Zang. Patched by Mikko Korpela.

Examples

library(utils)data(ca533)data(co021)combi1 <- combine.rwl(list(ca533, co021))## or alternatively for data.frames to combinecombi2 <- combine.rwl(ca533, co021)identical(combi1, combi2) # TRUE

Common Interval

Description

This function finds the common interval on a set of tree-ring widthssuch as that produced byread.rwl.

Usage

common.interval(rwl, type=c("series", "years", "both"),                make.plot=TRUE)

Arguments

rwl

adata.frame of ring widths withrownames(x) containing years andcolnames(x)containing each seriesID such as produced byread.rwl

type

acharacter string of"series","years", or"both". Argumentmatching is performed.

make.plot

alogical indicating if a plot should be drawn

Details

This trims anrwl object to a common interval that maximizesthe number of series (type="series"), the number of years(type="years"), or a compromise between the two(type="both"). A modifiedseg.plot can be drawnas well.

Value

Adata.frame withcolnames(x) andrownames(x).

Author(s)

Filipe Campelo, Andy Bunn and Mikko Korpela

See Also

seg.plot

Examples

library(utils)data(co021)co021.s <- common.interval(co021, type="series", make.plot=TRUE)co021.y <- common.interval(co021, type="years", make.plot=TRUE)co021.b <- common.interval(co021, type="both", make.plot=TRUE)dim(co021)dim.s <- dim(co021.s)dim.s       # the highest number of seriesprod(dim.s) #   (33 series x 288 years = 9504)dim.y <- dim(co021.y)dim.y       # the highest number of yearsprod(dim.y) #   (27 series x 458 years = 12366)dim.b <- dim(co021.b)dim.b       # compromise solutionprod(dim.b) #   (28 series x 435 years = 12180)

Compute Correlations between Series

Description

Computes the correlation between each tree-ring series in a rwl object.

Usage

corr.rwl.seg(rwl, seg.length = 50, bin.floor = 100, n = NULL,             prewhiten = TRUE, pcrit = 0.05, biweight = TRUE,             method = c("spearman", "pearson","kendall"),             make.plot = TRUE, label.cex = 1, floor.plus1 = FALSE,             master = NULL,             master.yrs = as.numeric(if (is.null(dim(master))) {                              names(master)                          } else {                              rownames(master)                          }),             ...)

Arguments

rwl

adata.frame with series as columns and years asrows such as that produced byread.rwl.

seg.length

an even integral value giving length of segments inyears (e.g., 20, 50, 100 years).

bin.floor

a non-negative integral value giving the base forlocating the first segment (e.g., 1600, 1700, 1800AD). Typically 0, 10, 50, 100, etc.

n

NULL or an integral value giving the filter lengthfor thehanning filter used for removal of lowfrequency variation.

prewhiten

logical flag. IfTRUE each series iswhitened usingar.

pcrit

a number between 0 and 1 giving the critical value forthe correlation test.

biweight

logical flag. IfTRUE then a robustmean is calculated usingtbrm.

method

Can be either"pearson","kendall", or"spearman" which indicates the correlation coefficient to beused. Defaults to"spearman". Seecor.test.

make.plot

logical flag indicating whether to make aplot.

label.cex

numeric scalar for the series labels on theplot. Passed toaxis.cex inaxis.

floor.plus1

logical flag. IfTRUE, one year isadded to the base location of the first segment (e.g., 1601, 1701,1801AD).

master

NULL, anumericvector or amatrix-like object ofnumeric values, including adata.frame. IfNULL, a number of master chronologies,one for each series inrwl, is built fromrwl using the leave-one-out principle. If avector, the function uses this as the master chronology. Ifamatrix ordata.frame, this object is used forbuilding the master chronology (no leave-one-out).

master.yrs

anumeric vector giving the years ofseries. Defaults tonames orrownames ofmaster coerced tonumeric type.

...

other arguments passed to plot.

Details

This function calculates correlation serially between each tree-ringseries and a master chronology built from all the other series in therwl object (leave-one-out principle). Optionally, theuser may give amaster chronology (avector) as anargument. In the latter case, the same master chronology is used forall the series in therwl object. The user can alsochoose to give amasterdata.frame (series ascolumns, years as rows), from which a single master chronology isbuilt.

Correlations are done for each segment of the series where segmentsare lagged by half the segment length (e.g., 100-year segments wouldbe overlapped by 50-years). The first segment is placed according tobin.floor. The minimum bin year is calculated asceiling(min.yr/bin.floor)*bin.floor wheremin.yr is the first year in either therwlobject or the user-specifiedmaster chronology, whicheveris smaller. For example if the first year is 626 andbin.floor is 100 then the first bin would start in 700.Ifbin.floor is 10 then the first bin would start in 630.

Correlations are calculated for the first segment, then the secondsegment and so on. Correlations are only calculated for segments withcomplete overlap with the master chronology. For now, correlations areSpearman’s rho calculated viacor.test usingmethod = "spearman".

Each series (including those in the rwl object) is optionallydetrended as the residuals from ahanning filter withweightn. The filter is not applied ifn isNULL. Detrending can also be done via prewhitening where theresiduals of anar model are added to each seriesmean. This is the default. The master chronology is computed as themean of therwl object usingtbrm ifbiweight isTRUE androwMeans if not. Notethat detrending can change the length of the series. E.g., ahanning filter will shorten the series on either end byfloor(n/2). The prewhitening default will change theseries length based on thear model fit. The effects ofdetrending can be seen withseries.rwl.plot.

The function is typically invoked to produce a plot where each segmentfor each series is colored by its correlation to the masterchronology. Green segments are those that do not overlap completelywith the width of the bin. Blue segments are those that correlateabove the user-specified critical value. Red segments are those thatcorrelate below the user-specified critical value and might indicate adating problem.

Value

Alist containing matricesspearman.rho,p.val,overall,bins,rwi, vectoravg.seg.rho,numericseg.lag,seg.length,pcrit,label.cex. An additionalcharacterflags is also returned if any segments fall below thecritical value. Matrixspearman.rho contains thecorrelations for each series by bin. Matrixp.valcontains the p-values on the correlation for each series bybin. Matrixoverall contains the average correlation andp-value for each series. Matrixbins contains the yearsencapsulated by each bin. The vectoravg.seg.rhocontains the average correlation for each bin. Matrixrwicontains the detrended rwl data, the numericsseg.lag,seg.length,pcrit,label.cex are from the oroginal call and used to pass intoplot.crs.

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

See Also

corr.series.seg,skel.plot,series.rwl.plot,ccf.series.rwl,plot.crs

Examples

library(utils)data(co021)crs <- corr.rwl.seg(co021, seg.length = 100, label.cex = 1.25)names(crs)## Average correlation and p-value for the first few serieshead(crs$overall)## Average correlation for each bincrs$avg.seg.rho

Compute Correlation between a Series and a Master Chronology

Description

Compute correlation between a tree-ring series and a master chronology bysegment.

Usage

corr.series.seg(rwl, series, series.yrs = as.numeric(names(series)),                seg.length = 50, bin.floor = 100, n = NULL,                prewhiten = TRUE, biweight = TRUE,                 method = c("spearman", "pearson","kendall"),                pcrit = 0.05,                make.plot = TRUE, floor.plus1 = FALSE, ...)

Arguments

rwl

adata.frame with series as columns and years asrows such as that produced byread.rwl.

series

anumeric orcharacter vector. Usually atree-ring series. If the length of the value is 1, thecorresponding column ofrwl is selected (by name orposition) as the series and ignored when building the masterchronology. Otherwise, the value must benumeric.

series.yrs

anumeric vector giving the years ofseries. Defaults toas.numeric(names(series)). Ignored ifseries is an index to a column ofrwl.

seg.length

an even integral value giving length of segments inyears (e.g., 20, 50, 100 years).

bin.floor

a non-negative integral value giving the base forlocating the first segment (e.g., 1600, 1700, 1800AD). Typically 0, 10, 50, 100, etc.

n

NULL or an integral value giving the filter lengthfor thehanning filter used for removal of lowfrequency variation.

prewhiten

logical flag. IfTRUE each series iswhitened usingar.

biweight

logical flag. IfTRUE then a robustmean is calculated usingtbrm.

method

Can be either"pearson","kendall", or"spearman" which indicates the correlation coefficient to beused. Defaults to"spearman". Seecor.test.

pcrit

a number between 0 and 1 giving the critical value forthe correlation test.

make.plot

logical flag indicating whether to make aplot.

floor.plus1

logical flag. IfTRUE, one year isadded to the base location of the first segment (e.g., 1601, 1701,1801AD).

...

other arguments passed to plot.

Details

This function calculates the correlation between a tree-ring series and amaster chronology built from a rwl object. Correlations are done bysegment (see below) and with a moving correlation with length equal totheseg.length. The function is typically invoked toproduce a plot.

Value

Alist containing matricesbins,moving.rho, and vectorsspearman.rho,p.val, andoverall.

Matrixbins contains the years encapsulated by each bin(segments). Matrixmoving.rho contains the movingcorrelation and p-value for a moving average equal toseg.length. Vectorspearman.rho containsthe correlations by bin andp.val containsthe p-values. Vectoroverall contains the averagecorrelation and p-value.

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

See Also

corr.series.seg,skel.plot,series.rwl.plot,ccf.series.rwl

Examples

library(utils)data(co021)dat <- co021## Create a missing ring by deleting a year of growth in a random seriesflagged <- dat$"641143"flagged <- c(NA, flagged[-325])names(flagged) <- rownames(dat)dat$"641143" <- NULLseg.100 <- corr.series.seg(rwl = dat, series = flagged,                           seg.length = 100, biweight = FALSE)## Not run: flagged2 <- co021$"641143"names(flagged2) <- rownames(dat)seg.100.1 <- corr.series.seg(rwl=dat, seg.length=100, biweight=FALSE,                             series = flagged2)## Select series by name or column positionseg.100.2 <- corr.series.seg(rwl=co021, seg.length=100, biweight=FALSE,                             series = "641143")seg.100.3 <- corr.series.seg(rwl=co021, seg.length=100, biweight=FALSE,                             series = which(colnames(co021) == "641143"))identical(seg.100.1, seg.100.2) # TRUEidentical(seg.100.2, seg.100.3) # TRUE## End(Not run)

Read Ring Width File from CSV

Description

This function reads in a file of ring widths (.rwl) from a text file with comma separated values (csv).

Usage

csv2rwl(fname,...)

Arguments

fname

acharacter vector giving the file name of thecsv file.

...

other arguments passed toread.table.

Details

This is a simple wrapper toread.table that reads in a text file with ring-width data in "spreadsheet" format. I.e., with series in columns and the the years as rows. The first column should contain the years and each subsequent column should contain a tree-ring series. The series names should be in the first row of the file. The deafult forNA values are empty cells or as the character string"NA" but can also be set using thena.strings argument passed toread.table. E.g.,:

Year Ser1A Ser1B Ser2A Ser2B
1901 NA 0.45 0.43 0.24
1902 NA 0.05 0.00 0.07
1903 0.17 0.46 0.03 0.21
1904 0.28 0.21 0.54 0.41
1905 0.29 0.85 0.17 0.76
1906 0.56 0.64 0.56 0.31
1907 1.12 1.06 0.99 0.83
etc...

Note that this is a rudimentary convenience function that isn't doing anything sophisticated. It reads in a file, assigns the years to the row names and sets the class of the object toc("rwl","data.frame") which allowsdplR to recognize it.

Although arguments can be passed toread.table, this is not designed to be a flexible function. As is the philosophy withdplR, modifying the code is easy should the user wish to read in a different style of text file (e.g., tab delimited). Typingcsv2rwl at theR prompt will get the user started.

Value

Function returns an object of classc("rwl", "data.frame") with the series in columns and the yearsas rows. The seriesIDs are the column names and the yearsare the row names.

Author(s)

Andy Bunn

See Also

read.rwl,read.table

Examples

library(utils)data(ca533)# write out a rwl file in a format that csv2rwl will understandtm <- time(ca533)foo <- data.frame(tm,ca533)# this is the temp file where foo will be writtentmpName <- tempfile()write.csv(foo,file=tmpName,row.names=FALSE)# read it back in using csv2rwlbar <- csv2rwl(tmpName)# check to see if identicalidentical(ca533,bar)# delete temp fileunlink(tmpName)

Detrend Multiple Ring-Width Series Simultaneously

Description

This is a wrapper fordetrend.series to detrend manyring-width series at once.

Usage

detrend(rwl, y.name = names(rwl), make.plot = FALSE,        method = c("Spline", "ModNegExp", "Mean", "Ar", "Friedman",                   "ModHugershoff", "AgeDepSpline"),        nyrs = NULL, f = 0.5, pos.slope = FALSE,        constrain.nls = c("never", "when.fail", "always"),        verbose = FALSE, return.info = FALSE,        wt, span = "cv", bass = 0, difference = FALSE)

Arguments

rwl

adata.frame with series as columns and years asrows such as that produced byread.rwl

y.name

acharacter vector oflength(ncol(rwl)) that gives theID of eachseries. Defaults to the column names ofrwl.

make.plot

alogical flag. Makes plots of the raw dataand detrended data ifTRUE. See details below.

method

acharacter vector to determine the detrendingmethods. See details below. Possible values are all subsets of
c("Spline", "ModNegExp", "Mean", "Ar", "Friedman", "ModHugershoff", "AgeDepSpline").Defaults to using all the available methods.

nyrs

a number giving the rigidity of the smoothing spline,defaults to 0.67 of series length ifnyrs isNULL.

f

a number between 0 and 1 giving the frequency response orwavelength cutoff. Defaults to 0.5.

pos.slope

alogical flag. Will allow for a positiveslope to be used in method"ModNegExp" and"ModHugershoff". IfFALSE theline will be horizontal.

constrain.nls

acharacter string which controlsthe constraints of the"ModNegExp" model and the"ModHugershoff". Seedetrend.series for further details.

verbose

logical. Write out details?

return.info

alogical flag. IfTRUE, detailsabout models and data will be added to the return value. See‘Value’.

wt

anumeric vector of case weights for method"Friedman". The default means equals weights.

span

anumeric value controlling method"Friedman", or"cv" (default) for automatic choice bycross-validation. Seesupsmu.

bass

anumeric value controlling the smoothness of thefitted curve in method"Friedman". Seesupsmu.

difference

alogical flag. Compute residuals by substraction if TRUE, otherwise use division.

Details

Seedetrend.series for details on detrendingmethods. Settingmake.plot = TRUE will cause plots ofeach series to be produced. These could be saved usingDevices if desired.

Value

If one detrending method is used, adata.frame containing thedimensionless detrended ring widths with column names, row names anddimensions ofrwl. If more methods are used, a list withncol(rwl) elements each containing adata.framewith the detrended ring widths in each column.

Ifreturn.info isTRUE, the return value is alist with four parts:

series

the main result described above (data.frame orlist of data.frames)

curves

the curve or line used to detrendseries. Either adata.frame or a list of data.frames.

model.info

Information about the models corresponding to eachoutput series. Alist with one element for each column ofrwl. Seedetrend.series (‘Value’,model.info) for a description of the contents.

data.info

Information about the input series. Alistwith one element for each column ofrwl. Seedetrend.series (‘Value’,data.info).

Note

This function uses theforeach loopingconstruct with the%dopar% operator.For parallel computing and a potential speedup, a parallel backendmust be registered before running the function. Ifverbose isTRUE, parallel computation is disabled.

Author(s)

Andy Bunn. Improved by Mikko Korpela.

See Also

detrend.series

Examples

library(utils)data(ca533)## Detrend using modified exponential decay. Returns a data.frameca533.rwi <- detrend(rwl = ca533, method = "ModNegExp")## Detrend using splines and compute## residuals via subtractionca533.rwi <- detrend(rwl = ca533, method = "Spline",                     difference = TRUE)## Detrend using modified Hugershoff curve and return info on the model## fits. Returns a list with: series, curves, modelinfo and data.infodata(co021)co021.rwi <- detrend(rwl = co021, method = "ModHugershoff",                     return.info=TRUE)## Not run: library(grDevices)## Detrend using all methods. Returns a listca533.rwi <- detrend(rwl = ca533)## Save a pdf of all seriesfname <- tempfile(fileext=".pdf")print(fname) # tempfile used for outputpdf(fname)ca533.rwi <- detrend(rwl = ca533, method = c("Spline", "ModNegExp"),                     make.plot = TRUE)dev.off()unlink(fname) # remove the file## End(Not run)

Detrend a Ring-Width Series

Description

Detrend a tree-ring series by one of two methods, a smoothing spline ora statistical model. The series and fits are plotted by default.

Usage

detrend.series(y, y.name = "", make.plot = TRUE,               method = c("Spline", "ModNegExp", "Mean",                "Ar", "Friedman", "ModHugershoff","AgeDepSpline"),               nyrs = NULL, f = 0.5, pos.slope = FALSE,               constrain.nls = c("never", "when.fail", "always"),               verbose = FALSE, return.info = FALSE,               wt, span = "cv", bass = 0, difference = FALSE)

Arguments

y

anumeric vector. Usually a tree-ring series.

y.name

an optionalcharacter vector to name the seriesfor plotting purposes.

make.plot

alogical flag. Makes plots of the raw dataand detrended data ifTRUE.

method

acharacter vector to determine the detrendingmethods. See details below. Possible values are all subsets of
c("Spline", "ModNegExp", "Mean", "Ar", "Friedman", "ModHugershoff", "AgeDepSpline").Defaults to using all the available methods.

nyrs

a number controlling the smoothness of thefitted curve in methods. See Details.

f

a number between 0 and 1 giving the frequency response orwavelength cutoff in method"Spline". Defaults to 0.5. Seecaps.

pos.slope

alogical flag. Will allow for a positiveslope to be used in method"ModNegExp" or"AgeDepSpline". IfFALSE theline will be horizontal.

constrain.nls

acharacter string which controlsthe constraints of the"ModNegExp" model and and the"ModHugershoff" model which are fit using nonlinear least-squares vianls. The value is ananswer to the question: When should the parameters of thenlsfunction be constrained? The options are"never": do not constrain (the default),"when.fail":only compute the constrained solution if the unconstrained fitcontains other than positive values, and"always": return theconstrained solution, even if the unconstrained one would have beenvalid. See ‘Details’.

verbose

alogical flag. Write out details to the screen?

return.info

alogical flag. IfTRUE, detailsabout models and data will be added to the return value. See‘Value’.

wt

anumeric vector of case weights for method"Friedman". The default means equals weights.

span

anumeric value controlling method"Friedman", or"cv" (default) for automatic choice bycross-validation. Seesupsmu.

bass

anumeric value controlling the smoothness of thefitted curve in method"Friedman". Seesupsmu.

difference

alogical flag. Compute residuals by subtraction if TRUE, otherwise use division.

Details

This detrends and standardizes a tree-ring series. The detrending is the estimation and removal of the tree’s natural biological growth trend. The default standardization is done by dividing each series by the growth trend to produce units in the dimensionless ring-width index (RWI). Ifdifference is TRUE, the index is calculated by subtraction. Values of zero (typically missing rings) iny are set to 0.001.

There are currently seven methods available fordetrending although more are certainly possible. The methodsimplemented are an age-dependent spline viaads (method = "AgeDepSpline"), the residuals of an AR model(method = "Ar"), Friedman's Super Smoother (method = "Friedman"), a simple horizontal line(method = "Mean"), or a modified Hugershoffcurve (method = "ModHugershoff"), a modified negative exponentialcurve (method = "ModNegExp"), and a smoothing spline viacaps (method = "Spline").

The"AgeDepSpline" approach uses an age-dependent spline with an initialstiffness of 50 (nyrs=50). Seeads. If some of the fitted values are not positive then method"Mean" is used. However, this isextremely unlikely.

The"Ar" approach is also known as prewhitening where the detrended series is the residuals of anar model divided by themean of those residuals to yield a series with white noise and a mean of one.This method removes all but the high frequency variation in the seriesand should only be used as such.

The"Friedman" approach uses Friedman’s ‘supersmoother’ as implemented insupsmu. The parameterswt,span andbass can beadjusted, butperiodic is always set toFALSE. If some of the fitted values are not positive then method"Mean" is used.

The"Mean" approach fits a horizontal line using the mean ofthe series. This method is the fallback solution in cases where the"Spline" or the linear fit (also a fallback solution itself)contains zeros or negative values, which would lead to invalidring-width indices.

The"ModHugershoff" approach attempts to fit a Hugershoffmodel of biological growth of the formf(t) = a t^b e^{-g t} + d, where the argument of the function is time, usingnls. See Fritts (2001) for details about theparameters. Optionconstrain.nls gives apossibility to constrain the parameters of the modified negativeexponential function. If the constraints are enabled, the nonlinearoptimization algorithm is instructed to keep the parameters in thefollowing ranges:a \ge 0,b \ge 0 andd \ge 0. The default is to not constrain the parameters(constrain.nls = "never") fornls butwarn the user when the parameters go out of range.

If a suitable nonlinear model cannot be fit(function is non-decreasing or some values are not positive) then alinear model is fit. That linear model can have a positive slopeunlesspos.slope isFALSE in which case method"Mean" is used.

The"ModNegExp" approach attempts to fit a classic nonlinearmodel of biological growth of the formf(t) = a e^{b t} + k, where the argument of the function is time, usingnls. See Fritts (2001) for details about theparameters. Optionconstrain.nls gives apossibility to constrain the parameters of the modified negativeexponential function. If the constraints are enabled, the nonlinearoptimization algorithm is instructed to keep the parameters in thefollowing ranges:a \ge 0,b \le 0 andk \ge 0. The default is to not constrain the parameters(constrain.nls = "never") fornls butwarn the user when the parameters go out of range.

If a suitable nonlinear model cannot be fit(function is non-decreasing or some values are not positive) then alinear model is fit. That linear model can have a positive slopeunlesspos.slope isFALSE in which case method"Mean" is used.

The"Spline" approach uses a spline where the frequencyresponse is 0.50 at a wavelength of 0.67 * “series length inyears”, unless specified differently usingnyrs andf in the functioncaps. If some of the fitted values are not positive then method"Mean" is used.

These methods are chosen because they are commonly used indendrochronology. There is a rich literature on detrendingand many researchers are particularly skeptical of the use of the classic nonlinear model of biological growth (f(t) = a e^{b t} + k) for detrending. It is, of course, up to the user to determine the best detrending method for their data.

Note that the user receives a warning if a series has negative values in the fitted curve. This happens fairly commonly with with the ‘Ar’ method on high-order data. It happens less often with method ‘Spline’ butisn't unheard of (see ‘Examples’). If this happens, users should lookcarefully at their data before continuing. Automating detrending and not evaluating each series individually is folly. Remember, frustration over detrending is the number one cause of dendros going to live as hermits in the tallgrass prairie, where there are no trees to worry about.

See the references below for further details on detrending. It's a dark art.

Value

If several methods are used, returns adata.frame containingthe detrended series (y) according to the methods used.The columns are named and ordered to matchmethod. Ifonly one method is selected, returns a vector.

Ifreturn.info isTRUE, the return value is alist with four parts:

series

the main result described above (data.frame orvector)

curves

the curve or line used to detrendseries. Either adata.frame or vector.

model.info

Information about the models corresponding to eachoutput series. Whereasseries may return a vector,model.info is always a list where each top levelelement corresponds to one selected method. Also these elements arenamed and arranged according to the methods selected. Each elementis a list with some of the following sub-elements, depending onwhich detrending method was actually used:

n.zeros

See"data.info" below. Always present.

zero.years

See"data.info". Always present.

method

The method actually used for detrending. One of"Mean","Line","ModNegExp","Spline" or"Ar". Always present.

mean

Mean of the input series, missing values removed.Only for method"Mean".

coefs

Coefficients of the model. Methods"Line"and"ModNegExp".

formula

The"ModNegExp"formula.

is.constrained

Alogical flag indicating whetherthe parameters of the"ModNegExp" model wereconstrained. Only interesting when argumentconstrain.nls is set to"when.fail".

nyrs

The value ofnyrs used forcaps. For methods"Spline" and"AgeDepSpline".

order

The order of the autoregressive model, selected byAIC (Akaike information criterion). Only for method"Ar".

ar

The autoregressive coefficients used by method"Ar". Anumeric vector ordered by increasinglag.

data.info

Information about the input series: number("n.zeros") and location ("zero.years") of zerovalues. If the locations are in acharacter vector, they areyears. Otherwise they are indices to the input series.

dirtDog

A logical flag indicating whether the requested method resulted in neagtive values for the curve fit, what Cook's ARSTAN called a Dirty Dog.

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela. A bug fixrelated to negative output values is based on work by Alice Cecile.

References

Cook, E. R. and Kairiukstis, L. A., editors (1990)Methods ofDendrochronology: Applications in the Environmental Sciences.Springer.ISBN-13: 978-0-7923-0586-6.

Fritts, H. C. (2001)Tree Rings and Climate.Blackburn.ISBN-13: 978-1-930665-39-2.

See Also

detrend

Examples

library(stats)library(utils)## Use series CAM011 from the Campito data setdata(ca533)series <- ca533[, "CAM011"]names(series) <- rownames(ca533)# defaults to all six methodsseries.rwi <- detrend.series(y = series, y.name = "CAM011", verbose=TRUE)# see plot with three methodsseries.rwi <- detrend.series(y = series, y.name = "CAM011",                             method=c("Spline", "ModNegExp","Friedman"),                             difference=TRUE)# see plot with two methods# interesting to note difference from ~200 to 250 years # in terms of what happens to low frequency growthseries.rwi <- detrend.series(y = series, y.name = "CAM011",                             method=c("Spline", "ModNegExp"))# see plot with just one method and change the spline# stiffness to 50 years (which is not neccesarily a good choice!)series.rwi <- detrend.series(y = series, y.name = "CAM011",                             method="Spline",nyrs=50)                             # note that method "Ar" doesn't get plotted in first panel# since this approach doesn't approximate a growth curve.series.rwi <- detrend.series(y = series, y.name = "CAM011",                             method="Ar")                             # note the difference between ModNegExp and ModHugershoff at the # start of the series. Also notice how curves, etc. are returned# via return.infodata(co021)series <- co021[, 4]names(series) <- rownames(co021)series.rwi <- detrend.series(y = series, y.name = names(co021)[4],                             method=c("ModNegExp", "ModHugershoff"),                             verbose = TRUE, return.info = TRUE,                              make.plot = TRUE)                             # A dirty dog.# In the case of method=="Spline" the function carries-on# and applies method=="Mean" as an alternative. data(nm046)series <- nm046[,8]names(series) <- rownames(nm046)series.rwi <- detrend.series(y = series, y.name = names(nm046)[8],                             method="Spline",                             make.plot = FALSE)

Defunct functions in dplR

Description

These are functions no longer included in dplR

Details

Function: plotRings
Function: ffcsaps, usecaps instead

Fill Internal NA

Description

This function fills internalNA values (i.e., those with numeric dataabove and below a small data gap) in each column of adata.frame such as a data set of ring widths as produced byread.rwl.

Usage

fill.internal.NA(x, fill = c("Mean", "Spline", "Linear"))

Arguments

x

adata.frame of ring widths withrow.names(x) containing years andnames(x)containing each seriesID such as produced byread.rwl

fill

anumeric value (e.g.,0) or acharacter string of"Mean","Spline", or"Linear". Defaults to"Mean".

Details

There are occasionally data gaps within a tree-ring series. Some ofthe functions in dplR will failwhen an internalNA is encountered (e.g.caps). Thisfunction fills internalNA values with either a given numeric value(e.g.,0) or through crude imputation. The latter can be calculated as the mean of the series (fill="Mean") or calculated by fitting a cubic spline(fill="Spline") using thespline function or calculatedby linear approximation (fill="Linear") using the functionapprox.

Editorial: Having internalNA in a tree-ring series isoften bad practice and filling those values should be done withcaution. For instance, some users code missing rings asNAinstead of0. And missing values (i.e.,NA) aresometimes present in maximum latewood density data when the rings aresmall. A common, but not recommended, practice is to leave stretchesofNA values in places where it has been impossible toaccurately measure rings (perhaps because of a break in the core). Itis often better to treat that core as two separate series (e.g., "01A"and "01B" rather than have internalNA values. As with allprocessing, the analyst should make a decision based on theirexperience with the wood and not rely on software to make a choice forthem!

Value

Adata.frame withcolnames(x) andrownames(x). InternalNAsfilled as above.

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

See Also

spline,approx

Examples

library(graphics)library(stats)foo <- data.frame(x1=c(rnorm(5), NA, NA, rnorm(3)),                  x2=c(rnorm(10)),                  x3=c(NA, NA, rnorm(3), NA, rnorm(4)),                  x4=c(NA, NA, rnorm(3), NA, rnorm(3), NA),                  x5=c(NA, NA, rnorm(8)),                  x6=c(NA, rnorm(9)),                  x7=c(NA, rnorm(5), NA, rnorm(3)),                  x8=c(rnorm(8), NA, NA),                  x9=c(rnorm(5), NA, rnorm(3), NA))row.names(foo) <- 1901:1910class(foo) <- c("rwl","data.frame")fill.internal.NA(foo, fill=0)bar <- fill.internal.NA(foo, fill="Spline")baz <- fill.internal.NA(foo, fill="Linear")## note differences in method "Spline" vs. "Linear"yrs <- time(foo)plot(yrs, foo$x7, type="b", lwd=3)lines(yrs, bar$x7, col="red", lwd=2)lines(yrs, baz$x7, col="green", lwd=1)

Calculate the Gini Coefficient

Description

This function calculates the Gini coefficient on raw or detrendedring-width series.

Usage

gini.coef(x)

Arguments

x

anumeric vector

Details

This calculates the Gini coefficient of inequality which is used as anall-lag measure of diversity in tree-ring records – typically detrendedseries. Lower values indicate lower diversity. The use of the Ginicoefficient in dendrochronology is described by Biondi and Qeadan (2008).See Handcock and Morris (1999) for more information.

Value

the Gini coefficient.

Author(s)

Mikko Korpela, based on original by Andy Bunn

References

Biondi, F. and Qeadan, F. (2008) Inequality in Paleorecords.Ecology,89(4), 1056–1067.

Handcock, M. S. and Morris, M. (1999)Relative DistributionMethods in the Social Sciences. Springer.ISBN:0-387-98778-9.

See Also

rwl.stats

Examples

library(utils)data(ca533)ca533.rwi <- detrend(rwl = ca533, method = "ModNegExp")ca533.crn <- chron(ca533.rwi)gini.coef(ca533.crn)

Calculate Gleichläufigkeit

Description

This function calculates the Gleichläufigkeit and related measures for a given set of tree-ring records.

Usage

  glk(x, overlap = 50, prob = TRUE)  glk.legacy(x)

Arguments

x

adata.frame of tree-ring data with records incolumns, and years as rows.

overlap

integer value with minimal length of overlapping growth changes (compared number of tree rings - 1). Comparisons with less overlap are not compared.

prob

ifTRUE then the probability of exceedence of the Gleichläufigkeit will be calculated

Details

Gleichläufigkeit is a classical agreement test based on sign tests (Eckstein and Bauch, 1969). This function implements Gleichläufigkeit as the pairwise comparison of all records in data set. This vectorized implementation is faster than the previous version and follows the original definition (Huber 1942), instead of the incorrect interpretation that has been used in the past (Schweingruber 1988, see Buras/Wilmking 2015 for the correction).

The probability of exceedence (p) for the Gleichläufigkeit expresses the chance that the Gleichläufigkeit is incorrect. The observed value of the Gleichläufigkeit is converted to a z-score and based on the standard normal curve the probability of exceedence is calculated. The result is a matrix of all p-values (Jansma 1995, 60-61, see also Visser 2020).

Note that prior to dplR version 1.7.2,glk did not have theoverlap orprob and returned amatrix with just the Gleichläufigkeit for all possible combinations of records. That function can still be accessed viaglk.legacy.

Value

The funtions returns a namedlist of two or three matrices (p_mat is optional ifprob = TRUE):

  1. glk_mat:matrix with Gleichläufigkeit

  2. overlap:matrix with number of overlapping growth changes.This is the number of overlapping years minus one.

  3. p_mat:matrix of all probabilities of exceedence for all observed Gleichläufigkeit values.

The matrices can be extracted from the list by selecting the name or index number. If two curves have less than 3 years of overlap, Gleichläufigkeit cannot be computed, andNA is returned.To calculate the global glk of the datasetmean(x$glk_mat, na.rm = TRUE).

Author(s)

Christian Zang. Patched and improved by Mikko Korpela.Improved by Allan Buras. Further improved and expanded by Ronald Visser and Andy Bunn

References

Buras, A. and Wilmking, M. (2015) Correcting the calculation of Gleichläufigkeit,Dendrochronologia34, 29-30. DOI: https://doi.org/10.1016/j.dendro.2015.03.003

Eckstein, D. and Bauch, J. (1969) Beitrag zur Rationalisierung eines dendrochronologischen Verfahrens und zur Analyse seiner Aussagesicherheit.Forstwissenschaftliches Centralblatt,88(1), 230-250.

Huber, B. (1943) Über die Sicherheit jahrringchronologischer Datierung.Holz als Roh- und Werkstoff6, 263-268. DOI: https://doi.org/10.1007/BF02603303

Jansma, E., 1995.RemembeRINGs; The development and application of local and regional tree-ring chronologies of oak for the purposes of archaeological and historical research in the Netherlands, Nederlandse Archeologische Rapporten 19, Rijksdienst voor het Oudheidkundig Bodemonderzoek, Amersfoort

Schweingruber, F. H. (1988)Tree rings: basics and applications of dendrochronology, Kluwer Academic Publishers, Dordrecht, Netherlands, 276 p.

Visser, R.M. (2020) On the similarity of tree-ring patterns: Assessing the influence of semi-synchronous growth changes on the Gleichläufigkeit for big tree-ring data sets,Archaeometry,63, 204-215 DOI: https://doi.org/10.1111/arcm.12600

See Also

sgcsgc is an alternative forglk)

Examples

library(utils)  data(ca533)  ca533.glklist <- glk(ca533)  ca533.glk_mat <- ca533.glklist$glk_mat  # calculating the mean GLK including self-similarities  mean(ca533.glk_mat, na.rm = TRUE)   # calculating the mean GLK excluding self-similarities  mean(ca533.glk_mat[upper.tri(ca533.glk_mat)], na.rm = TRUE)

Ponderosa Pine Distance to Pith Corresponding togp.rwl

Description

This data set gives the distance to pith for each series (in mm) thatmatches the ring widths forgp.rwl – a data set ofponderosa pine (Pinus ponderosa) from the Gus Pearson NaturalArea (GPNA) in northern Arizona,USA. Data arefurther described by Biondi and Qeadan (2008) and references therein.

Usage

data(gp.d2pith)

Format

Adata.frame containing seriesIDs in column 1(series) and the distance (in mm) from the innermost ringto the pith of the tree (d2pith). This can be usedtogether with the ring widths to calculate the area of each ring.

Source

DendroLab, University of Nevada Reno,USA.https://dendrolaborg.wordpress.com/

References

Biondi, F. and Qeadan, F. (2008) A theory-driven approach to tree-ringstandardization: Defining the biological trend from expected basal areaincrement.Tree-Ring Research,64(2), 81–96.


Ponderosa Pine Stem Diameters and Bark Thickness (gp.rwl)

Description

This data set gives the diameter at breast height for each series thatmatches the series ingp.rwl – a data set of ponderosapine (Pinus ponderosa) from the Gus Pearson Natural Area(GPNA) in northern Arizona,USA. Data are furtherdescribed by Biondi and Qeadan (2008) and references therein.

Usage

data(gp.dbh)

Format

Adata.frame containing seriesIDs in column 1(series), tree diameter (in cm) at breast height(dbh), and the bark thickness (in cm). This can be usedtogether with the ring widths to calculate the area of each ring.

Source

DendroLab, University of Nevada Reno,USA.https://dendrolaborg.wordpress.com/

References

Biondi, F. and Qeadan, F. (2008) A theory-driven approach to tree-ringstandardization: Defining the biological trend from expected basal areaincrement.Tree-Ring Research,64(2), 81–96.


Ponderosa Pine Pith Offsets Corresponding togp.rwl

Description

This data set gives the pith offsets that match the ring widths forgp.rwl – a data set of ponderosa pine (Pinusponderosa) from the Gus Pearson Natural Area (GPNA) innorthern Arizona,USA. Data are further described by Biondiand Qeadan (2008) and references therein.

Usage

data(gp.po)

Format

Adata.frame containing seriesIDs in column 1(series) and the number of years between the beginning ofthat series ingp.rwl and the pith of the tree(pith.offset). This can be used together with the ringwidths to calculate the cambial age of each ring.

Source

DendroLab, University of Nevada Reno,USA.https://dendrolaborg.wordpress.com/

References

Biondi, F. and Qeadan, F. (2008) A theory-driven approach to tree-ringstandardization: Defining the biological trend from expected basal areaincrement.Tree-Ring Research,64(2), 81–96.


Ponderosa Pine Ring Widths from Gus Pearson Natural Area

Description

This data set includes ring-width measurements for ponderosa pine(Pinus ponderosa) increment cores collected at the Gus PearsonNatural Area (GPNA) in northern Arizona,USA. There are 58 series from 29 trees (2 cores pertree). Data are further described by Biondi and Qeadan (2008) andreferences therein.

Usage

data(gp.rwl)

Format

Adata.frame containing 58 ring-width series in columns and 421years in rows.

Source

DendroLab, University of Nevada Reno,USA.https://dendrolaborg.wordpress.com/

References

Biondi, F. and Qeadan, F. (2008) A theory-driven approach to tree-ringstandardization: Defining the biological trend from expected basal areaincrement.Tree-Ring Research,64(2), 81–96.


Hanning Filter

Description

Applies a Hanning filter of lengthn tox.

Usage

hanning(x, n = 7)

Arguments

x

a vector

n

length of the Hanning filter, defaults to 7

Details

This applies a low frequency Hanning (a.k.a. Hann) filter tox with weight set ton.

Value

A filtered vector.

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

References

Oppenheim, A. V., Schafer, R. W., and Buck, J. R. (1999)Discrete-Time Signal Processing. Prentice-Hall, 2nd edition.ISBN-13: 978-0-13-754920-7.

See Also

filter

Examples

library(graphics)library(utils)data(ca533)yrs <- time(ca533)y <- ca533[, 1]not.na <- !is.na(y)yrs <- yrs[not.na]y <- y[not.na]plot(yrs, y, xlab = "Years", ylab = "Series1 (mm)",     type = "l", col = "grey")lines(yrs, hanning(y, n = 9), col = "red", lwd = 2)lines(yrs, hanning(y, n = 21), col = "blue", lwd = 2)legend("topright", c("Series", "n=9", "n=21"),       fill=c("grey", "red", "blue"))

Interactively Detrend Multiple Ring-Width Series

Description

Interactively detrend multiple tree-ring series by one of two methods, asmoothing spline or a statistical model. This is a wrapper fordetrend.series.

Usage

i.detrend(rwl, y.name = names(rwl), nyrs = NULL, f = 0.5,          pos.slope = FALSE)

Arguments

rwl

adata.frame with series as columns and years asrows such as that produced byread.rwl orca533

y.name

acharacter vector of lengthncol(rwl) that gives theID of eachseries. Defaults to the column names ofrwl.

nyrs

a number giving the rigidity of the smoothing spline,defaults to 0.67 of series length ifnyrs isNULL.

f

a number between 0 and 1 giving the frequency response orwavelength cutoff. Defaults to 0.5.

pos.slope

alogical flag. Will allow for a positiveslope to be used in method"ModNegExp". IfFALSE theline will be horizontal.

Details

This function allows a user to choose detrending curves based on plotsthat are produced bydetrend.series for which it isessentially a wrapper. The user enters their choice of detrendedmethod via keyboard at a prompt for each ring width series inrwl. Seedetrend.series for examples anddetails on the detrending methods.

Value

Adata.frame containing each detrended series according to themethod used as columns and rownames set tocolnames(y). These are typically years. Plots are alsoproduced as the user chooses the detrending methods through keyboardinput.

Author(s)

Andy Bunn

See Also

detrend.series


Interactively Detrend a Ring-Width Series

Description

Interactively detrend a tree-ring series by one of three methods, asmoothing spline, a linear model, or the mean. This is a wrapper fordetrend.series.

Usage

i.detrend.series(y, y.name = NULL, nyrs = NULL, f = 0.5,                 pos.slope = FALSE)

Arguments

y

anumeric vector. Usually a tree-ring series.

y.name

an optionalcharacter vector to name the seriesfor plotting purposes.

nyrs

a number giving the rigidity of the smoothing spline,defaults to 0.67 of series length ifnyrs isNULL.

f

a number between 0 and 1 giving the frequency response orwavelength cutoff. Defaults to 0.5.

pos.slope

alogical flag. Will allow for a positiveslope to be used in method"ModNegExp". IfFALSE theline will be horizontal.

Details

This function allows a user to choose a detrending method based on aplot that is produced bydetrend.series for which it isessentially a wrapper. The user enters their choice of detrendedmethod via keyboard at a prompt. Seedetrend.series forexamples and details on the detrending methods.

Value

A vector containing the detrended series (y) according tothe method used with names set tocolnames(y). These aretypically years. A plot is also produced and the user chooses a methodthrough keyboard input.

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

See Also

detrend.series


Edit a Ring-Width Series

Description

Insert or delete rings from a ring-width series

Usage

insert.ring(rw.vec,rw.vec.yrs=as.numeric(names(rw.vec)),            year,ring.value=mean(rw.vec,na.rm=TRUE),            fix.last=TRUE,fix.length=TRUE)delete.ring(rw.vec,rw.vec.yrs=as.numeric(names(rw.vec)),            year,fix.last=TRUE,fix.length=TRUE)

Arguments

rw.vec

a vector of data

rw.vec.yrs

the years forrw.vec asnames

year

the year to add or delete

ring.value

the value to add

fix.last

logical. If TRUE the last year of the seriesis fixed and the first year changes.

fix.length

logical. If TRUE the length of the output will be the length of the input.

Details

Simple editing of ring widths.

Value

A named vector.

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

See Also

dplR

Examples

library(utils)data(gp.rwl)dat <- gp.rwl# insert a value of zero for the year 1950 in series 50A# fix the last year of growth and maintain the length of the seriestmp <- insert.ring(rw.vec=dat$"50A",rw.vec.yrs = time(dat),                   year=1950,ring.value=0,fix.length = TRUE)# with fix.length=TRUE this can be merged back into the rwl object:data.frame(dat$"50A",tmp)dat$"50A" <- tmp# note that if fix.last = FALSE and fix.length = FALSE inserting a ring causes the# ending year of the series to be pushed forward and the length of the output to# be longer than the original series.tmp <- insert.ring(rw.vec=dat$"50A",rw.vec.yrs = time(dat),                   year=1950,ring.value=0, fix.last = FALSE,                    fix.length = FALSE)# with fix.length=FALSE this can't be merged back into the rwl object the# same way as abovetail(tmp)length(tmp)nrow(dat)# the same logic applies to deleting rings.dat <- gp.rwl# delete the year 1950 in series 50A# fix the last year of growth and maintain the length of the seriestmp <- delete.ring(rw.vec=dat$"50A",rw.vec.yrs = time(dat),                   year=1950,fix.last = TRUE, fix.length = TRUE)# with fix.length=TRUE this can be merged back into the rwl object:data.frame(dat$"50A",tmp)dat$"50A" <- tmp# note that if fix.last = FALSE and fix.length = FALSE inserting a ring causes the# ending year of the series to be pushed forward and the length of the output to# be longer than the original series.tmp <- delete.ring(rw.vec=dat$"50A", rw.vec.yrs = time(dat),                   year=1950, fix.last = FALSE,                    fix.length = FALSE)# with fix.length=FALSE this can't be merged back into the rwl object the# same way as abovetail(tmp)length(tmp)nrow(dat)

Individual Series Correlation Against a Master Chronology

Description

This function calculates the correlation between a series and a masterchronology.

Usage

  interseries.cor(rwl,n=NULL,prewhiten=TRUE,biweight=TRUE,    method = c("spearman", "pearson", "kendall"))

Arguments

rwl

adata.frame with series as columns and years asrows such as that produced byread.rwl.

n

NULL or an integral value giving the filter lengthfor thehanning filter used for removal of lowfrequency variation.

prewhiten

logical flag. IfTRUE each series iswhitened usingar.

biweight

logical flag. IfTRUE then a robustmean is calculated usingtbrm.

method

Can be either"pearson","kendall", or"spearman" which indicates the correlation coefficient to beused. Defaults to"spearman". Seecor.test.

Details

This function calculates correlation serially between each tree-ringseries and a master chronology built from all the other series in therwl object (leave-one-out principle).

Each series in the rwl object is optionallydetrended as the residuals from ahanning filter withweightn. The filter is not applied ifn isNULL. Detrending can also be done via prewhitening where theresiduals of anar model are added to each seriesmean. This is the default. The master chronology is computed as themean of therwl object usingtbrm ifbiweight isTRUE androwMeans if not. Notethat detrending can change the length of the series. E.g., ahanning filter will shorten the series on either end byfloor(n/2). The prewhitening default will change theseries length based on thear model fit. The effects ofdetrending can be seen withseries.rwl.plot.

This function produces the same output of theoverall portion ofcorr.rwl.seg. The mean correlation value given is sometimes referred to as the “overall interseries correlation” or the “COFECHA interseries correlation”. This output differs from therbar statistics given byrwi.stats in thatrbar is the average pairwise correlation between series where this is the correlation between a series and a master chronology.

Value

adata.frame with correlation values and p-values given fromcor.test

Author(s)

Andy Bunn, patched and improved by Mikko Korpela

See Also

rwl.stats,rwi.stats

Examples

library(utils)data(gp.rwl)foo <- interseries.cor(gp.rwl)# compare to: # corr.rwl.seg(rwl=gp.rwl,make.plot=FALSE)$overall# using pearson's rfoo <- interseries.cor(gp.rwl,method="pearson")# two measures of interseries correlation# compare interseries.cor to rbar from rwi.statsgp.ids <- read.ids(gp.rwl, stc = c(0, 2, 1))bar <- rwi.stats(gp.rwl, gp.ids, prewhiten=TRUE)bar$rbar.effmean(foo[,1])

Date Conversion to Character in LaTeX Format

Description

This is a simple convenience function that returns a date in theformat used by ‘⁠\today⁠’ in LaTeX. A possible use case is fixingthe date shown in a vignette at weaving time.

Usage

latexDate(x = Sys.Date(), ...)

Arguments

x

any object for which anas.POSIXlt method exists.Defaults to the current date.

...

other arguments toas.POSIXlt

Value

Acharacter vector

Author(s)

Mikko Korpela

Examples

latexDate()                              # todaylatexDate(Sys.Date() + 5)                # today + 5 dayslatexDate(c("2013-12-06", "2014-09-19")) # fixed dates## [1] "December 6, 2013"   "September 19, 2014"latexDate(5*60*60*24, origin=Sys.Date()) # today + 5 days

Convert Character Strings for Use with LaTeX

Description

Some characters cannot be entered directly into a LaTeX document.This function converts the inputcharacter vector to a formsuitable for inclusion in a LaTeX document in text mode. It can beused together with ‘⁠\Sexpr⁠’ in vignettes.

Usage

latexify(x, doublebackslash = TRUE, dashdash = TRUE,         quotes = c("straight", "curved"),         packages = c("fontenc", "textcomp"))

Arguments

x

acharacter vector

doublebackslash

alogical flag. IfTRUE,backslashes in the output are doubled. It seems that Sweave needsTRUE and knitrFALSE.

dashdash

alogical flag. IfTRUE (the default),consecutive dashes (“-”) in the input will be rendered asseparate characters. IfFALSE, they will not be given anyspecial treatment, which will usually mean that two dashes arerendered as an en dash and three dashes make an em dash.

quotes

acharacter string specifying how single anddouble quotes (ASCII codes 39 and 34) and stand-alonegrave accents (ASCII code 96) in the input are treated.The default is to use straight quotes and the proper symbol for thegrave accent. The other option is to use curved right side(closing) quotes, and let LaTeX convert the grave accent to openingcurved quotes. Straight double quotes are not available in thedefault OT1 font encoding of LaTeX. Straight single quotes and thegrave accent symbol require the “textcomp” package. Seepackages.

packages

acharacter vector specifying the LaTeXpackages allowed. The use of some symbols in LaTeX requirescommands or characters made available by an add-on package. If apackage required for a given character is not marked as available, afallback solution is silently used. For example, curved quotes maybe used instead of straight quotes. The supported packages are"eurosym" (not used by default),"fontenc" and"textcomp". Including"fontenc" in the vector meansthat some other encoding than OT1 is going to be used. Note thatstraight quotes are an exception in the sense that a reasonablesubstitute (curved quotes) is available. In many other cases,"textcomp" and"fontenc" are silently assumed.

Details

The function is intended for use with unformatted inline text.Newlines, tabs and other whitespace characters ("[:space:]" inregex) are converted to spaces. Control characters("[:cntrl:]") that are not whitespace are removed. Other moreor less special characters in theASCII set are ‘{’,‘}’, ‘\’, ‘#’, ‘$’, ‘%’,‘^’, ‘&’, ‘_’, ‘~’, double quote,‘/’, single quote, ‘<’, ‘>’, ‘|’, graveand ‘-’. They are converted to the corresponding LaTeXcommands. Some of the conversions are affected by user options,e.g.dashdash.

Before applying the substitutions described above, input elements withEncoding set to"bytes" are printed and theoutput is stored usingcaptureOutput. The result ofthis intermediate stage isASCII text where some charactersare shown as their byte codes using a hexadecimal pair prefixed with"\x". This set includes tabs, newlines and controlcharacters. The substitutions are then applied to the intermediateresult.

The quoting functionssQuote anddQuotemay use non-ASCII quote characters, depending on the locale.Also these quotes are converted to LaTeX commands. This means thatthe quoting functions are safe to use with any LaTeX input encoding.Similarly, some other non-ASCII characters, e.g. letters,currency symbols, punctuation marks and diacritics, are converted tocommands.

Adding"eurosym" topackages enables the use of theeuro sign as provided by the"eurosym" package (‘⁠\euro⁠’).

The result is converted to UTF-8 encoding, Normalization Form C (NFC).Note that this function will not add any non-ASCIIcharacters that were not already present in the input. On thecontrary, some non-ASCII characters, e.g. all characters inthe"latin1" (ISO-8859-1)Encoding(character set), are removed when converted to LaTeX commands. Anyremaining non-ASCII character has a good chance of workingwhen the document is processed with XeTeX or LuaTeX, but the Unicodesupport available with pdfTeX is limited.

Assuming that ‘⁠pdflatex⁠’ is used for compilation, suggestedpackage loading commands in the document preamble are:

\usepackage[T1]{fontenc}    % no '"' in OT1 font encoding\usepackage{textcomp}       % some symbols e.g. straight single quote\usepackage[utf8]{inputenx} % UTF-8 input encoding\input{ix-utf8enc.dfu}      % more supported characters

Value

Acharacter vector

Author(s)

Mikko Korpela

References

INRIA. Tralics: a LaTeX to XML translator, HTML documentation of allTeX commands.https://www-sop.inria.fr/marelle/tralics/.

Levitt, N., Persch, C., and Unicode, Inc. (2013) GNOME Character Map,application version 3.10.1.

Mittelbach, F., Goossens, M., Braams, J., Carlisle, D., andRowley, C. (2004)The LaTeX Companion. Addison-Wesley,second edition.ISBN-13: 978-0-201-36299-2.

Pakin, S. (2009) The Comprehensive LaTeX SymbolList.https://www.ctan.org/tex-archive/info/symbols/comprehensive.

The Unicode Consortium. The Unicode Standard.https://home.unicode.org/.

Examples

x1 <- "clich\xe9\nma\xf1ana"Encoding(x1) <- "latin1"x1x2 <- x1Encoding(x2) <- "bytes"x2x3 <- enc2utf8(x1)testStrings <-    c("different     kinds\nof\tspace",      "control\a characters \ftoo",      "{braces} and \\backslash",      '#various$ %other^ &characters_ ~escaped"/coded',      x1,      x2,      x3)latexStrings <- latexify(testStrings, doublebackslash = FALSE)## All should be "unknown"Encoding(latexStrings)cat(latexStrings, sep="\n")## Input encoding does not matteridentical(latexStrings[5], latexStrings[7])

Perform a Continuous Morlet Wavelet Transform

Description

This function performs a continuous wavelet transform on a time series.

Usage

morlet(y1, x1 = seq_along(y1), p2 = NULL, dj = 0.25, siglvl = 0.95)

Arguments

y1

numeric vector. Series to be transformed.

x1

numeric. A vector of values giving the years for theplot. Must be the same length aslength(y1).

p2

numeric. The number of power of two to be computedfor the wavelet transform. Calculated from length ofy1ifNULL.

dj

numeric. Sub-octaves per octave calculated.

siglvl

numeric. Level for the significance test.

Details

This performs a continuous wavelet transform of a time series. Thisfunction is typically invoked withwavelet.plot.

Value

Alist containing:

y

numeric. The original time series.

x

numeric. The time values.

wave

complex. The wavelet transform.

coi

numeric. The cone of influence.

period

numeric. The period.

Scale

numeric. The scale.

Signif

numeric. The significant values.

Power

numeric. The squared power.

Note

This is a port of Torrence’sIDL code,which can be accessed through theInternet Archive Wayback Machine.

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

References

Torrence, C. and Compo, G. P. (1998) A practical guide to waveletanalysis.Bulletin of the American Meteorological Society,79(1), 61–78.

See Also

wavelet.plot

Examples

library(utils)data(ca533)ca533.rwi <- detrend(rwl = ca533, method = "ModNegExp")ca533.crn <- chron(ca533.rwi, prewhiten = FALSE)Years <- time(ca533.crn)CAMstd <- ca533.crn[, 1]out.wave <- morlet(y1 = CAMstd, x1 = Years, dj = 0.1, siglvl = 0.99)

Calculate NET

Description

Computes the\mathit{NET} parameter for a set of tree-ringrecords or other time-series data.

Usage

net(x, weights = c(v = 1, g = 1))

Arguments

x

Amatrix ordata.frame with at least two rows and twocolumns containingnumeric data. The rows should represent asequence of sampling points with uniform intervals (e.g. a range ofyears), but this is not checked. Each column is a time-seriesspanning either the whole time range or a part of it.

weights

Anumeric vector with two elements. Normally, variation("v") and Gegenläufigkeit("g") contribute to NET with equal weight. It is possible touse different weights by setting them here. The names of the vectorare matched toc("v", "g") (see ‘Examples’). If nonames are given, the first element is the weight of variation.

Details

This function computes the\mathit{NET} parameter (Esper etal., 2001). The overall\mathit{NET} is an average of all(non-NA) yearly values\mathit{NET_j}, which arecomputed as follows:

\mathit{NET_j}=v_j+(1-G_j)

The yearly variationv_j is the standard deviation of themeasurements of a single year divided by their mean.Gegenläufigkeit1-G_j is basedon one definition of GleichläufigkeitG_j, similar to but not the same as whatglkcomputes. Particularly, in the formula used by this function (Esperet al., 2001), simultaneous zero differences in two series are notcounted as a synchronous change.

The weights ofv_j and1-G_j in the sum canbe adjusted with the argumentweights (see above). As arather extreme example, it is possible to isolate variation orGegenläufigkeit by setting one of the weightsto zero (see ‘Examples’).

Value

Alist with the following components, in the same order asdescribed here:

all

anumeric vector containing\mathit{NET_j}. Row names ofx (if any)are copied here.

average

anumeric value\mathit{NET}, theaverage of the"all" vector (NA values removed).

Author(s)

Mikko Korpela

References

Esper, J., Neuwirth, B., and Treydte, K. (2001) A new parameter toevaluate temporal signal strength of tree-ring chronologies.Dendrochronologia,19(1), 93–102.

Examples

library(utils)data(ca533)ca533.rwi <- detrend(rwl = ca533, method = "ModNegExp")ca533.net <- net(ca533.rwi)tail(ca533.net$all)ca533.net$average## Not run: ## Isolate the components of NETca533.v <- net(ca533.rwi, weights=c(v=1,0))ca533.g <- net(ca533.rwi, weights=c(g=1,0))## End(Not run)

Los Alamos Tree Ring Widths

Description

This data set gives the raw ring widths for Douglas firPseudotsuga menziesii near Los Alamos New Mexico,USA. There are 8 series. Data set was created usingread.rwl and saved to an .rda file usingsave.

Usage

data(nm046)

Format

Adata.frame containing 8 tree-ring series in columns and 289years in rows.

Source

International tree-ring data bank, Accessed on 20-April-2021 athttps://www.ncei.noaa.gov/pub/data/paleo/treering/measurements/northamerica/usa/nm046.rwl

References

O'Brien, D (2002) Los Alamos DataSet.IGBPPAGES/World Data Center forPaleoclimatology Data Contribution Series 2002-NM046.RWL.NOAA/NCDC Paleoclimatology Program, Boulder,Colorado,USA.


Low-pass, high-pass, band-pass, and stop-pass filtering

Description

Applies low-pass, high-pass, band-pass, or stop-pass filtering toy with frequencies (or periods) supplied by the user.

Usage

pass.filt(y, W, type = c("low", "high", "stop", "pass"),          method = c("Butterworth", "ChebyshevI"),          n = 4, Rp = 1)

Arguments

y

anumeric vector, typically a tree-ring series.

W

anumeric vector giving frequency or period of thefilter. See details.

type

acharacter giving the type of filter. Values canbe "low", "high", "stop", or "pass" for low-pass, high-pass,band-pass, or stop-pass filters. Defaults to "low".

method

acharacter specifying indicating whether to usea Butterworth (default) or a type I Chebyshev filter.

n

anumeric value giving the order of thefilter. Larger numbers create steeper fall off.

Rp

anumeric value giving the dB for the passband ripple.

Details

This function applies either a Butterworth or a Chebyshev type I filter of ordern to a signal and is nothing more than a wrapper for functions in thesignal package. The filters are designed viabutter andcheby1. The filter is applied viafiltfilt.

The input data (y) has the mean value subtracted and is then padded via reflection at the start and the end to a distance of twice the maximum period. The padded data and the filter are passed tofiltfilt after which the data are unpadded and returned afer the mean is added back.

The argumementW can be given in either frequency between 0 and 0.5 or, for convenience, period (minimum value of 2). For low-pass and high-pass filters,W must have a length of one. For low-pass and high-pass filtersW must be a two-element vector (c(low, high)) specifying the lower and upper boundaries of the filter.

Because this is just a wrapper for casual use with tree-ring data the frequencies and periods assume a sampling frequency of one. Users are encouraged to build their own filters using thesignal package.

Value

A filtered vector.

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

See Also

hanning,detrend

Examples

data("co021")x <- na.omit(co021[, 1])# 20-year low-pass filter -- note freq is passed inbSm <- pass.filt(x, W=0.05, type="low", method="Butterworth")cSm <- pass.filt(x, W=0.05, type="low", method="ChebyshevI")plot(x, type="l", col="grey")lines(bSm, col="red")lines(cSm, col="blue")# 20-year high-pass filter -- note period is passed inbSm <- pass.filt(x, W=20, type="high")plot(x, type="l", col="grey")lines(bSm, col="red")# 20 to 100-year band-pass filter -- note freqs are passed inbSm <- pass.filt(x, W=c(0.01, 0.05), type="pass")cSm <- pass.filt(x, W=c(0.01, 0.05), type="pass", method="ChebyshevI")plot(x, type="l", col="grey")lines(bSm, col="red")lines(cSm, col="blue")# 20 to 100-year stop-pass filter -- note periods are passed incSm <- pass.filt(x, W=c(20, 100), type="stop", method="ChebyshevI")plot(x, type="l", col="grey")lines(cSm, col="red")

Plot a Tree-Ring Chronology

Description

This function makes a default plot of a tree-ring chronology from adata.frame of the type produced bychron,chron.ars,chron.stabilized,ssf.

Usage

## S3 method for class 'crn'plot(x, add.spline = FALSE, nyrs = NULL, ...)

Arguments

x

adata.frame ofclass{crn}.e.g., as produced bychron,chron.ars,chron.stabilized,ssf.

add.spline

alogical flag. Will add a line with asmoothing spline usingcaps

nyrs

a number giving the rigidity of the smoothing spline.Defaults to 1/3 times the length of the first chronology ifnyrs isNULL

...

Additional arguments to pass toplot.

Details

This makes a crude plot of one or more tree-ring chronologies.

Value

None. Invoked for side effect (plot).

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

See Also

chron

Examples

library(graphics)data(wa082)# Truncate the RW data to a sample depth at least 5wa082Trunc <- wa082[rowSums(!is.na(wa082))>4,]# Detrend with age-dependent splinewa082RWI <- detrend(wa082Trunc,method = "AgeDep")# make several chronologieswa082CRN1 <- chron(wa082RWI)wa082CRN2 <- chron.stabilized(wa082RWI,                              winLength=51,                              biweight = TRUE,                              running.rbar = TRUE)wa082CRN3 <- chron.ars(wa082RWI)wa082CRN4 <- ssf(wa082Trunc)# and plotplot.crn(wa082CRN1,add.spline = TRUE,nyrs=20)plot.crn(wa082CRN2,add.spline = TRUE,nyrs=20)plot(wa082CRN3,add.spline = TRUE,nyrs=20)plot(wa082CRN4,add.spline = TRUE,nyrs=20)# a custom crnfoo <- data.frame(wa082CRN1,sfc=wa082CRN4$sfc)foo <- foo[,c(1,3,2)]class(foo) <- c("crn","data.frame")plot.crn(foo,add.spline = TRUE,nyrs=20)

Plotting crs Objects

Description

Plots objects returned fromcorr.rwl.seg.

Usage

## S3 method for class 'crs'plot(x, ...)

Arguments

x

An object of class"crs".

...

Additional arguments passed toplot

Value

None. A plot is produced.

Author(s)

Andy Bunn

See Also

corr.rwl.seg

Examples

library(graphics)data(co021)foo <- corr.rwl.seg(co021, make.plot = FALSE)plot(foo)

Plotting Rwl Objects

Description

Plots rwl objects.

Usage

## S3 method for class 'rwl'plot(x, plot.type=c("seg","spag"), ...)

Arguments

x

An object of class"rwl".

plot.type

Character. Type "seg" callsseg.plot while "spag" callsspag.plot

...

Additional arguments for eachtype

Value

None. A plot is produced.

Author(s)

Andy Bunn

See Also

read.rwl

Examples

library(graphics)library(utils)data(co021)plot(co021, plot.type="seg")plot(co021, plot.type="spag")plot(co021, plot.type="spag", zfac=2)

Convert Pith Offset to Wood Completeness

Description

This function creates a partial wood completeness data structure basedon pith offset data.

Usage

po.to.wc(po)

Arguments

po

Adata.frame containing two variables. Variable one(series) gives the seriesID as eithercharacters orfactors. Variable two(pith.offset) contains integral values and gives theyears from the beginning of the core to the pith (or center) of thetree. The minimum value is 1.

Details

Usespith.offset - 1 as the number of missing heartwoodrings.

Value

Adata.frame containing one variable of wood completeness data:n.missing.heartwood (integer type). This can beused as input towrite.tridas.

Author(s)

Mikko Korpela

See Also

wc.to.po,rcs,write.tridas

Examples

## Not run: library(utils)data(gp.po)all(wc.to.po(po.to.wc(gp.po)) == gp.po)## End(Not run)

Calculates Pointer Years from a Group of Ring-Width Series

Description

This function calculates pointer years on adata.frame ofring-width series using the Becker algorithm. The pointer years arecomputed with adjustable thresholds of relative radial growthvariation and number of series displaying similar growth pattern(i.e. positive or negative variations).

Usage

pointer(rwl, rgv.thresh = 10, nseries.thresh = 75, round.decimals = 2)

Arguments

rwl

adata.frame with ring-width series as columns andyears as rows such as that produced byread.rwl.

rgv.thresh

anumeric giving the minimum absoluterelative radial growth variation (in percentage) above which thegrowth change from the yeart-1 tot is considered assignificant. Must be > 0. Values > 100 are possible but highlyunusual. See references. Defaults to 10.

nseries.thresh

anumeric giving the minimum percentageof series displaying significant relative radial growth variationsof a same sign above which the yeart is considered asa pointer year. Positive significant variations will results in apositive pointer year, negative ones in a negative pointer year.This number ranges from 1 to 100. Defaults to 75.

round.decimals

aninteger indicating the number ofdecimal places to be used for outputs. This number must bepositive. Defaults to 2.

Details

This calculates pointer years from ring-width series for each yeart of the time period covered by the series using theBecker algorithm. This algorithm is based on, first, the calculationof the individual relative radial growth variation by comparison ofring-width of yeart to that of yeart-1 foreach series, and second, the inter-series comparison of both sign andmagnitude of these variations.

For example, ifrgv.thresh andnseries.thresh are set at 10 and 75 respectively, pointeryears will be defined as those years when at least 75% of the seriespresent an absolute relative radial growth variation higher than 10%.

Users unfamiliar with the Becker algorithm should refer to Becker etal. (1994) and Mérian and Lebourgeois (2011) for furtherdetails.

Value

Adata.frame containing the following columns (each rowcorresponds to one position of the window):

Year

Considered year (t).

Nb.series

Number of available series.

Perc.pos

Percentage of series displaying a significantpositive radial growth variation.

Perc.neg

Percentage of series displaying a significantnegative radial growth variation.

Nature

Number indicating whether the year is a positivepointer year (1), a negative pointer year (-1) or a regular year(0).

RGV_mean

Mean radial growth variations over the availableseries.

RGV_sd

Standard deviation of the radial growth variations overthe available series.

Author(s)

Pierre Mérian. Improved by Mikko Korpela and AndyBunn.

References

Becker, M., Nieminen, T. M., and Gérémia, F. (1994)Short-term variations and long-term changes in oak productivity innortheastern France – the role of climate and atmosphericCO2.Annals of Forest Science,51(5),477–492.

Mérian, P. and Lebourgeois, F. (2011) Size-mediatedclimate–growth relationships in temperate forests: A multi-speciesanalysis.Forest Ecology and Management,261(8), 1382–1391.

See Also

skel.plot

Examples

## Pointer years calculation on ring-width series. Returns a data.frame.library(utils)data(gp.rwl)py <- pointer(rwl=gp.rwl, rgv.thresh=10, nseries.thresh=75,              round.decimals=2)tail(py)

Power Transformation of Tree-Ring Data

Description

Power transformation of tree-ring width.

Usage

powt(rwl, method = "universal", rescale = FALSE,     return.power=FALSE)

Arguments

rwl

adata.frame, typically of raw tree-ring widths series, such as that produced byread.rwl orread.fh

method

acharacter vector to determine the transformmethod. See details below. Possible values are either "universal" or "cook." Pattern matching is used.

rescale

logical flag. IfTRUE then each transformed series is rescaled to have the orginal mean and standard deviation of the input data. See details.

return.power

logical flag. IfTRUE then the power estimate(s) is returned.

Details

In dendrochronology, ring width series are sometimes power transformed to address heteroscedasticity.

The classic procedure used bymethod="cook" is a variance stabilization technique implemented afterCook & Peters (1997): for each series a linear model is fitted on thelogs of level and spread, where level is defined as the local meanM_t = \left(R_t + R_{t-1}\right)/2 withring widths R, and spread S is the local standard deviation defined asS_t = \left|R_t - R_{t-1}\right|. Theregression coefficient b from a linear model\log S = k + b \log M is then used for the power transform\star{R}_t = R_t^{1-b}.

The procedure above is modified withmethod="universal" where all samples are used simultaneously in a linear mixed-effects model with time (year)as a random effect:lmer(log S ~ log M + (1|year). This "universal" or "signal free" approach accounts for the common year effect across all of the series inrwl and should address that not every year has the same change in environmental conditions to the previous year.

Therescale argument will return the series with a mean and standarddeviation that matches the input data. While this is a common convention,users should note that this can produce negative values which can be confusingif thought of as "ring widths."

Value

Either an object of classc("rwl", "data.frame") containing the power transformed ring width series with the series in columns and the years as rows or in the case of a single series, a possibly named vector of the same. With classrwl, the seriesIDs are the column names and the years are the row names.

Ifreturn.power=TRUE the returned object is alist containing the power transformed data and anumeric with the power estimate(s) used to transform the data.

Author(s)

Christian Zang implemented the Cook and Peters method. Stefan Klesse conceivedand wrote the universal method. Patched and improved by Mikko Korpela and Andy Bunn.

References

Cook, E. R. and Peters, K. (1997) Calculating unbiasedtree-ring indices for the study of climatic and environmentalchange.The Holocene,7(3), 361–370.

Examples

library(utils)data(zof.rwl)powtUniversal <- powt(zof.rwl, method = "universal")powtCook <- powt(zof.rwl, method = "cook")op <- par(no.readonly = TRUE)par(mfcol = c(1, 3))hist(summary(zof.rwl)$skew,     breaks = seq(-2.25,2.25,by=0.25),     main="Raw Data",xlab="Skew")hist(summary(powtUniversal)$skew,     breaks = seq(-2.25,2.25,by=0.25),     main="Universal POWT",xlab="Skew")hist(summary(powtCook)$skew,     breaks = seq(-2.25,2.25,by=0.25),     main="Cook POWT",xlab="Skew")par(op) # restore graphical parameters

Printing Redfit Results

Description

Print information contained in or derived from a redfit object.

Usage

## S3 method for class 'redfit'print(x, digits = NULL, csv.out = FALSE, do.table = FALSE,      prefix = "", row.names = FALSE, file = "", ...)

Arguments

x

An object of class"redfit".

digits

Specifies the desired number of significant digits inthe output. The argument is passed toformat andprint.data.frame. A positive integral value orNULL. IfNULL, the value inoptions("digits")is used.

csv.out

Alogical flag. IfTRUE, writes alarge, comma-separated table of information. The table contains onerow for each frequency. IfFALSE, writes a few summarynumbers instead. See ‘Details’.

do.table

Alogical flag. IfTRUE, the largeinformation table is also printed whencsv.out isFALSE, although not in a comma-separated format but withprint.data.frame.

prefix

A prefix to be used on every output line except thelarge information table. REDFIT (seeReferences) uses"# ".

row.names

Alogical flag enabling or disablingautomatic row names from the large information table, or acharacter vector of names. In any case, the table willcontain frequency as the first column.

file

A writable connection or a character string naming afile. Used for setting the output destination whencsv.out isTRUE. The default is to write thecomma-separated table to the console.

...

Arguments towrite.csv. Used whencsv.out isTRUE.

Value

Invisibly returnsx.

Author(s)

Mikko Korpela

References

This function is based on the Fortran programREDFIT,which is in the public domain.

Schulz, M. and Mudelsee, M. (2002) REDFIT: estimating red-noisespectra directly from unevenly spaced paleoclimatic time series.Computers & Geosciences,28(3), 421–426.

See Also

redfit

Examples

library(utils)data(ca533)tm <- time(ca533)x <- ca533[[1]]idx <- which(!is.na(x))redf <- redfit(x[idx], tm[idx], "time",               nsim = 100, iwin = 0, ofac = 1, n50 = 1)print(redf)fname <- tempfile(fileext=".csv")print(fname) # tempfile used for outputprint(redf, csv.out = TRUE, file = fname)redftable <- read.csv(fname)unlink(fname) # remove the file

Do some reporting on a RWL object

Description

This function prints the results ofrwl.report

Usage

## S3 method for class 'rwl.report'print(x, ...)

Arguments

x

alist fromrwl.report

...

not implemented

Details

This function formats thelist fromrwl.report for the user to have a summary report of the number of series, the mean lengthof all the series, the first year, last year, the mean first-order autocorrelation (viasummary.rwl), the mean interseries correlation (viainterseries.cor), the years where a series has a missing ring (zero), internal NA, or a very small ring (<0.005).

Value

Invisible

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

See Also

rwl.report,summary.rwl,interseries.cor

Examples

data("gp.rwl")rwl.report(gp.rwl)foo <- gp.rwlfoo[177,1] <- NA foo[177:180,3] <- NA foo[185,4] <- 0.001 rwl.report(foo)

Add Raster Elements to Plot

Description

This function takes plotting commands and uses a temporarybitmap graphics device to capture their output. Theresulting raster image is drawn in the plot or figure region of theactive high-level plot. A new plot is started if one does not exist.

Usage

rasterPlot(expr, res = 150, region = c("plot", "figure"), antialias,           bg = "transparent", interpolate = TRUE, draw = TRUE,           Cairo = FALSE, ...)

Arguments

expr

Low-level plotting commands (lines,points,text, ...) representing elements to be added to thecurrent plot. Acall or anexpression.

res

Resolution in points per inch (ppi). A numeric value. Suggestedvalues for different types of display media are given incompactPDF. For example, the default 150 ppicorresponds to “ebook” quality.

region

The function can draw in the"plot" region or the"figure" region which also includes"mar" margins (seepar). If the drawing commands inexprcontain no material for the margins, the default"plot" isoptimal. Plotting in the outer margins ("oma" inpar) is not supported.

antialias

Antialiasing argument passed topng. The default(missing argument) is probably good for line plots but"none" is preferred for images in which color signifies valueof data. Unused if aCairo device is used instead ofpng.

bg

Background color of the raster plot, an argument passed tothe bitmap device. If the default"transparent" does notwork, try"white" or another color. Note that anon-transparent background will mask any previous content in thefigure or plot region, depending on the value ofregion.

interpolate

Argument passed torasterImage. Alogicalflag. The default isTRUE: use linear interpolation.Analogously toantialias,FALSE is preferredwhen color maps to value.

draw

Alogical flag. Draw the results (TRUE, the default)or return an image object (FALSE)?

Cairo

Alogical flag.TRUE for preferring aCairo topng as the bitmap device,FALSE (the default) for the opposite. If the preferreddevice cannot be used, the other one will be tried.

...

Other arguments topng orCairo.

Details

The appropriate graphical parameters of the current graphics deviceare copied to the temporary bitmap device. Therefore theappearance of the raster contents should be almost the same as whendirectly drawn.

The call or expressionexpr is evaluated in theenvironment of the caller.

It is possible that the raster contents will maintain a constant sizewhen the graphics device is resized. If resizing works, however, theimage may become distorted. For example, circle symbols will turninto ellipses if the width to height ratio is not maintained (see‘Examples’). This is in contrast to a standard plot in adisplay graphics device, e.g.x11, where text andsymbols maintain their size when the device is resized.

Value

Ifdraw isTRUE, there is no return value. Thefunction is used for the side effects.

Ifdraw isFALSE, an object of class"nativeRaster" is returned. The object can be used as inputforrasterImage orgrid.raster. SeereadPNG. If no bitmap device is available(see ‘Note’),NULL is returned.

Note

If either of these requirements is not met, at least onemessage is generated and the function reverts to regularplotting. Thebg argument is then handled by drawing afilled rectangle. Alsoregion is honored, but the othersettings do not apply.

Author(s)

Mikko Korpela

Examples

library(graphics)library(stats)## Picture with various graphical elementsx <- 1:100y0 <- quote(sin(pi * x / 20) + x / 100 + rnorm(100, 0, 0.2))y <- eval(y0)ylab <- deparse(y0)spl <- smooth.spline(y)plot(x, y, type = "n", axes = FALSE, ylab = ylab)usr <- par("usr")xrange <- usr[2] - usr[1]xsize <- xrange * 0.4nsteps <- 8xmar <- xsize / 20yrange <- usr[4] - usr[3]ysize <- yrange / 20ymar <- 0.5 * ysizeX <- seq(usr[1] + xmar, by = xsize / nsteps, length.out = nsteps + 1)xleft <- X[-(nsteps + 1)]xright <- X[-1]pin <- par("pin")maxrad <- xsize / 3 * min(1, pin[2] / pin[1])nrad <- 16minrad <- maxrad / nradRad <- seq(maxrad, by = (minrad - maxrad) / (nrad - 1), length.out=nrad)xmar2 <- xmar + maxradymar2 <- (xmar2 / xrange) * pin[1] / pin[2] * yrangeexpr <- quote({    rect(xleft, usr[4] - 1.5 * ysize, xright, usr[4] - ymar,         col = rainbow(8), border = NA)    symbols(rep(usr[2] - xmar2, nrad), rep(usr[3] + ymar2, nrad),            circles = Rad, inches = FALSE, add = TRUE, fg = NA,            bg = gray.colors(nrad + 1, 1, 0)[-1])    points(y)    lines(spl)})rasterPlot(expr, res = 50)box()axis(1)axis(2)## The same picture with higher resolution but no antialiasingplot(y, type = "n", axes = FALSE, ann = FALSE)## No content in margin, but region = "figure" and bg = "white"## paints margin whiterasterPlot(expr, antialias = "none", interpolate = FALSE,           region = "figure", bg = "white")## Draw box, axes, labelsparnew <- par(new = TRUE)plot(x, y, type = "n", ylab = ylab)par(parnew)## Draw plot(1:5) with adjusted margins and additional axes.  Some parts## are drawn with rasterPlot, others normally.  Resize to see stretching.op <- par(no.readonly = TRUE)par(mar = c(5.1, 4.1, 2.1, 2.1))plot(1:5, type = "n", axes = FALSE, ann = FALSE)expr2 <- quote({    points(c(2, 4), c(2, 4))    axis(2)    axis(3)})rasterPlot(expr2, region = "figure", bg = "white")points(c(1, 3, 5), c(1, 3, 5))box()axis(1)axis(4)title(xlab = "Index", ylab = "1:5")par(op)

Regional Curve Standardization

Description

Detrend multiple ring-width series simultaneously using a regionalcurve.

Usage

rcs(rwl, po, nyrs = NULL, f = 0.5, biweight = TRUE, ratios = TRUE,    rc.out = FALSE, make.plot = TRUE, ..., rc.in = NULL, check = TRUE)

Arguments

rwl

adata.frame with series as columns and years asrows such as that produced byread.rwl

po

adata.frame containing two variables. Variable one(series in the example below) gives the seriesID as eithercharacters orfactors. Thesemust exactly matchcolnames(rwl). Variable two(pith.offset in the example below) must be integralvalues and give the years from the beginning of the core to the pith(or center) of the tree. The minimum value is 1.

nyrs

a number giving the rigidity of the smoothing spline,defaults to 0.1 of length of the maximum cambial age (i.e., thelength of the regional curve) ifnyrs isNULL.

f

a number between 0 and 1 giving the frequency response orwavelength cutoff. Defaults to 0.5.

biweight

logical flag. IfTRUE then a robustmean is calculated usingtbrm.

ratios

logical flag. IfTRUE (the default) thenindices are calculated by division, ifFALSE indices arecalculated by subtraction.

rc.out

logical flag. Returns the regional curve alongwith the ring-width indices ifTRUE.

make.plot

logical flag. Makes plots of the raw data andregional curve ifTRUE.

...

other arguments passed toplot.

rc.in

for internal use.

check

alogical flag. Bypass input checks by settingthis toFALSE.

Details

This method detrends and standardizes tree-ring series by calculatingan age-related growth curve specific to therwl. Thedetrending is the estimation and removal of the tree’s naturalbiological growth trend. The standardization is done by eitherdividing each series by the growth trend or subtracting the growthtrend from each series to produce units in the dimensionlessring-width index (RWI). The option to produce indices bysubtraction is intended to be used on series that have been subject tovariance stabilization (e.g., usingpowt).

The spline approach uses an n-year spline where the frequency responseis 0.50 at a wavelength of 10 percent of the maximum cambial ageunless specified differently usingnyrs andf in the functioncaps.

This attempts to remove the low frequency variability that is due tobiological or stand effects. See the references below for furtherdetails on detrending in general, and Biondi and Qeadan (2008) for anexplanation ofRCS.

Value

Adata.frame containing the dimensionless and detrendedring-width indices with column names, row names and dimensions ofrwl. Ifrc.out isTRUE then alist will be returned with adata.frame containing thedetrended ring widths as above and avector containing theregional curve.

Note

DendroLab website:https://dendrolaborg.wordpress.com/

Author(s)

Code provided by DendroLab based on programming by F. Qeadan andF. Biondi, University of Nevada Reno,USA and adapted fordplR by Andy Bunn. Patched and improved by Mikko Korpela.

References

Biondi, F. and Qeadan, F. (2008) A theory-driven approach to tree-ringstandardization: Defining the biological trend from expected basal areaincrement.Tree-Ring Research,64(2), 81–96.

Cook, E. R. and Kairiukstis, L. A., editors (1990)Methods ofDendrochronology: Applications in the Environmental Sciences.Springer.ISBN-13: 978-0-7923-0586-6.

Fritts, H. C. (2001)Tree Rings and Climate.Blackburn.ISBN-13: 978-1-930665-39-2.

See Also

detrend,chron,cms,caps

Examples

library(utils)data(gp.rwl)data(gp.po)gp.rwi <- rcs(rwl = gp.rwl, po = gp.po, biweight = TRUE,              rc.out = TRUE, make.plot = FALSE)str(gp.rwi)gp.rwi <- rcs(rwl = gp.rwl, po = gp.po, biweight = TRUE,              make.plot = TRUE, main = "Regional Curve")

ReadDPL Compact Format Ring Width File

Description

This function reads in aDPL compact format file of ringwidths.

Usage

read.compact(fname)

Arguments

fname

acharacter vector giving the file name of therwl file.

Details

This function should be able to read files written by theDendrochronology Program Library (DPL) in its compactformat.

Value

An object of classc("rwl", "data.frame") with the series incolumns and the years as rows. The seriesIDs are thecolumn names and the years are the row names.

Author(s)

Mikko Korpela

See Also

read.rwl,read.tucson,read.tridas,read.fh,write.compact

Examples

## Not run: data(co021)fname <- write.compact(rwl.df = co021,                       fname = tempfile(fileext=".rwl"),                       append = FALSE, prec = 0.001)foo <- read.compact(fname)str(foo)str(co021)all.equal(foo,co021)unlink(fname)## End(Not run)

Read Tucson Format Chronology File

Description

This function reads in a Tucson (decadal) format file of tree-ringchronologies (.crn).

Usage

read.crn(fname, header = NULL, encoding = getOption("encoding"),         long = TRUE)

Arguments

fname

acharacter vector giving the file name of thecrn file.

header

logical flag indicating whether the file has aheader. IfNULL then the function will attempt to determineif a header exists

encoding

the name of the encoding to be used when reading thecrn file. Usually the default value will work, but a crn filewritten in a non-default encoding may crash the function. In thatcase, identifying the encoding and specifying it here should fix theproblem. Examples of popular encodings available on many systemsare"ASCII","UTF-8", and"latin1" alias"ISO-8859-1". See the help offile.

long

logical flag indicating whether to automaticallydetect when an input file uses more than 4 characters for the decade.IfFALSE, the function assumes 6 characters are used for thesiteID and 4 characters for the decade, which is thestandard. IfTRUE (the default), long records may work.

Details

This reads in a standard crn file as defined according to thestandards of theITRDB athttps://www1.ncdc.noaa.gov/pub/data/paleo/treering/treeinfo.txt. Despite thestandards at theITRDB, this occasionally fails due toformatting problems.

Value

Adata.frame with each chronology in columns and the years asrows. The chronologyIDs are the column names and the yearsare the row names. If the file includes sample depth that is includedas the last column (samp.depth). The output class isclass "crn" and "data.frame"

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.


Read Heidelberg Format Ring Width File

Description

This function reads in a Heidelberg (block or column) format file ofring widths (.fh).

Usage

read.fh(fname, BC_correction = FALSE)

Arguments

fname

acharacter vector giving the file name of the fhfile.

BC_correction

alogical. If TRUE the correction moves BC-dates one year forward.

Details

This reads in a fh-file with ring widths in blocks (decadal format) orin columns (e.g., as with comment flags) as used by TSAP program.Chronologies or half-chronos in fh-format are not supported.

Value

An object of classc("rwl", "data.frame") with the series incolumns and the years as rows. The keycodes are the column names andthe years are the row names. Depending on metadata available in theinput file, the following attributes may be present in thedata.frame:

ids

Adata.frame identifying the series. Always containscolumns"tree" and"core", may contain columns"site","radius", and"stemDisk". Allcolumns arenumeric.

po

Adata.frame containing pith offsets, formatted foruse inrcs.

Author(s)

Christian Zang. New features and patches by Mikko Korpela and Ronald Visser.

References

Rinn, F. (2003)TSAP-Win User Reference Manual.Rinntech, Heidelberg.https://rinntech.info/products/tsap-win/.

See Also

read.rwl


Read Site-Tree-CoreIDs

Description

These functions try to read site, tree, and coreIDs from arwldata.frame.

Usage

read.ids(rwl, stc = c(3, 2, 3), ignore.site.case = FALSE,         ignore.case = FALSE, fix.typos = FALSE, typo.ratio = 5,         use.cor = TRUE)autoread.ids(rwl, ignore.site.case = TRUE, ignore.case = "auto",             fix.typos = TRUE, typo.ratio = 5, use.cor = TRUE)

Arguments

rwl

adata.frame with series as columns and years asrows such as that produced byread.rwl orca533

stc

a vector of three integral values or character string"auto". The numbers indicate the number of characters to split thesite code (stc[1]), the treeIDs(stc[2]), and the coreIDs(stc[3]). Defaults toc(3, 2, 3). If "auto",tries to automatically determine the split locations. See Detailsfor further information.

use.cor

alogical flag. IfTRUE andstc is "auto", correlation clustering may be used fordetermining the length of the tree and core parts. See Details.

The following parameters affect the handling of suspected typingerrors. Some have different default values inread.ids andautoread.ids.

ignore.site.case

alogical flag. IfTRUE, thefunction does not distinguish between upper case and lower caseletters in the site part of the series names.

ignore.case

alogical flag or "auto". IfTRUE,the function does not distinguish between upper case and lower caseletters in the tree / core part of the series names. The default inread.ids isFALSE, i.e. the difference matters. Thedefault inread.ids is"auto", which means that thefunction tries to be smart with respect to case sensitivity. In"auto" mode, the function generally ignores case differences,unless doing so would result in additional duplicate combinations oftree and coreIDs. Also, when in"auto" mode andstc is"auto", case sensitivity is used inhighly heuristic ways when deciding the boundary between the sitepart and the tree part in uncertain cases.

fix.typos

alogical flag. IfTRUE, the functionwill try to detect and fix typing errors.

typo.ratio

anumeric value larger than1,affecting the eagerness of the function to fix typing errors. Thedefault is 5. See Details.

Details

Because dendrochronologists often take more than one core per tree, itis occasionally useful to calculate within vs. between tree variance.The International Tree Ring Data Bank (ITRDB) allows thefirst eight characters in an rwl file for seriesIDs butthese are often shorter. Typically the creators of rwl files use alogical labeling method that can allow the user to determine the treeand coreID from the label.

Argumentstc tells how each series separate into site,tree, and coreIDs. For instance a series code might be"ABC011" indicating site"ABC", tree 1, core 1. If thisformat is consistent then thestc mask would bec(3, 2, 3) allowing up to three characters for the coreID (i.e., pad to the right). If it is not possible todefine the scheme (and often it is not possible to machine readIDs), then the outputdata.frame can be builtmanually. See Value for format.

The functionautoread.ids is a wrapper toread.ids withstc="auto", i.e. automatic detection of the site / tree / corescheme, and different default values of some parameters. In automaticmode, the names in the samerwl can even follow differentsite / tree / core schemes. As there are numerous possible encodingschemes for naming measurement series, the function cannot alwaysproduce the correct result.

Withstc="auto", the site part can be one of the following.

These descriptions are somewhat general, and the detailscan be found in regular expressions inside the function. If a namedoes not match any of the descriptions, it is matched against apreviously found site part, starting from the longest.

The followingID schemes are detected and supported in thetree / core part. The detection is done per site.

If the split of a tree / core part cannot be found with any of themethods described above, the prefix of the string is matched against apreviously found tree part, starting from the longest. The fallbackmechanism for the still undecided tree / core parts is one of thefollowing. The first one is used ifuse.cor isTRUE, number two if it isFALSE.

  1. Pairwise correlation coefficients are computed between allremaining series. Pairs of series with above median correlationare flagged as similar, and the other pairs are flagged asdissimilar. Each possible number of characters (minimum 1) isconsidered for the share of the treeID. Thecorresponding unique would-be treeIDs determine a set ofclusterings where one cluster is formed by all the measurementseries of a single tree. For each clustering (allocation ofcharacters), an agreement score is computed. The agreement score isdefined as the sum of the number of similar pairs with matchingcluster number and the number of dissimilar pairs with non-matchingcluster number. The number of characters with the maximum agreementis chosen.

  2. If the majority of the names in the site usekcharacters for the tree part, that number is chosen. Otherwise, onecore per tree is assumed. Parametertypo.ratio has adouble meaning as it also defines what is meant by majority here: atleasttypo.ratio / (typo.ratio + 1) *n.tot, wheren.tot is the number of names in the site.

In both fallback mechanisms, the number of characters allocated forthe tree part will be increased until all trees have a non-zeroID or there are no more characters.

Suspected typing errors will be fixed by the function iffix.typos isTRUE. The parametertypo.ratio affects the eagerness to fix typos, i.e. thenumber of counterexamples required to declare a typo. The followingmain typo fixing mechanisms are implemented:

SiteIDs.

If a rare site string resembles an atleasttypo.ratio times more frequent alternative, andif fixing it would not create any name collisions, make the fix.The alternative string must be unique, or if there is more thanone alternative, it is enough if only one of them is a look-alikestring. Any kind of substitution in one character place isallowed if the alternative string has the same length as theoriginal string. The alternative string can be one characterlonger or one character shorter than the original string, but onlyif it involves interpreting one digit as the look-alike alphabetor vice versa. There are requirements to how long a site stringmust be in order to be eligible for replacement / typo fixing,i.e. cannot be shortened to zero length, cannot change the onlycharacter of a site string. The parametersignore.case andignore.site.case havesome effect on this typo fixing mechanism.

Tree and coreIDs.

If all tree / core parts of asite have the same length, each character position is inspectedindividually. If the characters in thei:th position arepredominantly digits (alphabets), any alphabets (digits) arechanged to the corresponding look-alike digit (alphabet) if thereis one. The look-alike groups are {0, O, o}, {1, I, i}, {5,S, s} and {6, G}. The parametertypo.ratiodetermines the decision threshold of interpreting the type of eachcharacter position as alphabet (digit): the ratio of alphabets(digits) to the total number of characters must be at leasttypo.ratio / (typo.ratio + 1). If a namediffers from the majority type in more than one characterposition, it is not fixed. Also, no fixes are performed if any ofthem would cause a possible monotonic order of numeric prefixes tobreak.

The function attempts to convert the tree and core substrings tointegral values. When this succeeds, the converted values are copiedto the output without modification. When non-integral substrings areobserved, each unique tree is assigned a unique integral value. Thesame applies to cores within a tree, but there are some subtletieswith respect to the handling of duplicates. Substrings are sortedbefore assigning thenumericIDs.

The order of columns inrwl, in most cases, does notaffect the tree and coreIDs assigned to each series.

Value

Adata.frame with column one named"tree" giving anID for each tree and column two named"core" givinganID for each core. The original seriesIDs arecopied from rwl as rownames. The order of the rows in the outputmatches the order of the series inrwl. If more than onesite is detected, an additional third column named"site" willcontain a siteID. All columns have integral valuednumeric values.

Author(s)

Andy Bunn (original version) and Mikko Korpela (patches,stc="auto",fix.typos, etc.).

See Also

rwi.stats,read.rwl

Examples

library(utils)data(ca533)read.ids(ca533, stc = c(3, 2, 3))autoread.ids(ca533)

Read Ring Width File

Description

This function reads in a file of ring widths (.rwl) in one of theavailable formats.

Usage

read.rwl(fname,         format = c("auto", "tucson", "compact", "tridas", "heidelberg", "csv"),         ...)

Arguments

fname

acharacter vector giving the file name of therwl file.

format

acharacter vector giving the format. This mustbe"auto" (rough automatic detection),"tucson","compact","tridas","heidelberg" or"csv". Automaticformat detection is the default but failable.

...

arguments specific to the function implementing theoperation for the chosen format.

Details

This is a simple wrapper to the functions actually implementing theread operation.

Value

If a"tucson","compact","heidelberg","csv" file isread (even through"auto"), returns an object of classc("rwl", "data.frame") with the series in columns and the yearsas rows. The seriesIDs are the column names and the yearsare the row names.

If a"tridas" file is read (even through"auto"),returns a list of results. Seeread.tridas for moreinformation.

Author(s)

Mikko Korpela

See Also

read.tucson,read.compact,read.tridas,read.fh,csv2rwl,write.rwl


Read Tree Ring Data Standard (TRiDaS) File

Description

This function reads in a TRiDaS formatXML file.Measurements, derived series and various kinds of metadata aresupported.

Usage

read.tridas(fname, ids.from.titles = FALSE,            ids.from.identifiers = TRUE, combine.series = TRUE,            trim.whitespace = TRUE, warn.units = TRUE)

Arguments

fname

character vector giving the file name of theTRiDaS file.

ids.from.titles

logical flag indicating whether tooverride the (tree, core, radius, measurement) structure imposed bythe element hierarchy (element, sample, radius, measurementSeries)of the file. IfTRUE, measurement series will be rearrangedby matching titles in the file at the aforementioned four levels ofthe hierarchy. Defaults toFALSE, i.e. the element hierarchyof the file will be used.

ids.from.identifiers

logical flag indicating whether to(partially) override the element hierarchy of the file. IfTRUE, measurement series will be grouped according tomatching identifiers at the measurementSeries level, whereidentifiers are available. The changes caused by this option areapplied on top of the structure imposed by the file or computed frommatching titles ifids.from.titles == TRUE. DefaultstoTRUE.

combine.series

logical flag indicating whether tocombine two or more measurement series with the same set of (tree,core, radius, measurement)ID numbers. Each set ofcombined measurement series will be represented by one column of aresultingdata.frame. Overlapping years of combined series do notproduce a warning. If several data points are available for a givenyear, the function chooses one in a rather arbitrary manner. Thisoption can only have effect whenids.from.titles ||ids.from.identifiers.

trim.whitespace

logical flag indicating whether toreplace repeated white spaces in the text content of the file withonly one space. Defaults toTRUE, i.e. excess white spacewill be trimmed from the text.

warn.units

logical flag indicating whether to warnabout unitless measurements and “strange” units. Thefunction expects measurements in units that can be converted tomillimetres. Defaults toTRUE: warnings will be given. Forexample, density measurements will trigger warnings, which can bedisabled by setting this option toFALSE.

Details

The Tree Ring Data Standard (TRiDaS) is described in Jansma et. al(2010).

The parameters used for rearranging (ids.from.titles,ids.from.identifiers) and combining(combine.series) measurement series only affect the fourlowest levels of document structure: element, sample, radius,measurementSeries. Series are not reorganized or combined at theupper structural levels (project, object).

Value

A list with a variable number of components according to the contentsof the input file. The possible list components are:

measurements

Adata.frame or a list ofdata.frames withthe series in columns and the years as rows. Contains measurements(‘⁠<measurementSeries>⁠’) with known years. The seriesIDs are the column names and the years are the rownames. The seriesIDs are derived from ‘⁠<title>⁠’elements in the input file. Each unique combination of‘⁠<project>⁠’, ‘⁠<object>⁠’, ‘⁠<unit>⁠’, ‘⁠<taxon>⁠’,and ‘⁠<variable>⁠’ gets a separatedata.frame.

ids

Adata.frame or a list ofdata.frames with columnsnamed"tree","core","radius", and"measurement", together giving a uniquenumericIDfor each column of thedata.frame(s) inmeasurements.

If!combine.series && (ids.from.titles ||ids.from.identifiers), some rows may be non-unique.

titles

Adata.frame or a list ofdata.frames withcolumns named"tree","core","radius", and"measurement", containing the ‘⁠<title>⁠’ hierarchy ofeach column of thedata.frame(s) inmeasurements.

wood.completeness

Adata.frame or a list ofdata.framescontaining wood completeness information. Column names are a subsetof the following, almost self-explanatory set:"pith.presence","heartwood.presence","sapwood.presence",
"last.ring.presence","last.ring.details","bark.presence",
"n.sapwood","n.missing.heartwood","n.missing.sapwood",
"missing.heartwood.foundation","missing.sapwood.foundation",
"n.unmeasured.inner","n.unmeasured.outer".

unit

Acharacter vector giving the unit of themeasurements. Length equals the number ofdata.frames inmeasurements.

project.id

Anumeric vector giving the projectID, i.e. the position of the corresponding‘⁠<project>⁠’ element), of the measurements in eachdata.frame inmeasurements. Length equals thenumber ofdata.frames.

project.title

Acharacter vector giving the title of theproject of eachdata.frame inmeasurements.Length equals the number ofdata.frames.

site.id

Adata.frame giving the siteID(position of ‘⁠<object>⁠’ element(s) within a ‘⁠<project>⁠’)of eachdata.frame inmeasurements. May haveseveral columns to reflect the possibly nested ‘⁠<object>⁠’elements.

site.title

Adata.frame giving the site(‘⁠<object>⁠’) title of eachdata.frame inmeasurements. May have several columns to reflect thepossibly nested ‘⁠<object>⁠’ elements.

taxon

Adata.frame showing the taxonomic name for eachdata.frame inmeasurements. Contains some ofthe following columns:"text","lang","normal","normalId","normalStd". The firsttwo are a free-form name and its language, and the rest are relatedto a normalized name.

variable

Adata.frame showing the measured variable ofeachdata.frame inmeasurements. Contains someof the following columns:"text","lang","normal","normalId","normalStd","normalTridas". The first two are a free-form name and itslanguage, and the rest are related to a normalized name.

undated

Alist of measurements with unknown years,together with metadata. Elements are a subset of the following:

data

Anumeric vector or a list of such vectorscontaining measurement series

unit

Acharacter vector giving the unit of themeasurements. Length equals the number of measurement series inundated$data

ids

Adata.frame with columns named"tree","core","radius", and"measurement",together giving anumericID for each measurementseries inundated$data. The rows areguaranteed to be unique only when comparing measurement serieswith the sameproject.id andsite.id,but not ifids.from.titles ||ids.from.identifiers.

titles

Adata.frame with columns named"tree","core","radius", and"measurement", containing the ‘⁠<title>⁠’ hierarchy ofeach measurement series inundated$data

project.id

Anumeric vector giving the projectID of each measurement series inundated$data

project.title

Acharacter vector giving the projecttitle of each measurement series inundated$data

site.id

Adata.frame giving the siteID ofeach measurement series inundated$data

site.title

Adata.frame giving the site title ofeach measurement series inundated$data

variable

Adata.frame containing the variable ofeach measurement series inundated$data

taxon

Adata.frame containing taxonomic names ofeach measurement series inundated$data

wood.completeness

Adata.frame containing woodcompleteness information of each measurement series inundated$data

derived

Alist of calculated series of values, togetherwith metadata. Elements are a subset of the following:

data

Anumeric vector or a list of such vectorscontaining calculated series of values.

link

Alist ofdata.frames, one for eachseries inderived$data, giving links to themeasurements used to form the corresponding derived series.Eachdata.frame has a subset of the following columns:"idRef" (reference to a series in the same file),"xLink" (URI),"identifier", and"domain" (identifier and its domain, not necessarily inthe same file).

project.id

Anumeric vector giving the projectID of each derived series inderived$data

id

Anumeric vector giving theID (orderof appearance in the project) of each derived series inderived$data

title

Acharacter vector giving the title of eachderived series inderived$data

project.title

Acharacter vector giving the projecttitle of each derived series inderived$data

unit

Acharacter vector giving the unit of thederived series. Length equals the number of series inderived$data.

standardizing.method

Acharacter vector giving thestandardizing method of the derived series. Length equals thenumber of series inderived$data.

variable

Adata.frame containing the variable ofeach series inderived$data

type

Adata.frame containing the type of variousentities, and metadata related to each ‘⁠type⁠’ element.Contents areNA where the metadata is not applicable (e.g.,notree.id when the ‘⁠type⁠’ element refers to aproject). Columns are a subset of the following:

text

The text of the ‘⁠type⁠’ element

lang

The language of the text

normal

The normalized name of the type

normalId

TheID value of the type in the standarddictionary

normalStd

The name of the standard

project.id

TheID of the project

site.id

One or more columns with this prefix, depending onthe maximum depth of the ‘⁠<object>⁠’ hierarchy. Gives theID of the site where the ‘⁠<type>⁠’ elementappeared.

tree.id

TheID of the tree

core.id

TheID of the core

derived.id

TheID of the derived series

project.title

The title of the project

site.title

One or more columns with this prefix, dependingon the maximum depth of the ‘⁠<object>⁠’ hierarchy. Gives thetitle of the site where the ‘⁠<type>⁠’ element appeared.

tree.title

The title of the tree

core.title

The title of the core

derived.title

The title of the derived series

comments

Adata.frame containing comments to variousentities, and metadata related to each ‘⁠comments⁠’ element.Contents areNA where the metadata is not applicable. Columnsare a subset of the following:

text

The text of the ‘⁠comments⁠’ element

project.id

TheID of the project

site.id

One or more columns with this prefix, depending onthe maximum depth of the ‘⁠<object>⁠’ hierarchy. Gives theID of the site.

tree.id

TheID of the tree

core.id

TheID of the core

radius.id

TheID of the radius

measurement.id

TheID of the measurement series

derived.id

TheID of the derived series

project.title

The title of the project

site.title

One or more columns with this prefix, dependingon the maximum depth of the ‘⁠<object>⁠’ hierarchy. Gives thetitle of the site.

tree.title

The title of the tree

core.title

The title of the core

radius.title

The title of the radius

measurement.title

The title of the measurement series

derived.title

The title of the derived series

identifier

Adata.frame containing identifiers ofvarious entities, and metadata related to each ‘⁠identifier⁠’element. Contents areNA where the metadata is notapplicable. Columns are a subset of the following:

text

The text of the ‘⁠identifier⁠’ element

domain

The domain which the identifier is applicable to

project.id

TheID of the project

site.id

One or more columns with this prefix, depending onthe maximum depth of the ‘⁠<object>⁠’ hierarchy. Gives theID of the site.

tree.id

TheID of the tree

core.id

TheID of the core

radius.id

TheID of the radius

measurement.id

TheID of the measurement series

derived.id

TheID of the derived series

project.title

The title of the project

site.title

One or more columns with this prefix, dependingon the maximum depth of the ‘⁠<object>⁠’ hierarchy. Gives thetitle of the site.

tree.title

The title of the tree

core.title

The title of the core

radius.title

The title of the radius

measurement.title

The title of the measurement series

derived.title

The title of the derived series

remark

Alist of remarks concerning individual measuredor derived values, with some of the following items:

measurements

Remarks related to measurements with a knownyear. Adata.frame with the following columns:

text

The remark

frame

Index to adata.frame inmeasurements

row

Index to a row of thedata.frame

col

Index to a column of thedata.frame

undated

Remarks related to measurements without a knownyear. Adata.frame with the following columns:

text

The remark

series

Index to a series inundated$data

idx

Index to a value in the series

derived

Remarks related to derived values. Adata.frame with the following columns:

text

The remark

series

Index to a series inderived$data

idx

Index to a value in the series

laboratory

Adata.frame or alist ofdata.frames with one item per project. Eachdata.frame contains information about the researchlaboratories involved in the project. Columns are a subset of thefollowing:

name

Name of the laboratory

acronym

Acronym of the name

identifier

Identifier

domain

Domain which the identifier is applicable to

addressLine1

Address

addressLine2

Another address line

cityOrTown

City or town

stateProvinceRegion

State, province or region

postalCode

Postal code

country

Country

research

Adata.frame or alist ofdata.frames with one item per project. Eachdata.frame contains information about the systems in whichthe research project is registered. Columns are the following:

identifier

Identifier

domain

Domain which the identifier is applicable to

description

General description

altitude

Adata.frame containing the altitude oftrees. Columns are the following:

metres

The altitude in metres

project.id

TheID of the project

site.id

One or more columns with this prefix, depending onthe maximum depth of the ‘⁠<object>⁠’ hierarchy. Gives theID of the site.

tree.id

TheID of the tree

project.title

The title of the project

site.title

One or more columns with this prefix, dependingon the maximum depth of the ‘⁠<object>⁠’ hierarchy. Gives thetitle of the site.

tree.title

The title of the tree

preferred

Adata.frame containing links to preferredmeasurement series. Columns are a subset of the following:

idRef

Reference to a series in the same file

xLink

URI

identifier

Identifier of a series not necessarily in thesame file

domain

Domain which the identifier is applicable to

project.id

TheID of the project

site.id

One or more columns with this prefix, depending onthe maximum depth of the ‘⁠<object>⁠’ hierarchy. Gives theID of the site.

tree.id

TheID of the tree

project.title

The title of the project

site.title

One or more columns with this prefix, depending onthe maximum depth of the ‘⁠<object>⁠’ hierarchy. Givesthe title of the site.

tree.title

The title of the tree

Note

This is an early version of the function. Bugs are likely toexist, and parameters and return values are subject to change. Notall metadata defined in the TRiDaS specification is supported –unsupported elements are quietly ignored.

Author(s)

Mikko Korpela

References

Jansma, E., Brewer, P. W., and Zandhuis, I. (2010) TRiDaS 1.1: Thetree-ring data standard.Dendrochronologia,28(2),99–130.

See Also

read.rwl,read.tucson,read.compact,read.fh,write.tridas


Read Tucson Format Ring Width File

Description

This function reads in a Tucson (decadal) format file of ring widths (.rwl).

Usage

read.tucson(fname, header = NULL, long = FALSE,            encoding = getOption("encoding"),             edge.zeros = TRUE, verbose = TRUE)

Arguments

fname

acharacter vector giving the file name of therwl file.

header

logical flag indicating whether the file has aheader. IfNULL then the function will attempt to determineif a header exists.

long

logical flag indicating whether dates in file span0CE and therefore use negative numbers. IfTRUEonly the first 7 characters can be used for seriesIDs.IfFALSE then seriesIDs can be up to 8characters.

encoding

the name of the encoding to be used when reading therwl file. Usually the default value will work, but an rwl filewritten in a non-default encoding may crash the function. In thatcase, identifying the encoding and specifying it here should fix theproblem. Examples of popular encodings available on many systemsare"ASCII","UTF-8", and"latin1" alias"ISO-8859-1". See the help offile.

edge.zeros

logical flag indicating whether leading ortrailing zeros in series will be preserved (when the flag isTRUE, the default) or discarded, i.e. marked asNA(whenFALSE).

verbose

logical flag, print info on data.

Details

This reads in a standard rwl file as defined according to thestandards of theITRDB athttps://www1.ncdc.noaa.gov/pub/data/paleo/treering/treeinfo.txt. Despite thestandards at theITRDB, this occasionally fails due toformatting problems.

Value

An object of classc("rwl", "data.frame") with the series incolumns and the years as rows. The seriesIDs are thecolumn names and the years are the row names.

Author(s)

Andy Bunn. Patched and greatly improved by Mikko Korpela.

See Also

read.rwl,read.compact,read.tridas,read.fh,write.tucson


Red-Noise Spectra of Time-Series

Description

Estimate red-noise spectra from a possibly unevenly spaced time-series.

Usage

redfit(x, t, tType = c("time", "age"), nsim = 1000, mctest = TRUE,       ofac = 4, hifac = 1, n50 = 3, rhopre = NULL,       p = c(0.10, 0.05, 0.02), iwin = 2,       txOrdered = FALSE, verbose = FALSE, seed = NULL,       maxTime = 10, nLimit = 10000)runcrit(n, p = c(0.10, 0.05, 0.02), maxTime = 10, nLimit = 10000)

Arguments

x

anumeric vector representing a possibly unevenlyspaced time-series.

t

anumeric vector of times or ages corresponding tox. If missing, this is set to an evenly spacedincreasing integer sequence (1, 2, ...) alongx.SeetxOrdered.

tType

acharacter string indicating the type of thet vector: either times or ages.

nsim

anumeric value giving the number of simulated AR1spectra to compute.

mctest

alogical flag. IfTRUE, performs aMonte Carlo test for computing red noise false-alarm levels. Inthat case, the result list will contain non-NULL elements"ci80","ci90","ci95" and"ci99".

ofac

oversampling factor for Lomb-Scargle Fourier transform.Anumeric value.

hifac

maximum frequency to analyze relative to the Nyquistfrequency. Anumeric value.

n50

number of segments. The segments overlap by about 50percent.

rhopre

anumeric value giving the prescribedautocorrelation coefficient. IfNULL or negative, theautocorrelation coefficient will be estimated from the data.

p

anumeric orbigq (ifpackage"gmp" is installed) vector of significance levels fora statistical test considering the number of runs in a sequence.See ‘Details’.

iwin

the type of window used for scaling the values of eachsegment of data. Anumeric value or one of"rectangular","welch i","hanning","triangular" and"blackman-harris". Integers0:4 correspond to the character values, in this order. Thedefaultiwin = 2 corresponds to the"hanning"window.

txOrdered

alogical flag. IfTRUE, it isassumed thatt is in ascending order withoutduplicates. IfFALSE (the default),t will besorted andx reordered accordingly. Values ofx at identical values oft are averaged.If duplicates are found, the non-duplicatedt andaveragedx will be included in the return value of thefunction.

verbose

alogical flag. IfTRUE, the functionprints some information while operating.

seed

a value to be given toset.seed at the start ofthe function. The value is also recorded in the list returned. IfnotNULL, this can be used for reproducible results.

maxTime

anumeric value giving the approximate maximumtime in seconds to use for computing the exact acceptance regions ofthe number of runs test. See alsonLimit.

nLimit

anumeric value giving the maximumn for whichruncrit will try to compute an exactsolution to the acceptance regions of the number of runs test.Precomputed solutions may exist for largern). Thislimit is in place because a part of the exact solution always needsto be computed in order to roughly estimate the total time andwhether it would exceedmaxTime. IfnLimit is very large,maxTime may be(greatly) exceeded while computing the aforementioned part of theexact solution.

n

an integral value giving the length of the sequence in thenumber of runs test.

Details

Functionredfit computes the spectrum of a possibly unevenlysampled time-series by using the Lomb-Scargle Fourier transform. Thespectrum is bias-corrected using spectra computed from simulated AR1series and the theoretical AR1 spectrum.

The function duplicates the functionality of program REDFIT by Schulzand Mudelsee. See the manual of that program for more information.The results of this function should be very close to REDFIT. However,some changes have been made:

Functionruncrit computes the limits of the acceptance regionof a number of runs test: assuming a sequence ofn i.i.d.discrete random variables with two possible valuesa andbof equal probability (0.5), we are examining the distribution of thenumber of runs. A run is an uninterrupted sequence of onlya oronlyb. The minimum number of runs is 1 (a sequence with onlya or onlyb) while the maximum number isn(alternatinga andb). See Bradley, p. 253–254,259–263. The function is also called fromredfit;seercnt in ‘Value’ for the interpretation. Inthis case the argumentsp,maxTime andnLimit are passed fromredfit toruncrit,andn is the number of output frequencies.

The results ofruncrit have been essentially precomputed forsome values ofp andn. If a precomputedresult is not found andn is not too large(nLimit,maxTime), the exact results arecomputed on-demand. Otherwise, or if package"gmp" is notinstalled, the normal distribution is used for approximation.

Value

Functionruncrit returns alist containingrcritlo,rcrithi andrcritexact(see below). Functionredfit returns alist with thefollowing elements:

varx

variance ofx estimated from its spectrum.Anumeric value.

rho

average autocorrelation coefficient, either estimatedfrom the data or prescribed (rhopre). Anumericvalue.

tau

the time scale of an AR1 process corresponding torho. Anumeric value.

rcnt

anumeric value giving the number of runs to beused for a statistical test studying the difference between atheoretical AR1 spectrum and the bias-corrected spectrum estimatedfrom the data. Null hypothesis: the two spectra agree, i.e. theprobability of either being larger than the other is 0.5 at everypoint. Requires thatiwin == 0 ("rectangular"),ofac == 1 andn50 == 1. Otherwise thetest is not performed andrcnt isNULL.

rcritlo

anumeric vector of critical low values forthe number of runs, i.e. the lowest value for accepting the nullhypothesis at each level of significancep. Whenreturned fromredfit,NULL whenrcnt isNULL.

rcrithi

anumeric vector of critical high values forthe number of runs, i.e. the highest value for accepting the nullhypothesis at each level of significancep. Whenreturned fromredfit,NULL whenrcnt isNULL.

rcritexact

alogical vector specifying whether eachpair ofrcritlo andrcrithi are exactvalues (TRUE) or approximated from a normal distribution(FALSE). When returned fromredfit,NULL whenrcnt isNULL.

freq

the frequencies used. Anumeric vector. Theother numeric vectors have the same length, i.e. one value for eachfrequency studied.

gxx

estimated spectrum of the data (t,x). Anumeric vector.

gxxc

red noise corrected spectrum of the data. Anumeric vector.

grravg

average AR1 spectrum overnsimsimulations. Anumeric vector.

gredth

theoretical AR1 spectrum. Anumeric vector.

corr

anumeric vector containing the by-frequencycorrection:gxxc equalsgxx divided bycorr (or multiplied by the inverse correction). Alsoused for computingci80,ci90,ci95 andci99.

ci80

anumeric vector containing the bias-corrected80th percentile (by frequency) red noise spectrum. Only ifmctest isTRUE.

ci90

anumeric vector containing the 90th percentilered noise spectrum.

ci95

95th percentile red noise spectrum.

ci99

99th percentile red noise spectrum.

call

the call to the function. Seematch.call.

params

Alist with the following items:

np

number of points in the data.

nseg

number of points in each segment.

nfreq

number of frequencies in the results.

avgdt

average sampling interval.

df

difference between consecutive frequencies.

fnyq

average Nyquist frequency.

n50

value of then50 argument.

ofac

value of theofac argument.

hifac

value of thehifac argument.

segskip

the ideal, non-rounded difference betweenstarting indices of consecutive segments.

iwin

value of theiwin argument. If acharacter value was used, this contains the correspondingnumber used internally.

nsim

value of thensim argument.

mctest

value of themctest argument.

rhopre

value of therhopre argument.

vers

version of dplR. SeepackageVersion.

seed

value of theseed argument.

t

if duplicated values oft are given, thenon-duplicatednumeric time or age vector (seetType) is returned here. OtherwiseNULL. SeetxOrdered.

x

if duplicated values oft are given, theaveragednumeric data vector is returned here. OtherwiseNULL.

Author(s)

Mikko Korpela. Examples by Andy Bunn.

References

Functionredfit is based on the Fortran programREDFIT(version 3.8e), which is in the public domain.

Bradley, J. V. (1968)Distribution-Free StatisticalTests. Prentice-Hall.

Schulz, M. and Mudelsee, M. (2002) REDFIT: estimating red-noisespectra directly from unevenly spaced paleoclimatic time series.Computers & Geosciences,28(3), 421–426.

See Also

print.redfit

Examples

# Create a simulated tree-ring width series that has a red-noise# background ar1=phi and sd=sigma and an embedded signal with # a period of 10 and an amplitude of have the rednoise sd.library(graphics)library(stats)runif(1)rs <- .Random.seedset.seed(123)nyrs <- 500yrs <- 1:nyrs# Here is an ar1 time series with a mean of 2mm,# an ar1 of phi, and sd of sigmaphi <- 0.7sigma <- 0.3sigma0 <- sqrt((1 - phi^2) * sigma^2)x <- arima.sim(list(ar = phi), n = nyrs, sd = sigma0) + 2# Here is a sine wave at f=0.1 to add in with an amplitude# equal to half the sd of the red noise backgroundper <- 10amp <- sigma0 / 2wav <- amp * sin(2 * pi / per * yrs)# Add them together so we have signal and noisex <- x + wav# Here is the redfit specredf.x <- redfit(x, nsim = 500)# Acceptance region of number of runs test# (not useful with default arguments of redfit())runcrit(length(redf.x[["freq"]]))op <- par(no.readonly = TRUE) # Save to reset on exitpar(tcl = 0.5, mar = rep(2.2, 4), mgp = c(1.1, 0.1, 0))plot(redf.x[["freq"]], redf.x[["gxxc"]],     ylim = range(redf.x[["ci99"]], redf.x[["gxxc"]]),     type = "n", ylab = "Spectrum", xlab = "Frequency (1/yr)",     axes = FALSE)grid()lines(redf.x[["freq"]], redf.x[["gxxc"]], col = "#1B9E77")lines(redf.x[["freq"]], redf.x[["ci99"]], col = "#D95F02")lines(redf.x[["freq"]], redf.x[["ci95"]], col = "#7570B3")lines(redf.x[["freq"]], redf.x[["ci90"]], col = "#E7298A")freqs <- pretty(redf.x[["freq"]])pers <- round(1 / freqs, 2)axis(1, at = freqs, labels = TRUE)axis(3, at = freqs, labels = pers)mtext(text = "Period (yr)", side = 3, line = 1.1)axis(2); axis(4)legend("topright", c("x", "CI99", "CI95", "CI90"), lwd = 2,       col = c("#1B9E77", "#D95F02", "#7570B3", "#E7298A"),       bg = "white")box()## Not run: # Second example with tree-ring data# Note the long-term low-freq signal in the data. E.g.,# crn.plot(cana157)library(utils)data(cana157)yrs <- time(cana157)x <- cana157[, 1]redf.x <- redfit(x, nsim = 1000)plot(redf.x[["freq"]], redf.x[["gxxc"]],     ylim = range(redf.x[["ci99"]], redf.x[["gxxc"]]),     type = "n", ylab = "Spectrum", xlab = "Frequency (1/yr)",     axes = FALSE)grid()lines(redf.x[["freq"]], redf.x[["gxxc"]], col = "#1B9E77")lines(redf.x[["freq"]], redf.x[["ci99"]], col = "#D95F02")lines(redf.x[["freq"]], redf.x[["ci95"]], col = "#7570B3")lines(redf.x[["freq"]], redf.x[["ci90"]], col = "#E7298A")freqs <- pretty(redf.x[["freq"]])pers <- round(1 / freqs, 2)axis(1, at = freqs, labels = TRUE)axis(3, at = freqs, labels = pers)mtext(text = "Period (yr)", side = 3, line = 1.1)axis(2); axis(4)legend("topright", c("x", "CI99", "CI95", "CI90"), lwd = 2,       col = c("#1B9E77", "#D95F02", "#7570B3", "#E7298A"),       bg = "white")box()par(op)## End(Not run).Random.seed <- rs

(Running Window) Statistics on Detrended Ring-Width Series

Description

These functions calculate descriptive statistics on adata.frame of (usually) ring-width indices. The statistics areoptionally computed in a running window with adjustable length andoverlap. The data can be filtered so that the comparisons are made toon just high-frequency data.

Usage

rwi.stats.running(rwi, ids = NULL, period = c("max", "common"),                  method = c("spearman", "pearson","kendall"),                  prewhiten=FALSE,n=NULL,                  running.window = TRUE,                  window.length = min(50, nrow(rwi)),                  window.overlap = floor(window.length / 2),                  first.start = NULL,                  min.corr.overlap = min(30, window.length),                  round.decimals = 3,                  zero.is.missing = TRUE)rwi.stats(rwi, ids=NULL, period=c("max", "common"),           method = c("spearman", "pearson","kendall"), ...)rwi.stats.legacy(rwi, ids=NULL, period=c("max", "common"))

Arguments

rwi

adata.frame with detrended and standardized ringwidth indices as columns and years as rows such as that produced bydetrend.

ids

an optionaldata.frame with column one named"tree" giving anumericID for each tree andcolumn two named"core" giving anumericIDfor each core. Defaults to one core per tree as
data.frame(tree=1:ncol(rwi), core=rep(1, ncol(rwi))).

period

acharacter string, either"common" or"max" indicating whether correlations should be limited tocomplete observations over the period common to all cores (i.e. rowscommon to all samples) or the maximum pairwise overlap. Defaultsto"max".

method

Can be either"pearson","kendall", or"spearman" which indicates the correlation coefficient to beused. Defaults to"spearman". Seecor.

n

NULL or an integral value giving the filter lengthfor thehanning filter used for removal of lowfrequency variation.

prewhiten

logical flag. IfTRUE each series iswhitened usingar.

running.window

logical flag indicating whether to use arunning window (TRUE, the default) or to ignore the otherwindow parameters and effectively use one window covering all years(FALSE).

window.length

numeric value indicating the length ofthe running window in years. The default is 50 years or the numberof years (rows) inrwi, whichever is smaller.

window.overlap

numeric value indicating the overlap ofconsecutive window positions, i.e. the number of common years. Thedefault is half of the window length, rounded down.

first.start

an optionalnumeric value setting theposition of the first window. Must be a value between1 andn.years-window.length+1, wheren.years is the number of years inrwi. Thedefault valueNULL lets the function make the decision usingsome heuristic rules.

min.corr.overlap

numeric value setting the minimumnumber of common years in any pair of ring-width series required fortheir correlation to be included in the calculations. Smalleroverlaps are considered to yield unreliable correlation values whichare ignored. Defaults to the minimum of 30 and the length of thewindow. One way to lift the restriction and include all correlationsis to setmin.corr.overlap = 0.

round.decimals

non-negative integernumeric valuesetting the desired number of decimal places in the results. UseNA,NULL or a negative number for no rounding.

zero.is.missing

logical flag indicating whether totreat zeros as missing values (TRUE, the default) or toinclude them in computation (FALSE).

...

arguments passed on torwi.stats.running

Details

This calculates a variety of descriptive statistics commonly used indendrochronology.

The functionrwi.stats is a wrapper that callsrwi.stats.running withrunning.window = FALSE.The results may differ from those prior to dplR 1.5.3, where theformerrwi.stats (now renamed torwi.stats.legacy) wasreplaced with a call torwi.stats.running.

For correctly calculating the statistics on within and between seriesvariability, an appropriate mask (parameterids) must beprovided that identifies each series with a tree as it is common fordendrochronologists to take more than one core per tree. The functionread.ids is helpful for creating a mask based on theseriesID.

Ifids has duplicate tree/core combinations, thecorresponding series are averaged before any statistics are computed.The value of the parameterzero.is.missing is relevant inthe averaging:TRUE ensures that zeros don’tcontribute to the average. The default value ofzero.is.missing isTRUE. The default prior todplR 1.5.3 wasFALSE. If the parameter is set toFALSE,the user will be warned in case zeros are present. Duplicatetree/core combinations are not detected byrwi.stats.legacy.

Row names ofids may be used for matching theIDs with series inrwi. In this case, thenumber of rows inids is allowed to exceed the number ofseries. If some names ofrwi are missing from the rownames ofids, the rows ofids are assumed tobe in the same order as the columns ofrwi, and thedimensions must match. The latter is also the way thatrwi.stats.legacy handlesids, i.e. names areignored and dimensions must match.

Note thatperiod = "common" can produceNaN for many ofthe stats if there is no common overlap period among the cores. Thishappens especially in chronologies with floating subfossil samples(e.g.,ca533).

Some of the statistics are specific to dendrochronology (e.g., theeffective number of cores or the expressed population signal). Usersunfamiliar with these should see Cook and Kairiukstis (1990) andFritts (2001) for further details for computational details on theoutput. The signal-to-noise ratio is calculated following Cook and Pederson (2011).

Note that Buras (2017) cautions against using the expressed population signal as a statistic to determine the whether a chronology correctly represents the population signal of a data set. He reccomends the use of subsample signal strength (sss) over EPS.

If desired, therwi can be filtered in the same manneras the family of cross-dating functions usingprewhiten andn. See the help page forcorr.rwl.seg formore details.

Value

Adata.frame containing the following columns (each rowcorresponds to one position of the window):

start.year

the first year in the window. Not returned ifrunning.window isFALSE or called asrwi.stats orrwi.stats.legacy.

mid.year

the middle year in the window, rounded down. Notreturned ifrunning.window isFALSE or called asrwi.stats orrwi.stats.legacy.

end.year

the last year in the window. Not returned ifrunning.window isFALSE or called asrwi.stats orrwi.stats.legacy.

n.cores

the number of cores

n.trees

the number of trees

n

the average number of trees (for each year, a tree needs atleast one non-NA core in order to be counted). Not returnedin the results ofrwi.stats.legacy

n.tot

total number of correlations calculated asn.wt +n.bt.

Equal ton.cores * (n.cores-1)/2 if there isoverlap between all samples

n.wt

number of within-tree correlations computed

n.bt

number of between-tree correlations computed

rbar.tot

the mean of all the correlations between different cores

rbar.wt

the mean of the correlations between series from thesame tree over all trees

rbar.bt

the mean interseries correlation between all seriesfrom different trees

c.eff

the effective number of cores (takes into account thenumber of within-tree correlations in each tree)

rbar.eff

the effective signal calculated asrbar.bt / (rbar.wt + (1-rbar.wt) /c.eff)

eps

the expressed population signal calculated using the averagenumber of trees as
n *rbar.eff / ((n - 1) *rbar.eff + 1)

snr

the signal to noise ratio calculated using the averagenumber of trees as
n *rbar.eff / (1-rbar.eff)

Note

This function uses theforeach loopingconstruct with the%dopar% operator.For parallel computing and a potential speedup, a parallel backendmust be registered before running the function.

Author(s)

Mikko Korpela, based onrwi.stats.legacy by AndyBunn

References

Buras, A. (2017) A comment on the Expressed Population Signal. Dendrochronologia 44:130-132.

Cook, E. R. and Kairiukstis, L. A., editors (1990)Methods ofDendrochronology: Applications in the Environmental Sciences.Springer.ISBN-13: 978-0-7923-0586-6.

Cook, E. R. and Pederson, N. (2011) Uncertainty, Emergence, andStatistics in Dendrochronology. In Hughes, M. K., Swetnam, T. W., andDiaz, H. F., editors,Dendroclimatology: Progress andProspects, pages 77–112. Springer.ISBN-13:978-1-4020-4010-8.

Fritts, H. C. (2001)Tree Rings and Climate. Blackburn.ISBN-13: 978-1-930665-39-2.

See Also

detrend,cor,read.ids,rwi.stats,corr.rwl.seg

Examples

library(utils)data(gp.rwl)data(gp.po)gp.rwi <- cms(rwl = gp.rwl, po = gp.po)gp.ids <- read.ids(gp.rwl, stc = c(0, 2, 1))# On a running windowrwi.stats.running(gp.rwi, gp.ids)## With no running window (i.e. running.window = FALSE)rwi.stats(gp.rwi, gp.ids)## Restrict to common overlap (in this case 1899 to 1987)rwi.stats(gp.rwi, gp.ids, period="common")rwi.stats.legacy(gp.rwi, gp.ids) # rwi.stats prior to dplR 1.5.3

Do some reporting on a RWL object

Description

This function generates a small report on arwl (orrwi) objectthat gives the user some basic information on the data including the number ofseries, the span of the data, the mean interseries correlation, the number ofmissing rings (zeros), internalNA values, and rings that are very small,or very large.

Usage

rwl.report(rwl,small.thresh=NA,big.thresh=NA)

Arguments

rwl

adata.frame of ring widths withrownames(x) containing years andcolnames(x)containing each seriesID such as produced byread.rwl

small.thresh

anumeric value for the threshold value that will causesmall rings to be listed. If values isNA this will be omitted.

big.thresh

anumeric value for the threshold value that will causelarge rings to be listed. If values isNA this will be omitted.

Details

This generates information about arwl object including the number of series, the mean length of all the series, the first year, last year, the mean first-order autocorrelation (viasummary.rwl), the mean interseries correlation (viainterseries.cor), the years where a series has a missing ring (zero), internal NA, very small ring, very large rings, etc.

This output of this function is not typically meant for the user to access but has aprint method for the user.

Value

Alist with elements containing descriptive information on therwl object. Specifically:

small.thresh

anumeric value passed in.

big.thresh

anumeric value passed in.

nSeries

anumeric value with the number of series.

n

anumeric value with the total number of rings.

meanSegLength

anumeric with the mean segment length.

firstYear

anumeric with the first year.

lastYear

anumeric with the last year.

meanAR1

anumeric with the mean AR1 value of all series.

sdAR1

anumeric with the standard deviation of the AR1 values of all series.

unconnected

alogical indicating if there are rows (years) with all NA values.

unconnectedYrs

anumeric vector with unconnceted years.

nZeros

anumeric with number of zeros in the data.

zeros

alist containing series and years with zeros or anumeric of 0.

allZeroYears

anumeric indicating rows (years) with all zero values.

consecutiveZeros

alist containing series and years with consecuative zeros or anumeric of 0.

meanInterSeriesCor

anumeric with the mean interseries correlation.

sdInterSeriesCor

anumeric with the standard deviation of the interseries correlations.

internalNAs

alist containing series and years with internal NA values or anumeric of 0.

smallRings

alist containing series and years with small rings or anumeric of 0.

bigRings

alist containing series and years with small rings or anumeric of 0.

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

See Also

read.rwl,summary.rwl,interseries.cor

Examples

data("gp.rwl")rwl.report(rwl = gp.rwl)# list very small (smallest 1pct) of rings as wellone.pct <- quantile(gp.rwl[gp.rwl != 0], na.rm=TRUE, probs=0.01)rwl.report(rwl = gp.rwl, small.thresh = one.pct)

Calculate Descriptive Summary Statistics on Ring-Width Series

Description

This function calculates descriptive statistics on arwl objectof raw or detrended ring-width series.

Usage

rwl.stats(rwl)## S3 method for class 'rwl'summary(object, ...)

Arguments

rwl,object

arwl object with (usually) raw ring-width seriesas columns and years as rows such as that produced byread.rwl. It is sometimes desirable to run this ondetrended (e.g., rwi) data.

...

Additional arguments from the generic function. Theseare silently ignored.

Details

This calculates a variety of descriptive statistics commonly used indendrochronology (see below). Users unfamiliar with these should seeCook and Kairiukstis (1990) and Fritts (2001) for further details.

Thesummary method for class"rwl" is a wrapperforrwl.stats.

Value

Adata.frame containing descriptive stats on each"series". These are the first and last year of the series aswell as the length of the series ("first","last","year"). The mean, median, standard deviation are given("mean","median","stdev") as are the skewness,the excess kurtosis (calculated as Pearson’s kurtosis minus 3), the Gini coefficient, and first orderautocorrelation ("skew","kurtosis","gini.coef","ar1").

Note that prior to version 1.6.8, two measures of sensitivity were also included. However mean sensitivity is not a robust statistic that should rarely, if ever, be used (Bunn et al. 2013). Those sensitivity functions ("sens1" and"sens2") are still available for continuity. Users should consider the coef of variation in lieu of mean sensitivity.

Author(s)

Andy Bunn. Slightly improved by Mikko Korpela.

References

Bunn, A. G., Jansma, E., Korpela, M., Westfall, R. D., and Baldwin,J. (2013) Using simulations and data to evaluate mean sensitivity(\zeta) as a useful statistic in dendrochronology.Dendrochronologia,31(3), 250–254.

Cook, E. R. and Kairiukstis, L. A., editors (1990)Methods ofDendrochronology: Applications in the Environmental Sciences.Springer.ISBN-13: 978-0-7923-0586-6.

Fritts, H. C. (2001)Tree Rings and Climate. Blackburn.ISBN-13: 978-1-930665-39-2.

See Also

rwi.stats,read.rwl

Examples

library(utils)data(ca533)rwl.stats(ca533)summary(ca533)

Superposed Epoch Analysis

Description

This function calculates the significance of the departure from themean for a given set of key event years and lagged years.

Usage

sea(x, key, lag = 5, resample = 1000)

Arguments

x

a chronologydata.frame of ring-width indices (suchas produced bychron)

key

a vector specifying the key event years for the superposedepoch

lag

an integral value defining the number of lagged years

resample

an integral value specifying the number of bootstrapsample for calculation of confidence intervals

Details

Superposed epoch analysis (SEA) is used to test the significance of a meantree growth response to certain events (such as droughts). Departuresfrom the meanRWI values for the specified years prior toeach event year, the event year, and the specified years immediatelyafter each event are averaged to a superposed epoch. To determine ifRWI for these years was significantly different fromrandomly selected sets oflag+1 other years, bootstrapresampling is used to randomly select sets oflag+1 yearsfrom the data set and to estimate significances for the departuresfrom the meanRWI.

SEA computation is based on scaledRWI values, and95%-confidence intervals are computed for the scaled values for eachyear in the superposed epoch.

Value

Adata.frame with

lag

the lagged years,

se

the superposed epoch, i.e. the scaled meanRWI forthe event years,

se.unscaled

the unscaled superposed epoch, i.e. the meanRWI for the event years,

p

significance of the departure from the chrono’s meanRWI,

ci.95.lower

lower 95% confidence band,

ci.95.upper

upper 95% confidence band,

ci.99.lower

lower 99% confidence band,

ci.99.upper

upper 99% confidence band.

Author(s)

Christian Zang. Patched and improved by Mikko Korpela.

References

Lough, J. M. and Fritts, H. C. (1987) An assessment of the possibleeffects of volcanic eruptions on North American climate usingtree-ring data, 1602 to 1900AD.Climatic Change,10(3), 219–239.

Examples

library(graphics)library(utils)data(cana157)event.years <- c(1631, 1742, 1845)cana157.sea <- sea(cana157, event.years)foo <- cana157.sea$se.unscalednames(foo) <- cana157.sea$lagbarplot(foo, col = ifelse(cana157.sea$p < 0.05, "grey30", "grey75"),         ylab = "RWI", xlab = "Superposed Epoch")

Segment Plot

Description

Makes a segment plot of tree-ring data.

Usage

seg.plot(rwl, ...)

Arguments

rwl

adata.frame with series as columns and years asrows such as that produced byread.rwl.

...

arguments to be passed to plot.

Details

This makes a simple plot of the length of each series in a tree-ringdata set.

Value

None. This function is invoked for its side effect, which is toproduce a plot.

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

See Also

spag.plot

Examples

library(utils)data(co021)seg.plot(co021)

Calculate Mean Sensitivity

Description

This function calculates mean sensitivity of a detrended ring-widthseries.

Usage

  sens1(x)

Arguments

x

anumeric vector containing the series

Details

This calculates mean sensitivity according to Eq. 1 in Biondi andQeadan (2008). This is the standard measure of sensitivity indendrochronology and is typically calculated on detrended series.However, note that mean sensitivity is not a robust statistic and should rarely, if ever, be used (Bunn et al. 2013).

Value

the mean sensitivity.

Author(s)

Mikko Korpela, based on original by Andy Bunn

References

Biondi, F. and Qeadan, F. (2008) Inequality in Paleorecords.Ecology,89(4), 1056–1067.

Bunn, A. G., Jansma, E., Korpela, M., Westfall, R. D., and Baldwin,J. (2013) Using simulations and data to evaluate mean sensitivity(\zeta) as a useful statistic in dendrochronology.Dendrochronologia,31(3), 250–254.

See Also

sens2,rwl.stats

Examples

library(utils)data(ca533)ca533.rwi <- detrend(rwl = ca533, method = "ModNegExp")sens1(ca533.rwi[, 1])

Calculate Mean Sensitivity on Series with a Trend

Description

This function calculates mean sensitivity of a raw or detrendedring-width series.

Usage

  sens2(x)

Arguments

x

anumeric vector containing the series

Details

This calculates mean sensitivity according to Eq. 2 in Biondi andQeadan (2008). This is a measure of sensitivity in dendrochronologythat is typically used in the presence of a trend. However, note that mean sensitivity is not a robust statistic and should rarely, if ever, be used (Bunn et al. 2013).

Value

the mean sensitivity.

Author(s)

Mikko Korpela, based on original by Andy Bunn

References

Biondi, F. and Qeadan, F. (2008) Inequality in Paleorecords.Ecology,89(4), 1056–1067.

Bunn, A. G., Jansma, E., Korpela, M., Westfall, R. D., and Baldwin,J. (2013) Using simulations and data to evaluate mean sensitivity(\zeta) as a useful statistic in dendrochronology.Dendrochronologia,31(3), 250–254.

See Also

sens1,rwl.stats

Examples

library(utils)data(ca533)ca533.rwi <- detrend(rwl = ca533, method = "ModNegExp")sens2(ca533.rwi[, 1])

Plot Series and a Master

Description

Plots a tree-ring series with a master chronology and displaystheir fit, segments, and detrending options in support of thecross-dating functions.

Usage

series.rwl.plot(rwl, series, series.yrs = as.numeric(names(series)),                seg.length = 100, bin.floor = 100, n = NULL,                prewhiten = TRUE, biweight = TRUE, floor.plus1 = FALSE)

Arguments

rwl

adata.frame with series as columns and years as rowssuch as that produced byread.rwl.

series

anumeric orcharacter vector. Usually atree-ring series. If the length of the value is 1, thecorresponding column ofrwl is selected (by name orposition) as the series and ignored when building the masterchronology. Otherwise, the value must benumeric.

series.yrs

anumeric vector giving the years ofseries. Defaults toas.numeric(names(series)). Ignored ifseries is an index to a column ofrwl.

seg.length

an even integral value giving length of segments inyears (e.g., 20, 50, 100 years).

bin.floor

a non-negative integral value giving the base forlocating the first segment (e.g., 1600, 1700, 1800AD). Typically 0, 10, 50, 100, etc.

n

NULL or an integral value giving the filter lengthfor thehanning filter used for removal of lowfrequency variation.

prewhiten

logical flag. IfTRUE each series iswhitened usingar.

biweight

logical flag. IfTRUE then a robustmean is calculated usingtbrm.

floor.plus1

logical flag. IfTRUE, one year isadded to the base location of the first segment (e.g., 1601, 1701,1801AD).

Details

The function is typically invoked to produce four plots showing theeffect of the detrending optionsn andprewhiten and the binning optionsseg.lengthandbin.floor.

Plot 1

Time series plot of the filtered series and themaster

Plot 2

Scatterplot of series vs. master

Plot 3

Segments that would be used in the other cross-datingfunctions (e.g.,corr.series.seg)

Plot 4

Text giving the detrending options and the time spanof the raw and filtered series and master

The series and master are returned as well.

See help pages forcorr.rwl.seg,corr.series.seg, andccf.series.rwl formore information on these arguments.

Value

Alist containing the filtered vectorsseries andmaster.

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

See Also

corr.rwl.seg,corr.series.seg,ccf.series.rwl

Examples

library(utils)data(co021)foo <- series.rwl.plot(rwl = co021, series = "646244", seg.length = 100,                       n = 5)## note effect of n on first year in the seriesfoo <- series.rwl.plot(rwl = co021, series = "646244", seg.length = 100,                       n = 13, prewhiten = FALSE)bar <- series.rwl.plot(rwl = co021, series = "646244", seg.length = 100,                       n = 7, prewhiten = FALSE)head(foo$series)head(bar$series)

Synchronous Growth Changes

Description

This function calculates the synchronous growth changes (sgc), semi synchronous growth changes (ssgc) and the length of the compared overlap for a given set of tree-ring records. Optionally the probability of exceedence is calculated.

Usage

  sgc(x,overlap = 50, prob = TRUE)

Arguments

x

adata.frame of tree-ring data with records in columns, and years as rows.

overlap

integer value with minimal length of overlapping growth changes (compared number of tree rings - 1). Comparisons with less overlap are not compared.

prob

ifTRUE then the probability of exceedence of the sgc will be calculated

Details

The sgc is a non parametric test based on sign tests.The synchronous growth changes (sgc) and semi synchronous growth changes (ssgc) are meant to replace the Gleichläufigkeit (glk()), since the Gleichläufigkeit can be (strongly) influenced by years when one of the compared series shows no growth change. The sgc gives a better description of the similarity (Visser, 2020). The ssgc gives the percentage years that one of the compared series shows no growth change. This function implements sgc and ssgc as the vectorized pairwise comparison of all records in data set.

The probability of exceedence (p) for the sgc expresses the chance that the sgc is incorrect. The observed value of the sgc is converted to a z-score and based on the standard normal curve the probability of exceedence is calculated (Visser 2020). The result is a matrix of all p-values.

Value

Alist with three or four matrices (p_mat is optional ifprob = TRUE):

  1. sgc_mat:matrix with synchronous growth changes (sgc) for all possible combinations of records

  2. ssgc_mat:matrix with semi-synchronous growth changes (ssgc) for all possible combinations of records

  3. overlap:matrix with number of overlapping growth changes.This is the number of overlapping years minus one.

  4. p_mat:matrix of all probabilities of exceedence for all observed sgc values.

The matrices can be extracted from the list by selecting the name or the index number. Comparisons are only compared if the overlap is above the set theshold and if no threshold is set, this defaults to 50 years.If no comparison can be compared,NA is returned.

To calculate the global sgc of the dataset (assumingx.sgc <- sgc(x):mean(x.sgc$sgc_mat, na.rm = TRUE)). For the global ssgc use:mean(x.sgc$ssgc_mat, na.rm = TRUE).

Author(s)

Ronald Visser

References

Visser, R.M. (2020) On the similarity of tree-ring patterns: Assessing the influence of semi-synchronous growth changes on the Gleichläufigkeit for big tree-ring data sets,Archaeometry,63, 204-215 DOI: https://doi.org/10.1111/arcm.12600

See Also

glk

Examples

  library(dplR)  data(ca533)  ca533.sgclist <- sgc(ca533)  mean(ca533.sgclist$sgc_mat, na.rm = TRUE)  mean(ca533.sgclist$ssgc_mat, na.rm = TRUE)

Skeleton Plot

Description

Automatically generates a skeleton plot of tree-ring data.

Usage

skel.plot(rw.vec, yr.vec = NULL, sname = "", filt.weight = 9,          dat.out = FALSE, master = FALSE, plot = TRUE)

Arguments

rw.vec

anumeric vector of a tree-ring chronology orseries

yr.vec

optionalnumeric vector giving years for thetree-ring data

sname

an optionalcharacter string giving theID for the data. The width of the string, often identicalto the number of characters, must be less than 8.

filt.weight

filter length for the Hanning filter, defaults to 9

dat.out

logical flag indicating whether to return adata.frame containing the data.

master

logical flag indicating whether to make the plotwith the segments inverted to ease pattern matching. IfTRUEthe segments will be plotted from the top down and the labels on thex axes will be on the bottom.

plot

logical flag indicating whether to make a plot.

Details

This makes a skeleton plot – a plot that gives the relative growth foryeart relative to yearst-1 andt+1. Note that this plot is a standard plot indendrochronology and typically made by hand for visually cross-datingseries. This type of plot might be confusing to those not accustomedto visual cross-dating. See references for more information. Theimplementation is based on Meko’s (2002) skeleton plotting approach.

The skeleton plot is made by calculating departures from highfrequency growth for each year by comparing yeart to thesurrounding three years(t-1,t,t+1). Low frequencyvariation is removed using ahanning filter. Relativegrowth is scaled from one to ten but only values greater than threeare plotted. This function’s primary effect is to create plot withabsolute units that can be printed and compared to other plots. Here,anomalous growth is plotted on a 2mm grid and up to 120 years areplotted on a single row with a maximum of 7 rows (840 years). Theseplots are designed to be plotted on standard paper using anappropriatedevice, e.g.,postscript with defaults or topdf with plot width and height to accommodate a landscape plot,e.g.,width = 10,height = 7.5,paper = "USr". These plots are designed to be printableand cut into strips to align long series. Statistical cross-dating ispossible if the data are output but more easily done using the functionsxskel.plot andxskel.ccf.plot.

Value

This function is invoked primarily for its side effect, which is toproduce a plot. Ifdat.out isTRUE then adata.frame is returned with the years and height of theskeleton plot segments as columns.

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

References

Stokes, M. A. and Smiley, T. L. (1968)An Introduction toTree-Ring Dating. The University of Arizona Press.ISBN-13: 978-0-8165-1680-3.

Sheppard, P. R. (2002) Crossdating Tree Rings Using Skeleton Plotting.https://www.ltrr.arizona.edu/skeletonplot/introcrossdate.htm.

Meko, D. (2002) Tree-Ring MATLAB Toolbox.https://www.mathworks.com/matlabcentral/.

See Also

Devices,hanning,xskel.plot,xskel.ccf.plot

Examples

library(utils)data(co021)x <- co021[,33]x.yrs <- time(co021)x.name <- colnames(co021)[33]## On a raw ring width series - undatedskel.plot(x)## On a raw ring width series - dated with namesskel.plot(x, yr.vec = x.yrs, sname = x.name, master = TRUE)## Not run: library(grDevices)## Try cross-datingy <- co021[, 11]y.yrs <- time(co021)y.name <- colnames(co021)[11]## send to postscript - 3 pages totalfname1 <- tempfile(fileext=".ps")print(fname1) # tempfile used for PS outputpostscript(fname1)## "Master series" with correct calendar datesskel.plot(x, yr.vec = x.yrs, sname = x.name, master = TRUE)## Undated series, try to align with last plotskel.plot(y)## Here's the answer...skel.plot(y, yr.vec = y.yrs, sname = y.name)dev.off()unlink(fname1) # remove the PS file## alternatively send to pdffname2 <- tempfile(fileext=".pdf")print(fname2) # tempfile used for PDF outputpdf(fname2, width = 10, height = 7.5, paper = "USr")skel.plot(x, yr.vec = x.yrs, sname = x.name, master = TRUE)skel.plot(y)skel.plot(y, yr.vec = y.yrs, sname = y.name)dev.off()unlink(fname2) # remove the PDF file## End(Not run)

Spaghetti Plot

Description

Makes a spaghetti plot of tree-ring data.

Usage

spag.plot(rwl, zfac = 1, useRaster = FALSE, res = 150, ...)

Arguments

rwl

adata.frame with series as columns and years asrows such as that produced byread.rwl.

zfac

a multiplier forrwl to enhance clarity whenplotting.

useRaster

Alogical flag. IfTRUE, the tree-ringseries are drawn as a raster image. Other parts of the plot arenot affected. Other choices areNA (automatic) andFALSE (use vector graphics, the default). Seewavelet.plot.

res

Anumeric vector of length 1. The resolution(pixels per inch) of the tree-ring series when a raster image isused.

...

arguments to be passed tolines.

Details

This makes a simple plot of each series in a tree-ring data set. Eachseries is centered first by subtracting the column mean usingscale. The plot can be grossly tuned withzfac which is a multiplier torwl beforeplotting and centering.

Value

None. This function is invoked for its side effect, which is toproduce a plot.

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

See Also

seg.plot

Examples

library(utils)data(co021)plot(co021,plot.type = "spag")spag.plot(co021, zfac = 2)

Simple Signal Free Standardization

Description

A simple implentation of the signal-free chronology

Usage

ssf(rwl,     method="Spline",     nyrs = NULL,     difference = FALSE,    max.iterations = 25,     mad.threshold = 5e-4,    recode.zeros = FALSE,    return.info = FALSE,     verbose = TRUE)

Arguments

rwl

arwl object with series as columns and years asrows such as that produced byread.rwl. See ‘Details’.

method

acharacter vector to determine the detrendingmethod. See ‘Details’ below. Possible values are
c("Spline", "AgeDepSpline").

nyrs

a number controlling the smoothness of thefitted curve in methods. See ‘Details’ indetrend.series.

difference

alogical flag. Compute residuals by subtraction if TRUE, otherwise use division. See ‘Details’ indetrend.series

max.iterations

anumeric. The maximum number of iterations to be used in the fitting process. See ‘Details’.

mad.threshold

anumeric. The median absolute difference threshold used for a stopping criteria. See ‘Details’.

recode.zeros

alogical flag. Replace values of zero inrwl with 0.001 if TRUE.

return.info

alogical flag. IfTRUE, detailsabout models and data will be added to the return value. See‘Value’.

verbose

alogical flag. Write out details to the screen?

Details

This function creates a simple signal-free chronology that loosely follows the procedures laid out on p75 of Melvin and Briffa (2008). This function is a lighter version of that procedure and users who want more control and refinement should look to the CRUST program decried in Melvin and Briffa (2014). These steps are described in more detail inLearning to Love R.

  1. Detrend each series using the selected method, calculate RWI by division (or subtraction), and create an initial mean-value chronology.

  2. Create signal-free measurements by dividing (or subtracting) each series of measurements by the chronology. Ifreturn.info is invoked these are returned insfRW_Array.

  3. Rescale the signal-free measurements to their original mean. Ifreturn.info is invoked these are returned insfRWRescaled_Array.

  4. If the sample depth is one, replace signal-free measurements with original measurements.

  5. Fit curves to signal free measurements.Ifreturn.info is invoked these are returned insfRWRescaledCurves_Array.

  6. Get new growth indicies by dividing (or subtracting) the original measurements by curves in the last step. Ifreturn.info is invoked these are returned insfRWI_Array.

  7. Create a mean-value chronology using the indicies from the prior step. Ifreturn.info is invoked these are returned insfCrn_Mat.

  8. Repeat steps two through seven up tomaxIter or until themadThreshold is reached. The stopping criteria is determined using the absolute difference between filtered chronologies generated in interation k and k-1. This is done with the residuals of a high-pass filter on the chronology using a cubic smoothing spline (caps) with the stiffness set as the median of the segment lengths of series contributing to the chronology. The stopping threshold is calculated as the median absolute difference of the kth and kth-1 chronologies weighted by the normalized sample depth. Ifreturn.info is invoked the residual chronologies are returned inhfCrnResids_Mat and the median absolute differences are returns inMAD_Vec.

The input object (rwl) should be ofclassrwl. If it not, the function will attempt to coerce it usingas.rwl and a warning will be issued.

See the references below for further details on detrending. It's a dark art.

Value

An object of of classcrn anddata.frame with the signal-free chronology and the sample depth. The years are stored as row numbers.

Ifreturn.info isTRUE alist containing ouptput by iteration (k):

infoList

alist with information on the arguments used in the function call.

k

anumeric containing the number of iterations.

ssfCrn

the signal-free chronology as above.

sfRW_Array

anarray of years by series by iteration (0:k) that holds the signal free measurements. The values insfRW_Array[,,1] are what is used at the start of the iterative process (iteration 0) which here are the original data.

sfRWRescaled_Array

anarray of years by series by iteration (0:k) that holds the rescaled signal free measurements. The values insfRWRescaled_Array[,,1] are what is used at the start of the iterative process (iteration 0) which here are the original data.

sfRWRescaledCurves_Array

anarray of years by series by iteration (0:k) that holds the rescaled signal free curve fits. The values insfRWRescaledCurves_Array[,,1] are the curves used at the start of the iterative process (iteration 0).

sfRWI_Array

anarray of years by series by iteration (0:k) that holds the detrended signal free measurements. The values insfRWI_Array[,,1] are the RWI values at the start of the iterative process (iteration 0).

sfCrn_Mat

amatrix of years by iteration (0:k) that holds the calculated chronology. The values insfCrn_Mat[,1] is the initial chronology from the start of the iterative process (iteration 0).

hfCrn_Mat

amatrix of years by iteration (0:k) that holds the calculated high-frequency chronology. The values inhfCrn_Mat[,1] is the initial high-frequency chronology from the start of the iterative process (iteration 0).

hfCrnResids_Mat

amatrix of years by k-1 that holds the differences between the kth and the kth-1 high frequency chronology residuals.

MAD_out

avector containing the median absolute difference between iteration k and k-1.

Author(s)

Ed Cook provided Fortran code that was ported to R by Andy Bunn.

References

Melvin, TM, Briffa, KR (2008) A 'signal-free' approach to dendroclimatic standardisation. Dendrochronologia 26: 71–86 doi: 10.1016/j.dendro.2007.12.001

Melvin T. M. and Briffa K.R. (2014a) CRUST: Software for the implementation of Regional Chronology Standardisation: Part 1. Signal-Free RCS. Dendrochronologia 32, 7-20, doi: 10.1016/j.dendro.2013.06.002

Melvin T. M. and Briffa K.R. (2014b) CRUST: Software for the implementation of Regional Chronology Standardisation: Part 2. Further RCS options and recommendations. Dendrochronologia 32, 343-356, doi: 10.1016/j.dendro.2014.07.008

See Also

detrend.chron

Examples

library(stats)data(wa082)wa082_SSF <- ssf(wa082)plot(wa082_SSF,add.spline=TRUE,nyrs=20)wa082_SSF_Full <- ssf(wa082,method = "AgeDepSpline",   difference = TRUE, return.info = TRUE)plot(wa082_SSF_Full$ssfCrn,add.spline=TRUE,nyrs=20)

Subsample Signal Strength

Description

Calculate subsample signal strength on adata.frame of (usually) ring-width indices.

Usage

sss(rwi, ids = NULL)

Arguments

rwi

adata.frame with detrended and standardized ringwidth indices as columns and years as rows such as that produced bydetrend.

ids

an optionaldata.frame with column one named"tree" giving anumericID for each tree andcolumn two named"core" giving anumericIDfor each core. Defaults to one core per tree as
data.frame(tree=1:ncol(rwi), core=rep(1, ncol(rwi))).

Details

This calculates subsample signal strength (sss) following equation 3.50 in Cook and Kairiukstis (1990) but using notation from Buras (2017) because writing the prime unicode symbol seems too difficult. The function callsrwi.stats and passes it the argumentsids andprewhiten.

To make better use of variation in growth within and between series, an appropriate mask (parameterids) should be provided that identifies each series with a tree as it is common for dendrochronologists to take more than one core per tree. The functionread.ids is helpful for creating a mask based on the seriesID.

Subsample signal strength is calculated as\frac{n[1+(N-1)\bar{r}]}{N[1+(n-1)\bar{r}]} wheren andN are the number of cores or trees in the subsample and sample respectively andrbar is mean interseries correlation. If there is only one core per treen is the sample depth in a given year (rowSums(!is.na(rwi))),N is the number of cores (n.cores as given byrwi.stats), andrbar is the mean interseries correlation between all series (r.bt as given byrwi.stats). If there are multiple cores per treen is the number of trees present in a given year,N is the number of trees (n.trees as given byrwi.stats), andrbar is the effective mean interseries correlation (r.eff as given byrwi.stats).

Readers interested in the differences between subsample signal strength and the more commonly used (running) expressed population signal should look at Buras (2017) on the common misuse of the expressed population signal as well as Cook and Pederson (2011) for a more general approach to categorizing variability in tree-ring data.

Value

Anumeric containing the subsample signal strength that is the same as number if rows ofrwi.

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

References

Buras, A. (2017) A comment on the Expressed Population Signal. Dendrochronologia 44:130-132.

Cook, E. R. and Kairiukstis, L. A., editors (1990)Methods ofDendrochronology: Applications in the Environmental Sciences.Springer.ISBN-13: 978-0-7923-0586-6.

Cook, E. R. and Pederson, N. (2011) Uncertainty, Emergence, andStatistics in Dendrochronology. In Hughes, M. K., Swetnam, T. W., andDiaz, H. F., editors,Dendroclimatology: Progress andProspects, pages 77–112. Springer.ISBN-13:978-1-4020-4010-8.

See Also

rwi.stats,read.ids

Examples

data(ca533)ca533.rwi <- detrend(ca533,method="Spline")# assuming 1 core / treeca533.sss <- sss(ca533.rwi)ca533.ids <- autoread.ids(ca533)# done properly with >=1 core / tree as per the idsca533.sss2 <- sss(ca533.rwi,ca533.ids)yr <- time(ca533)plot(yr,ca533.sss,type="l",ylim=c(0.4,1),     col="darkblue",lwd=2,xlab="Year",ylab="SSS")lines(yr,ca533.sss2,lty="dashed",      col="darkgreen",lwd=2)# Plot the chronology showing a potential cutoff year based on SSS# (using sss2 with the correct series IDs to get >=1 core / tree as per the ids)ca533.crn <- chron(ca533.rwi)def.par <- par(no.readonly=TRUE)par(mar = c(2, 2, 2, 2), mgp = c(1.1, 0.1, 0), tcl = 0.25, xaxs='i')plot(yr, ca533.crn[, 1], type = "n", xlab = "Year",     ylab = "RWI", axes=FALSE)cutoff <- max(yr[ca533.sss2 < 0.85])xx <- c(500, 500, cutoff, cutoff)yy <- c(-1, 3, 3, -1)polygon(xx, yy, col = "grey80")abline(h = 1, lwd = 1.5)lines(yr, ca533.crn[, 1], col = "grey50")lines(yr, caps(ca533.crn[, 1], nyrs = 32), col = "red", lwd = 2)axis(1); axis(2); axis(3);par(new = TRUE)## Add SSSplot(yr, ca533.sss2, type = "l", xlab = "", ylab = "",     axes = FALSE, col = "blue")abline(h=0.85,col="blue",lty="dashed")axis(4, at = pretty(ca533.sss2))mtext("SSS", side = 4, line = 1.1, lwd=1.5)box()par(def.par)

Chronology Stripping byEPS

Description

EPS-based chronology stripping after Fowler & Boswijk 2003.

Usage

strip.rwl(rwl, ids = NULL, verbose = FALSE, comp.plot = FALSE,          legacy.eps = FALSE)

Arguments

rwl

adata.frame of raw tree-ring widths series, such asthat produced byread.rwl orread.fh

ids

an optionaldata.frame with column one named"tree" giving anumericID for each tree andcolumn two named"core" giving anumericIDfor each core. This is passed on torwi.stats. Seeits manual for the meaning of the default valueNULL and moreinformation.

verbose

logical flag, indicating if theEPScalculated at each step and other details should be printed on theconsole during the chronology stripping process

comp.plot

logical flag, indicating if a diagnostic plotwith year-wise stripped and unstrippedEPS should be drawn(see details below)

legacy.eps

logical flag, indicating if theEPSwill be calculated withrwi.stats (FALSE, the default)orrwi.stats.legacy (TRUE)

Details

TheEPS-based chronology stripping is implemented afterFowler & Boswijk 2003: First, all series are standardized using adouble detrending procedure with splines and frequency cutoffs of 50%at 20 and 200 years. Then,EPS is calculated for thechronology including all (remaining) series. In each iteration, thealgorithm calculates leave-one-outEPS values, and theseries whose removal increases overallEPS the most isdiscarded. This is repeated until no further increase inEPS is gained by discarding a single series. The procedureis then repeated in the opposite direction, i.e., the reinsertion ofeach previously removed series into thedata.frame isconsidered. In each iteration, the series (if any) whose reinsertionincreasesEPS the most is reinserted. As a last step,EPS is calculated for each year of the stripped and originalchronology including all series. Ifcomp.plot is set toTRUE, a diagnostic plot is shown for the year-wise comparison.

When verbose output is chosen, theEPS values for allleave-one-out (or back-in) chronologies are reported. If discardingor re-inserting a single series leads to an improvement inEPS, this series is marked with an asterisk.

Value

The functions returns adata.frame of raw tree-ring widths,where series that do not contribute to an overall improvement inEPS are left out.

Author(s)

Christian Zang. Patched and improved by Mikko Korpela.

References

Fowler, A. and Boswijk, G. (2003) Chronology stripping as a tool forenhancing the statistical quality of tree-ringchronologies.Tree-Ring Research,59(2), 53–62.

See Also

rwi.stats

Examples

library(utils)data(anos1)anos1.ids <- read.ids(anos1, stc = c(4, 3, 1))srwl <- strip.rwl(anos1, ids = anos1.ids, verbose = TRUE)tail(srwl)

Calculate Tukey's Biweight Robust Mean

Description

This calculates a robust average that is unaffected by outliers.

Usage

tbrm(x, C = 9)

Arguments

x

anumeric vector

C

a constant.C is preassigned a value of 9according to the Cook reference below but other values arepossible.

Details

This is a one step computation that follows the Affy whitepaper below,see page 22. This function is called bychron tocalculate a robust mean.C determines the point at whichoutliers are given a weight of 0 and therefore do not contribute tothe calculation of the mean.C = 9 sets values roughly+/-6 standard deviations to 0.C = 6 is also used intree-ring chronology development. Cook and Kairiukstis (1990) havefurther details.

An exact summation algorithm (Shewchuk 1997) is used. When someassumptions about the rounding of floating point numbers andconservative compiler optimizations hold, summation error iscompletely avoided. Whether the assumptions hold depends on theplatform, i.e. compiler andCPU.

Value

Anumeric mean.

Author(s)

Mikko Korpela

References

Statistical Algorithms Description Document, 2002, Affymetrix.

Cook, E. R. and Kairiukstis, L. A., editors (1990)Methods ofDendrochronology: Applications in the Environmental Sciences.Springer.ISBN-13: 978-0-7923-0586-6.

Mosteller, F. and Tukey, J. W. (1977)Data Analysis andRegression: a second course in statistics. Addison-Wesley.ISBN-13: 978-0-201-04854-4.

Shewchuk, J. R. (1997) Adaptive precision floating-point arithmeticand fast robust geometric predicates.Discrete andComputational Geometry,18(3), 305–363.

See Also

chron

Examples

library(stats)library(utils)foo <- rnorm(100)tbrm(foo)mean(foo)## Comparedata(co021)co021.rwi <- detrend(co021, method = "ModNegExp")crn1 <- apply(co021.rwi, 1, tbrm)crn2 <- chron(co021.rwi)cor(crn1, crn2[, 1])

Retrieve or set the time values for rwl and crn objects

Description

Retrieve or set the time values for rwl and crn objects.

Usage

## S3 method for class 'rwl'time(x, ...)## S3 method for class 'crn'time(x, ...)time(x) <- value

Arguments

x

An object of class"rwl" or an aboject of class"crn".

...

Not used.

value

Anumeric vector to assign the time.

Value

Anumeric vector of time (typically in years) for the object. This is done viaas.numeric(rownames(x)) but has been asked for by users so many times that it is being included as a function.

Author(s)

Andy Bunn

See Also

read.rwlread.crn

Examples

library(utils)data(co021)# extract yearsco021.yrs <- time(co021)# set years -- silly exampletime(co021) <- co021.yrs+100

Calculate mean across cores in a tree

Description

This function calculates the mean value for each tree in a rwl or rwi object.

Usage

treeMean(rwl, ids, na.rm=FALSE)

Arguments

rwl

adata.frame of ring widths withrownames(rwl) containing years andcolnames(rwl)containing each seriesID such as produced byread.rwl

ids

adata.frame with column one named"tree" giving anumericID for each tree andcolumn two named"core" giving anumericIDfor each core.

na.rm

logical passed torowMeans. Should missing values be removed?

Details

This function averages together multiple cores to give a mean value of growth.It is very common in dendrochronology to take more than one core per tree. Inthose cases it is occassionally desirable to have an average of the cores.This function merely loops through therwl object and calculates therowMeans for each tree. Ifna.rm=TRUE trees with >1 sample will be averaged only over the period where the samples overlap. If FALSE the output can vary in the number of samples. See examples.

Value

An object of classc("rwl", "data.frame") with the mean annual value for each tree.

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

See Also

read.rwl,read.ids

Examples

data(gp.rwl)gp.ids <- read.ids(gp.rwl, stc = c(0, 2, 1))gp.treeMean <- treeMean(gp.rwl, gp.ids)gp.treeMean2 <- treeMean(gp.rwl, gp.ids, na.rm=TRUE)# look at an example of a single tree with different averaging periodstree40 <- data.frame(gp.rwl[, c("40A","40B")],                     gp.treeMean[, "40", drop=FALSE],                     gp.treeMean2[, "40", drop=FALSE])names(tree40) <- c("coreA", "coreB", "treeMean1", "treeMean2")head(tree40,50)data(ca533)ca533.treeMean <- treeMean(ca533, autoread.ids(ca533))# plot using S3method for class "rwl"plot(ca533.treeMean,plot.type="spag")

Browse and Check Standard TRiDaS Vocabulary

Description

This function can be used to browse the TRiDaS vocabulary by category.

Usage

tridas.vocabulary(category = c("dating type", "measuring method",                      "shape", "location type", "variable", "unit",                      "remark", "dating suffix", "presence / absence",                      "complex presence / absence", "certainty"),                  idx = NA, term = NA, match.exact = FALSE)

Arguments

category

Vocabulary category as acharacter vector oflength one. One of"dating type","measuring method","shape","location type","variable","unit","remark","dating suffix","presence / absence","complex presence / absence","certainty". Partial matches are allowed.

idx

Anumeric vector. Index to thecharactervector containing the vocabulary of the given category.

term

Acharacter vector. One or more (partial) terms tolook for in the given category.

match.exact

Alogical value. IfTRUE, partialmatching ofterm is not used. Defaults toFALSE.

Details

The Tree Ring Data Standard (TRiDaS) is described in Jansma et. al(2010).

The function has four usage modes:

  1. Whenidx is given, returns item numberidx in the givencategory. There may beseveral numbers inidx, in which case multiple itemsare returned.

  2. Whenterm contains one or more items andmatch.exact isTRUE, checks whether any of theterms is an exact match in the givencategory

  3. Whenterm contains one or more items andmatch.exact isFALSE, expands partial matches ofthe terms in the vocabulary of the givencategory

  4. When onlycategory is given, returns the completevocabulary in the givencategory

Value

In mode 1

Acharacter vector, same length as inidx

In mode 2

Alogical value

In mode 3

Acharacter vector, same length as interm

In mode 4

Acharacter vector

Author(s)

Mikko Korpela

References

Jansma, E., Brewer, P. W., and Zandhuis, I. (2010) TRiDaS 1.1: Thetree-ring data standard.Dendrochronologia,28(2),99–130.

See Also

read.tridas,write.tridas

Examples

## Show all entries in category "measuring method"tridas.vocabulary(category = "measuring")## Show item number one in category "complex presence / absence"tridas.vocabulary(category = "complex", idx = 1)## Check whether "half section" exists in category "shape"tridas.vocabulary(category = "shape", term = "half section",                  match.exact = TRUE)## Return unabbreviated matches to several queries in category "remark"tridas.vocabulary(category = "remark",                  term = c("trauma", "fire", "diffuse"))

UUID Generator

Description

Initializes and returns a generator of universally unique identifiers.Use the returned function repeatedly for creating one or moreUUIDs, one per function call.

Usage

uuid.gen(more.state = "")

Arguments

more.state

Acharacter string for altering the state of the generator

Details

This function returns a function (closure) which generatesUUIDs. The state of that anonymous function is set whenuuid.gen is called. The state consists of the following:

The Pseudo Random Number Generator ofR (see.Random.seed) is used in the generation ofUUIDs. No initialization of thePRNG is done.Tampering with the state of theRPRNG while using a givenUUID generator causes a risk of non-unique identifiers.Particularly, setting the state of thePRNG to the samevalue before two calls to theUUID generator guarantees twoidentical identifiers. If twoUUID generators have adifferent state, it isnot a problem to have thePRNGgoing through or starting from the same state with both generators.

The user is responsible for selecting aPRNG with areasonable number of randomness. Usually, this doesn’t require anyaction. For example, anyPRNG algorithm available inRworks fine. However, the uniqueness ofUUIDs can bedestroyed by using a bad user-suppliedPRNG.

TheUUIDs produced byuuid.gen generators are Version4 (random) with 122 random bits and 6 fixed bits. TheUUIDis presented as acharacter string of 32 hexadecimal digits and4 hyphens:

⁠xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx⁠

wherex is any hexadecimal digit andy is one of"8","9","a", or"b". Eachx andy in the example is an independent variables (for all practicalpurposes); subscripts are omitted for clarity. TheUUIDgenerator gets 32 hex digits from theMD5 message digestalgorithm by feeding it a string consisting of the constant generatorstate and 5 (pseudo) random numbers. After that, the 6 bits are fixedand the hyphens are added to form the finalUUID.

Value

A parameterless function which returns a singleUUID(character string)

Author(s)

Mikko Korpela

References

Leach, P., Mealling, M., and Salz, R. (2005) A Universally UniqueIDentifier (UUID)URN namespace.RFC4122, RFC Editor.https://www.rfc-editor.org/rfc/rfc4122.txt.

See Also

digest,Random

Examples

## Normal useug <- uuid.gen()uuids <- character(100)for(i in 1:100){  uuids[i] <- ug()}length(unique(uuids)) == 100 # TRUE, UUIDs are unique with high probability## Do NOT do the following unless you want non-unique IDsrs <- .Random.seedset.seed(0L)id1 <- ug()set.seed(0L)id2 <- ug()id1 != id2 # FALSE, The UUIDs are the same.Random.seed <- rs## Strange usage pattern, but will probably produce unique IDsug1 <- uuid.gen("1")set.seed(0L)id1 <- ug1()ug2 <- uuid.gen("2")set.seed(0L)id2 <- ug2()id1 != id2 # TRUE, The UUIDs are different with high probability.Random.seed <- rs

Hurricane Ridge, Pacific silver fir

Description

This data set gives the raw ring widths for Pacific silver firAbies amabilis at Hurricane Ridge in Washington,USA.There are 23 series. Data set was created usingread.rwland saved to an .rda file usingsave.

Usage

data(wa082)

Format

Adata.frame containing 23 tree-ring series in columns and 286years in rows.

Source

International tree-ring data bank, Accessed on 20-April-2021 athttps://www.ncei.noaa.gov/pub/data/paleo/treering/measurements/northamerica/usa/wa082.rwl

References

Schweingruber, F. (1983) Hurricane Ridge Data Set.IGBPPAGES/World Data Center for Paleoclimatology DataContribution Series 1983-wa082.RWL.NOAA/NCDCPaleoclimatology Program, Boulder, Colorado,USA.


Plot a Continuous Wavelet Transform

Description

This function creates afilled.contour plot of a continuouswavelet transform as output frommorlet.

Usage

wavelet.plot(wave.list,             wavelet.levels = quantile(wave.list$Power,                                       probs = (0:10)/10),             add.coi = TRUE, add.sig = TRUE,             x.lab = gettext("Time", domain = "R-dplR"),             period.lab = gettext("Period", domain = "R-dplR"),             crn.lab = gettext("RWI", domain = "R-dplR"),             key.cols = rev(rainbow(length(wavelet.levels)-1)),             key.lab = parse(text=paste0("\"",                                         gettext("Power",                                                 domain="R-dplR"),                                         "\"^2")),             add.spline = FALSE, f = 0.5, nyrs = NULL,             crn.col = "black", crn.lwd = 1,coi.col='black',             crn.ylim = range(wave.list$y) * c(0.95, 1.05),             side.by.side = FALSE,             useRaster = FALSE, res = 150, reverse.y = FALSE, ...)

Arguments

wave.list

Alist. Output frommorlet.

wavelet.levels

Anumeric vector. Values for levels ofthe filled contours for the wavelet plot.

add.coi

Alogical flag. Add cone of influence?

add.sig

Alogical flag. Add contour lines for significance?

x.lab

X-axis label.

period.lab

Y-axis label for the wavelet plot.

crn.lab

Y-axis label for the time-series plot.

key.cols

A vector of colors for the wavelets and the key.

key.lab

Label for key.

add.spline

Alogical flag. Add a spline to thetime-series plot usingcaps?.

nyrs

A number giving the rigidity of the smoothing spline,defaults to 0.33 of series length ifnyrs isNULL.

f

A number between 0 and 1 giving the frequency response orwavelength cutoff for the smoothing spline. Defaults to 0.5.

crn.col

Line color for the time-series plot.

crn.lwd

Line width for the time-series plot.

coi.col

Color for the COI ifadd.coi isTRUE.

crn.ylim

Axis limits for the time-series plot.

side.by.side

Alogical flag. Plots will be in one row ifTRUE.

useRaster

Alogical flag. IfTRUE, the filledcontours are drawn as a raster image. Other parts of the plot arenot affected.useRaster=TRUE can be especially useful when apdf device is used: the size and complexity of thePDF file will probably be greatly reduced. Setting thistoTRUE has negative effects when used with a bitmapdevice such aspng. IfNA, plotting of a raster imagewill be attempted if and only if the name of the graphics device is"pdf" or"postscript". The default isFALSE:draw directly to the graphics device without using an intermediateraster image.

res

Anumeric vector of length 1. The resolution(pixels per inch) of the filled contours when a raster image isused. SeeuseRaster.

reverse.y

Alogical flag. IfTRUE, the Y-axiswill be reversed, i.e. period increasing towards the bottom. Thedefault isFALSE.

...

Arguments passed torasterPlot. Onlyrelevant when the filled contours are drawn as a raster image. SeeuseRaster.

Details

This produces a plot of a continuous wavelet transform and plots theoriginal time series. Contours are added for significance and a cone ofinfluence polygon can be added as well. Anything within the cone ofinfluence should not be interpreted.

The time series can be plotted with a smoothing spline as well.

Value

None. This function is invoked for its side effect, which is to produce aplot.

Note

The functionmorlet is a port of Torrence’sIDL code, which can be accessed through theInternet Archive Wayback Machine.

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

References

Torrence, C. and Compo, G. P. (1998) A practical guide to waveletanalysis.Bulletin of the American Meteorological Society,79(1), 61–78.

See Also

morlet,caps

Examples

library(stats)library(utils)data(ca533)ca533.rwi <- detrend(rwl = ca533, method = "ModNegExp")ca533.crn <- chron(ca533.rwi, prewhiten = FALSE)Years <- time(ca533.crn)CAMstd <- ca533.crn[, 1]out.wave <- morlet(y1 = CAMstd, x1 = Years, p2 = 9, dj = 0.1,                   siglvl = 0.99)wavelet.plot(out.wave, useRaster = NA)## Not run: # Alternative palette with better separation of colors# via: rev(RColorBrewer::brewer.pal(10, "Spectral"))specCols <- c("#5E4FA2", "#3288BD", "#66C2A5", "#ABDDA4", "#E6F598",               "#FEE08B", "#FDAE61", "#F46D43", "#D53E4F", "#9E0142")wavelet.plot(out.wave, key.cols=specCols,useRaster = NA)# fewer colorslevs <- quantile(out.wave$Power, probs = c(0, 0.5, 0.75, 0.9, 0.99))wavelet.plot(out.wave, wavelet.levels = levs, add.sig = FALSE,             key.cols = c("#FFFFFF", "#ABDDA4", "#FDAE61", "#D7191C"), useRaster = NA)             ## End(Not run)

Convert Wood Completeness to Pith Offset

Description

This function creates a pith offset data structure based on woodcompleteness data.

Usage

wc.to.po(wc)

Arguments

wc

Adata.frame containing wood completeness data, as returnedbyread.tridas.

Details

Computes the sum of the variablesn.missing.heartwood andn.unmeasured.inner inwc.

Value

Adata.frame containing two variables. Variable one(series) gives the seriesID as eithercharacters orfactors. These matchrownames(wc). Variable two (pith.offset) isofinteger type and gives the years from the beginning of thecore to the pith (or center) of the tree. The minimum value is 1.

Author(s)

Mikko Korpela

See Also

po.to.wc,rcs,read.tridas

Examples

library(utils)data(gp.po)all(wc.to.po(po.to.wc(gp.po)) == gp.po)

WriteDPL Compact Format Ring Width File

Description

This function writes a chronology to aDPL compact formatfile.

Usage

write.compact(rwl.df, fname, append = FALSE, prec = 0.01,              mapping.fname = "", mapping.append = FALSE, ...)

Arguments

rwl.df

adata.frame containing tree-ring ring widthswith the series in columns and the years as rows. The seriesIDs are the column names and the years are the rownames. This type ofdata.frame is produced byread.rwl andread.compact.

fname

acharacter vector giving the file name of therwl file.

append

logical flag indicating whether to append thischronology to an existing file.

prec

numeric indicating the precision of the outputfile. This must be equal to either 0.01 or 0.001 (units are inmm).

mapping.fname

acharacter vector of length one givingthe file name of an optional output file showing the mapping betweeninput and output seriesIDs. The mapping is only printedfor thoseIDs that are transformed. An empty name (thedefault) disables output.

mapping.append

logical flag indicating whether toappend the description of the altered seriesIDs to anexisting file. The default is to create a new file.

...

Unknown arguments are accepted but not used.

Details

The output should be readable by the Dendrochronology Program Library(DPL) as a compact format file.

In seriesIDs, letters of the English alphabet and numbersare allowed. Other characters will be removed. The length of theIDs is limited to about 50 characters, depending on thelength of the other items to be placed on the header lines of theoutput file. LongerIDs will be truncated. Also anyduplicateIDs will be automatically edited so that onlyuniqueIDs exist. If seriesIDs are changed, oneor more warnings are shown. In that case, the user may wish to print alist of the renamings (see Arguments).

Value

fname

Author(s)

Mikko Korpela, based on write.tucson by Andy Bunn

See Also

write.rwl,write.tucson,write.tridas,read.compact

Examples

library(utils)data(co021)fname <- write.compact(rwl.df = co021,                       fname = tempfile(fileext=".rwl"),                       append = FALSE, prec = 0.001)print(fname) # tempfile used for outputunlink(fname) # remove the file

Write Tucson Format Chronology File

Description

This function writes a chronology to a Tucson (decadal) format file.

Usage

write.crn(crn, fname, header = NULL, append = FALSE)

Arguments

crn

adata.frame containing a tree-ring chronology withtwo columns of the type produced bychron. The firstcolumn contains the mean value chronology, the second column givesthe sample depth. Years for the chronology are determined from therow names. The chronologyID is determined from the firstcolumn name.

fname

acharacter vector giving the file name of thecrn file.

header

alist giving information for the header of thefile. IfNULL then no header information will be written.

append

logical flag indicating whether to append thischronology to an existing file.

Details

This writes a standard crn file as defined according to the standardsof theITRDB athttps://www1.ncdc.noaa.gov/pub/data/paleo/treering/treeinfo.txt. This is thedecadal or Tucson format. It is anASCII file and machinereadable by the standard dendrochronology programs. Header informationfor the chronology can be written according to the International TreeRing Data Bank (ITRDB) standard. The header standard is notvery reliable however and should be thought of as experimentalhere. Do not try to write headers using dplR to submit to theITRDB. When submitting to theITRDB, you can enterthe metadata via their website. If you insist however, the headerinformation is given as alist and must be formatted with thefollowing:

DescriptionNameClassMax Width
SiteIDsite.idcharacter 6
Site Namesite.namecharacter 52
Species Codespp.codecharacter 4
State or Countrystate.countrycharacter 13
Speciessppcharacter 18
Elevationelevcharacter 5
Latitudelatcharacter ornumeric 5
Longitudelongcharacter ornumeric 5
First Yearfirst.yrcharacter ornumeric 4
Last Yearlast.yrcharacter ornumeric 4
Lead Investigatorlead.invscharacter 63
Completion Datecomp.datecharacter 8

See examples for a correctly formatted header list. If the width ofthe fields is less than the max width, then the fields will be paddedto the right length when written. Note thatlat andlong are reallylat*100 orlong*100 and given as integral values. E.g., 37 degrees30 minutes would be given as 3750.

This function takes a single chronology with sample depth asinput. This means that it will fail if given output fromchron whereprewhiten == TRUE. However,more than one chronology can be appended to the bottom of an existingfile (e.g., standard and residual) with a second call towrite.crn. However, theITRDB recommendssaving and publishing only one chronology per file. The examplessection shows how to circumvent this. The output from this functionmight be suitable for publication on theITRDB although theheader writing is clunky (see above) and rwl files are much betterthan crn files in terms of usefulness on theITRDB.

Value

fname

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

See Also

chron,read.crn

Examples

library(utils)data(ca533)ca533.rwi <- detrend(rwl = ca533, method = "ModNegExp")ca533.crn <- chron(ca533.rwi)fname1 <- write.crn(ca533.crn, tempfile(fileext=".crn"))print(fname1) # tempfile used for output## Put the standard and residual chronologies in a single file## with ITRDB header info on top. Not recommended.ca533.crn <- chron(ca533.rwi, prewhiten = TRUE)ca533.hdr <- list(site.id = "CAM", site.name = "Campito Mountain",                  spp.code = "PILO", state.country = "California",                  spp = "Bristlecone Pine", elev = "3400M", lat = 3730,                  long = -11813, first.yr = 626, last.yr = 1983,                  lead.invs = "Donald A. Graybill, V.C. LaMarche, Jr.",                  comp.date = "Nov1983")fname2 <- write.crn(ca533.crn[, -2], tempfile(fileext=".crn"),                    header = ca533.hdr)write.crn(ca533.crn[, -1], fname2, append = TRUE)print(fname2) # tempfile used for outputunlink(c(fname1, fname2)) # remove the files

Write Chronology File

Description

This function writes a chronology to a file in one of the availableformats.

Usage

write.rwl(rwl.df, fname, format = c("tucson", "compact", "tridas"), ...)

Arguments

rwl.df

adata.frame containing tree-ring ring widthswith the series in columns and the years as rows. The seriesIDs are the column names and the years are the rownames. This type ofdata.frame is produced byread.rwl.

fname

acharacter vector giving the file name of therwl file.

format

acharacter vector giving the format. This mustbe"tucson","compact", or"tridas". Tucsonformat is the default.

...

arguments specific to the function implementing theoperation for the chosen format.

Details

This is a simple wrapper to the functions actually implementing thewrite operation.

Value

fname

Author(s)

Mikko Korpela

See Also

write.crn,write.tucson,write.compact,write.tridas,read.rwl

Examples

library(utils)data(co021)co021.hdr <- list(site.id = "CO021",                  site.name = "SCHULMAN OLD TREE NO. 1, MESA VERDE",                  spp.code = "PSME", state.country = "COLORADO",                  spp = "DOUGLAS FIR", elev = 2103, lat = 3712,                  long = -10830, first.yr = 1400, last.yr = 1963,                  lead.invs = "E. SCHULMAN", comp.date = "")fname <- write.rwl(rwl.df = co021, fname = tempfile(fileext=".rwl"),                   format = "tucson", header = co021.hdr,                   append = FALSE, prec = 0.001)print(fname) # tempfile used for outputunlink(fname) # remove the file

Write Tree Ring Data Standard (TRiDaS) file

Description

This function writes measured or derived (standardized,averaged) series of values to a TRiDaS format file. Some metadata arealso supported.

Usage

write.tridas(rwl.df = NULL, fname, crn = NULL, prec = NULL, ids = NULL,    titles = NULL, crn.types = NULL, crn.titles = NULL,    crn.units = NULL, tridas.measuring.method = NA,    other.measuring.method = "unknown", sample.type = "core",    wood.completeness = NULL, taxon = "",    tridas.variable = "ring width", other.variable = NA,    project.info = list(type = c("unknown"), description = NULL,                        title = "", category = "", investigator = "",                        period = ""),    lab.info = data.frame(name = "", acronym = NA, identifier = NA,                          domain = "", addressLine1 = NA,                          addressLine2 = NA, cityOrTown = NA,                          stateProvinceRegion = NA, postalCode = NA,                          country = NA),    research.info = data.frame(identifier = NULL, domain = NULL,                               description = NULL),    site.info = list(type = "unknown", description = NULL, title = ""),    random.identifiers = FALSE, identifier.domain = lab.info$name[1],    ...)

Arguments

rwl.df

data.frame containing tree-ring ring widths inmillimetres with the series in columns and the years as rows. TheseriesIDs are the column names and the years are the rownames. This type ofdata.frame is produced byread.tucson,read.compact andread.tridas. Defaults toNULL: no measurementseries are written.

fname

character vector giving the file name of the rwlfile

crn

data.frame or a list ofdata.framescontaining tree-ring chronologies. Acceptsdata.frames ofthe type produced bychron. Additionally, allowsseveral chronologies perdata.frame. Any column of thedata.frame(s) with a name starting with"samp.depth"is interpreted as a sample depth. The rest of the columns areinterpreted as chronologies whose titles are determined from thecolumn names (optionally from parametercrn.titles).Chronology columns and sample depth columns are paired in order sothat the first chronology gets the first sample depth column, secondchronology gets the second set of sample depths, etc. If there areless sample depth columns than chronologies, the sample depths arerecycled. Defaults toNULL: no chronologies are written.

prec

optionalnumeric indicating the rounding precisionof the output file when writing the data contained inrwl.df. Defaults toNULL: no rounding is doneand the measurements are written in (non-integer) millimetres.Possiblenumeric values are 0.001, 0.01, 0.05, 0.1, 1, 10,100 and 1000, which cause the data to be transformed to micrometres,1/100th millimetres, 1/20th millimetres, 1/10 millimetres,(millimetres), centimetres, decimetres or metres, respectively, andthen rounded to integral values. Data rounded to decimetres arewritten in centimetres (values always ending in zero). Otherwise,the matching unit is used in the file.

ids

optionaldata.frame with column one named"tree" giving thenumericID of the tree,column two named"core" giving thenumericID of the core, optional column three named"radius" giving thenumericID of theradius, and optional column four named"measurement" givingthenumericID of the measurement. If column"measurement" exists, column"radius" must also exist.Defaults to one core, radius and measurement per tree:

  data.frame(tree=1:n.col, core=rep(1,n.col),             radius=rep(1,n.col), measurement=rep(1,n.col))

wheren.col is the number of columns inrwl.df.

titles

optionaldata.frame with column one named"tree" giving the title of the tree, column two named"core" giving the title of the core, column three named"radius" giving the title of the radius, and column fournamed"measurement" giving the title of the measurement. Bydefault,titles isNULL, and the title hierarchyis automatically created out of the column names ofrwl.df, takingids into account.

crn.types

character vector or alist ofcharacter vectors giving the types of the derived series incrn. A single vector is interpreted as one type perdata.frame incrn, recycled if not long enough.A list of vectors is interpreted as one list element perdata.frame. In this case, the list is recycled to thecorrect length. After that, the vectors inside the list arerecycled to match the number of derived series in eachdata.frame ofcrn. The default is to writeempty ‘⁠<type>⁠’ elements.

crn.titles

optionalcharacter vector or alistofcharacter vectors giving the titles of the derived seriesincrn. The interpretation is the same as withcrn.types, except that the default is to derive thetitles from the column names ofcrn. AlsoNAmeans that the column name is used.

crn.units

optionalcharacter vector or alist ofcharacter vectors giving the units of the derived series incrn. The interpretation is the same as withcrn.types, except that the default is to mark theseries as ‘⁠<unitless>⁠’. AlsoNA means‘⁠<unitless>⁠’.

tridas.measuring.method

character vector giving themeasuring method used to acquire each series ofrwl.df.Partial matching is used to replace these with the complete terms intridas.vocabulary. If the vector is shorter than thenumber of columns inrwl.df, it is recycled to thecorrect length. The default is to use the information inother.measuring.method instead. Also,NA in anyposition of the vector means that the measuring method informationfor that series is looked up inother.measuring.method.

other.measuring.method

character vector giving themeasuring method used to acquire each series ofrwl.df.In contrast totridas.measuring.method, these arefree-form strings in English. If the vector is shorter than thenumber of columns inrwl.df, it is recycled to thecorrect length. The default value is"unknown".

sample.type

optionalcharacter vector giving the typeof the samples, corresponding to"core" inids.The length of the vector, however, must match the number of columnsinrwl.df, or it is recycled to the correct length. Ifthere are several measurements per sample, some elements ofsample.type are redundant. The default is to use"core" for all series.

wood.completeness

optionaldata.frame giving woodcompleteness information for the measurement series inrwl.df. The number of rows must match the number ofcolumns inrwl.df. The columns are expected to be asubset of the following (descriptions almost directly quoted fromTRiDaS specification):

n.unmeasured.inner

Field for recording whether there areany rings at the inner (i.e. towards pith) edge of the samplethat have not been measured. Typically used to note when ringsare too damaged to measure. Non-negative integral value.

n.unmeasured.outer

Field for recording whether there areany rings at the outer (i.e. towards bark) edge of the samplethat have not been measured. Typically used to note when ringsare too damaged to measure. Non-negative integral value.

pith.presence

Whether the pith is present or absent.Each element must be a partial match with the contents ofcategory"complex presence / absence" intridas.vocabulary.

heartwood.presence

Whether the outer (youngest) heartwoodis present and if so whether it is complete.

Category"complex presence / absence" intridas.vocabulary.

n.missing.heartwood

Estimated number of missing heartwoodrings to the pith. Non-negative integral value.

missing.heartwood.foundation

Description of the way theestimation of how many heartwood rings are missing was made andwhat the certainty is. Free-form string.

sapwood.presence

Whether the sapwood is present or not.

Category"complex presence / absence".

n.sapwood

Number of sapwood rings measured. Non-negativeintegral value.

last.ring.presence

Last ring under the bark is present orabsent.

Category"presence / absence".

last.ring.details

If the last ring under the bark ispresent, include information about the completeness of this ringand/or season of felling. Free-form string.

n.missing.sapwood

Estimated number of missing sapwood ringsto the bark. Non-negative integral value.

missing.sapwood.foundation

Description of the way theestimation of how many sapwood rings are missing was made andwhat the certainty is. Free-form string.

bark.presence

Bark is present or absent.

Category"presence / absence" intridas.vocabulary.

taxon

character string. The most detailed taxonomicname known for this element (species, genus, family etc).Preferably from theCatalogueof Life controlled vocabulary. The same string is used for all ofrwl.df. The default value is an empty string, but aproper value should really be given.

tridas.variable

character string. Measured variable(ring width, earlywood, latewood etc) taken from the TRiDaScontrolled vocabulary (tridas.vocabulary, category"variable"). The same string is used for all ofrwl.df. Defaults to"ring width".

other.variable

character string. Measured variable asa free-form string. The same string is used for all ofrwl.df. This is only used iftridas.variable isNA.

project.info

list containing information about theproject. Elements are the following (includes quotes from theTRiDaS specification):

type

character vector. The type(s) of the project.Defaults to"unknown".

description

character string. A description of theproject. Defaults toNULL: no description.

title

character string. The title of the project.Defaults to an empty string.

category

character string. Category of researchthis project falls into. Defaults to an empty string.

investigator

character string. Principalinvestigator of this project. Defaults to an empty string.

period

character string. When thedendrochronological project took place. Could consist of astart- and end-date. If unknown it should be estimated.Defaults to an empty string.

lab.info

data.frame. Information about thedendrochronological research laboratories where this work was done.One row per laboratory. Defaults to one laboratory with an emptyname and no other information. The columns are expected to be asubset of the following:

name

Name of the laboratory

acronym

Optional acronym of the laboratory

identifier

Optional identifier of the laboratory

domain

The domain which the identifier of the laboratory isapplicable to. Could be theURL of theorganization’s server or the name of the organizationas long as it is not ambiguous.

addressLine1

First address line

addressLine2

Second address line

cityOrTown

City or town

stateProvinceRegion

State, province or region

postalCode

Postal code. Beware of ignored leading zerosif these are given innumeric orinteger typevalues. It is always safe to usecharacter values.

country

Country

research.info

optionaldata.frame with informationabout the systems in which the research project isregistered. Columns are the following:

identifier

Identifier

domain

Domain which the identifier is applicable to

description

General description

site.info

list containing information about the site(‘⁠<object>⁠’). Elements are the following, and all arecharacter strings:

type

Type of the site. Defaults to"unknown".

description

Description. Defaults to no description.

title

Title of the site. Defaults to an empty string.

random.identifiers

logical flag. IfTRUE,unique random identifiers are created withuuid.genand attached to each ‘⁠<project>⁠’ (one in the file),‘⁠object⁠’ (site, one in the file), ‘⁠<element>⁠’ (tree),‘⁠<sample>⁠’ (core), ‘⁠<radius>⁠’, ‘⁠<measurementSeries>⁠’(measurement) and ‘⁠<derivedSeries>⁠’ element in the resultingTRiDaS file.

identifier.domain

character string. The domain whichthe random identifiers are applicable to. Could be theURL of the organization’s server or the name of theorganization as long as it is not ambiguous. Defaults to the nameof the first laboratory inlab.info.

...

Unknown arguments are accepted but not used.

Details

The Tree Ring Data Standard (TRiDaS) is described in Jansma et. al(2010).

Value

fname

Note

This is an early version of the function. Bugs are likely toexist, and parameters are subject to change.

Author(s)

Mikko Korpela

References

Jansma, E., Brewer, P. W., and Zandhuis, I. (2010) TRiDaS 1.1: Thetree-ring data standard.Dendrochronologia,28(2),99–130.

See Also

write.rwl,write.tucson,write.compact,write.crn,read.tridas

Examples

library(utils)## Not run: ## Write raw ring widthsdata(co021)fname1 <- write.tridas(rwl.df = co021,    fname = tempfile(fileext=".xml"), prec = 0.01,    site.info = list(title = "Schulman old tree no. 1, Mesa Verde",                     type = "unknown"),    taxon = "Pseudotsuga menziesii var. menziesii (Mirb.) Franco",    project.info = list(investigator = "E. Schulman",                        title = "", category = "",                        period = "", type = "unknown"))print(fname1) # tempfile used for output## Write mean value chronology of detrended ring widthsdata(ca533)ca533.rwi <- detrend(rwl = ca533, method = "ModNegExp")ca533.crn <- chron(ca533.rwi, prewhiten = TRUE)fname2 <- write.tridas(crn = ca533.crn,    fname = tempfile(fileext=".xml"),    taxon = "Pinus longaeva D.K. Bailey",    project.info =        list(investigator = "Donald A. Graybill, V.C. LaMarche, Jr.",             title = "Campito Mountain", category = "",             period = "", type = "unknown"))print(fname2) # tempfile used for outputunlink(c(fname1, fname2)) # remove the files## End(Not run)

Write Tucson Format Chronology File

Description

This function writes a chronology to a Tucson (decadal) format file.

Usage

write.tucson(rwl.df, fname, header = NULL, append = FALSE,             prec = 0.01, mapping.fname = "", mapping.append = FALSE,             long.names = FALSE, ...)

Arguments

rwl.df

adata.frame containing tree-ring ring widthswith the series in columns and the years as rows. The seriesIDs are the column names and the years are the rownames. This type ofdata.frame is produced byread.rwl andread.compact.

fname

acharacter vector giving the file name of therwl file.

header

alist giving information for the header of thefile. IfNULL then no header information will be written.

append

logical flag indicating whether to append thischronology to an existing file. The default is to create a newfile.

prec

numeric indicating the precision of the outputfile. This must be equal to either 0.01 or 0.001 (units are inmm).

mapping.fname

acharacter vector of length one givingthe file name of an optional output file showing the mapping betweeninput and output seriesIDs. The mapping is only printedfor thoseIDs that are transformed. An empty name (thedefault) disables output.

mapping.append

logical flag indicating whether toappend the description of the altered seriesIDs to anexisting file. The default is to create a new file.

long.names

logical flag indicating whether to allowlong seriesIDs (7 or 8 characters) to be written to theoutput. The default is to only allow 6 characters.

...

Unknown arguments are accepted but not used.

Details

This writes a standard rwl file as defined according to the standardsof theITRDB athttps://www1.ncdc.noaa.gov/pub/data/paleo/treering/treeinfo.txt. This is thedecadal or Tucson format. It is anASCII file and machinereadable by the standard dendrochronology programs. Header informationfor the rwl can be written according to the International Tree RingData Bank (ITRDB) standard. The header standard is not veryreliable however and should be thought of as experimental here. Do nottry to write headers using dplR to submit to theITRDB. Whensubmitting to theITRDB, you can enter the metadata viatheir website. If you insist however, the header information is givenas alist and must be formatted with the following:

DescriptionNameClassMax Width
SiteIDsite.idcharacter 5
Site Namesite.namecharacter 52
Species Codespp.codecharacter 4
State or Countrystate.countrycharacter 13
Speciessppcharacter 18
Elevationelevcharacter 5
Latitudelatcharacter ornumeric 5
Longitudelongcharacter ornumeric 5
First Yearfirst.yrcharacter ornumeric 4
Last Yearlast.yrcharacter ornumeric 4
Lead Investigatorlead.invscharacter 63
Completion Datecomp.datecharacter 8

See examples for a correctly formatted header list. If the width ofthe fields is less than the max width, then the fields will be paddedto the right length when written. Note thatlat andlong are reallylat * 100 orlong * 100 and given as integral values. E.g., 37 degrees30 minutes would be given as 3750.

Series can be appended to the bottom of an existing file with a secondcall towrite.tucson. The output from this file is suitable forpublication on theITRDB.

The function is capable of altering excessively long and/or duplicateseriesIDs to fit the Tucson specification. Additionally,characters other than numbers or English letters will be removed. IfseriesIDs are changed, one or more warnings are shown. Inthat case, the user may wish to print a list of the renamings (seeArguments).

Settinglong.names = TRUE allows seriesIDs tobe 8 characters long, or 7 in case there are year numbers using 5characters. Note that in the latter case the limit of 7 charactersapplies to allIDs, not just the one corresponding to theseries with long year numbers. The default (long.names = FALSE) is to allow 6 characters. LongIDs may causeincompatibility with other software.

Value

fname

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

See Also

write.crn,read.tucson,write.rwl,write.compact,write.tridas

Examples

library(utils)data(co021)co021.hdr <- list(site.id = "CO021",                  site.name = "SCHULMAN OLD TREE NO. 1, MESA VERDE",                  spp.code = "PSME", state.country = "COLORADO",                  spp = "DOUGLAS FIR", elev = "2103M", lat = 3712,                  long = -10830, first.yr = 1400, last.yr = 1963,                  lead.invs = "E. SCHULMAN", comp.date = "")fname <- write.tucson(rwl.df = co021, fname = tempfile(fileext=".rwl"),                      header = co021.hdr, append = FALSE, prec = 0.001)print(fname) # tempfile used for outputunlink(fname) # remove the file

Crossdate an undated series

Description

Pulls an undated series through a dated rwl file in order to try to establish dates

Usage

xdate.floater(rwl, series, series.name = "Unk", min.overlap = 50, n = NULL,             prewhiten = TRUE, biweight = TRUE,             method = c("spearman", "pearson","kendall"),             make.plot = TRUE,return.rwl = FALSE, verbose = TRUE)

Arguments

rwl

adata.frame with series as columns and years asrows such as that produced byread.rwl.

series

adata.frame with series as columns and years asrows such as that produced byread.rwl.

series.name

acharacter giving a name for the series.

min.overlap

number

n

NULL or an integral value giving the filter lengthfor thehanning filter used for removal of lowfrequency variation.

prewhiten

logical flag. IfTRUE each series iswhitened usingar.

biweight

logical flag. IfTRUE then a robustmean is calculated usingtbrm.

method

Can be either"pearson","kendall", or"spearman" which indicates the correlation coefficient to beused. Defaults to"spearman". Seecor.test.

make.plot

logical flag indicating whether to make aplot.

return.rwl

logical flag indicating whether to make aplot.

verbose

logical flag indicating whether to print some results to screen.

Details

This takes an undated series (a floater) and drags it along a datedrwl object in order to estabish possible dates for the series. This function is experimental and under development. It might change in future releases.

Value

By default adata.frame is returned with the first and last year of the period compared as well as the correlation, p-value, and number of observations. Ifreturn.rwl isTRUE then a list is returned with therwl object as well as thedata.frame with the correlation statistics.

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

See Also

corr.series.seg,skel.plot,series.rwl.plot,ccf.series.rwl

Examples

library(utils)data(co021)summary(co021)foo <- co021[,"645232"]# 645232  1466 1659bar <- co021bar$"645232" <- NULLout <- xdate.floater(bar, foo, min.overlap = 50, series.name = "Undated")foo <- co021[,"646118"]# 646118  1176 1400bar <- co021bar$"646118" <- NULLout <- xdate.floater(bar, foo, min.overlap = 100, series.name = "Undated")# note that this can fail if a long overlap is needed. This produces the # wrong dates.out <- xdate.floater(bar, foo, min.overlap = 200, series.name = "Undated")

Skeleton Plot for Series and Master with Cross Correlation

Description

...

Usage

xskel.ccf.plot(rwl, series, series.yrs = as.numeric(names(series)),               win.start, win.width = 50, n = NULL,               prewhiten = TRUE, biweight = TRUE, series.x=FALSE)

Arguments

rwl

adata.frame with series as columns and years as rowssuch as that produced byread.rwl.

series

anumeric orcharacter vector. Usually atree-ring series. If the length of the value is 1, thecorresponding column ofrwl is selected (by name orposition) as the series and ignored when building the masterchronology. Otherwise, the value must benumeric.

series.yrs

anumeric vector giving the years ofseries. Defaults toas.numeric(names(series)).

win.start

year to start window

win.width

an even integral value

n

NULL or an integral value giving the filter length for thehanning filter used for removal of low frequencyvariation.

prewhiten

logical flag. IfTRUE each series iswhitened usingar.

biweight

logical flag. IfTRUE then a robustmean is calculated usingtbrm.

series.x

logical flag indicating whether to make theseriesthex argument toccf. See Details.

Details

This function produces a plot that is a mix of a skeleton plot and across-correlation plot. It’s used in crossdating.

The top panel shows the normalized values for the master chronology(bottom half) and the series (top half) in green. The values are thedetrended and standardized data (e.g., RWI).

Similarly, the black lines are a skeleton plot for the master andseries with the marker years annotated for the master on the bottomaxis and series on the top. The text at the top of the figure givesthe correlation between the series and master (green bars) as well asthe percentage of agreement between the years of skeleton bars for theseries and master. I.e., if all the black lines occur in the sameyears the percentage would be 100%.

The bottom panels show cross correlations for the first half (left)and second half of the time series using functionccf.

The cross correlations are calculated callingccf as
ccf(x=master, y=series, lag.max=lag.max, plot=FALSE) ifseries.x isFALSE and asccf(x=series, y=master, lag.max=lag.max, plot=FALSE) ifseries.x isTRUE. This argument was introduced in dplR version 1.7.0.Different users have different expectations about how missing or extra rings are notated. Ifswitch.x = FALSE the behavior will be like COFECHA where a missing ring in a series produces a negative lag in the plot rather than a positive lag.

The plot is built using theGrid package whichallows for great flexibility in building complicated plots. However,these plots look best when they don’t cover too wide a rangeof years (unless the plotting device is wider than is typical). Forthat reason the user will get a warning ifwin.width isgreater than 100 years.

Old-school skeleton plots to print on paper are made withskel.plot.

Value

None. Invoked for side effect (plot).

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

See Also

ccf

Examples

library(utils)data(co021)dat <- co021#corrupt a seriesbad.series <- dat$"641143"names(bad.series) <- rownames(dat)bad.series <- delete.ring(bad.series,year=1825)# good matchxskel.ccf.plot(rwl=dat,series=bad.series,win.start=1900,win.width=50)# overlap missing ringxskel.ccf.plot(rwl=dat,series=bad.series,win.start=1800,win.width=50)

Skeleton Plot for Series and Master

Description

...

Usage

xskel.plot(rwl, series, series.yrs = as.numeric(names(series)),           win.start, win.end = win.start+100, n = NULL,            prewhiten = TRUE, biweight = TRUE)

Arguments

rwl

adata.frame with series as columns and years as rowssuch as that produced byread.rwl.

series

anumeric orcharacter vector. Usually atree-ring series. If the length of the value is 1, thecorresponding column ofrwl is selected (by name orposition) as the series and ignored when building the masterchronology. Otherwise, the value must benumeric.

series.yrs

anumeric vector giving the years ofseries. Defaults toas.numeric(names(series)).

win.start

year to start window

win.end

year to end window

n

NULL or an integral value giving the filter length for thehanning filter used for removal of low frequencyvariation.

prewhiten

logical flag. IfTRUE each series iswhitened usingar.

biweight

logical flag. IfTRUE then a robustmean is calculated usingtbrm.

Details

This function produces a plot that is a mix of a skeleton plot and across-correlation plot. It’s used in crossdating.

The top panel shows the normalized values for the master chronology(bottom half) and the series (top half) in green. The values are thedetrended and standardized data (e.g., RWI).

Similarly, the black lines are a skeleton plot for the master andseries with the marker years annotated for the master on the bottomaxis and series on the top. The text at the top of the figure givesthe correlation between the series and master (green bars) as well asthe percentage of agreement between the years of skeleton bars for theseries and master. I.e., if all the black lines occur in the sameyears the percentage would be 100%.

The bottom panels show cross correlations for the first half (left)and second half of the time series using functionccf asccf(x=series,y=master,lag.max=5).

The plot is built using theGrid package whichallows for great flexibility in building complicated plots. However,these plots look best when they don’t cover too wide a rangeof years (unless the plotting device is wider than is typical). Forthat reason the user will get a warning ifwin.width isgreater than 100 years.

Old-school skeleton plots to print on paper are made withskel.plot.

Value

None. Invoked for side effect (plot).

Author(s)

Andy Bunn. Patched and improved by Mikko Korpela.

See Also

ccf

Examples

library(utils)data(co021)dat <- co021#corrupt a seriesbad.series <- dat$"641143"names(bad.series) <- rownames(dat)bad.series <- delete.ring(bad.series,year=1825)# good matchxskel.plot(rwl=dat,series=bad.series,win.start=1850)# overlap missing ringxskel.plot(rwl=dat,series=bad.series,win.start=1800)

Ancillary Data Corresponding tozof.rwl

Description

This data set gives the pith offsets, distance to pith, and diameter that match the ring widths forzof.rwl – a data set of European Beech (Fagus sylvatica) increment cores collected at the Zofingen in Switzerland.

Usage

data(zof.anc)

Format

Adata.frame containing four columns. Column one gives the series ID. Column two (PO) gives the number of rings estimated to be missing to the pith. Column three (d2pith) gives the estimated distance to the pith (mm). Column four (diam) gives the diameter at breast height (DBH) in cm.

Source

Contributed by Stefan Klesse

References

Klesse, S., Babst, F., Lienert, S., Spahni, R., Joos, F., Bouriaud, O., Carrer, M., Filippo, A.D., Poulter, B., Trotsiuk, V., Wilson, R., Frank, D.C. (2018) A combined tree ring and vegetation model assessment of European forest growth sensitivity to interannual climate variability.Global Biogeochemical Cycles 32, 1226 – 1240.


European Beech Ring Widths from Zofingen, Switzerland

Description

This data set includes ring-width measurements for European Beech (Fagus sylvatica) increment cores collected at the Zofingen in Switzerland. There are 61 series.

Usage

data(zof.rwl)

Format

Adata.frame containing 61 ring-width series in columns and 156years in rows.

Source

Contributed by Stefan Klesse

References

Klesse, S., Babst, F., Lienert, S., Spahni, R., Joos, F., Bouriaud, O., Carrer, M., Filippo, A.D., Poulter, B., Trotsiuk, V., Wilson, R., Frank, D.C. (2018) A combined tree ring and vegetation model assessment of European forest growth sensitivity to interannual climate variability.Global Biogeochemical Cycles 32, 1226 – 1240.


[8]ページ先頭

©2009-2025 Movatter.jp