Skip to contents

This function centers the line weights of an `ena.set` by subtracting the mean of each connection from all units. This is a standard step in preparing data for rotation.

Usage

center(x, add.meta = TRUE, exclude_zero_networks = FALSE)

Arguments

x

An `ena.set` object (typically after `sphere_norm()`) or a numeric matrix.

add.meta

A logical value. If `TRUE` (the default), metadata is preserved. Ignored if `x` is a matrix.

exclude_zero_networks

A logical value. If `TRUE`, units whose line weights are all zero are excluded when computing the column means used for centering. The mean is computed from non-zero units only, but all units (including zero-network ones) are shifted by that mean. This prevents empty networks from pulling the centroid toward zero. Defaults to `FALSE` (standard behaviour: all units contribute to the mean). Use `TRUE` for ordered/directed ENA sets produced by `accumulate(ordered = TRUE)`.

Value

If `x` is an `ena.set`, it returns the modified `ena.set` with the centered data stored in `x$model$points.for.projection`. If `x` is a matrix, it returns a centered matrix.

Examples

data(RS.data)

codes <- c("Data", "Technical.Constraints", "Performance.Parameters",
           "Client.and.Consultant.Requests", "Design.Reasoning",
           "Collaboration")
units <- c("Condition", "UserName")
horizon <- c("Condition", "GroupName")
enaset <- RS.data |>
  accumulate(units, codes, horizon) |>
  sphere_norm() |>
  center()