format_correlation_table(PCoACorPlot, shortNames)

Format a PCA loading table with colour-coded cells and abbreviated trait names.

utilityvisualisation
Args:PCoACorPlot — loading data frameshortNames — abbreviated trait labels
format_correlation_table <- function(PCoACorPlot, shortNames) {
  cbind.data.frame(
    PCoACorPlot,
    color = shortNames[match(rownames(PCoACorPlot), shortNames$original), "color"],
    names = shortNames[match(rownames(PCoACorPlot), shortNames$original), "short"]
  )
}