netread: Reading Network Data Files and Initial Cleaning ('netread')

View source: R/netread.R

netreadR Documentation

Reading Network Data Files and Initial Cleaning (netread)

Description

The netread function reads in various files storing relational data converts them into edgelists that ensure their compatibility with other ideanet functions.

Usage

netread(
  path = NULL,
  filetype = NULL,
  sheet = NULL,
  nodelist = NULL,
  node_sheet = NULL,
  object = NULL,
  col_names = TRUE,
  row_names = FALSE,
  format = NULL,
  net_name = "network",
  missing_code = 99999,
  i_elements = NULL,
  j_elements = NULL
)

Arguments

path

A character value indicating the path of the file which the data are to be read from. If netread is converting igraph or network objects, no file path is needed.

filetype

A character value indicating the type of file being read. Valid arguments are "csv", "excel" (.xls, .xlsx), "igraph" (for igraph objects), "network" or "sna" (for network objects), "pajek" (for Pajek files), and "ucinet" (for UCINet files).

sheet

If reading in an Excel file with multiple sheets, a character value indicating the name of the sheet on which the core relational data are stored.

nodelist

If the relational data being read have a corresponding file for node-level information, a character value indicating the path of the file which this data are to be read from.

node_sheet

If reading in an Excel file with multiple sheets, a character value indicating the name of the sheet on which the node-level information is store.

object

If converting an igraph or network object, the object to be converted.

col_names

For reading CSV and Excel files, a logical value indicating whether the first row in the file serves as the file's header and contains the names of each column.

row_names

For reading CSV and Excel files, a logical value indicating whether the first column in the file contains ID values for each row and should not be treated as part of the core data.

format

For reading CSV and Excel files, a character value indicating the format in which relational data are structured in the file. Valid arguments include "edgelist", "adjacency_matrix", and "adjacency_list".

net_name

A character value indicating the name of the network being read from the file(s). This name will be used as a prefix for both outputs created by netread.

missing_code

A numeric value indicating "missing" values in the data being read. Such "missing" values are sometimes included to identify the presence of isolated nodes in an edgelist when a corresponding nodelist is unavailable.

i_elements

If format is set to edgelist, a character value indicating the name of the column containing the sender of ties in the edgelist. If not specified, netread assumes the first column of the data represents tie senders.

j_elements

If format is set to edgelist, a character value indicating the name of the column containing the receiver of ties in the edgelist. If not specified, netread assumes the second column of the data represents tie receivers

Value

A list containing an edgelist and a nodelist, both of which are formatted to be compatible with the netwrite function.


ideanet documentation built on April 3, 2025, 11:55 p.m.