Learn R Programming

rEHR (version 1.0)

prev_totals: Calculates the prevalence totals for the output of a data frame of events/patients etc.

Description

e.g. Run on the output of a call to prev_terms

Usage

prev_totals(dat, included_totals = c("year", .ehr$practice_id), time_var = "year", person_years = 100)

Arguments

dat
a dataframe
included_totals
character vector describing which aggregates should be included e.g. c("year", "practid")
time_var
name of the variable determining timepoints
person_years
numeric multiplier for presentation of prevalence and incidence numbers

Value

list of aggregates and/or the original data

Details

Outputs totals by aggregated by a time variable and other variables Updated to use dplyr to do the aggregation - Now 40x faster!