I have a data frame that includes three columns that have numerical data. I would like to exclude cases where all three columns contain NA values, but not exclude columns where zero, one, or two of the columns contain NA values.
BA_B1_Con.2016 = data.frame(Cm20 = c(0.3, 0.4, 0.3, NA, NA, NA), Cm40 = c(NA, 0.3, 0.3, NA, 0.5, NA), Cm60 = c(0.5, NA, 0.5, NA, 0.4, NA))
I would like the 4th and 6th cases to be excluded since they equal NA values in all three columns, but would like the other NA values to remain in the data frame. I've tried to subset by indicating to exclude cases where all three columns equal NA, but that doesn't quite work right.
I've tried:
BA_B1_Con.2016 <- subset(BA_B1_Con.2016,Cm20 != "NA" & Cm40 != "NA" & Cm60 != "NA")
This doesn't quite work right. I believe I should be able to do this with the subset() function, but am open to other thoughts.
Thanks!