4 ms·
``` library(data.table) purchases[amount <= median(amount)*10][, .(total = sum(amount - discount)), by = .(country)][order(country)] ``` - no quotes needed -
by interiormut 1y ago
```
library(data.table)
purchases[amount <= median(amount)*10][, .(total = sum(amount - discount)), by = .(country)][order(country)]
```
- no quotes needed
- no loc needed
- only 1 groupby needed