I have a grid created by mean the following script:
# My grid [using package 'sf'] worldGrid <- st_make_grid(x = worldMap, what = "polygons", cellsize = 10) worldGrid <- st_sf(idcell = 1:length(worldGrid), geom = worldGrid) %>% st_cast("POLYGON")
What I want to obtain is a SpatialPolygonDataframe with tre columns: idcell, LONG, LAT
where the coordinates 'LOG' and 'LAT' represent the longitude and latitude of the centroids of each cell of my grid, respectively.
Is that possible in R?