Skip to content

Commit

Permalink
Merge pull request #566 from ropensci/565-checks-when-suggests-are-un…
Browse files Browse the repository at this point in the history
…available

Only run rnet_group() examples when igraph installed
  • Loading branch information
Robinlovelace authored Aug 2, 2024
2 parents a8abe99 + 935cdad commit e4b840d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/rnet_group.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@
#' rnet_group representing the groups of each network element. In the latter
#' case, the connectivity of the spatial object is derived from the sfNetwork
#' object.
#'
#' @note These functions rely on the igraph package. If igraph is not installed,
#' the function will return a message.
#'
#' @family rnet
#' @examples
#' if (requireNamespace("igraph", quietly = TRUE)) {
#' rnet <- rnet_breakup_vertices(stplanr::osm_net_example)
#' rnet$group <- rnet_group(rnet)
#' plot(rnet["group"])
Expand All @@ -36,6 +40,7 @@
#' plot(rnet["group_louvain"])
#' rnet$group_fast_greedy <- rnet_group(rnet, igraph::cluster_fast_greedy)
#' plot(rnet["group_fast_greedy"])
#' }
#' @export
rnet_group <- function(rnet, ...) {
UseMethod("rnet_group")
Expand Down
6 changes: 6 additions & 0 deletions man/rnet_group.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e4b840d

Please sign in to comment.