read.rep {rmutil} | R Documentation |

`dftorep`

forms an object of class, `repeated`

, from data
read from a file with the option of removing any observations where
response and covariate values have NAs. For repeated measurements,
observations on the same individual must be together in the file. A
number of validity checks are performed on the data.

Such objects can be printed and plotted. Methods are available for
extracting the response, the numbers of observations per individual,
the times, the weights, the units of measurement/Jacobian, the nesting
variable, the covariates, and their names: `response`

,
`nobs`

, `times`

,
`weights`

, `delta`

,
`nesting`

, `covariates`

, and
`names`

.

read.rep(file, header=TRUE, skip=0, sep = "", na.strings="NA", response, id=NULL, times=NULL, censor=NULL, totals=NULL, weights=NULL, nest=NULL, delta=NULL, coordinates=NULL, type=NULL, ccov=NULL, tvcov=NULL, na.rm=T)

`file` |
A file name from which to read the data with variables as columns and observations as rows. |

`header` |
A logical value indicating whether the file contains the names of the variables as the line before the first row of data. |

`skip` |
The number of lines of the file to skip before beginning to read data. |

`sep` |
The field separator character. Values on each line of the file are separated by this character. |

`na.strings` |
A vector of strings defining what values are to be assigned NA. |

`response` |
A character vector giving the column name(s) of the dataframe for the response variable(s). |

`id` |
A character vector giving the column name of the
dataframe for the identification numbers of the individuals. If the
numbers are not consecutive integers, a warning is given.
If NULL, one observation per individual is assumed if `times` is
also NULL, other time series is assumed. |

`times` |
An optional character vector giving the column name of the dataframe for the times vector. |

`censor` |
An optional character vector giving the column name(s)
of the dataframe for the censor indicator(s). This must be the same
length as `response` . Responses without censor indicator can have
a column either of all NAs or all 1s. |

`totals` |
An optional character vector giving the column name(s)
of the dataframe for the totals for binomial data. This must be the same
length as `response` . Responses without censor indicator can have
a column all NAs. |

`weights` |
An optional character vector giving the column name of the dataframe for the weights vector. |

`nest` |
An optional character vector giving the column name of
the dataframe for the nesting vector within individuals.
This is the second level of nesting for repeated measurements, with the individual being the first level. Values for an individual must be consecutive increasing integers. |

`delta` |
An optional character vector giving the column name(s)
of the dataframe for the units of measurement/Jacobian(s) of the
response(s). This must be the same length as `response` .
Responses without units of measurement/Jacobian can have a column all
NAs.
If all response variables have the same unit of measurement, this can be that one number. If each response variable has the same unit of measurement for all its values, this can be a numeric vector of length the number of response variables. |

`coordinates` |
An optional character vector giving the two or three column name(s) of the dataframe for the spatial coordinates. |

`type` |
An optional character vector giving the types of response variables: nominal, ordinal, discrete, duration, continuous, multivariate, or unknown. |

`ccov` |
An optional character vector giving the column names of the dataframe for the time-constant or inter-individual covariates. For repeated measurements, if the value is not constant for all observations on an individual, an error is produced. |

`tvcov` |
An optional character vector giving the column names of the dataframe for the time-varying or intra-individual covariates. |

`na.rm` |
If TRUE, observations with NAs in any variables selected are removed in the object returned. Otherwise, the corresponding indicator variable is returned in a slot in the object. |

Returns an object of class, `repeated`

, containing a list of the
response object (`z$response`

, so that, for example, the response vector
is `z$response$y`

; see `restovec`

), and
possibly the two classes of covariate objects (`z$ccov`

and
`z$tvcov`

; see `tcctomat`

and
`tvctomat`

).

J.K. Lindsey

`dftorep`

, `lvna`

,
`read.list`

, `restovec`

,
`rmna`

, `tcctomat`

,
`tvctomat`

## Not run: read.rep("test.dat", resp=c("y1","y2"), times="tt", id="id", ## Not run: totals=c("tot1","tot2"), tvcov="x",ccov="x2")

[Package *rmutil* version 1.0 Index]