mirror of
https://github.com/msberends/AMR.git
synced 2025-07-10 00:23:03 +02:00
(v1.1.0.9006) lose dependencies
This commit is contained in:
@ -59,7 +59,7 @@
|
||||
#' @inheritSection AMR Read more on our website!
|
||||
#' @source <https://www.whocc.no/atc_ddd_alterations__cumulative/ddd_alterations/abbrevations/>
|
||||
#' @examples
|
||||
#' \donttest{
|
||||
#' \dontrun{
|
||||
#' # oral DDD (Defined Daily Dose) of amoxicillin
|
||||
#' atc_online_property("J01CA04", "DDD", "O")
|
||||
#' # parenteral DDD (Defined Daily Dose) of amoxicillin
|
||||
@ -77,6 +77,14 @@ atc_online_property <- function(atc_code,
|
||||
url = "https://www.whocc.no/atc_ddd_index/?code=%s&showdescription=no") {
|
||||
|
||||
stopifnot_installed_package(c("curl", "rvest", "xml2"))
|
||||
has_internet <- get("has_internet", envir = asNamespace("curl"))
|
||||
html_attr <- get("html_attr", envir = asNamespace("rvest"))
|
||||
html_children <- get("html_children", envir = asNamespace("rvest"))
|
||||
html_node <- get("html_node", envir = asNamespace("rvest"))
|
||||
html_nodes <- get("html_nodes", envir = asNamespace("rvest"))
|
||||
html_table <- get("html_table", envir = asNamespace("rvest"))
|
||||
html_text <- get("html_text", envir = asNamespace("rvest"))
|
||||
read_html <- get("read_html", envir = asNamespace("xml2"))
|
||||
|
||||
check_dataset_integrity()
|
||||
|
||||
@ -84,10 +92,6 @@ atc_online_property <- function(atc_code,
|
||||
atc_code <- as.character(ab_atc(atc_code))
|
||||
}
|
||||
|
||||
require("curl")
|
||||
require("xml2")
|
||||
require("rvest")
|
||||
|
||||
if (!has_internet()) {
|
||||
message("There appears to be no internet connection.")
|
||||
return(rep(NA, length(atc_code)))
|
||||
|
Reference in New Issue
Block a user