Antonio:

If the variable you are subsetting is a factor with multiple levels (and
it appears you have 15), then the levels of the factor remain and will
show up in summary, but your data set will only include the rows of data
that you want. I am pretty sure subset has worked properly in your case.

Try 

> data[1:20,]

And just look at your data to see.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Antonio Olinto
Sent: Monday, December 06, 2004 7:45 AM
To: R-help
Subject: [R] using subset

Hi,

I have doubts in using subset command. I have a list of, lets say, 15
species and I want to make a subset with only 2 of them. I'm the command
data2 <- subset(data1, species=="sp1"|species=="sp2")

Nevertheless, when I ask for the summary (summary(data2)) the others
species names still apearing. Also I tried data2<-data1(data1$species
%in% c("sp1","sp2")),]

But I got the same result. How can I get a "clean" subset?

Thanks for any help. Best regards.

Antonio Olinto



-------------------------------------------------
WebMail Bignet - O seu provedor do litoral www.bignet.com.br

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to