Combining sapply() with group_by()

,

Create a reprex (FAQ: How to do a minimal reproducible example ( reprex ) for beginners) and it will be much easier to help you :slight_smile: