Please supplement your question with a minimal reproducible example. Use dput() for data and specify all non-base packages with library calls. For statistical questions please use

R Programming Language

R is a free, open-source programming language and software environment for statistical computing, bioinformatics, and graphics. It is a multi-paradigm language and dynamically typed. R is an implementation of the S programming language combined with lexical scoping semantics inspired by Scheme.
R was created by Ross Ihaka and Robert Gentleman and is now developed by the R Development Core Team.

The R environment is easily extended through a packaging system on CRAN, the Comprehensive R Archive Network, where one can find several bioinformatics packages, and Bioconductor which is focused in bioinformatics.

Code Language (used for syntax highlighting): lang-r