[R] Scatter plots using pairs()

Nestor Arguea narguea at uwf.edu
Tue Feb 11 21:54:35 CET 2014

Command pairs() does not show the correlation coefficient on the upper
diagonal of a set of scatter plots.  The command produces an error in
Windows 7, but it works fine in OS X Mavericks with the same R version
3.0.2.  Platform, R version and example under Windows 7 provided
[1] "i386-w64-mingw32"
[1] "R version 3.0.2 (2013-09-25)"


> set.seed(12345)
> x <- rnorm(10)
> y <- log(c(2:11))
> z <- data.frame(x,y)
> cor(z)
           x          y
x  1.0000000 -0.4867929
y -0.4867929  1.0000000
> pairs(z)
> pairs(z,upper.panel=panel.cor)
Error in pairs.default(z, upper.panel = panel.cor) :
  object 'panel.cor' not found


Nestor Arguea
Chair, Marketing and Economics
Director of International Business Programs
University of West Florida

More information about the R-help mailing list