I created a data frame (projects) by merging a shape file (US Zip codes) and a dataset. The below line of code returns the X and Y coordinates of my data frame (project)! I Would like to include longitude and latitude in two columns in the project data frame.
However, I just need one lat and long for each zip code. I think the mean of long and lat for each zip code should be sufficient.
head(st_coordinates(projects))
> head(st_coordinates(projects))
X Y L1 L2 L3
[1,] -71.36374 41.85854 1 1 1
[2,] -71.36449 41.85847 1 1 1
[3,] -71.36473 41.85844 1 1 1
[4,] -71.36580 41.85834 1 1 1
[5,] -71.36573 41.85828 1 1 1
[6,] -71.36562 41.85818 1 1 1