1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-08 09:51:48 +02:00

(v1.6.0.9017) extra system codes

This commit is contained in:
2021-05-04 12:47:33 +02:00
parent f33e61bac7
commit 5679ccdaf9
32 changed files with 98 additions and 133 deletions

View File

@ -129,11 +129,14 @@ check_dataset_integrity <- function() {
} else {
plural <- c(" is", "s", "")
}
warning_("The following data set", plural[1],
" overwritten by your global environment and prevent", plural[2],
" the AMR package from working correctly: ",
vector_and(overwritten, quotes = "'"),
".\nPlease rename your object", plural[3], ".", call = FALSE)
if (message_not_thrown_before("dataset_overwritten")) {
warning_("The following data set", plural[1],
" overwritten by your global environment and prevent", plural[2],
" the AMR package from working correctly: ",
vector_and(overwritten, quotes = "'"),
".\nPlease rename your object", plural[3], ".", call = FALSE)
remember_thrown_message("dataset_overwritten")
}
}
# check if other packages did not overwrite our data sets
valid_microorganisms <- TRUE
@ -838,13 +841,6 @@ message_not_thrown_before <- function(fn, entire_session = FALSE) {
is.null(pkg_env[[paste0("thrown_msg.", fn)]]) || !identical(pkg_env[[paste0("thrown_msg.", fn)]], unique_call_id(entire_session))
}
reset_all_thrown_messages <- function() {
# for unit tests, where the environment and highest system call do not change
pkg_env_contents <- ls(envir = pkg_env)
rm(list = pkg_env_contents[pkg_env_contents %like% "^thrown_msg."],
envir = pkg_env)
}
has_colour <- function() {
# this is a base R version of crayon::has_color, but disables colours on emacs