title: 'edges' must be numeric or character. What is the problem?
body: <p>i'm new to coding and I'm trying to perform a network analysis in R. i've got a data frame with 2 columns, one country of origin and the other is destination. I am trying to calculate betweenness and closeness centrality in R. But when trying to graph using :</p>
  
  <pre><code>g &lt;- graph (c2, directed=TRUE)
  </code></pre>
  
  <p>, where <code>c2</code> is the name of my DF as described above, I get the message:</p>
  
  <pre><code>Error in graph(c2, directed = TRUE) : 
    'edges' must be numeric or character. 
  </code></pre>
  
  <p>I've already tried converting factors to characters by the following:</p>
  
  <pre><code>c2 &lt;- data.frame(lapply(c2, as.character), stringsAsFactors=F)
  </code></pre>
  
  <p>but for some reason it is not helping. What have I done wrong? </p>
  
  <p>edit* - dput(head(c2)) gives: </p>
  
  <pre><code>&gt; dput(head(c2))
  structure(list(CountryID.Origin = c("india", "malaysia", "fiji", 
  "fiji", "china", "united states (the)"), State = c("ACT", "ACT", 
  "ACT", "ACT", "NSW", "NSW")), row.names = c(NA, 6L), class = "data.frame")
  </code></pre>