pytable: Make person-year table from individual data

Description Usage Arguments Value Examples

View source: R/pytable.R

Description

This function creates the person-years table from event, time and covariate data. The number of event and time of some observations with the same covariate data are summed up, and made into one observation.

Usage

1

Arguments

event

a vector specifying number of event.

time

a vector specifying time variable.

cov

vector or matrix or data.frame of covariates.

scale

a scaling for person-year. The value of 365.25 will make person-year table from time variable recoded as days.

Value

a person-year data.frame

Examples

1
2
3
4
5
event <- c(1,0,2,1,1,0,1,1)
time <- c(3,5,12,4,6,2,5,2)
cov1 <- c(3,2,4,2,3,2,1,1)
cov2 <- c(0,0,0,0,1,1,1,1)
pytable(event, time, cbind(cov1,cov2))

Example output

  event py cov1 cov2
1     2  7    1    1
2     1  9    2    0
3     0  2    2    1
4     1  3    3    0
5     1  6    3    1
6     2 12    4    0

epifit documentation built on May 29, 2017, 3:43 p.m.