The fact that A and B have dimensions indicates that they are more than simple vectors. It appears that when you create D you are subsetting columns rather than rows, try:
> D <- C[which(C %in% A ==FALSE),] # note the "," Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Zoppoli, Gabriele (NIH/NCI) [G] > Sent: Friday, February 12, 2010 3:58 PM > To: r-help@r-project.org > Subject: Re: [R] logical operations with lists > > 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.