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

single symbol in j behaves strangely #2983

Closed
franknarf1 opened this issue Jul 20, 2018 · 2 comments
Closed

single symbol in j behaves strangely #2983

franknarf1 opened this issue Jul 20, 2018 · 2 comments
Labels
duplicate non-atomic column e.g. list columns, S4 vector columns

Comments

@franknarf1
Copy link
Contributor

franknarf1 commented Jul 20, 2018

I was trying to do a cross join on a couple small tables:

library(data.table)
# data.table 1.11.5 IN DEVELOPMENT built 2018-07-11 03:11:00 UTC; travis  Latest news: http://r-datatable.com
idDT  = data.table(id = 1:2)
varDT = data.table(v = letters[1:3], x = 4:6)

idDT[, varDT, by=id]
# Error in FUN(X[[i]], ...) : 
#   Invalid column: it has dimensions. Can't format it. If it's the result of data.table(table()), use as.data.table(table()) instead.

idDT[, (varDT), by=id]
# as expected

So it didn't recognize that varDT is a list of columns (which is what we typically want in j, from my understanding). If I use a list instead of a data.table...

>     L = as.list(varDT); idDT[, L, by=id]
   id     L
1:  1 a,b,c
2:  1 4,5,6
3:  2 a,b,c
4:  2 4,5,6

... something different but still weird/wrong happens. I thought maybe I needed to use the .. prefixes since I'm accessing an object one level up, but no dice there either:

>     L = as.list(varDT); idDT[, ..L, by=id]
Error in `[.data.table`(idDT, , ..L, by = id) : 
  Internal error:  DT[, ..var] should be dealt with by the branch above now.

I also tried options(datatable.WhenJisSymbolThenCallingScope=TRUE) from the FAQ but saw the same behavior.

If there's logic assuming that any bare symbol in j should be a single column, I guess it would make more sense to assume it's a list of columns (since that's what j should contain, at least when by= is present).

@MichaelChirico
Copy link
Member

Related: #1090, #814, #1717, #2343

@jangorecki jangorecki added the non-atomic column e.g. list columns, S4 vector columns label Apr 5, 2020
@jangorecki
Copy link
Member

AFAIK duplicate of #1473

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate non-atomic column e.g. list columns, S4 vector columns
Projects
None yet
Development

No branches or pull requests

3 participants