title: How to change labels on a network diagram in R?
body: <p>I'm using R for Social Network Analysis, trying out the packages SNA, Network, and iGraph.</p>
  
  <p>My data is a data.frame structured as... <code>d &lt;-</code></p>
  
  <pre><code>Source  Target  Weight  Label
  1       2       0.5     "Fred"
  1       3       0.7     "Fred"
  2       3       0.9     "Bill"
  3       1       1.0     "Allen"
  </code></pre>
  
  <p>(I also have a version that is just (a) source, target, and weight, and a separate file (b) providing a correspondence between Source IDs and Label values, ie, the names of the sources, where <code>a &lt;-</code> </p>
  
  <pre><code>Source  Target  Weight
  1       2       0.5   
  1       3       0.7   
  2       3       0.9   
  3       1       1.0   
  </code></pre>
  
  <p><code>labels1 &lt;-</code> </p>
  
  <pre><code>Source  Label
  1       "Fred"
  2       "Bill"
  3       "Allen"
  </code></pre>
  
  <p><code>labels2 &lt;-</code> </p>
  
  <pre><code>Source  Label
  1       "TrueName1"
  2       "TrueName2"
  3       "TrueName3"
  </code></pre>
  
  <p>)</p>
  
  <p>I'm working with an Anonymized social network, so I'd like to be able to change the Name labels easily between replottings---ie using label set 1 or label set 2, where the edges are the same, but the node name correspondence between sourceID and Label Name changes.  </p>
  
  <p>However, when trying to use any of these packages, it seems I would have to convert the values in both source and target to be equal to the labels.  Is there any easy way to append labels as a correspondence to source?</p>
  
  <p>So long as I have the Label column, things like <code>network(d)</code> and <code>graph.data.frame(d, directed=TRUE)</code> won't work.  Once I drop this category, it will, but my graphs have numeric labels.</p>
  
  <p>What I'd like to be able to do is something like this:</p>
  
  <pre><code>plot(a, labels=NA) 
  plot(a, labels=labels1) 
  </code></pre>
  
  <p>and</p>
  
  <pre><code>plot(a, labels=labels2) 
  </code></pre>
  
  <p>to move between numeric, anonymized, and non-anonymized labels on the graph.</p>