split_rows_by function

Add rows according to levels of a variable