Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect handling of NA character values in DataFrame / DynamicVector #126

Open
marymoni opened this issue Jul 15, 2020 · 0 comments
Open

Comments

@marymoni
Copy link

It seems that there is a bug with string values handling in DynamicVector class - when trying to get NA value, it is converted into 'NA' string and not in null value (like CharacterVector does).

Here is code to reproduce when working with DynamicVector's via DataFrame class:


private static void TestNa(REngine engine)
{

    engine.Evaluate("options(stringsAsFactors = FALSE)");

    var df = engine.Evaluate("data.frame(col_str = c('AAA', NA_character_))").AsDataFrame();
    
    var col_str = df["col_str"];
    
    var val1 = col_str[1]; // 'NA' - not expected
    
    var val2 = col_str.AsCharacter()[1]; // null - expected

}

It seems that method DynamicVector.ReadString() misses check for NaStringPointer which exists in CharacterVector.GetValue() method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant