Here are the necessary steps:
-
Install the recent Mono including F# as it's described in the section Debian, Ubuntu, and derivatives.
-
Install Monodevelop (the addins are not necessary for RProvider, but are handy to have anyway):
sudo apt-get install monodevelop monodevelop-nunit monodevelop-versioncontrol
-
In the Monodevelop install the F# plugin (you can ignore the installation error, it's a known bug).
-
Restart the Monodevelop!
-
Skim through the guide Using R provider on Mac and Linux and ignore everything regarding the 64-bitness: Mono is 64bit on the Linux distribution by default.
-
Configure RProvider:
echo -e "MONO64=`which mono`\nR_HOME=`R --print-home`" > ~/.rprovider.conf
-
Create a F# Tutorial solution, as described in the guide mentionned above, and install
rprovider
nuget package. -
Paste following code into the
Tutorial.fsx
(pay attention to theI
path and the RProvider version):
#nowarn "211"
#I "../packages/RProvider.1.1.20"
#load "RProvider.fsx"
open RProvider
open RProvider.graphics
open RProvider.grDevices
open RProvider.datasets
R.mean([1;2;3;4])
// testing graphics
R.x11()
// Calculate sin using the R 'sin' function
// (converting results to 'float') and plot it
[ for x in 0.0 .. 0.1 .. 3.14 ->
R.sin(x).GetValue<float>() ]
|> R.plot
// Plot the data from the standard 'Nile' data set
R.plot(R.Nile)
- Close the R graph window later with:
R.graphics_off()
- If you want to run examples from R Provider Tutorial, you need to install some R packages. Run following commands in R command prompt:
install.packages("zoo")
install.packages("tseries")
Also replace SPX
with SPY
in the example F# code from the tutorial.