
Coerce to spatial DataBackend
Source:R/DataBackendRaster.R, R/DataBackendVector.R
as_data_backend.RdWraps a mlr3::DataBackend around spatial objects.
Currently these S3 methods are only alternative ways for writing DataBackendRaster$new().
They do not support coercing from other backends yet.
Usage
# S3 method for class 'stars'
as_data_backend(data, primary_key = NULL, ...)
# S3 method for class 'SpatRaster'
as_data_backend(data, primary_key = NULL, ...)
# S3 method for class 'RasterBrick'
as_data_backend(data, primary_key = NULL, ...)
# S3 method for class 'RasterStack'
as_data_backend(data, primary_key = NULL, ...)
# S3 method for class 'sf'
as_data_backend(data, primary_key = NULL, keep_rownames = FALSE, ...)Arguments
- data
(terra::SpatRaster)
The input terra::SpatRaster.- primary_key
(
character(1)|integer())
Name of the primary key column, or integer vector of row ids.- ...
(
any)
Not used.- keep_rownames
(
logical(1)|character(1))
IfTRUEor a single string, keeps the row names ofdataas a new column. The column is named like the provided string, defaulting to"..rownames"forkeep_rownames == TRUE. Note that the created column will be used as a regular feature by the task unless you manually change the column role. Also seedata.table::as.data.table().