How to select columns that don't contain any NA
values in R? As long as a column contains at least one NA
, I want to exclude it. What's the best way to do it? I am trying to use sum(is.na(x))
to achieve this, but haven't been successful.
Also, another R question. Is it possible to use commands to exclude columns that contain all same values? For example,
column1 column2
row1 a b
row2 a c
row3 a c
My purpose is to exclude column1
from my matrix so the final result is:
column2
row1 b
row2 c
row3 c