Re: [R] Finding a max

2012-11-21 Thread Ignacio Martinez
Thanks a lot! On Wed, Nov 21, 2012 at 12:51 PM, Rui Barradas wrote: > Hello, > > You're complicating what is simple: > > > prop3$effort[which.max(prop3$**Low)] # First maximum of Low > prop3$effort[which.max(prop3$**High)] # Ditto, of High > > which.max(prop3$Low) # Row number that maximizes

Re: [R] Finding a max

2012-11-21 Thread Bert Gunter
On Wed, Nov 21, 2012 at 9:51 AM, Rui Barradas wrote: > Hello, > > You're complicating what is simple: Fortune? (Well, it's a profound truism that we all should live by -- but I leave it to others to judge whether it meets Fortunes criteria). -- Bert > > > prop3$effort[which.max(prop3$Low)] # F

Re: [R] Finding a max

2012-11-21 Thread Rui Barradas
Hello, You're complicating what is simple: prop3$effort[which.max(prop3$Low)] # First maximum of Low prop3$effort[which.max(prop3$High)] # Ditto, of High which.max(prop3$Low) # Row number that maximizes Low which.max(prop3$High) # Row number that maximizes High Hope this helps, Rui Barr

[R] Finding a max

2012-11-21 Thread Ignacio Martinez
My data looks like this: X Y1(X) Y2(X) i want to find the values of x that maximize Y1 and Y2. Right now I'm getting the answer but I would like to know if there is a more efficient/elegant way of doing this. This code reproduces what I'm doing: [code] prop3<-structure(list(effort = c(0, 0.00898