[R] data frames

aolinto@bignet.com.br aolinto at bignet.com.br
Tue Sep 11 19:47:22 CEST 2001


Dear R-list members

Here goes a question on data frames:

I want to create a new data frame excluding some records 
(rows) from an existing one.

Considering the data frame "fish.dat" at the end of this 
message, I can make a boxplot(Ring~Radius) and identify the 
points at rows 11 and 25 as outliers.

With the command fish.dat[c(11, 25),] I can identify which 
fishes are related to these rows (fishes #4 and #1).

With subset(fish.dat,reg==1) I can display all records from 
fish 1. My first question is:
How can I list all records from fishes 1 and 4 at once?

Now I want to create a new data frame without the records from 
fishes 1 and 4.

The only way I know is to type
newfish.dat <- fish.dat[-c(2,4,6,10,11,15, ... ),]

Probably there's an easier way that I couldn't find out. I've 
already made some trials, all with syntax problems.

Thanks,

Antonio Olinto
Fisheries Institute
Sao Paulo - Brasil

	Fish	Ring	Radius
1	2	1	0.36
2	4	1	0.37
3	3	1	0.44
4	1	1	0.45
5	5	1	0.47
6	4	2	0.58
7	2	2	0.59
8	3	2	0.68
9	5	2	0.72
10	1	2	0.80
11	4	3	0.63
12	2	3	0.85
13	3	3	0.93
14	5	3	0.97
15	1	3	1.05
16	4	4	0.95
17	3	4	1.11
18	2	4	1.15
19	5	4	1.15
20	1	4	1.28
21	4	5	1.13
22	3	5	1.29
23	5	5	1.32
24	2	5	1.35
25	1	5	1.49


-----------------------------------------------------
E-Mail enviado por WebMail - http://www.bignet.com.br


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