MakeComDimScoresTable: MakeComDimScoresTable

View source: R/MakeComDimScoresTable.R

MakeComDimScoresTableR Documentation

MakeComDimScoresTable

Description

Creates a long (tidy) data frame with the global and/or local scores from a ComDim model, suitable for use with ggplot2.

Usage

MakeComDimScoresTable(
  model,
  blocks = NULL,
  dim = NULL,
  dim.ort = NULL,
  include = c("Q.scores", "T.scores", "Q.scores.ort", "T.scores.ort")[1:2]
)

Arguments

model

The output from a ComDim analysis (a ComDim object).

blocks

The blocks from which local scores will be extracted. A vector of integers (block indices) or block names. When omitted, all blocks are included. Only relevant when "T.scores" or "T.scores.ort" are in include.

dim

Integer vector of predictive component indices to include. When omitted, all predictive components in the model are included.

dim.ort

Integer vector of orthogonal component indices to include. When NULL, all orthogonal components present in the model are included. When 0, no orthogonal components are included.

include

Character vector selecting which score types to include. Accepted values (case-insensitive) are "Q.scores" (global predictive scores), "T.scores" (local predictive scores), "Q.scores.ort" (global orthogonal scores), and "T.scores.ort" (local orthogonal scores). Defaults to c("Q.scores", "T.scores").

Value

A long data frame with one row per sample–component–score-type combination, containing the following columns:

sample.id

Sample name (factor).

sample.id.number

Integer position of the sample (factor).

block.id

Block index, or "Global" / "Global.ort" for Q scores.

block.name

Block name, or "Global" / "Global.ort" for Q scores (factor).

dim

Component number.

scores.type

One of "Global", "Global.ort", "Local", or "Local.ort" (factor).

scores.type.dim

Concatenation of scores type and component number, e.g. "Q.scores1" (factor).

value

Score value.

See Also

MakeComDimLoadingsTable, ComDim_PCA

Examples

b1 <- matrix(rnorm(500), 10, 50) # 10 rows and 50 columns
b2 <- matrix(rnorm(800), 10, 80) # 10 rows and 80 columns
mb <- MultiBlock(Data = list(b1 = b1, b2 = b2))
model <- ComDim_PCA(mb, ndim = 2)
tbl <- MakeComDimScoresTable(model)

R.ComDim documentation built on May 13, 2026, 9:07 a.m.