mirror of
https://github.com/msberends/AMR.git
synced 2025-07-09 03:22:00 +02:00
(v1.4.0.9044) mo tibble printing, mo_shortname() fix
This commit is contained in:
@ -187,13 +187,16 @@ search_type_in_df <- function(x, type, info = TRUE) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!is.null(found) & info == TRUE) {
|
||||
msg <- paste0("Using column '", font_bold(found), "' as input for `col_", type, "`.")
|
||||
if (type %in% c("keyantibiotics", "specimen")) {
|
||||
msg <- paste(msg, "Use", font_bold(paste0("col_", type), "= FALSE"), "to prevent this.")
|
||||
if (message_not_thrown_before(fn = paste0("search_", type))) {
|
||||
msg <- paste0("Using column '", font_bold(found), "' as input for `col_", type, "`.")
|
||||
if (type %in% c("keyantibiotics", "specimen")) {
|
||||
msg <- paste(msg, "Use", font_bold(paste0("col_", type), "= FALSE"), "to prevent this.")
|
||||
}
|
||||
message_(msg)
|
||||
remember_thrown_message(fn = paste0("search_", type))
|
||||
}
|
||||
message_(msg)
|
||||
}
|
||||
found
|
||||
}
|
||||
@ -534,6 +537,20 @@ get_current_data <- function(arg_name, call) {
|
||||
call = call - 4))
|
||||
}
|
||||
|
||||
get_root_env_address <- function() {
|
||||
sub('<environment: (.*)>', '\\1', utils::capture.output(sys.frames()[[1]]))
|
||||
}
|
||||
|
||||
remember_thrown_message <- function(fn) {
|
||||
assign(x = paste0("address_", fn),
|
||||
value = get_root_env_address(),
|
||||
envir = mo_env)
|
||||
}
|
||||
|
||||
message_not_thrown_before <- function(fn) {
|
||||
is.null(mo_env[[paste0("address_", fn)]]) || !identical(mo_env[[paste0("address_", fn)]], get_root_env_address())
|
||||
}
|
||||
|
||||
has_colour <- function() {
|
||||
# this is a base R version of crayon::has_color
|
||||
enabled <- getOption("crayon.enabled")
|
||||
|
Reference in New Issue
Block a user