title: From dataframe to vertex/edge array
body: <p>I have the dataframe</p>
  
  <pre><code>test &lt;- structure(list(
       y2002 = c("freshman","freshman","freshman","sophomore","sophomore","senior"),
       y2003 = c("freshman","junior","junior","sophomore","sophomore","senior"),
       y2004 = c("junior","sophomore","sophomore","senior","senior",NA),
       y2005 = c("senior","senior","senior",NA, NA, NA)), 
                .Names = c("2002","2003","2004","2005"),
                row.names = c(c(1:6)),
                class = "data.frame")
  &gt; test
         2002      2003      2004   2005
  1  freshman  freshman    junior senior
  2  freshman    junior sophomore senior
  3  freshman    junior sophomore senior
  4 sophomore sophomore    senior   &lt;NA&gt;
  5 sophomore sophomore    senior   &lt;NA&gt;
  6    senior    senior      &lt;NA&gt;   &lt;NA&gt;
  </code></pre>
  
  <p>and I need to create a vertex/edge list (for use with igraph) with every time the student category changes in consecutive years, while ignoring when there is no change, as in</p>
  
  <pre><code>testvertices &lt;- structure(list(
   vertex = 
    c("freshman","junior", "freshman","junior","sophomore","freshman",
      "junior","sophomore","sophomore","sophomore"),
   edge = 
    c("junior","senior","junior","sophomore","senior","junior",
      "sophomore","senior","senior","senior"),
   id =
    c("1","1","2","2","2","3","3","3","4","5")),
                         .Names = c("vertex","edge", "id"),
                         row.names = c(1:10),
                         class = "data.frame")
  &gt; testvertices
        vertex      edge id
  1   freshman    junior  1
  2     junior    senior  1
  3   freshman    junior  2
  4     junior sophomore  2
  5  sophomore    senior  2
  6   freshman    junior  3
  7     junior sophomore  3
  8  sophomore    senior  3
  9  sophomore    senior  4
  10 sophomore    senior  5
  </code></pre>
  
  <p>At this point I'm ignoring the ids, my graph should weight edges by count (i.e., freshman -> junior =3). The idea is to make a tree graph. I know it is beside the main munging point, but that's in case you ask...</p>