I think we need a bit more information and data. Have a look at how to create a reproducible example (reprex).
In particular we need to know what the data looks like and what packages you are using.