Skip to content
Prev 257810 / 398502 Next

Removing row with smallest value, for a given factor

On Apr 23, 2011, at 9:05 AM, - - wrote:

            
Consider using ave and creating a logical vector that you then negate:

 > ave(dat$index, list(dat$day), FUN=function(x) x==min(x))
  [1] 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0

dat[ -ave(dat$index, list(dat$day), FUN=function(x) x==min(x)), ]


--

David Winsemius, MD
West Hartford, CT