twofiles_to_egor function

Import ego-centered network data from two file format

Import ego-centered network data from two file format

This function imports ego-centered network data, stored in two files, where one file contains the ego attributes and the edge information and the other file contains the alters data. This form of data storage for ego-centered network data is proposed by Muller, Wellman and Marin (1999).

twofiles_to_egor( egos, alters, ID.vars = list(ego = "egoID", alter = "alterID", source = "Source", target = "Target"), max.alters, aa.first.var, selection = NULL, ... )

Arguments

  • egos: Data frame containing ego data (egos as cases)

  • alters: Data frame containing alters data (alters in rows), alters are connected to their ego by an egoID.

  • ID.vars: A named list containing column names of the relevant input columns:

    • ego: unique identifier associated with each ego, defaulting to "egoID"; has no effect if alters.df and aaties.df are both lists of data frames.
    • alter: unique-within-ego identifier associated with each alter, defaulting to "alterID"; optional aaties.df are not provided.
    • source: if aaties.df is provided, the column given the alter identifier of the origin of a relation.
    • target: if aaties.df is provided, the column given the alter identifier of the destination of a relation.
  • max.alters: Maximum number of alters that are included in edge data.

  • aa.first.var: Index or name of the first column in egos containing alter-alter data.

  • selection: Character naming numeric variable indicating alters selection with zeros and ones.

  • ...: additional arguments to egor().

Returns

An egor object is returned. It is a list of three data frames: (1) ego: dataframe of all egos and their attributes; (2) alter: dataframe of all alters; (3) aatie: dataframe of alter alter ties/ edges

Examples

path_to_alters_8.csv <- system.file("extdata", "alters_8.csv", package = "egor") path_to_one_file_8 <- system.file("extdata", "one_file_8.csv", package = "egor") # read data from disk egos_8 <- read.csv2(path_to_one_file_8) alters_8 <- read.csv2(path_to_alters_8.csv) # convert to egor object twofiles_to_egor( egos = egos_8, alters = alters_8, max.alters = 8, aa.first.var = "X1.to.2")