Aggregate antibiotic usage data by AWaRe group

awr_aggregate(
  df,
  atc = atc,
  ddd = ddd,
  ...,
  tall = FALSE,
  method = getOption("abxaware.method", "dk"),
  ignore.other = FALSE,
  silent = FALSE
)

Arguments

df

Data frame.

atc

ATC code.

ddd

Amount (usually Defined Daily Doses).

...

Grouping variables.

tall

If TRUE (default) outputs data in tall format.

method

'dk' (default), uk or 'who' indicating the AWaRe classification to be used. The default may be changed within an R session using options(abxaware.method = 'who').

ignore.other

If TRUE, ignores drugs that have no AWaRe class.

silent

If TRUE, prints method.

Value

A data frame.

Examples

awr_aggregate(abx_sales)
#> Aggregating data using the "dk" AWaRe classification
#> # A tibble: 1 × 5 #> total reserve watch access other #> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 25286569. 997134. 10693833. 13592934. 2668.
awr_aggregate(abx_sales, atc, ddd)
#> Aggregating data using the "dk" AWaRe classification
#> # A tibble: 1 × 5 #> total reserve watch access other #> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 25286569. 997134. 10693833. 13592934. 2668.
awr_aggregate(abx_sales, atc, ddd, region)
#> Aggregating data using the "dk" AWaRe classification
#> # A tibble: 5 × 6 #> region total reserve watch access other #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 Hovedstaden 9964511. 572993. 3764616. 5624234. 2668. #> 2 Midtjylland 4692156. 132510. 2405504. 2154141. 0 #> 3 Nordjylland 2278616. 36727. 1030179. 1211710. 0 #> 4 Sjælland 3369530. 71470. 1479130. 1818930. 0 #> 5 Syddanmark 4981757. 183433. 2014403. 2783921. 0
awr_aggregate(abx_sales, atc, ddd, region, tall = TRUE)
#> Aggregating data using the "dk" AWaRe classification
#> # A tibble: 16 × 5 #> aware region ddd total p #> <fct> <chr> <dbl> <dbl> <dbl> #> 1 reserve Hovedstaden 572993. 9964511. 0.0575 #> 2 reserve Midtjylland 132510. 4692156. 0.0282 #> 3 reserve Nordjylland 36727. 2278616. 0.0161 #> 4 reserve Sjælland 71470. 3369530. 0.0212 #> 5 reserve Syddanmark 183433. 4981757. 0.0368 #> 6 watch Hovedstaden 3764616. 9964511. 0.378 #> 7 watch Midtjylland 2405504. 4692156. 0.513 #> 8 watch Nordjylland 1030179. 2278616. 0.452 #> 9 watch Sjælland 1479130. 3369530. 0.439 #> 10 watch Syddanmark 2014403. 4981757. 0.404 #> 11 access Hovedstaden 5624234. 9964511. 0.564 #> 12 access Midtjylland 2154141. 4692156. 0.459 #> 13 access Nordjylland 1211710. 2278616. 0.532 #> 14 access Sjælland 1818930. 3369530. 0.540 #> 15 access Syddanmark 2783921. 4981757. 0.559 #> 16 other Hovedstaden 2668. 9964511. 0.000268
awr_aggregate(abx_sales, atc, ddd, month)
#> Aggregating data using the "dk" AWaRe classification
#> # A tibble: 79 × 6 #> month total reserve watch access other #> <date> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 2015-01-01 276997. 15936. 125162. 135863. 35 #> 2 2015-02-01 288550. 16781. 132353. 139401. 15 #> 3 2015-03-01 396840. 19708. 181769. 195318. 45 #> 4 2015-04-01 260539. 15093. 118676. 126705. 65 #> 5 2015-05-01 275710. 16959. 123166. 135570. 15 #> 6 2015-06-01 312190. 17329. 133961. 160845. 55 #> 7 2015-07-01 293852. 16140. 124887. 152765. 60 #> 8 2015-08-01 281087. 17058. 119319. 144706. 5 #> 9 2015-09-01 304548. 12741. 131995. 159767. 45 #> 10 2015-10-01 307043. 9933. 138503. 158571. 35 #> # … with 69 more rows
awr_aggregate(abx_sales, atc, ddd, month, region)
#> Aggregating data using the "dk" AWaRe classification
#> # A tibble: 395 × 7 #> month region total reserve watch access other #> <date> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 2015-01-01 Hovedstaden 98537. 9311. 39442. 49749 35 #> 2 2015-01-01 Midtjylland 56220. 1874. 29831. 24515 0 #> 3 2015-01-01 Nordjylland 27845. 704. 13895. 13246. 0 #> 4 2015-01-01 Sjælland 37140. 944. 16308. 19887. 0 #> 5 2015-01-01 Syddanmark 57255. 3104. 25686. 28466. 0 #> 6 2015-02-01 Hovedstaden 104359. 9838. 43469. 51037. 15 #> 7 2015-02-01 Midtjylland 57580. 1767. 31091. 24722. 0 #> 8 2015-02-01 Nordjylland 26508. 526. 12927. 13054. 0 #> 9 2015-02-01 Sjælland 37975. 1074. 17294. 19607. 0 #> 10 2015-02-01 Syddanmark 62129. 3576. 27572. 30981. 0 #> # … with 385 more rows
awr_aggregate(abx_sales, atc, ddd, month, region, hospital)
#> Aggregating data using the "dk" AWaRe classification
#> # A tibble: 1,580 × 8 #> month region hospital total reserve watch access other #> <date> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 2015-01-01 Hovedstaden Amager og Hvidovre… 9079. 273. 4241. 4565. 0 #> 2 2015-01-01 Hovedstaden Bispebjerg og Fred… 14395. 858. 6235. 7303. 0 #> 3 2015-01-01 Hovedstaden Bornholms Hospital 2152. 147. 1068. 937. 0 #> 4 2015-01-01 Hovedstaden Herlev og Gentofte… 21331. 855. 6715. 13762. 0 #> 5 2015-01-01 Hovedstaden Hospitalerne i Nor… 15470. 849. 6407. 8214. 0 #> 6 2015-01-01 Hovedstaden Rigshospitalet 36109. 6329. 14777. 14968. 35 #> 7 2015-01-01 Midtjylland Aarhus Universitet… 25140. 1229. 12239. 11672. 0 #> 8 2015-01-01 Midtjylland Hospitalsenhed Midt 8762. 170 4589. 4003. 0 #> 9 2015-01-01 Midtjylland Hospitalsenheden V… 10881. 358. 6026. 4497. 0 #> 10 2015-01-01 Midtjylland Regionshospitalet … 6134. 50 3480. 2603. 0 #> # … with 1,570 more rows