2 ms·
Thank you for the link. I still end up confused. How does selecting the 3rd column, dt[, 3] jive with >`DT[i, j, by, ...]` which means: “Take DT, subset
by wodenokoto 7y ago
Thank you for the link. I still end up confused.
How does selecting the 3rd column,
dt[, 3]
jive with
>`DT[i, j, by, ...]` which means: “Take DT, subset rows using i, then calculate j ...
I don’t understand how column selection and calculating an expression is the same thing.
So now I can’t figure out if
DT[, sum(V1)]
Will return the column indexed at the sum of V1 or if it will return the sum of the column called V1. How can I tell, from the syntax?
- nojito 7y agoj is always for columns. So for your first example it grabs the third column. The calculation you’re performing is a column selection. For your second example, you’re returning all the rows, selecting column V1, and summing it. I really prefer to name the operations dt[rows, columns, groups]