Calculating OPC using GIS in R