# c14 [![DOI](https://zenodo.org/badge/334443504.svg)](https://doi.org/10.5281/zenodo.21361370) **c14** makes it easy and intuitive to incorporate radiocarbon dating into tidy data analysis workflows in R. It provides classes and functions for radiocarbon data that fit nicely in tables and work well with pipes and dplyr verbs. These include direct support for the most common tasks when working with radiocarbon data—calibrating, summarising, aggregating and plotting radiocarbon dates—as well as conversion methods for combining specialised methods provided by other packages (e.g. [rcarbon](https://cran.r-project.org/package=rcarbon), [BChron](https://andrewcparnell.github.io/Bchron/), [oxcAAR](https://cran.r-project.org/package=oxcAAR)) in the same analysis. It was forked from [stratigraphr](https://github.com/joeroe/stratigraphr) v0.3.0. ## Installation You can install the latest release of c14 [from CRAN](https://cran.r-project.org/package=c14) with: ``` r install.packages("c14") ``` Or the development version from GitHub using the [remotes](https://remotes.r-lib.org/) package: ``` r # install.packages("remotes") remotes::install_github("joeroe/c14") ``` ## Usage The main aim of c14 is to make it easier to work with radiocarbon data within a tidy workflow. For example, we can combine [`dplyr::filter()`](https://dplyr.tidyverse.org/reference/filter.html) with [`c14_calibrate()`](https://c14.joeroe.io/reference/c14_calibrate.md) to only calibrate dates from a specific site: ``` r library("c14") library("dplyr", warn.conflicts = FALSE) ppnd |> filter(site == "Ganj Dareh") |> select(lab_id, cra, error) |> mutate(cal = c14_calibrate(cra, error)) #> # A tibble: 9 × 4 #> lab_id cra error cal #> #> 1 GaK 807 10400 150 11751–12709 cal BP #> 2 OxA 2099 8840 110 9557–10193 cal BP #> 3 OxA 2100 9010 110 9748–10486 cal BP #> 4 OxA 2101 8850 100 9560–10197 cal BP #> 5 OxA 2102 8690 110 9490–10144 cal BP #> 6 SI 922 8570 210 9034–10181 cal BP #> 7 SI 923 8625 195 9142–10202 cal BP #> 8 SI 924 8640 90 9470–10106 cal BP #> 9 SI 925 8385 75 9141–9534 cal BP ``` The resulting `cal`-class vector can be assigned to a new column, allowing us to keep working with the data in the context of the original data frame or tibble. # Package index ## Radiocarbon measurements Functions for working with uncalibrated radiocarbon measurements - [`c14_age_norm()`](https://c14.joeroe.io/reference/c14_age_norm.md) : Generate the normal distribution of a radiocarbon age - [`c14_age()`](https://c14.joeroe.io/reference/c14_units.md) [`c14_f14c()`](https://c14.joeroe.io/reference/c14_units.md) : Radiocarbon unit calculations - [`c14_decay_libby`](https://c14.joeroe.io/reference/c14_decay.md) [`c14_decay_cambridge`](https://c14.joeroe.io/reference/c14_decay.md) : Radiocarbon decay constants ## Radiocarbon calibration Functions for calibrating radiocarbon determinations to a calendar timescale - [`c14_calibrate()`](https://c14.joeroe.io/reference/c14_calibrate.md) : Calibrate radiocarbon dates - [`cal()`](https://c14.joeroe.io/reference/cal.md) : Calibrated radiocarbon dates - [`as_cal_dist()`](https://c14.joeroe.io/reference/as_cal_dist.md) : Convert a foreign object to a cal_dist object - [`cal_dist()`](https://c14.joeroe.io/reference/cal_dist.md) : Calendar probability distribution ## Calibration curves Data, classes and functions for radiocarbon calibration curves - [`IntCal20`](https://c14.joeroe.io/reference/c14_curves.md) [`SHCal20`](https://c14.joeroe.io/reference/c14_curves.md) [`Marine20`](https://c14.joeroe.io/reference/c14_curves.md) [`IntCal13`](https://c14.joeroe.io/reference/c14_curves.md) [`SHCal13`](https://c14.joeroe.io/reference/c14_curves.md) [`Marine13`](https://c14.joeroe.io/reference/c14_curves.md) [`IntCal09`](https://c14.joeroe.io/reference/c14_curves.md) [`Marine09`](https://c14.joeroe.io/reference/c14_curves.md) [`IntCal04`](https://c14.joeroe.io/reference/c14_curves.md) [`SHCal04`](https://c14.joeroe.io/reference/c14_curves.md) [`Marine04`](https://c14.joeroe.io/reference/c14_curves.md) [`IntCal98`](https://c14.joeroe.io/reference/c14_curves.md) [`Marine98`](https://c14.joeroe.io/reference/c14_curves.md) : Radiocarbon calibration curves - [`c14_curve()`](https://c14.joeroe.io/reference/c14_curve.md) [`c14_fcurve()`](https://c14.joeroe.io/reference/c14_curve.md) : Radiocarbon calibration curve class - [`read_14c()`](https://c14.joeroe.io/reference/read_14c.md) : Read calibration curve files ## Summarise calibrated dates Functions for summarising calibrated radiocarbon determinations - [`cal_hdr()`](https://c14.joeroe.io/reference/cal_hdr.md) [`cal_hdi()`](https://c14.joeroe.io/reference/cal_hdr.md) : Highest Density Region and Highest Density Interval - [`cal_mode()`](https://c14.joeroe.io/reference/cal_mode.md) [`cal_median()`](https://c14.joeroe.io/reference/cal_mode.md) [`cal_mean()`](https://c14.joeroe.io/reference/cal_mode.md) [`cal_local_mode()`](https://c14.joeroe.io/reference/cal_mode.md) [`cal_central()`](https://c14.joeroe.io/reference/cal_mode.md) : Point estimates of calibrated radiocarbon dates - [`cal_probability()`](https://c14.joeroe.io/reference/cal_probability.md) : Probability that a calibrated date falls within an age range ## Aggregate calibrated dates Functions for aggregating calibrated radiocarbon determinations - [`cal_density()`](https://c14.joeroe.io/reference/cal_density.md) [`density(`*``*`)`](https://c14.joeroe.io/reference/cal_density.md) : Kernel density estimation of calendar probability distributions - [`cal_sum()`](https://c14.joeroe.io/reference/cal_sum.md) [`sum(`*``*`)`](https://c14.joeroe.io/reference/cal_sum.md) : Sum calendar probability distributions ## Tidy radiocarbon metadata Functions for tidying metadata associated with radiocarbon determinations - [`c14_control_lab_id()`](https://c14.joeroe.io/reference/c14_control_lab_id.md) : Control radiocarbon laboratory identifiers - [`c14_control_material()`](https://c14.joeroe.io/reference/c14_control_material.md) : Control radiocarbon sample materials - [`c14_fix_lab_id()`](https://c14.joeroe.io/reference/c14_fix_lab_id.md) [`c14_is_lab_id()`](https://c14.joeroe.io/reference/c14_fix_lab_id.md) : Detect and fix malformed radiocarbon laboratory identifiers - [`c14_parse_lab_id()`](https://c14.joeroe.io/reference/c14_parse_lab_id.md) : Parse radiocarbon laboratory identifiers - [`c14_lab_code_thesaurus`](https://c14.joeroe.io/reference/c14_lab_code_thesaurus.md) : Radiocarbon laboratory code thesaurus - [`c14_labs`](https://c14.joeroe.io/reference/c14_labs.md) : Radiocarbon laboratories - [`c14_material_thesaurus`](https://c14.joeroe.io/reference/c14_material_thesaurus.md) : Radiocarbon sample material thesaurus ## Plotting Plotting radiocarbon data - [`plot(`*``*`)`](https://c14.joeroe.io/reference/plot.c14_cal.md) : Plot calibrated radiocarbon dates ## Example data Example datasets included with the package - [`ppnd`](https://c14.joeroe.io/reference/ppnd.md) : Radiocarbon dates from Neolithic Southwest Asia - [`shub1_c14`](https://c14.joeroe.io/reference/shub1_c14.md) : Radiocarbon dates from Shubayqa 1 # Articles ### All vignettes - [Tidy radiocarbon data](https://c14.joeroe.io/articles/c14.md):