Can you show us a minimal working example of what you are doing and supply some sample data?
Paste the code here between
```
```
A handy way to provide some sample data is to do `dput(mydata) where "mydata" is the name of your dataset and copy the output here between
```
```
If you have a large dataset dput(head(mydata, 100)) should give us enough to work with. You may find this helpfull Tips for writing R-related questions