Skip to content

Instantly share code, notes, and snippets.

@johnmyleswhite
Created September 20, 2014 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnmyleswhite/fd6cbed2f691a9119cfe to your computer and use it in GitHub Desktop.
Save johnmyleswhite/fd6cbed2f691a9119cfe to your computer and use it in GitHub Desktop.
The dangers of rendering many distinct NA's as if they were all the same
> v <- c(1, 2, 3, 4)
> ind <- NA
> ind
[1] NA
> v[ind]
[1] NA NA NA NA
> ind <- -ind
> ind
[1] NA
> v[ind]
[1] NA
> ind <- -ind
> ind
[1] NA
> v[ind]
[1] NA
@nalimilan
Copy link

Wow. This deserves a mention in the R Inferno. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment