It might have to do with the storage.mode():

> reference <- c(11, 14, 16, 5, 4, 2,  0, 15, 9, 0)
> storage.mode(reference)
[1] "double"
> cpgDensity <- as.integer(reference)
> storage.mode(cpgDensity)
[1] "integer"
> identical(reference,cpgDensity)
[1] FALSE

regards
Søren

________________________________________
Fra: r-help-boun...@r-project.org [r-help-boun...@r-project.org] P&#229; vegne 
af Dario Strbenac [d.strbe...@garvan.org.au]
Sendt: 1. marts 2010 07:24
Til: r-help@r-project.org
Emne: [R] identical() mystery

Hello,

I have 2 vectors of the same mode and the same contents but I still get FALSE. 
Any ideas ?

> reference <- c(11, 14, 16, 5, 4, 2,  0, 15, 9, 0)
> reference
 [1] 11 14 16  5  4  2  0 15  9  0
> cpgDensity
 [1] 11 14 16  5  4  2  0 15  9  0
> identical(cpgDensity, reference)
[1] FALSE
> mode(cpgDensity)
[1] "numeric"
> mode(reference)
[1] "numeric"
> cpgDensity == reference
 [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE

Thanyou,
         Dario.

______________________________________________
R-help@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.
______________________________________________
R-help@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.

Reply via email to