Learn R Programming

incidence2 (version 2.6.1)

cumulate: Compute cumulative 'incidence'

Description

cumulate() computes the cumulative incidence over time for an incidence2 object.

Usage

cumulate(x)

Arguments

x

incidence2 object.

Examples

Run this code
.old <- data.table::setDTthreads(2)
dat <- data.frame(
  dates = as.integer(c(0,1,2,2,3,5,7)),
  groups = factor(c(1, 2, 3, 3, 3, 3, 1))
)

i <- incidence(dat, date_index = "dates", groups = "groups")
cumulate(i)
data.table::setDTthreads(.old)

Run the code above in your browser using DataLab