Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

distinct..html

Select distinct/unique rows


Description

Retain only unique/distinct rows from an input df.

Usage

distinct.(.df, ..., .keep_all = FALSE)

Arguments

.df

A data.frame or data.table

...

Columns to select before determining uniqueness. If omitted, will use all columns. tidyselect compatible.

.keep_all

Only relevant if columns are provided to ... arg. This keeps all columns, but only keeps the first row of each distinct values of columns provided to ... arg.

Examples

test_df <- tidytable(
  x = 1:3,
  y = 4:6,
  z = c("a", "a", "b")
)

test_df %>%
  distinct.()

test_df %>%
  distinct.(z)

tidytable

Tidy Interface to 'data.table'

v0.6.1
MIT + file LICENSE
Authors
Mark Fairbanks [aut, cre], Abdessabour Moutik [ctb], Matt Carlson [ctb], Ivan Leung [ctb], Ross Kennedy [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.