Learn R Programming

Epi (version 0.1)

stattable.funs: Special functions for use in stat.table

Description

These functions may be used as contents arguments to the function stat.table. They are defined internally in stat.table and have no independent existence.

Usage

count()
ratio(d,y,scale=1, na.rm=TRUE)
percent(...)

Arguments

d, y
numeric vectors of equal length (d for Deaths, y for person-Years)
scale
a scalar giving a value by which the ratio should be multiplied
na.rm
a logical value indicating whether NA values should be stripped before computation proceeds.
...
a list of variables taken from the index argument to stat.table

Value

  • When used as a contents argument to stat.table, these functions create the following tables:
    • count
    {returns a contingency table of counts.}
  • ratioreturns a table of values scale * sum(d)/sum(y)
  • percentreturns a table of percentages ratio(d,y,scale=1, na.rm=TRUE) of the classifying variables. Variables that are in the index argument to stat.table but not in the call to percent are used to define strata, within which the percentages add up to 100.

See Also

stat.table