robgriffin247 <robgriffin247 <at> hotmail.com> writes:

> 
> 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.
> 

  sounds like you want data$C <- pmax(data$A,data$B)
(or data <- transform(C,pmax(A,B)))

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to