You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
The text was updated successfully, but these errors were encountered:
I was trying to do a cross join on a couple small tables:
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...... 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: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 whatj
should contain, at least whenby=
is present).The text was updated successfully, but these errors were encountered: