K Isn't Lisp (2004) 2 years ago
Unsure of performance but using R's `data.table`(which has uses beyond this example so installing this library shouldn't be a one off)
library(data.table)
v <- rbindlist(list(
data.table(e1=1, string='one'),
data.table(e1=1, string='two'),
data.table(e1=1, string='three'),
data.table(e1=1, string='one'),
data.table(e1=1, string='four'),
data.table(e1=1, string='two'))
)
v[, list(counter= sum(e1)),by= string]