[R] odd behaviour of identical

Wacek Kusnierczyk Waclaw.Marcin.Kusnierczyk at idi.ntnu.no
Mon Oct 27 00:21:46 CET 2008


smells bad design.

jim holtman wrote:
> If you want them to be identical, then you have to explicitly assign
> an integer to the vector so that conversion is not done:
>
>   
>> x = 1:10
>> y = 1:10
>>
>> all.equal(x,y)
>>     
> [1] TRUE
>   
>> identical(x,y)
>>     
> [1] TRUE
>   
>> y[11] = 11L
>> y = y[1:10]
>>
>> all.equal(x,y)
>>     
> [1] TRUE
>   
>> identical(x,y)
>>     
> [1] TRUE
>   
>
>
> On Sun, Oct 26, 2008 at 6:39 PM, Wacek Kusnierczyk
> <Waclaw.Marcin.Kusnierczyk at idi.ntnu.no> 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.
>>
>>     
>
>
>
>   


-- 
-------------------------------------------------------------------------------
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



More information about the R-help mailing list