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

When using {} in RHS of :=, sometimes NULL does not remove a column. #5284

Closed
eutwt opened this issue Dec 11, 2021 · 0 comments · Fixed by #5289
Closed

When using {} in RHS of :=, sometimes NULL does not remove a column. #5284

eutwt opened this issue Dec 11, 2021 · 0 comments · Fixed by #5289
Labels
Milestone

Comments

@eutwt
Copy link

eutwt commented Dec 11, 2021

I installed from the GitHub master branch. I'm not understanding why the first result is not the same as the second.

library(data.table)

dd <- data.table(x = 1)
dd[, c('z', 'x') := {x <- NULL; list(2, NULL)}][]
#>        x     z
#>    <num> <num>
#> 1:     2     2
dd <- data.table(x = 1)
dd[, c('z', 'x') := {list(2, NULL)}][]
#>        z
#>    <num>
#> 1:     2
System Info
version
#>                _                           
#> platform       x86_64-apple-darwin17.0     
#> arch           x86_64                      
#> os             darwin17.0                  
#> system         x86_64, darwin17.0          
#> status                                     
#> major          4                           
#> minor          1.0                         
#> year           2021                        
#> month          05                          
#> day            18                          
#> svn rev        80317                       
#> language       R                           
#> version.string R version 4.1.0 (2021-05-18)
#> nickname       Camp Pontanezen

Created on 2021-12-11 by the reprex package (v2.0.1)

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