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

Additional args to FUN in st_join() don't work #376

Closed
Robinlovelace opened this issue Jun 6, 2017 · 6 comments
Closed

Additional args to FUN in st_join() don't work #376

Robinlovelace opened this issue Jun 6, 2017 · 6 comments

Comments

@Robinlovelace
Copy link
Contributor

Reproducible example (on sf_0.4-3 not tested on latest version):

library(sf)
example("st_join")
st_join(a, b, FUN = mean, na.rm = T)
@edzer
Copy link
Member

edzer commented Jun 6, 2017

Well, the ... are now passed on to the join function; you can't pass them on to both; in the dev version (which I'm looking at) this is documented. Whether it is a good idea is another question. The thinking was that you could pass on a pattern to st_relate, when that is used to join.

@Robinlovelace
Copy link
Contributor Author

Robinlovelace commented Jun 11, 2017

If it's documented that makes it less of an issue but I still think it's an issue: if people have a FUN argument a logical next step is to pass it args, as with lapply etc.

I see the issue about not being able to pass all ... and am not sure what the best solution to this issue is. If the code above can be made to work, or replaced by a different command that achieves the same result in example("st_join") that would be a benefit for users I think.

Robinlovelace referenced this issue in geocompx/geocompr Jun 11, 2017
@edzer
Copy link
Member

edzer commented Jun 11, 2017 via email

@edzer
Copy link
Member

edzer commented Jun 12, 2017

I am going to remove the FUN argument, and leave aggregation to sf::aggregate.sf of summarise, so that we can do this, following the example of ?st_join, by

st_join(a, b) %>% aggregate(list(.$a.x), mean)

or

library(dplyr)
st_join(a, b) %>% group_by(a.x) %>% summarise(mean(a.y))

@edzer
Copy link
Member

edzer commented Jun 12, 2017

Deprecated arg FUN in st_join in 1db9b59.

@edzer edzer closed this as completed Jun 12, 2017
@Robinlovelace
Copy link
Contributor Author

Thanks Edzer, great fix! Will look into docs although probably not until I'm back from travels in July.

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

2 participants