Check ?"%in% HTH, Jorge
On Thu, Jun 3, 2010 at 7:52 PM, LCOG1 <> wrote: > > Hi all, > I have toyed with this for too long today and in the past i used multiple > lines of code to get at what i want. Consider the following: > > All i need to do is subset Pc to the values that do not equal Pc.X. The > first attempt doesnt work because i have unequal lengths. The second > attempt doesnt give me an the right answer. > > > Pc<-c("Res","Com","Ind","Os","Mix","Gov","Rur") > Pc.X<-c("Com","Ind","Mix") > PcToAdd_<-Pc[Pc!=Pc.X] > #Doesnt Work > AND > > PcToAdd_<-subset(Pc.X,Pc.X %in% Pc) > #Works but doesnt get me what i want > > I am looking a return of PcToAdd_ <- "Res" "Os" "Gov" "Rur" > > This has got to be a simple answer. Thanks > -- > View this message in context: > http://r.789695.n4.nabble.com/Subsetting-for-unwanted-values-tp2242506p2242506.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. > [[alternative HTML version deleted]] ______________________________________________ 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.