distinct

0th

Percentile

Select distinct/unique rows.

Retain only unique/distinct rows from an input tbl. This is an efficient version of unique. distinct() is best-suited for interactive use, distinct_() for calling from a function.

Usage
distinct(.data, ...)

distinct_(.data, ..., .dots)

Arguments
.data
a tbl
...
Variables to use when determining uniqueness. If there are multiple rows for a given combination of inputs, only the first row will be preserved.
.dots
Used to work around non-standard evaluation. See vignette("nse") for details.
Aliases
  • distinct
  • distinct_
Examples
df <- data.frame(
  x = sample(10, 100, rep = TRUE),
  y = sample(10, 100, rep = TRUE)
)
nrow(df)
nrow(distinct(df))
distinct(df, x)
distinct(df, y)

# You can also use distinct on computed variables
distinct(df, diff = abs(x - y))
Documentation reproduced from package dplyr, version 0.3, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.