1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-26 07:26:13 +01:00

(v0.7.1.9094) get_column_abx() improvement

This commit is contained in:
dr. M.S. (Matthijs) Berends 2019-10-06 21:44:08 +02:00
parent b6653a620a
commit 3d5692219e
11 changed files with 25 additions and 15 deletions

View File

@ -1,5 +1,5 @@
Package: AMR Package: AMR
Version: 0.7.1.9093 Version: 0.7.1.9094
Date: 2019-10-06 Date: 2019-10-06
Title: Antimicrobial Resistance Analysis Title: Antimicrobial Resistance Analysis
Authors@R: c( Authors@R: c(

View File

@ -1,4 +1,4 @@
# AMR 0.7.1.9093 # AMR 0.7.1.9094
<small>Last updated: 06-Oct-2019</small> <small>Last updated: 06-Oct-2019</small>
### Breaking ### Breaking
@ -102,7 +102,7 @@
* Printed info now distinguishes between added and changes values * Printed info now distinguishes between added and changes values
* Using Verbose mode (i.e. `eucast_rules(..., verbose = TRUE)`) returns more informative and readable output * Using Verbose mode (i.e. `eucast_rules(..., verbose = TRUE)`) returns more informative and readable output
* Using factors as input now adds missing factors levels when the function changes antibiotic results * Using factors as input now adds missing factors levels when the function changes antibiotic results
* Improved the internal auto-guessing function for determining antibiotics in your data set (`AMR:::get_column_abx()`) * Improved the internal auto-guessing function for determining antimicrobials in your data set (`AMR:::get_column_abx()`)
* Removed class `atc` - using `as.atc()` is now deprecated in favour of `ab_atc()` and this will return a character, not the `atc` class anymore * Removed class `atc` - using `as.atc()` is now deprecated in favour of `ab_atc()` and this will return a character, not the `atc` class anymore
* Removed deprecated functions `abname()`, `ab_official()`, `atc_name()`, `atc_official()`, `atc_property()`, `atc_tradenames()`, `atc_trivial_nl()` * Removed deprecated functions `abname()`, `ab_official()`, `atc_name()`, `atc_official()`, `atc_property()`, `atc_tradenames()`, `atc_trivial_nl()`
* Fix and speed improvement for `mo_shortname()` * Fix and speed improvement for `mo_shortname()`

View File

@ -191,7 +191,7 @@ eucast_rules <- function(x,
txt <- paste0("WARNING: In Verbose mode, the eucast_rules() function does not apply rules to the data, but instead returns a data set in logbook form with extensive info about which rows and columns would be effected and in which way.", txt <- paste0("WARNING: In Verbose mode, the eucast_rules() function does not apply rules to the data, but instead returns a data set in logbook form with extensive info about which rows and columns would be effected and in which way.",
"\n\nThis may overwrite your existing data if you use e.g.:", "\n\nThis may overwrite your existing data if you use e.g.:",
"\ndata <- eucast_rules(data, verbose = TRUE)\n\nDo you want to continue?") "\ndata <- eucast_rules(data, verbose = TRUE)\n\nDo you want to continue?")
if ("rstudioapi" %in% rownames(installed.packages())) { if ("rstudioapi" %in% rownames(utils::installed.packages())) {
q_continue <- rstudioapi::showQuestion("Using verbose = TRUE with eucast_rules()", txt) q_continue <- rstudioapi::showQuestion("Using verbose = TRUE with eucast_rules()", txt)
} else { } else {
q_continue <- menu(choices = c("OK", "Cancel"), graphics = TRUE, title = txt) q_continue <- menu(choices = c("OK", "Cancel"), graphics = TRUE, title = txt)

View File

@ -122,12 +122,22 @@ get_column_abx <- function(x,
...) { ...) {
# determine from given data set # determine from given data set
x_bak <- x
df_trans <- data.frame(colnames = colnames(x), df_trans <- data.frame(colnames = colnames(x),
abcode = suppressWarnings(as.ab(colnames(x)))) abcode = suppressWarnings(as.ab(colnames(x))))
df_trans <- df_trans[!is.na(df_trans$abcode),] df_trans <- df_trans[!is.na(df_trans$abcode),]
x <- as.character(df_trans$colnames) x <- as.character(df_trans$colnames)
names(x) <- df_trans$abcode names(x) <- df_trans$abcode
# remove the ones that do not already have the rsi class (as.rsi) and that have >50% invalid values
x <- sapply(x, function(col = x, df = x_bak) {
ifelse(is.rsi(as.data.frame(df)[, col]) |
is.rsi.eligible(as.data.frame(df)[, col], threshold = 0.5),
col,
NA)
})
x <- x[!is.na(x)]
# add from self-defined dots (...): # add from self-defined dots (...):
# get_column_abx(example_isolates %>% rename(thisone = AMX), amox = "thisone") # get_column_abx(example_isolates %>% rename(thisone = AMX), amox = "thisone")
dots <- list(...) dots <- list(...)

View File

@ -84,7 +84,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="https://msberends.gitlab.io/AMR/index.html">AMR (for R)</a> <a class="navbar-link" href="https://msberends.gitlab.io/AMR/index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9093</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9094</span>
</span> </span>
</div> </div>

View File

@ -84,7 +84,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9093</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9094</span>
</span> </span>
</div> </div>

View File

@ -84,7 +84,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9093</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9094</span>
</span> </span>
</div> </div>

View File

@ -84,7 +84,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9093</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9094</span>
</span> </span>
</div> </div>

View File

@ -43,7 +43,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9093</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9094</span>
</span> </span>
</div> </div>

View File

@ -84,7 +84,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9093</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9094</span>
</span> </span>
</div> </div>
@ -231,9 +231,9 @@
</div> </div>
<div id="amr-0-7-1-9093" class="section level1"> <div id="amr-0-7-1-9094" class="section level1">
<h1 class="page-header"> <h1 class="page-header">
<a href="#amr-0-7-1-9093" class="anchor"></a>AMR 0.7.1.9093<small> Unreleased </small> <a href="#amr-0-7-1-9094" class="anchor"></a>AMR 0.7.1.9094<small> Unreleased </small>
</h1> </h1>
<p><small>Last updated: 06-Oct-2019</small></p> <p><small>Last updated: 06-Oct-2019</small></p>
<div id="breaking" class="section level3"> <div id="breaking" class="section level3">
@ -349,7 +349,7 @@ Since this is a major change, usage of the old <code>also_single_tested</code> w
<li>Using factors as input now adds missing factors levels when the function changes antibiotic results</li> <li>Using factors as input now adds missing factors levels when the function changes antibiotic results</li>
</ul> </ul>
</li> </li>
<li>Improved the internal auto-guessing function for determining antibiotics in your data set (<code>AMR:::get_column_abx()</code>)</li> <li>Improved the internal auto-guessing function for determining antimicrobials in your data set (<code>AMR:::get_column_abx()</code>)</li>
<li>Removed class <code>atc</code> - using <code><a href="../reference/AMR-deprecated.html">as.atc()</a></code> is now deprecated in favour of <code><a href="../reference/ab_property.html">ab_atc()</a></code> and this will return a character, not the <code>atc</code> class anymore</li> <li>Removed class <code>atc</code> - using <code><a href="../reference/AMR-deprecated.html">as.atc()</a></code> is now deprecated in favour of <code><a href="../reference/ab_property.html">ab_atc()</a></code> and this will return a character, not the <code>atc</code> class anymore</li>
<li>Removed deprecated functions <code>abname()</code>, <code>ab_official()</code>, <code>atc_name()</code>, <code>atc_official()</code>, <code>atc_property()</code>, <code>atc_tradenames()</code>, <code>atc_trivial_nl()</code> <li>Removed deprecated functions <code>abname()</code>, <code>ab_official()</code>, <code>atc_name()</code>, <code>atc_official()</code>, <code>atc_property()</code>, <code>atc_tradenames()</code>, <code>atc_trivial_nl()</code>
</li> </li>
@ -1289,7 +1289,7 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<div id="tocnav"> <div id="tocnav">
<h2>Contents</h2> <h2>Contents</h2>
<ul class="nav nav-pills nav-stacked"> <ul class="nav nav-pills nav-stacked">
<li><a href="#amr-0-7-1-9093">0.7.1.9093</a></li> <li><a href="#amr-0-7-1-9094">0.7.1.9094</a></li>
<li><a href="#amr-0-7-1">0.7.1</a></li> <li><a href="#amr-0-7-1">0.7.1</a></li>
<li><a href="#amr-0-7-0">0.7.0</a></li> <li><a href="#amr-0-7-0">0.7.0</a></li>
<li><a href="#amr-0-6-1">0.6.1</a></li> <li><a href="#amr-0-6-1">0.6.1</a></li>

View File

@ -84,7 +84,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9093</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9094</span>
</span> </span>
</div> </div>