I am trying to select a list from a data table and apply a function. Finally I want the result as a column of the data table.. Following is an example of what i am trying to do ...
I tried something like this :
dt <- dt[, value:=f(V3) , by=list(V1)]
Data table:
V1 V2 V3
1 8 40
1 5 22
1 6 36
2 7 11
2 3 8
2 6 20
2 9 18
3 . .
. . .
Result :
V1 Value
1 f(list(40,22,36))
2 f(list(11,8,20,18))
3 f(list(...))