[R] Sorting elements in a data.frame
Liaw, Andy
andy_liaw at merck.com
Wed Jun 23 20:16:43 CEST 2004
Do you mean:
> pmax(x[,1], x[,2]) / pmin(x[,1], x[,2])
[1] 3.00 2.25 3.75 2.25
??
Andy
> From: Dan Bolser
>
> Hi,
>
> I have data like this....
>
> print(x)
>
> ID VAL1 VAL2
> 1 2 6
> 2 4 9
> 3 45 12
> 4 99 44
>
> What I would like is data like this...
>
> ID VAL1 VAL2
> 1 2 6
> 2 4 9
> 3 12 45
> 4 44 99
>
>
> So that my analysis of the ratio VAL2/VAL1 is somehow uniform.
>
> Any advice is welcome!
>
> Dan.
More information about the R-help
mailing list