MatrixData: MatrixData

Description Fields Methods See Also Examples

Description

An abstract class for storing metaData relevant to a matrix. This class forms the backbone of the data structures. It enforces the core functionality we want the data we model to have. This class covers any data which has two major axes, and can be thought of as a matrix. It also can cover the case where the data is matrix-like, but our representation of the data is not matrix-like. ## TODO: make an example for this (think cholera data).

Fields

cellData

A list of metadata associated with the cells of the data.

cnames

The names of columns in the data.

colData

A list of metadata associated with the columns of the data.

mat

This is the matrix. For extensibility, it cannot be written to directly and must be modified through methods.

metaData

Any data not part of the main data structure.

ncol

The number of columns in the data.

nrow

The number of rows in the data

rnames

The names of rows in the data.

rowData

A list of metadata associated with the columns of the data.

Methods

debug(string)

A function for debugging the methods of this class. It calls the browser command. In order for methods to opt into to debugging, they need to implement the following code at the beginning: if(<method_name> %in% private$.debug){browser()}. This method exists, because the debugger is not always intuitive when it comes to debugging R6 methods.

Arguments
string - The name(s) of methods to debug as a character vector

initialize(...)

This function should be extended. Create a new instance of this class.

Arguments
... - This function should take in any arguments just in case.

undebug(string)

A function for ceasing to debug methods. Normally a method will call the browser command every time it is run. This command will stop it from doing so.

Arguments
string - The name(s) of the methods to stop debugging.

See Also

Inherits from : DataContainer

Is inherited by : AbstractIncidenceMatrix, ArrayData

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
SampleMatrixData <- R6Class(
  inherit = MatrixData,
  public = list(
    initialize = function(data){
      if('matrix' %in% class(data)){
        private$.mat = data
        private$.nrow = nrow(data)
        private$.ncol = ncol(data)
        private$.rnames = rownames(data)
        private$.cnames = colnames(data)
      }
    }
  )
)

HopkinsIDD/ForecastFramework documentation built on Nov. 10, 2019, 2:15 a.m.