
DataBackend for data.table as an in-memory data base.
R6::R6Class object inheriting from DataBackend.
DataBackendDataTable$new(data, primary_key = NULL) as_data_backend(data, primary_key = NULL, ...)
data
:: data.table::data.table()
The input data.table::data.table()
.
primary_key
:: character(1)
Name of the primary key column.
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.
See DataBackend.
See DataBackend.
Other DataBackend: DataBackendMatrix
,
DataBackend
, as_data_backend
# 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 DataLab