you probably want to use the apply function: d=sample(1000,500); d[sample(500,50)]<-NA; #put 50 NAs into the data d=data.frame(matrix(d,ncol=50)); names(d)=paste('var',1:50,sep='.') d apply(d,1,sum) #are any of the row values NA ? apply(d,2,function(x)sum(is.na(x))) #how many values for each of the 50 variables are NA ?
David Freedman, CDC -- View this message in context: http://r.789695.n4.nabble.com/data-management-Rowwise-NA-tp2242232p2242260.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.