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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Mar 14 07:41:32 CET 2009


Author: rhijmans
Date: 2009-03-14 07:41:32 +0100 (Sat, 14 Mar 2009)
New Revision: 355

Modified:
   pkg/raster/NAMESPACE
   pkg/raster/R/median.R
   pkg/raster/man/Summary-methods.Rd
Log:


Modified: pkg/raster/NAMESPACE
===================================================================
--- pkg/raster/NAMESPACE	2009-03-14 06:16:00 UTC (rev 354)
+++ pkg/raster/NAMESPACE	2009-03-14 06:41:32 UTC (rev 355)
@@ -1,8 +1,8 @@
 importFrom("methods", Ops, Math)
 importFrom("graphics", hist, plot, lines)
-importFrom("stats", median, aggregate)
+importFrom("stats", aggregate)
 importFrom("utils", stack, unstack)
 importFrom("sp", overlay, bbox, Spatial, SpatialPixels, SpatialPixelsDataFrame, SpatialGrid, SpatialGridDataFrame)
 exportClasses(BoundingBox, BasicRaster, Raster, RasterLayer, RasterStack)
-exportMethods(raster, calc, overlay, bbox, aggregate, stack, unstack, show, summary, plot, hist, ncol, nrow, ncell, dim, lines, median)
+exportMethods(raster, calc, overlay, bbox, aggregate, stack, unstack, show, summary, plot, hist, ncol, nrow, ncell, dim, lines, Median)
 exportPattern("^[^\\.]")
\ No newline at end of file

Modified: pkg/raster/R/median.R
===================================================================
--- pkg/raster/R/median.R	2009-03-14 06:16:00 UTC (rev 354)
+++ pkg/raster/R/median.R	2009-03-14 06:41:32 UTC (rev 355)
@@ -4,22 +4,21 @@
 # Version 0.8
 # Licence GPL v3
 
-setGeneric("median", function(x, na.rm=FALSE)
-	standardGeneric("median"))
+setGeneric("Median", function(x, ...)
+	standardGeneric("Median"))
 
 
-#setMethod('median', signature(x='ANY'), 
-#	function(x, ..., na.rm=FALSE){
-#		x <- c(x, ...)
-#		return(stats::median(x, na.rm=na.rm))
-#	}
-#)
+setMethod('Median', signature(x='ANY'), 
+	function(x, ..., na.rm=FALSE){
+		x <- c(x, ...)
+		return(stats::median(x, na.rm=na.rm))
+	}
+)
 
 
-setMethod("median", signature(x='Raster'),
-#	function(x, ..., na.rm=FALSE){
-#		rasters <- list(...)
-	function(x, na.rm=FALSE){
+setMethod("Median", signature(x='Raster'),
+	function(x, ..., na.rm=FALSE){
+		rasters <- list(...)
 		if (class(x) == 'RasterLayer') {
 			if (length(rasters)==0) { 
 				return(x) 

Modified: pkg/raster/man/Summary-methods.Rd
===================================================================
--- pkg/raster/man/Summary-methods.Rd	2009-03-14 06:16:00 UTC (rev 354)
+++ pkg/raster/man/Summary-methods.Rd	2009-03-14 06:41:32 UTC (rev 355)
@@ -1,11 +1,12 @@
 \name{Summary}
+
 \docType{methods}
 
 \alias{Summary,Raster-method}
 \alias{mean,Raster-method}
-\alias{median}
-\alias{median,ANY-method}
-\alias{median,Raster-method}
+\alias{Median}
+\alias{Median,ANY-method}
+\alias{Median,Raster-method}
 
 \title{ Summary methods }
 
@@ -15,7 +16,10 @@
  \code{mean, median, max, min, range, prod, sum, any, all}
 }
 
+
 \note{
+ All methods take code{na.rm} as an additional logical argument. Default is \code{FALSE}. 
+ If \code{TRUE}, NA values are removed from calculations
  These methods compare layers and the result of these methods is always a single RasterLayer. 
  
  You can mix RasterLayer, RasterStack objects and single numeric or logical values. 



More information about the Raster-commits mailing list