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.

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())

Source

read_ucinet() kindly supplied by Christian Steglich, constructed on 18 June 2015.

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 read_ucinet() the file path should be to the header file (.##h), if it exists and that it is currently not possible to import multiple networks from a single UCINET file. Please convert these one by one.

sv

Allows users to specify whether their csv file is "comma" (English) or "semi-colon" (European) separated.

...

Additional parameters passed to the read/write function.

ties

A character string indicating the ties/network, where the data contains several.

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.

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:

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.

See also

as

Other makes: create, generate, learning, play, write()