as.array | R Documentation |
In the ursaRaster
object the 3-dimensional image data are presented in 2-dimensional matrix. as.array
transforms internal 2-dimensional data to the usual 3-dimansional data. as.matrix
just extracts image data in internal 2-dimensional format.
## S3 method for class 'ursaRaster'
as.array(x, ...)
## non-public
.as.array(x, drop = FALSE, flip = FALSE, permute = FALSE, dim = FALSE)
... |
Arguments, which are passed to |
x |
|
drop |
Logical. If |
permute |
Logical. If |
flip |
Logical. If |
dim |
Logical. If |
Use permute=TRUE
to create an object of class raster
: as.raster(as.array(...))
The spatial reference system is lost.
If dim=FALSE
then as.array
returns object of class array
.
If dim=TRUE
then as.array
returns dimension of array.
as.matrix
returns object of class matrix
.
Nikita Platonov platonov@sevin.ru
as.raster
is a function to direct export to the object of class raster
.
as.matrix
with argument/value coords=TRUE
and as.data.frame
for object of class ursaRaster
keep spatial reference system.
session_grid(NULL)
a <- pixelsize()
a <- (a-global_min(a))/(global_max(a)-global_min(a))
b <- c(entire=a,half=a/2,double=a*2)
str(m <- as.matrix(b))
str(d1 <- as.array(b))
str(d2 <- as.array(b[1],drop=FALSE))
str(d3 <- as.array(b[1],drop=TRUE))
contour(d3)
filled.contour(d3)
d4 <- as.array(b,perm=TRUE)/global_max(b)
d4[is.na(d4)] <- 0
str(d4 <- as.raster(d4))
plot(d4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.