Learn R Programming

mark (version 0.8.1)

unique_rows: Unique rows

Description

Drops duplicated rows

Usage

unique_rows(data, cols = NULL, from_last = FALSE, invert = FALSE)

Value

data will duplicates removes

Arguments

data

A data.frame

cols

Columns to compare against; when NULL selects all columns

from_last

When TRUE returns the last row containing duplicates, rather than the first

invert

If TRUE returns the duplicated rows

Examples

Run this code
df <- quick_dfl(
  i = 1:4,
  a = rep(1:2, 2L),
  b = rep("a", 4L),
)

unique_rows(df, 2:3)
unique_rows(df, c("a", "b"), from_last = TRUE, invert = TRUE)

Run the code above in your browser using DataLab