[R] determining the difference between 2 character string

Jim Holtman jholtman at gmail.com
Sun Jan 15 09:53:54 CET 2012


why cann't you use setdiff or unique?  in the sample data how do you tell the difference?  do you compare the whole string, or partial? a better definition of your problem and what you have tried would help.  it would seem like there is nothing the same between your sample data.

Sent from my iPad

On Jan 15, 2012, at 3:28, Philip Robinson <philip.c.robinson at gmail.com> wrote:

> Hi,
> 
> I am struggling, I have 2 lists with shared elements, one ~600, one
> ~1000, and I need to determine the difference between them.
> 
> They are character strings, and to use setdiff(), or unique() I need
> vectors. I don't know how to force these character strings into a form
> where you can use functions like setdiff(). Any help would be greatly
> appreciated.
> 
> 
>> head(R1)
> [1] "ccc-5-96078266-C-T" "ccc-5-96127578-C-T" "ccc-5-96133900-A-G"
> "ccc-5-96145958-C-T" "ccc-5-96147966-C-T" "ccc-5-96150086-T-C"
> 
>> head(R2)
> [1] "imm_5_96030100" "imm_5_96377451" "imm_5_96334858"
> "imm_5_96318074" "imm_5_96356643" "imm_5_96389465"
> 
> thanks
> Philip
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list