View source: R/ann_tab_onset.R
ann_tab_onset_qtrly | R Documentation |
Prepare quarterly onset tables. Takes data in long format and reshapes wide for use in annual tables.
ann_tab_onset_qtrly(dat, timeperiod, org_code, total, ho, co, org_type)
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" |
A wide dataframe with total counts, total rates, onset count, onset rate, other onset count by financial year
fy_long
ordered_fin_qtr
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.