Grouped sampling for data frames