DataBackend: DataBackend

Description Format Construction Fields Methods See Also Examples

Description

This is the abstract base class for data backends.

Data Backends provide a layer of abstraction for various data storage systems. It is not recommended to work directly with the DataBackend. Instead, all data access is handled transparently via the Task.

To connect to out-of-memory database management systems such as SQL servers, see mlr3db.

The required set of fields and methods to implement a custom DataBackend is listed in the respective sections. See DataBackendDataTable or DataBackendMatrix for exemplary implementations of the interface.

Format

R6::R6Class object.

Construction

Note: This object is typically constructed via a derived classes, e.g. DataBackendDataTable or DataBackendMatrix, or via the S3 method as_data_backend().

1
DataBackend$new(data, primary_key = NULL, data_formats = "data.table", converters = list())

Fields

Methods

See Also

Extension Packages: mlr3db

Other DataBackend: DataBackendDataTable, DataBackendMatrix, as_data_backend

Examples

1
2
3
4
5
6
7
8
data = data.table::data.table(id = 1:5, x = runif(5), y = sample(letters[1:3], 5, replace = TRUE))

b = DataBackendDataTable$new(data, primary_key = "id")
print(b)
b$head(2)
b$data(rows = 1:2, cols = "x")
b$distinct(rows = b$rownames, "y")
b$missings(rows = b$rownames, cols = names(data))

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