svetlana.eden at vanderbilt.edu
Fri Feb 27 16:56:30 CET 2004
I get two vectors 'iFalseFalse' and 'i2'.
I think they should be the same but they are not.
Is it because
R does not handle complicated logical expressions in such cases
or I do something wrong?
> z1 = c(NA, "", 3, NA, "", 3)
> z2 = c("", "", 3, NA, 3, NA)
> cV = (as.character(z1)==as.character(z2))
 NA TRUE TRUE NA FALSE NA
> iFalse = (c(1:(length(z1))))[(cV==FALSE)]
> iNonNA = (c(1:(length(z1))))[(!(is.na(cV)))]
 NA NA 5 NA
 2 3 5
> iFalseFalse = intersect(iFalse, iNonNA)
> i2 = (c(1:(length(z1))))[( (cV==FALSE)&&(!(is.na(cV))) )]
Svetlana Eden Biostatistician II School of Medicine
Department of Biostatistics Vanderbilt University
More information about the R-help