Reputation: 2571
I'm trying to use the following R library: iSubpathwayMiner
that requires the following packages:
graph
, igraph
, RBGL
.
While running the string
graphList<-getMetabolicECECGraph()
that you can find in the vignette, the following Error I'm not able to manage occurs:
# Error in if (get.vertex.attribute(graphList[[i]], "type", j - 1) %in% :
# argument is of length zero
Can anyone help me at least to try to understand what does it means and how to manage it?
Thank you in advance
Best
Upvotes: 1
Views: 945
Reputation: 1894
The error is saying that the argument of the if
is NULL
. This most likely arises because your graph does not have an attribute named type
. There are errors and other unresolved conflicts with these libraries, so it is not possible to rule anything else out.
You can run this example in a R session
library(igraph)
g <- graph.ring(10)
g <- set.graph.attribute(g, "name", "RING")
g <- set.vertex.attribute(g, "color", value=c("red", "green"))
get.vertex.attribute(g, "color")
#>[1] "red" "green" "red" "green" "red" "green" "red" "green" "red" "green"
#Asking for an attribute that does not exist will return NULL
get.vertex.attribute(g, "day")
#>NULL
#And
if(NULL){print(1)}
#>Error in if (NULL) { : argument is of length zero
#so
if(get.vertex.attribute(g, "day") %in% c("Mon","Tue","Wed")){print("doSomething")}
#>Error in if (get.vertex.attribute(g, "day") %in% c("Mon", "Tue", "Wed")) { :
#argument is of length zero
In general, you should check that an argument of an if
statement is not NULL
by using something like is.null()
beforehand.
Upvotes: 1