Skip to content
Prev 247499 / 398506 Next

Finding NAs in DF

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