[R] data manipulation
Cowpertwait, Paul
P.S.Cowpertwait at massey.ac.nz
Wed Sep 5 01:56:43 CEST 2001
Antonio,
This seems to work (but you may want to adjust the resulting column names):
length2.dat <- data.frame(cbind(length1.dat$LT[-c(5,6)],
length1.dat$LF[-c(5,6)]))
_____________________________________
Paul S.P. Cowpertwait
IIMS, Massey University, Albany,
Private Bag 102 904
North Shore Mail Centre
Auckland, NZ
Tel (+64) (9) 443 9799 ext 9488
http://www.massey.ac.nz/~pscowper
_____________________________________
-----Original Message-----
From: Antonio Olinto [mailto:aolinto at bignet.com.br]
Sent: Wednesday, 5 September 2001 10:51
To: R-help
Subject: [R] data manipulation
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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