[R] range and intersection

2010-03-13 Thread Adrian Johnson
Hi: I have a two large files (over 300K lines). file 1: NameX UK 199 UK 230 UK 139 .. UAE194 UAE 94 File 2: Name XY UK140 180 UK195240 UK304340 I want to select X of File 1 and search if it falls in range of X and Y of

Re: [R] range and intersection

2010-03-13 Thread David Winsemius
On Mar 13, 2010, at 10:14 PM, Adrian Johnson wrote: Hi: I have a two large files (over 300K lines). file 1: NameX UK 199 UK 230 UK 139 .. UAE194 UAE 94 File 2: Name XY UK140 180 UK195240 UK304340 I haven't figured

Re: [R] range and intersection

2010-03-13 Thread jim holtman
Try this: file1 - read.table(textConnection(NameX + UK 199 + UK 230 + UK 139 + UAE194 + UAE 94), header=TRUE, as.is=TRUE) file2 - read.table(textConnection(Name XY + UK140 180 + UK195240 + UK304340), header=TRUE, as.is=TRUE)

Re: [R] range and intersection

2010-03-13 Thread Adrian Johnson
Hi David, Sorry. I want to test those lines in file1 match name in file2. IF File1$Name == File2$Name then: check if File1$X is in range of File2$(x,y): if yes: print File1$Name '\t' File1$X '\t' File2$Name '\t' File2$X '\t' File2$Y. Thanks Adrian On

Re: [R] range and intersection

2010-03-13 Thread David Winsemius
On Mar 13, 2010, at 11:38 PM, Adrian Johnson wrote: Hi David, Sorry. I want to test those lines in file1 match name in file2. IF File1$Name == File2$Name then: check if File1$X is in range of File2$(x,y): Not an adequately specific bit os pseudo code. if yes:

Re: [R] range and intersection

2010-03-13 Thread Adrian Johnson
The example I gave was just an example, I made for illustrating my problem. I IF File1$Name == File2$Name then: check if File1$X is in range of File2$(x,y): if yes: print File1$Name '\t' File1$X '\t' File2$Name '\t' File2$X '\t' File2$Y if no :

Re: [R] range and intersection

2010-03-13 Thread jim holtman
If you also want to match on the Name, this should do it: file1 - read.table(textConnection(NameX + UK 199 + UK 230 + UK 139 + UAE194 + UAE 94), header=TRUE, as.is=TRUE) file2 - read.table(textConnection(Name XY + UK80 100 + UK140 180 + UK195

Re: [R] range and intersection

2010-03-13 Thread Charles C. Berry
On Sat, 13 Mar 2010, Adrian Johnson wrote: Hi: I have a two large files (over 300K lines). file 1: NameX UK 199 UK 230 UK 139 .. UAE194 UAE 94 File 2: Name XY UK140 180 UK195240 UK304340 I want to select X of File 1

Re: [R] range and intersection

2010-03-13 Thread Charles C. Berry
Typo corrected below. On Sat, 13 Mar 2010, Charles C. Berry wrote: On Sat, 13 Mar 2010, Adrian Johnson wrote: Hi: I have a two large files (over 300K lines). file 1: NameX UK 199 UK 230 UK 139 .. UAE194 UAE 94 File 2: Name XY UK