Drop rows containing missing values

drop_na(data, ...)

Arguments

data

A data frame.

...

Specification of variables to consider while dropping rows. If empty, consider all variables. Use bare variable names. Select all variables between x and z with x:z, exclude y with -y. For more options, see the select documentation.

See also

drop_na_ for a version that uses regular evaluation and is suitable for programming with.

Examples

library(dplyr) df <- data_frame(x = c(1, 2, NA), y = c("a", NA, "b")) df %>% drop_na()
#> # A tibble: 1 × 2 #> x y #> <dbl> <chr> #> 1 1 a
df %>% drop_na(x)
#> # A tibble: 2 × 2 #> x y #> <dbl> <chr> #> 1 1 a #> 2 2 <NA>