Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to new data.table #999

Merged
merged 3 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Imports:
R6 (>= 2.4.1),
backports,
checkmate (>= 2.0.0),
data.table (>= 1.14.2),
data.table (>= 1.15.0),
evaluate,
future,
future.apply (>= 1.5.0),
Expand Down Expand Up @@ -74,7 +74,7 @@ Config/testthat/edition: 3
Config/testthat/parallel: false
NeedsCompilation: no
Roxygen: list(markdown = TRUE, r6 = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Collate:
'mlr_reflections.R'
'BenchmarkResult.R'
Expand Down
2 changes: 1 addition & 1 deletion R/DataBackend.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
DataBackend = R6Class("DataBackend", cloneable = FALSE,
public = list(
#' @field primary_key (`character(1)`)\cr
#' Column name of the primary key column of unique integer row ids.
#' Column name of the primary key column of positive and unique integer row ids.
primary_key = NULL,

#' @field data_formats (`character()`)\cr
Expand Down
4 changes: 1 addition & 3 deletions R/DataBackendDataTable.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ DataBackendDataTable = R6Class("DataBackendDataTable", inherit = DataBackend,
cols = intersect(cols, colnames(private$.data))

if (self$compact_seq) {
# https://github.com/Rdatatable/data.table/issues/3109
.__i__ = keep_in_bounds(rows, 1L, nrow(private$.data))
private$.data[.__i__, cols, with = FALSE]
private$.data[rows, cols, with = FALSE, nomatch = NULL]
} else {
ijoin(private$.data, rows, cols, self$primary_key)
}
Expand Down
2 changes: 1 addition & 1 deletion R/Task.R
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ Task = R6Class("Task",
private$.hash
},

#' @field row_ids (`integer()`)\cr
#' @field row_ids (positive `integer()`)\cr
#' Returns the row ids of the [DataBackend] for observations with role "use".
row_ids = function(rhs) {
assert_ro_binding(rhs)
Expand Down
2 changes: 1 addition & 1 deletion R/as_data_backend.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ as_data_backend.data.frame = function(data, primary_key = NULL, keep_rownames =
if (is.character(primary_key)) {
assert_string(primary_key)
assert_choice(primary_key, colnames(data))
assert_integer(data[[primary_key]], any.missing = FALSE, unique = TRUE)
assert_integer(data[[primary_key]], any.missing = FALSE, unique = TRUE, lower = 0L)
} else {
if (is.null(primary_key)) {
row_ids = seq_row(data)
Expand Down
4 changes: 2 additions & 2 deletions inst/testthat/helper_expectations.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ expect_backend = function(b) {
checkmate::expect_data_table(x, nrows = 0L, ncols = 0L)

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

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

Expand Down
4 changes: 2 additions & 2 deletions man-roxygen/param_cols.R
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#' @param cols `character()`\cr
#' Column names.
#' @param cols (`character()`)\cr
#' Vector of column names.
4 changes: 2 additions & 2 deletions man-roxygen/param_rows.R
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#' @param rows `integer()`\cr
#' Row indices.
#' @param rows (positive `integer()`)\cr
#' Vector or row indices.
4 changes: 2 additions & 2 deletions man/BenchmarkResult.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/DataBackend.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions man/DataBackendDataTable.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions man/DataBackendMatrix.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/Learner.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/LearnerClassif.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/LearnerRegr.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/Measure.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/MeasureClassif.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/MeasureRegr.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/MeasureSimilarity.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/PredictionClassif.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/PredictionRegr.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/Resampling.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading