When I use .Internal(inspect()) to NA_real_ and NaN, it returns,
> .Internal(inspect(NA_real_))
@0x000001e79724d0e0 14 REALSXP g0c1 [REF(2)] (len=1, tl=0) nan
> .Internal(inspect(NaN))
@0x000001e797264a88 14 REALSXP g0c1 [REF(2)] (len=1, tl=0) nan
It seems like their only difference is the memory address.
However, when I coerce the NA_real_ and NaN into character, it returns,
> as.character(c(NaN, NA_real_))
[1] "NaN" NA
I understand that it should return the above result as NaN can't be character and it will be coerced into "NaN" but NA_real will be coerced into NA_character_. But considering their gut is same, how can R returns different results for them?
Thank you in advance for any suggestions!