approx.cos: Piecewise cosine interpolation

Description Usage Arguments Details Examples

Description

Returns a list of points which interpolate given data points. Similar to approx.

Usage

1
2
approx.cos(x, y = NULL, xout, n = 50, yleft, yright, rule = 1,
  ties = mean)

Arguments

x, y

numeric vectors giving the coordinates of the points to be interpolated.

xout

an optional set of numeric values specifying where interpolation is to take place.

n

If xout is not specified, interpolation takes place at n equally spaced points spanning the interval [min(x), max(x)].

yleft

the value to be returned when input x values are less than min(x). The default is defined by the value of rule given below.

yright

the value to be returned when input x values are greater than max(x). The default is defined by the value of rule given below.

rule

an integer (of length 1 or 2) describing how interpolation is to take place outside the interval [min(x), max(x)]. If rule is 1 then NAs are returned for such points and if it is 2, the value at the closest data extreme is used. Use, e.g., rule = 2:1, if the left and right side extrapolation should differ.

ties

Handling of tied x values. Either a function with a single vector argument returning a single number result or the string "ordered".

Details

This function is based on and functions similarly to approx and spline .

Examples

1
2
3
4
y <- rnorm(10)
x <- 1:10
plot(x, y)
lines(approx.cos(x, y, n=200))

sushilashenoy/zoom.plot documentation built on May 30, 2019, 8:42 p.m.