-
Notifications
You must be signed in to change notification settings - Fork 990
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
setDF should drop indices #4889
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I think the problem is with
The correct behaviour (and the adjusted doc) should read as:
|
I agree with @tdeenes, raised this in the 2nd part of my comment above:
The 1st half still worries me too, but it might be a different bug. Also @jangorecki note that the update that uses |
Self contained repro (without loading anything, suitable for unit tests): d <- data.table(a=1:100, b=1:100)
invisible(d[a == 50])
setDF(d)
d[1:50, "a"] <- d[51:100, "a"]
setDT(d)
print(d[a == 99]) # one line, wrong result
# manual fix:
setindex(d,NULL)
print(d[a == 99]) # two lines, right result |
I created a single line PR for this |
ff2.zip
Attached is a small zip archive of a saved data.table that demonstrates a problem where sometimes the
[
operator gives misleading results.One way to show the correct result:
Many seemingly no-ops fix the data.table state. One example:
Tested on both Windows and Ubuntu, and data.table versions 1.13.6 and 1.11.8 correspondingly. (the sessionInfo below is of the windows machine)
#
Output of sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] data.table_1.13.6
loaded via a namespace (and not attached):
[1] bit_4.0.4 compiler_3.6.1 tools_3.6.1 bit64_4.0.5
The text was updated successfully, but these errors were encountered: