[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????
David Winsemius
dwinsemius at comcast.net
Tue Sep 15 19:13:03 CEST 2009
On Sep 15, 2009, at 1:04 PM, Corrado wrote:
> On Tuesday 15 September 2009 17:28:02 Gavin Simpson wrote:
>> [note you don't give us your x so I'm making this up - This is what
>> Duncan was going on about in an earlier thread, give us something
>> we can
>> just paste into R and it works]
>
> Dear Gavin,
>
> I do not understand what more information! Take any vector of length
> 1, for
> example x<-1. Plus all the command that where in my previous
> email ....
>
> What is the logic behind
>
> identical(length(x),1)
identical() tests for the two objects having the same class for one
thing:
> class(length(c(9)) )
[1] "integer"
> class(1)
[1] "numeric"
> class(1) != class( length( c(9) ) )
[1] TRUE
>
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list