Re: [R] Identifying case by groups in a data frame

2012-05-03 Thread Jorge I Velez
Dear José, Here is one way: # aux. function foo <- function(x, ...){ m <- mean(x, ...) S <- sd(x, ...) x > m + S } # result iris$rule <- with(iris, ave(Petal.Width, list(Species), FUN = foo)) head(iris) HTH, Jorge.- On Thu, May 3, 2012 at 5:19 P

[R] Identifying case by groups in a data frame

2012-05-03 Thread Jose Bustos Melo
Hi everyone, I would like to identify the case by groups that is just bigger that avg plus sd. For example, using species as group and petal.wid as my variable in the iris data. What's the better way to doit? creating a function? So,the question is to identify the single element of each species