Skip to content

Commit

Permalink
fix(task): evaluate deparsed id in the beginning (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-muecke authored Jun 11, 2024
1 parent 2566d13 commit ac1814f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,6 @@ rsconnect/

revdep/
CRAN-SUBMISSION

# MacOS
.DS_Store
6 changes: 6 additions & 0 deletions R/as_task_clust.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ as_task_clust.TaskClust = function(x, clone = FALSE, ...) { # nolint
#' Defaults to the (deparsed and substituted) name of the data argument.
#' @export
as_task_clust.data.frame = function(x, id = deparse(substitute(x)), ...) { # nolint
force(id)

ii = which(map_lgl(keep(x, is.double), anyInfinite))
if (length(ii)) {
warningf("Detected columns with unsupported Inf values in data: %s", str_collapse(names(ii)))
Expand All @@ -42,6 +44,8 @@ as_task_clust.data.frame = function(x, id = deparse(substitute(x)), ...) { # nol
#' @rdname as_task_clust
#' @export
as_task_clust.DataBackend = function(x, id = deparse(substitute(x)), ...) { # nolint
force(id)

TaskClust$new(id = id, backend = x)
}

Expand All @@ -50,6 +54,8 @@ as_task_clust.DataBackend = function(x, id = deparse(substitute(x)), ...) { # no
#' Data frame containing all columns specified in formula `x`.
#' @export
as_task_clust.formula = function(x, data, id = deparse(substitute(data)), ...) { # nolint
force(id)

assert_data_frame(data)
assert_subset(all.vars(x), c(names(data), "."), .var.name = "formula")
if (attributes(terms(x, data = data))$response) {
Expand Down

0 comments on commit ac1814f

Please sign in to comment.