Dear all, I have a vector with number that some of them are part of the seq(1,800,4). How can I check which of the numbers belong to the seq(1,800,4) LEt's say that is called myvector the vector with the numbers. Is there in R something like this? is.member(myvector,seq(1,800,4)) I would like to thank you in advance for your help B.R Alex [[alternative HTML version deleted]]
On Sep 30, 2011, at 12:25 PM, Alaios wrote:> Dear all, > I have a vector with number that some of them are part of the > > seq(1,800,4). How can I check which of the numbers belong to the > seq(1,800,4) > > LEt's say that is called myvector the vector with the numbers. > Is there in R something like this? > is.member(myvector,seq(1,800,4)) >?match # which is the basis for %in% David Winsemius, MD West Hartford, CT
> 5 %in% seq(1,800,4)[1] TRUE> 4 %in% seq(1,800,4)[1] FALSE or> is.element(5, seq(1,800,4))[1] TRUE> is.element(4, seq(1,800,4))[1] FALSE Sarah On Fri, Sep 30, 2011 at 12:25 PM, Alaios <alaios at yahoo.com> wrote:> Dear all, > I have a vector with number that some of them are part of the > > seq(1,800,4). How can I check which of the numbers belong to the seq(1,800,4) > > LEt's say that is called myvector the vector with the numbers. > Is there in R something like this? > is.member(myvector,seq(1,800,4)) > > I would like to thank you in advance for your help > > B.R > Alex>-- Sarah Goslee http://www.functionaldiversity.org
is.element(myvector, seq(1,800,4)) or, if you like typing percent signs, myvector %in% seq(1,800,4) Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Alaios > Sent: Friday, September 30, 2011 9:26 AM > To: R-help at r-project.org > Subject: [R] is member > > Dear all, > I have a vector with number that some of them are part of the > > seq(1,800,4). How can I check which of the numbers belong to the seq(1,800,4) > > LEt's say that is called myvector the vector with the numbers. > Is there in R something like this? > is.member(myvector,seq(1,800,4)) > > I would like to thank you in advance for your help > > B.R > Alex > [[alternative HTML version deleted]]