Skip to content

Commit

Permalink
remove user-facing calls
Browse files Browse the repository at this point in the history
pass `call` only to the internal `new_container()`. otherwise, the most informative context is `current_env()` from the function body.
  • Loading branch information
simonpcouch committed Apr 22, 2024
1 parent 319ac5f commit 4164156
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
9 changes: 4 additions & 5 deletions R/container.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
#' classification, these should be given in the order of the factor levels of
#' the `estimate`.
#' @param time The name of the predicted event time. (not yet supported)
#' @param call The call to be displayed in warnings or errors.
#' @examples
#'
#' container()
#' @export
container <- function(mode = "unknown", type = "unknown", outcome = character(0),
estimate = character(0), probabilities = character(0),
time = character(0), call = current_env()) {
time = character(0)) {
dat <-
list(
outcome = outcome,
Expand All @@ -32,7 +31,7 @@ container <- function(mode = "unknown", type = "unknown", outcome = character(0)
operations = list(),
columns = dat,
ptype = tibble::tibble(),
call = call
call = current_env()
)
}

Expand Down Expand Up @@ -88,7 +87,7 @@ print.container <- function(x, ...) {

#' @export
fit.container <- function(object, .data, outcome, estimate, probabilities = c(),
time = c(), call = current_env(), ...) {
time = c(), ...) {

# ------------------------------------------------------------------------------
# set columns via tidyselect
Expand Down Expand Up @@ -121,7 +120,7 @@ fit.container <- function(object, .data, outcome, estimate, probabilities = c(),

object <- new_container(object$mode, object$type,
operations = object$operations,
columns = dat, ptype = ptype, call = call)
columns = dat, ptype = ptype, call = current_env())

# ------------------------------------------------------------------------------

Expand Down
5 changes: 1 addition & 4 deletions man/container.Rd

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

0 comments on commit 4164156

Please sign in to comment.