Skip to content

Commit

Permalink
Address dt lock issue in data.table < 1.9.8 Rdatatable/data.table#1341
Browse files Browse the repository at this point in the history
  • Loading branch information
Grant Nguyen committed Jan 30, 2017
1 parent f2b6bd7 commit 5dba65e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/assert_ids.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ assert_ids <- function(data, id_vars, assert_combos=TRUE, assert_dups=TRUE, ids_
}
if(assert_dups == TRUE & nrow(data_ids) != nrow(data)) {
data <- data.table(data)
duplicates <- data[duplicated(data[, .SD, .SDcols=id_varnames]), .SD, .SDcols=id_varnames]
duplicates <- data[duplicated(data[, .SD, .SDcols=id_varnames])]
duplicates <- duplicates[, .SD, .SDcols=id_varnames] # Subset columns separately to avoid dt lock issue in <1.9.8 https://github.com/Rdatatable/data.table/issues/1341
nrow_duplicates <- nrow(duplicates)

## Get the total number of duplicates in each id combination.
Expand Down

0 comments on commit 5dba65e

Please sign in to comment.