Skip to content
Prev 29126 / 29559 Next

Problem with writing a function that attaches atributes from polygons of a shapefile to the points of a grid

Hi Miguel,
Maybe this way:


xy<-gridcentres(madrid_sqr_m,150,150)
xy.df <- as.data.frame(xy)
xy_sf <- st_as_sf(xy.df, coords=1:2)
xy_crs <- st_sfc(xy_sf, crs=25830)
xy_joined <- st_join(xy_crs, Catfiscal)
join.ppp <- ppp(st_coordinates(xy_joined)[,"X"], 
st_coordinates(xy_joined)[,"Y"], window=madrid_sqr_m, marks 
=xy_joined$categoria)

Cheers,
Marcelino




El 23/01/2023 a las 20:11, MIGUEL GOMEZ DE ANTONIO escribi?: