DataBackendMatrix: DataBackend for Matrix

Description Format Construction Fields Methods See Also Examples

Description

DataBackend for Matrix. Data is stored as (sparse) matrix.

Format

R6::R6Class object inheriting from DataBackend.

Construction

1
2
DataBackendMatrix$new(data, primary_key = NULL)
as_data_backend(data, primary_key = NULL, ...)

Fields

See DataBackend.

Methods

See DataBackend.

See Also

Other DataBackend: DataBackendDataTable, DataBackend, as_data_backend

Examples

1
2
3
4
5
6
7
8
requireNamespace("Matrix")
data = Matrix::Matrix(sample(0:1, 20, replace = TRUE), ncol = 2)
colnames(data) = c("x1", "x2")
rownames(data) = paste0("row_", 1:10)

b = as_data_backend(data)
b$head()
b$data(b$rownames[1:3], b$colnames, data_format = "Matrix")

mllg/mlr3 documentation built on Sept. 27, 2019, 9:38 a.m.