as.sparse3Darray {spatstat.sparse}R Documentation

Convert Data to a Sparse Three-Dimensional Array

Description

Convert other kinds of data to a sparse three-dimensional array.

Usage

as.sparse3Darray(x, ...)

Arguments

x

Data in another format (see Details).

...

Ignored.

Details

This function converts data in various formats into a sparse three-dimensional array (object of class "sparse3Darray").

The argument x can be

Value

Sparse three-dimensional array (object of class "sparse3Darray").

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner rolfturner@posteo.net and Ege Rubak rubak@math.aau.dk.

See Also

sparse3Darray

Examples

  A <- array(c(1,3,0,0,0,0,0,4,0,2,0,5,
               0,0,1,0,0,0,1,0,0,0,1,0),
             dim=c(3,4,2))
  #' array to sparse array
  B <- as.sparse3Darray(A) # positive extent
  #' list of matrices to sparse array
  B <- as.sparse3Darray(list(A[,,1], A[,,2]))
  #' matrix to sparse array
  B1 <- as.sparse3Darray(A[,,1])
  #' vector to sparse array
  B11 <- as.sparse3Darray(A[,1,1])

[Package spatstat.sparse version 3.1-0 Index]