I have data like the following:
These data are obtained from a Stata dataset (.dta exported to .csv) and are intended to plot a map of shapefiles. I import it into R, drop rows with missing data, and convert to sf (I am not sure if this is the best way to do it). I then plot.
coords <- read.csv("filename.csv") %>% drop_na()
coords2 <- st_as_sf(x=coords, coords = c("X_X", "X_Y"))
ggplot(coords2) + geom_sf()
This is what I get:
How can I instead get a map that has lines instead of the points? And how can I shade the individual map areas based on another variable, such as X_ID?