LinInterp: Linear Interpolation

Description Usage Arguments Details Value Author(s) Examples

View source: R/LinInterp.R

Description

Linearly interpolates, allowing multiple y-values for a given x-value.

Usage

1
LinInterp(xin, yin, xout, mode = 'data')

Arguments

xin

Input x vector

yin

Input y vector

xout

x-values at which to interpolate

mode

How to handle x-values with multiple y-values: one of 'jump', 'data', 'all'

Details

Regarding the 'mode' argument: 'data' interpolates using the mean of all y-values for the given x-value, while 'jump' or 'all' uses only the y-value on the same side of the discontinuity as the element of 'xout'.

Value

Vector of interpolated y-values corresponding to xout.

Author(s)

Jake Anderson

Examples

1
2
3
4
5
6
xin = c(1, 2, 3, 3, 4, 5)
yin = c(0, 0, 0, 1, 1, 1)
xout = 3.5

LinInterp(xin, yin, xout, 'all')
LinInterp(xin, yin, xout, 'data')

TauP.R documentation built on May 2, 2019, 3:25 a.m.