I'm building a site which contains lot of optimization work and all those work are done in R language. I'm building whole site on Django. Is there any way I can connect both R code and Django or what should I do here ?
I tried installing rpy2
which works fine in python but in Django
I'm getting a error:
File "F:\django-app\restapi\views.py", line 25, in <module>
import rpy2.robjects as robjects
File "F:\django-app\venv\lib\site-packages\rpy2\robjects\__init__.py", line 19, in <module>
from rpy2.robjects.robject import RObjectMixin, RObject
File "F:\django-app\venv\lib\site-packages\rpy2\robjects\robject.py", line 6, in <module>
rpy2.rinterface.initr()
File "F:\django-app\venv\lib\site-packages\rpy2\rinterface\__init__.py", line 208, in initr
initr(r_preservehash=r_preservehash)
RuntimeError: R_USER not defined.
what's the best option to do this. Is there any thing I'm missing here?