ann_tab_onset_annual: ann_tab_onset_annual

View source: R/ann_tab_onset.R

ann_tab_onset_annualR Documentation

ann_tab_onset_annual

Description

Produce annual tables by onset status

Usage

ann_tab_onset_annual(
  dat,
  timeperiod,
  org_code,
  denominator,
  total,
  ho,
  co,
  org_type
)

Arguments

dat

A dataframe in long format

timeperiod

A financial year as YYYYYY or YYYY/YY. Can be either numeric or character

org_code

Character vector giving organisation code

denominator

The denominator value

total

Total count of cases

ho

Count of hospital-onset cases

co

Count of community-onset cases

org_type

The only parameter which should not be a column in the data frame a character giving either "Trust" or "CCG"

Value

A wide dataframe with total counts, total rates, onset count, onset rate, other onset count by financial year

Examples

ann_onset_testdat <- data.frame(stringsAsFactors=FALSE,
              time_period = c(201415L, 201516L, 201617L, 201718L, 201415L, 201516L,
                              201617L, 201718L),
                 org_code = c("W1A", "W1A", "W1A", "W1A", "E17", "E17", "E17",
                              "E17"),
              denominator = c(100L, 100L, 100L, 100L, 100L, 100L, 100L, 100L),
                    this_is_the_total = c(10L, 20L, 30L, 40L, 50L, 0L, 40L, 30L),
                       ho = c(8L, 16L, 22L, 31L, 40L, 0L, 35L, 15L),
                       co = c(2L, 4L, 8L, 9L, 10L, 0L, 5L, 15L),
       pir_trust_assigned = c(4L, 10L, 5L, 30L, 10L, 0L, 5L, 5L),
         pir_ccg_assigned = c(3L, 5L, 20L, 5L, 40L, 0L, 30L, 20L),
              third_party = c(3L, 5L, 5L, 5L, 0L, 0L, 5L, 5L)
    )
 ann_tab_onset_annual(ann_onset_testdat, timeperiod = time_period,
    org_code = org_code, denominator = denominator, total= this_is_the_total, ho = ho,
    co = co, org_type = "trust")

PublicHealthEngland/hcaidcs documentation built on Jan. 19, 2024, 8:38 a.m.