0

How can I get all rows that contain any NA values in a dataframe using tidyverse syntax?

I was googling this, but have find it difficult to find an answer.

Eisen
  • 1,697
  • 9
  • 27
  • 1
    `NULL` is different than `NA`. What are you looking for? Can you provide an example and show expected output based on that? – Ronak Shah Jul 14 '20 at 01:59
  • When I call `sum(is.na(data))` in my dataframe it says I have 286 values that are NA. I'm just trying to see those rows which are NA. – Eisen Jul 14 '20 at 02:00
  • 2
    `data[rowSums(is.na(data)) > 0, ]` Or in `tidyverse` , `data %>% filter_all(any_vars(is.na(.)))` – Ronak Shah Jul 14 '20 at 02:01
  • It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Jul 14 '20 at 04:00

0 Answers0