[R] Logical Indexing of vectors -- Odd Behavior or....
Joel Kincaid
jfkincaid at salisbury.edu
Thu Mar 27 22:17:35 CET 2003
R-Community,
I'm puzzled by the following behavior in R 1.6.2 and have found no
reference to this in the archives:
>P <- seq(.1,.9,by=.1)
>P[P > .4]
[1] 0.5 0.6 0.7 0.8 0.9
as expected. However,
>P[P > .3]
[1] 0.3 0.4 0.5 0.6 0.7 0.8 0.9
???
Which is unexpected. Furthermore on the logical side
> P>.1
[1] FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
> P>.2
[1] FALSE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
> P>.3
[1] FALSE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
> P>.4
[1] FALSE FALSE FALSE FALSE TRUE TRUE TRUE TRUE TRUE
> P>.5
[1] FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE TRUE
> P>.6
[1] FALSE FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE
> P>.7
[1] FALSE FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE
What's with .3 and .7? Any pointers to where I might find out the info
would be greatly appreciated,
I'm running 1.6.2 on windows XP,
Sincerely,
Joel F. Kincaid, Ph. D.
Assistant Professor
Department of Economics and Finance
Franklin P. Perdue School of Business
Salisbury University
Salisbury Maryland, 21801
Phone: (410) 548-4416
Email: jfkincaid at salisbury.edu
More information about the R-help
mailing list