In Factor.cs, the GetFactors() method has a bug.
This call will fail: engine.Evaluate("factor(c(\"a\", \"b\", NA, \"a\"))").AsFactor()
To fix it, the method implementation should change to:
public string[] GetFactors()
{
var levels = GetLevels();
return this.Where(value => value != int.MinValue).Select(value => levels[value - 1]).ToArray();
}
This call will fail: engine.Evaluate("factor(c(\"a\", \"b\", NA, \"a\"))").AsFactor()
To fix it, the method implementation should change to:
public string[] GetFactors()
{
var levels = GetLevels();
return this.Where(value => value != int.MinValue).Select(value => levels[value - 1]).ToArray();
}