---
title: rintcal
output:
html_vignette:
toc: true
toc_depth: 3
number_sections: true
vignette: >
%\VignetteIndexEntry{rintcal}
%\VignetteEngine{knitr::rmarkdown}
\usepackage[utf8]{inputenc}
---
# Introduction
The international IntCal group provides ratified radiocarbon calibration curves such as IntCal20 (for northern hemisphere terrestrial radiocarbon dates; Reimer et al. 2020[^1]), Marine20 (for marine dates; Heaton et al. 2020[^2]) and SHCal20 (Hogg et al. 2020[^3]). This package provides these curves, as well as previous iterations (IntCal13, Marine13, SHCal13, IntCal09, Marine09, IntCal04, Marine04, SHCal04, IntCal98, Marine98), Arnold and Libby's first curve[^4], and postbomb curves (Levin and Kromer 2004[^5], Santos et al. 2015[^6], Andrews et al. 2016[^7], Hua et al. 2021[^8]).
# Installation
On first usage of the package, it has to be installed:
```{r, eval=FALSE}
install.packages('rintcal')
```
If you have a recent version of `rbacon`, `rplum`, `coffee`, `rice` or `clam` installed on your computer, `rintcal` will probably have been installed as well. Sometimes new versions of these packages appear, so please re-issue the above command regularly to remain up-to-date, or use:
```{r, eval=FALSE}
update.packages()
```
To obtain access to the calibration curves, first the package has to be loaded:
```{r}
library(rintcal)
```
# Calibration curves
## Loading curves
Now you can load a calibration curve into the memory, for example the default curve IntCal20, and check the first and last few entries:
```{r}
ic20 <- ccurve()
head(ic20)
tail(ic20)
```
The files have three columns: cal BP, the corresponding IntCal C14 BP ages, and the uncertainties (1 standard deviation).
To see more detail of each rintcal function, place a question-mark before the function name, e.g.:
```{r, eval=FALSE}
?ccurve
```
To get a list of available curves and associated files (and where they can be found):
```{r}
list.ccurves()
```
### Libby's curve
Legacy calibration data such as Arnold & Libby (1951) can be compared with the latest calibration curves. Only included here are those radiocarbon dates of Arnold and Libby which come with independent (historical, archaeological or dendrochronological) age estimates. Note that Arnold and Libby did not define their 'calendar years' explicitly, so the ages have to be taken with a degree of caution.
```{r, fig.width=5, fig.asp=1}
libby <- read.table(file.path(system.file(package = 'rintcal'), "extdata/Arnold_Libby_1951.txt"), header=T, sep=",")
plot(libby[,2], libby[,4], xlab="'cal' BP", ylab="C14 BP", pch=20) # plot the radiocarbon dates and their known calendar ages
segments(libby[,2]-libby[,3], libby[,4], libby[,2]+libby[,3], libby[,4]) # calendar error bars (not all are quantified)
segments(libby[,2], libby[,4]-libby[,5], libby[,2], libby[,4]+libby[,5]) # radiocarbon error bars
abline(0, 1, lty=2)
ic20 <- ccurve() # add the IntCal20 curve
ic20.pol <- cbind(c(ic20[,1], rev(ic20[,1])), c(ic20[,2]-ic20[,3], rev(ic20[,2]+ic20[,3])))
polygon(ic20.pol, col="darkgreen", border=NA)
```
## Curve data
To look at the data underlying the IntCal curves, we can open the IntCal20 dataset downloaded from intchron.org and extract any relevant information, for example to check how many Irish oaks are in the dataset:
```{r}
intcal <- intcal.read.data()
IrishOaks <- intcal.data.frames(intcal, taxon="Quercus sp.", country="Ireland")
length(IrishOaks)
```
Or plot a Bristlecone Pine series, one with single-ring radiocarbon dates that show a very abrupt change in radiocarbon age (Miyake Event):
```{r, fig.width=4, fig.asp=.8}
Bristle <- intcal.data.frames(intcal, taxon="Pinus longaeva")
Bristle_yearly <- Bristle[[20]]$data[,c(8,14,15)]
plot(Bristle_yearly[,1], Bristle_yearly[,2], xlab="cal BP", ylab="C14 BP")
segments(Bristle_yearly[,1], Bristle_yearly[,2]-Bristle_yearly[,3], Bristle_yearly[,1], Bristle_yearly[,2]+Bristle_yearly[,3])
```
The data underlying parts of the IntCal calibration curve can be visualised, for example from 500 to 0 cal BP:
```{r, fig.width=5, fig.asp=1}
intcal.data(0, 500)
```
Want to plot only some specific datasets over a period of time?
```{r, fig.width=5, fig.asp=1}
dat <- intcal.data(20e3, 25e3)
unique(dat$set)
dat <- intcal.data(20e3, 25e3, select.sets=c(109, 120), data.cols=c(1,2))
```
It is also possible to plot the data in other `realms` such as pMC (`p`), F14C (`F`) or Δ14C (`d`), e.g.:
```{r, fig.width=5, fig.asp=1}
intcal.data(20e3, 25e3, realm="d")
```
## Manipulations
You can also combine calibration curves, e.g. a 40%:60% mix of Intcal20 and Marine20 with a 100+-20 year offset for the latter. If save is set to TRUE, the resulting curve will be saved with the name mixed.14C, in a folder together with the calibration curves. The name of this folder is listed, and it can be changed by specifying the option 'cc.dir'.
```{r}
mydir <- tempdir()
# new.ccdir(mydir)
mix.ccurves(0.4, cc1="IntCal20", cc2="Marine20", offset=cbind(100, 20), save=TRUE, cc.dir=mydir)
```
To glue prebomb and postbomb calibration curves into one and store it as a variable in your session (for example, IntCal20 and the NH1 postbomb curve):
```{r, fig.width=4, fig.asp=.8}
glued <- glue.ccurves("IntCal20", "NH1")
plot(glued[1:650,1:2], xlab="cal BP", ylab="C-14 BP", pch=".")
```
[^1]: Reimer PJ et al., 2020. The IntCal20 Northern Hemisphere radiocarbon age calibration curve (0-55 cal kBP). *Radiocarbon* 62, 725-757
[^2]: Heaton TJ et al., 2020. Marine20-The Marine Radiocarbon Age Calibration Curve (0-55,000 cal BP). *Radiocarbon* 62, 779-820
[^3]: Hogg AG et al., 2020. SHCal20 Southern Hemisphere Calibration, 0-55,000 Years cal BP. *Radiocarbon* 62, 759-778
[^4]: Arnold JR, Libby WF, 1951. Radiocarbon Dates. *Science* 113, p. 111-120
[^5]: Levin I, Kromer, B, 2004. The Tropospheric 14CO2 Level in Mid-Latitudes of the Northern Hemisphere (1959-2003), *Radiocarbon* 46, 1261-1272
[^6]: Santos GM, Linares R, Lisi CS, Filho MT, 2015. Annual growth rings in a sample of Parana pine (*Araucaria angustifolia*): Toward improving the 14C calibration curve for the Southern Hemisphere. *Quaternary Geochronology* 25, 96-103
[^7]: Andrews H, Siciliano D, Potts DC, DeMartini EE, Covarrubias S, 2016. Bomb radiocarbon and the Hawaiian Archipelago: Coral, otoliths and seawater. *Radiocarbon* 58, 531-548
[^8]: Hua Q et al. 2021. Atmospheric Radiocarbon for the Period 1950-2019. *Radiocarbon* 64, 723-745