1

Is there an easy way how Hmisc labels that have been defined earlier appear in a complex R plot e.g. a SPLOM (scatter plot matrix)?enter image description here

# defining labels
library(Hmisc)
label(mtcars$mpg) <- "Miles per gallon"
label(mtcars$qsec) <- "quarter mile time"

# SPLOM
library(psych)
pairs.panels(mtcars[, c("mpg", "qsec")])

In that case instead of "mpg" there should be "miles per gallon" in the plot.

ehi
  • 409
  • 8
  • 23

1 Answers1

1

We can use setNames to change the names

pairs.panels(setNames(mtcars[c("mpg", "qsec")], c("Miles per gallon", "quarter mile time")))

enter image description here

akrun
  • 874,273
  • 37
  • 540
  • 662