read {manynet} | R Documentation |
Making networks from external files
Description
Researchers regularly need to work with a variety of external data formats.
The following functions offer ways to import from some common external
file formats into objects that {manynet}
and other graph/network packages
in R can work with:
-
read_matrix()
imports adjacency matrices from Excel/csv files. -
read_edgelist()
imports edgelists from Excel/csv files. -
read_nodelist()
imports nodelists from Excel/csv files. -
read_pajek()
imports Pajek (.net or .paj) files. -
read_ucinet()
imports UCINET files from the header (.##h). -
read_dynetml()
imports DyNetML interchange format for rich social network data. -
read_graphml()
imports GraphML files.
Usage
read_matrix(file = file.choose(), sv = c("comma", "semi-colon"), ...)
read_edgelist(file = file.choose(), sv = c("comma", "semi-colon"), ...)
read_nodelist(file = file.choose(), sv = c("comma", "semi-colon"), ...)
read_pajek(file = file.choose(), ties = NULL, ...)
read_ucinet(file = file.choose())
read_dynetml(file = file.choose())
read_graphml(file = file.choose())
Arguments
file |
A character string with the system path to the file to import.
If left unspecified, an OS-specific file picker is opened to help users select it.
Note that in |
sv |
Allows users to specify whether their csv file is
|
... |
Additional parameters passed to the read/write function. |
ties |
A character string indicating the ties/network, where the data contains several. |
Details
Note that these functions are not as actively maintained as others in the package, so please let us know if any are not currently working for you or if there are missing import routines by raising an issue on Github.
There are a number of repositories for network data that hold various datasets in different formats. See for example:
UCIrvine Network Data Repository
Please let us know if you identify any further repositories of social or political networks and we would be happy to add them here.
The _ucinet
functions only work with relatively recent UCINET
file formats, e.g. type 6406 files.
To import earlier UCINET file types, you will need to update them first.
To import multiple matrices packed into a single UCINET file,
you will need to unpack them and convert them one by one.
Value
read_edgelist()
and read_nodelist()
will import
into edgelist (tibble) format which can then be coerced or combined into
different graph objects from there.
read_pajek()
and read_ucinet()
will import into
a tidygraph format, since they already contain both edge and attribute data.
read_matrix()
will import into tidygraph format too.
Note that all graphs can be easily coerced into other formats
with {manynet}
's as_
methods.
Source
read_ucinet()
kindly supplied by Christian Steglich,
constructed on 18 June 2015.
See Also
Other makes:
create
,
generate
,
learning
,
play
,
write()