Skip to content

Commit 9f8a522

Browse files
authored
BREAKING CHANGE: remove data format argument (#100)
* BREAKING CHANGE: remove data format argument * ... * ...
1 parent 2fd4922 commit 9f8a522

File tree

6 files changed

+16
-26
lines changed

6 files changed

+16
-26
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ URL: https://mlr3spatial.mlr-org.com,
1717
https://github.com/mlr-org/mlr3spatial
1818
BugReports: https://github.com/mlr-org/mlr3spatial/issues
1919
Depends:
20-
mlr3 (>= 0.14.0),
20+
mlr3 (>= 1.1.0),
2121
R (>= 3.1.0)
2222
Imports:
2323
checkmate (>= 2.0.0),
@@ -49,7 +49,7 @@ Config/testthat/parallel: false
4949
Encoding: UTF-8
5050
LazyData: true
5151
Roxygen: list(markdown = TRUE)
52-
RoxygenNote: 7.3.2
52+
RoxygenNote: 7.3.3
5353
Collate:
5454
'DataBackendRaster.R'
5555
'DataBackendVector.R'

R/DataBackendRaster.R

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ DataBackendRaster = R6Class("DataBackendRaster",
5454
private$.categories = terra::cats(data)
5555
private$.layer_names = names(data)
5656
private$.crs = terra::crs(data)
57-
58-
self$data_formats = "data.table"
5957
},
6058

6159
#' @description
@@ -69,15 +67,11 @@ DataBackendRaster = R6Class("DataBackendRaster",
6967
#' Rows are guaranteed to be returned in the same order as `rows`, columns
7068
#' may be returned in an arbitrary order. Duplicated row ids result in
7169
#' duplicated rows, duplicated column names lead to an exception.
72-
#'
73-
#' @param data_format (`character(1)`)\cr
74-
#' Desired data format. Currently only `"data.table"` supported.
75-
data = function(rows, cols, data_format = "data.table") {
70+
data = function(rows, cols) {
7671
stack = self$stack
7772
if (is.null(rows)) rows = numeric(0)
7873
rows = assert_integerish(rows, coerce = TRUE, null.ok = TRUE)
7974
assert_names(cols, type = "unique")
80-
assert_choice(data_format, self$data_formats)
8175
cols = intersect(cols, private$.layer_names)
8276

8377
if (!length(cols)) {

R/DataBackendVector.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ DataBackendVector = R6::R6Class("DataBackendVector",
1818
#' Name of the primary key column, or integer vector of row ids.
1919
initialize = function(data, primary_key) {
2020
assert_class(data, "sf")
21-
self$data_formats = "data.table"
2221

2322
# store geometry
2423
sf_column = attr(data, "sf_column")

man/DataBackendRaster.Rd

Lines changed: 1 addition & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/mlr3spatial-package.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/helper_expectations.R

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,50 +12,50 @@ expect_backend = function(b) {
1212
rn1 = head(rn, 1L)
1313
pk = b$primary_key
1414

15-
x = b$data(rows = rn, cols = pk, data_format = "data.table")
15+
x = b$data(rows = rn, cols = pk)
1616
checkmate::expect_data_table(x, ncols = 1L, nrows = n, col.names = "unique")
1717
x = x[[1L]]
1818
checkmate::expect_integerish(x, len = n, unique = TRUE)
1919

20-
x = b$data(rows = rn, cols = setdiff(cn, pk)[1L], data_format = "data.table")
20+
x = b$data(rows = rn, cols = setdiff(cn, pk)[1L])
2121
checkmate::expect_data_table(x, ncols = 1L, nrows = n, col.names = "unique")
2222
x = x[[1L]]
2323
checkmate::expect_atomic_vector(x, len = n)
2424

2525
# extra cols are ignored
26-
x = b$data(rows = rn1, cols = c(cn[1L], "_not_existing_"), data_format = "data.table")
26+
x = b$data(rows = rn1, cols = c(cn[1L], "_not_existing_"))
2727
checkmate::expect_data_table(x, nrows = length(rn1), ncols = 1L)
2828

2929
# zero cols matching
30-
x = b$data(rows = rn1, cols = "_not_existing_", data_format = "data.table")
30+
x = b$data(rows = rn1, cols = "_not_existing_")
3131
checkmate::expect_data_table(x, nrows = 0L, ncols = 0L)
3232

3333
# extra rows are ignored
3434
query_rows = c(rn1, if (is.integer(rn)) -1L else "_not_existing_")
35-
x = b$data(query_rows, cols = cn[1L], data_format = "data.table")
35+
x = b$data(query_rows, cols = cn[1L])
3636
checkmate::expect_data_table(x, nrows = length(rn1), ncols = 1L)
3737

3838
# zero rows matching
3939
query_rows = if (is.integer(rn)) -1L else "_not_existing_"
40-
x = b$data(rows = query_rows, cols = cn[1L], data_format = "data.table")
40+
x = b$data(rows = query_rows, cols = cn[1L])
4141
checkmate::expect_data_table(x, nrows = 0L, ncols = 1L)
4242

4343
# rows are duplicated
44-
x = b$data(rows = rep(rn1, 2L), cols = b$colnames, data_format = "data.table")
44+
x = b$data(rows = rep(rn1, 2L), cols = b$colnames)
4545
checkmate::expect_data_table(x, nrows = 2L * length(rn1), ncols = p)
4646

4747
# cols are returned in the right order
4848
j = rev(cn)
49-
x = b$data(rows = rn1, cols = j, data_format = "data.table")
49+
x = b$data(rows = rn1, cols = j)
5050
testthat::expect_equal(j, colnames(x))
5151

5252
# rows are returned in the right order
5353
i = sample(rn, min(n, 10L))
54-
x = b$data(rows = i, cols = b$primary_key, data_format = "data.table")
54+
x = b$data(rows = i, cols = b$primary_key)
5555
testthat::expect_equal(i, x[[1L]])
5656

5757
# duplicated cols raise exception
58-
testthat::expect_error(b$data(rows = rn1, cols = rep(cn[1L], 2L), data_format = "data.table"), "unique")
58+
testthat::expect_error(b$data(rows = rn1, cols = rep(cn[1L], 2L)), "unique")
5959

6060
# $head()
6161
checkmate::expect_data_table(b$head(.Machine$integer.max), nrows = n, ncols = p)

0 commit comments

Comments
 (0)