Skip to contents

Calibrates a set of 14C ages using rcarbon::calibrate and optionally summarises the empirical PDFs of calendar age to mean and standard deviation and appends these to the input dataframe

Usage

calibrate_14C_age(
  dat,
  age.14C = "age.14C",
  age.14C.se = "age.14C.se",
  cal_curve = "intcal20",
  return.type = "dat",
  offset = "offset",
  offset.se = "offset.se"
)

Arguments

dat

A dataframe containing the radiocarbon dates and uncertainties

age.14C

Name of column with 14C ages, Default: 'age.14C'

age.14C.se

Name of column with 1se 14C age uncertainty, Default: 'age.14C.se'

cal_curve

Calibration curve, Default: 'intcal20', see calibrate

return.type

Return the ammended dataframe or additionally the list of PDFs, Default: 'dat'

offset

Name of offset column, e.g. reservoir age. If column does not exist, no offset is applied.

offset.se

Name of offset uncertainty column, e.g. sigmaDelatR. If column does not exist, no offset uncertainty is applied.

Value

A dataframe or list

Details

A wrapper for rcarbon::calibrate

See also

Examples

# With defaults
dat <- data.frame(age.14C = c(2000, 20000),
                  age.14C.se = c(100, 200))
calibrate_14C_age(dat)
#> # A tibble: 2 × 7
#>   DateID age.14C age.14C.se offset offset.se age.14C.cal age.14C.cal.se
#>    <dbl>   <dbl>      <dbl>  <dbl>     <dbl>       <dbl>          <dbl>
#> 1      1    2000        100      0         0        1939           135.
#> 2      2   20000        200      0         0       24045           239.

# Change the calibration
calibrate_14C_age(dat, cal_curve = "marine13")
#> Warning: timeRange value not supported with the selected curve(s); calibrating using timeRange=c(50000,0)
#> Warning: timeRange value not supported with the selected curve(s); calibrating using timeRange=c(50000,0)
#> # A tibble: 2 × 7
#>   DateID age.14C age.14C.se offset offset.se age.14C.cal age.14C.cal.se
#>    <dbl>   <dbl>      <dbl>  <dbl>     <dbl>       <dbl>          <dbl>
#> 1      1    2000        100      0         0        1564           119.
#> 2      2   20000        200      0         0       23599           255.

# Return the PDFs
cal.lst <- calibrate_14C_age(dat, cal_curve = "marine13", return = "list")
#> Warning: timeRange value not supported with the selected curve(s); calibrating using timeRange=c(50000,0)
#> Warning: timeRange value not supported with the selected curve(s); calibrating using timeRange=c(50000,0)
cal.lst
#> $dat
#> # A tibble: 2 × 7
#>   DateID age.14C age.14C.se offset offset.se age.14C.cal age.14C.cal.se
#>    <dbl>   <dbl>      <dbl>  <dbl>     <dbl>       <dbl>          <dbl>
#> 1      1    2000        100      0         0        1564           119.
#> 2      2   20000        200      0         0       23599           255.
#> 
#> $cal.ages
#> # A tibble: 2,303 × 14
#>    DateID   CRA Error Details CalCurve ResOffsets ResErrors StartBP EndBP
#>     <dbl> <dbl> <dbl> <lgl>   <chr>         <dbl>     <dbl>   <dbl> <dbl>
#>  1      1  2000   100 NA      marine13          0         0   50000     0
#>  2      1  2000   100 NA      marine13          0         0   50000     0
#>  3      1  2000   100 NA      marine13          0         0   50000     0
#>  4      1  2000   100 NA      marine13          0         0   50000     0
#>  5      1  2000   100 NA      marine13          0         0   50000     0
#>  6      1  2000   100 NA      marine13          0         0   50000     0
#>  7      1  2000   100 NA      marine13          0         0   50000     0
#>  8      1  2000   100 NA      marine13          0         0   50000     0
#>  9      1  2000   100 NA      marine13          0         0   50000     0
#> 10      1  2000   100 NA      marine13          0         0   50000     0
#> # ℹ 2,293 more rows
#> # ℹ 5 more variables: Normalised <lgl>, F14C <lgl>, CalEPS <dbl>, calBP <dbl>,
#> #   PrDens <dbl>
#> 
# Use different column names
dat <- data.frame(radiocarbon.age = c(2000, 20000),
                 se = c(100, 200))
calibrate_14C_age(dat, age.14C = "radiocarbon.age", age.14C.se = "se")
#> # A tibble: 2 × 7
#>   DateID radiocarbon.age    se offset offset.se age.14C.cal age.14C.cal.se
#>    <dbl>           <dbl> <dbl>  <dbl>     <dbl>       <dbl>          <dbl>
#> 1      1            2000   100      0         0        1939           135.
#> 2      2           20000   200      0         0       24045           239.
if (FALSE) { # \dontrun{
if(interactive()){
 #EXAMPLE1
 }
} # }