View source: R/Francis_bomb_functions.R
closest.pt | R Documentation |
closest.pt
finds, for each sample point in samp
, the point on
the reference curve (continuous linear spline defined by ref) that is
'closest' to it. Distance (and thus the definition of 'closest') is
defined, differently for each sample point, by dividing the x and y
values by the sampling errors for that point.
closest.pt( ref, samp, ref.x = "x", ref.y = "y", samp.x = "Sample.Year", samp.y = "F14C", age.err = "SE.Age", y.err = "F14C.SD", plotit = FALSE, incl.dist = FALSE )
ref |
list, data frame, or matrix containing x- and y-coordinates for a
reference line one wishes to compare sample points to. Typically this
will be the output from a call to |
samp |
data frame, with a minimum of 4 columns, representing your 'test' data set. Individual columns should represent x-cordinates, y-cordinates, aging error, and y error. Typically x will represnt sample year or birth year and y will rerpresent either D14C or F14C. |
ref.x |
character string giving the name of the x-value in the provided
|
ref.y |
character string giving the name of the y-value in the provided
|
samp.x |
character string giving the name of the x-value in the
provided |
samp.y |
character string giving the name of the y-value in the
provided |
age.err |
character string giving the name of the column representing
aging error provided in the |
y.err |
character string giving the name of the column representing
the y-variable error provided in the |
plotit |
logical indicating whether to generate plot |
incl.dist |
logical indicating whether to include distance calculations in resultant output |
A dataframe with components (each with length nrow(samp)) with components X, Y - x & y coordinates of closest points - and optionally (if incl.dist = TRUE) dist - signed distance from reference curve. Optionally plots (if plot = TRUE) the data, including lines joining each sample point to its closest point.
Other Bomb Radiocarbon Analyses:
bias.plot.BR()
,
calc.bias()
,
calc.h()
,
get.h.from.bias()
,
get.nearest()
,
get.ref.line()
,
sim.hdist()
data(snapper) snapper.red <- snapper[snapper$C14year >= 1955 & snapper$C14year <= 1972, ] data(bluenose) bluenose.red <- bluenose[bluenose$C14year >= 1955 & bluenose$C14year <= 1972, ] bluenose.red <- bluenose.red[bluenose.red$C14 >= -506 & bluenose.red$C14 <= 94.0, ] ref <- get.ref.line(snapper.red$C14year, snapper.red$C14) closest.pt(ref = ref, samp = bluenose.red, samp.x = "C14year", samp.y = "C14", age.err = "age.err", y.err = "C14.err", plot = TRUE, incl.dist = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.