| Title: | A Set of Methods for Longitudinal Data Objects |
|---|---|
| Description: | A very simple implementation of a class for longitudinal data. |
| Authors: | R. Gentleman |
| Maintainer: | Arthur Allignol <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 1.1.5 |
| Built: | 2026-06-04 09:43:22 UTC |
| Source: | https://github.com/cran/lgtdl |
as.lgtdl coerces its argument to class lgtdl if possible.
is.lgtdl returns TRUE if its argument is of class
lgtdl and FALSE otherwise.
as.lgtdl(x, row.names=NULL) is.lgtdl(x)as.lgtdl(x, row.names=NULL) is.lgtdl(x)
x |
An object which is coerced to a |
row.names |
An optional set of row names to be used for the names
of the covariates in the resulting |
is.lgtdl |
Returns |
as.lgtdl |
Returns an object of class |
Robert Gentleman
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) is.lgtdl(TRUE)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) is.lgtdl(TRUE)
The covariate component of the lgtdl object is returned.
getcov(x, ...) ## S3 method for class 'lgtdl' getcov(x, cov, ...)getcov(x, ...) ## S3 method for class 'lgtdl' getcov(x, cov, ...)
x |
The |
cov |
The name of the covariate to be extracted. |
... |
Ignored, there for potential future use. |
The covariate, as either a matrix or vector, is returned.
Robert Gentleman
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) getcov(x1) getcov(x2)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) getcov(x1) getcov(x2)
A linear interpolation, using approx, is used to obtain
estimates of the covariate at times other than those observed.
interplinear(x, ...) ## S3 method for class 'lgtdl' interplinear(x, time, cov = NULL, ...) ## S3 method for class 'AsIs' interplinear(x, ...)interplinear(x, ...) ## S3 method for class 'lgtdl' interplinear(x, time, cov = NULL, ...) ## S3 method for class 'AsIs' interplinear(x, ...)
x |
The |
time |
The time(s) at which interpolation is desired. |
cov |
The name of the covariate in the |
... |
Ignored. |
A vector containing the interpolated estimates of the covariate values at the requested times.
Robert Gentleman
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, 4) interpprev(x2, c(12, 14))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, 4) interpprev(x2, c(12, 14))
These functions provide an interpolation mechanism for objects of
class lgtdl. The AsIs method is the vectorized version.
interpprev(x, ...) ## S3 method for class 'lgtdl' interpprev(x, time, cov, ...) ## S3 method for class 'AsIs' interpprev(x, ...)interpprev(x, ...) ## S3 method for class 'lgtdl' interpprev(x, time, cov, ...) ## S3 method for class 'AsIs' interpprev(x, ...)
x |
|
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 |
... |
Ignored. |
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.
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.
Robert Gentleman
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))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))
The lgtdl class is a simple class of R/S objects that make it
simpler to manipulate longitudinal data.
Robert Gentleman
Gentleman Robert (2001). Modeling with Objects. Proceedings of the 2nd International Workshop on Distributed Statistical Computing. http://r-project.org/nosvn/conferences/DSC-2001/Proceedings/Gentleman.pdf
A lgtdly object consists of a time component and one or more covariates measured or observed at the times specified in the time component. This function plots the covariate trajectories as lines on the y axis.
## S3 method for class 'lgtdl' plot(x, ...)## S3 method for class 'lgtdl' plot(x, ...)
x |
An object of class |
... |
Optional arguments to control the plotting. |
One should be able to specify values for any of the graphics parameters to change the appearance of the plot.
No value is returned. A line plot of the longitudinal object is rendered on the active graphics device.
Robert Gentleman
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) plot(x1) plot(x2)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) plot(x1) plot(x2)
Data frames can contain lgtdl objects as elements. When the data
frame is printed this function provides a suitable string for printing.
## S3 method for class 'lgtdl' toString(x, width, ...)## S3 method for class 'lgtdl' toString(x, width, ...)
x |
The object to be formated. |
width |
To control the width of the returned string-ignored. |
... |
Ignored. |
A character string. Currently it is "lgtdl, length = " with the
length of the time component added.
Robert Gentleman
toString