Return a (list of)
network object(s) after reading a corresponding .net or .paj file. The code accepts ragged array edgelists, but cannot currently handle 2-mode, multirelational (e.g. KEDS), or networks with entries for both edges and arcs (e.g. GD-a99m).
sna for more information.
the name of the file whence the data are to be read. If it does not contain an absolute path, the file name is relative to the current working directory (as returned by
logical: Should longer descriptions of the reading and coercion process be printed out?
logical: Should very detailed descriptions of the reading and coercion process be printed out? This is typically used to debug the reading of files that are corrupted on coercion.
optional name for the edge variable read from the file. The default is to use the value in the project file if found.
Should the returned network be simplified as much as possible and saved? The values specifies the name of the file which the data are to be stored. If it does not contain an absolute path, the file name is relative to the current working directory (see
if the network has timing information attached to edges/vertices, how should it be processed?
*Vertices block includes the optional graphic attributes (coordinates, shape, size, etc.) they will be read attached to the network as vertex attributes but values will not be interperted (i.e. Pajek's color names will not be translated to R color names). Vertex attributes included in a
*Vector block will be attached as vertex attributes.
Edges or Arc weights in the
*Edges block are include in the network as an attribute with the same name as the network. If no weight is included, a default weight of 1 is used. Optional graphic attributes or labels will be attached as edge attributes.
If the file contains an empty
Arcs block, an undirected network will be returned. Otherwise the network will be directed, with two edges (one in each direction) added for every row in the
*Edges blocks having timing information included in the rows (indicated by '[...]' tokens), it will be attached to the vertices with behavior determined by the
time.format option. If the
'networkDynamic' format is used, times will be translated to
networkDynamic's spell model with the assumtion that the original Pajek representation was indicating discrete time chunks. For example
"[5-10]" will become the spell
"[2-*]" will become
"" will become
[7,8]. See documentation for
?activity.attribute for details.
*Events blocks are not yet supported.
As there is no known single complete specification for the file format, parsing behavior has been infered from references and examples below.
The structure of the object returned by
read.paj depends on the contents of the file it parses.
if input file contains information about a single 'network' object (i.e .net input file) a single network object is returned with attribute data set appropriately if possible. or a list of networks (for .paj input).
if input file contains multiple sets of relations for a single network, a list of network objects ('network.series') is returned, along with a formula object?.
if input .paj file contains additional information (like partition information), or multiple
*Network definitions a two element list is returned. The first element is a list of all the network objects created, and the second is a list of partitions, etc. (how are these matched up)
Batagelj, Vladimir and Mrvar, Andrej (2011) Pajek Reference Manual version 2.05 http://vlado.fmf.uni-lj.si/pub/networks/pajek/doc/pajekman.pdf Section 5.3 pp 73-79
Batageli, Vladimir (2008) "Network Analysis Description of Networks" http://vlado.fmf.uni-lj.si/pub/networks/doc/ECPR/08/ECPR01.pdf
Pajek Datasets http://vlado.fmf.uni-lj.si/pub/networks/data/esna/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
require(network) par(mfrow=c(2,2)) test.net.1 <- read.paj("http://vlado.fmf.uni-lj.si/pub/networks/data/GD/gd98/A98.net") plot(test.net.1,main=test.net.1%n%'title') test.net.2 <- read.paj("http://vlado.fmf.uni-lj.si/pub/networks/data/mix/USAir97.net") # plot using coordinates from the file in the file plot(test.net.2,main=test.net.2%n%'title', coord=cbind(test.net.2%v%'x', test.net.2%v%'y'), jitter=FALSE) # read .paj project file # notice output has $networks and $partitions read.paj('http://vlado.fmf.uni-lj.si/vlado/podstat/AO/net/Tina.paj')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.