1

I am using these lines of code to generate scatterplots between all the combinations of the columns of data: air . Is there any way to choose all the combinations of columns with a specific column? For example if we have 5 columns, I want only the scatterplots for the 3d column such as: 1-3, 2-3, 4-3, 5-3. Not all the combinations.

pairs(air, labels = colnames(air), main = "Pairs matrix", pch = 21, 
bg = c("red", "green3", "blue", "yellow"),
upper.panel = NULL)

1 Answers1

1

You could use the pairs2() function from the TeachingDemos package. e.g.:

library(TeachingDemos)
pairs2( airquality[3], airquality[,c(1,2,4,5) ], panel=panel.smooth)

enter image description here

Edgar Santos
  • 3,426
  • 2
  • 17
  • 29