[R] odd behaviour of identical

markleeds at verizon.net markleeds at verizon.net
Sun Oct 26 23:49:11 CET 2008


the str function shows that x is an int and y is  a num so it's probably 
not a bug. or  maybe  the conversion to num is but probably not the 
identical.

x = 1:10
y = 1:10

all.equal(x,y)
identical(x,y)

y[11] = 11
y = y[1:10]

all.equal(x,y)
identical(x,y)

print(str(y))
print(str(x))



On Sun, Oct 26, 2008 at  5:39 PM, Wacek Kusnierczyk wrote:

> given what ?identical says, i find the following odd:
>
> x = 1:10
> y = 1:10
>
> all.equal(x,y)
> [1] TRUE
> identical(x,y)
> [1] TRUE
>
> y[11] = 11
> y = y[1:10]
>
> all.equal(x,y)
> [1] TRUE
> identical(x,y)
> [1] FALSE
>
> y
> [1] 1 2 3 4 5 6 7 8 9 10
> length(y)
> [1] 10
>
>
> looks like a bug.
>
> platform       i686-pc-linux-gnu          arch           i686 
> os             linux-gnu                  system         i686, 
> linux-gnu            status                                    major 
> 2                          minor          7.0 
> year           2008                       month          04 
> day            22                         svn rev        45424 
> language       R                          version.string R version 
> 2.7.0 (2008-04-22)
>
>
> vQ
>
> -- 
> 
> -------------------------------------------------------------------------------
> Wacek Kusnierczyk, MD PhD
>
> Email: waku at idi.ntnu.no
> Phone: +47 73591875, +47 72574609
>
> Department of Computer and Information Science (IDI)
> Faculty of Information Technology, Mathematics and Electrical 
> Engineering (IME)
> Norwegian University of Science and Technology (NTNU)
> Sem Saelands vei 7, 7491 Trondheim, Norway
> Room itv303
>
> Bioinformatics & Gene Regulation Group
> Department of Cancer Research and Molecular Medicine (IKM)
> Faculty of Medicine (DMF)
> Norwegian University of Science and Technology (NTNU)
> Laboratory Center, Erling Skjalgsons gt. 1, 7030 Trondheim, Norway
> Room 231.05.060
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list