Read ego-centered network data exported with EgoNet software as an egor object
Source: R/read.ego.folders.R
read_egonet.RdThis function imports ego-centered network data from folders with separate files for alters-level and edge data. It will run some basic checks upon the completeness of the data and inform the user of potential problems. This function can be used to import data exported from EgoNet (McCarty 2011).
Usage
read_egonet(
egos.file,
alter.folder,
edge.folder,
csv.sep = ",",
ID.vars = list(ego = "egoID", alter = "alterID", source = "Source", target = "Target"),
first.col.row.names = FALSE,
...
)Arguments
- egos.file
File name of the .csv file containing the ego data.
- alter.folder
Folder name of the folder containing the alter data in separate .csv files for each ego/ network.
- edge.folder
Folder name of the folder containing the edge/ tie data in separate .csv files for each ego/ network.
- csv.sep
Characterindicating the separator used in csv files.- ID.vars
A named list containing column names of the relevant input columns:
egounique identifier associated with each ego, defaulting to
"egoID"; has no effect ifalters.dfandaaties.dfare both lists of data frames.alterunique-within-ego identifier associated with each alter, defaulting to
"alterID"; optionalaaties.dfare not provided.sourceif
aaties.dfis provided, the column given the alter identifier of the origin of a relation.targetif
aaties.dfis provided, the column given the alter identifier of the destination of a relation.
- first.col.row.names
Booleanindicating if first column contains row names, that are to be skipped, default isFALSE.- ...
additional arguments to
egor().
Value
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
egos.file <- system.file("extdata", "egos_32.csv", package = "egor")
alters.folder <- system.file("extdata", "alters_32", package = "egor")
edge.folder <- system.file("extdata", "edges_32", package = "egor")
ef <- read_egonet(egos.file = egos.file,
alter.folder = alters.folder,
edge.folder = edge.folder,
csv.sep = ";")
#> Reading ego data.
#> Checking if alter.files and edge.files correspond
#> Creating $alters.df and $alters.list
#> Creating edge lists: $edges