Description Usage Arguments Value Examples
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.
1 2 3 4 | ## S4 method for signature 'Raster'
as.character(x, ...)
## S4 method for signature 'Extent'
as.character(x, ...)
|
x |
Raster* or Extent object |
... |
additional arguments, none implemented |
character
1 2 3 4 5 6 7 8 9 10 11 12 | 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))
|
Loading required package: sp
[1] "raster(ncol=3, nrow=3, xmn=-180, xmx=180, ymn=-90, ymx=90, crs='+proj=longlat +datum=WGS84')"
[1] "brick(ncol=3, nrow=3, nl=2, xmn=-180, xmx=180, ymn=-90, ymx=90, crs='+proj=longlat +datum=WGS84')"
[1] "extent(-180, 180, -90, 90)"
class : RasterBrick
dimensions : 3, 3, 9, 2 (nrow, ncol, ncell, nlayers)
resolution : 120, 60 (x, y)
extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84
class : Extent
xmin : -180
xmax : 180
ymin : -90
ymax : 90
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.