Learn R Programming

chronosphere (version 0.3.1)

apply: Apply-type iterator for RasterArrays

Description

The function implements the apply-type iterators for the RasterArray class. Output values are constrained to RasterArrays, whenever possible. Not yet implemented for multidimensional MARGINs.

Arguments

X

an array, including matrices and RasterArrays.

MARGIN

a vector giving the subscripts which the function will be applied over. E.g., for a matrix 1 indicates rows, 2 indicates columns, c(1, 2) indicates rows and columns. Where X has named dimnames, it can be a character vector selecting dimension names. For RasterArrays only single dimension margins are implemented.

FUN

the function to be applied: see <U+2018>Details<U+2019> of apply.

...

optional arguments passed to FUN.

Value

Depending on the on the output of FUN, a list, a vector or RasterArray object.

Format

An object of class standardGeneric of length 1.

Examples

Run this code
# NOT RUN {
# double of itself
data(dems)
a<- cbind(dems, dems)
same <- apply(a, 1, sum)
# }

Run the code above in your browser using DataLab