I have a dataframe where some of the values are NA. I would like to remove these columns.
My data.frame looks like this
v1 v2 1 1 NA 2
Here's a convenient way to do it using the dplyr function select_if(). Combine not (!), any() and is.na(), which is equivalent to selecting all columns that don't contain any NA values.
dplyr
select_if()
!
any()
is.na()
library(dplyr) Itun %>% select_if(~ !any(is.na(.)))