[R-sig-Geo] Extract() fails to return data for boundary admin units

Bacou, Melanie mel at mbacou.com
Tue Oct 18 21:06:23 CEST 2016


Chris,
Actually I take that back, using extract() with `weights=TRUE` returned 
`0` instead of NA values for these problematic coastal admin units. 
Think I might have to impute them manually.

--Mel.


On 10/18/2016 2:33 PM, Bacou, Melanie wrote:
>
> Chris,
> Thanks, using `weights=TRUE` to compute the means fixed the problem.
> Perfect, --Mel.
>
>
> On 10/18/2016 11:10 AM, chris english wrote:
>>
>> Mel,
>>
>> Looking at detail in cjg.png the northmost missing data island shows 
>> approx 20-25 in Southern three quarters and 0-5 the small North at 
>> tip of island. Directly above this 0-5 another coastal 0-5.
>> If a substantial east-west scarp bisected the island it might 
>> explain. I would otherwise expect a very slight mismatch in 
>> projection, a thing I often have problems with.
>>
>> Though reading raster::extract it looks like you want to employ the 
>> weights are if your polys are relatively smaller than your cells.
>>
>> HTH
>> Chris
>>
>>
>> On Oct 18, 2016 4:35 PM, "Bacou, Melanie" <mel at mbacou.com 
>> <mailto:mel at mbacou.com>> wrote:
>>
>>     Hi,
>>     I'm summarizing biophysical rasters (UDEL precipitation and
>>     temperature) across administrative units for countries in Africa
>>     using (pseudo code):
>>
>>     raster::extract(udel, admin, fun=mean, na.rm=T, small=T)
>>
>>     Out of the 756 units I need data for, extract() fails to return
>>     means for a few coastal units (in red on the maps below) even
>>     though the rasters show data at these locations.
>>
>>     Is there a particular reason why this might happen? Shall I look
>>     for possible geometry errors in my source shapefiles, or could
>>     there be another reason?
>>
>>     Maps here:
>>     https://dl.dropboxusercontent.com/u/30925475/eclgcdmhapfplaml.png
>>     <https://dl.dropboxusercontent.com/u/30925475/eclgcdmhapfplaml.png>
>>     https://dl.dropboxusercontent.com/u/30925475/lmkgmdoohpmhdcjg.png
>>     <https://dl.dropboxusercontent.com/u/30925475/lmkgmdoohpmhdcjg.png>
>>
>>     Thanks for any tip. --Mel.
>>
>>     _______________________________________________
>>     R-sig-Geo mailing list
>>     R-sig-Geo at r-project.org <mailto:R-sig-Geo at r-project.org>
>>     https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>     <https://stat.ethz.ch/mailman/listinfo/r-sig-geo>
>>
>


	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list