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

geo_join variable matching #48

Open
antaldaniel opened this issue Nov 18, 2018 · 0 comments
Open

geo_join variable matching #48

antaldaniel opened this issue Nov 18, 2018 · 0 comments

Comments

@antaldaniel
Copy link

First of all congratulations for this great package. I was a bit struggling to find out why I could not geo-match my data. I think that it is a bit unfortunate that there is no exact longitude and latitude variable matching in the geo_join function.

I made a small amendment in the documentation of the function. However, I think that a clearer matching would be more appropriate, given that Google any many other APIs use by default lng for longitudes.

` states <- data_frame(state = state.name,
lng = state.center$x,
lat = state.center$y)

s1 <- rename(states, state1 = state)
s2 <- rename(states, state2 = state)

pairs <- s1 %>%
geo_inner_join(s2, by = c("lng", "lat"),
max_dist = 200) %>%
filter(state1 != state2)
`

Another issue that makes the whole code very difficult to read and amend that only a very few functions are directly imported. For example, in geo_join dplyr::data_frame and dplyr::common_by are not referenced or imported. It is not logical to me why the above modification should not work. Given that in geo-matching lat.x must strictly match with lat.y and lon.x with lon.y it would be preferable to clearly pass on these arguments, for example, like by.lat = c("lat", "lat") and by.lon = c("lon", "lng")

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