[R] identical(length(x), 1) returns FALSE, but print(length(x)) is 1, length(x)==1 is TRUE, and is.integer(lenght(x)) is TRUE????
Steve Lianoglou
mailinglist.honeypot at gmail.com
Tue Sep 15 18:22:14 CEST 2009
Hi,
On Sep 15, 2009, at 12:16 PM, Corrado wrote:
> Dear R,
>
> the condition:
>
> identical(length(x),1) returns FALSE
>
> but
>
> print(length(x))
>
> returns 1 and:
>
> is.vector(x) is TRUE.
> is.integer(length(x)) is TRUE
> length(x) ==1 is TRUE
>
> I am puzzled.
But is.integer(1) is FALSE
and identical(length(x), 1L) is TRUE
... ouch ...
I guess the lesson learned is that:
identical() != ==
-steve
--
Steve Lianoglou
Graduate Student: Computational Systems Biology
| Memorial Sloan-Kettering Cancer Center
| Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
More information about the R-help
mailing list