I think it’s going to be difficult for helpers to answer your question without some more information. A good starting place is reading this guide: FAQ: Tips for writing R-related questions.
Can you try turning your question into a reproducible example? If you get stuck on that, can you at least include more of the code you are running, especially your library() statements?