Skip to content

Commit

Permalink
rename prediction column (closes #22)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpcouch committed Sep 16, 2024
1 parent 7a99861 commit f053382
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions R/adjust-numeric-range.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#' @inheritSection adjust_equivocal_zone Data Usage
#'
#' @examplesIf FALSE
# # TODO: unskip -- fn currently requires estimate to be called `.pred` (#22)
#' library(tibble)
#'
#' # create example data
Expand Down Expand Up @@ -105,12 +104,21 @@ predict.numeric_range <- function(object, new_data, tailor, ...) {
lo <- object$arguments$lower_limit
hi <- object$arguments$upper_limit

# todo depends on tm predict col names
new_data[[est_nm]] <-
probably::bound_prediction(new_data, lower_limit = lo, upper_limit = hi)[[est_nm]]
probably::bound_prediction(
rename_prediction_column(new_data, est_nm),
lower_limit = lo,
upper_limit = hi
)[[".pred"]]
new_data
}

rename_prediction_column <- function(data, est_nm) {
data[[".pred"]] <- data[[est_nm]]
data[[est_nm]] <- NULL
data
}

#' @export
required_pkgs.numeric_range <- function(x, ...) {
c("tailor", "probably")
Expand Down

0 comments on commit f053382

Please sign in to comment.