Skip to content

Commit

Permalink
🔧check col_names in merge_directed [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Oct 16, 2019
1 parent 4e53ff1 commit 443ac04
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/graph-merge.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
#' nrow (graph); nrow (graph_undir) # the latter is much smaller
merge_directed_graph <- function (graph, col_names = c ("flow"))
{
if (!"flow" %in% names (graph))
stop ("graph does not have any flows to merge")
if (!all (col_names %in% names (graph)))
stop (paste0 ("col_names [",
paste (col_names, collapse = ", "),
"] do not match columns in graph"))

gr_cols <- dodgr_graph_cols (graph)
graph2 <- convert_graph (graph, gr_cols)
Expand Down

0 comments on commit 443ac04

Please sign in to comment.