Thanks Peter: 
 
For others who are interested, the first one one with [-indices,] doesn't 
really do, because the first level of indices are the component names. eg, if I 
have a data frame with variables, name, DOB, gender, then by using the first 
choice, I'm merely deleting lists of variables, but thanks Peter for the second 
trick. That one works for deleting the actually data entries.
 
Karen> Subject: RE: [R] deleting certain observations in a data frame> Date: 
Fri, 15 Feb 2008 10:05:39 +1300> From: [EMAIL PROTECTED]> To: [EMAIL 
PROTECTED]; r-help@r-project.org> > Karen> > For indices, use the minus sign: 
yourData[-indicesToBeDeleted,]> > For rownames, negate %in%:> 
yourData[!rownames(yourData)%in%namesToBeDeleted,] > > HTH> > Peter Alspach> > 
> -----Original Message-----> > From: [EMAIL PROTECTED] > > [mailto:[EMAIL 
PROTECTED] On Behalf Of Chang Liu> > Sent: Friday, 15 February 2008 9:50 a.m.> 
> To: r-help@r-project.org> > Subject: [R] deleting certain observations in a 
data frame> > > > > > Hi, I'm wondering what the fastest way is to delete 
certain > > data points (observations) in a data frame. > > I have a vector of 
the indices/row.names I would like to > > delete. I have tried replacing list 
by list, but it always > > complains about different lengths, "replacing list 
of length > > a with length b" and so on.> > >!
  > Another way to think of it is that it's a generazation of > > na.rm I 
guess.> > > > Thanks,> > Karen> > 
_________________________________________________________________> > > > > > 
[[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.
_________________________________________________________________


        [[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.

Reply via email to