Reputation: 801
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?
Upvotes: 1
Views: 893
Reputation: 20811
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)
}
Upvotes: 2