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 use data.table a lot to calculate absolute frequencies on the fly with, while also applying a subsetting flag in i in the same call.
iris[Sepal.Width<3.7,.N,.(Species)]
If i want to change this to relative frequencies within the subset, I need to save the number of rows after filtering as denominator in another call, like this:
This gets old after a while when doing this a lot.
It would be great if a symbol .NROW similar to .N existed, returning the nrow of the data.table after applying i, but before going into the subgroup.
The name .NROW is probably bad since it would be unclear what the difference to .N is, maybe .NI or .NFILT?
The text was updated successfully, but these errors were encountered:
zerweck
changed the title
.NROW as a way to access the nrow after subsetting in i but before entering a subgroup
.NROW as a way to access the nrow after subsetting in i but before entering a subgroup
Aug 28, 2020
I like the concept but I always think of @MichaelChirico's comment from the thread as I sometimes wonder if there are too many symbols already, some of which are only triggered via NSE.
I use data.table a lot to calculate absolute frequencies on the fly with, while also applying a subsetting flag in
i
in the same call.If i want to change this to relative frequencies within the subset, I need to save the number of rows after filtering as denominator in another call, like this:
This gets old after a while when doing this a lot.
It would be great if a symbol
.NROW
similar to.N
existed, returning the nrow of the data.table after applyingi
, but before going into the subgroup.The name
.NROW
is probably bad since it would be unclear what the difference to.N
is, maybe.NI
or.NFILT
?The text was updated successfully, but these errors were encountered: