threefiles_to_egor {egor} | R Documentation |
Read/ import ego-centered network data from the three files format, EgoWeb2.0 or openeddi.
Description
These functions read ego-centered network data from the three files format, EgoWeb2.0 or openeddi and transform it to an egoR object. The three files format consists of an ego file, on alters file and one file containing the edge data. EgoWeb2.0 and openeddi use variations of this format.
Usage
threefiles_to_egor(
egos,
alters.df,
edges,
ID.vars = list(ego = "egoID", alter = "alterID", source = "Source", target = "Target"),
ego.vars = NULL,
...
)
read_egoweb(
alter.file,
edges.file,
egos.file = NULL,
ID.vars = list(ego = "EgoID", alter = "Alter.Number", source = "Alter.1.Number", target
= "Alter.2.Number"),
ego.vars = NULL,
...
)
read_openeddi(
egos.file = NULL,
alters.file = NULL,
edges.file = NULL,
ID.vars = list(ego = "puid", alter = "nameid", source = "nameid", target = "targetid"),
ego.vars = NULL,
...
)
Arguments
egos |
|
alters.df |
|
edges |
|
ID.vars |
A named list containing column names of the relevant input columns:
|
ego.vars |
A |
... |
additional arguments to |
alter.file |
A character specifiying the filename of the alters data. |
edges.file |
A character specifiying the filename of the edge data. |
egos.file |
A character specifiying the filename of the ego data. |
alters.file |
|
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
Functions
-
read_egoweb()
: This function reads in data from an EgoWeb 2.0 survey and transforms it to an egoR object. If no file name for the egos file is provided ego data is assumed to be merged with alters data and it will be extracted byread_egoweb
. By default the standard ID variable names of EgoWeb are used, if you need to specify the ID variable names use the ID.vars parameter. Further Information: github.com/qualintitative/egoweb -
read_openeddi()
: This function reads in data created by the openeddi survey software and transforms it to an egoR object. If no parameters are providedread_openeddi
will try to find the adequate files in the working directory. By default the standard ID variable names of openeddi are used, if you need to specify the ID variable names use the ID.vars parameter. Further Information: www.openeddi.com
Examples
# The data for read.egonet.threefiles() needs to be loaded with read.csv(),
# for it to be converted to an egoR object.
egos.file <- system.file("extdata", "egos_32.csv", package = "egor")
alters.file <- system.file("extdata", "alters_32.csv", package = "egor")
edges.file <- system.file("extdata", "edges_32.csv", package = "egor")
egos <- read.csv2(egos.file)
alters <- read.csv2(alters.file)
edges <- read.csv2(edges.file)
tf <- threefiles_to_egor(egos = egos, alters.df = alters, edges = edges)
# read_egoweb() and read_openeddi() read the files directly from the disk.
# Fetch current working directory
wd <- getwd()
setwd(system.file("extdata", "openeddi", package = "egor"))
oe <- read_openeddi()
setwd(system.file("extdata", "egoweb", package = "egor"))
ew <- read_egoweb(alter.file = "alters_32.csv", edges.file = "edges_32.csv",
egos.file = "egos_32.csv")
# Restore working directory
setwd(wd)