I have a dataframe with around 40 points. They are grouped by an ID variable (their name), which four points in each group. I'm trying to turn these points into polygons, but I've had a lot of trouble with different methods in both sf and sp — currently I have them as a large sf dataframe, but I can't seem to find any function that would use a grouping variable to create polygons.
I've tried using the st_cast method, the general idea being
polypoints <- polypoints %>%
group_by("ID") %>%
st_cast("MULTIPOINT") %>%
st_cast("MULTILINESTRING") %>%
st_cast("MULTIPOLYGON")
but the step from multipoint to multiline string leaves the geography empty — what are the steps for a process like this?






MULITPOLYGONa typo in the code or just here? – Spacedman Aug 19 '19 at 19:51