How to cite R packages when using Mendeley?
Each R package has a different way to be cited. Some were formally published as scientific articles in journals, some only as packages. The only way to know for sure is to check how the package maintainer want you to cite their package, with function citation. 
Base R also comes with function toBibtex that help you export the correct citations as a bibtex file. 

For instance:

&gt; citation("Rcpp")

To cite Rcpp in publications use:

  Dirk Eddelbuettel and Romain Francois (2011). Rcpp: Seamless
  R and C++ Integration. Journal of Statistical Software,
  40(8), 1-18. URL http://www.jstatsoft.org/v40/i08/.

  Eddelbuettel, Dirk (2013) Seamless R and C++ Integration with
  Rcpp. Springer, New York. ISBN 978-1-4614-6867-7.

  Dirk Eddelbuettel and James Joseph Balamuta (2017). Extending
  R with C++: A Brief Introduction to Rcpp. PeerJ Preprints
  5:e3188v1. URL
  https://doi.org/10.7287/peerj.preprints.3188v1.

To see these entries in BibTeX format, use 'print(&lt;citation&gt;,
bibtex=TRUE)', 'toBibtex(.)', or set
'options(citation.bibtex.max=999)'.

&gt; toBibtex(citation("knitr"))
@Manual{,
  title = {knitr: A General-Purpose Package for Dynamic Report Generation in R},
  author = {Yihui Xie},
  year = {2018},
  note = {R package version 1.20},
  url = {https://yihui.name/knitr/},
}

@Book{,
  title = {Dynamic Documents with {R} and knitr},
  author = {Yihui Xie},
  publisher = {Chapman and Hall/CRC},
  address = {Boca Raton, Florida},
  year = {2015},
  edition = {2nd},
  note = {ISBN 978-1498716963},
  url = {https://yihui.name/knitr/},
}

@InCollection{,
  booktitle = {Implementing Reproducible Computational Research},
  editor = {Victoria Stodden and Friedrich Leisch and Roger D. Peng},
  title = {knitr: A Comprehensive Tool for Reproducible Research in {R}},
  author = {Yihui Xie},
  publisher = {Chapman and Hall/CRC},
  year = {2014},
  note = {ISBN 978-1466561595},
  url = {http://www.crcpress.com/product/isbn/9781466561595},
}


As for importing bibtex files into Mendeley, I do not use Mendeley myself but this Q&amp;A on TeX.se shows that one can simply use menu items "File > Import... > Bibtex (*.bib) " to do so.