INNER CODE UNIT · Python
_get_R_home_and_rlib_path
briscverse/ryp · ryp.py:60
def _get_R_home_and_rlib_path() -> tuple[str, str]:
"""
Get R's home directory, first by checking the environment variable R_HOME,
then (if not defined or misconfigured) by running `R RHOME`. Also get the
path to the R shared library.
Based on the rpy2.situation.get_rlib_path() and rpy2.situation.get_r_home()
functions.
Returns:
The R home directory and the path to the R shared library.
"""
# If the environment variable R_HOME is defined, check that it exists and
# that it is properly configured: it must exist, and the R shared library
# must be found at the expected location under it (see _get_rlib_path()).
R_home = os.environ.get('R_HOME')
if R_home is not None:
if os.path.isdir(R_home):