I have read
http://stat.ethz.ch/R-manual/R-devel/library/base/html/Logic.html
and the difference between & and && doesn\'t make sense. For examp
Consider this, then it should be clear:
as.logical(c(0,1,2,3,4))
#[1] FALSE TRUE TRUE TRUE TRUE
So...
c(1,2,3) & c(1,3,3)
#[1] TRUE TRUE TRUE
is equivalent to:
c(TRUE,TRUE,TRUE) & c(TRUE,TRUE,TRUE)
...which compares by element using & and returns c(TRUE,TRUE,TRUE)
For reference:
test <- c(NA,NaN,-Inf,-1,-0.5,0,0.5,1,2,Inf)
data.frame(test,as.logical(test))
# test as.logical.test.
#1 NA NA
#2 NaN NA
#3 -Inf TRUE
#4 -1.0 TRUE
#5 -0.5 TRUE
#6 0.0 FALSE
#7 0.5 TRUE
#8 1.0 TRUE
#9 2.0 TRUE
#10 Inf TRUE