As a still relative beginner to the nuances of S & SPlus, I'm having a bit
of difficulty coping with the scoping rules of S.
Consider the following trivial function:
myfunction<-function(x,y)
{
apply(x, 2, function(x,y) { tapply (x, y, mean)}
}
If I run this function, I get an error of the sort:
Error in FUN: Argument "y" is missing, with no default: FUN(X)
Dumped
Why is "y" invisible to the second function call when it is given as an
explicit argument?
How would I fix it?
Where would I find more information on the scoping rules for this type of
function development (i.e. where I call S-functions that have their own
function arguments inside of a user-developed function)?
Marc Feldesman
P.S. I am aware of the very clear example given in VR2 on page 154,
warning of this sort of scoping visibility problem. Their solution simply
doesn't work here, unless I'm "applying" it wrong.
Dr. Marc R. Feldesman
email: feldesmanm@pdx.edu
email: feldesman@ibm.net
fax: 503-725-3905
"Math is hard. Let's go to the mall" Barbie
Powered by: Monstrochoerus - the 300 MHz Pentium II
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
|