statar (version 0.1.1)

duplicates: returns duplicated rows

Description

returns duplicated rows

Usage

duplicates(x, ..., by = NULL, gen = "N")

duplicates_(x, vars, by = NULL, gen = "N")

Arguments

x
a data.table
...
Variables to keep (beyond the by variable). Default to all variables. See the select documentation.
by
Variable to group by. Default is the key, or everything is the data.table is not keyed.
gen
A character that specifies the name of a new variable with the number of duplicates. Default to "N".
vars
Used to work around non-standard evaluation.

Value

  • a data.table with groups that have duplicates.

Examples

Run this code
library(data.table)
DT <- data.table(a = rep(1:2, each = 3), b = 1:6)
duplicates(DT, by = "a")
duplicates(DT, by = list(a,b))

Run the code above in your browser using DataLab