-
-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: use {lifecycle} for deprecation #1014
base: main
Are you sure you want to change the base?
Conversation
Current Aviator status
This pull request is currently open (not queued). How to mergeTo merge this PR, comment See the real-time status of this PR on the Aviator webapp. Use the Aviator Chrome Extension to see the status of your PR within GitHub.
|
483b08a
to
779c868
Compare
e22d6fe
to
5e3bdfa
Compare
ℹ Please use `set_edge_attr()` instead. | ||
> causal.effect("y", "x", G = g) | ||
Error in simple_es_index(x, ii) : Unknown edge selected | ||
Calls: causal.effect ... [ -> [.igraph.es -> lapply -> FUN -> simple_es_index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea why this is failing now.
3. │ └─rlang::eval_bare(expr, quo_get_env(quo)) | ||
4. └─cfid::import_graph(ig) | ||
5. └─cfid::dag(paste0(c(g_obs, g_unobs), collapse = "; ")) | ||
6. └─cfid:::stopifnot_(nzchar(x), "Argument `x` contains only whitespace or special characters.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤷
> q.arg = list(list(min=-pi, max=pi), list(min=-pi, max=pi), list(min=-pi, max=pi)) | ||
> estimateGraph(f.mat=ishigami.fun, d=3, q.arg=q.arg, n.tot=10000, method="LiuOwen") | ||
Error in (function (edges, n = max(edges), directed = TRUE) : | ||
unused arguments (3, FALSE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WAT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again related to how we pass the ... 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now I'm wondering whether there are uncaught occurrences of the same issue for other deprecated functions, I'll check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
although, in this case, I'm starting to think the error is one usage error that existed before but wasn't caught.
The code is graph(as.vector(t(E)), d , FALSE)
where d is 3 and as.vector(t(E))
is c(1, 3)
. In make_graph()
, the ... are for "when the graph is given via a literal". Here the edges are numeric. So we're in
Lines 612 to 627 in b806ec2
old_graph <- function(edges, n = max(edges), directed = TRUE) { | |
on.exit(.Call(R_igraph_finalizer)) | |
if (missing(n) && (is.null(edges) || length(edges) == 0)) { | |
n <- 0 | |
} | |
.Call( | |
R_igraph_create, as.numeric(edges) - 1, as.numeric(n), | |
as.logical(directed) | |
) | |
} | |
args <- list(edges, ...) | |
if (!missing(n)) args <- c(args, list(n = n)) | |
if (!missing(directed)) args <- c(args, list(directed = directed)) | |
do.call(old_graph, args) |
old_graph()
function doesn't have more arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
although, why did it used to work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
igraph::make_graph(c(1, 3), 3, FALSE)
#> IGRAPH 628f020 U--- 3 1 --
#> + edge from 628f020:
#> [1] 1--3
igraph::graph(c(1, 3), 3, FALSE)
#> Warning: `graph()` was deprecated in igraph 2.0.0.
#> ℹ Please use `make_graph()` instead.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
#> Error in (function (edges, n = max(edges), directed = TRUE) : unused arguments (3, FALSE)
Created on 2024-01-08 with reprex v2.0.2
|
||
Quitting from lines 46-56 [unnamed-chunk-5] (Tutorial.Rmd) | ||
Error: processing vignette 'Tutorial.Rmd' failed with diagnostics: | ||
At vendor/cigraph/src/graph/type_indexededgelist.c:101 : Number of vertices must not be negative. Invalid value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay
R/make.R
Outdated
} | ||
|
||
if (missing(simplify)) { | ||
make_graph(edges = edges, n = n, isolates = isolates, directed = directed, ...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this fail if edges
is a formula?
I don't like the interface of make_graph()
, but deprecating it is an uphill battle. Can we instead export all relevant functions (e.g., make_famous_graph()
), and supersede it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's open another issue regarding make_graph()'s superseding, and I'll do my best to fix the current graph() here in this PR.
I wonder how, in the problematic cases, we could "replay" the call exactly, just switching the function name. https://rlang.r-lib.org/reference/stack.html |
I'll come back to this later (this week or next), still some thinking needed. |
@krlmlr we could discuss the approach in |
The functions needing a similar fix are |
Fix #697
Fix #977