Hello.  I want to construct a scatterplot matrix in which the above-diagonal
panels represent values from a control group while the below-diagonal values
represent values from a treatment group.  I have managed to write primative
panel functions (below) but cannot figure out how to pass arguments to these
panel functions.
 
Here is the panel function for the upper.panel argument of pairs:
> my.upper.panel
function(x,y,treat.value=1,...)
{points(x[dat$treat==treat.value],y[dat$treat==treat.value],pch=16)}
 
Here is the panel function for the lower.panel agument of pairs:
> my.lower.panel
function(x,y,treat.value=2,...)
{points(x[dat$treat==treat.value],y[dat$treat==treat.value],pch=1)}

Now, if I simply call: >
pairs(~x+y+z,data=dat,lower.panel=my.lower.panel,upper.panel=my.upper.panel)
 
I get what I want.  "dat" is a data frame with four columns called "treat",
x, y, z and "treat" has values of 1 or 2.
 
I want to be able to specify the value of "treat.value" in my panel
functions within the call to pairs in cases in which the values of "treat"
are different from 1 or 2.  Something like:
 
pairs(~x+y+z,data=dat,lower.panel=my.lower.panel(treat.value=2),upper.panel=
my.upper.panel(treat.value=1))
 
However, when I do this, I get the error message:
 
>
pairs(~x+y+z,data=dat,lower.panel=my.lower.panel(treat.value=2),upper.panel=
my.upper.panel(treat.value=1))
Error in points(x[dat$treat == treat.value], y[dat$treat == treat.value],  :

        argument "x" is missing, with no default

Question: how can one pass along different values of arguments from within a
panel function such as I have described?
 

 

Bill Shipley

 

 

        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to