Dean
Provide an example using reprex()
and people might help.
It's really easy:
install.packages("reprex")
library(reprex)
Then select your code and copy to the clipboard.
Don't paste anywhere, just go to the Console and type reprex()
Then go to RStudio Community and paste into a comment.
More details here: FAQ: What's a reproducible example (`reprex`) and how do I create one?