Learn R Programming

Biograph (version 1.0)

Lexislines.episodes: Draw Lexis diagram with lifelines for selected subjects

Description

The function draws a Lexis diagram, using the Lexis object defined in the Epi package, and draws lifelines for selected subjects.

Usage

Lexislines.episodes(Dlong, subjectsID, title1)

Arguments

Dlong
Input data in long format
subjectsID
Lifelines are drawn for subjects, identified by ID, included in the vector subjectsID.
title1
Title of the Lexis diagram.

Value

  • Lcoh11Lexis object
  • Lcohh12Lexis object
  • subvector of IDs of subjects selected for the lifelines in the Lexis diagram
  • kNumber of subjects selected

Details

The data should be in the long format. The function produces a Lexis object and plots the object. Transitions are marked on the lifelines.

Examples

Run this code
#  Example 1: Employment careers
  data(GLHS) 
  z<- Parameters (GLHS)
  D <- Biograph.long (GLHS)
  tit5 <- "Employment careers for a selection of subjects. GLHS"
  subjects <- c(1,78,120,208)
  z <- Lexislines.episodes (D$Depisode,subjectsID = subjects,title1 = tit5)
  
#  Example 2: Living arrangements 
  data(NLOG98)
  z<- Parameters (NLOG98)
  D <- Biograph.long (NLOG98)
  tit5 <- "Living arrangements for a selection of subjects, NLOH98"
  subjectsID <- c(12,15,19,5442)
  rainbow(length(namstates))
  z <- Lexislines.episodes (D$Depisode,subjectsID = subjectsID,title1 = tit5)

Run the code above in your browser using DataLab