mlr3 (version 0.1.0-9000)

DataBackendDataTable: DataBackend for data.table

Description

DataBackend for data.table as an in-memory data base.

Arguments

Format

R6::R6Class object inheriting from DataBackend.

Construction

DataBackendDataTable$new(data, primary_key = NULL)
as_data_backend(data, primary_key = NULL, ...)

DataBackendDataTable does not copy the input data, while as_data_backend calls data.table::copy(). as_data_backend creates a primary key column as integer column if primary_key is NULL.

Fields

See DataBackend.

Methods

See DataBackend.

See Also

Other DataBackend: DataBackendMatrix, DataBackend, as_data_backend

Examples

Run this code
# NOT RUN {
data = as.data.table(iris)
data$id = seq_len(nrow(iris))
b = DataBackendDataTable$new(data = data, primary_key = "id")
print(b)
b$head()
b$data(rows = 100:101, cols = "Species")

b$nrow
head(b$rownames)

b$ncol
b$colnames

# alternative construction
as_data_backend(iris)
# }

Run the code above in your browser using DataCamp Workspace