From b46f314c4348428218fab8ba7f25f5c0d7f2fad8 Mon Sep 17 00:00:00 2001 From: Andrea Gilardi Date: Thu, 28 Mar 2024 20:17:05 +0100 Subject: [PATCH 01/16] trigger checks From 8bc7c487a75e070044970c5d1876637f01025648 Mon Sep 17 00:00:00 2001 From: Andrea Gilardi Date: Thu, 28 Mar 2024 20:23:42 +0100 Subject: [PATCH 02/16] update roxygen note --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 1b561ce2..c2af9043 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -63,4 +63,4 @@ VignetteBuilder: ByteCompile: true Encoding: UTF-8 LazyData: true -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 From 6cf874fad4a41958af9a9054725b136753dfcc86 Mon Sep 17 00:00:00 2001 From: Andrea Gilardi Date: Thu, 28 Mar 2024 20:23:56 +0100 Subject: [PATCH 03/16] update actions/checkout version --- .github/workflows/R-CMD-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index c6e34f04..9745b76a 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -15,7 +15,7 @@ jobs: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: r-lib/actions/setup-r@v2 with: From 56f3e66aa711915aa3a0c12d32e32917a33b680a Mon Sep 17 00:00:00 2001 From: Andrea Gilardi Date: Thu, 28 Mar 2024 20:30:05 +0100 Subject: [PATCH 04/16] GHA: test also on R devel According to the docs, the default value is just 'release' --- .github/workflows/R-CMD-check.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 9745b76a..c1671068 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -11,6 +11,9 @@ name: R-CMD-check jobs: R-CMD-check: runs-on: ubuntu-latest + strategy: + matrix: + R: [ 'release', 'devel' ] env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} R_KEEP_PKG_SOURCE: yes From 0d26928e86b59291fbee766161694a35ec381fa6 Mon Sep 17 00:00:00 2001 From: Andrea Gilardi Date: Thu, 28 Mar 2024 20:33:00 +0100 Subject: [PATCH 05/16] GHA: proper handling of r-version --- .github/workflows/R-CMD-check.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index c1671068..44458b8a 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -22,6 +22,7 @@ jobs: - uses: r-lib/actions/setup-r@v2 with: + r-version: ${{ matrix.R }} use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 From 2a246c5041d1c15a9e4034239ed01276f7170c46 Mon Sep 17 00:00:00 2001 From: Andrea Gilardi Date: Thu, 28 Mar 2024 21:00:50 +0100 Subject: [PATCH 06/16] GHA: disable RSPM --- .github/workflows/R-CMD-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 44458b8a..dc78532a 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -23,7 +23,7 @@ jobs: - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.R }} - use-public-rspm: true + use-public-rspm: false - uses: r-lib/actions/setup-r-dependencies@v2 with: From fe5177fe75258a2b2ca444d3218cbd764b6bcc3e Mon Sep 17 00:00:00 2001 From: Andrea Gilardi Date: Thu, 28 Mar 2024 21:31:27 +0100 Subject: [PATCH 07/16] GHA: made old cache invalid --- .github/workflows/R-CMD-check.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index dc78532a..a1161d30 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -27,6 +27,7 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: + cache-version: 2 extra-packages: rcmdcheck - uses: r-lib/actions/check-r-package@v2 From 5564cefcdbd09fd51f450121ec2b7e13a7ac7dc0 Mon Sep 17 00:00:00 2001 From: Andrea Gilardi Date: Fri, 29 Mar 2024 21:52:21 +0100 Subject: [PATCH 08/16] the package version must be specified as a character instead of numeric see #265 --- R/spatstat.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/spatstat.R b/R/spatstat.R index 306e57fb..bee92db2 100644 --- a/R/spatstat.R +++ b/R/spatstat.R @@ -15,7 +15,7 @@ check_spatstat = function(pkg) { ) } else { spst_ver = try(packageVersion("spatstat"), silent = TRUE) - if (!inherits(spst_ver, "try-error") && spst_ver < 2.0-0) { + if (!inherits(spst_ver, "try-error") && spst_ver < "2.0-0") { stop( "You have an old version of spatstat which is incompatible with ", pkg, From 329f6ba6967f192c9fcb0fc8c2d199a3d546e4fe Mon Sep 17 00:00:00 2001 From: Andrea Gilardi Date: Fri, 29 Mar 2024 21:52:45 +0100 Subject: [PATCH 09/16] update docs --- man/as.linnet.Rd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/as.linnet.Rd b/man/as.linnet.Rd index ac814f8b..a4c61239 100644 --- a/man/as.linnet.Rd +++ b/man/as.linnet.Rd @@ -5,7 +5,7 @@ \alias{as.linnet.sfnetwork} \title{Convert a sfnetwork into a linnet} \usage{ -\method{as.linnet}{sfnetwork}(X, ...) +as.linnet.sfnetwork(X, ...) } \arguments{ \item{X}{An object of class \code{\link{sfnetwork}} with a projected CRS.} From a8d86cb513a677a4e34bc89af2de7be4c91ab72c Mon Sep 17 00:00:00 2001 From: Andrea Gilardi Date: Fri, 29 Mar 2024 21:55:58 +0100 Subject: [PATCH 10/16] simplify GHA --- .github/workflows/R-CMD-check.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index a1161d30..99989ebc 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - R: [ 'release', 'devel' ] + R: [ 'release' ] env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} R_KEEP_PKG_SOURCE: yes @@ -23,11 +23,10 @@ jobs: - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.R }} - use-public-rspm: false + use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 with: - cache-version: 2 extra-packages: rcmdcheck - uses: r-lib/actions/check-r-package@v2 From 214458ecabb689d0edc5efcd91406d519fd3774a Mon Sep 17 00:00:00 2001 From: Andrea Gilardi Date: Fri, 29 Mar 2024 22:07:58 +0100 Subject: [PATCH 11/16] is.directed -> is_directed is.directed is soft deprecated since igrpah v2.0.0 --- tests/testthat/test_morphers.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testthat/test_morphers.R b/tests/testthat/test_morphers.R index e8654677..ab583308 100644 --- a/tests/testthat/test_morphers.R +++ b/tests/testthat/test_morphers.R @@ -252,8 +252,8 @@ test_that("morphers return same network when there is no morphing suppressWarnings(ecount(convert(subd_u, to_spatial_subdivision))) ) expect_equal( - is.directed(net_d), - is.directed(convert(net_d, to_spatial_directed)) + is_directed(net_d), + is_directed(convert(net_d, to_spatial_directed)) ) expect_setequal( st_geometry(activate(net_l, "edges")), From 02f8d23635265d73ad95960a7443291c7a49e9af Mon Sep 17 00:00:00 2001 From: Luuk van der Meer Date: Tue, 9 Apr 2024 13:23:40 +0200 Subject: [PATCH 12/16] fix: Update URL of dodgr github page :wrench: --- vignettes/sfn04_routing.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vignettes/sfn04_routing.Rmd b/vignettes/sfn04_routing.Rmd index 18e46700..11aba01f 100644 --- a/vignettes/sfn04_routing.Rmd +++ b/vignettes/sfn04_routing.Rmd @@ -35,7 +35,7 @@ old_hooks = fansi::set_knit_hooks( Calculating shortest paths between pairs of nodes is a core task in network analysis. The `sfnetworks` package offers wrappers around the path calculation functions of `igraph`, making it easier to use them when working with spatial data and tidyverse packages. This vignette demonstrates their functionality. -In this regard it is important to remember that `sfnetworks` is a general-purpose package for spatial network analysis, not specifically optimized for a single task. If your *only* purpose is many-to-many routing in large networks, there might be other approaches that are faster and fit better to your needs. For example, the [dodgr](https://github.com/ATFutures/dodgr) package was designed for many-to-many routing on large dual-weighted graphs, with its main focus on OpenStreetMap road network data. The [cppRouting](https://github.com/vlarmet/cppRouting) package contains functions to calculate shortest paths and isochrones/isodistances on weighted graphs. When working with OpenStreetMap data, it is also possible to use the interfaces to external routing engines such as [graphhopper](https://github.com/crazycapivara/graphhopper-r), [osrm](https://github.com/riatelab/osrm) and [opentripplanner](https://github.com/ropensci/opentripplanner). The [stplanr](https://github.com/ropensci/stplanr) package for sustainable transport planning lets you use many routing engines from a single interface, through `stplanr::route()`, including routing using local R objects. Of course, all these packages can be happily used *alongside* `sfnetworks`. +In this regard it is important to remember that `sfnetworks` is a general-purpose package for spatial network analysis, not specifically optimized for a single task. If your *only* purpose is many-to-many routing in large networks, there might be other approaches that are faster and fit better to your needs. For example, the [dodgr](https://github.com/UrbanAnalyst/dodgr) package was designed for many-to-many routing on large dual-weighted graphs, with its main focus on OpenStreetMap road network data. The [cppRouting](https://github.com/vlarmet/cppRouting) package contains functions to calculate shortest paths and isochrones/isodistances on weighted graphs. When working with OpenStreetMap data, it is also possible to use the interfaces to external routing engines such as [graphhopper](https://github.com/crazycapivara/graphhopper-r), [osrm](https://github.com/riatelab/osrm) and [opentripplanner](https://github.com/ropensci/opentripplanner). The [stplanr](https://github.com/ropensci/stplanr) package for sustainable transport planning lets you use many routing engines from a single interface, through `stplanr::route()`, including routing using local R objects. Of course, all these packages can be happily used *alongside* `sfnetworks`. ```{r, message=FALSE} library(sfnetworks) From 4602e102b6c148a450d588d5846900c2613a3020 Mon Sep 17 00:00:00 2001 From: Luuk van der Meer Date: Tue, 9 Apr 2024 13:28:31 +0200 Subject: [PATCH 13/16] fix: Add missing backslash in function docs :wrench: --- R/morphers.R | 2 +- man/spatial_morphers.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/morphers.R b/R/morphers.R index bbe8a207..86f52376 100644 --- a/R/morphers.R +++ b/R/morphers.R @@ -564,7 +564,7 @@ to_spatial_simple = function(x, remove_multiple = TRUE, remove_loops = TRUE, #' @param protect Nodes to be protected from being removed, no matter if they #' are a pseudo node or not. Can be given as a numeric vector containing node #' indices or a character vector containing node names. Can also be a set of -#' geospatial features as object of class code{\link[sf]{sf}} or +#' geospatial features as object of class \code{\link[sf]{sf}} or #' \code{\link[sf]{sfc}}. In that case, for each of these features its nearest #' node in the network will be protected. Defaults to \code{NULL}, meaning that #' none of the nodes is protected. diff --git a/man/spatial_morphers.Rd b/man/spatial_morphers.Rd index b1e4c6dd..2ad55187 100644 --- a/man/spatial_morphers.Rd +++ b/man/spatial_morphers.Rd @@ -109,7 +109,7 @@ to \code{TRUE}.} \item{protect}{Nodes to be protected from being removed, no matter if they are a pseudo node or not. Can be given as a numeric vector containing node indices or a character vector containing node names. Can also be a set of -geospatial features as object of class code{\link[sf]{sf}} or +geospatial features as object of class \code{\link[sf]{sf}} or \code{\link[sf]{sfc}}. In that case, for each of these features its nearest node in the network will be protected. Defaults to \code{NULL}, meaning that none of the nodes is protected.} From 6a151136085aac6a633845d0be6fe52b1aed5819 Mon Sep 17 00:00:00 2001 From: Luuk van der Meer Date: Tue, 9 Apr 2024 13:45:54 +0200 Subject: [PATCH 14/16] feat: Add message argument to sfnetwork constructor. Refs #261 :gift: --- R/sfnetwork.R | 12 ++++++++---- man/sfnetwork.Rd | 5 +++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/R/sfnetwork.R b/R/sfnetwork.R index 531c6612..889797de 100644 --- a/R/sfnetwork.R +++ b/R/sfnetwork.R @@ -53,6 +53,10 @@ #' your input data meet the requirements, the checks are unnecessary and can be #' turned off to improve performance. #' +#' @param message Should informational messages (those messages that are +#' neither warnings nor errors) be printed when constructing the network? +#' Defaults to \code{TRUE}. +#' #' @param ... Arguments passed on to \code{\link[sf]{st_as_sf}}, if nodes need #' to be converted into an \code{\link[sf]{sf}} object during construction. #' @@ -102,7 +106,7 @@ #' @export sfnetwork = function(nodes, edges = NULL, directed = TRUE, node_key = "name", edges_as_lines = NULL, length_as_weight = FALSE, - force = FALSE, ...) { + force = FALSE, message = TRUE, ...) { # Prepare nodes. # If nodes is not an sf object: # --> Try to convert it to an sf object. @@ -140,12 +144,12 @@ sfnetwork = function(nodes, edges = NULL, directed = TRUE, node_key = "name", # --> Adding additional attributes if requested. if (is.null(edges)) { # Run validity check for nodes only and return the network. - if (! force) require_valid_network_structure(x_sfn, message = TRUE) + if (! force) require_valid_network_structure(x_sfn, message = message) return (x_sfn) } if (edges_as_lines) { # Run validity check before explicitizing edges. - if (! force) require_valid_network_structure(x_sfn, message = TRUE) + if (! force) require_valid_network_structure(x_sfn, message = message) # Add edge geometries if needed. if (edges_are_explicit) { # Edges already have geometries, we don't need to add them. @@ -163,7 +167,7 @@ sfnetwork = function(nodes, edges = NULL, directed = TRUE, node_key = "name", x_sfn = implicitize_edges(x_sfn) } # Run validity check after implicitizing edges. - if (! force) require_valid_network_structure(x_sfn, message = TRUE) + if (! force) require_valid_network_structure(x_sfn, message = message) } if (length_as_weight) { edges = edges_as_sf(x_sfn) diff --git a/man/sfnetwork.Rd b/man/sfnetwork.Rd index c298868b..39cd8fd5 100644 --- a/man/sfnetwork.Rd +++ b/man/sfnetwork.Rd @@ -12,6 +12,7 @@ sfnetwork( edges_as_lines = NULL, length_as_weight = FALSE, force = FALSE, + message = TRUE, ... ) } @@ -63,6 +64,10 @@ These checks are important, but also time consuming. If you are already sure your input data meet the requirements, the checks are unnecessary and can be turned off to improve performance.} +\item{message}{Should informational messages (those messages that are +neither warnings nor errors) be printed when constructing the network? +Defaults to \code{TRUE}.} + \item{...}{Arguments passed on to \code{\link[sf]{st_as_sf}}, if nodes need to be converted into an \code{\link[sf]{sf}} object during construction.} } From b781c06c1d093c91e89eeafe5c2800ef9423dc30 Mon Sep 17 00:00:00 2001 From: Luuk van der Meer Date: Tue, 9 Apr 2024 13:47:02 +0200 Subject: [PATCH 15/16] release: Update changelog :bookmark: --- NEWS.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/NEWS.md b/NEWS.md index 0c969dd6..b93fc072 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,13 @@ +# sfnetworks v0.6.4 + +### New features + +* The `sfnetwork()` construction function now has an argument `message` which can be set to `FALSE` when the network validity checks should not print informational messages to the console. Refs [#261](https://github.com/luukvdmeer/sfnetworks/issues/261). + +### Maintenance + +* Code and documentation was updated where needed to align with changes in base R and/or package dependencies. No changes to program logic or behavior. + # sfnetworks v0.6.3 ### Bug fixes From 3a4b645b44cc8d4c087e6c38d310988460dfadb7 Mon Sep 17 00:00:00 2001 From: Luuk van der Meer Date: Tue, 9 Apr 2024 13:47:52 +0200 Subject: [PATCH 16/16] release: Version bump to v0.6.4 :bookmark: --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index c2af9043..549742f2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: sfnetworks Title: Tidy Geospatial Networks -Version: 0.6.3 +Version: 0.6.4 Authors@R: c(person(given = "Lucas", family = "van der Meer",