Description Usage Arguments Value Examples
View source: R/calc_multi_dims_stats.R
rewrite 'multi_dims_stats()' using data.table to speed up the calculation. The usage of this function is the same as 'multi_dims_stats()' but the efficiency is at least 6 times higher.
1 2 3 4 5 6 7  | multi_dims_stats_dt(
  data,
  ...,
  drug_colname = "drug",
  st_drug_name,
  ed_drug_name
)
 | 
data | 
 a **data table** with dimensions labels and drug monitoring data divided by MRL.  | 
... | 
 dimension names parameters. **NOT Character**. The supported dimensions are depending on 'data'. As for now, only 6 dimensions are supported: * year * quarter * province * category * product * drug (depending on param 'drug_colname') If you want to use (and you must use) this param, you should replace '...' with e.g. 'quarter, province, drug'.  | 
drug_colname | 
 the name of column containing drug names, and is the dimension name.  | 
st_drug_name | 
 the name of the first drug residual column.  | 
ed_drug_name | 
 the name of the last drug residual column. *Notice*: the column between 'st_drug_name' and 'ed_drug_name' should all be drug residual column.  | 
a data frame containing essential stats.
1 2 3 4 5  | ## without `drug`
# multi_dims_stats_dt(treated_data, year, province)
# multi_dims_stats_dt(treated_data)
## with `drug`
# multi_dims_stats_dt(treated_data, quarter, drug)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.