[R] how to make subset of large data

Uwe Ligges ligges at statistik.tu-dortmund.de
Sun Sep 28 19:36:40 CEST 2008



ram basnet wrote:
> I have very large data set. I want to make subset of data based on the matching. For example, 
>  
>> x
> [1] "a" "b" "c" "f"
> 
>> yy
>                                                                    
>  "a" "-0.761988113636315" "-0.117672628171555" "-0.885641151614679"
> "b" "-1.13288279283289"  "1.49472214344206"   "-1.99837287923763" 
>  "c" "-1.40091234602209"  "-1.52648481863209"  "-0.965170583818188"
> "d" "0.555887401098017"  "0.97145488124429"   "-0.591375965267432"
> "e" "-0.817496999999489" "0.598589864959733"  "-0.74697501001117" 
>  "f" "-1.59120505480671"  "-1.67283394866541"  "0.664771975944383" 
>                               
>> match(x,yy[,1])
> [1] 1 2 3 6

Not sure what you mean, with what you already have I guess you mean:

index <- match(x,yy[,1])
yynew <- yy[index,]

Uwe Ligges


> Now, i want to extract data of matching observataions between two subsets (i.e. 1,2,3,6) and make a new subset.
>  
> If some body has idea, then it will be great for me.
> Thanks in advanced.
>  
> Ram Basnet.
>  
>  
>                                  
> 
> 
> 
>       
> 	[[alternative HTML version deleted]]
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list