Suppose you have a dataframe with 9 columns. You want to remove cases which have all NAs in columns 5:9. It\'s not at all relevant if there are NAs in columns 1:4.
S
You can use all with apply to find rows where all values are NA:
all
apply
NA
x[!apply(is.na(x[,5:9]), 1, all),]
or negate is.na and test for any:
is.na
any
x[apply(!is.na(x[,5:9]), 1, any),]
or using rowSums like @RHertel wher you dont need to calculate the number of selected rows:
rowSums
x[rowSums(!is.na(x[,5:9])) > 0,]