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
Submitted by: Michele Carriero; Assigned to: Nobody; R-Forge link
Please consider the following:
dt <- data.table(a=sample(letters, 100, T), b=rnorm(100))
dt[ a=="c", list(.N, .I)]
N .I
1: 412: 423: 434: 44dt[a=="c", list(.N, .I), by=a]
a N .I
1: c 4542: c 4673: c 4714: c 486
The first statement subsets the table first and then calculates locations. The second shows the original location of all rows having a=="c".
Unless there are reasons (which I'm currently missing) for which the above needs to happen, I think that both expressions should give the second result.
Regards,
Michele.
The text was updated successfully, but these errors were encountered:
Submitted by: Michele Carriero; Assigned to: Nobody; R-Forge link
Please consider the following:
The first statement subsets the table first and then calculates locations. The second shows the original location of all rows having
a=="c"
.Unless there are reasons (which I'm currently missing) for which the above needs to happen, I think that both expressions should give the second result.
Regards,
Michele.
The text was updated successfully, but these errors were encountered: