s-news
[Top] [All Lists]

Re: function in tapply

To: "'Manoel Pacheco'" <mpacheco@glec.com>, <s-news@lists.biostat.wustl.edu>
Subject: Re: function in tapply
From: "Christos Hatzis" <christos@nuverabio.com>
Date: Fri, 21 Apr 2006 13:12:01 -0400
In-reply-to: <001501c66566$144f03b0$0401a8c0@Manolo>
Organization: Nuvera Biosciences
Reply-to: <christos@nuverabio.com>
Thread-index: AcZlZg3YUPYST4GDTp6Y3Nfv8HmYngAAFlLA
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




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