(v1.2.0.9003) better terminal colour support
@ -1,6 +1,6 @@
|
||||
Package: AMR
|
||||
Version: 1.2.0.9002
|
||||
Date: 2020-06-03
|
||||
Version: 1.2.0.9003
|
||||
Date: 2020-06-05
|
||||
Title: Antimicrobial Resistance Analysis
|
||||
Authors@R: c(
|
||||
person(role = c("aut", "cre"),
|
||||
|
4
NEWS.md
@ -1,5 +1,5 @@
|
||||
# AMR 1.2.0.9002
|
||||
## <small>Last updated: 03-Jun-2020</small>
|
||||
# AMR 1.2.0.9003
|
||||
## <small>Last updated: 05-Jun-2020</small>
|
||||
|
||||
### Changed
|
||||
* Fixed a bug where `eucast_rules()` would not work on a tibble when the `tibble` or `dplyr` package was loaded
|
||||
|
@ -250,26 +250,63 @@ dataset_UTF8_to_ASCII <- function(df) {
|
||||
df
|
||||
}
|
||||
|
||||
|
||||
# replace crayon::has_color, but now also FALSE on non-interactive mode
|
||||
has_colour <- function () {
|
||||
if (Sys.getenv("TERM") == "dumb" | !interactive()) {
|
||||
# this is a base R version of crayon::has_color
|
||||
enabled <- getOption("crayon.enabled")
|
||||
if (!is.null(enabled)) {
|
||||
return(isTRUE(enabled))
|
||||
}
|
||||
rstudio_with_ansi_support <- function(x) {
|
||||
if (Sys.getenv("RSTUDIO", "") == "") {
|
||||
return(FALSE)
|
||||
}
|
||||
if ((cols <- Sys.getenv("RSTUDIO_CONSOLE_COLOR", "")) != "" && !is.na(as.numeric(cols))) {
|
||||
return(TRUE)
|
||||
}
|
||||
tryCatch(get("isAvailable", envir = asNamespace("rstudioapi"))(), error = function(e) return(FALSE)) &&
|
||||
tryCatch(get("hasFun", envir = asNamespace("rstudioapi"))("getConsoleHasColor"), error = function(e) return(FALSE))
|
||||
}
|
||||
if (rstudio_with_ansi_support() && sink.number() == 0) {
|
||||
return(TRUE)
|
||||
}
|
||||
if (!isatty(stdout())) {
|
||||
return(FALSE)
|
||||
}
|
||||
if (tolower(Sys.info()["sysname"]) == "windows") {
|
||||
if (Sys.getenv("ConEmuANSI") == "ON" | Sys.getenv("CMDER_ROOT") != "") {
|
||||
if (Sys.getenv("ConEmuANSI") == "ON") {
|
||||
return(TRUE)
|
||||
} else {
|
||||
}
|
||||
if (Sys.getenv("CMDER_ROOT") != "") {
|
||||
return(TRUE)
|
||||
}
|
||||
return(FALSE)
|
||||
}
|
||||
emacs_version <- function () {
|
||||
ver <- Sys.getenv("INSIDE_EMACS")
|
||||
if (ver == "") {
|
||||
return(NA_integer_)
|
||||
}
|
||||
"COLORTERM" %in% names(Sys.getenv()) | grepl("^screen|^xterm|^vt100|color|ansi|cygwin|linux",
|
||||
Sys.getenv("TERM"),
|
||||
ver <- gsub("'", "", ver)
|
||||
ver <- strsplit(ver, ",", fixed = TRUE)[[1]]
|
||||
ver <- strsplit(ver, ".", fixed = TRUE)[[1]]
|
||||
as.numeric(ver)
|
||||
}
|
||||
if ((Sys.getenv("EMACS") != "" || Sys.getenv("INSIDE_EMACS") != "") &&
|
||||
!is.na(emacs_version()[1]) && emacs_version()[1] >= 23) {
|
||||
return(TRUE)
|
||||
}
|
||||
if ("COLORTERM" %in% names(Sys.getenv())) {
|
||||
return(TRUE)
|
||||
}
|
||||
if (Sys.getenv("TERM") == "dumb") {
|
||||
return(FALSE)
|
||||
}
|
||||
grepl(pattern = "^screen|^xterm|^vt100|color|ansi|cygwin|linux",
|
||||
x = Sys.getenv("TERM"),
|
||||
ignore.case = TRUE,
|
||||
perl = TRUE)
|
||||
}
|
||||
|
||||
|
||||
# the crayon colours
|
||||
try_colour <- function(..., before, after, collapse = " ") {
|
||||
txt <- paste0(unlist(list(...)), collapse = collapse)
|
||||
|
@ -614,7 +614,7 @@ eucast_rules <- function(x,
|
||||
if (info == TRUE) {
|
||||
cat(font_bold(paste0("\nRules by this AMR package (",
|
||||
font_red(paste0("v", utils::packageVersion("AMR"), ", ",
|
||||
format(utils::packageDate("AMR"), "%Y"))), ")\n")))
|
||||
format(utils::packageDate("AMR"), "%Y"))), "), see ?eucast_rules\n")))
|
||||
}
|
||||
|
||||
ab_enzyme <- subset(antibiotics, name %like% "/")[, c("ab", "name")]
|
||||
|
@ -101,6 +101,7 @@ filter_ab_class <- function(x,
|
||||
return(x.bak)
|
||||
}
|
||||
# get reference data
|
||||
ab_class.bak <- ab_class
|
||||
ab_class <- gsub("[^a-zA-Z0-9]+", ".*", ab_class)
|
||||
ab_class <- gsub("(ph|f)", "(ph|f)", ab_class)
|
||||
ab_class <- gsub("(t|th)", "(t|th)", ab_class)
|
||||
@ -109,6 +110,10 @@ filter_ab_class <- function(x,
|
||||
atc_group1 %like% ab_class |
|
||||
atc_group2 %like% ab_class)
|
||||
ab_group <- find_ab_group(ab_class)
|
||||
if (ab_group == "") {
|
||||
message(font_blue(paste0("NOTE: unknown antimicrobial class '", ab_class.bak, "', data left unchanged.")))
|
||||
return(x.bak)
|
||||
}
|
||||
# get the columns with a group names in the chosen ab class
|
||||
agents <- ab_in_data[names(ab_in_data) %in% ab_reference$ab]
|
||||
if (length(agents) == 0) {
|
||||
|
@ -127,12 +127,12 @@ countries_plot <- ggplot(countries_geometry) +
|
||||
|
||||
countries_plot_mini <- countries_plot
|
||||
countries_plot_mini$data <- countries_plot_mini$data %>% filter(ID != "Antarctica")
|
||||
countries_plot_mini <- countries_plot_mini + scale_colour_gradient(low = "#81899B", high = "#81899B")
|
||||
# countries_plot_mini <- countries_plot_mini + scale_colour_gradient(low = "#81899B", high = "#81899B")
|
||||
countries_plot_big <- countries_plot +
|
||||
labs(title = tools::toTitleCase("Countries where the AMR package for R was downloaded from"),
|
||||
subtitle = paste0("Between March 2018 (first release) and ", format(Sys.Date(), "%B %Y"), "." #,
|
||||
#"The dots denote visitors on our website https://gitlab.io/msberends/AMR."
|
||||
)) +
|
||||
labs(title = tools::toTitleCase("Countries the AMR package for R was downloaded from"),
|
||||
subtitle = paste0("Between March 2018 (first release) and ",
|
||||
format(Sys.Date(), "%B %Y")),
|
||||
caption = "Source: https://cran-logs.rstudio.com") +
|
||||
theme(plot.title = element_text(size = 16, hjust = 0.5),
|
||||
plot.subtitle = element_text(size = 12, hjust = 0.5)) +
|
||||
geom_text(aes(x = -170,
|
||||
@ -142,12 +142,7 @@ countries_plot_big <- countries_plot +
|
||||
paste(sort(countries_name[!is.na(countries_name)]), collapse = ", ")),
|
||||
200)),
|
||||
hjust = 0,
|
||||
size = 4) # +
|
||||
# # points of visitors
|
||||
# geom_point(data = ip_tbl,
|
||||
# aes(x = x, y = y),
|
||||
# size = 1,
|
||||
# colour = "#81899B")
|
||||
size = 4)
|
||||
|
||||
# main website page
|
||||
ggsave("pkgdown/logos/countries.png",
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="https://msberends.gitlab.io/AMR/index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9002</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9003</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9002</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9003</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9002</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9003</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9002</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9003</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
@ -43,7 +43,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9002</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9003</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9002</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9003</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -229,13 +229,13 @@
|
||||
<small>Source: <a href='https://gitlab.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
|
||||
</div>
|
||||
|
||||
<div id="amr-1209002" class="section level1">
|
||||
<h1 class="page-header" data-toc-text="1.2.0.9002">
|
||||
<a href="#amr-1209002" class="anchor"></a>AMR 1.2.0.9002<small> Unreleased </small>
|
||||
<div id="amr-1209003" class="section level1">
|
||||
<h1 class="page-header" data-toc-text="1.2.0.9003">
|
||||
<a href="#amr-1209003" class="anchor"></a>AMR 1.2.0.9003<small> Unreleased </small>
|
||||
</h1>
|
||||
<div id="last-updated-03-jun-2020" class="section level2">
|
||||
<div id="last-updated-05-jun-2020" class="section level2">
|
||||
<h2 class="hasAnchor">
|
||||
<a href="#last-updated-03-jun-2020" class="anchor"></a><small>Last updated: 03-Jun-2020</small>
|
||||
<a href="#last-updated-05-jun-2020" class="anchor"></a><small>Last updated: 05-Jun-2020</small>
|
||||
</h2>
|
||||
<div id="changed" class="section level3">
|
||||
<h3 class="hasAnchor">
|
||||
|
@ -10,7 +10,7 @@ articles:
|
||||
WHONET: WHONET.html
|
||||
benchmarks: benchmarks.html
|
||||
resistance_predict: resistance_predict.html
|
||||
last_built: 2020-06-03T12:33Z
|
||||
last_built: 2020-06-05T11:55Z
|
||||
urls:
|
||||
reference: https://msberends.gitlab.io/AMR/reference
|
||||
article: https://msberends.gitlab.io/AMR/articles
|
||||
|
@ -82,7 +82,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9001</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9003</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9002</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9003</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |