global operator {ursa} | R Documentation |
Function from this global.\emph{FUN}
list returns requred statistics FUN for the whole image.
global_mean(x, ursa = FALSE, ...) global_median(x, ursa = FALSE, ...) global_sd(x, ursa = FALSE, ...) global_sum(x, ursa = FALSE, ...) global_min(x, ursa = FALSE, ...) global_max(x, ursa = FALSE, ...) global_n(x, ursa = FALSE, ...) global_nNA(x, ursa = FALSE, ...) global_range(x, ursa = FALSE, ...)
x |
Object of class |
ursa |
Logical. The class of returned value. If |
... |
Arguments in function |
For any function global.\emph{FUN}
, if argument na.rm
is not in ...
, then \emph{FUN}
is called with forced na.rm=TRUE
.
global_range\emph{list of arguments}
is implemented as c(global_min(\emph{list of arguments}), global_max(\emph{list of arguments}))
with the same list of arguments.
Alternative method to get global statistics is function applying directly to the raster value. For example, sd(ursa_value(x,na.rm=TRUE))
. This way is also appropriate for missing global functions: for example, var(ursa_value(x,na.rm=TRUE))
.
If ursa=FALSE
then numeric
.
If ursa=TRUE
then object of class ursaRaster
.
Nikita Platonov platonov@sevin.ru
session_grid(NULL) a <- ursa_dummy(2,min=-40,max=80) a[a<0] <- NA print(a) a.mean <- global_mean(a) a.sd <- global_sd(a) a.sum <- global_sum(a) a.min <- global_min(a) a.max <- global_max(a) a.median <- global_median(a) print(c(mean=a.mean,sd=a.sd,sum=a.sum,min=a.min,max=a.max,median=a.median)) v.max <- max(ursa_value(a),na.rm=TRUE) print(c('global_max()'=a.max,'max(ursa_value())'=v.max,dif=a.max-v.max)) r.max <- global_max(a,ursa=TRUE) print(r.max) b <- c(a,'appended scalar value'=a.max) print(b)