scapply function

Single-cell apply a function to a matrix split by a factor