Rpy2 error wac-a-mole: R_USER not defined
You need to set the R_USER
environment variable, e.g. to the username of the Windows account you use. See also this quote from this link:
1) Add the path to R.dll to my PATH variable (I went to the 32-bit directory) 2) Add an environment variable R_HOME (C:\Program Files\R\R-2.12.1 for me) 3) Add an environment variable R_USER (simply my username in Windows).
How to set environment variable R_User? And how to get module winreg?
It seems that you have to tweek your environment variables manually. To do this, go to the environment variables (Control Panel > System Settings > Advanced System Settings > (Advanced Tab) Environment Variables) and follow the steps from the top answer here: How to setup environment variable R_user to use rpy2 in python . (Make sure you add to the Path).
Concerning the RRuntimeError you mentioned in the comments, it's hard to tell without further info, but it seems like your code tries to open a file (or install R libraries). Check out these links:
- Error in file(file, "rt") : cannot open the connection
- assign variables from python to R using r.assign and then use read.table
- https://bitbucket.org/rpy2/rpy2/issues/399/rruntimeerror-error-in-file-file-rt-cannot
Error install rpy2: 'sh' is not recognized as an internal or external command, operable program or batch file
- Download the version you need here http://www.lfd.uci.edu/~gohlke/pythonlibs/#rpy2
- Open Anaconda Prompt and navigate to the folder you have downloaded the file
- Run pip install file_name.whl
Related Topics
How to Copy a 2D Array into a 3Rd Dimension, N Times
How to Get the Index of a Maximum Element in a Numpy Array Along One Axis
Getting Number of Elements in an Iterator in Python
Convert a Timedelta to Days, Hours and Minutes
Writing String to a File on a New Line Every Time
How to Make the Python Interpreter Correctly Handle Non-Ascii Characters in String Operations
Purpose of Calling Function Without Brackets Python
Pandas: Peculiar Performance Drop for Inplace Rename After Dropna
How to Generate All Possible Three Letter Strings
Pyqt Showing Video Stream from Opencv
Pick N Distinct Items at Random from Sequence of Unknown Length, in Only One Iteration
(Z3Py) Checking All Solutions for Equation
Parameterized Queries with Psycopg2/Python Db-API and Postgresql