[R] removing rows from a dataframe

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Mon Sep 4 00:40:40 CEST 2000


Douglas Bates <bates at stat.wisc.edu> writes:

> > newhilodata <- subset(hilodata, diff(c(0,as.integer(sym))) != 0)
> > 
> > (actually, the as.integer is unnecessary because the c() will unclass
> > the factor automagically)
> 
> Alternatively, you could use the match function because it returns the
> first match.

Or, as Robert pointed out to me privately: duplicated() does the trick

  subset(hilodata, duplicated(sym))

got to be the simplest variant.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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