Oct 24, 2013 at 12:02 AM
Edited Oct 24, 2013 at 12:03 AM
Currently you'd need to arrange in your .NET language to create an array of DateTime and an array of doubles, retrieve them and create your data frame in R.
If you'd like to create a data frame whole in C# then return to R, this is something about to be supported. In practice with the current binaries released, this is probably not feasible.
I've had the same question yesterday.
I thought I would give it a try, using the latest changes I've made to rClr and R.NET over the past month.
The following code works as expected using the latest code at the new codeplex site
clrGetMemberSignature("Rclr.RdotnetDataConverterTests", "CreateTestDataFrame" )
df <- clrCallStatic("Rclr.RdotnetDataConverterTests", "CreateTestDataFrame" )
# name a
#1 a 1
#2 b 2
#3 c 3
I'll design an API for more seamless data frame handling over the coming month. I cannot work on this much as part of my day job, so it may take a while. The API may look like this, but this is something I'd welcome suggestions on:
dotNetDictionary <- clrCallStatic ("TestClass", "CreateDictionary") # something like Dictionary<string,Array>
df <- as.data.frame(dotNetDictionary )
dotDataSet <- clrCallStatic ("TestClass", "CreateDataSet") # I have not used DataSet for years, but this is probably what people dealing with databases have in mind
df <- as.data.frame(dotDataSet )
dotGridView <- clrCallStatic ("TestClass", "CreateGridView") # Again something I have lost touch with over the years.
df <- as.data.frame(dotGridView )