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=TRUE)
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
).
A file name from which to read the data with variables as columns and observations as rows.
A logical value indicating whether the file contains the names of the variables as the line before the first row of data.
The number of lines of the file to skip before beginning to read data.
The field separator character. Values on each line of the file are separated by this character.
A vector of strings defining what values are to be assigned NA.
A character vector giving the column name(s) of the dataframe for the response variable(s).
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.
An optional character vector giving the column name of the dataframe for the times vector.
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.
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.
An optional character vector giving the column name of the dataframe for the weights vector.
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.
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.
An optional character vector giving the two or three column name(s) of the dataframe for the spatial coordinates.
An optional character vector giving the types of response variables: nominal, ordinal, discrete, duration, continuous, multivariate, or unknown.
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.
An optional character vector giving the column names of the dataframe for the time-varying or intra-individual covariates.
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.
J.K. Lindsey
dftorep
, lvna
,
read.list
, restovec
,
rmna
, tcctomat
,
tvctomat
if (FALSE) read.rep("test.dat", resp=c("y1","y2"), times="tt", id="id",
if (FALSE) totals=c("tot1","tot2"), tvcov="x",ccov="x2")
Run the code above in your browser using DataLab