I have the following dataframe:
DF <- data.frame(x = c(1, 2, 3,NA), y = c(1,0, 10, NA), z=c(43,NA, 33, NA))
If I want to omit only x = NA and z = NA.
complete.cases deletes all the row contains NA for desired column.
Therefore, I am not sure how to only delete the last row in the dataframe DF.
Not clear whether you want to exclude rows where x OR z = NA or x AND z = NA. Change the boolean from and
&to or|if that’s the case: