get.nearest: Find Nearest Point

View source: R/Francis_bomb_functions.R

get.nearestR Documentation

Find Nearest Point

Description

get.nearest for each point (x,y), returns the x-coordinate of the point on the line that is closest to it in the x-direction. The lie is a linear spline defined by joining a series of poitns by straight lines.

Usage

get.nearest(line, x, y)

Arguments

line

a list, with components x and y (each an n-vector), containing the series of n points definign the line

x, y

- m-vectors defining m points

Value

Returns a vecto of lenght m. This has value NA for any point whose y value lies outside the range of the y values in the line.

See Also

Other Bomb Radiocarbon Analyses: bias.plot.BR(), calc.bias(), calc.h(), closest.pt(), get.h.from.bias(), get.ref.line(), sim.hdist()

Examples

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)
get.nearest(ref, bluenose.red$C14year, bluenose.red$C14)

ballengerj/FishyR documentation built on June 17, 2022, 10:33 p.m.