[R] filter data frames
Christophe Weibel
christophe.weibel at epfl.ch
Fri Jun 7 11:41:31 CEST 2002
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:
> pairs(as.data.frame(list(tstart=df$tstart[valid],tend=df$tend.sdr[valid])))
or this:
> pairs(cbind(df$tstart,df$tend)[valid,],labels=c("tstart","tend"))
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?
--
Christophe Weibel
_________________________
christophe.weibel at epfl.ch
Phone: +41 21 312-3525
Prof: +41 21 69-34244
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list