Last data update: 2014.03.03

R: Draw life lines in a Lexis diagram.
Lexis.linesR Documentation

Draw life lines in a Lexis diagram.

Description

Add life lines to a Lexis diagram.

Usage

Lexis.lines( entry.date = NA,
              exit.date = NA,
             birth.date = NA,
              entry.age = NA,
               exit.age = NA,
              risk.time = NA,
               col.life = "black",
               lwd.life = 2,
                   fail = NA,
               cex.fail = 1,
               pch.fail = c(NA, 16),
               col.fail = col.life,
                   data = NULL )

Arguments

entry.date, entry.age, exit.date, exit.age, risk.time, birth.date

Numerical vectors defining lifelines to be plotted in the diagram. At least three must be given to produce lines. Not all subsets of three will suffice, the given subset has to define life lines. If insufficient data is given, no life lines are produced.

col.life

Colour of the life lines.

lwd.life

Width of the life lines.

fail

Logical of event status at exit for the persons whose life lines are plotted.

cex.fail

The size of the status marks at the end of life lines.

pch.fail

The status marks at the end of the life lines.

col.fail

Colour of the marks for censorings and failures respectively.

data

Data frame in which to interpret values.

Value

If sufficient information on lifelines is given, a data frame with one row per person and columns with entry ages and dates, birth date, risk time and status filled in.

Side effect: Life lines are added to an existing Lexis diagram. Lexis.lines adds life lines to an existing plot.

Author(s)

Bendix Carstensen, Steno Diabetes Center, http://BendixCarstensen.com

See Also

Lexis.diagram, Life.lines

Examples

Lexis.diagram( entry.age = c(3,30,45),
               risk.time = c(25,5,14),
              birth.date = c(1970,1931,1925.7),
                    fail = c(TRUE,TRUE,FALSE) )
Lexis.lines( entry.age = sample( 0:50, 100, replace=TRUE ),
             risk.time = sample( 5:40, 100, r=TRUE),
            birth.date = sample( 1910:1980, 100, r=TRUE ),
                  fail = sample(0:1,100,r=TRUE),
              cex.fail = 0.5,
              lwd.life = 1 )

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(Epi)

Attaching package: 'Epi'

The following object is masked from 'package:base':

    merge.data.frame

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Epi/Lexis.lines.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Lexis.lines
> ### Title: Draw life lines in a Lexis diagram.
> ### Aliases: Lexis.lines
> ### Keywords: hplot dplot
> 
> ### ** Examples
> 
> Lexis.diagram( entry.age = c(3,30,45),
+                risk.time = c(25,5,14),
+               birth.date = c(1970,1931,1925.7),
+                     fail = c(TRUE,TRUE,FALSE) )
> Lexis.lines( entry.age = sample( 0:50, 100, replace=TRUE ),
+              risk.time = sample( 5:40, 100, r=TRUE),
+             birth.date = sample( 1910:1980, 100, r=TRUE ),
+                   fail = sample(0:1,100,r=TRUE),
+               cex.fail = 0.5,
+               lwd.life = 1 )
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>