[R] logical operations with lists

Iain Gallagher iaingallagher at btopenworld.com
Fri Feb 12 23:20:30 CET 2010


> a<-list('a', 'b', 'c')
> b<-list('c', 'd', 'e')
> c<-intersect(a,b)
> c
[[1]]
[1] "c"

Is this what you want?

Cheers

Iain

--- On Fri, 12/2/10, Zoppoli, Gabriele (NIH/NCI) [G] <zoppolig at mail.nih.gov> wrote:

> From: Zoppoli, Gabriele (NIH/NCI) [G] <zoppolig at mail.nih.gov>
> Subject: [R] logical operations with lists
> To: "r-help at r-project.org" <r-help at r-project.org>
> Date: Friday, 12 February, 2010, 22:06
> Sorry, maybe it's easy but I haven't
> found anything useful:
> 
> how can I obtain a list C that contains all the members in
> the list B that are not in list A? This are lists of nanes,
> not numbers!
> 
> Thank you
> 
> 
> Gabriele Zoppoli, MD
> Ph.D. Fellow, Experimental and Clinical Oncology and
> Hematology, University of Genova, Genova, Italy
> Guest Researcher, LMP, NCI, NIH, Bethesda MD
> 
> Work: 301-451-8575
> Mobile: 301-204-5642
> Email: zoppolig at mail.nih.gov
> ______________________________________________
> 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