Return the R Home Directory

Return the R home directory.

R.home(component = "home")
As well as "home" which gives the R home directory, other known values are "bin", "doc", "etc", "modules" and "share" giving the paths to the corresponding parts of an R installation.

The R home directory is the top-level directory of the R installation being run.

The R home directory is often referred to as R_HOME, and is the value of an environment variable of that name in an R session. unix It can be found outside an R session by R RHOME.


A character string giving the R home directory or path to a particular component. Normally the components are all subdirectories of the R home directory, but this may not be the case in a Unix-like installation.The return value for "modules" and on Windows "bin" is to a sub-architecture-specific location.The function R.home() bases the constructed paths on the current value of the environment variable R_HOME which is normally set on startup.On Windows the values of R.home() and R_HOME are guaranteed not to contain spaces, switching to the 8.3 short form of path elements if required. The value of R_HOME is set on startup to use forward slashes (since many package maintainers pass it unquoted to shells, for example in ‘Makefile’s).

  • R.home
  • R_HOME
Documentation reproduced from package base, version 3.1.3, License: Part of R 3.1.3

Community examples

Looks like there are no examples yet.