Could you please turn this into a self-contained reprex (short for reproducible example)? It will help us help you if we can be sure we're all working with/looking at the same stuff. For example, it's much easier to diagnose an error if we have the actual error message in front of us, and can see where it pops up in the code execution.
If you run into problems with access to your clipboard, you can specify an outfile for the reprex, and then copy and paste the contents into the forum.