Let\'s say I have a dataframe with two columns X and Y and my goal is to sample the dataframe based on cols X and Y where Y is a value and X is a categorical variable: