RLink`
RLink`

InstallR

InstallR[opts]

starts up the R runtime and connects to it.

Details and Options

  • InstallR must be called before any work can be done with the RLink.
  • The following options can be given:
  • "JRELocation"Automaticpath to a custom Java Runtime Environment (JRE)
    "RCommandLine"Automaticlist of strings starting with "--" and representing command-line arguments for R
    "RHomeLocation"Automaticlocation of the root of an external R distribution (currently Windows only)
    "AddToRDataTypePath"Nonelist of directories with external data type definitions
    "ConfigureAutomatically"Trueenables automatic configuration of the R distribution upon the first use
    "RVersion"Automaticversion of the R system to connect to; must be a string
    "JRINativeLibraryLocation"Automaticpath to the folder containing the native JRI library compatible with the given external R distribution
  • If the "RHomeLocation" option is not set, InstallR will ignore possible settings of options "JRINativeLibraryLocation" and "RVersion" and attempt to use the last R distribution to which it has successfully connected. If either no such connection took place or the current connection attempt fails, it will search for all available R distributions and try connecting to each of them in turn until a successful connection is established. If InstallR fails to connect to any of the found R distributions or if none were found, it returns $Failed, with an appropriate error message.
  • If "RHomeLocation" is set to a specific location, this enables RLink to use an external R distribution, where the specified location should correspond to the setting of the R_HOME variable (which points at the root of the R distribution).
  • If the R runtime has already been installed, InstallR does nothing when called with the same value of the "RHomeLocation" option and issues a warning message if that value points to a different R distribution than the one currently in use. In either case, it keeps running the current active R session.
  • RLink searches in directories specified with "AddToRDataTypePath" for external data type definitions, which are user-defined data types extending core RLink type system. When found, such definitions are loaded by InstallR and registered with RLink.

Examples

Basic Examples  (1)

This loads the RLink package:

This configures RLink and installs the R runtime:

You can now start working:

This loads the RLink package:

This automatically configures RLink and connects to an external R runtime/distribution, identified by its home directory:

You can now start working:

Uninstall R to end the RLink session:

This configures RLink and connects to an external R runtime/distribution, passing the options "RVersion" and "JRINativeLibraryLocation" explicitly (which may be required in certain cases when RLink is unable to infer these parameters automatically):

You can now start working:

Uninstall R to end the RLink session:

Wolfram Research (2012), InstallR, Wolfram Language function, https://reference.wolfram.com/language/RLink/ref/InstallR.html.

Text

Wolfram Research (2012), InstallR, Wolfram Language function, https://reference.wolfram.com/language/RLink/ref/InstallR.html.

CMS

Wolfram Language. 2012. "InstallR." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/RLink/ref/InstallR.html.

APA

Wolfram Language. (2012). InstallR. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/RLink/ref/InstallR.html

BibTeX

@misc{reference.wolfram_2024_installr, author="Wolfram Research", title="{InstallR}", year="2012", howpublished="\url{https://reference.wolfram.com/language/RLink/ref/InstallR.html}", note=[Accessed: 12-October-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_installr, organization={Wolfram Research}, title={InstallR}, year={2012}, url={https://reference.wolfram.com/language/RLink/ref/InstallR.html}, note=[Accessed: 12-October-2024 ]}