mardi 30 avril 2019

Why does this return NA instead of TRUE/FALSE?

Why does this

as.character(EARLY_TOPUP$STATUS[5]) != "ELIGIBLE"

returns NA instead of boolean value?

EARLY_TOPUP data frame has following values

> EARLY_TOPUP
                    STEP VALUE THRESHOLD       STATUS
1           Days in Loan     3      30.0 NOT ELIGIBLE
2      Present EWS Score     2      10.0     ELIGIBLE
3                Max EWS     2      15.0     ELIGIBLE
4 Weighted Payment Score   NaN       2.5         <NA>
5  Weighted Safety Ratio   NaN       2.0         <NA>

when I do I get expected values

> as.character("NA") != "ELIGIBLE"
[1] TRUE
> as.character("<NA>") != "ELIGIBLE"
[1] TRUE

Aucun commentaire:

Enregistrer un commentaire