I have a numerical vector:
vec = c(1464.556644,552.6007169,155.4249747,1855.360016,1315.874155,2047.980206,2361.475519,4130.530507,1609.572131,4298.980363,697.6034771,312.080866,2790.738644,1116.406288,989.6391649,2683.393338,3032.080837,2462.137352,2964.362507,1182.894473,1268.968128,4495.503015,576.1063996,232.4996213,1355.256694,1336.607876,2506.458008,1242.918255,3645.587384)
and I would like to select n=5 points from it that are as equidistant from each other as possible. In other words, I would like to get the points from vec that are closest to these points:
seq(min(vec),max(vec),(max(vec)-min(vec))/(n-1))
What is the fastest way to achieve this?