Last data update: 2014.03.03

R: Plot lifelines into a Lexis grid
lexis.lifelineR Documentation

Plot lifelines into a Lexis grid

Description

Add lifelines to an existing Lexis grid.

Usage

lexis.lifeline(lg, entry, exit = NA, lineends = F, colour = "red",
  alpha = 1, lwd = 0.5)

Arguments

lg,

an existing object originally created with lexis.grid().

entry

character, set the entry or birth date of an individual in format "YYYY-MM-DD".

exit

character, set the exit or death date of an individual in format "YYYY-MM-DD". Default is NA (no exit or death observed).

lineends

logical, if TRUE lineends will be marked. Default is FALSE.

colour

character, set the colour of the lifelines. Default is "red".

alpha

numeric, set the transparency of the lifelines. Default is 1 (no transparency).

lwd

numeric, set the linewidth of the lifelines. Default is 0.5.

Details

Takes an existing Lexis grid and adds lifelines to the grid. Input can be a single dates or dates from a vector.

Value

A ggplot2 object.

Author(s)

Philipp Ottolinger

Examples

lg <- lexis.grid(year.start = 1900, year.end = 1905, age.start = 0, age.end = 5)
lexis.lifeline(lg = lg, entry = "1901-09-23")
lexis.lifeline(lg = lg, entry = "1901-09-23", exit = "1904-03-03")

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(LexisPlotR)
Loading required package: ggplot2
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/LexisPlotR/lexis.lifeline.Rd_%03d_medium.png", width=480, height=480)
> ### Name: lexis.lifeline
> ### Title: Plot lifelines into a Lexis grid
> ### Aliases: lexis.lifeline
> 
> ### ** Examples
> 
> lg <- lexis.grid(year.start = 1900, year.end = 1905, age.start = 0, age.end = 5)
> lexis.lifeline(lg = lg, entry = "1901-09-23")
> lexis.lifeline(lg = lg, entry = "1901-09-23", exit = "1904-03-03")
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>