Error when running a formula within a function

You had a good instinct to share something about the data of concern.

However, the way you did it does not facilitate easy copy and pasting of your data, so a user can easily add it to their R session.

You can read this guide to see how such things are possible via datapasta package, or base::dput()
FAQ: How to do a minimal reproducible example ( reprex ) for beginners