I have some polygons in a data.frame
called walktime
.
> class(walktime)
[1] "sf" "data.frame"
I want to combine the polygons to one. As I understand this is possible with
walktime2 <- sf::st_combine(walktime)
> class(walktime2)
[1] "sfc_MULTIPOLYGON" "sfc"
But if I plot walktime2
I have holes in my combined polygon.
How can I avoid this?
Thanks for any help.
Reproducable code is here: https://github.com/StatistikVolker/exp_st_combine_holes
You need
st_union
rather thanst_combine
.From the docs for
?st_combine
Whereas
So we can resolve your issue by doing: