Lexis.lines: Draws Lexis diagram with lifelines for selected subjects

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

The function draws a Lexis diagram and draws lifelines for selected subjects (using ggplot2 package)

Usage

1
Lexis.lines(Bdata,Dlong, subjectsID, title)

Arguments

Bdata

Biograph object

Dlong

Input data in long format

subjectsID

Lifelines are drawn for subjects, identified by ID, included in the vector subjectsID.

title

Title of the Lexis diagram.

Details

The function produces a Lexis object and plots the object for selected subjects. Transitions are marked on the lifelines. It requires data in long format. If the long format is not available, the function calls the function Biograph.long to produce the required object.

Value

subjectsID

Subjects selected

p

The plot of the lifelines

Note

requires ggplot2

Author(s)

Frans Willekens

See Also

Lexislines.episodes

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#  Example 1: Employment careers
  data(GLHS) 
  z<- Parameters (GLHS)
  GLHS.yr <- date_b(Bdata=GLHS,selectday=1,format.out="year")
  D <- Biograph.long (GLHS.yr)
  tit5 <- "Employment careers for a selection of subjects. GLHS"
  subjects <- c(1,78,120,208)
  z <- Lexis.lines (Bdata=GLHS.yr,Dlong=D$Depisode,subjectsID = subjects,title = tit5)

#  Example 2: Long data format need to be obtained
  z <- Lexislines.episodes (Bdata=GLHS.yr,subjectsID = subjects,title = tit5)  

#  Example 3: Living arrangements 
  data(NLOG98)
  z<- Parameters (NLOG98)
  NLOG98.yr <- date_b(Bdata=NLOG98,selectday=1,format.out="year")
  D <- Biograph.long (NLOG98.yr)
  tit5 <- "Living arrangements for a selection of subjects, NLOG98"
subjectsID <- c(8,96,980,1056,1496,2883)
  z <- Lexis.lines (NLOG98.yr,D$Depisode,subjectsID = subjectsID,title = tit5)

Example output

[1] ". . . . Running function Parameters . . . . "
[1] "Exploring types of transitions"
[1] . . . . .  Creating long format  . . . . . .
[1] . . . . .  running reshape  . . . . . 
[1]  . . . . Sort data in long format  . . . . 
[1]  . . . . Adjust long format for survival package etc . . .  
[1] "Producing long format for ggplot2. Patience please."
[1] Getting data in long file format. Patience please.
[1] . . . . .  Creating long format  . . . . . .
[1] . . . . .  running reshape  . . . . . 
[1]  . . . . Sort data in long format  . . . . 
[1]  . . . . Adjust long format for survival package etc . . .  
[1] "Data in long format produced. Lexis continues."
NOTE: entry.status has been set to 0 for all.
[1] ". . . . Running function Parameters . . . . "
[1] "Exploring types of transitions"
[1] . . . . .  Creating long format  . . . . . .
[1] . . . . .  running reshape  . . . . . 
[1]  . . . . Sort data in long format  . . . . 
[1]  . . . . Adjust long format for survival package etc . . .  
[1] "Producing long format for ggplot2. Patience please."

Biograph documentation built on May 1, 2019, 8:48 p.m.