title: How to calculate distance matrix using gDistance in R?
body: <p>I'd like to calculate distance from polygons. for calculate methode, i use hausdorff distance. i have calculate for 2 polygon only. how to calculate for polygons? need your help please.
  this source code for calculate 2 polygon</p>
  
  <blockquote>
    <p>library(maptools)</p>
    
    <p>library(rgdal)</p>
    
    <p>shape &lt;- readShapePoly("clipjawa.shp") #load for file .shp</p>
    
    <p>pemalang &lt;- shape[1,1]  #save coordinates from polygon 1 to variable pemalang</p>
    
    <p>tegal &lt;- shape[2,1]  #save coordinates from polygon 2 to variable tegal</p>
    
    <p>distance &lt;- gDistance(pemalang,tegal,hausdorff=TRUE)</p>
  </blockquote>