ann_tab_onset_qtrly: ann_tab_onset_qtrly

View source: R/ann_tab_onset.R

ann_tab_onset_qtrlyR Documentation

ann_tab_onset_qtrly

Description

Prepare quarterly onset tables. Takes data in long format and reshapes wide for use in annual tables.

Usage

ann_tab_onset_qtrly(dat, timeperiod, org_code, total, ho, co, org_type)

Arguments

dat

A data frame with the necessary columns

timeperiod

A financial year quarter

org_code

Character vector giving organisation code

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

See Also

fy_long

ordered_fin_qtr

Examples


ann_onset_testdat <- data.frame(stringsAsFactors=FALSE,
              time_period = c(20141L, 20142L, 20153L, 20164L, 20141L, 20152L,
                              20163L, 20174L),
                 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_qtrly(ann_onset_testdat, timeperiod = time_period,
    org_code = org_code, total= this_is_the_total, ho = ho,
    co = co, org_type = "trust")

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