[R] apply problem

Greg Snow snow at fisher.byu.edu
Mon Mar 18 19:57:09 CET 2002


On Sun, 17 Mar 2002 ggrothendieck at yifan.net wrote:

> 
> > > > > > apply(iris3,1,function(x)identical(x,iris3[1,]))
> > > > >     1     2     3
> > > > > FALSE FALSE FALSE
> > > > >
> > > > > What's wrong here?
[snip]
> OK.  Efficiency aside,I believe it would still be nice to have this ability 
> for compactness.  Here are some ideas:

How about:

> sapply( seq(along=iris3[,1]), function(x,y) identical(y[x,], iris3[1,]),
+ y=iris3)
[1]  TRUE FALSE FALSE


-- 
Greg Snow, PhD                Office: 223A TMCB
Department of Statistics      Phone:  (801) 378-7049
Brigham Young University      Dept.:  (801) 378-4505
Provo, UT  84602              email:  gls at byu.edu

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list