Learn R Programming

incidence2 (version 0.2.2)

cumulate: Compute cumulative 'incidence'

Description

cumulate is an S3 generic to compute cumulative numbers, with methods for different types of objects:

  • default method is a wrapper for cumsum

  • incidence objects: computes cumulative incidence over time

Usage

cumulate(x)

# S3 method for default cumulate(x)

# S3 method for incidence2 cumulate(x)

Arguments

x

An incidence object.

Examples

Run this code
# NOT RUN {
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)
i

cumulative_i <- cumulate(i)
cumulative_i
# }

Run the code above in your browser using DataLab