[R] Logical vectors

Stephen Liu satimis at yahoo.com
Thu Nov 4 06:50:01 CET 2010


Hi folks,

Pls help me to understand follow;

An Introduction to R

2.4 Logical vectors
http://cran.r-project.org/doc/manuals/R-intro.html#R-and-statistics

1)
> x
[1] 1 2 3 4 5
> temp <- x != 1
> temp
[1] FALSE  TRUE  TRUE  TRUE  TRUE
> 


2)
> x
[1] 1 2 3 4 5
> temp <- x > 1
> temp
[1] FALSE  TRUE  TRUE  TRUE  TRUE


Why NOT
> temp
[1] TRUE  FALSE  FALSE FALSE  FALSE

?


TIA

B.R.
Stephen L





More information about the R-help mailing list