Skip to contents

Template for construction of virtual arrays ('VirtualArray') and a derived class ('XArray') to instantiate it with general objects.

Arguments

stack

A list-class object.

index

A vector, matrix or array type object. Includes the indices of layers in the stack.

dim

A numeric vector. Same as for array, creates proxy procedurally.

Value

An XArray-class object.

Details

The 'VirtualArray' class implements structures to organize objects of the same class in multidimensional arrays. Subsetting rules were defined using the proxy object in the index slot. The 'VirtualArray' is the base class for 'XArray' and 'RasterArray' classes. The 'XArray' class derived from VirtualArray allows the instantiation of basic virtual arrays with genearl R objects, which form a single list in the @stack slot. The 'SfArray' class is derived from the 'XArray' class.

The class has two slots: @stack: A list containing objects of the same class (i.e. layers). @index: A proxy object that represents the structure of the entities.

Examples

# 2d XArray of vectors
  data(exemplar)
  st <-exemplar@stack
  ind <- 1:nlayers(st)
  dim(ind) <- c(3,4)
  dimnames(ind) <- list(n = c(10, 20, 30), seed = 1:4)
  xa<- XArray(stack=st, index=ind)