Welcome to R and RStudio
We need more information, especially some data in dput() format. Have a look at this.