If it can integrate via a java action or api such as rest, soap, jdbc, flat file, message bus, you can use it in Mendix.
Short answer is no. Mendix runs on Java and it is not possible to add R code to a java runtime. You can look at java libraries for machine learning such as weka https://www.cs.waikato.ac.nz/ml/weka/
Have a look at this blogpost for some ideas
This article might be useful: https://ubiops.com/building-a-low-code-app-powered-by-ai/
It shows to deploy your R model in UbiOps and turn it in a webservice which you can then call from your Mendix app.
Also works for Python code.