I have little practice with the R program.
I have a raster (A) with a resolution of 25 m, and a shapefile (B) with 28 points. Both are in the same coordinate system. I need to get all the values of the cells that are within a 150 meter buffer around each point. I think each buffer should have about 36 cells, but when I ask for an extract it gives me 113 values for each buffer instead of 36.
library(rgdal)
library(raster)
rasterA<-raster("raster_files/rasterA.tif")
points<-shapefile("shapes/points.shp")
buf_extract<-extract(rasterA,points, buffer=150, fun=mean)
> buf_extract
[1] 6.302614 11.469918 10.688248 12.084446 8.289129 15.961509 9.301893
[8] 13.021266 15.639012 8.104079 9.027967 12.720691 8.267416 14.272940
[15] 15.952641 8.804795 11.739820 7.717286 9.892222 9.167639 21.376933
[22] 17.556753 10.857881 9.965647 4.061926 7.895299 13.135085 9.009453
28 values (1 for each buffer, but i need all the values)
buf_extract2<-extract(rasterA,points, buffer=150)
this give me 113values for each buffer
[[1]]
[1] 7.593949 7.834788 7.719778 6.108775 6.454401 6.872255 7.262654 7.368511
[9] 7.042189 6.777296 5.291142 5.157088 5.199492 5.433459 5.909557 6.537760
[17] 6.369468 5.573733 5.383897 6.002542 5.506225 5.344615 5.221140 4.974058
[25] 4.915928 5.353066 5.750508 5.161426 4.573459 4.535450 6.148440 5.818326
[33] 5.889338 6.021966 5.715917 5.161469 4.724522 5.067512 5.153687 4.575481
[41] 4.097950 6.381460 6.325565 6.144562 6.246908 6.468264 6.433755 6.032630
[49] 5.059701 4.552027 4.641086 4.752925 4.467887 6.559077 6.672942 6.681599
[57] 6.906225 7.123539 7.038149 6.903086 5.969213 4.576506 4.187059 4.771128
[65] 5.173688 7.060712 6.977954 6.832266 6.908452 7.270662 7.417850 7.708537
[73] 7.058840 4.895347 4.301607 4.968847 5.676866 7.394628 7.233017 7.049599
[81] 7.190104 7.483492 8.210265 7.840908 5.259006 5.095017 5.967366 6.436542
[89] 7.125921 7.189645 7.426985 7.459230 7.546505 8.483737 8.355728 6.272616
[97] 6.374536 6.871512 6.731644 7.335055 7.529627 7.503234 8.326931 8.253778
[105] 6.992667 6.549087 6.380013 7.372172 7.511145 7.447345 7.769475 7.352947
[113] 6.123725