I’m getting angry about something that seems simple to me. I would like to select the points inside a polygon with the sf package. Both have the same CRS : EPSG:27572 "NTF (Paris) / Lambert zone II. I can't provide a reproductible example because data are confidential...
My points :
Classes ‘sf’ and 'data.frame': 5033 obs. of 6 variables:
$ date : chr "18/04/2014" "17/04/2014" "21/04/2014" "22/04/2014" ...
$ id : chr "Auberta" "Auberta" "Auberta" "Auberta" ...
$ sex : chr "F" "F" "F" "F" ...
$ age : chr "0" "0" "0" "0" ...
$ year : chr "2014" "2014" "2014" "2014" ...
$ geometry:sfc_POINT of length 5033; first list element: 'XY' num 472270 1752852
- attr(*, "sf_column")= chr "geometry"
- attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA NA NA NA
..- attr(*, "names")= chr [1:5] "date" "id" "sex" "age" ...
My polygon :
Classes ‘sf’ and 'data.frame': 1 obs. of 2 variables:
$ zone2 : chr "30T"
$ geometry:sfc_POLYGON of length 1; first list element: List of 1
..$ : num [1:29, 1:2] 425644 422338 419034 415729 412423 ...
..- attr(*, "class")= chr [1:3] "XY" "POLYGON" "sfg"
- attr(*, "sf_column")= chr "geometry"
- attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA
..- attr(*, "names")= chr "zone2"
I tried the st_join function but no matter what I put in the join argument, all points are subset. I attach a screenshot.
HELP PLEASE !


