1

I know pairs(df) is a great way to do scatter plots in finding possible correlations in variables with say about max 10 variables, but is there a way to plot scatter plots for say 200 variables?

1
  • 2
    It depends on what you want it to look like. You can use a bigger page with all 200 or you could break the 200 variables into sets and do pairs() on each... Commented May 1, 2015 at 16:22

1 Answer 1

2

as @AlexA suggested, one way:

n <- 5
ii <- cumsum(seq.int(ncol(mtcars)) %% n == 0)

pdf('~/desktop/tmp.pdf')
for (i in unique(ii))
  pairs(mtcars[, ii %in% i])
dev.off()

or to get a quick look at them

for (i in unique(ii)) {
  pairs(mtcars[, ii %in% i])
  Sys.sleep(2)
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.