[R] Unique Pairs based on a Minimum Value

2007-11-05 Thread Bret Collier
RUsers, I am trying (with little success) to determine how to combine unique and min to do some data frame manipulations and I could use a little advice. I have tried various combinations of 'unique', 'min' and 'apply' with no luck. Given this simple example data (x, y) x-c(10, 10, 12, 13,

Re: [R] Unique Pairs based on a Minimum Value

2007-11-05 Thread jim holtman
Here is one way of doing it: z - as.data.frame(cbind(x, y)) a - by(z, z$x, function(b) b[which.min(b$y),]) do.call('rbind', a) x y 10 10 112 12 12 111 13 13 117 15 15 114 16 16 113 17 17 119 On 11/5/07, Bret Collier [EMAIL PROTECTED] wrote: RUsers, I am trying (with little success)