[Raster-commits] r144 - pkg/raster/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jan 16 06:46:58 CET 2009


Author: rhijmans
Date: 2009-01-16 06:46:58 +0100 (Fri, 16 Jan 2009)
New Revision: 144

Modified:
   pkg/raster/R/get.R
Log:


Modified: pkg/raster/R/get.R
===================================================================
--- pkg/raster/R/get.R	2009-01-16 03:53:19 UTC (rev 143)
+++ pkg/raster/R/get.R	2009-01-16 05:46:58 UTC (rev 144)
@@ -136,10 +136,10 @@
 
 	# RH: ouch. Use Apply instead:
 	cells <- vector("integer", length=0)
-	for (i in startrow:endrow) {
-		firstcell <- (i-1) * ncol(object) + startcol
-		lastcell <- (i-1) * ncol(object) + endcol
-		cells <- c(cells, c(firstcell:lastcell))
+	for (r in startrow:endrow) {
+		firstcell <- cellFromRowCol(object, r, startcol)
+		lastcell <- cellFromRowCol(object, r, endcol)
+		cells <- c(cells, firstcell:lastcell)
 	}
 	return(cells)
 }



More information about the Raster-commits mailing list