Lexis_fpa {popEpi} | R Documentation |
Create a Lexis Object with Follow-up Time, Period, and Age Time Scales
Description
This is a simple wrapper around Lexis
for creating
a Lexis
object with the time scales fot
, per
,
and age
.
Usage
Lexis_fpa(
data,
birth = NULL,
entry = NULL,
exit = NULL,
entry.status = NULL,
exit.status = NULL,
subset = NULL,
...
)
Arguments
data |
a |
birth |
the time of birth; A character string naming the variable in data or an expression to evaluate - see Flexible input |
entry |
the time at entry to follow-up; supplied the
same way as |
exit |
the time at exit from follow-up; supplied the
same way as |
entry.status |
passed on to |
exit.status |
passed on to |
subset |
a logical condition to subset by before passing data
and arguments to |
... |
additional optional arguments passed on to
|
Value
A Lexis
object with the usual columns that Lexis
objects
have, with time scale columns fot
, per
, and age
.
They are calculated as
fot = entry - entry
(to ensure correct format, e.g. difftime)
per = entry
and
age = entry - birth
Examples
data("sire", package = "popEpi")
lex <- Lexis_fpa(sire,
birth = "bi_date",
entry = dg_date,
exit = ex_date + 1L,
exit.status = "status")
## some special cases
myVar <- "bi_date"
l <- list(myVar = "bi_date")
sire$l <- sire$myVar <- 1
## conflict: myVar taken from data when "bi_date" was intended
lex <- Lexis_fpa(sire,
birth = myVar,
entry = dg_date,
exit = ex_date + 1L,
exit.status = "status")
## no conflict with names in data
lex <- Lexis_fpa(sire,
birth = l$myVar,
entry = dg_date,
exit = ex_date + 1L,
exit.status = "status")