Skip to content
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

%in% returns repeated rows #1131

Closed
vttrifonov opened this issue Apr 28, 2015 · 1 comment
Closed

%in% returns repeated rows #1131

vttrifonov opened this issue Apr 28, 2015 · 1 comment

Comments

@vttrifonov
Copy link

The %in% operator has an unexpected behavior (see below). I am pretty sure this did not exist before (code which used to work, stopped working, because of this) but I cannot pinpoint the exact time when this happened.

-- example code begins here

library(data.table)

data.table 1.9.4 For help type: ?data.table

*** NB: by=.EACHI is now explicit. See README to restore previous behaviour.

sessionInfo()

R version 3.1.0 (2014-04-10)

Platform: x86_64-unknown-linux-gnu (64-bit)

locale:

[1] C

attached base packages:

[1] stats graphics grDevices utils datasets methods base

other attached packages:

[1] data.table_1.9.4

loaded via a namespace (and not attached):

[1] Rcpp_0.11.2 chron_2.3-45 plyr_1.8.1 reshape2_1.4 stringr_0.6.2

packageVersion("data.table")

[1] '1.9.4'

data.table(a=c(1, 2, 3))[a %in% c(1, 1, 2, 1),]

a

#1: 1
#2: 1
#3: 2
#4: 1

expected to see

a

#1: 1
#2: 2

@arunsrinivasan
Copy link
Member

Thanks, but fixed in 1.9.5 (one of the auto indexing bugs).

# v1.9.5
data.table(a=1:3)[a %in% c(1,1,2,1)]
#    a
# 1: 1
# 2: 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants