FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

When using `{}` in RHS of `:=`, sometimes `NULL` does not remove a column. · Issue #5284 · Rdatatable/data.table · GitHub

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

Description

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL