mo_tab_long | R Documentation |
Takes line list data and aggregates to long data for saving as long-format monthly tables. Outputs are also sorted by organisation, time and metric.
mo_tab_long(dat, collection_var, metric_var, org_var, year_var, month_var)
dat |
A dataframe containing line-listing data |
collection_var |
A string giving the data collection |
metric_var |
Column in dat giving column for the metric |
org_var |
The variable giving the organisation code |
year_var |
The variable giving the calendar year |
month_var |
The variable giving the calendar month |
It is expected that the metric variable is an ordered factor prior to the creation of the long tables.
ann_tab_long
, factor_apportioned
, factor_prior_hc
library(dplyr)
data(line_listing)
line_listing <- line_listing %>%
mutate(cyear = format(specimen_date, "%Y"),
cmonth = date_to_cmonth(specimen_date),
prior_hc = factor(prior_hc))
mo_tab_long(dat = line_listing, collection_var = collection,
org_var = reporting_organisation_code,
metric_var = prior_hc,
year_var = cyear, month_var = cmonth
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.