Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

choice filter #83

Open
3 tasks
asiripanich opened this issue Jun 2, 2020 · 1 comment
Open
3 tasks

choice filter #83

asiripanich opened this issue Jun 2, 2020 · 1 comment

Comments

@asiripanich
Copy link
Member

asiripanich commented Jun 2, 2020

related to #80, #6

@asiripanich
Copy link
Member Author

asiripanich commented Jun 2, 2020

nabor is 100 times faster than nngeo.

library(nngeo)
#> Warning: package 'nngeo' was built under R version 3.6.2
#> Loading required package: sf
#> Warning: package 'sf' was built under R version 3.6.2
#> Linking to GEOS 3.7.2, GDAL 2.4.2, PROJ 5.2.0
library(nabor)
library(sf)

points <- towns

points_coords <- st_coordinates(points)
points_geo <- st_geometry(points)

rbenchmark::benchmark(
  nn_nngeo = st_nn(points_geo, points_geo, maxdist = 1000, k = c(20), progress = FALSE),
  nn_nabor = knn(data=points_coords, k=20, radius=1000)
)
#>       test replications elapsed relative user.self sys.self user.child
#> 2 nn_nabor          100   0.044    1.000     0.042    0.001          0
#> 1 nn_nngeo          100   4.436  100.818     4.344    0.062          0
#>   sys.child
#> 2         0
#> 1         0

Created on 2020-06-02 by the reprex package (v0.3.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant