[R] question about subset

Berton Gunter gunter.berton at gene.com
Fri May 6 00:36:20 CEST 2005


?row.names

-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
"The business of the statistician is to catalyze the scientific learning
process."  - George E. P. Box
 
 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of jose silva
> Sent: Thursday, May 05, 2005 3:31 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] question about subset
> 
> Dear R users:
> 
> I have a quick question:
> 
> is there any way to get a subset of a data frame with the 
> ordered indexes or without these indexes?
> 
> example:
> 
> mydata<- data.frame(A=seq(1,10), B=c(-5,2,-4,6,-8,-9,2,5,7,0))
> subset(mydata, B>0)
>   A B
> 2 2 2
> 4 4 6
> 7 7 2
> 8 8 5
> 9 9 7
> 
> I would like to obtain this:
> 
>   A B
> 1 2 2
> 2 4 6
> 3 7 2
> 4 8 5
> 5 9 7
> 
> or this
> 
>   A B
>   2 2
>   4 6
>   7 2
>   8 5
>   9 7
> 
> I think this is possible but I dont know how...
> any sugestion?
> thanks
> 
> jose silva
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list