Discussion:
[igraph] Indexing issues with vectors in R
giorgio delzeri
2017-08-28 13:38:09 UTC
Permalink
Hi R community!
I have a problem with a vector indexing in R.
I have already had a similar problem that I solved in the past, but this
time the stuff is slightly different.
Last time, the problem was the following:

"w <- unique(unlist(adjacent_vertices(g,
which(V(g)$compartment=="SPREADER"))))


dummy_1 <- which(V(g)$compartment[w]=="IGNORANT")"

which I solved by adding the following line of code:

" dummy_1 <- w[dummy_1]".
Once I added the previous line of code, I solved the indexing problem I had
with the "dummy_1" vertex.

This time it seems to be slightly different, because I start from:

"dummy_2 <- which(V(g)$compartment=="SPREADER")"

Do you have any suggestion on how I can, this time, deal with the indexing
problem of the "dummy_2" vertex?
obviously, this time I cannot add the comand "dummy_2 <- w[dummy_2]"
because I have not a "w" vector to use.
Thanks! Giorgio

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Mail
priva di virus. www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Loading...