Last data update: 2014.03.03

R: Plots ages and calendar years at transitions in Lexis diagram
Lexis.pointsR Documentation

Plots ages and calendar years at transitions in Lexis diagram

Description

Plots observations in age-time diagram for each category of categorical covariate (using ggplot2)

Usage

Lexis.points(Bdata, transition, title, cov,group,legend.pos,pdf)

Arguments

Bdata

Biograph object

transition

The transition selected, e.g. "NJ" in GLHS data

title

Title of Lexis diagram

cov

Covariate. Observations are plotted for each category of this covariate. If observations should be plotted for the total sample population, cov = NA

group

Covariate. Graphs for groups are in separate panels.

legend.pos

position of legend

pdf

If graph should be stored in pdf file: pdf=TRUE, else pdf=FALSE

Value

graph

Note

requires ggplot2

Author(s)

Frans Willekens.

See Also

Lexispoints (requires Epi)

Examples

#  Example 1: ages at labour market entry, by sex
  data(GLHS)
  #y <- Parameters(GLHS)
  t <- "Date and age at labour market entry by sex and cohort"
  z <- Lexis.points (GLHS,"NJ",title=t,cov="sex",group="cohort",legend.pos="right",pdf=FALSE)

#  Example 2: ages at first birth among married women, by religious denomination
  data(NLOG98)
  y <- Parameters (NLOG98)
  t <- "Date and age at first birth (married women) by religion and cohort"
  z <- Lexis.points (NLOG98,"MK",title=t,cov="kerk",group="cohort",legend.pos="right",pdf=FALSE)
#  Example 3: ages at leaving home, by birth cohort (any destination)
  t <- "Date and age at leaving parental home by religion and education"
  z <- c(0.7,0.2)
  z <- Lexis.points (NLOG98,"H*",title=t,cov="kerk",group="educ",legend.pos=z,pdf=FALSE)  
  

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(Biograph)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Biograph/Lexis.points.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Lexis.points
> ### Title: Plots ages and calendar years at transitions in Lexis diagram
> ### Aliases: Lexis.points
> 
> ### ** Examples
> 
> #  Example 1: ages at labour market entry, by sex
>   data(GLHS)
>   #y <- Parameters(GLHS)
>   t <- "Date and age at labour market entry by sex and cohort"
>   z <- Lexis.points (GLHS,"NJ",title=t,cov="sex",group="cohort",legend.pos="right",pdf=FALSE)
[1] Age profile: Number of individuals with transition NJ is 201
> 
> #  Example 2: ages at first birth among married women, by religious denomination
>   data(NLOG98)
>   y <- Parameters (NLOG98)
[1] ". . . . Running function Parameters . . . . "
[1] "Exploring types of transitions"
>   t <- "Date and age at first birth (married women) by religion and cohort"
>   z <- Lexis.points (NLOG98,"MK",title=t,cov="kerk",group="cohort",legend.pos="right",pdf=FALSE)
[1] Age profile: Number of individuals with transition MK is 291
> #  Example 3: ages at leaving home, by birth cohort (any destination)
>   t <- "Date and age at leaving parental home by religion and education"
>   z <- c(0.7,0.2)
>   z <- Lexis.points (NLOG98,"H*",title=t,cov="kerk",group="educ",legend.pos=z,pdf=FALSE)  
[1] Age profile: Number of individuals with transition H* is 456
>   
> 
> 
> 
> 
> dev.off()
null device 
          1 
>