You can only pass one argument in in functions used within tapply. Other
arguments need to be given as a parameters:
tapply(a, function(x,y) { out <- outer(x,y,"/") ; out[lower.tri(out)] }, y=b
)
-Christos
-----Original Message-----
From: s-news-owner@lists.biostat.wustl.edu
[mailto:s-news-owner@lists.biostat.wustl.edu] On Behalf Of Manoel Pacheco
Sent: Friday, April 21, 2006 1:08 PM
To: s-news@lists.biostat.wustl.edu
Subject: [S] function in tapply
My simple function
myout <- function(x,y) { out <- outer(x,y,"/") ; out[lower.tri(out)] }
works fine in the command line, but when I insert it in
tapply(a, b, function(x,y) { out <- outer(x,y,"/") ; out[lower.tri(out)]
} )
I get an error message:
Problem in FUN(...X.sub.i....): argument "y" is missing with no default Use
traceback() to see the call stack
I would appreciate suggestions on how to solve this problem.
Thanks,
Manolo
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu. To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with the
BODY of the message: unsubscribe s-news
|