variableNames-set-MultiBlock-method: variableNames<-

variableNames<-R Documentation

variableNames<-

Description

Set the variable names of a MultiBlock object. value must be a named list with one entry per block, where each entry is a vector of variable names whose length matches the number of columns in that block.

Usage

variableNames(x) <- value

## S4 replacement method for signature 'MultiBlock'
variableNames(x) <- value

Arguments

x

A MultiBlock object.

value

A named list of variable-name vectors, one per block.

Details

To update a single block, use standard list-replacement chaining: variableNames(mb)[["b1"]] <- newNames

Value

The updated MultiBlock object.

Examples

b1 <- matrix(rnorm(500), 10, 50)
b2 <- matrix(rnorm(800), 10, 80)
mb <- MultiBlock(Data = list(b1 = b1, b2 = b2))

# Replace all at once:
variableNames(mb) <- list(
  b1 = paste0("v", 1:50),
  b2 = paste0("v", 1:80)
)

# Replace a single block using chaining:
variableNames(mb)[["b1"]] <- paste0("feat_", 1:50)

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