# Life.lines: Compute dates/ages for life lines in a Lexis diagram In Epi: Statistical Analysis in Epidemiology

## Description

Fills out the missing information for follow up of persons in a Lexis diagram if sufficient information is given.

## Usage

 ```1 2 3 4 5 6``` ```Life.lines( entry.date = NA, exit.date = NA, birth.date = NA, entry.age = NA, exit.age = NA, risk.time = NA ) ```

## Arguments

 ```entry.date, exit.date,birth.date, entry.age, exit.age, risk.time``` Vectors defining lifelines to be plotted in the diagram. At least three must be given to produce a result. Not all subsets of three will suffice, the given subset has to define life lines. If insufficient data is given, nothing is returned and a warning is given.

## Value

Data frame with variables `entry.date`, `entry.age`, `exit.date`, `exit.age`, `risk.time`, `birth.date`, with all entries computed for each person. If any of `entry.date`, `exit.date` or `birth.date` are of class `Date` or if any of `entry.age`, `exit.age` or `risk.time` are of class `difftime` the date variables will be of class `Date` and the other three of class `difftime`.

`Lexis.diagram`, `Lexis.lines`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19``` ```( Life.lines( entry.age = c(3,30,45), risk.time = c(25,5,14), birth.date = c(1970,1931,1925.7) ) ) # Draw a Lexis diagram Lexis.diagram() # Compute entry and exit age and date. ( LL <- Life.lines( entry.age = c(3,30,45), risk.time = c(25,5,14), birth.date = c(1970,1931,1925.7) ) ) segments( LL[,1], LL[,2], LL[,3], LL[,4] ) # Plot the life lines. # Compute entry and exit age and date, supplying a date variable bd <- ( c(1970,1931,1925.7) - 1970 ) * 365.25 class( bd ) <- "Date" ( Life.lines( entry.age = c(3,30,45), risk.time = c(25,5,14), birth.date = bd ) ) ```

### Example output

```Attaching package: 'Epi'

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

merge.data.frame

entry.date entry.age exit.date exit.age birth.date risk.time
1     1973.0         3    1998.0       28     1970.0        25
2     1961.0        30    1966.0       35     1931.0         5
3     1970.7        45    1984.7       59     1925.7        14
entry.date entry.age exit.date exit.age birth.date risk.time
1     1973.0         3    1998.0       28     1970.0        25
2     1961.0        30    1966.0       35     1931.0         5
3     1970.7        45    1984.7       59     1925.7        14
entry.date entry.age  exit.date  exit.age birth.date risk.time
1 1972-12-31  1095.75  1998-01-01 10227.00  1970-01-01  9131.25
2 1961-01-04 10957.50  1966-01-04 12783.75  1931-01-05  1826.25
3 1970-09-18 16436.25  1984-09-17 21549.75  1925-09-17  5113.50
```

Epi documentation built on Feb. 28, 2021, 1:06 a.m.