From 2b4406dd0f63b468b2348dc5a6f2c9521b9e6f78 Mon Sep 17 00:00:00 2001 From: olivroy Date: Mon, 16 Dec 2024 09:26:46 -0500 Subject: [PATCH 1/2] Reduce imports and move vignette only to `Config/Needs/website` --- DESCRIPTION | 11 ++--------- R/misc_from_mapview.R | 2 +- R/process_color.R | 1 + R/tm_legend.R | 1 - R/tmapLeafletRun.R | 2 ++ man/tm_legend.Rd | 2 +- 6 files changed, 7 insertions(+), 12 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 2f366389b..40e88c74f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -41,7 +41,6 @@ Imports: sf (>= 0.9-3), stars (>= 0.4-2), stats, - servr, s2, tmaptools (>= 3.1), units (>= 0.6-1) @@ -49,26 +48,20 @@ Suggests: av, cartogram, colorspace, - dplyr, ggplot2, gifski, knitr, maptiles, - osmdata, png, - rmapshaper, - rmarkdown, - bookdown, + servr, shiny, terra, testthat (>= 3.2.0), - tidyr, widgetframe, - geofacet, - mapview, rstudioapi Config/Needs/check: Nowosad/spDataLarge, lwgeom Config/Needs/coverage: Nowosad/spDataLarge, lwgeom +Config/Needs/website: bookdown, geofacet, rmarkdown, mapview Config/testthat/edition: 3 Encoding: UTF-8 LazyData: true diff --git a/R/misc_from_mapview.R b/R/misc_from_mapview.R index bf75dbd0a..c645fe781 100644 --- a/R/misc_from_mapview.R +++ b/R/misc_from_mapview.R @@ -21,7 +21,7 @@ get_ide = function () { } ## need to assign global variable .vsc -if(getRversion() >= "2.15.1") utils::globalVariables(c(".vsc")) +utils::globalVariables(c(".vsc")) is_vscode = function() { exists(".vsc") && exists("attach", envir = .vsc) diff --git a/R/process_color.R b/R/process_color.R index 9c07a62dd..42721a9b9 100644 --- a/R/process_color.R +++ b/R/process_color.R @@ -33,6 +33,7 @@ process_color <- function(col, alpha=NA, sepia_intensity=0, saturation=1, color_ new_cols <- do.call("rgb", c(unname(as.data.frame(res)), list(maxColorValue=255))) + rlang::check_installed("colorspace") # color blind sim sim_colors = switch(color_vision_deficiency_sim, deutan = colorspace::deutan, diff --git a/R/tm_legend.R b/R/tm_legend.R index d17231555..4e333446a 100644 --- a/R/tm_legend.R +++ b/R/tm_legend.R @@ -8,7 +8,6 @@ #' @param design Legend design `"standard"`. #' @param reverse Should the legend be reversed? #' @param na.show Show `NA` values in legend? -#' @param position PARAM_DESCRIPTION #' @param width Width of the legend #' @param height Height of the legend #' @inheritParams tm_title diff --git a/R/tmapLeafletRun.R b/R/tmapLeafletRun.R index ff9a296ef..a3ba4c1bd 100644 --- a/R/tmapLeafletRun.R +++ b/R/tmapLeafletRun.R @@ -77,6 +77,7 @@ tmapLeafletRun = function(o, q, show, knit, args) { paneHeight = -1 } if (ide == "vscode") { + rlang::check_installed("servr") # VSCode's viewer can't ignore cross-origin requests. Need to serve the # map so assests can be read, e.g. .fgb files. server <- servr::httd( @@ -90,6 +91,7 @@ tmapLeafletRun = function(o, q, show, knit, args) { viewer(url, height = paneHeight) } } else { + rlang::check_installed("servr") viewerFunc = function(url) { dir = get_url_dir(url) switch(ide, diff --git a/man/tm_legend.Rd b/man/tm_legend.Rd index bc00ea16d..1b0d0ba32 100644 --- a/man/tm_legend.Rd +++ b/man/tm_legend.Rd @@ -69,7 +69,7 @@ tm_legend_combine(variable) \item{na.show}{Show \code{NA} values in legend?} -\item{position}{PARAM_DESCRIPTION} +\item{position}{Vector of two values, specifying the x and y coordinates. The first is either \code{"left"} or \code{"right"}, the second either \code{"top"} or \code{"bottom"}.} \item{width}{Width of the legend} From 64da5234e0a56340ad3c8a59c9c343bd9c138c54 Mon Sep 17 00:00:00 2001 From: olivroy Date: Mon, 16 Dec 2024 09:56:44 -0500 Subject: [PATCH 2/2] document tm_legend() --- R/tm_legend.R | 6 +++--- man/tm_legend.Rd | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/R/tm_legend.R b/R/tm_legend.R index 4e333446a..90fdf7ff1 100644 --- a/R/tm_legend.R +++ b/R/tm_legend.R @@ -33,9 +33,9 @@ #' @param item.na.space PARAM_DESCRIPTION #' @param item.shape PARAM_DESCRIPTION #' @param ticks List of vectors of size 2 that determines the horizontal tick mark lines (for portrait legends). The values are the y-values of begin and endpoint of each tick mark. -#' @param ticks.disable.na PARAM_DESCRIPTION -#' @param ticks.col PARAM_DESCRIPTION -#' @param ticks.lwd PARAM_DESCRIPTION +#' @param ticks.disable.na Remove ticks for NA values +#' @param ticks.col Legend ticks color +#' @param ticks.lwd Legend ticks line widths #' @param margins PARAM_DESCRIPTION #' @param margin.item.text PARAM_DESCRIPTION #' @param ... visual values, e.g. `col`, `fill`, `lwd`, can be specified. If so, they overrule the default visual values, which are determined by the drawn map objects (e.g. polygons) diff --git a/man/tm_legend.Rd b/man/tm_legend.Rd index 1b0d0ba32..2a95538f8 100644 --- a/man/tm_legend.Rd +++ b/man/tm_legend.Rd @@ -131,11 +131,11 @@ tm_legend_combine(variable) \item{ticks}{List of vectors of size 2 that determines the horizontal tick mark lines (for portrait legends). The values are the y-values of begin and endpoint of each tick mark.} -\item{ticks.disable.na}{PARAM_DESCRIPTION} +\item{ticks.disable.na}{Remove ticks for NA values} -\item{ticks.col}{PARAM_DESCRIPTION} +\item{ticks.col}{Legend ticks color} -\item{ticks.lwd}{PARAM_DESCRIPTION} +\item{ticks.lwd}{Legend ticks line widths} \item{margins}{PARAM_DESCRIPTION}