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
Would not be the same thing as dt[b<2, a := 0] ?
Maybe it is what is implied by the first post, but, indeed, I think that being able to use relative index for conditions could be nice
For now, the syntax to do the same is cumbersome.
DT[DT[,index=.I[expression],by=id]$index,a:=999]
It would be simpler to be able to do things such as
Agree that the best use cases for this appear to be when combined with a merge in i, or when assigning to the first element of a by group, so that the conditioning is either much harder or impossible to do in i directly. Reverting to an rbindlapply approach to build a DT from scratch for now
Activity
jangorecki commentedon Aug 20, 2014
Also mentioned in nice use case here: http://stackoverflow.com/questions/21819253/how-to-change-the-last-value-in-each-group-by-reference-in-data-table
matthieugomez commentedon Sep 1, 2014
Would not be the same thing as
dt[b<2, a := 0]?Maybe it is what is implied by the first post, but, indeed, I think that being able to use relative index for conditions could be nice
For now, the syntax to do the same is cumbersome.
It would be simpler to be able to do things such as
franknarf1 commentedon Sep 17, 2015
I think this is a good example (in the comment): http://stackoverflow.com/questions/32638845/replacing-nas-in-dataframe-with-constants-in-another-in-r/32639171#comment53127039_32639171
Instead of
I'd like to do
franknarf1 commentedon Jan 18, 2016
This is another good example, I think: http://stackoverflow.com/q/34845396
And another not-bad example: http://stackoverflow.com/q/37862828/
And another not-bad example: http://stackoverflow.com/q/38083937/
And another one: http://stackoverflow.com/q/38910869/
And a bad example: https://stackoverflow.com/a/44525179/ like
DT[, x[.N] := sum(v), by=g]Another
x[.N] :=one: https://stackoverflow.com/q/50821561/DavidArenburg commentedon Aug 19, 2016
Another good example of a possibly useful use case on SO http://stackoverflow.com/a/39035748/3001626
Also, this is labeled as "high" but it is not assigned to any milestone...
MichaelChirico commentedon Sep 21, 2016
Agree that the best use cases for this appear to be when combined with a merge in
i, or when assigning to the first element of abygroup, so that the conditioning is either much harder or impossible to do inidirectly. Reverting to anrbindlapplyapproach to build a DT from scratch for now