s-news
[Top] [All Lists]

Re: Question about tapply

To: Ad Feelders <ad@cs.uu.nl>
Subject: Re: Question about tapply
From: "David L Lorenz" <lorenz@usgs.gov>
Date: Fri, 19 Mar 2004 07:34:12 -0600
Cc: s-news@lists.biostat.wustl.edu, s-news-owner@lists.biostat.wustl.edu
Ad,
  The function tapply is a wrapper for lapply. Basically, it uses split to
create a list of the data and calls lapply with the valid data.  Try
something like this:

result <- lapply(split(data, factors), function)

Dave


                                                                                
                                                                    
                      Ad Feelders <ad@cs.uu.nl>                                 
                                                                    
                      Sent by:                         To:       
<s-news@lists.biostat.wustl.edu>                                                
   
                      s-news-owner@lists.biosta        cc:                      
                                                                    
                      t.wustl.edu                      Subject:  [S] Question 
about tapply                                                          
                                                                                
                                                                    
                                                                                
                                                                    
                      03/18/04 09:43                                            
                                                                    
                                                                                
                                                                    
                                                                                
                                                                    




Dear S users,

I'm running S+ 6 for windows.

I have the following problem with tapply. As it says in the documentation,
tapply calls FUN for each cell that has any data in it. I would like FUN
however to
handle the "no data situation" but since FUN isn't even called in that
case,
I can't. Does anybody know an elegant solution to this problem?

Best regards,

-Ad Feelders

---------------------------------------------------------------------------
Ad Feelders
Universiteit Utrecht
Institute of Information & Computing Sciences
PO Box 80089
3508 TB Utrecht
The Netherlands
ad@cs.uu.nl
Phone: +31 30 2533176

--------------------------------------------------------------------
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>