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

Set columns with a named list. do.call(":=", list()) #4950

Closed
myoung3 opened this issue Apr 2, 2021 · 2 comments
Closed

Set columns with a named list. do.call(":=", list()) #4950

myoung3 opened this issue Apr 2, 2021 · 2 comments
Labels
programming parameterizing queries: get, mget, eval, env

Comments

@myoung3
Copy link
Contributor

myoung3 commented Apr 2, 2021

A request for this to work seen in the wild: https://stackoverflow.com/questions/66917673/set-multiple-columns-in-r-data-table-with-a-named-list-and

library(data.table)
dt <- data.table(a=0)
dt[, do.call(`:=`, list(b=1,c=2))]
#> Error in (function (...) : Check that is.data.table(DT) == TRUE. Otherwise, := and `:=`(...) are defined for use in j, once only and in particular ways. See help(":=").

Created on 2021-04-02 by the reprex package (v1.0.0)

@myoung3 myoung3 changed the title do.call(:=, list()) do.call(":=", list()) Apr 2, 2021
@myoung3 myoung3 changed the title do.call(":=", list()) Set columns with a named list. do.call(":=", list()) Apr 2, 2021
@myoung3
Copy link
Contributor Author

myoung3 commented Apr 2, 2021

@myoung3
Copy link
Contributor Author

myoung3 commented Apr 2, 2021

closing since this is actually a duplicate of #1543.

@myoung3 myoung3 closed this as completed Apr 2, 2021
@jangorecki jangorecki added the programming parameterizing queries: get, mget, eval, env label Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
programming parameterizing queries: get, mget, eval, env
Projects
None yet
Development

No branches or pull requests

2 participants