The R language and programming environment is now commonly used in dendrochronology. R is the world’s preeminent open-source statistical computing software and its power can be harnessed for tree-ring science through the contribution of add-on packages which are freely available on the internet. There are now many R packages for working with dendro data from measuring (measuRing) to standardization and chronology building (dplR, detrendeR), to fire history (burnr) to disturbance (TRADER) to climate-growth analysis (treeclim, pointRes, dendroTools, BIOdry) to working with data from dendrometers (dendrometeR) and cell anatomy (tracheideR, RAPTOR). Although extremely powerful, R has a steep learning curve that has lead some to postpone using it in their own work. In these pages we will demonstrate the ways in which analysts can work with tree-ring data in R over the entire life cycle of a project in a transparent and reproducible way – from initial measuring of the wood to statistical tests to producing publication-quality graphics. These pages are written as a demonstration using on-board data sets but can easily be adapted for users to work with their own data.

1 Before Starting

1.1 R

Please install R by visiting www.r-project.org. We recommend that you use RStudio to interact with, and script in R. These documents were all made using R version 3.5.0 (2018-04-23).

1.2 Getting dplR

Install the add-on library dplR. You can download and install these using the install.packages function from the R prompt:

install.packages("dplR")

These documents use version 1.6.8 of dplR. You can check the version of your version of dplR via:

packageVersion("dplR")

If your version is older you can update it (and all your other packages) in R via:

update.packages()

These documents were all made using the most up-to-date versions of the packages available on the Comprehensive R Archive Network. Updating regularly is good practice!

2 Getting Help with R

These pages demonstrate some basic aspects of tree-ring analysis through executable examples with on-board data sets. After a basic introduction, you will have a chance to work through examples yourself or work on your own analysis.

No prior R experience is necessary but for those who are new to R, we suggest using the resources at swirl as a way of starting to learn R.

3 Citing R, dplR, and other packages

It’s important to cite software for any number of reasons. E.g., citing software let’s the reader know what you did and hopefully furthers the science; being specific about version number you used will help track down discrpenscies as software evoloves; and so on. There is a nifty citation() function in R that gives you information on how to best cite R and, in many cases, its packages.

citation()
## 
## To cite R in publications use:
## 
##   R Core Team (2018). R: A language and environment for
##   statistical computing. R Foundation for Statistical Computing,
##   Vienna, Austria. URL https://www.R-project.org/.
## 
## A BibTeX entry for LaTeX users is
## 
##   @Manual{,
##     title = {R: A Language and Environment for Statistical Computing},
##     author = {{R Core Team}},
##     organization = {R Foundation for Statistical Computing},
##     address = {Vienna, Austria},
##     year = {2018},
##     url = {https://www.R-project.org/},
##   }
## 
## We have invested a lot of time and effort in creating R, please
## cite it when using it for data analysis. See also
## 'citation("pkgname")' for citing R packages.

As the citation function indicates: “We have invested a lot of time and effort in creating R, please cite it when using it for data analysis.” The creation of dplR is an act of love. We enjoy writing this software and helping users. However, we are not among the idle rich. Alas. We have jobs and occasionally have to answer to our betters. We ask that you please cite dplR and R appropriately in your work. This way when our department chairs and deans accuse us of being dilettantes we can point to the use of dplR as a partial excuse. There is more detailed information available in the help files and in the literature (Bunn, 2008, 2010).

citation("dplR")
## 
## Bunn AG (2008). "A dendrochronology program library in R (dplR)."
## _Dendrochronologia_, *26*(2), 115-124. ISSN 1125-7865, doi:
## 10.1016/j.dendro.2008.01.002 (URL:
## http://doi.org/10.1016/j.dendro.2008.01.002).
## 
## Bunn AG (2010). "Statistical and visual crossdating in R using the
## dplR library." _Dendrochronologia_, *28*(4), 251-258. ISSN
## 1125-7865, doi: 10.1016/j.dendro.2009.12.001 (URL:
## http://doi.org/10.1016/j.dendro.2009.12.001).
## 
##   Andy Bunn, Mikko Korpela, Franco Biondi, Filipe Campelo, Pierre
##   Mérian, Fares Qeadan, Christian Zang, Darwin Pucha-Cofrep and
##   Jakob Wernicke (2018). dplR: Dendrochronology Program Library in
##   R. R package version 1.6.9.
##   https://r-forge.r-project.org/projects/dplr/
## 
## To see these entries in BibTeX format, use 'print(<citation>,
## bibtex=TRUE)', 'toBibtex(.)', or set
## 'options(citation.bibtex.max=999)'.

The same practice goes for any other add-on package you might use.

4 Modules

In the following pages we will cover the basics of dplR, crossdating, and some limited time-series analysis. Users should be familiar with the basics of dendrochronology and concepts like detrending, autocorrelation, spectral analysis and so on.

If this is all new to you – you should proceed immediately to a good primer on dendrochronology like Fritts (2001) or the Cook Book (1990). These pages are not intended to teach you about how to do tree-ring analysis. They are intended to teach you how to use R for dendro.

References

Bunn AG (2008) A dendrochronology program library in R (dplR). Dendrochronologia, 26, 115–124.

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

Cook E, Kairiukstis L (1990) Methods of dendrochronology: Applications in the environmental sciences. Kluwer, pp.

Fritts HC (2001) Tree Rings and Climate. The Blackburn Press, pp.