distinct.: Select distinct/unique rows

Description Usage Arguments Examples

View source: R/distinct.R

Description

Retain only unique/distinct rows from an input df.

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
test_df <- tidytable(
  x = 1:3,
  y = 4:6,
  z = c("a", "a", "b")
)

test_df %>%
  distinct.()

test_df %>%
  distinct.(z)

mtfairbanks/gdt documentation built on May 4, 2021, 9:44 a.m.