When I clip two spatial point data sets of the same dimensions to a polygon, a different number of rows results. These images show the vector boundary used to clip (red), and black and white are 0s and 1s in two rasters that I've converted to simple x/y data to intersect with the polygon. This is just to illustrate the data; I did not attempt to clip the raster data.
The boundary used to clip is not a multipolygon; it's displayed in two parts because it straddles the international dateline. This boundary is in the middle of the Pacific Ocean. I used the same code to clip the same data for another boundary in the Atlantic Ocean and I did not have the problem; resulting number of rows matched.
[enter image description here](https://i.enter image description herestack.imgur.com/TP8bL.jpg)
I am expecting: nrow(NPFC_T2_sf_clip) to equal nrow(NPFC_T2_sf_clip) when I run the following R code:
NPFC_T1_sf_clip <- NPFC_T1_sf %>% sf::st_join(NPFC, join = st_intersects) %>% # use a spatial join filter(RFB == 'NPFC') %>% # filter only datapoints within NPFC bind_cols(st_coordinates(.) %>% as.data.frame()) %>% rename(y = Y, x = X) %>% st_set_geometry(NULL)`
`NPFC_T2_sf_clip <- NPFC_T2_sf %>% sf::st_join(NPFC, join = st_intersects) %>% # use a spatial join filter(RFB == 'NPFC') %>% # filter only datapoints within NPFC bind_cols(st_coordinates(.) %>% as.data.frame()) %>% rename(y = Y, x = X) %>% st_set_geometry(NULL)
nrow(NPFC_T1_sf) = 1681667
nrow(NPFC_T2_sf) = 1681667
nrow(NPFC_T1_sf_clip) = 272996
nrow(NPFC_T2_sf_clip) = 272781