[Raster-commits] r348 - pkg/raster/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Mar 13 08:26:43 CET 2009


Author: jacobvanetten
Date: 2009-03-13 08:26:43 +0100 (Fri, 13 Mar 2009)
New Revision: 348

Modified:
   pkg/raster/man/pointdistance.Rd
Log:
dist example suggestion Robert

Modified: pkg/raster/man/pointdistance.Rd
===================================================================
--- pkg/raster/man/pointdistance.Rd	2009-03-13 04:58:09 UTC (rev 347)
+++ pkg/raster/man/pointdistance.Rd	2009-03-13 07:26:43 UTC (rev 348)
@@ -45,8 +45,12 @@
    
    #Make a distance matrix (dist object)
    dst <- matrix(nrow=4,ncol=4)
-   for (i in 1:4){dst[,i] <- distanceGreatcircle(a[i,],b)}
+   for (i in 1:4){dst[,i] <- distanceGreatcircle(a[i,],a)}
    dst <- as.dist(dst)
+   
+   #Now the same, but avoiding the loop
+   dst <- distanceGreatcircle(a[rep(1:4,times=4),],a[rep(1:4,each=4),])
+   dst <- as.dist(matrix(dst,ncol=4))
 }
 
 \keyword{ spatial }



More information about the Raster-commits mailing list