R: Functions for loading and writing Pajek files

loadmatrix {blockmodeling} | R Documentation

## Functions for loading and writing Pajek files

### Description

`loadmatrix` - Loads a Pajek ".mat" filename as a matrix.

Functions for reading/loading and writing Pajek files:

`loadnetwork` - Loads a Pajek ".net" filename as a matrix. For now, only simple one and two-mode networks are supported (eg. only single relations, no time information).

`loadnetwork2` - The same as above, but adapted to be called within `loadpajek`.

`loadnetwork3` - Another version for reading networks.

`loadnetwork4` - Another version for reading networks.

`loadpajek` - Loads a Pajek project file name (".paj") as a list with the following components: Networks, Partitions, Vectors and Clusters. Clusters and hierarchies are dismissed.

`loadvector` - Loads a Pajek ".clu" filename as a vector.

`loadvector2` - The same as above, but adapted to be called within `loadpajek` - as a consequence not suited for reading clusters.

`savematrix` - Saves a matrix into a Pajek ".mat" filename.

`savenetwork` - Saves a matrix into a Pajek ".net" filename.

`savevector` - Saves a vector into a Pajek ".clu" filename.

### Usage

    loadmatrix(filename)

    loadnetwork(filename, useSparseMatrix = NULL, minN = 50)

    loadnetwork2(
      filename,
      useSparseMatrix = NULL,
      minN = 50,
      safe = TRUE,
      closeFile = TRUE
    )

    loadnetwork3(filename, useSparseMatrix = NULL, minN = 50)

    loadnetwork4(filename, useSparseMatrix = NULL, minN = 50, fill = FALSE)

    loadpajek(filename)

    loadvector(filename)

    loadvector2(filename)

    savematrix(n, filename, twomode = 1)

    savenetwork(n, filename, twomode = "default", symetric = NULL)

    savevector(v, filename)

### Arguments

`filename` | The name of the file to be loaded or saved to or an open file object.
`useSparseMatrix` | Should a sparse matrix be use instead of the ordinary one? Sparse matrices can only be used if package Matrix is installed. The default `NULL` uses sparse matrices for networks with more that `minN` vertices.
`minN` | The minimal number of units in the network to use sparse matrices.
`safe` | If `FALSE` error will occur if not all vertices have labels. If `TRUE` reading works faster.
`closeFile` | Should the connection be closed at the end. Should be always `TRUE` if function is used directly.
`fill` | If `TRUE`, then in case the rows have unequal length, blank fields are added.
`n` | A matrix representing the network.
`twomode` | 1 for one-mode networks and 2 for two-mode networks. Default sets the argument to 1 for square matrices and to 2 for others.
`symetric` | If `TRUE`, only the lower part of the matrix is used and the values are interpreted as "Edges", not "Arcs".
`v` | A vector.

### Value

NULL, a matrix or a vector (see Description).

### Author(s)

Vladimir Batagelj & Andrej Mrvar (most functions), Aleš Žiberna (`loadnetwork`, `loadpajek` and modification of others)

### References

Batagelj, V., & Mrvar. A. (1999). Pajek - Program for Large Network Analysis. Retrieved from http://vlado.fmf.uni-lj.si/pub/networks/pajek/.

de Nooy, W., Mrvar, A., & Batagelj. V. (2005). Exploratory Social Network Analysis with Pajek. London: SAGE Publications.

### See Also

`plot.mat`, `critFunC`, `optRandomParC`

[Package blockmodeling version 1.0.0 Index]