s-news
[Top] [All Lists]

Re: function in tapply

To: "'Manoel Pacheco'" <mpacheco@glec.com>, "'Rosenfeld, Simon (NIH/NCI) [E]'" <rosenfes@mail.nih.gov>
Subject: Re: function in tapply
From: <Rich@Mango-Solutions.com>
Date: Sat, 22 Apr 2006 11:39:09 +0100
Cc: <s-news@lists.biostat.wustl.edu>
In-reply-to: <006a01c66588$e86998f0$0401a8c0@Manolo>
Thread-index: AcZliOIa/dbDMgDLSYOE2nlRjo4HgQAb7A5g
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


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