Re: [R] Returning a vector from by

2008-11-03 Thread ronggui
If you just want that result, you can try tapply instead of by. > tapply(res$Score,res$ID,max) a b 2 1 On Mon, Nov 3, 2008 at 7:31 PM, Daniel Brewer <[EMAIL PROTECTED]> wrote: > Hello, > > I am trying to return a vector from a simply by but I cannot get it > working, even using simplify=TRUE. > >

[R] Returning a vector from by

2008-11-03 Thread Daniel Brewer
Hello, I am trying to return a vector from a simply by but I cannot get it working, even using simplify=TRUE. res <- data.frame(ID=c("a","a","a","b","b"),Score=c(0,1,2,0,1)) yoda <- by(res$Score,res$ID,max,simplify=T) class(yoda) [1] "by" I would like it to return a vector with the names as the