qap_setup: Individual to Dyadic variable transformation ('qap_setup').

View source: R/qap_setup.R

qap_setupR Documentation

Individual to Dyadic variable transformation (qap_setup).

Description

The qap_setup function transform an individual level attributes into dyadic comparisons following a set of methods. Output can be used to compute QAP measurements using sister functions in ideanet.

Usage

qap_setup(
  net,
  variables = NULL,
  methods = NULL,
  directed = FALSE,
  additional_vars = NULL
)

Arguments

net

An igraph or network object.

variables

A vector of strings naming attributes to be transformed from individual-level to dyadic-level.

methods

A vector of strings naming methods to be applied to the variables vector. The methods vector must be the same length as the variables vector. Methods are applied in order (e.g, first method is applied to the first named attribute in variables). Possible methods are "reduced_category", "multi_category", "both", and "difference". For more information about methods, consult the included vignette.

directed

A logical statement identifying if the network should be treated as directed. Defaults to FALSE.

additional_vars

A data frame containing additional individual-level variables not contained in the primary network input. Additional dataframe must contain an id or label variables which matches network exactly.

Value

qap_setup returns a list of elements that include:

- graph, an updated igraph object containing the newly constructed dyadic variables and additional individual-level variables.

- nodes, a nodelist reflecting additional variables if included.

- edges, a nodelist reflecting new dyadic variables.

Examples



flor <- netwrite(nodelist = florentine_nodes,
                 node_id = "id",
                 i_elements = florentine_edges$source,
                 j_elements = florentine_edges$target,
                 type = florentine_edges$type,
                 directed = FALSE,
                 net_name = "florentine_graph")

flor_setup <- qap_setup(flor$florentine_graph,
                        variables = c("total_degree"),
                        methods = c("difference"))

ideanet documentation built on June 8, 2025, 1:07 p.m.