Learn R Programming

specmine (version 4.0.0)

ica_loadingsplot: ICA loadings plot

Description

Creates a two-dimensional plot of the loadings associated with two independent components.

Usage

ica_loadingsplot(ica.result, dims = c(1, 2), top.n = NULL, labels = FALSE)

Value

A ggplot object.

Arguments

ica.result

Result returned by ica_analysis_dataset().

dims

Two independent components whose loadings should be plotted.

top.n

Optional number of variables with the largest loading magnitude to display.

labels

Logical indicating whether variable labels should be displayed.

Examples

Run this code
if (requireNamespace("fastICA", quietly = TRUE)) {
  datamat <- matrix(
    rnorm(240),
    nrow = 8,
    dimnames = list(
      paste0("feature", 1:8),
      paste0("sample", 1:30)
    )
  )

  dataset <- list(data = datamat)

  ica.result <- ica_analysis_dataset(
    dataset,
    n_components = 2,
    maxit = 100,
    seed = 42
  )

  ica_loadingsplot(
    ica.result,
    dims = c(1, 2),
    labels = TRUE
  )
}

Run the code above in your browser using DataLab