I'm implementing a simple function in python with the rpy2 API.
In VScode I manage to print a confidence interval, calculating Z-statistic calling the function created with the robjects as seen in the pic. But before the printed value I get the message "Unable to determine R home: [WinError 2] The system could not find the specified file". The same message appears in Jupyter but doesn't allow me to print anything at all, when calling a rpy2 function it get the error "Conversion 'rpy2py' not defined for objects of type '<class 'rpy2.rinterface.SexpClosure'>'".
Also just importing the package itself "import rpy2.robjects" retrives the same message. Import rpy2 alone doesn't show up anything.
I tried to add Rscript.exe and R.exe path to system variables but didn't work, neither of them (not sure if I did it properly), tried to reinstall R, didn't work.
Any clue on how to solve this?
Image of the function being used and it's output in VSCode The output for the same function as before but in jupyter