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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jan 19 14:29:22 CET 2009


Author: jacobvanetten
Date: 2009-01-19 14:29:22 +0100 (Mon, 19 Jan 2009)
New Revision: 159

Modified:
   pkg/raster/R/properties.R
Log:
nlayers

Modified: pkg/raster/R/properties.R
===================================================================
--- pkg/raster/R/properties.R	2009-01-19 12:58:56 UTC (rev 158)
+++ pkg/raster/R/properties.R	2009-01-19 13:29:22 UTC (rev 159)
@@ -70,12 +70,11 @@
 	return(c(x, y))
 }
 
-
 nlayers <- function(object) {
-	if (class(object) == "RasterLayer") {
-		return(1)
-	} else {
+	if (class(object) == "RasterStack" | class(object) == "RasterBrick") {
 		return(object at data@nlayers)
+	} else {
+		return(1)
 	}	
 }
 



More information about the Raster-commits mailing list