New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

index should be removed after unique method #1760

Closed
jangorecki opened this Issue Jul 1, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@jangorecki
Member

jangorecki commented Jul 1, 2016

from SO:

library(data.table)
test <- data.table(a = c("1", "1", "2", "2", "3", "4", "4", "4"), 
                   b = letters[1:8], 
                   d = c(TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE))
test[d == TRUE, `:=`(b = "M")] # create index
utest <- unique(test, by = c("a", "b"))
stopifnot(nrow(utest[d == TRUE])==2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment