rigraph
rigraph copied to clipboard
lazy_dots "use of NULL environment is defunct" when subsetting edges from function body
From @jtatria on October 18, 2017 21:34
Hello!
Sub-setting an edge vector with a logical vector from inside a function's body fails with the error below if the logical vector used for sub-setting has previously been evaluated inside the function's body.
Passing the logical vector as an un-eveluated promise works fine.
igraph_version: 1.1.2.9000
PS: google led me to this Jan 2015 igraph-help thread discussing the same issue.
MWE:
require( igraph )
null_defunct <- function( x, set ) {
bomb <- set
return( x[ set ] );
}
g <- sample_grg( 1000, .2 );
set <- ( runif( length( E( g ) ) ) > .3 )
null_defunct( E( g ), set )
Error:
Error in lazy_dots(..., .follow_symbols = TRUE) :
use of NULL environment is defunct
Copied from original issue: igraph/igraph#1038
Still seeing this:
library(igraph, warn.conflicts = FALSE)
null_defunct <- function(x, set) {
bomb <- set
return(x[set])
}
g <- sample_grg(1000, .2)
set <- (runif(length(E(g))) > .3)
null_defunct(E(g), set)
#> Error in lazy_dots(..., .follow_symbols = TRUE): use of NULL environment is defunct
Created on 2023-03-31 with reprex v2.0.2