0

I use "igraph" package with RStudio, this package is really helpful for graphs to analyse. I've got graphs: (a (1).net, ..., a (128).net)

At first I input the graph, then I can analyse:

a (1)<-read.graph("a (1).net","format=pajek")
 is.directed(a1)

Is.directed's output is binary, YES, if the edges of the graphs are directed to a node, if they are undirected then the output is NO.

'd like to for loop it to save some time:

for(x in 2:128) 
{
paste('a (', x, ')', sep='')<-read.graph(paste('a (', x, ').net', sep=''),"format=pajek")
is.directed(paste('a (', x, ')', sep=''))
}

Error:

 Error in match.arg(arg = arg, choices = choices, several.ok = several.ok) : 
  'arg' should be one of “edgelist”, “pajek”, “ncol”, “lgl”, “graphml”, “dimacs”, “graphdb”, “gml”, “dl”

How can I analyse all of my graphs with a for loop? What's wrong with my script?

Übel Yildmar
  • 491
  • 1
  • 9
  • 24
  • Please send code that is self-contained and is syntactically correct at least. See http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Gabor Csardi Dec 06 '14 at 19:59
  • 1
    Another suggestion -- tag your questions with r, not just rstudio, as it's really an r language question. You'll get more potential answerers this way. – eamcvey Dec 07 '14 at 18:36
  • 1
    One problem you have is that your argument name in read.graph is within a string. It should be like this: `read.graph("a (1).net",format="pajek")` – eamcvey Dec 07 '14 at 18:38

0 Answers0