diff --git a/DESCRIPTION b/DESCRIPTION index d46a43f..c169762 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,7 +8,7 @@ Imports: dplyr, httr, magrittr -Suggests: +Suggests: maps, maptools, readr, diff --git a/R/00utils.R b/R/00utils.R index 9c60f28..fb042fb 100644 --- a/R/00utils.R +++ b/R/00utils.R @@ -29,7 +29,7 @@ dplyr_class_wrapper = function(callback) { #' the callstack. See https://stackoverflow.com/a/33108841 #' #' @noRd -isNonInteractive = function () { +is_non_interactive = function () { ff <- sapply(sys.calls(), function(f) as.character(f[1])) any(ff %in% c("knit2html", "render")) || !interactive() } diff --git a/R/api.R b/R/api.R index 89c3bcb..ff7911e 100644 --- a/R/api.R +++ b/R/api.R @@ -60,7 +60,7 @@ get_stats_ = function (endpoint) { } osem_request_ = function (host, path, ..., type = 'parsed', progress) { - progress = if (progress && !isNonInteractive()) httr::progress() else NULL + progress = if (progress && !is_non_interactive()) httr::progress() else NULL res = httr::GET(host, progress, path = path, query = list(...)) if (httr::http_error(res)) { diff --git a/R/measurement.R b/R/measurement.R index 97738bc..53937c9 100644 --- a/R/measurement.R +++ b/R/measurement.R @@ -106,9 +106,10 @@ parse_get_measurements_params = function (params) { if (is.null(params$phenomenon) | is.na(params$phenomenon)) stop('Parameter "phenomenon" is required') - if ((!is.na(params$from) && is.na(params$to)) || - (!is.na(params$to) && is.na(params$from)) - ) stop('specify "from" only together with "to"') + if ( + (!is.na(params$from) && is.na(params$to)) || + (!is.na(params$to) && is.na(params$from)) + ) stop('specify "from" only together with "to"') if ( (!is.null(params$bbox) && !is.null(params$boxes)) || @@ -161,7 +162,7 @@ paged_measurements_req = function (query) { query$`to-date` = date_as_isostring(page$to) res = do.call(get_measurements_, query) - if (query$progress && !isNonInteractive()) + if (query$progress && !is_non_interactive()) cat(paste(query$`from-date`, query$`to-date`, sep = ' - '), '\n') res