

   FFiinndd tthhee mmoosstt rreecceenntt vvaalluuee ooff aa ttiimmee--vvaarryyiinngg ccoovvaarriiaattee
   bbeeffoorree eeaacchh oobbsseerrvveedd rreessppoonnssee aanndd ppoossssiibbllyy aadddd tthheemm ttoo aa
   lliisstt ooff ootthheerr ttiimmee--vvaarryyiinngg ccoovvaarriiaatteess..

        gettvc(response, times=NULL, tvcov=NULL, tvctimes=NULL,
             oldtvcov=NULL, ties=TRUE)

   AArrgguummeennttss::

   response: A list of two column matrices with response values
             and times for each individual, one matrix or
             dataframe of response values, or an object of
             class, response (created by `restovec').

      times: When `response' is a matrix, a vector of possibly
             unequally spaced times for the response, when they
             are the same for all individuals or a matrix of
             times. Not necessary if equally spaced.

      tvcov: A list of two column matrices with time-varying
             covariate values and corresponding times for each
             individual or one matrix or dataframe of such
             covariate values. Times need not be the same as
             for responses.

   tvctimes: When the time-varying covariate is a matrix, a
             vector of possibly unequally spaced times for the
             covariate, when they are the same for all individ-
             uals or a matrix of times. Not necessary if
             equally spaced.

   oldtvcov: A list of matrices with time-varying covariate
             values, observed at the event times in `response',
             for each individual, or an object of class, tvcov.
             If not provided, a new object is created.

       ties: If TRUE, when the response and covariate times are
             identical, the response depends on that new value
             (as in observational studies); if FALSE, only the
             next response depends on that value (for example,
             if the covariate is a new treatment just applied
             at that time).

   DDeessccrriippttiioonn::

        `gettvc' compares the times of response observations
        with those of time-varying covariates to find the most
        recent observed time-varying covariate for each
        response. These are either placed in a new object of
        class, tvcov, added to an already existing list of
        matrices containing other time-varying covariates and a
        new object of class, tvcov, created, or added to an
        existing object of class, tvcov.

   VVaalluuee::

        An object of class, tvcov, is returned containing the
        new time-varying covariate and, possibly, those in
        `oldtvcov'.

   AAuutthhoorr((ss))::

        J.K. Lindsey and D.F. Heitjan

   SSeeee AAllssoo::

        `carma', `elliptic', `gar', `kalcount', `kalseries',
        `kalsurv', `read.list', `restovec', `tvctomat'.

   EExxaammpplleess::

        y <- matrix(rnorm(20), ncol=5)
        resp <- restovec(y, times=c(1,3,6,10,15))
        z <- matrix(rpois(20,5),ncol=5)
        z
        # create a new time-varying covariate object for the response
        newtvc <- gettvc(resp, tvcov=z, tvctimes=c(1,2,5,12,14))
        covariates(newtvc)
        # add another time-varying covariate to the object
        z2 <- matrix(rpois(20,5),ncol=5)
        z2
        newtvc2 <- gettvc(resp, tvcov=z2, tvctimes=c(0,4,5,12,16), oldtvc=newtvc)
        covariates(newtvc2)

