I am trying to import the rpy2 library into a Jupyter Notebook but I cannot get past this error.
The PATH \'C:\\Program Files\\R\\R-4.0.2\\bin\\x64\' has been added.<
Here is my working solution:
import os
os.environ["R_HOME"] = r"D:\Install\R\R-3.6.1"
os.environ["PATH"] = r"D:\Install\R\R-3.6.1\bin\x64" + ";" + os.environ["PATH"]
import rpy2
from rpy2.robjects import pandas2ri, packages
pandas2ri.activate()
stats = packages.importr('stats')
I found a solution here.
Adding the PATH
C:\Users\username\Anaconda2;C:\Users\username\Anaconda2\Scripts;C:\Users\username\Anaconda2\Library\bin;C:\Users\username\Anaconda2\Library\mingw-w64\lib;C:\Users\username\Anaconda2\Library\mingw-w64\bin
and subsequently restarting Anaconda fixed the issue.