[R] Finding NAs in DF

Johannes Graumann johannes_graumann at web.de
Mon Jan 17 11:01:46 CET 2011


Hi,

What is an efficient way to take this DF

	data.frame(A=c(1,2,NA,NA),B=c(1,NA,NA,4))

and get 
	c(NA,"TWO","BOTH","ONE")

as the result, where NA corresponds to a row without "NA"s, TWO indicates NA 
in the second and ONE in the first column.

Thanks for any pointers.

Joh



More information about the R-help mailing list