My dataset consists of numeric columns, with some missing (i.e. NA) values. I want to find the rows that consist entirely of NA values. For example:
library(tidyverse)
library(magrittr)
frm <- tribble(
~A, ~B, ~C,
11, 22, 33,
14, NA, 37,
10, 29, 36,
NA, NA, NA,
18, 28, 38
)
I could process each row in a for-loop, using is.na() and all(), but I'd like to find a "tidy" solution. This is the best I could do:
frm %>%
rowwise %>%
summarize(all_values_missing = is.na(A) & is.na(B) & is.na(C))
But this approach doesn't scale to datasets with lots of columns and nontrivial column-names. Any ideas would be much appreciated!