File: drop_na.Rd

package info (click to toggle)
r-cran-tidyr 1.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,720 kB
  • sloc: cpp: 268; sh: 9; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 883 bytes parent folder | download | duplicates (2)
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))
}