R/replaceProperties.R

# Author: Robert J. Hijmans
# Date :  January 2009
# Version 0.9
# Licence GPL v3


setMethod("ncol<-", signature('BasicRaster', 'numeric'), 
	function(x, ..., value) {
		dim(x) <- c(nrow(x), value)
		return(x)
	}
)

setMethod("nrow<-", signature('BasicRaster', 'numeric'), 
	function(x, ..., value) {
		dim(x) <- c(value, ncol(x))
		return(x)
	}
)

#'ncol<-' <- function(x, value) {
#	dim(x) <- c(nrow(x), value)
#	return(x)
#}	

#'nrow<-' <- function(x, value) {
#	dim(x) <- c(value, ncol(x))
#	return(x)
#}	


'xmin<-' <- function(x, value) {
	if (inherits(x, 'Extent')) {
		x@xmin <- value
	} else {
		x@extent@xmin <- value
	}
	return(x)
}

'xmax<-' <- function(x, value) {
	if (inherits(x, 'Extent')) {
		x@xmax <- value
	} else {
		x@extent@xmax <- value
	}
	return(x)
}

'ymin<-' <- function(x, value) {
	if (inherits(x, 'Extent')) {
		x@ymin <- value
	} else {
		x@extent@ymin <- value
	}
	return(x)
}

'ymax<-' <- function(x, value) {
	if (inherits(x, 'Extent')) {
		x@ymax <- value
	} else {
		x@extent@ymax <- value
	}
	return(x)
}

Try the raster package in your browser

Any scripts or data that you put into this service are public.

raster documentation built on April 6, 2019, 3:05 a.m.