the successful execution of following code depends in my case on the execution method. Executing the code for the first time via F5 works without any errors. However, executing the code for the second time via F5 raises the error:
"NotImplementedError: Conversion 'rpy2py' not defined for objects of type '<class 'rpy2.rinterface.SexpClosure'>'".
After that, I need to restart Spyder and no errors occurs for the first execution. The same error appears even for the first time, when executing single lines via F5. Can anyone fix that problem?
import os
os.environ["R_HOME"] = r"C:/Users/mea39219/AppData/Local/Programs/R/R-4.2.1"
os.environ["PATH"] = r"C:/Users/mea39219/AppData/Local/Programs/R/R-4.2.1\bin\x64" + ";" + os.environ["PATH"]
from rpy2.robjects.packages import importr
# import R's "base" package
base = importr('base')
# import R's "utils" package
utils = importr('utils')
Version Python: 3.8.9 (WinPython); Version R: 4.2.1; Version rpy2: 3.5.5
Thanks in advance for your help!
Best regards, Alex