A class for storing a matrix and relevant metaData.
A list of metadata associated with the cells of the data.
The names of columns in the data.
A list of metadata associated with the columns of the data.
A data.frame representation of the IncidenceMatrix. The frame contains all rows/columns as rows of the data frame, and the rows, columns, values and all metadata types as columns. This is similar to the melt function.
This is the matrix. For extensibility, it cannot be written to directly and must be modified through methods.
Any data not part of the main data structure.
The number of columns in the data.
The number of rows in the data
The names of rows in the data.
A list of metadata associated with the columns of the data.
This function adds empty columns to the right side of the data.
This function adds empty rows to the data.
Convert this object to an sts object with as much information as possible
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.
This function replaces the matrix value at column i with the difference. between the values at columns i and (i-lag).
If mutate=FALSE
, a clone of this object will run the method and be returned. Otherwise, there is no return.
Select the last k
slices of the data in dimension direction
.
If mutate=FALSE
, a clone of this object will run the method and be returned. Otherwise, there is no return.
Create a new IncidenceMatrix
object from its components.
This function replaces the current matrix with a new matrix with one column for every column, and a row for every row/index combination. The column corresponding to the row and index will have the value of the original matrix in the same row, but index columns previous. This shift will introduce NAs where it passes off the end of the matrix.
If mutate=FALSE
, a clone of this object will run the method and be returned. Otherwise, there is no return.
This function replaces the current matrix with a new matrix with one column for every column, and a row for every row/index combination. The column corresponding to the row and index will have the value of the original matrix in the same row, but index columns ahead.
If mutate=FALSE
, a clone of this object will run the method and be returned. Otherwise, there is no return.
This function is a way to modify the data as though it were a matrix.
This function rescales each element of our object according to f
If mutate=FALSE
, a clone of this object will run the method and be returned. Otherwise, there is no return.
Select the data corresponding to the rows rows
and the columns columns
. rows
and columns
can be either numeric or named indices.
If mutate=FALSE
, a clone of this object will run the method and be returned. Otherwise, there is no return.
Select the last k
slices of the data in dimension direction
.
If mutate=FALSE
, a clone of this object will run the method and be returned. Otherwise, there is no return.
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.
Inherits from : AbstractIncidenceMatrix
# NOT RUN {
data = IncidenceMatrix$new(matrix(1:9,3,3))
data$mat
data$nrow
data$ncol
data$colData = list(1:3,letters[1:3])
data$colData
data$addColumns(2)
data$colData
data$mat
data$diff(1)
data$mat
data$lag(1)
data$mat
data$head(1,1)
data$mat
data$tail(2,2)
data$mat
data$mutate(data=3)
data$mat
data = IncidenceMatrix$new(matrix(1:9,3,3))
data$scale(function(x){x^2},mutate=FALSE)$mat
data$mat
data$subset(rows=1,cols=2)
data$mat
# }
Run the code above in your browser using DataLab