1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-25 17:26:12 +01:00
This commit is contained in:
dr. M.S. (Matthijs) Berends 2022-10-22 10:20:09 +02:00
parent d0b54f640c
commit d10651eb26
6 changed files with 17 additions and 24 deletions

View File

@ -1,6 +1,6 @@
Package: AMR Package: AMR
Version: 1.8.2.9031 Version: 1.8.2.9032
Date: 2022-10-21 Date: 2022-10-22
Title: Antimicrobial Resistance Data Analysis Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR) Description: Functions to simplify and standardise antimicrobial resistance (AMR)
data analysis and to work with microbial and antimicrobial properties by data analysis and to work with microbial and antimicrobial properties by

View File

@ -1,4 +1,4 @@
# AMR 1.8.2.9031 # AMR 1.8.2.9032
This version will eventually become v2.0! We're happy to reach a new major milestone soon! This version will eventually become v2.0! We're happy to reach a new major milestone soon!

View File

@ -94,6 +94,8 @@ globalVariables(c(
"atc_group1", "atc_group1",
"atc_group2", "atc_group2",
"base_ab", "base_ab",
"ci_min",
"ci_max",
"code", "code",
"cols", "cols",
"count", "count",

View File

@ -112,9 +112,6 @@ add_custom_antimicrobials <- function(x) {
AMR_env$custom_ab_codes <- c(AMR_env$custom_ab_codes, x$ab) AMR_env$custom_ab_codes <- c(AMR_env$custom_ab_codes, x$ab)
class(AMR_env$AB_lookup$ab) <- "character" class(AMR_env$AB_lookup$ab) <- "character"
bind_rows <- import_fn("bind_rows", "dplyr", error_on_fail = FALSE)
if (is.null(bind_rows)) {
# do the binding in base R
new_df <- AMR_env$AB_lookup[0, , drop = FALSE][seq_len(NROW(x)), , drop = FALSE] new_df <- AMR_env$AB_lookup[0, , drop = FALSE][seq_len(NROW(x)), , drop = FALSE]
rownames(new_df) <- NULL rownames(new_df) <- NULL
list_cols <- vapply(FUN.VALUE = logical(1), new_df, is.list) list_cols <- vapply(FUN.VALUE = logical(1), new_df, is.list)
@ -127,10 +124,6 @@ add_custom_antimicrobials <- function(x) {
new_df[, col] <- x[, col, drop = TRUE] new_df[, col] <- x[, col, drop = TRUE]
} }
AMR_env$AB_lookup <- unique(rbind(AMR_env$AB_lookup, new_df)) AMR_env$AB_lookup <- unique(rbind(AMR_env$AB_lookup, new_df))
} else {
# otherwise use dplyr
AMR_env$AB_lookup <- unique(bind_rows(AMR_env$AB_lookup, x))
}
class(AMR_env$AB_lookup$ab) <- c("ab", "character") class(AMR_env$AB_lookup$ab) <- c("ab", "character")
message_("Added ", nr2char(nrow(x)), " record", ifelse(nrow(x) > 1, "s", ""), " to the internal `antibiotics` data set.") message_("Added ", nr2char(nrow(x)), " record", ifelse(nrow(x) > 1, "s", ""), " to the internal `antibiotics` data set.")
} }

View File

@ -279,7 +279,6 @@ rsi_calc_df <- function(type, # "proportion", "count" or "both"
col_results <- as.data.frame(as.matrix(table(values)), stringsAsFactors = FALSE) col_results <- as.data.frame(as.matrix(table(values)), stringsAsFactors = FALSE)
col_results$interpretation <- rownames(col_results) col_results$interpretation <- rownames(col_results)
col_results$isolates <- col_results[, 1, drop = TRUE] col_results$isolates <- col_results[, 1, drop = TRUE]
ddf <<- col_results
if (NROW(col_results) > 0 && sum(col_results$isolates, na.rm = TRUE) > 0) { if (NROW(col_results) > 0 && sum(col_results$isolates, na.rm = TRUE) > 0) {
if (sum(col_results$isolates, na.rm = TRUE) >= minimum) { if (sum(col_results$isolates, na.rm = TRUE) >= minimum) {
col_results$value <- col_results$isolates / sum(col_results$isolates, na.rm = TRUE) col_results$value <- col_results$isolates / sum(col_results$isolates, na.rm = TRUE)

View File

@ -34,7 +34,6 @@
import_functions <- c( import_functions <- c(
"%chin%" = "data.table", "%chin%" = "data.table",
"anti_join" = "dplyr", "anti_join" = "dplyr",
"bind_rows" = "dplyr",
"chmatch" = "data.table", "chmatch" = "data.table",
"cur_column" = "dplyr", "cur_column" = "dplyr",
"full_join" = "dplyr", "full_join" = "dplyr",