Skip to contents

Highlights the variables that contribute most to a selected principal component. The helper works with dense matrices returned by pca_variable_contributions() as well as with bigmemory::big.matrix objects via sampling.

Usage

pca_plot_contributions(
  contributions,
  component = 1L,
  top_n = 20L,
  draw = TRUE,
  ...
)

Arguments

contributions

Contribution matrix where rows correspond to variables and columns to components.

component

Integer index of the component to visualise.

top_n

Number of variables with the largest absolute contribution to include in the bar plot.

draw

Logical; set to FALSE to skip plotting.

...

Additional arguments passed to barplot().

Value

A data frame with the variables and their contributions is returned invisibly. When draw = TRUE, a bar plot of the top variables is produced.