[Raster-commits] r436 - in pkg/raster: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Apr 30 17:52:55 CEST 2009


Author: rhijmans
Date: 2009-04-30 17:52:55 +0200 (Thu, 30 Apr 2009)
New Revision: 436

Added:
   pkg/raster/man/extent.Rd
Removed:
   pkg/raster/man/getBbox.Rd
Modified:
   pkg/raster/R/overlayList.R
   pkg/raster/R/zonal.R
Log:


Modified: pkg/raster/R/overlayList.R
===================================================================
--- pkg/raster/R/overlayList.R	2009-04-28 14:43:49 UTC (rev 435)
+++ pkg/raster/R/overlayList.R	2009-04-30 15:52:55 UTC (rev 436)
@@ -61,6 +61,12 @@
 			}
 			vals <- do.call(fun, vallist)
 			
+			if (r == 1) {
+				if (length(vals) == 1 && ncol(outraster) > 1) {
+					stop('single value returned for a row; inappropriate formula used')
+				}
+			}
+			
 			if (outraster at file@name == "") {
 #				v <- c(v, vals)
 				v[startcells[r]:endcells[r]] <- vals

Modified: pkg/raster/R/zonal.R
===================================================================
--- pkg/raster/R/zonal.R	2009-04-28 14:43:49 UTC (rev 435)
+++ pkg/raster/R/zonal.R	2009-04-30 15:52:55 UTC (rev 436)
@@ -5,6 +5,7 @@
 # Licence GPL v3
 
 zonal <- function(raster, zones, stat='mean', keepdata=TRUE, track=-1) {
+	compare(c(raster, zones))
 
 	if (class(stat) != 'character') {
 		if (canProcessInMemory(raster, 3)) {

Added: pkg/raster/man/extent.Rd
===================================================================
--- pkg/raster/man/extent.Rd	                        (rev 0)
+++ pkg/raster/man/extent.Rd	2009-04-30 15:52:55 UTC (rev 436)
@@ -0,0 +1,47 @@
+\name{extent}
+
+\alias{extent}
+\alias{extent,BoundingBox-method}
+\alias{extent,BasicRaster-method}
+\alias{extent,Spatial-method}
+\alias{extent,matrix-method}
+\alias{extent,vector-method}
+\alias{bbox,Raster-method}
+
+  
+\title{Extent}
+
+\description{
+This function returns the extent, as a BoundingBox object, of a Raster* or Spatial* object (or a BoundingBox object). 
+It will also create a BoundingBox object from a matrix (2x2; rows=minx, maxx; cols=miny, maxy) or vector (length=4; order= xmin, xmax, ymin, ymax)
+
+\code{bbox(x)} returns a SP type bbox object (a matrix)
+}
+
+\usage{
+extent(x)
+}
+
+\arguments{
+  \item{x}{A Raster* or BoundingBox object } 
+}
+ 
+\value{
+A BoundingBox object
+}
+  
+\author{Robert J. Hijmans}
+
+\seealso{ \code{\link[raster]{setExtent}}, \code{\link[raster]{drawBox}} }
+
+\examples{
+r <- raster()
+extent(r)
+extent(c(0, 20, 0, 20))
+#is equivalent to
+newBbox(0, 20, 0, 20)
+
+extent(matrix(c(0, 0, 20, 20), nrow=2))
+}
+
+\keyword{spatial}

Deleted: pkg/raster/man/getBbox.Rd
===================================================================
--- pkg/raster/man/getBbox.Rd	2009-04-28 14:43:49 UTC (rev 435)
+++ pkg/raster/man/getBbox.Rd	2009-04-30 15:52:55 UTC (rev 436)
@@ -1,47 +0,0 @@
-\name{extent}
-
-\alias{extent}
-\alias{extent,BoundingBox-method}
-\alias{extent,BasicRaster-method}
-\alias{extent,Spatial-method}
-\alias{extent,matrix-method}
-\alias{extent,vector-method}
-\alias{bbox,Raster-method}
-
-  
-\title{Extent}
-
-\description{
-This function returns the extent, as a BoundingBox object, of a Raster* or Spatial* object (or a BoundingBox object). 
-It will also create a BoundingBox object from a matrix (2x2; rows=minx, maxx; cols=miny, maxy) or vector (length=4; order= xmin, xmax, ymin, ymax)
-
-\code{bbox(x)} returns a SP type bbox object (a matrix)
-}
-
-\usage{
-extent(x)
-}
-
-\arguments{
-  \item{x}{A Raster* or BoundingBox object } 
-}
- 
-\value{
-A BoundingBox object
-}
-  
-\author{Robert J. Hijmans}
-
-\seealso{ \code{\link[raster]{setExtent}}, \code{\link[raster]{drawBox}} }
-
-\examples{
-r <- raster()
-extent(r)
-extent(c(0, 20, 0, 20))
-#is equivalent to
-newBbox(0, 20, 0, 20)
-
-extent(matrix(c(0, 0, 20, 20), nrow=2))
-}
-
-\keyword{spatial}



More information about the Raster-commits mailing list