interpprev: Interpolation Using the Previous Value

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/lgtdl.R

Description

These functions provide an interpolation mechanism for objects of class lgtdl. The AsIs method is the vectorized version.

Usage

1
2
3
4
5
interpprev(x, ...)
## S3 method for class 'lgtdl'
interpprev(x, time, cov, ...)
## S3 method for class 'AsIs'
interpprev(x, ...)

Arguments

x

x is either an object of class lgtdl or of class AsIs. It is the object on which interpolation is to be performed.

time

A vector of times at which interpolation is requested.

cov

The name of the covariate on which interpolation is requested. It is only required if x has more than one covariate.

...

Ignored.

Details

If objects of class lgtdl are inserted into a data frame they become a vector with class AsIs. In order to operate on these we provide a method for that class. The method is simply a vectorized version.

Value

interpprev.lgtdl returns a numeric vector of the interpolated values of the covariate at the time(s) specified by time. interpprev.AsIs returns a vector of interpolated values of the covariate. In this case the vector contains one value for each element x. time must be either the same length as x or of length one. In the latter case all interpolations are done at that time.

Author(s)

Robert Gentleman

See Also

interplinear

Examples

1
2
3
4
5
6
  x1<-data.frame(time=c(1,3,5), cov=c(4,6,8))
  x2<-data.frame(time=c(11,13,15), interest=c(66,45,88))
  x1<-as.lgtdl(x1)
  x2<-as.lgtdl(x2)
  interpprev(x1, c(2,4))
  interpprev(x2, c(12, 14))

Example output

[1] 4 6
[1] 66 45

lgtdl documentation built on May 1, 2019, 8:47 p.m.

Related to interpprev in lgtdl...