Skip to content
Prev 26777 / 29559 Next

Spatial Query (Selection) with Apply

Hi,

I want to do multiple selections of a point shapefile based on polygons on
other layers, I can do this in a for loop, but I desire to do this in a
function of the apply family.

I named the point shapefile "nodes" and the polygons shapefile "zones".

This is what I did:

tmp <- list()
for (i in 1:nrow(zones at data)) {
    tmp[[i]] <- nodes[subset(zones, ESTUDIO == i),]
    tmp
  }

But I have no clue how to change it to the apply family, can you provide
an example of this?

Thanks in advance.

Regards,
Ariel Fuentes