[R] question about setdiff()
Svetlana Eden
svetlana.eden at vanderbilt.edu
Fri Feb 27 18:18:26 CET 2004
Thank you for your answers,
I have another question:
the behaviour of setdiff(indicesFalse, indicesNA)
does not seem predictable to me.
> indices
[1] 1 2 3 4 5 6
> compareVector
[1] NA TRUE TRUE TRUE FALSE NA
> indicesNA = indices[is.na(compareVector)]
> indicesNA
[1] 1 6
> indicesFalse = indices[compareVector == FALSE]
> indicesFalse
[1] NA 5 NA
> setdiff(indicesNA, indicesFalse) ######################## OK
[1] 1 6
> setdiff(indicesFalse, indicesNA) ######################## I would
> expect here 'NA 5 NA'
[1] NA 5
>
--
Svetlana Eden Biostatistician II School of Medicine
Department of Biostatistics Vanderbilt University
More information about the R-help
mailing list