Kenneth See %in%. In your example:
Data2 <- subset(Data1, !Identity%in%c(1,2,3)) HTH ...... Peter Alspach > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Kenneth Takagi > Sent: Wednesday, 20 February 2008 2:28 p.m. > To: r-help@r-project.org > Subject: [R] Deleting multiple rows based on a variable > > Hello, > > > > I have a dataset which consists of 9 columns (variables) and > 35 rows (observations). I am doing a simple linear > regression of one variable on the other. There are some > observations that are outliers and I would like to remove > them based on another variable (it's a unique, numeric > variable). How do you tell R to remove multiple rows > (observations) based on a variable value? > > > > For example, I am trying to remove observations that have > variable Identity = 1, 2, 3: > > > > Data2<-subset(Data1, Identity!=c(1,2,3))> > > > This does not work. It works if I do it one at a time, but > is very time consuming. Is there a way to remove all desired > observations at once? > > > > Thanks! > > > > Kenneth Takagi > > [EMAIL PROTECTED] > > > > > [[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. > The contents of this e-mail are privileged and/or confidential to the named recipient and are not to be used by any other person and/or organisation. If you have received this e-mail in error, please notify the sender and delete all material pertaining to this e-mail. ______________________________________________ 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.