Skip to contents

Assembles the ModelData structure consumed by <qe-visual> from pre-prepared data.frames. All data.frames are converted to QEFrames (see qe_frame()).

Usage

qe_model_data(
  nodes,
  edges,
  points = NULL,
  groups = NULL,
  directed = FALSE,
  id_col = "ENA_UNIT",
  node_id_col = "code",
  x_col = "x",
  y_col = "y",
  group_col = "Condition"
)

Arguments

nodes

data.frame of code-node positions. Must contain columns node_id_col, x_col, y_col.

edges

data.frame of edge weights. Must contain id_col plus one column per edge pair (e.g. Data.Collaboration).

points

data.frame of unit positions. Must contain id_col, group_col, x_col, y_col.

groups

data.frame of group summary statistics as returned by group_summary(), or NULL to compute automatically from points.

directed

Logical. TRUE for ONA (ordered/directed) models.

id_col

Name of the unit-ID column in edges and points.

node_id_col

Name of the code-ID column in nodes.

x_col

Name of the x-coordinate column.

y_col

Name of the y-coordinate column.

group_col

Name of the group column in points.

Value

A named list suitable for serialisation with jsonlite::toJSON() and passing to qe_export_html() or qe_plot().

Examples

if (FALSE) { # \dontrun{
model <- qe_model_data(nodes_df, edges_df, points_df, directed = FALSE)
qe_plot(model)
} # }