buildnet: Get clean network graph, matrix, or edgelist

View source: R/buildnet.R

buildnetR Documentation

Get clean network graph, matrix, or edgelist

Description

Transform weighted social network data collected in wide format to a network graph (igraph object), matrix, or edgelist.

Usage

buildnet(
  snawide,
  nettype,
  weighttype = "Strength",
  missingweight = 1,
  return = "graph"
)

Arguments

snawide

Wide social network dataframe to be transformed

nettype

Character string; name of network, matching column names, in quotes (e.g., "Friend")

weighttype

Character string; tie strength type in variable names, in quotes (default is "Strength")

missingweight

Numeric; if participant nominated a tie but did not provide a tie strength rating, what strength should be assumed? (default is 1)

return

Character string; if "graph" or "network" (default), function will return an igraph graph object; if "matrix," function will return a network matrix; if "edgelist" or "el," function will return an edgelist

Details

Requires set naming system: participant id column named "PPID", nominated tie columns named network type + tie number + "Name" or "ID" (e.g., "Friend1Name" or "Friend1ID"), tie strength columns named network type + tie number + tie strength type (e.g., "Friend1Strength"). Isolates are retained by including a self-nomination (loop) with tie weight 0.

Value

A weighted igraph graph, network matrix, or edgelist


kturetsky/sneasy documentation built on Aug. 29, 2022, 7:11 a.m.