cohorts: Transform Table to Cohort Format

View source: R/cohorts.R

cohortsR Documentation

Transform Table to Cohort Format

Description

Transform Year | Age | Value table into cohort format, and possibly create a plot.

Usage

cohorts(x, xtab = TRUE, plot = TRUE, log = "", base = exp(1),
  type = "l", lty = 1, xlab = "Age", ylab = "Value", ...)

Arguments

x

a Year | Age | Value table (three column data frame or crosstabbed data frame, matrix, or table).

xtab

whether the output should be returned as a wide crosstab table (otherwise long data frame).

plot

whether a cohort plot should be created.

log

a string specifying which axes should be log-transformed: "", "x", "y", "xy", or TRUE -> "y".

base

the log base used if log is TRUE.

type

passed to matplot.

lty

passed to matplot.

xlab

passed to matplot.

ylab

passed to matplot.

...

passed to matplot.

Value

Crosstab table in cohort format, of class c("xtabs","table").

Warning

Zero values are treated as NA.

Note

If x is a three column data frame, column 1 must contain the year, column 2 the age, and column 3 the value. If x is crosstabbed, rows must be years and columns must be age.


arnima-github/arni documentation built on Oct. 28, 2023, 6:18 p.m.