1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-25 17:26: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: '**'
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

View File

@ -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

View File

@ -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

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!

View File

@ -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 {

View File

@ -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"
)