Description Usage Arguments Value Examples
View source: R/calc_multi_dims_stats.R
'multi_dims_stats()' creates a new data frame. It will have one or more rows for each combination of grouping dimensions. If there are no grouping dimensions, the output will have a single row summarising all samples in the input data frame. Despite the dimensions columns, it will contain other 3 or 6 columns depending on whether there is *drug* dimension in the dimension combination.
If *drug* dimension is in the dimension combination, it will report:
* 'sample_size': is the size of the sample set under specified dimensions. * 'detection_rate': is the detection rate of this specified sample set. * 'qualification_rate': is the qualification rate of this specified sample set.
If *drug* dimension is **not** in the dimension combination, it will report:
* 'sample_size': is the size of the sample set under specified dimensions. * 'qualification_rate': is the qualification rate of this specified sample set. * 'multi_detection_rate': is the multi-residue detection rate of this specified sample set. * 'max_defective_num': is the max multi-residue detection number of this specified sample set. * 'multi_defective_rate': is the multi-residue defective rate of this specified sample set. * 'max_defective_num': is the multi-residue defective number of this specified sample set.
1 | multi_dims_stats(data, ..., drug_colname = "drug", st_drug_name, ed_drug_name)
|
data |
a data frame 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(treated_data, year, province)
# multi_dims_stats(treated_data)
## with `drug`
# multi_dims_stats(treated_data, quarter, drug)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.