Re: [R] find max value in different columns

2014-02-27 Thread arun
Hi, Try: dat <- read.table(text="ID    ONE  TWO  THREE 1    2  5    7 2    6  NA  NA 3    5  7    NA 4    1  NA  NA",sep="",header=TRUE) dat1 <- dat #Either: dat$MAX <- apply(dat[,-1],1,max,na.rm=TRUE) #or  dat1$MAX <- do.call('pmax',c(dat1[,2:4],list(na.rm=TRUE))

Re: [R] find max value in different columns

2014-02-27 Thread Mat
Thanks for the help. problem is solved. :-) -- View this message in context: http://r.789695.n4.nabble.com/find-max-value-in-different-columns-tp4685905p4685912.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org ma

Re: [R] find max value in different columns

2014-02-27 Thread PIKAL Petr
Hi if I name your data frame to YDF apply(YDF, 1, max, na.rm=FALSE) shall find row max values. Jyst add them as new column. Regards Petr > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Mat > Sent: Thursday, February 27, 2