I am attempting to label polygons from a spatial feature data frame using ggplot2. I am trying to replicate the description here under the heading, "Download Some Boundary Data: State/County/HUC"
This is my code to try to get the lat and lon values to use for the label location in geom_text():
selected_sites <- arc.open(survey_sites)
ss <- arc.select(selected_sites)
ss_shape <- arc.data2sf(ss)
refcode_list <- ss$refcode
ss_shape <- ss_shape %>%
mutate(lon=map(geometry, ~st_centroid(.x)[[1]]),
lat=map(geometry, ~st_centroid(.x)[[2]]))
I keep getting the following error:
Error in mutate_impl(.data, dots) :
Evaluation error:.x
is not a vector (closure).