top_items: Display the salient items for each factor

View source: R/interpret.R

top_itemsR Documentation

Display the salient items for each factor

Description

Returns, per level and factor, the items whose absolute loading meets or exceeds cut, sorted by descending absolute loading. This gives a concise reading of "what each factor is about" without printing a full item-by-factor matrix, which does not scale well to large k or many items.

Usage

top_items(
  x,
  level = NULL,
  cut = 0.3,
  n = NULL,
  sort = TRUE,
  by = c("factor", "item"),
  show_labels = TRUE
)

Arguments

x

An ackwards object.

level

Integer vector selecting which level(s) to include. NULL (default) returns all levels.

cut

Absolute-loading threshold. Items with ⁠|loading| >= cut⁠ are shown. Default 0.3, matching the cut_show plotting default.

n

Maximum number of items to show per factor. NULL (default) shows all items meeting the cut. When set, the top-n items by ⁠|loading|⁠ are kept after applying the cut.

sort

Logical. When TRUE (default), items within each group are ordered by descending ⁠|loading|⁠. Set to FALSE to keep the original order (useful when items have a meaningful sequence).

by

One of "factor" (default) or "item". "factor" groups the listing by factor (the salient items of each factor – "what is this factor about?"). "item" inverts the grouping to list, for each item, the factors it loads on – which makes cross-loadings legible ("where does this item go?"). n and sort apply within whichever unit by selects.

show_labels

Logical. When TRUE (default) and the data carried a variable-label attribute at fit time (see ackwards()), items are shown as id: label; items without a label fall back to the bare id. Set to FALSE to always show the bare ⁠m{k}f{j}⁠-style item ids.

Details

Loadings are signed and reflect the object's primary-parent sign alignment (see ackwards()). Items near the cut threshold may appear for one sign orientation but not the other; this is expected and informative.

If factor labels have been attached, the factor dimension is shown as label (id) wherever it appears – the group headers under by = "factor" and the body entries under by = "item".

Value

An object of class "top_items". Print it for a grouped cli listing. The underlying data frame (one row per selected item) is accessible via ⁠$data⁠ and contains columns level, factor, item, and loading (plus label when labels are available). The values equal the corresponding tidy(x, what = "loadings") rows (after filtering and optional sorting).

See Also

tidy.ackwards(), label_template(), set_factor_labels(), autoplot.ackwards()

Examples

# Fit the raw dataset (not na.omit(), which would drop the column
# attributes): bfi25's IPIP item labels are then captured and printed as
# `code: label`. `missing = "listwise"` handles the NAs cleanly. A 10-item
# subset keeps the example fast; use all items in practice.
x <- ackwards(bfi25[, 1:10], k_max = 3, cor = "polychoric", missing = "listwise")
top_items(x)
top_items(x, level = 3, cut = 0.4, n = 5)

# Invert the grouping to read cross-loadings item-by-item
top_items(x, level = 3, cut = 0.25, by = "item")


ackwards documentation built on July 25, 2026, 1:08 a.m.