2

I have a small, 2 vertex network in Pajek format that I would like to read into a network object using statnet. The network has no arcs or edges, just those 2 vertices. Unfortunately, when I use read.paj, it just returns NULL. Code to reproduce this is:

Pajek file:

*Vertices          2
        1    1231062
        2    1231095
*Arcs
*Edges

R code:

require(statnet)
read.paj("SC1C1W2Sch122.net", debug = TRUE)
# [1] "nextline called... new loop started"
# [1] "nextline called... new loop started"
# [1] "arc or edge lines present"
# [1] "arc or edge lines present"
# [1] "nextline called... new loop started"
# [1] "nnetworks= 0"
# [1] "network.names= "
# [1] "vertex null? FALSE"
# [1] "network.title= SC1C1W2Sch122"
# [1] "vector null? TRUE"
# [1] "colnames.vector= "
# [1] "projects null? TRUE"
# [1] "nprojects= 0"
# [1] "names.projects= "
# NULL

Any ideas?

Jake Fisher
  • 3,220
  • 3
  • 26
  • 39

1 Answers1

0

I'm not sure why it is not working for you as the listed example worked just fine for me. You could alternatively use the read.graph function in igraph and then convert the graph to a network using the intergraph package.

library(igraph)
g=read.graph("SC1C1W2Sch122.net",format="pajek")

library(intergraph)
n=asNetwork(g)
Ryan Haunfelder
  • 766
  • 3
  • 11
  • Thanks. I spoke to one of the `statnet` developers when I encountered this, and he fixed it in version 1.13.0 of the `network` package, which was released in September 2015. – Jake Fisher Jan 20 '16 at 16:59