Combining geom_sf data with a dataframe

Aloha. I'm new and apologize in advance for any gaffes.

I'm trying to combine a multi-polygon shapefile (with POLYGON geometry) and CSV-type data using geom_sf in ggplot2. I have read all I can find about proper use of CRS and have a lot of GIS experience. So, I'm not confused about CRS basics.

My problem seems to be that the dataframe attributes and the geom_sf data do not share common Longitude, Latitude attributes. I've tried 'longitude', 'long' and 'Longitude', for example, without resolution. This seems to be data dependent so I don't have an MWE at this point.

Here's a 2-line example:

p1 = ggplot(C3, aes(x=long, y=lat, color=HR_NAME, group=DAUCO))
p1 + geom_point(size=10) + geom_sf(data = SFWGS84)

Error in FUN(X[[i]], ...) : object 'long' not found

However, I cannot grok how to resolve this. Any suggestions are appreciated.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.