HI, The context was missing. I had to dig through Nabble to find what you actually meant.
vec1<-"Iphone 4S 16 G" vec2<-"4S G 16 Iphone" vec3<-"16 G Iphone 4S" vec4<-"3S G 16 Iphone" res2<-paste(sort(unlist(strsplit(vec2," "))),collapse= " ") res3<-paste(sort(unlist(strsplit(vec3," "))),collapse= " ") res1<-paste(sort(unlist(strsplit(vec1," "))),collapse= " ") res4<-paste(sort(unlist(strsplit(vec4," "))),collapse= " ") identical(res1,res2) #[1] TRUE identical(res1,res3) #[1] TRUE identical(res1,res4) #[1] FALSE res1 #[1] "16 4S G Iphone" res4 #[1] "16 3S G Iphone" I think I previously used: res33<-paste(sort(unlist(strsplit(vec3," "))),collapse= "_") #this should also work res44<-paste(sort(unlist(strsplit(vec4," "))),collapse= "_") res11<-paste(sort(unlist(strsplit(vec4," "))),collapse= "_") identical(res11,res33) #[1] FALSE identical(res11,res44) #[1] TRUE A.K. ________________________________ From: Tammy Ma <metal_lical...@live.com> To: smartpink...@yahoo.com; "r-help@r-project.org" <r-help@r-project.org> Sent: Thursday, November 8, 2012 8:12 AM Subject: Re: [R] map two names into one Thanks. Yes. Your approach can identify: Glaxy ace S 5830 and S 5830 Glaxy ace But you can not identify using same program: Iphone 4S 16 G Iphone 4S 16G How should I solve both in same time. Kind regards, Tammy ______________________________________________ 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.