One is an integer and the other is not. Try
for (i in 1:5) print( identical( i, as.integer(1) ) )
---
Date: Fri, 12 Dec 2003 14:47:07 -0800
From: John Welsh <jwelsh at skcc.org>
To: 'R-help at lists.R-project.org' <R-help at stat.math.ethz.ch>
Subject: [R] Basic question on function "identical"
> for(i in c(1:5))
+ {
+ print(identical(i,1))
+ }
[1] FALSE
[1] FALSE
[1] FALSE
[1] FALSE
[1] FALSE
Why don't I get:
[1] TRUE
[1] FALSE
[1] FALSE
[1] FALSE
[1] FALSE
John Welsh
Associate Professor
Sidney Kimmel Cancer Center
10835 Altman Row
San Diego, CA 92121
(858) 450-5990 ex.282
jwelsh at skcc.org
--- On Fri 12/12, John Welsh < jwelsh at skcc.org > wrote:
From: John Welsh [mailto: jwelsh at skcc.org]
To: R-help at stat.math.ethz.ch
Date: Fri, 12 Dec 2003 14:47:07 -0800
Subject: [R] Basic question on function "identical"
<br><br>> for(i in c(1:5))<br>+ {<br>+
print(identical(i,1))<br>+ }<br><br>[1] FALSE<br>[1]
FALSE<br>[1] FALSE<br>[1] FALSE<br>[1]
FALSE<br><br>Why don't I get:<br><br>[1]
TRUE<br>[1] FALSE<br>[1] FALSE<br>[1] FALSE<br>[1]
FALSE<br><br><br>John Welsh<br>Associate
Professor<br>Sidney Kimmel Cancer Center<br>10835 Altman
Row<br>San Diego, CA 92121<br>(858) 450-5990 ex.282<br>jwelsh
at
skcc.org<br><br>______________________________________________<br>R-help
at stat.math.ethz.ch mailing
list<br>https://www.stat.math.ethz.ch/mailman/listinfo/r-help<br>