mirror of
https://github.com/msberends/AMR.git
synced 2025-12-16 06:30:21 +01:00
141 lines
8.3 KiB
Markdown
141 lines
8.3 KiB
Markdown
# Check Availability of Columns
|
|
|
|
Easy check for data availability of all columns in a data set. This
|
|
makes it easy to get an idea of which antimicrobial combinations can be
|
|
used for calculation with e.g.
|
|
[`susceptibility()`](https://amr-for-r.org/reference/proportion.md) and
|
|
[`resistance()`](https://amr-for-r.org/reference/proportion.md).
|
|
|
|
## Usage
|
|
|
|
``` r
|
|
availability(tbl, width = NULL)
|
|
```
|
|
|
|
## Arguments
|
|
|
|
- tbl:
|
|
|
|
A [data.frame](https://rdrr.io/r/base/data.frame.html) or
|
|
[list](https://rdrr.io/r/base/list.html).
|
|
|
|
- width:
|
|
|
|
Number of characters to present the visual availability - the default
|
|
is filling the width of the console.
|
|
|
|
## Value
|
|
|
|
[data.frame](https://rdrr.io/r/base/data.frame.html) with column names
|
|
of `tbl` as row names
|
|
|
|
## Details
|
|
|
|
The function returns a
|
|
[data.frame](https://rdrr.io/r/base/data.frame.html) with columns
|
|
`"resistant"` and `"visual_resistance"`. The values in that columns are
|
|
calculated with
|
|
[`resistance()`](https://amr-for-r.org/reference/proportion.md).
|
|
|
|
## Examples
|
|
|
|
``` r
|
|
availability(example_isolates)
|
|
#> count available visual_availabilty resistant visual_resistance
|
|
#> date 2000 100.0% |####################|
|
|
#> patient 2000 100.0% |####################|
|
|
#> age 2000 100.0% |####################|
|
|
#> gender 2000 100.0% |####################|
|
|
#> ward 2000 100.0% |####################|
|
|
#> mo 2000 100.0% |####################|
|
|
#> PEN 1629 81.5% |################----| 73.7% |##############------|
|
|
#> OXA 365 18.3% |###-----------------| 31.2% |######--------------|
|
|
#> FLC 943 47.2% |#########-----------| 29.5% |#####---------------|
|
|
#> AMX 1350 67.5% |#############-------| 59.6% |###########---------|
|
|
#> AMC 1879 94.0% |##################--| 23.7% |####----------------|
|
|
#> AMP 1350 67.5% |#############-------| 59.6% |###########---------|
|
|
#> TZP 1001 50.0% |##########----------| 12.6% |##------------------|
|
|
#> CZO 446 22.3% |####----------------| 44.6% |########------------|
|
|
#> FEP 724 36.2% |#######-------------| 14.2% |##------------------|
|
|
#> CXM 1789 89.5% |#################---| 26.3% |#####---------------|
|
|
#> FOX 818 40.9% |########------------| 27.4% |#####---------------|
|
|
#> CTX 943 47.2% |#########-----------| 15.5% |###-----------------|
|
|
#> CAZ 1811 90.6% |##################--| 66.5% |#############-------|
|
|
#> CRO 943 47.2% |#########-----------| 15.5% |###-----------------|
|
|
#> GEN 1855 92.8% |##################--| 24.6% |####----------------|
|
|
#> TOB 1351 67.6% |#############-------| 34.4% |######--------------|
|
|
#> AMK 692 34.6% |######--------------| 63.7% |############--------|
|
|
#> KAN 471 23.6% |####----------------| 100.0% |####################|
|
|
#> TMP 1499 75.0% |###############-----| 38.1% |#######-------------|
|
|
#> SXT 1759 88.0% |#################---| 20.5% |####----------------|
|
|
#> NIT 743 37.2% |#######-------------| 17.1% |###-----------------|
|
|
#> FOS 351 17.6% |###-----------------| 42.2% |########------------|
|
|
#> LNZ 1023 51.2% |##########----------| 69.3% |#############-------|
|
|
#> CIP 1409 70.5% |#############-------| 16.2% |###-----------------|
|
|
#> MFX 211 10.6% |##------------------| 33.6% |######--------------|
|
|
#> VAN 1861 93.1% |##################--| 38.3% |#######-------------|
|
|
#> TEC 976 48.8% |#########-----------| 75.7% |###############-----|
|
|
#> TCY 1200 60.0% |###########---------| 29.8% |#####---------------|
|
|
#> TGC 798 39.9% |########------------| 12.7% |##------------------|
|
|
#> DOX 1136 56.8% |###########---------| 27.7% |#####---------------|
|
|
#> ERY 1894 94.7% |##################--| 57.2% |###########---------|
|
|
#> CLI 1520 76.0% |###############-----| 61.2% |############--------|
|
|
#> AZM 1894 94.7% |##################--| 57.2% |###########---------|
|
|
#> IPM 889 44.5% |########------------| 6.2% |#-------------------|
|
|
#> MEM 829 41.5% |########------------| 5.9% |#-------------------|
|
|
#> MTR 34 1.7% |--------------------| 14.7% |##------------------|
|
|
#> CHL 154 7.7% |#-------------------| 21.4% |####----------------|
|
|
#> COL 1640 82.0% |################----| 81.2% |################----|
|
|
#> MUP 270 13.5% |##------------------| 5.9% |#-------------------|
|
|
#> RIF 1003 50.2% |##########----------| 69.6% |#############-------|
|
|
# \donttest{
|
|
if (require("dplyr")) {
|
|
example_isolates %>%
|
|
filter(mo == as.mo("Escherichia coli")) %>%
|
|
select_if(is.sir) %>%
|
|
availability()
|
|
}
|
|
#> count available visual_availabilty resistant visual_resistance
|
|
#> PEN 467 100.0% |######################| 100.0% |######################|
|
|
#> OXA 0 0.0% |----------------------|
|
|
#> FLC 0 0.0% |----------------------|
|
|
#> AMX 392 83.9% |##################----| 50.0% |###########-----------|
|
|
#> AMC 467 100.0% |######################| 13.1% |##--------------------|
|
|
#> AMP 392 83.9% |##################----| 50.0% |###########-----------|
|
|
#> TZP 416 89.1% |###################---| 5.5% |#---------------------|
|
|
#> CZO 82 17.6% |###-------------------| 2.4% |----------------------|
|
|
#> FEP 317 67.9% |##############--------| 2.8% |----------------------|
|
|
#> CXM 465 99.6% |######################| 5.4% |#---------------------|
|
|
#> FOX 377 80.7% |#################-----| 6.9% |#---------------------|
|
|
#> CTX 459 98.3% |#####################-| 2.4% |----------------------|
|
|
#> CAZ 460 98.5% |#####################-| 2.4% |----------------------|
|
|
#> CRO 459 98.3% |#####################-| 2.4% |----------------------|
|
|
#> GEN 460 98.5% |#####################-| 2.0% |----------------------|
|
|
#> TOB 462 98.9% |#####################-| 2.6% |----------------------|
|
|
#> AMK 171 36.6% |########--------------| 0.0% |----------------------|
|
|
#> KAN 0 0.0% |----------------------|
|
|
#> TMP 396 84.8% |##################----| 39.1% |########--------------|
|
|
#> SXT 465 99.6% |######################| 31.6% |######----------------|
|
|
#> NIT 458 98.1% |#####################-| 2.8% |----------------------|
|
|
#> FOS 61 13.1% |##--------------------| 0.0% |----------------------|
|
|
#> LNZ 467 100.0% |######################| 100.0% |######################|
|
|
#> CIP 456 97.6% |#####################-| 12.5% |##--------------------|
|
|
#> MFX 57 12.2% |##--------------------| 100.0% |######################|
|
|
#> VAN 467 100.0% |######################| 100.0% |######################|
|
|
#> TEC 467 100.0% |######################| 100.0% |######################|
|
|
#> TCY 3 0.6% |----------------------| 66.7% |##############--------|
|
|
#> TGC 68 14.6% |###-------------------| 0.0% |----------------------|
|
|
#> DOX 0 0.0% |----------------------|
|
|
#> ERY 467 100.0% |######################| 100.0% |######################|
|
|
#> CLI 467 100.0% |######################| 100.0% |######################|
|
|
#> AZM 467 100.0% |######################| 100.0% |######################|
|
|
#> IPM 422 90.4% |###################---| 0.0% |----------------------|
|
|
#> MEM 418 89.5% |###################---| 0.0% |----------------------|
|
|
#> MTR 2 0.4% |----------------------| 0.0% |----------------------|
|
|
#> CHL 0 0.0% |----------------------|
|
|
#> COL 240 51.4% |###########-----------| 0.0% |----------------------|
|
|
#> MUP 0 0.0% |----------------------|
|
|
#> RIF 467 100.0% |######################| 100.0% |######################|
|
|
# }
|
|
```
|