When writing some expression that operates in j
on a data.table
, .SD
doesn't contain all the columns in the table but rather only the ones that the expression uses. This is fine for running things but isn't awesome for debugging. What's the best way to see all the columns? I can pass all the names to .SDcols
but this seems fairly tedious. Ex:
x = data.table(a=1:10, b=10:1, id=1:5)
x[,{ browser(); a+1},by=id]
Called from: `[.data.table`(x, , {
browser()
a + 1
}, by = id)
Browse[1]> n
debug at #1: a + 1
Browse[1]> .SD
a
1: 1
2: 6