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

fix add manual ab

This commit is contained in:
dr. M.S. (Matthijs) Berends 2022-10-18 22:53:38 +02:00
parent ad68b50ecd
commit e5e6d2200d
6 changed files with 19 additions and 7 deletions

View File

@ -33,6 +33,10 @@ on:
branches: '**' branches: '**'
push: push:
branches: '**' 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 name: check-devel

View File

@ -34,7 +34,7 @@ on:
schedule: schedule:
# run a schedule everyday at 1 AM. # run a schedule everyday at 1 AM.
# this is to check that all dependencies are still available (see R/zzz.R) # this is to check that all dependencies are still available (see R/zzz.R)
- cron: '0 1 * * *' cron: '0 1 * * *'
name: check-release name: check-release

View File

@ -1,6 +1,6 @@
Package: AMR Package: AMR
Version: 1.8.2.9018 Version: 1.8.2.9019
Date: 2022-10-15 Date: 2022-10-18
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.9018 # AMR 1.8.2.9019
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

@ -112,12 +112,18 @@ 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_rowtts", "dplyr", error_on_fail = FALSE) bind_rows <- import_fn("bind_rows", "dplyr", error_on_fail = FALSE)
if (is.null(bind_rows)) { if (is.null(bind_rows)) {
# do the binding in base R # 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)
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)) { for (col in colnames(x)) {
# assign new values
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))

View File

@ -34,6 +34,7 @@
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",
@ -54,8 +55,8 @@ import_functions <- c(
"semi_join" = "dplyr", "semi_join" = "dplyr",
"showQuestion" = "rstudioapi" "showQuestion" = "rstudioapi"
) )
# functions that are called directly
# functions that are called directly with ::
call_functions <- c( call_functions <- c(
# cleaner # cleaner
"freq.default" = "cleaner", "freq.default" = "cleaner",
@ -104,6 +105,7 @@ extended_functions <- c(
"get_skimmers" = "skimr", "get_skimmers" = "skimr",
"type_sum" = "tibble", "type_sum" = "tibble",
"vec_cast" = "vctrs", "vec_cast" = "vctrs",
"vec_math" = "vctrs",
"vec_ptype2" = "vctrs" "vec_ptype2" = "vctrs"
) )