Skip to content

filter data frames

2 messages · Christophe Weibel, Brian Ripley

#
Hello!

I'm looking for an easy way to filter data frames.

Some rows in my data frame needs to be left out,
for instance, rows with invalid data.

Right now, if I want to pair two columns of this data frame,
I have to do this:
or this:
where 'valid' is a logical vector of valid rows.

Is there a way to filter a data frame without making a vector of
the columns, thus losing the column names?

Okay, perhaps I'm greedy. It's already working, what am I complaining
about?
#
On Fri, 7 Jun 2002, Christophe Weibel wrote:

            
What's wrong with df[valid, c("tstart","tend")], which is what you appear
to want?

I am sure that's in the R Introduction.