0

I need to add the id attribute to my vertices as labels, and display them in the plot. Which I did with the following code:

V(novel)$label <- V(novel)$id
plot(novel)

However, I only want to display the id of the vertices where the weighted degree is more than 30. I tried the code below, but it gives me only TRUE or FALSE as output, instead of filtering the vertices.

graph.strength(novel) > 30

How can I filter in which vertices should the plot display the id?

Spacedman
  • 92,590
  • 12
  • 140
  • 224
sabih4911
  • 1
  • 1

1 Answers1

1

V(novel)$label <- ifelse(graph.strength(novel) > 30, V(novel)$id, "") should do the trick; basically you set up an empty label for those vertices that have a strength less than or equal to 30.

Tamás
  • 47,239
  • 12
  • 105
  • 124