It interpolates y value when a corresponding x value (xnew) does not exist within x vector

gInterpol(x, y, xnew, Outer="NEAREST")

Arguments

x

vector values of x-axis, usually time

y

vector values of y-axis, usually concentration

xnew

new x point to be interpolated, usually new time point

Outer

indicates how to do the out of x range point

Details

This function interpolate y value, if xnew is not in x vector. If xnew is in the x vector, it just returns the given x and y vector. This function usually is called by gIntAUC function Returned vector is sorted in the order of increasing x values.

Value

new x and y vector containing xnew and ynew point

Author

Kyun-Seop Bae <k@acr.kr>

See also

Examples

x = 1:10 + 0.1
y = -2*x + 40.2
gInterpol(x, y, 1.5)
#> [[1]]
#>  [1]  1.1  1.5  2.1  3.1  4.1  5.1  6.1  7.1  8.1  9.1 10.1
#> 
#> [[2]]
#>  [1] 38.0 37.2 36.0 34.0 32.0 30.0 28.0 26.0 24.0 22.0 20.0
#> 
gInterpol(x, y, 0.5) # Out of range, Left
#> [[1]]
#>  [1]  0.5  1.1  2.1  3.1  4.1  5.1  6.1  7.1  8.1  9.1 10.1
#> 
#> [[2]]
#>  [1] 38 38 36 34 32 30 28 26 24 22 20
#> 
gInterpol(x, y, 11) # Out of range, Left
#> [[1]]
#>  [1]  1.1  2.1  3.1  4.1  5.1  6.1  7.1  8.1  9.1 10.1 11.0
#> 
#> [[2]]
#>  [1] 38 36 34 32 30 28 26 24 22 20 20
#>