Learn R Programming

LexisPlotR (version 0.4.0)

lexis_lifeline: Plot lifelines into a Lexis grid

Description

Add lifelines to an existing Lexis grid.

Usage

lexis_lifeline(lg, birth, entry = NA, exit = NA, lineends = FALSE,
  colour = lexisplotr_colours()[5], alpha = 1, lwd = 0.5)

Arguments

lg,

an existing object originally created with lexis_grid().

birth

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

entry

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

exit

character, set the exit or death date of an individual in format "YYYY-MM-DD". Optional.

lineends

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

colour

character, set the colour of the lifelines.

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.

Value

A ggplot2 object.

Details

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

Examples

Run this code
# NOT RUN {
lg <- lexis_grid(year_start = 1900, year_end = 1905, age_start = 0, age_end = 5)
lexis_lifeline(lg = lg, birth = "1901-09-23")
lexis_lifeline(lg = lg, birth = "1901-09-23", entry = "1902-04-01")
lexis_lifeline(lg = lg, birth = "1901-09-23", exit = "1904-10-31")
# }

Run the code above in your browser using DataLab