Learn R Programming

mets (version 1.2.3.1)

count.history: Counts the number of previous events of two types for recurrent events processes

Description

Counts the number of previous events of two types for recurrent events processes

Usage

count.history(data, status = "status", id = "id", types = 1:2,
  names.count = "Count")

Arguments

data

data-frame

status

name of status

id

id

types

types of the events (code) related to status

names.count

name of Counts, for example Count1 Count2 when types=c(1,2)

Examples

Run this code
# NOT RUN {
########################################
## getting some rates to mimick 
########################################

data(base1cumhaz)
data(base4cumhaz)
data(drcumhaz)
dr <- drcumhaz
base1 <- base1cumhaz
base4 <- base4cumhaz

######################################################################
### simulating simple model that mimicks data 
### now with two event types and second type has same rate as death rate
######################################################################

rr <- simRecurrentII(1000,base1,dr,death.cumhaz=base4)
rr <-  count.history(rr)
dtable(rr,~"Count*"+status,level=1)

# }

Run the code above in your browser using DataLab