[R] abbreviate

Omar Lakkis uofiowa at gmail.com
Wed Jun 15 19:59:46 CEST 2005


> p = data.frame(high=c(5,2), settle=c(3,4))
> p
  high settle
1    5      3
2    2      4

What is the most abbreviated way to apply:
if (p$high < p$settle) p$high = p$settle

I want to modify p to become:
> p
  high settle
1    5      3
2    4      4




More information about the R-help mailing list