-2

I have a data frame which has a column with some valid entries, some blank entries, and some entries with NA. I want to know which entries have either blank or NA. How do I do this?

One idea I had was to convert the blank entries to NA and then find the entries with NA, but how do I do this conversion?

Rich Scriven
  • 97,041
  • 11
  • 181
  • 245
quartz
  • 69
  • 2
  • 6
  • `which(df == "" | is.na(df), arr.ind = TRUE)` would be my guess. But without a reproducible example it would be a waste of time to go any further. – Rich Scriven Jun 17 '17 at 14:02
  • Your blank entries are empty strings, or they may be spaces as well? – moodymudskipper Jun 17 '17 at 14:11
  • This is why it's a waste of time to proceed to try and solve this without a repro example. – Rich Scriven Jun 17 '17 at 14:13
  • 1
    Maybe we ought to create a service that will restrict users (maybe with low rep) to post a question If a reproducible example is not detected. – Sotos Jun 17 '17 at 14:18

1 Answers1

1

Try :

nas <- which(is.na(df$col))
emptystrs <- which(df$col == "")
nas_or_empty <- which(is.na(df$col)|df$col == "")
moodymudskipper
  • 46,417
  • 11
  • 121
  • 167