1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/drop-na.R
\name{drop_na}
\alias{drop_na}
\title{Drop rows containing missing values}
\usage{
drop_na(data, ...)
}
\arguments{
\item{data}{A data frame.}
\item{...}{<\code{\link[=tidyr_tidy_select]{tidy-select}}> Columns to inspect for
missing values. If empty, all columns are used.}
}
\description{
\code{drop_na()} drops rows where any column specified by \code{...} contains a
missing value.
}
\details{
Another way to interpret \code{drop_na()} is that it only keeps the "complete"
rows (where no rows contain missing values). Internally, this completeness is
computed through \code{\link[vctrs:vec_detect_complete]{vctrs::vec_detect_complete()}}.
}
\examples{
df <- tibble(x = c(1, 2, NA), y = c("a", NA, "b"))
df \%>\% drop_na()
df \%>\% drop_na(x)
vars <- "y"
df \%>\% drop_na(x, any_of(vars))
}
|