Calculating OPC in R GIS