Open franknarf1 opened 7 years ago
It should also illustrate how to name columns from j (instead of just getting V1):
j
V1
Henrik's example: https://chat.stackoverflow.com/transcript/message/38440648#38440648
library(data.table) d <- data.table(grp = c("a", "a", "a", "b", "b"), x = 1:5) # one way es = list() es[["my_min"]] = quote(min(x)) es[["my_max"]] = quote(max(x)) e = as.call(c(as.symbol("list"), es)) # another way e = setNames( quote(.(min(x), max(x))), c("", "my_min", "my_max") ) # then... d[, eval(e), by=grp]
Josh's answer is helpful here: https://stackoverflow.com/a/14697835/
Another example: https://stackoverflow.com/a/55733481
It might make sense to add exercises as well
Also this might be helpful https://stackoverflow.com/a/54800108/2490497
It should also illustrate how to name columns from
j
(instead of just gettingV1
):Henrik's example: https://chat.stackoverflow.com/transcript/message/38440648#38440648
Josh's answer is helpful here: https://stackoverflow.com/a/14697835/