groupGeneric | R Documentation |
These functions implement arithmetical and logical operations, mathematical functions for objects of class ursaRaster
as well as group generic functions from package base do similar for S3 class. These are local operations in the raster algebra (map algebra).
## S3 method for class 'ursaRaster'
Ops(e1, e2 = NULL)
## S3 method for class 'ursaRaster'
Math(x, ...)
## S3 method for class 'ursaRaster'
Complex(z)
## S3 method for class 'ursaRaster'
Summary(..., na.rm = FALSE)
x |
|
e1 |
|
e2 |
Numeric of length 1, matrix, array, or |
na.rm |
Logical. If |
z |
Any. |
... |
For group Math - further arguments passed to methods. See description for generic. For group Summary - set of arguments, which are recognized via their names (using regular expressions), position and classes.
|
The groups are 'Summary'
, 'Ops'
, 'Math'
, and 'Complex
'. See “Details” section in the S3 Generic Functions help page.
The group 'Complex'
is unsupported.
The groups 'Math'
and 'Summary'
are implemented completely.
The group 'Ops'
has some features.
Logical operators "<"
, ">"
, "<="
, ">="
, "=="
, \"!="
return 'NA'
for value FALSE
and '1'
for value TRUE
to organize cells' masking.
Unary operator "!"
is equal to binary operator operators "!="
, where the second argument is scalar value 0
(zero).
The operators of groups 'Math'
and 'Ops'
destroy color tables.
For group 'Summary'
the realization of local operators of map algebra is possible via apply
function:
apply(ursa_value(obj),1,function(x) {y <- sd(x)+1;y})
or
as.ursa(apply(obj,1:2,function(x) {y <- sd(x)+1;y}))
Operators of groups 'Complex'
return stop
Operators of groups 'Math'
, 'Ops'
, 'Summary'
return object of class ursaRaster
Nikita Platonov platonov@sevin.ru
Other S3 generic function for local operations of map algebra are mean
, median
.
Standard deviation (local) and certain local operations can be extracted using local_stat
.
session_grid(NULL)
session_grid(regrid(mul=1/4))
a1 <- ursa_dummy(nband=3,min=-5*pi,max=5*pi)
print(a1)
try(print(complex1 <- Re(a1)))
print(math1 <- a2 <- round(a1))
print(math1 <- sin(a1))
print(math2 <- floor(a1))
print(math3 <- ceiling(a1))
print(math4 <- cumsum(a1)) ## does this have a sense for rasters?
print(ops1 <- a1-2*rev(a1)+mean(a1))
print(mean(ops1)) ## vanishing
a2 <- ursa_new(value=c(1,2,4),bandname=c("single","double","quadruple"))
print(a2)
print(ops2 <- a2[1]==a2[2])
print(ops3 <- a2[1]==a2[2]/2)
print(ops4 <- a1>0)
print(a1[a1>0])
print(sum1 <- sum(a1))
print(sum2 <- range(a1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.