Hi Rusers,
  I found sometimes that the same values cannot be judged to be the same in
R. Anybody knows the probelm? I think i ignored some minor detail. Thanks.
Here is the example.
############
data1<-matrix(data=c(1,1.2,1.3,"3/23/2004",1,1.5,2.3,"3/22/2004",2,0.2,3.3,"4/23/2004",3,1.5,1.3,"5/22/2004"),nrow=4,ncol=4,byrow=TRUE)
data1<-data.frame(data1);names(data1)<-c("areaid","x","y","date")
data2<-matrix(data=c(1,1.22,1.32,1,  1.53,  2.34,1,  1.21,  1.37,1,  1.52,
2.35,2,  0.21,  3.33,2,  0.23,  3.35,3,  1.57, 1.31,3,  1.59,
1.33),nrow=8,ncol=3,byrow=TRUE)
data2<-data.frame(data2);names(data2)<-c("areaid","x1","y1")
data2$tag<-0
data1_1<-data1[1,]
data2_1<-data2[data2$areaid==data1_1$areaid & data2$tag==0,]
ran_1<-sample(c(1:length(data2_1)),2, replace = FALSE)
data2_1<-data2_1[ran_1,]
data_1<-merge(data1_1,data2_1)
#data_1
#       areaid  x   y      date   x1   y1  tag
#    1      1 1.2 1.3 3/23/2004 1.52 2.35   0
#    2      1 1.2 1.3 3/23/2004 1.53 2.34   0
data2[data_1$x1==data2$x1 & data_1$y1==data2$y1 & data2$tag==0,]
 #data2[c(data_1$x1==data2$x1 & data_1$y1==data2$y1 & data2$tag==0),]
#    areaid   x1    y1   tag
#2      1    1.53  2.34   0
  There should be two same observations between data_1 and data2, but here
only one was identified.
  Thanks a lot.

-- 
-----------------
Jane Chang
Queen's

	[[alternative HTML version deleted]]


