79327076

Date: 2025-01-03 16:43:59
Score: 2
Natty:
Report link

mode_by_group <- function(x) unique(x)[which.max(table(x)[table(x)>0)]

DT[ , moda := myfun(number), by = age]

DT

age v number moda

1: 12 -0.9740026 122 122

2: 12 0.6893727 125 122

3: 3 -0.9558391 5 5

4: 3 -1.2317071 5 5

5: 12 -0.9568919 122 122

Reasons:
  • Low length (0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: João Perin