I have tow vectors one is the subset of another x is a subset of X Both are vectors with n elements X[X %in% x] would give me x again rite because it is a subset but i want all those are not in x from X. X[which(X != x)] should this do that Thanks Ramya -- View this message in context: http://n4.nabble.com/vector-help-tp960277p960277.html Sent from the R help mailing list archive at Nabble.com.
On Dec 10, 2009, at 2:55 PM, Ramya wrote:> > I have tow vectors one is the subset of another > > x is a subset of X Both are vectors with n elements > > X[X %in% x] would give me x again rite because it is a subset but i > want all > those are not in x from X. > > X[which(X != x)] should this do thatPerhaps you think R _should_ read your mind, but we are not there yet. Try instead: X[!(X %in% x)]>-- David Winsemius, MD Heritage Laboratories West Hartford, CT
Sender: r-help-bounces at r-project.org On-Behalf-Of: mailinglist.honeypot at gmail.com Subject: Re: [R] vector help Message-Id: <2154BD29-ADD9-4CFC-8447-BA5EEA3A30DF at gmail.com> Recipient: Yingmei.Lavin at magnetar.com -------------- next part -------------- An embedded message was scrubbed... From: Steve Lianoglou <mailinglist.honeypot at gmail.com> Subject: Re: [R] vector help Date: Thu, 10 Dec 2009 15:47:58 -0500 Size: 6407 URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20091210/028ddf9b/attachment-0002.mht>
Sender: MicrosoftExchange329e71ec88ae4615bbc36ab6ce41109e at magnetar.com On-Behalf-Of: mailinglist.honeypot at gmail.com Subject: Re: [R] vector help Message-Id: <118a120f-a549-4bbe-86a4-8157e65297a0 at journal.report.generator> Recipient: 200000224 at boyersesf.com -------------- next part -------------- An embedded message was scrubbed... From: Steve Lianoglou <mailinglist.honeypot at gmail.com> Subject: Re: [R] vector help Date: Thu, 10 Dec 2009 14:48:33 -0600 Size: 7882 URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20091210/9fb52ddb/attachment-0002.mht>