View source: R/utility_functions.R
Lexis_fpa | R Documentation |
This is a simple wrapper around [Epi::Lexis]
for creating
a Lexis
object with the time scales fot
, per
,
and age
.
Lexis_fpa(
data,
birth = NULL,
entry = NULL,
exit = NULL,
entry.status = NULL,
exit.status = NULL,
subset = NULL,
...
)
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
|
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
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.