library(data.table)
DT = data.table(id = c(1L,1L,2L), v = 1:3)
DT[, first(.SD), by=id, .SDcols="v", verbose = TRUE]
# Finding groups using forderv ... 0 sec
# Finding group sizes from the positions (can be avoided to save RAM) ... 0 sec
# lapply optimization is on, j unchanged as 'first(.SD)'
# GForce optimized j to 'gfirst(.SD)'
Error in gfirst(.SD) :
GForce head can only be applied to columns, not .SD or similar. To get head of all items in a list such as .SD, either add the prefix utils::head(.SD) or turn off GForce optimization using options(datatable.optimize=1).
I tried head and it did work, contrary to the error message:
DT[, head(.SD, 1L), by=id, .SDcols="v", verbose=TRUE]
# Finding groups using forderv ... 0.02 sec
# Finding group sizes from the positions (can be avoided to save RAM) ... 0 sec
# lapply optimization changed j from 'head(.SD, 1L)' to 'list(head(v, 1L))'
# GForce optimized j to 'list(ghead(v, 1L))'
# Making each group and running j (GForce TRUE) ... 0 secs
# id v
# 1: 1 1
# 2: 2 3
Not a big deal and maybe it'll be handled in the process of of doing #735
The text was updated successfully, but these errors were encountered:
I tried this and got an error:
I tried head and it did work, contrary to the error message:
Not a big deal and maybe it'll be handled in the process of of doing #735
The text was updated successfully, but these errors were encountered: