Hi! Welcome!
I'm afraid I don't have an answer for you, but I do have some advice to hopefully help you get an answer faster:
-
This doesn't look like a question specifically about the RStudio IDE, so it would be a good idea to move it to a different category (you might also want to take a look at our RStudio vs R FAQ).
-
Thanks for including your code! Around here, it's considered both friendly and good practice to format your code as code — just select it and click the
</>
button at the top of the posting box (you can edit your post by clicking the little grey pencil at the bottom). -
The quickest path to an answer is to post a self-contained reproducible example. You're pretty close, but you're missing a non-screenshot sample of your data. It's easiest for people to help you if they can run your code on their own computer to debug and/or tweak it, and that's quite difficult right now. This thread has several ideas for how to post your data here (if your data are unavoidably large, see the discussion over here, instead).