Its not that easy, getting types sent from R over to C# when the C# side can't predeclare them is difficult. I know there's some dynamic stuff for DataFrames, but I know little about it. On the static side, you need to do something like this. I'm sure there's alternative ways to make this work, but here's mine:
[DataFrameRow]
public class RowData
{
[DataFrameColumn("Date")]
public double Date { get; set; }
[DataFrameColumn("IndexValues")]
public double IndexValues { get; set; }
}
private static void Main(string[] args)
{
var rEngine = REngine.GetInstance();
const string command = @"library(xts); IndexValues <- xts(rnorm(10), as.POSIXlt(Sys.Date()+1:10));
data.frame(Date = index(IndexValues), IndexValues, row.names=NULL)";
var df1 = rEngine.Evaluate(command).AsDataFrame();
var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
var dates = df1.GetRows<RowData>().Select(s => epoch.AddSeconds(s.Date)).ToList();
}