[R] data manipulation

Antonio Olinto aolinto at bignet.com.br
Wed Sep 5 00:51:02 CEST 2001


Dear R-list members,

Here goes a simple question that I could not solve: I want to delete a row
in a data frame.
Suppose rows 5 and 9 are out-layers and I want to take them out from a data
frame named "length1.dat":

       LT   LF
 1    335 320
 2    340 335
 3    360 355
 4    370 365
 5    376 310
 6    388 378
 7    395 385
 8    400 390
 9    400 410
10   405 392

I tried to make another data frame:

length2.dat <- data.frame(subset(length1.dat,select=-[5,])) # to take out
the 5th row

and also ... select= [-c(5,)] ... [-5,-9] ... many other variations, without
success.

I’d be thankful to receive any help. I have printed Maindonald’s “Using R
...” and Verzani’s “simpleR” but I could not find any hint on this matter.

Thanks in advance,

Antonio Olinto
Fisheries Institute
Sao Paulo - BRAZIL


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