Skip to content

Commit 87c0865

Browse files
authored
Merge pull request #493 from tidymodels/feature/dot-time-to-time
Rename `predict(.time =)` to `predict(time =)`
2 parents 6d6b0a7 + 9d769fe commit 87c0865

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: parsnip
2-
Version: 0.1.5.9002
2+
Version: 0.1.5.9003
33
Title: A Common API to Modeling and Analysis Functions
44
Description: A common interface is provided to allow users to specify a model without having to remember the different argument names across different functions or computational engines (e.g. 'R', 'Spark', 'Stan', etc).
55
Authors@R: c(

R/predict.R

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#' and "pred_int". Default value is `FALSE`.
2929
#' \item `quantile`: the quantile(s) for quantile regression
3030
#' (not implemented yet)
31-
#' \item `.time`: the time(s) for hazard and survival probability estimates.
31+
#' \item `time`: the time(s) for hazard and survival probability estimates.
3232
#' }
3333
#' @details If "type" is not supplied to `predict()`, then a choice
3434
#' is made:
@@ -48,7 +48,7 @@
4848
#'
4949
#' ## Censored regression predictions
5050
#'
51-
#' For censored regression, a numeric vector for `.time` is required when
51+
#' For censored regression, a numeric vector for `time` is required when
5252
#' survival or hazard probabilities are requested. Also, when
5353
#' `type = "linear_pred"`, censored regression models will be formatted such
5454
#' that the linear predictor _increases_ with time. This may have the opposite
@@ -309,7 +309,7 @@ check_pred_type_dots <- function(type, ...) {
309309

310310
# ----------------------------------------------------------------------------
311311

312-
other_args <- c("level", "std_error", "quantile", ".time")
312+
other_args <- c("level", "std_error", "quantile", "time")
313313
is_pred_arg <- names(the_dots) %in% other_args
314314
if (any(!is_pred_arg)) {
315315
bad_args <- names(the_dots)[!is_pred_arg]
@@ -323,21 +323,21 @@ check_pred_type_dots <- function(type, ...) {
323323
}
324324

325325
# ----------------------------------------------------------------------------
326-
# places where .time should not be given
327-
if (any(nms == ".time") & !type %in% c("survival", "hazard")) {
326+
# places where time should not be given
327+
if (any(nms == "time") & !type %in% c("survival", "hazard")) {
328328
rlang::abort(
329329
paste(
330-
".time should only be passed to `predict()` when 'type' is one of:",
330+
"'time' should only be passed to `predict()` when 'type' is one of:",
331331
paste0("'", c("survival", "hazard"), "'", collapse = ", ")
332332
)
333333
)
334334
}
335-
# when .time should be passed
336-
if (!any(nms == ".time") & type %in% c("survival", "hazard")) {
335+
# when time should be passed
336+
if (!any(nms == "time") & type %in% c("survival", "hazard")) {
337337
rlang::abort(
338338
paste(
339339
"When using 'type' values of 'survival' or 'hazard' are given,",
340-
"a numeric vector '.time' should also be given."
340+
"a numeric vector 'time' should also be given."
341341
)
342342
)
343343
}

R/predict_hazard.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#' @export predict_hazard.model_fit
66
#' @export
77
predict_hazard.model_fit <-
8-
function(object, new_data, .time, ...) {
8+
function(object, new_data, time, ...) {
99

1010
check_spec_pred_type(object, "hazard")
1111

@@ -21,7 +21,7 @@ predict_hazard.model_fit <-
2121
new_data <- object$spec$method$pred$hazard$pre(new_data, object)
2222

2323
# Pass some extra arguments to be used in post-processor
24-
object$spec$method$pred$hazard$args$.time <- .time
24+
object$spec$method$pred$hazard$args$time <- time
2525
pred_call <- make_pred_call(object$spec$method$pred$hazard)
2626

2727
res <- eval_tidy(pred_call)

R/predict_survival.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#' @export predict_survival.model_fit
66
#' @export
77
predict_survival.model_fit <-
8-
function(object, new_data, .time, ...) {
8+
function(object, new_data, time, ...) {
99

1010
check_spec_pred_type(object, "survival")
1111

@@ -21,7 +21,7 @@ predict_survival.model_fit <-
2121
new_data <- object$spec$method$pred$survival$pre(new_data, object)
2222

2323
# Pass some extra arguments to be used in post-processor
24-
object$spec$method$pred$survival$args$.time <- .time
24+
object$spec$method$pred$survival$args$time <- time
2525
pred_call <- make_pred_call(object$spec$method$pred$survival)
2626

2727
res <- eval_tidy(pred_call)

man/other_predict.Rd

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

man/predict.model_fit.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.

0 commit comments

Comments
 (0)