[R] Finding NAs in DF
johannes_graumann at web.de
Tue Jan 18 12:07:41 CET 2011
Thank you very much got something running now based on this.
jim holtman wrote:
> building on the previous responses, does this give you what you want:
> A B
> 1 1 1
> 2 2 NA
> 3 NA NA
> 4 NA 4
>> # determine where the NAs are
>> row.na <- apply(x, 1, is.na)
>> # now convert to list of columns with NAs
>> apply(row.na, 2, function(a) paste(colnames(x)[a], collapse = ','))
>  "" "B" "A,B" "A"
> On Mon, Jan 17, 2011 at 5:01 AM, Johannes Graumann
> <johannes_graumann at web.de> wrote:
>> What is an efficient way to take this DF
>> and get
>> 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.
>> R-help at r-project.org mailing list
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html and provide commented,
>> minimal, self-contained, reproducible code.
More information about the R-help