I tried finding a solution, but since I am not that familiar with R, I'm not sure if I used the best key words searching.
I have an igraph where vertices have attributes(positions, wealth) and I'm trying to compare the wealth of those vertices that have positions == "Manager".
Edit
I'm not only comparing the wealth but also another attribute: constraint. Also I tried to do the make this reproducible:
library(igraph)
M <- matrix(c( 0, 1, 0, 0, 0,
0, 0, 1, 0, 0,
1, 1, 0, 0, 1,
0, 1, 0, 0, 0,
0, 1, 1, 0, 0), nrow = 5, byrow=TRUE)
g <- graph.adjacency(M, mode = "undirected")
V(g)$position <- c("Manager", "Manager", "Other", "Other", "Other")
V(g)$wealth <- c("12", "16", "16", "4", "29")
V(g)$constraint <- constraint(g)
What I want to do is to see a table with the wealth and constraint of the Managers only.
Edit 2
@G5W offered this solution which works perfectly:
cbind(V(g)$wealth, V(g)$constraint)[V(g)$position == "Manager"]