Learn R Programming

epifit (version 0.1.2)

pytable: Make person-year table from individual data

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

pytable(event, time, cov, scale = 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

Run this code
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))

Run the code above in your browser using DataLab