I have a data frame such as
ID a b c
29 NA 2 NA
11 3 1 1
9 NA NA NA
I'd like to pull out the rows that have at least 1 value filled in for all the columns except for the ID
. For example, the row with ID=9
would not satisfy that condition, because all the columns after the ID
column are NA
.
You might think one way would be
d = d[!is.na(d$a) | !is.na(d$b) | !is.na(d$c),]
however in my case, there are like 20 columns after the ID
column, not just three.
What's a better way to do this?