Description Usage Arguments Details Value Note Author(s) Examples

Convenient function linking sparse Arrays from the package `spam`

to the sparse Matrices from the package `Matrix`

.

1 2 3 4 | ```
Array(A)
sparseArray(i, v = NULL, ...)
as.Matrix(M)
``` |

`A` |
An array to be turned into a sparse Array using |

`i` |
Integer matrix of array indices passed to |

`v` |
vector of values passed to |

`M` |
Matrix of type |

`...` |
Further arguments passed to |

`Array`

turns an `array`

into a sparse Array. There is a special behavior when a `dataframe`

is supplied. Such a dataframe is treated as 'long format', i.e. the columns of the dataframe are treated as dimensions of the Array, and all rows of the dataframe are interpreted as entries. The coordinates are given by the ordering of the levels in the dataframe, and the dimnames are given by the levels.

`sparseArray`

constructs sparse Arrays from a matrix of indices and a vector of values. dim and dimnames can be added as in `simple_sparse_array`

`as.Matrix`

turns a `simple_triplet_matrix`

into a `dgTMatrix`

.

Sparse Arrays use the class "simple_sparse_array" from `spam`

These functions are only an example of how `spam`

can be linked to `Matrix`

.

Michael Cysouw

1 2 3 4 5 6 |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.