Quantcast
Channel: R.NET
Viewing all articles
Browse latest Browse all 1634

Closed Issue: Iterating a linear model as a data frame leads to NotImplementedExceptions for DataSize, etc. in DynamicVector (DynamicVector can't handle LanguageObject) [11]

$
0
0
When iterating a linear model as a data frame, some of the columns (e.g. "call") are of Type SystemExpressionType.LanguageObject. DynamicVector throws a NotImplementedException in DataSize, this[int index], etc. for types other than NumericVector, IntegerVector, CharacterVector, LogicalVector, RawVector and ComplexVector, so how is one expected to generically iterate across other valid values in a data frame? (An obvious workaround is to access columns by name here, skipping "call" columns).

To reproduce:

SymbolicExpression result = engine.EagerEvaluate("summary(model)");

DataFrame dataFrame = result.AsDataFrame();

Console.WriteLine(dataFrame.RowCount);
Console.WriteLine(dataFrame.ColumnCount);

for (int i = 0; i < dataFrame.RowCount; ++i)
{
for (int j = 0; j < dataFrame.ColumnCount; ++j)
{
DataFrameRow row = dataFrame.GetRow(i);

object column = row[j]; // NotImplementedException will occur here from DynamicVector.DataSize

Console.Write(dataFrame.ColumnNames[j]);
Console.Write(" = ");
Console.Write(column);
Console.Write(", ");
}

Console.WriteLine();
}



Viewing all articles
Browse latest Browse all 1634

Trending Articles