-
Notifications
You must be signed in to change notification settings - Fork 991
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
Weird consequence (bug?) of using setattr() #1281
Comments
Oops, it must be related to the R internals. I just realized that the |
This is a really cool find :) It appears that > address(TRUE)
[1] "00000000105DEAC8"
> address(TRUE)
[1] "00000000105E1370"
> address(!FALSE)
[1] "00000000003E0F20"
> address(!FALSE)
[1] "00000000003E0F20" And that address of > address(3 > 0)
[1] "00000000003E0F20" So that's what you're seeing, but I have no idea what the underlying design decisions are here. |
Maybe worth posting this in bugzilla |
Not a bug in R. We've to account for length-1 vectors. I think this was a change in Rv3.1 |
@arunsrinivasan what does that mean? |
Arun, you are right. The bug is restricted to length-1 vectors, for example calling |
1 @tdeenes nice find. |
TRUE and FALSE are not affected by setattr(), as expected:
However, consider the following (open a new console to exclude the possibility of any interference):
NOTE: the whole problem disappears if we ask for an explicit copy before the setattr() call (just insert a line:
out <- copy(out)
before the setattr() command).My session info (with the very latest github version of data.table; the same problem also occurs on the CRAN version):
The text was updated successfully, but these errors were encountered: