The call to tapply should be ...
> tapply ( A SINGLE VECTOR, A FACTOR OR LIST OF FACTORS, A FUNCTION )
That is why your function call is not working ...
Are you trying to do this?
> outer( 1:2, 3:4 )
[,1] [,2]
[1,] 3 4
[2,] 6 8
Rich.
-----Original Message-----
From: s-news-owner@lists.biostat.wustl.edu
[mailto:s-news-owner@lists.biostat.wustl.edu] On Behalf Of Manoel Pacheco
Sent: 21 April 2006 22:17
To: Rosenfeld, Simon (NIH/NCI) [E]
Cc: s-news@lists.biostat.wustl.edu
Subject: [S] function in tapply
Simon,
The bad news is that your solution did not work:
a <- c(1,2); b <- c(3,4)
xy<-list(X=a, Y=b)
fun<-function(x){
X<-x$X
Y<-y$Y
outer(X, Y, "/")
}
result<-tapply (X=xy, FUN=fun)
Error Message:
Problem in tapply(X = xy, FUN = fun): argument "INDICES" is missing with no
default
The good news is that I was able to solve my problem without using tapply.
Thanks! I sincerely appreciate your support.
Manolo
PS I tried many variations on your code before sending this message
--------------------------------------------------------------------
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
|