From e5e6d2200d475a3202d18c9d10bfb329a75b0126 Mon Sep 17 00:00:00 2001 From: Matthijs Berends Date: Tue, 18 Oct 2022 22:53:38 +0200 Subject: [PATCH] fix add manual ab --- .github/workflows/check-devel.yaml | 4 ++++ .github/workflows/check-release.yaml | 2 +- DESCRIPTION | 4 ++-- NEWS.md | 2 +- R/add_custom_antimicrobials.R | 10 ++++++++-- inst/tinytest/test-zzz.R | 4 +++- 6 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/check-devel.yaml b/.github/workflows/check-devel.yaml index d878223c..994c511b 100644 --- a/.github/workflows/check-devel.yaml +++ b/.github/workflows/check-devel.yaml @@ -33,6 +33,10 @@ on: branches: '**' push: branches: '**' + schedule: + # run a schedule everyday at 1 AM. + # this is to check that all dependencies are still available (see R/zzz.R) + cron: '0 1 * * *' name: check-devel diff --git a/.github/workflows/check-release.yaml b/.github/workflows/check-release.yaml index e004ffb3..43a68f7a 100644 --- a/.github/workflows/check-release.yaml +++ b/.github/workflows/check-release.yaml @@ -34,7 +34,7 @@ on: schedule: # run a schedule everyday at 1 AM. # this is to check that all dependencies are still available (see R/zzz.R) - - cron: '0 1 * * *' + cron: '0 1 * * *' name: check-release diff --git a/DESCRIPTION b/DESCRIPTION index 825704e8..22908e7f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 1.8.2.9018 -Date: 2022-10-15 +Version: 1.8.2.9019 +Date: 2022-10-18 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) data analysis and to work with microbial and antimicrobial properties by diff --git a/NEWS.md b/NEWS.md index b09db9ba..33bebca7 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 1.8.2.9018 +# AMR 1.8.2.9019 This version will eventually become v2.0! We're happy to reach a new major milestone soon! diff --git a/R/add_custom_antimicrobials.R b/R/add_custom_antimicrobials.R index db9f2145..2a915d11 100644 --- a/R/add_custom_antimicrobials.R +++ b/R/add_custom_antimicrobials.R @@ -112,13 +112,19 @@ add_custom_antimicrobials <- function(x) { AMR_env$custom_ab_codes <- c(AMR_env$custom_ab_codes, x$ab) class(AMR_env$AB_lookup$ab) <- "character" - bind_rows <- import_fn("bind_rowtts", "dplyr", error_on_fail = FALSE) + 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] rownames(new_df) <- NULL + list_cols <- vapply(FUN.VALUE = logical(1), new_df, is.list) + for (l in which(list_cols)) { + # prevent binding NULLs in lists, replace with NA + new_df[, l] <- as.list(NA_character_) + } for (col in colnames(x)) { - new_df[, col] <- x[, col, drop = TRUE] + # assign new values + new_df[, col] <- x[, col, drop = TRUE] } AMR_env$AB_lookup <- unique(rbind(AMR_env$AB_lookup, new_df)) } else { diff --git a/inst/tinytest/test-zzz.R b/inst/tinytest/test-zzz.R index 47d5490c..6d98315e 100644 --- a/inst/tinytest/test-zzz.R +++ b/inst/tinytest/test-zzz.R @@ -34,6 +34,7 @@ import_functions <- c( "%chin%" = "data.table", "anti_join" = "dplyr", + "bind_rows" = "dplyr", "chmatch" = "data.table", "cur_column" = "dplyr", "full_join" = "dplyr", @@ -54,8 +55,8 @@ import_functions <- c( "semi_join" = "dplyr", "showQuestion" = "rstudioapi" ) -# functions that are called directly +# functions that are called directly with :: call_functions <- c( # cleaner "freq.default" = "cleaner", @@ -104,6 +105,7 @@ extended_functions <- c( "get_skimmers" = "skimr", "type_sum" = "tibble", "vec_cast" = "vctrs", + "vec_math" = "vctrs", "vec_ptype2" = "vctrs" )