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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat May 2 14:35:06 CEST 2009


Author: rhijmans
Date: 2009-05-02 14:35:05 +0200 (Sat, 02 May 2009)
New Revision: 437

Added:
   pkg/raster/R/rasterTmpFile.R
   pkg/raster/man/NAvalue.Rd
Removed:
   pkg/raster/man/setNAvalue.Rd
Modified:
   pkg/raster/R/Artith.R
   pkg/raster/R/Compare_Logical.R
   pkg/raster/R/Math.R
   pkg/raster/R/Merge.R
   pkg/raster/R/aggold.R
   pkg/raster/R/aggregate.R
   pkg/raster/R/calc.R
   pkg/raster/R/calcStack.R
   pkg/raster/R/compare.R
   pkg/raster/R/cover.R
   pkg/raster/R/crop.R
   pkg/raster/R/disaggregate.R
   pkg/raster/R/distance.R
   pkg/raster/R/expand.R
   pkg/raster/R/overlayList.R
   pkg/raster/R/polygonToRaster.R
   pkg/raster/R/project.R
   pkg/raster/R/readRaster.R
   pkg/raster/R/reclass.R
   pkg/raster/R/resample.R
   pkg/raster/R/summary.R
   pkg/raster/R/valuesRow.R
   pkg/raster/R/writeGDAL.R
   pkg/raster/man/compare.Rd
Log:


Modified: pkg/raster/R/Artith.R
===================================================================
--- pkg/raster/R/Artith.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/Artith.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -12,7 +12,7 @@
 			if (canProcessInMemory(e1, 4)) {
 				raster <- raster(e1, values=callGeneric( as.numeric(.getRasterValues(e1)), .getRasterValues(e2)))
 			} else {
-				raster <- raster(e1, filename=tempfile())
+				raster <- raster(e1, filename=rasterTmpFile())
 				for (r in 1:nrow(e1)) {
 					raster <- setValues(raster, callGeneric( as.numeric(.getRowValues(e1, r)), .getRowValues(e2, r) ), r)
 					raster <- writeRaster(raster)
@@ -32,7 +32,7 @@
 		if (canProcessInMemory(e1, 4)) {
 			return(raster(e1, values=callGeneric(as.numeric(.getRasterValues(e1)), e2) ) )
 		} else {
-			raster <- raster(e1, filename=tempfile())
+			raster <- raster(e1, filename=rasterTmpFile())
 			for (r in 1:nrow(e1)) {
 				raster <- setValues(raster, callGeneric( as.numeric(.getRowValues(e1, r)), e2) , r) 
 				raster <- writeRaster(raster)
@@ -50,7 +50,7 @@
 		if (canProcessInMemory(e2, 4)) {
 			return(raster(e2, values=callGeneric(as.numeric(e1), .getRasterValues(e2))))
 		} else {
-			raster <- raster(e2, filename=tempfile())
+			raster <- raster(e2, filename=rasterTmpFile())
 			for (r in 1:nrow(e2)) {
 				raster <- setValues(raster, callGeneric(as.numeric(e1), .getRowValues(e2, r)) , r)
 				raster <- writeRaster(raster)

Modified: pkg/raster/R/Compare_Logical.R
===================================================================
--- pkg/raster/R/Compare_Logical.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/Compare_Logical.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -45,7 +45,7 @@
 		if (canProcessInMemory(x, 3)) {
 			return(setValues(x, !values(x)))
 		} else {
-			rst <- raster(x, filename=tempfile())
+			rst <- raster(x, filename=rasterTmpFile())
 			dataType(rst) <- 'LOG1S'
 			for (r in 1:nrow(x)) {
 				rst <- setValues(rst, !.getRowValues(x, r), r)
@@ -68,7 +68,7 @@
 		if (canProcessInMemory(e1, 3)) {
 			rst <- setValues(rst, values=callGeneric(.getRasterValues(e1), rep(e2, ncell(e1)) ) )			
 		} else {
-			filename(rst) <- tempfile()
+			filename(rst) <- rasterTmpFile()
 			rowrep <- rep(e2, ncol(e1))
 			for (r in 1:nrow(e1)) {
 				rst <- setValues(rst, callGeneric( .getRowValues(e1, r), rowrep ), r)
@@ -80,7 +80,50 @@
 )	
 
 
+setMethod("Compare", signature(e1='RasterLayer', e2='logical'),
+	function(e1,e2){
+		if (!isTRUE(is.atomic(e2) & length(e2)==1)) {
+			stop('second argument should be a single logical value')
+		}
+		rst <- raster(e1)
+		dataType(rst) <- 'LOG1S'
+		if (canProcessInMemory(e1, 3)) {
+			rst <- setValues(rst, values=callGeneric(.getRasterValues(e1), e2 ) )			
+		} else {
+			filename(rst) <- rasterTmpFile()
+			for (r in 1:nrow(e1)) {
+				rst <- setValues(rst, callGeneric( .getRowValues(e1, r), e2 ), r)
+				rst <- writeRaster(rst)
+			}
+		}
+		return(rst)
+	}
+)
 
+
+
+setMethod("Compare", signature(e1='logical', e2='RasterLayer'),
+	function(e1,e2){
+		if (!isTRUE(is.atomic(e1) & length(e1)==1)) {
+			stop('first argument should be a single logical value')
+		}
+		rst <- raster(e2)
+		dataType(rst) <- 'LOG1S'
+		if (canProcessInMemory(e2, 3)) {
+			rst <- setValues(rst, values=callGeneric(.getRasterValues(e2), e1 ) )			
+		} else {
+			filename(rst) <- rasterTmpFile()
+			for (r in 1:nrow(e2)) {
+				rst <- setValues(rst, callGeneric( .getRowValues(e2, r), e1 ), r)
+				rst <- writeRaster(rst)
+			}
+		}
+		return(rst)
+	}
+)
+
+
+
 setMethod("Compare", signature(e1='numeric', e2='RasterLayer'),
 	function(e1,e2){
 		if (!isTRUE(is.atomic(e1) & length(e1)==1)) {
@@ -91,7 +134,7 @@
 			dataType(rst) <- 'LOG1S'
 			rst <- setValues(rst, callGeneric(.getRasterValues(e2), rep(e1, ncell(e2)) ) )
 		} else {
-			rst <- raster(e2, filename=tempfile())
+			rst <- raster(e2, filename=rasterTmpFile())
 			dataType(rst) <- 'LOG1S'
 			rowrep <- rep(e1, ncol(e2))
 			for (r in 1:nrow(e2)) {
@@ -114,7 +157,7 @@
 		if (canProcessInMemory(e1, 3)) {
 			rst <- setValues(rst, callGeneric(.getRasterValues(e1), .getRasterValues(e2) ) ) 
 		} else {
-			filename(rst) <- tempfile()
+			filename(rst) <- rasterTmpFile()
 			for (r in 1:nrow(e1)) {
 				rst <- setValues(rst, callGeneric( .getRowValues(e1, r), .getRowValues(e2, r) ), r)
 				rst <- writeRaster(rst)
@@ -136,7 +179,7 @@
 			if (canProcessInMemory(e1, 3)) {
 				rst <- setValues(rst, callGeneric(.getLogicalValues(e1), .getLogicalValues(e2)))
 			} else {
-				filename(rst) <- tempfile()
+				filename(rst) <- rasterTmpFile()
 				for (r in 1:nrow(e1)) {
 					rst <- setValues(rst, callGeneric( .getLogicalRowValues(e1, r), .getLogicalRowValues(e2, r) ), r)
 					rst <- writeRaster(rst)

Modified: pkg/raster/R/Math.R
===================================================================
--- pkg/raster/R/Math.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/Math.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -16,7 +16,7 @@
 				dataType(rst) <- 'INT4S'
 			}
 		} else {
-			rst <- raster(x, filename=tempfile())
+			rst <- raster(x, filename=rasterTmpFile())
 			if (fname %in% c('floor', 'ceiling', 'trunc')) {
 				dataType(rst) <- 'INT4S'
 			}
@@ -43,7 +43,7 @@
 			}
 			return(x)
 		} else {
-			rst <- raster(x, filename=tempfile())
+			rst <- raster(x, filename=rasterTmpFile())
 			if (digits == 0) {
 				dataType(x) <- 'INT4S'
 			}

Modified: pkg/raster/R/Merge.R
===================================================================
--- pkg/raster/R/Merge.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/Merge.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -49,7 +49,7 @@
 	v <- vector(length=0)
 	
 	if (!canProcessInMemory(x, 2) && filename == '') {
-		filename <- tempfile()
+		filename <- rasterTmpFile()
 		filename(outraster) <- filename
 		if (options('verbose')[[1]]) { cat('writing raster to:', filename(raster))	}						
 	}

Modified: pkg/raster/R/aggold.R
===================================================================
--- pkg/raster/R/aggold.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/aggold.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -71,7 +71,7 @@
 
 	} else if ( dataSource(x) == 'disk') { 
 		if (!canProcessInMemory(x, 2) && filename == '') {
-			filename <- tempfile()
+			filename <- rasterTmpFile()
 			filename(outraster) <- filename
 			if (options('verbose')[[1]]) { cat('writing raster to:', filename(raster))	}						
 		}

Modified: pkg/raster/R/aggregate.R
===================================================================
--- pkg/raster/R/aggregate.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/aggregate.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -80,7 +80,7 @@
 			mem <- FALSE
 		}
 		if (!canProcessInMemory(x, 2) && filename == '') {
-			filename <- tempfile()
+			filename <- rasterTmpFile()
 			filename(outRaster) <- filename
 			if (options('verbose')[[1]]) { cat('writing raster to:', filename(outRaster))	}						
 		}

Modified: pkg/raster/R/calc.R
===================================================================
--- pkg/raster/R/calc.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/calc.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -35,7 +35,7 @@
 		}
 	} else if (dataSource(x) == 'disk') {
 		if (!canProcessInMemory(x, 3) & filename == '') {
-			filename <- tempfile()
+			filename <- rasterTmpFile()
 			filename(outraster) <- filename
 		}
 		v <- vector(length=0)

Modified: pkg/raster/R/calcStack.R
===================================================================
--- pkg/raster/R/calcStack.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/calcStack.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -26,7 +26,7 @@
 	} else {
 		starttime <- proc.time()
 		if (!canProcessInMemory(x, 4) & filename == '') {
-			filename=tempfile()
+			filename=rasterTmpFile()
 			filename(outraster) <- filename
 		}
 		v <- vector(length=0)

Modified: pkg/raster/R/compare.R
===================================================================
--- pkg/raster/R/compare.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/compare.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -8,11 +8,12 @@
 
 
 
-compare <- function(objects, bb=TRUE, rowcol=TRUE, prj=TRUE, res=FALSE, orig=FALSE, tolerance=0.05, stopiffalse=TRUE, showwarning=FALSE) {
+compare <- function(object, ..., bb=TRUE, rowcol=TRUE, prj=TRUE, res=FALSE, orig=FALSE, tolerance=0.05, stopiffalse=TRUE, showwarning=FALSE) {
 	result <- TRUE
+	objects <- c(object, list(...))
 	if (!isTRUE(length(objects) > 1)) {
-		result <- F
-		stop('The first argument should consist of at least 2 Raster* objects')
+		warning('There should be at least 2 Raster* objects to compare')
+		return(result)
 	}	
 	minres <- min(res(objects[[1]]))
 	for (i in 2:length(objects)) { 

Modified: pkg/raster/R/cover.R
===================================================================
--- pkg/raster/R/cover.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/cover.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -36,7 +36,7 @@
 		}
 		
 		if (!canProcessInMemory(x, 4) && filename == '') {
-			filename <- tempfile()
+			filename <- rasterTmpFile()
 			filename(outraster) <- filename
 			if (options('verbose')[[1]]) { cat('writing raster to:', filename(raster))	}						
 		}

Modified: pkg/raster/R/crop.R
===================================================================
--- pkg/raster/R/crop.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/crop.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -31,7 +31,7 @@
 	} else if ( dataSource(raster) == 'disk') { 
 		
 		if (!canProcessInMemory(outraster, 2) && filename == '') {
-			filename <- tempfile()
+			filename <- rasterTmpFile()
 			filename(outraster) <- filename
 			if (options('verbose')[[1]]) { cat('writing raster to:', filename(outraster))	}						
 		}

Modified: pkg/raster/R/disaggregate.R
===================================================================
--- pkg/raster/R/disaggregate.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/disaggregate.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -37,7 +37,7 @@
 	} else if ( dataSource(raster) == 'disk') { 
 		
 		if (!canProcessInMemory(outraster) && filename == '') {
-			filename <- tempfile()
+			filename <- rasterTmpFile()
 			filename(outraster) <- filename
 			if (options('verbose')[[1]]) { cat('writing raster to:', filename)	}						
 		}

Modified: pkg/raster/R/distance.R
===================================================================
--- pkg/raster/R/distance.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/distance.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -64,8 +64,8 @@
 			ncols <- ncol(object)
 
 			m <- c(-Inf, Inf, 0)
-			rsl1 <- reclass(object, m, filename=tempfile(), overwrite=TRUE)
-			rsl2 <- raster(tempfile())
+			rsl1 <- reclass(object, m, filename=rasterTmpFile(), overwrite=TRUE)
+			rsl2 <- raster(rasterTmpFile())
 			
 			if(isLatLon(object)){
 				remainingCells <- TRUE

Modified: pkg/raster/R/expand.R
===================================================================
--- pkg/raster/R/expand.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/expand.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -47,7 +47,7 @@
 
 	} else if ( dataSource(raster) == 'disk' ) { 
 		if (!canProcessInMemory(outraster, 4) && filename == '') {
-			filename <- tempfile()
+			filename <- rasterTmpFile()
 			filename(outraster) <- filename
 			if (options('verbose')[[1]]) { cat('writing raster to:', filename(raster))	}						
 		}

Modified: pkg/raster/R/overlayList.R
===================================================================
--- pkg/raster/R/overlayList.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/overlayList.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -36,7 +36,7 @@
 	} else {
 		if (outraster at file@name == "") {
 			if (!canProcessInMemory(outraster, 4)) {
-				filename <- tempfile()
+				filename <- rasterTmpFile()
 				filename(outraster) <- filename
 			} else {
 				v  <- vector(length=ncell(outraster))

Modified: pkg/raster/R/polygonToRaster.R
===================================================================
--- pkg/raster/R/polygonToRaster.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/polygonToRaster.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -223,7 +223,7 @@
 		rv[holes] <- NA
 		
 		if (updateRaster) {
-			oldvals <- values(readRow(oldraster, r))
+			oldvals <- valuesRow(oldraster, r)
 			if (updateValue == "all") {
 				ind <- which(!is.na(rv))
 			} else if (updateValue == "zero") {

Modified: pkg/raster/R/project.R
===================================================================
--- pkg/raster/R/project.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/project.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -54,7 +54,7 @@
 	v <- vector(length=0)
 
 	if (!canProcessInMemory(to, 1) && filename(to) == '') {
-		filename <- tempfile()
+		filename <- rasterTmpFile()
 		filename(to) <- filename
 		if (options('verbose')[[1]]) { cat('writing raster to:', filename(to))	}
 	}

Added: pkg/raster/R/rasterTmpFile.R
===================================================================
--- pkg/raster/R/rasterTmpFile.R	                        (rev 0)
+++ pkg/raster/R/rasterTmpFile.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -0,0 +1,43 @@
+# Author: Robert J. Hijmans, r.hijmans at gmail.com
+# Date :  May 2009
+# Version 0.8
+# Licence GPL v3
+
+
+
+setTmpDir <- function(d=NULL) {
+	if (!is.null(d)) {
+		res <- file.exists(d)
+		if (!res) {
+			res <- dir.create(d,  showWarnings = FALSE)
+		}
+		if (res) { options(rasterTmpDir = d) }
+	}
+}
+
+
+rasterTmpDir <- function() {
+	d <- options('rasterTmpDir')[[1]]
+	if (is.null(d)) {
+		d <- paste(dirname(tempdir()), '/R_raster_tmp/', sep="")
+	}
+	return(d)
+}
+
+rasterTmpFile <- function()  {
+	d <- rasterTmpDir()
+	dir.create(d,  showWarnings = FALSE)
+	f <- paste(round(runif(10)*10), collapse="")
+	d <- paste(d, f, '.grd', sep="")
+	return(d)
+}
+
+removeTmpFiles <- function() {
+	d <- rasterTmpDir()
+	unlink(d)
+}
+
+showTmpFiles <- function() {
+	d <- rasterTmpDir()
+	list.files(d, '.grd')
+}

Modified: pkg/raster/R/readRaster.R
===================================================================
--- pkg/raster/R/readRaster.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/readRaster.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -31,7 +31,7 @@
 			} 
 			return(raster)
 		} else {
-			result <- valuesRow(raster, rownr)[startcol:endcol]
+			stop('cannot read a row of data for a raster that only exists in memory. Use valuesRow(raster, rownr)')
 		}
 		
 	} else if (.driver(raster) == 'raster') {

Modified: pkg/raster/R/reclass.R
===================================================================
--- pkg/raster/R/reclass.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/reclass.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -24,7 +24,7 @@
 	
 	if (dataContent(raster) == 'all') { nr <- 1 } else { nr <- 2 }
 	if (!canProcessInMemory(raster, nr) && filename == '') {
-		filename <- tempfile()
+		filename <- rasterTmpFile()
 		if (options('verbose')[[1]]) { cat('writing raster to:', filename(outRaster))	}						
 	}
 	

Modified: pkg/raster/R/resample.R
===================================================================
--- pkg/raster/R/resample.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/resample.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -16,7 +16,7 @@
 	dataType(to) <- datatype
 	
 	if (!canProcessInMemory(to, 1) && filename(to) == '') {
-		filename <- tempfile()
+		filename <- rasterTmpFile()
 		filename(to) <- filename
 		if (options('verbose')[[1]]) { cat('writing raster to:', filename(to))	}
 	}

Modified: pkg/raster/R/summary.R
===================================================================
--- pkg/raster/R/summary.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/summary.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -8,7 +8,7 @@
 .summaryRasters <- function(rasters, fun, funname, na.rm) {
 
 	if (!canProcessInMemory(rasters[[1]], 4)) {
-		filename <- tempfile()
+		filename <- rasterTmpFile()
 		raster <- raster(rasters[[1]], filename)
 	} else {
 		filename <- ""

Modified: pkg/raster/R/valuesRow.R
===================================================================
--- pkg/raster/R/valuesRow.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/valuesRow.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -21,8 +21,6 @@
 	if (!(validRow(object, rownr))) {
 		stop(paste(rownr,'is not a valid rownumber')) 
 	}
-	
-	
 	if (dataContent(object) == 'sparse') {
 		return (.valuesRow.sparse(object, rownr)) 
 	} else if (dataContent(object) == 'row') {
@@ -31,7 +29,7 @@
 		if (dataIndices(object) == c(startcell, endcell)) {
 			return(values(object))
 		} else {
-			stop('this row is not in memory. First use readRow() or readAll')		
+			return(values(readRow(object, rownr)))
 		}
 	} else if (dataContent(object) == 'block') {
 		firstcol <- colFromCell(object, dataIndices(object)[1])

Modified: pkg/raster/R/writeGDAL.R
===================================================================
--- pkg/raster/R/writeGDAL.R	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/R/writeGDAL.R	2009-05-02 12:35:05 UTC (rev 437)
@@ -38,7 +38,7 @@
 	
 #	GDALDataTypes <- c('Unknown', 'Byte', 'UInt16', 'Int16', 'UInt32','Int32', 'Float32', 'Float64', 'CInt16', 'CInt32',   'CFloat32', 'CFloat64')	
 #	typeNum <- match(gdalfiletype, GDALDataTypes, 1) - 1
-# 	my_tempfile <- tempfile()
+# 	my_tempfile <- rasterTmpFile()
 #	gdhandle <- .Call('RGDAL_CreateDataset', driver=driver, as.integer(c(ncol(raster), nrow(raster), nlayers(raster))), as.integer(typeNum), options=NULL, my_tempfile, PACKAGE="rgdal")
 #   transient = new("GDALTransientDataset", driver=driver, rows=nrow(raster), cols=ncol(raster), bands=nbands, type=dataformat, options=gdoptions, handle=gdhandle)
 

Added: pkg/raster/man/NAvalue.Rd
===================================================================
--- pkg/raster/man/NAvalue.Rd	                        (rev 0)
+++ pkg/raster/man/NAvalue.Rd	2009-05-02 12:35:05 UTC (rev 437)
@@ -0,0 +1,44 @@
+\name{NAvalue}
+
+\alias{NAvalue<-}
+\alias{NAvalue}
+
+\title{set the NA value of a RasterLayer }
+
+\description{
+NAvalue returns the value that is used to write NA values to disk (in 'raster' type files). 
+If you set the NA value of a RasterLayer, this value will be interpreted as NA when reading the values from a file. 
+Values already in memory will not be affected. 
+
+If the NA value is smaller than zero, all values smaller or equal to that number will be set to NA.
+}
+
+\usage{
+NAvalue(x) <- value
+}
+
+\arguments{
+ \item{x}{A \code{RasterLayer} object}
+ \item{value}{the value to be interpreted as NA; set this before reading the values from the file. Integer values are matched exactely; for decimal values files any value <= the value will be interpreted as NA}  
+}
+
+
+\value{
+a Raster* object
+}
+
+
+\author{ Robert J. Hijmans }
+
+\examples{ 
+r1 <- raster(system.file("pictures/Rlogo.jpg", package="rgdal"))
+r2 <- r1
+NAvalue(r2)
+NAvalue(r2) <- 255
+#plot(r1)
+#x11()
+#plot(r2)
+}
+
+\keyword{ spatial }
+

Modified: pkg/raster/man/compare.Rd
===================================================================
--- pkg/raster/man/compare.Rd	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/man/compare.Rd	2009-05-02 12:35:05 UTC (rev 437)
@@ -2,18 +2,20 @@
 
 \alias{compare}
   
-\title{ Compare RasterLayer objects }
+\title{Compare}
 
 \description{
-  compare evaluates whether a list of rasters has the same origin, resolution, number of rows and columns, and projection (or a subset of these comparisons).
+Evaluate whether a two or more rasters have the same origin, resolution, number of rows and columns, and projection (or a subset of these comparisons).
+Data values are not compared by this function.
 }
 
 \usage{
-compare(objects, bb=TRUE, rowcol=TRUE, prj=TRUE, res=FALSE, orig=FALSE, tolerance=0.05, stopiffalse=TRUE, showwarning=FALSE) 
+compare(object, ..., bb=TRUE, rowcol=TRUE, prj=TRUE, res=FALSE, orig=FALSE, tolerance=0.05, stopiffalse=TRUE, showwarning=FALSE) 
 }
 
 \arguments{
-  \item{objects}{vector or list of Raster* objects }
+  \item{object}{A Raster* object }
+  \item{...}{Additional Raster* objects}
   \item{bb}{logical. If \code{TRUE}, bounding boxes are compared}
   \item{rowcol}{logical. If \code{TRUE}, number of rows and columns of the objects are compared}
   \item{prj}{logical. If \code{TRUE} projections are compared.}
@@ -29,12 +31,12 @@
 \examples{
 	r1 <- raster()
 	r2 <- r1
-	compare(c(r1, r2))
 	r3 <- r1
+	compare(r1, r2, r3)
 	nrow(r3) <- 10
-#	compare(c(r1, r3))
-	compare(c(r1, r3), stopiffalse=FALSE)
-	compare(c(r1, r3), rowcol=FALSE)
+#	compare(r1, r3)
+	compare(r1, r3, stopiffalse=FALSE)
+	compare(r1, r3, rowcol=FALSE)
 }
 
 \keyword{ spatial }

Deleted: pkg/raster/man/setNAvalue.Rd
===================================================================
--- pkg/raster/man/setNAvalue.Rd	2009-04-30 15:52:55 UTC (rev 436)
+++ pkg/raster/man/setNAvalue.Rd	2009-05-02 12:35:05 UTC (rev 437)
@@ -1,44 +0,0 @@
-\name{NAvalue}
-
-\alias{NAvalue<-}
-\alias{NAvalue}
-
-\title{set the NA value of a RasterLayer }
-
-\description{
-NAvalue returns the value that is used to write NA values to disk (in 'raster' type files). 
-If you set the NA value of a RasterLayer, this value will be interpreted as NA when reading the values from a file. 
-Values already in memory will not be affected. 
-
-If the NA value is smaller than zero, all values smaller or equal to that number will be set to NA.
-}
-
-\usage{
-NAvalue(x) <- value
-}
-
-\arguments{
- \item{x}{A \code{RasterLayer} object}
- \item{value}{the value to be interpreted as NA; set this before reading the values from the file. Integer values are matched exactely; for decimal values files any value <= the value will be interpreted as NA}  
-}
-
-
-\value{
-a Raster* object
-}
-
-
-\author{ Robert J. Hijmans }
-
-\examples{ 
-r1 <- raster(system.file("pictures/Rlogo.jpg", package="rgdal"))
-r2 <- r1
-NAvalue(r2)
-NAvalue(r2) <- 255
-#plot(r1)
-#x11()
-#plot(r2)
-}
-
-\keyword{ spatial }
-



More information about the Raster-commits mailing list