Description Usage Arguments Value Examples
Creates a function that transforms depths into ages based on a set of known depths and known ages.
Interpolation is linear, and extrpolation is based on average sedimentation rates. Error
is not interpolated but is included in the final output if information for that depth is
requested (useful for putting error bars on age-depth model plots). If depths
are
provided, this funcion returns a data.frame
of the interpolated/extrapolated values.
1 2 |
knowndepths |
A vector of depths with known ages |
knownages |
A vector of ages of the depths specified |
age_err |
A vector of error values for the ages specified |
extrapolate |
An extrapolation method for depths beyond the maximum specified depth: one of 'average' or 'last'. |
depths |
If specified, will return a |
... |
If |
A function with the signature function(depth, cols=c("depth", "age", "err", "type"))
that transforms a depth into a data.frame
with the given cols
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # make an age depth function and use it
ad_func <- agedepth(c(17, 10, 6, 0), c(1880, 1940, 1970, 2015.9))
ad_func(4)
ad_func(6)
ad_func(c(0, 1, 2, 3, 4, 5, 6))
# specify depths to return a data.frame instead of a function
agedepth(c(17, 10, 6, 0), c(1880, 1940, 1970, 2015.9), depths=c(0, 1, 2, 3, 4, 5, 6))
# make an age-depth plot using ggplot
library(ggplot2)
ages <- agedepth(c(17, 10, 6, 0), c(1880, 1940, 1970, 2015.9),
depths=c(0, 6, 10, 17:22))
ggplot(ages, aes(x=age, y=depth, lty=type)) + geom_line() + scale_y_reverse()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.