Skip to content
Prev 262143 / 398502 Next

Sorting Dataframes

Hi:

Here's another approach using the plyr package:

# Write a function that takes a data frame as input and outputs a data frame
f <- function(df) df[which.max(df$Fish), ]
ddply(x, 'Bin', f)
  Bin Depth Fish
1   1     8   24
2   2     8   21
3   3    12   33

HTH,
Dennis
On Tue, Jun 7, 2011 at 3:32 PM, SamiC <s.cox.10 at aberdeen.ac.uk> wrote: