1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
  
     | 
    
      \name{as.character}
\alias{as.character}
\alias{as.character,Raster-method}
\alias{as.character,Extent-method}
  
 
\title{Character representation of a Raster or Extent object}
\description{
\code{as.character} returns a text (R code) representation of a Raster* or Extent object. The main purpose of this is to allow quick generation of objects to use in examples on, for example, stackoverflow.com. 
}
\usage{
\S4method{as.character}{Raster}(x, ...)
\S4method{as.character}{Extent}(x, ...)
}
\arguments{
 \item{x}{ Raster* or Extent object }
 \item{...}{ additional arguments, none implemented } 
}
  
\value{
character
}
\examples{
r <- raster(ncol=3, nrow=3)
values(r) <- 1:ncell(r)
as.character(r)
s <- stack(r, r)
as.character(s)
as.character(extent(s))
x <- as.character(s)
eval(parse(text=x))
y <- as.character(extent(s))
eval(parse(text=y))
}
\keyword{spatial}
\keyword{methods}
 
     |