[R] map two names into one
arun
smartpink111 at yahoo.com
Thu Nov 8 14:57:01 CET 2012
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.
________________________________
From: Tammy Ma <metal_licaling at live.com>
To: smartpink111 at yahoo.com; "r-help at r-project.org" <r-help at 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
More information about the R-help
mailing list