How to speed up these R computations? : <p>I have to data frames with X, Y, and Z coordinates. I want to find the distance between all of the points in the two data frames. (Like the distance between entry A1 and every entry in B, A2 and every entry in B, and so on, and vice versa). I basically did this:</p>

<p>1.) Wrote a function that calculates the distance between two points.
2.) Used the distanceFinder function to create a function that finds the distance between one point in a group, and every other point in the opposite group.
3.) Created a function called bigDistance() that calls filter() on every entry in one group, and appends the results to an empty data frame through a for loop until it's completed.</p>

<p>This code takes about 2 minutes to run on the file I'm experimenting with, and I just found out that I have to translate this algorithm to PHP... so I guess this is kind of an optimization question, because I feel like PHP would be way slower at making these computations than R? Sorry if people find this "off-topic" but yeah, super new to programming and Big O notation and stuff, so any tips would be amazing! Thanks!</p>
