Age-depth model interpolators/extrapolators

age_depth_interpolate(x, y)

age_depth_extrapolate(x, y, x0 = last, y0 = last, slope = NULL)

age_depth_exact(x, y)

age_depth_na(x, y)

Arguments

x

A paired vector of x values

y

A paired vector of y values

x0

The x value to anchor the transform

y0

The y value to anchor the transform

slope

The slope (in units of y/x) to use for the transform

Value

A list with component functions trans and inverse

Examples

age_depth_model(
  alta_lake_210Pb_ages,
  depth = depth_cm, age = age_year_ad,
  age_max = age_year_ad + age_error_yr,
  age_min = age_year_ad - age_error_yr,
  extrapolate_age_below = ~age_depth_extrapolate(
    tail(.x, 3), tail(.y, 3), x0 = dplyr::last, y0 = dplyr::last
  ),
  extrapolate_age_above = ~age_depth_extrapolate(
    head(.x, 3), head(.y, 3), x0 = dplyr::first, y0 = dplyr::first
  )
)
#> <age_depth_model>
#> Call: 
#> age_depth_model(
#>   .data = alta_lake_210Pb_ages, depth = depth_cm,
#>   age = age_year_ad, age_min = age_year_ad - age_error_yr,
#>   age_max = age_year_ad + age_error_yr, extrapolate_age_below = ~ age_depth_extrapolate(tail(
#>     .x,
#>     3
#>   ), tail(.y, 3), x0 = dplyr::last, y0 = dplyr::last),
#>   extrapolate_age_above = ~ age_depth_extrapolate(head(.x, 3),
#>     head(.y, 3),
#>     x0 = dplyr::first, y0 = dplyr::first
#>   )
#> )