rowwise function

Group input by rows