[R] Calculating Minimum Absolute Difference of Two Numeric Vectors
Dario Strbenac
d@tr7320 @end|ng |rom un|@@ydney@edu@@u
Tue Aug 18 09:00:09 CEST 2020
Good day,
What is a fast and efficient way to calculate the minimum absolute difference between two vectors of numbers? The two vectors have unequal length. I would also like to know the index of the first vector and the second vector which results in the minimum absolute difference. For example:
x <- rpois(500, 100)
y <- rpois(300, 30)
Is there a much faster way than a nested for loop without resorting to Rcpp?
--------------------------------------
Dario Strbenac
University of Sydney
Camperdown NSW 2050
Australia
More information about the R-help
mailing list