Learn R Programming

RGCCA (version 3.0.3)

rgcca_transform: Reduce dimensionality using RGCCA

Description

This function projects testing blocks using the block weight vectors of a fitted RGCCA object.

Usage

rgcca_transform(rgcca_res, blocks_test = rgcca_res$call$blocks)

Value

A list of matrices containing the projections of the test blocks using the block weight vectors of a fitted RGCCA object.

Arguments

rgcca_res

A fitted RGCCA object (see rgcca).

blocks_test

A list of blocks (data.frame or matrix) to be projected.

Examples

Run this code
data("Russett")
blocks <- list(
  agriculture = Russett[, 1:3],
  industry = Russett[, 4:5],
  politic = Russett[, 6:11])

Xtrain <- lapply(blocks, function(x) x[1:32, ])
Xtest <- lapply(blocks, function(x) x[33:47, ])
fit_rgcca <- rgcca(Xtrain, ncomp = 2)
projection <- rgcca_transform(fit_rgcca, Xtest)

Run the code above in your browser using DataLab