Column-Linked and Row-Linked Matrices

A class that links matrix-like objects (nodes) by rows or by columns while behaving similarly to a base R matrix. Very large matrices are supported if the nodes are memory-mapped objects.


CRAN_Status_Badge Rdoc Travis-CI Build Status Coverage status

LinkedMatrix is an R package that provides matrices implemented as lists of matrix-like nodes, linked by columns or rows.

It was originally developed for the BGData package to address the array size limit of ff (length must be between 1 and .Machine$integer.max) by chaining multiple ff objects together.

This package is deliberately kept simple. For computational methods that use LinkedMatrix check out the BGData package.

Example

The following code generates three different matrix-like objects and links them together by rows in a RowLinkedMatrix. The LinkedMatrix instance can then be treated like any other regular matrix.

library(LinkedMatrix)
 
m1 <- ff::ff(initdata = rnorm(50), dim = c(5, 10))
m2 <- bigmemory::big.matrix(init = rnorm(50), nrow = 5, ncol = 10)
m3 <- matrix(data = rnorm(50), nrow = 5, ncol = 10)
m <- RowLinkedMatrix(m1, m2, m3)
 
dim(m)
m[1, ]
m[, 1]

Installation

Install the stable version from CRAN:

install.packages("LinkedMatrix")

Alternatively, install the development version from GitHub:

devtools::install_github("QuantGen/LinkedMatrix")

Contribute

Documentation

Further documentation can be found on RDocumentation.

News

LinkedMatrix 1.3.1

  • Fix rownames() (for RowLinkedMatrix) or colnames() (for ColumnLinkedMatrix) returning NULL if first node does not have dimnames, but other nodes do. Missing entries will be denoted empty string, just like in base dimnames().
  • Do not exclude NULL when checking if rownames (for ColumnLinkedMatrix) or colnames (for RowLinkedMatrix) do not match.

LinkedMatrix 1.3.0

  • Add crochet subsetting and replacement support.
  • Add generic as.ColumnLinkedMatrix and as.RowLinkedMatrix for easy creation of LinkedMatrix objects from lists of matrix-like objects without do.call.
  • Warn if rownames (for ColumnLinkedMatrix) or colnames (for RowLinkedMatrix) do not match.
  • Implement str method.
  • Implement is.matrix method.
  • Slight performance improvements in nodes methods.
  • New sort parameter in index() which is set by default.
  • Add examples.

LinkedMatrix 1.2.0

  • Fix wrong order in result when subsetting using unordered positive integers.
  • Add i and j parameters in index to only generate entries for those indexes.
  • Various subsetting optimizations.

LinkedMatrix 1.1.0

  • Add LinkedMatrix constructor that creates either a ColumnLinkedMatrix or RowLinkedMatrix (controlled by linkedBy) of certain dimensions and of certain type.
  • Add rbind for RowLinkedMatrix and cbind for ColumnLinkedMatrix.
  • Remove apply and derivative functions to keep the package minimal.
  • Change length method to behave similarly to length for matrices.
  • Export nNodes function to get the number of nodes.
  • Only allow matrix-like objects with matching row or column dimensions (same number of rows in case of ColumnLinkedMatrix and same number of columns in case of RowLinkedMatrix) when creating linked matrices.

LinkedMatrix 1.0.0

Initial release.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("LinkedMatrix")

1.3.1 by Alexander Grueneberg, a year ago


https://github.com/QuantGen/LinkedMatrix


Report a bug at https://github.com/QuantGen/LinkedMatrix/issues


Browse source code at https://github.com/cran/LinkedMatrix


Authors: Gustavo de los Campos [aut] , Alexander Grueneberg [aut, cre]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports methods, crochet

Suggests BGData, ff, bigmemory, testthat, covr


Imported by symDMatrix.

Depended on by BGData.

Suggested by BEDMatrix.


See at CRAN