Skip to content

Commit f053382

Browse files
committed
rename prediction column (closes #22)
1 parent 7a99861 commit f053382

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

R/adjust-numeric-range.R

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#' @inheritSection adjust_equivocal_zone Data Usage
1515
#'
1616
#' @examplesIf FALSE
17-
# # TODO: unskip -- fn currently requires estimate to be called `.pred` (#22)
1817
#' library(tibble)
1918
#'
2019
#' # create example data
@@ -105,12 +104,21 @@ predict.numeric_range <- function(object, new_data, tailor, ...) {
105104
lo <- object$arguments$lower_limit
106105
hi <- object$arguments$upper_limit
107106

108-
# todo depends on tm predict col names
109107
new_data[[est_nm]] <-
110-
probably::bound_prediction(new_data, lower_limit = lo, upper_limit = hi)[[est_nm]]
108+
probably::bound_prediction(
109+
rename_prediction_column(new_data, est_nm),
110+
lower_limit = lo,
111+
upper_limit = hi
112+
)[[".pred"]]
111113
new_data
112114
}
113115

116+
rename_prediction_column <- function(data, est_nm) {
117+
data[[".pred"]] <- data[[est_nm]]
118+
data[[est_nm]] <- NULL
119+
data
120+
}
121+
114122
#' @export
115123
required_pkgs.numeric_range <- function(x, ...) {
116124
c("tailor", "probably")

0 commit comments

Comments
 (0)