[R] New column of data filled with the larger value from 2 columns

robgriffin247 robgriffin247 at hotmail.com
Wed Oct 26 12:00:57 CEST 2011


Hi,
I'm sure there is a pretty simple answer to this but I have had my head
buried in the R book and on help pages for a while now and I've not made any
progress.

In simple terms:
I have 2 columns of data, column A and column B. I want to create a new
column (C) and fill it with the largest value from of A or B on each row.


So I want C to contain A if B>A
and C to contain B if A=>B


Like I said I have tried to look for an answer and I'm sure there is one (or
many) out there but I am looking in the wrong places or for the wrong terms
so I would really appreciate this help! 


Thanks,
Rob.

(I promise that once I have mastered R- hopefully in the near future- I will
make up for my sins of asking a basic Q by answering many on here!)

--
View this message in context: http://r.789695.n4.nabble.com/New-column-of-data-filled-with-the-larger-value-from-2-columns-tp3940020p3940020.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list