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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jan 25 16:45:07 CET 2009


Author: rhijmans
Date: 2009-01-25 16:45:07 +0100 (Sun, 25 Jan 2009)
New Revision: 181

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


Modified: pkg/raster/R/read.raster.R
===================================================================
--- pkg/raster/R/read.raster.R	2009-01-25 15:14:28 UTC (rev 180)
+++ pkg/raster/R/read.raster.R	2009-01-25 15:45:07 UTC (rev 181)
@@ -300,17 +300,16 @@
 	for (i in seq(nlayers(rstack))) {
 		raster <- readPartOfRow(rstack at layers[[i]], rownumber, startcol, ncolumns)
 		if ( i == 1 )  {
-			rstack at data@values <- as.matrix(values(raster))
+			rstack at data@values <- matrix(nrow=length(values(raster)), ncol=nlayers(rstack)) 
 			rstack at data@content <- dataContent(raster)
 			rstack at data@indices <- dataIndices(raster)
 		}
-		else {
-			rstack at data@values <- cbind(rstack at data@values, values(raster)) 
-		}	   
+		rstack at data@values[,i] <- values(raster)
 	}
 	return(rstack)
 }
 
+
 .stackReadCells <- function(object, cells) {
 		for (i in seq(nlayers(object))) {
 			v <- .rasterReadCells(object at layers[[i]], cells)



More information about the Raster-commits mailing list