What is the difference between NaN and Inf, and NULL and NA in R?

前端 未结 2 533
囚心锁ツ
囚心锁ツ 2020-12-04 22:11

What is the difference between NaN and Inf, and NULL and NA in R?

Why ?NA and ?NULL tell me that \"NA\" has a length of \"1\" whereas NULL

相关标签:
2条回答
  • 2020-12-04 22:43

    In R language, there are two closely related null-like values: NA and NULL. Both are used to represent missing or undefined values.

    NULL represents the null object, it's a reserved word. NULL is perhaps returned by expressions and functions, so that values are undefined.

    NA is a logical constant of length 1, which contains a missing value indicator. NA can be freely coerced to any other vector type except raw. There are also constants NA_integer_, NA_real_, NA_complex_ and NA_character_ of the other atomic vector types which support missing values: all of these are reserved words in the R language.

    0 讨论(0)
  • 2020-12-04 22:49

    In short

    NaN  : means 0/0 -- Stands for Not a Number
    NA   : is generally interpreted as a missing, does not exist
    NULL : is for empty object.
    

    For an exact definition, you can read the documentation, which is very well written.

    0 讨论(0)
提交回复
热议问题