[R] determining the difference between 2 character strings

R. Michael Weylandt <michael.weylandt@gmail.com> michael.weylandt at gmail.com
Sun Jan 15 15:30:04 CET 2012



On Jan 15, 2012, at 3:28 AM, 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.

You can have character vectors. (in fact, from the below, I'm almost certain you already do)

Michael

> 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