From 19351bd487829c23942738d5b2e937a261442063 Mon Sep 17 00:00:00 2001 From: jan Date: Mon, 6 Mar 2023 16:44:19 +0100 Subject: [PATCH] dont install packages within functions or vignette --- R/box_utils.R | 9 --------- vignettes/osem-history_revised.Rmd | 4 ---- vignettes/osem-intro.Rmd | 4 ---- 3 files changed, 17 deletions(-) diff --git a/R/box_utils.R b/R/box_utils.R index 733f8bd..b5dbefe 100644 --- a/R/box_utils.R +++ b/R/box_utils.R @@ -1,14 +1,5 @@ #' @export plot.sensebox = function (x, ..., mar = c(2, 2, 1, 1)) { - if ( - !requireNamespace('sf', quietly = TRUE) || - !requireNamespace('maps', quietly = TRUE) || - !requireNamespace('maptools', quietly = TRUE) || - !requireNamespace('rgeos', quietly = TRUE) - ) { - stop('this functions requires additional packages. install them with - install.packages(c("sf", "maps", "maptools", "rgeos"))') - } geom = x %>% sf::st_as_sf() %>% diff --git a/vignettes/osem-history_revised.Rmd b/vignettes/osem-history_revised.Rmd index e612a60..91cf446 100644 --- a/vignettes/osem-history_revised.Rmd +++ b/vignettes/osem-history_revised.Rmd @@ -67,10 +67,6 @@ Another feature of interest is the spatial distribution of the boxes: `plot()` can help us out here. This function requires a bunch of optional dependencies though. ```{r, message=FALSE, warning=FALSE} -if (!require('maps')) install.packages('maps') -if (!require('maptools')) install.packages('maptools') -if (!require('rgeos')) install.packages('rgeos') - plot(boxes) ``` diff --git a/vignettes/osem-intro.Rmd b/vignettes/osem-intro.Rmd index 615d0ac..20509da 100644 --- a/vignettes/osem-intro.Rmd +++ b/vignettes/osem-intro.Rmd @@ -49,10 +49,6 @@ Another feature of interest is the spatial distribution of the boxes: `plot()` can help us out here. This function requires a bunch of optional dependencies though. ```{r, message=FALSE, warning=FALSE} -if (!require('maps')) install.packages('maps') -if (!require('maptools')) install.packages('maptools') -if (!require('rgeos')) install.packages('rgeos') - plot(all_sensors) ```