ratetable: Create r x 2 count and person-time table for calculating...

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

Description

Create r x 2 count and person-time table for calculating rates

Usage

1
2
ratetable(..., byrow = FALSE,
          rev = c("neither", "rows", "columns", "both"))

Arguments

...

see details

byrow

Default is TRUE and single vector or collection of numbers is read in row-wise. Set to FALSE to read in column-wise.

rev

reverse order of "rows", "colums", "both", or "neither" (default)

Details

Creates r x 2 table with r exposure levels and 2 columns (counts and person-time exposed). Arguments can be one of the following:

(1) r x 2 table of the following form:

1
2
3
4
5
                         Outcome
	     Exposure    cases pyears
	     E = 0 (ref)   a     PT0
	     E = 1         b     PT1
	   

(2) Two numeric vectors: 1st should be vector of counts, and the 2nd vector should be vector of person-times at risk. For example,

1
2
3
    cases  <- c(a, b)
    pyears <- c(PT0, PT1)
  

(3) >= 4 numbers in the following order: a, PT0, b, PT1

(4) One numeric vector of the following form: c(a, PT0, b, PT1)

Value

Returns r x 2 rate table, usually for additional analyses.

Author(s)

Tomas Aragon, aragon@berkeley.edu, http://www.phdata.science

References

none

See Also

epitable

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
##Breast cancer cases from radiation treatment for tuberculosis
##Rothman 1998, p. 238
bc0 <- 15
bc1 <- 41
py0 <- 19017
py1 <- 28010

##4 numbers
ratetable(bc0, py0, bc1, py1)

##1 vector
dat <- c(bc0, py0, bc1, py1)
ratetable(dat)

##2 vectors
cases <- c(bc0, bc1)
pyears <- c(py0, py1)
ratetable(bc.cases = cases, person.years = pyears)

##1 matrix
r238 <- matrix(c(41, 28010, 15, 19017), 2, 2)
dimnames(r238) <- list(c("BC cases", "Person-years"),
                       "Radiation" = c("Yes", "No"))
r238
r238b <- t(r238)
r238b
ratetable(r238b, rev = "r")

epitools documentation built on March 26, 2020, 9:14 p.m.

Related to ratetable in epitools...