need help in igraph package of R

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

need help in igraph package of R

bababasi
hi

I am struck with a problem in igraph package of R. My problem is as follows

I want to plot a power law fit for my data (in .net format --- pajek format)

syntax for that in R is

g <- read.graph("filename.net", "pajek")
d <- degree (g, mode="in")
power.law.fit (d+1, 2)

it gives me desired out put if my if input a single file

but I want to use a  variable file name ( such as name1, name2 ) so that I can read all my 100 files at a single stretch if I put this entire code in a loop.

names = "name1" "name2" "name3".....

while (i <= 100)
g <- read.graph("names[i]", "pajek")
d <- degree (g, mode="in")
power.law.fit (d+1, 2)
i <- i + 1
}

but names[i] does n't seem to work. Is there any alternative ?

I want to know how to use  a variable file name in this syntax

Any help is greately appreciated

barabasi