Skip to content
Prev 68928 / 398525 Next

"apply" question

----- Original Message ----- 
From: "Christoph Scherber" <Christoph.Scherber at uni-jena.de>
To: <r-help at stat.math.ethz.ch>
Sent: Monday, May 02, 2005 10:52 AM
Subject: [R] "apply" question
tmp <- rowSums(data[apply(data[,6:19],1,function(x) sum(is.na(x)))==0,1:5])

Now, tmp contains only the rowsums for the rows with no NAs in the other 
columns.

Sean