BlueMountainCapital/FSharpRProvider — pull request #85 by tpetricek (2014-05-06 10:16:11+00:00)
Title: Prototype of a type provider for type-safe RData access (#59)

I wrote this prototype during a recent "type provider coding dojo" at the London F# user group. It needs a bit more work (some cleanup and testing), but it should not be too much work to finish it. I recently came across a
[StackOverflow question][so] asking about this, so it looks like this would be genuinely useful.

This lets you write:

open RProvider
open RProvider.``base``

type Foo = RData<"C:\\Temp\\Test.rdata">
let f = new Foo()
f.cars
f.bar

In the current version, the types of the properties (`f.cars` and `f.bar`) are F# types that would be returned by the `Value` property (using whatever plugins are loaded currently). This means that in this example, I get `cars` of type `Frame` (using Deedle frames) and `bar` is `float[]`. If there is no default converter, you get just `SymbolicExpression`.

An alternative would be to return something like a `TypedExpression<'T>` which has `Value : 'T` and is `SymbolicExpression` (so that you can access the value as symbolic expression if you want to keep it in the R environment). Now that I think of it, that would probably be a better option...

Any feedback & thoughts would be welcome!

/cc @adamklein @hmansell
[so]: http://stackoverflow.com/questions/22991041/reading-writing-rdata-from-c-sharp-or-f-deedle-package