[R] Missing values

Michael Bedward michael.bedward at gmail.com
Tue Aug 17 09:57:05 CEST 2010


NA is a value that you can use for "missing" or inapplicable. It is
also the value returned by R functions to indicate missing (e.g. if
you use the match function to search a vector for a particular value,
but the value isn't present, match will return NA).

NaN means that the value wasn't missing but can't be expressed as a
number. 0/0 is NaN because the result is mathematically undefined
(sometimes called 'indeterminate').

Does that help at all ?

Michael

On 17 August 2010 16:59, Stephen Liu <satimis at yahoo.com> wrote:
> Hi folks,
>
>
> Could you please help me to understand;
>
>
> An Introduction to R
> http://cran.r-project.org/doc/manuals/R-intro.html#Logical-vectors
>
>
> The function is.na(x) gives a logical vector of the same size as x with value
> TRUE if and only if the corresponding element in x is NA.
>
>     > z <- c(1:3,NA);  ind <- is.na(z)
>
> and
>
>
> Note that there is a second kind of “missing” values which are produced by
> numerical computation, the so-called Not a Number, NaN, values. Examples are
>
>     > 0/0
>
> or
>
>     > Inf - Inf
>
>
> the explanation being abstract to me to understand.  TIA
>
>
> B.R.
> Stephen L
>
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list