I'm afraid that the code you shared is insufficient to run an example. please try and make a reprex that we can work with to perfect.
I.e. it should be something that can be copy pasted into our Rstudio session, and run and create output that is something close to what you want, to which we can improve