Interacting with R
If you are familiar with the R programming language and the environment for statistical studies, then you can easily transfer the accumulated material for use in Mathematica. To do this, you need to enable the RLink
package and download the paclet for R using RLinkResourcesInstall
:
When launching the RLinkResourcesInstall
function, you will be asked to confirm the installation, and after this, the process of downloading the necessary files will start.
To start a connection with R, you need to call the InstallR
function. For example, let's set the value of the
myR
variable using the RSet
function and then read it using the REvaluate
function:
With the help of the REvaluate
function, you can also declare functions written in R and execute them in Mathematica. For example, let's declare a function that returns the cube of given numbers:
To avoid the repeated calling of the REvaluate
function every time the thrd
function is called, you can use RFunction
:
In this example, we will...