Although you did provide code using the reprex package, you did not provide us with a sample of the original dataframe df. This means it's not possible to run your code or see what the input data looks like. Please provide a sample of the input, and what you would want to do with it (frequency of what).
If you need help building a good reprex, read this: