Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

list.lex

Compact printing of Lexis object


Description

Often the number of digits after the decimal point ant not the sugnificant digits is relevant in printing timescales.

Usage

list.lex( Lx, dig, sh="_" )

Arguments

Lx

A Lexis object.

dig

Scalar. How many digits should be printed after the decimal separator for the numerical variables.

sh

Replacement string for lex. in names when printing.

Details

The function is designed to make a compact listing of a Lexis obejct. Variables are ordered with lex.id, time scales, lex.dur and state variables first. In order to avoid save between columns the lex. prefix is replaced by an underscore to shorten the names.

Value

NULL, the functions is used for its compact printing of a Lexis object.

Author(s)

Bendix Carstensen

Examples

# A small bogus cohort
xcoh <- structure( list( id = c("A", "B", "C"),
                      birth = c("14/07/1952", "01/04/1954", "10/06/1987"),
                      entry = c("04/08/1965", "08/09/1972", "23/12/1991"),
                       exit = c("27/06/1997", "23/05/1995", "24/07/1998"),
                       fail = c(1, 0, 1) ),
                     .Names = c("id", "birth", "entry", "exit", "fail"),
                  row.names = c("1", "2", "3"),
                      class = "data.frame" )

# Convert the character dates into numerical variables (fractional years)
xcoh <- cal.yr( xcoh, format="%d/%m/%Y", wh=2:4 )
# Make a Lexis obejct
Lcoh <- Lexis( entry = list( per=entry ),
                exit = list( per=exit,
                             age=exit-birth ),
         exit.status = fail,
                data = xcoh )
Lcoh
list.lex( Lcoh, 2 )

Epi

Statistical Analysis in Epidemiology

v2.44
GPL-2
Authors
Bendix Carstensen [aut, cre], Martyn Plummer [aut], Esa Laara [ctb], Michael Hills [ctb]
Initial release
2021-02-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.