binned_sum (and the rest) also accept a factor variable