I'm trying to apply a function I created. It selects the first five lines of an object. I want to apply it for all the levels of a factor of my data frame.
As a result, I want my data frame with only the first five lines selected in each level of the factor I selected.
Does someone knows how to help me? It seems to be simple, but I can't find the solution.