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