Open jackWest9731 opened 10 months ago
I just ran into this. It looks like the bug was introduced at d88b1671 by this line, which calls unfocus()
at the top of the function in an attempt to make sure that the new focus()
functionality doesn't mess things up; but unfocus
can't handle bare lists, so it throws an error.
I assume the fix is to put the unfocus()
call inside the if
conditions that immediately follow the current call and that handle the bare list functionality. But I don't understand focus()
very well yet, so I'll hold back on submitting a PR that might cause some new problem.
In the meantime, I think the bug can be worked around fairly painlessly by using do.call()
(or rlang::exec()
) to pass the list to bind_graphs()
elementwise.
Here's a reprex showing the workaround using the example from the docs and above:
library(tidygraph)
#>
#> Attaching package: 'tidygraph'
#> The following object is masked from 'package:stats':
#>
#> filter
graph <- create_notable('bull')
new_graph <- create_notable('housex')
graphs <- list(graph, new_graph)
example_from_docs <- graph %>% tidygraph::bind_graphs(new_graph)
workaround <- do.call(bind_graphs, graphs)
igraph::identical_graphs(example_from_docs, workaround)
#> [1] TRUE
Created on 2024-05-20 with reprex v2.1.0
I see that allowing an input of a list of graphs to
bind_graphs()
was implemented from issue #88 , and I have been using this feature. After updating the package I have run into an issue when trying to do this. For example:Returns an error
Error in UseMethod("unfocus") : no applicable method for 'unfocus' applied to an object of class "list"
I would find it useful if this feature was reimplemented please. Thank you for the work that's been put into this package