Skip to content
Prev 310241 / 398502 Next

map two names into one

Hi,
There was a typo in my previous email.
?vec1<-"Iphone 4S 16 G"
?vec2<-"4S G 16 Iphone"
?vec3<-"16 G Iphone 4S"
vec4<-"3S G 16 Iphone"

res11<- paste(sort(unlist(strsplit(vec1," "))),collapse="_") # I typed vec4 instead of vec1
res33<-paste(sort(unlist(strsplit(vec3," "))),collapse= "_") 
res44<-paste(sort(unlist(strsplit(vec4," "))),collapse= "_")
?res11
#[1] "16_4S_G_Iphone"
?identical(res11,res33)
#[1] TRUE
?identical(res11,res44)
#[1] FALSE

I am not sure what the problem is.? It works with this example.? If you can provide some details, then it would be more helpful.


A.K.