s-news
[Top] [All Lists]

panel function works in R, not s-plus

To: s-news@wubios.wustl.edu
Subject: panel function works in R, not s-plus
From: David Parkhurst <parkhurs@imap.iu.edu>
Date: Mon, 28 Aug 2006 09:42:29 -0400
User-agent: Thunderbird 1.5.0.5 (Windows/20060719)
The following code, modified from the R help page for pairs(), works in R, but in the s-plus Enterprise Developer Version 7.0.6 for Microsoft Windows, I get the error message that follows it. How can I get these same effects in s-plus? (The effects are pairs plots with lowess curves in the lower triangle, and numerical correlation coefficients in the upper triangle.)

Here's the code:

panel.cor <- function(x, y, digits=2, prefix="", cex.cor)
{
    usr <- par("usr"); on.exit(par(usr))
    par(usr = c(0, 1, 0, 1))
    r <- (cor(x, y))  # abs
    txt <- format(c(r, 0.123456789), digits=digits)[1]
    txt <- paste(prefix, txt, sep="")
    if(missing(cex.cor)) cex <- 0.95/strwidth(txt)
    text(0.5, 0.5, txt) #, cex = cex * r)
}
pairs(the.data, lower.panel=panel.smooth, upper.panel=panel.cor)

and here is the error message:

Problem in pairs.data.frame(for.pairs, lower.panel = panel.smooth, upp..: Can't pass data of mode "function" to old-S function

Thanks for any help you can provide

David Parkhurst

<Prev in Thread] Current Thread [Next in Thread>