Calling R from F#

So I thought I would check out R.NET so I downloaded R from its home site.  I then created a basic F# library and installed R.DotNet.  I found it amusing that it installed from the recycle bin:

image

I then fired up a F# project to test it out.  I decided to mimic the C# example on the Codeplex site in F#.  I gopt to the 4th line where I actually tried to create an instance of the REngine:

image

So I typed into Google R and F# and what do you know,  some folks created a type provider for R  How cool is that?  I installed the RProvider from NuGet and then typed in the basic code sample but it was not getting recognized.

image

I then read in the documentation that you need to restart Visual Studio (good to know)  and make sure that the .NET version is 4.5.  Still no luck.  I then downloaded the example script that is on Github and I was getting the same problem.  Out of desperation, I hit F6 and I got this:

image

 

Then all of the R type provider references resolved.  I then changed the R.Net to point at the bin and all of those references resolved.  I then commented out

  1. //open RProvider.tseries
  2. //open RProvider.zoo

and

  1. //let adf = R.adf_test(msft)

and no more red squiqqley!  When I hit F6 though, I get this:

 

image

Undaunted, I ran the script anyway and sure enough, I got some output:

image

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: