these are vectors in R not lists try:
a<-c('a', 'b', 'c')#first vector (like A) > a [1] "a" "b" "c" b<-c('c', 'd', 'e')#second vector (like B) > b [1] "c" "d" "e" c<-setdiff(b,a)# all those in B but not A > c [1] "d" "e" cheers iain --- On Fri, 12/2/10, Zoppoli, Gabriele (NIH/NCI) [G] <zoppo...@mail.nih.gov> wrote: > From: Zoppoli, Gabriele (NIH/NCI) [G] <zoppo...@mail.nih.gov> > Subject: Re: [R] logical operations with lists > To: "r-help@r-project.org" <r-help@r-project.org> > Date: Friday, 12 February, 2010, 22:57 > I'm sorry but here's what I get: > > > A[1:10,] > [1] UQCRC1 IDH3B PDHA1 SUCLA2 COX5B > SDHB SDHA MDH2 DLD > COQ7 > > > dim(A) > [1] 1013 1 > > > B[1:10,] > [1] 3.8-1.2 3.8-1.3 3.8-1.4 3.8-1.5 5-HT3c2 A1BG > A1CF > A2BP1 A2LD1 A2M > > > dim(B) > [1] 55546 1 > > > C<-rbind(A,B) > > dim(C) > [1] 56559 1 > > > D <- C[which(C %in% A ==FALSE)] > > dim(D) > [1] 56559 0 > > and so with any other proposed method. > > I imported the list A and B this way: > > > > A<-as.vector(read.delim("E:/A.txt",sep="\t",header=FALSE)) > > and then removed the redundant rows with: > > > A<-unique(A) > > Guess I'm doing something really wrong here... Sorry for > the inexperience, I'm trying to improve... > > > > > > 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: zoppo...@mail.nih.gov > ________________________________________ > From: jbreic...@gmail.com > [jbreic...@gmail.com] > On Behalf Of Jonathan [jonsle...@gmail.com] > Sent: Friday, February 12, 2010 5:21 PM > To: Zoppoli, Gabriele (NIH/NCI) [G] > Cc: r-help@r-project.org > Subject: Re: [R] logical operations with lists > > This is probably not the best way, but (assuming you had > vectors and > not lists, since I'm not sure what your list looks like): > > C <- B[which(B %in% A ==FALSE)] > > Regards, > Jonathan > > > On Fri, Feb 12, 2010 at 5:06 PM, Zoppoli, Gabriele > (NIH/NCI) [G] > <zoppo...@mail.nih.gov> > wrote: > > 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: zoppo...@mail.nih.gov > > ______________________________________________ > > R-help@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. > > > > ______________________________________________ > R-help@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. > ______________________________________________ R-help@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.