Thursday 15 May 2014

r - Comparing elements in 2 tables efficiently -


I would like to know if there is some built-in function that can help me to execute the following algorithm efficiently. Assume table 1 and table 2 with size (Table 2) & lt; For every element in Table 1, size (Table 1) to search in the entire table 2 until the position between one column from Table 1 and one column in Table 2 is met.

In particular, I want to find the column value for C2 in Table 2, which is the abs (table1 $ c1 [j] - table2 $ c1) <0.01 for each j

I have a loop for table 1 which is used at a time which is the table 2 $ c2 [abs (table1 $ c1 [j] - table2 $ c1)

  returns <0.01]   

but it is really slow.

A method of collecting which package you want to use to include this in the SQL syntax Allows you to prepare for it and thus you can only use your position.

However, there is probably a more efficient way without a database path in R. However, if you are familiar with SQL, it can be very efficient in favor of programming.

Without a copy-proof example, I am not able to give you the test code, though.

No comments:

Post a Comment