Re: [R] How to select a row from one dataframe that is "close" to a row in another dataframe

2010-03-20 Thread Gabor Grothendieck
On Sat, Mar 20, 2010 at 1:39 PM, James Rome wrote: > And to use sqldf, it looks as if I have to read the source data files > directly into sqldf to use it. No. The whole idea of sqldf is that it operates directly on data frames. __ R-help@r-project.or

Re: [R] How to select a row from one dataframe that is "close" to a row in another dataframe

2010-03-20 Thread James Rome
On 3/20/2010 11:52 AM, Daniel Malter wrote: If the flight identifiers runway$Flight and oooi$Flight are unique (i.e. only one observation has the same identifier in each dataset), you could use merge() to bind together the dataset based on matching the two. See, ?merge Also, I see an OnDate vari

Re: [R] How to select a row from one dataframe that is "close" to a row in another dataframe

2010-03-20 Thread Gabor Grothendieck
Using the sqldf package you could do an SQL join with the indicated condition in your where clause. See the examples section of this page: http://sqldf.googlecode.com On Sat, Mar 20, 2010 at 10:20 AM, James Rome wrote: > I have two data frames of flight data,  but they have very different > numb

Re: [R] How to select a row from one dataframe that is "close" to a row in another dataframe

2010-03-20 Thread jim holtman
sqldf package: > n <- 200 > x <- data.frame(id=sample(1:10,n, TRUE), timex=runif(n)) > y <- data.frame(id=sample(1:15, n, TRUE), timey=runif(n), runway=seq(n)) > require(sqldf) > sqldf("select x.id, timex, y.id, timey, y.runway from x join y + where x.id = y.id and abs(timex - timey) < 0.005")

Re: [R] How to select a row from one dataframe that is "close" to a row in another dataframe

2010-03-20 Thread Daniel Malter
-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of James Rome Sent: Saturday, March 20, 2010 10:20 AM To: r-help@r-project.org Subject: [R] How to select a row from one dataframe that is "close" to a row in another dataframe I have two data frames of flight data, but they have very

[R] How to select a row from one dataframe that is "close" to a row in another dataframe

2010-03-20 Thread James Rome
I have two data frames of flight data, but they have very different numbers of rows. They come from different sources, so the data are not identical. > names(oooi) [1] "FltOrigDt" "MkdCrrCd" [3] "MkdFltNbr" "DprtTrpnStnCd" [5] "ArrTrpnStnCd"