From 0449de3e9d327be22666991154c65f66de5ce3fc Mon Sep 17 00:00:00 2001 From: Jon Harmon Date: Fri, 25 Aug 2023 10:54:59 -0500 Subject: [PATCH] Import functions from other packages rather than namespacing. (#51) --- NAMESPACE | 16 ++++++++++++++++ R/check.R | 28 +++++++++++++-------------- R/cls_unexported.R | 24 +++++++++++------------ R/is.R | 2 +- R/msgs_common.R | 16 ++++++++++++---- R/stabilize_arg.R | 6 +++--- R/stabilize_arg_scalar.R | 6 +++--- R/stabilize_chr.R | 8 ++++---- R/stabilize_chr_scalar.R | 4 ++-- R/stabilize_int.R | 10 +++++----- R/stabilize_int_scalar.R | 4 ++-- R/stabilize_lgl.R | 4 ++-- R/stabilize_lgl_scalar.R | 4 ++-- R/stbl-package.R | 12 ++++++++++++ R/to_chr.R | 22 ++++++++++----------- R/to_chr_scalar.R | 6 +++--- R/to_int.R | 38 ++++++++++++++++++------------------- R/to_int_scalar.R | 6 +++--- R/to_lgl.R | 28 +++++++++++++-------------- R/to_lgl_scalar.R | 6 +++--- R/to_null.R | 4 ++-- R/utils.R | 4 ++-- man/reexports.Rd | 17 +++++++++++++++++ man/stabilize_arg.Rd | 4 ++-- man/stabilize_arg_scalar.Rd | 4 ++-- man/stabilize_chr.Rd | 4 ++-- man/stabilize_chr_scalar.Rd | 4 ++-- man/stabilize_int.Rd | 4 ++-- man/stabilize_int_scalar.Rd | 4 ++-- man/stabilize_lgl.Rd | 4 ++-- man/stabilize_lgl_scalar.Rd | 4 ++-- man/to_chr.Rd | 4 ++-- man/to_chr_scalar.Rd | 4 ++-- man/to_int.Rd | 4 ++-- man/to_int_scalar.Rd | 4 ++-- man/to_lgl.Rd | 4 ++-- man/to_lgl_scalar.Rd | 4 ++-- 37 files changed, 192 insertions(+), 139 deletions(-) create mode 100644 man/reexports.Rd diff --git a/NAMESPACE b/NAMESPACE index 774e8c8..faf817c 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -20,6 +20,8 @@ S3method(to_lgl,double) S3method(to_lgl,factor) S3method(to_lgl,integer) S3method(to_lgl,logical) +export(caller_arg) +export(caller_env) export(object_type) export(stabilize_arg) export(stabilize_arg_scalar) @@ -35,3 +37,17 @@ export(to_int) export(to_int_scalar) export(to_lgl) export(to_lgl_scalar) +importFrom(cli,cli_abort) +importFrom(cli,no) +importFrom(glue,glue) +importFrom(rlang,caller_arg) +importFrom(rlang,caller_env) +importFrom(rlang,check_dots_empty0) +importFrom(rlang,inject) +importFrom(rlang,is_scalar_character) +importFrom(rlang,is_scalar_integer) +importFrom(rlang,is_scalar_logical) +importFrom(rlang,is_scalar_vector) +importFrom(rlang,try_fetch) +importFrom(vctrs,vec_cast) +importFrom(vctrs,vec_size) diff --git a/R/check.R b/R/check.R index 9bbf6c1..27588f5 100644 --- a/R/check.R +++ b/R/check.R @@ -1,7 +1,7 @@ .check_na <- function(x, allow_na = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env()) { + x_arg = caller_arg(x), + call = caller_env()) { allow_na <- to_lgl_scalar(allow_na, allow_null = FALSE, call = call) if (allow_na) { return(invisible(NULL)) @@ -23,8 +23,8 @@ .check_size <- function(x, min_size, max_size, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env()) { + x_arg = caller_arg(x), + call = caller_env()) { if (is.null(min_size) && is.null(max_size)) { return(invisible(NULL)) } @@ -33,7 +33,7 @@ max_size <- to_int_scalar(max_size, call = call) .check_x_no_more_than_y(min_size, max_size, call = call) - x_size <- vctrs::vec_size(x) + x_size <- vec_size(x) min_ok <- is.null(min_size) || x_size >= min_size max_ok <- is.null(max_size) || x_size <= max_size @@ -62,8 +62,8 @@ .check_scalar <- function(x, allow_null = TRUE, allow_zero_length = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { # TODO: Some of this is redundant. if (!length(x)) { @@ -83,11 +83,11 @@ } } - if (rlang::is_scalar_vector(x)) { + if (is_scalar_vector(x)) { return(invisible(NULL)) } - x_size <- vctrs::vec_size(x) + x_size <- vec_size(x) if (x_class == "NULL") { x_class <- "non-NULL" @@ -96,17 +96,17 @@ "must be a single {.cls {x_class}}.", x_arg = x_arg, call = call, - additional_msg = c(x = "{.arg {x_arg}} has {cli::no(x_size)} values.") + additional_msg = c(x = "{.arg {x_arg}} has {no(x_size)} values.") ) } .check_x_no_more_than_y <- function(x, y, - x_arg = rlang::caller_arg(x), - y_arg = rlang::caller_arg(y), - call = rlang::caller_env()) { + x_arg = caller_arg(x), + y_arg = caller_arg(y), + call = caller_env()) { if (!is.null(x) && !is.null(y) && x > y) { - cli::cli_abort( + cli_abort( c( "{.arg {x_arg}} can't be larger than {.arg {y_arg}}.", "*" = "{.arg {x_arg}} = {x}", diff --git a/R/cls_unexported.R b/R/cls_unexported.R index e31f12d..82b5a7a 100644 --- a/R/cls_unexported.R +++ b/R/cls_unexported.R @@ -4,8 +4,8 @@ to_cls_args = list(), allow_null = TRUE, allow_zero_length = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { if (is_rlang_cls_scalar(x)) { return(x) @@ -13,7 +13,7 @@ force(x_arg) force(call) - x <- rlang::inject( + x <- inject( to_cls_fn( x, allow_null = allow_null, @@ -44,12 +44,12 @@ allow_na = TRUE, min_size = NULL, max_size = NULL, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { force(x_arg) force(call) - x <- rlang::inject( + x <- inject( to_cls_fn( x, allow_null = allow_null, @@ -60,7 +60,7 @@ ) ) if (!is.null(check_cls_value_fn)) { - rlang::inject( + inject( check_cls_value_fn( x, !!!check_cls_value_fn_args, @@ -90,14 +90,14 @@ allow_null = TRUE, allow_zero_length = TRUE, allow_na = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { - rlang::check_dots_empty0(..., call = call) + check_dots_empty0(..., call = call) force(x_arg) force(call) - x <- rlang::inject( + x <- inject( to_cls_scalar_fn( x, allow_null = allow_null, @@ -109,7 +109,7 @@ ) ) if (!is.null(check_cls_value_fn)) { - rlang::inject( + inject( check_cls_value_fn( x, !!!check_cls_value_fn_args, diff --git a/R/is.R b/R/is.R index d97259f..1790cf5 100644 --- a/R/is.R +++ b/R/is.R @@ -1,6 +1,6 @@ .is_allowed_null <- function(x, allow_null = TRUE, - call = rlang::caller_env()) { + call = caller_env()) { allow_null <- to_lgl_scalar(allow_null, allow_null = FALSE, call = call) return(is.null(x) && allow_null) } diff --git a/R/msgs_common.R b/R/msgs_common.R index f11875d..29d4059 100644 --- a/R/msgs_common.R +++ b/R/msgs_common.R @@ -1,9 +1,17 @@ +#' @importFrom rlang caller_arg +#' @export +rlang::caller_arg + +#' @importFrom rlang caller_env +#' @export +rlang::caller_env + .stop_must <- function(msg, x_arg, call, additional_msg = NULL) { main_msg <- .glue2("{.arg [x_arg]} [msg]") - cli::cli_abort( + cli_abort( c(main_msg, additional_msg), call = call, - .envir = rlang::caller_env() + .envir = caller_env() ) } @@ -15,10 +23,10 @@ main_msg <- .glue2( "Can't coerce {.arg [x_arg]} {.cls [from_class]} to {.cls [to_class]}." ) - cli::cli_abort( + cli_abort( c(main_msg, additional_msg), call = call, - .envir = rlang::caller_env() + .envir = caller_env() ) } diff --git a/R/stabilize_arg.R b/R/stabilize_arg.R index 2a92633..f320923 100644 --- a/R/stabilize_arg.R +++ b/R/stabilize_arg.R @@ -27,10 +27,10 @@ stabilize_arg <- function(x, allow_na = TRUE, min_size = NULL, max_size = NULL, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { - rlang::check_dots_empty0(..., call = call) + check_dots_empty0(..., call = call) if (is.null(x)) { return( diff --git a/R/stabilize_arg_scalar.R b/R/stabilize_arg_scalar.R index 84b2777..0db5fd9 100644 --- a/R/stabilize_arg_scalar.R +++ b/R/stabilize_arg_scalar.R @@ -18,10 +18,10 @@ stabilize_arg_scalar <- function(x, allow_null = TRUE, allow_zero_length = TRUE, allow_na = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { - rlang::check_dots_empty0(..., call = call) + check_dots_empty0(..., call = call) .check_scalar( x, allow_null = allow_null, diff --git a/R/stabilize_chr.R b/R/stabilize_chr.R index 1f0152f..312c756 100644 --- a/R/stabilize_chr.R +++ b/R/stabilize_chr.R @@ -29,8 +29,8 @@ stabilize_chr <- function(x, min_size = NULL, max_size = NULL, regex = NULL, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { .stabilize_cls( x, @@ -50,8 +50,8 @@ stabilize_chr <- function(x, .check_value_chr <- function(x, regex, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env()) { + x_arg = caller_arg(x), + call = caller_env()) { if (is.null(regex)) { return(invisible(NULL)) } diff --git a/R/stabilize_chr_scalar.R b/R/stabilize_chr_scalar.R index 381954e..75f4891 100644 --- a/R/stabilize_chr_scalar.R +++ b/R/stabilize_chr_scalar.R @@ -21,8 +21,8 @@ stabilize_chr_scalar <- function(x, allow_zero_length = TRUE, allow_na = TRUE, regex = NULL, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { .stabilize_cls_scalar( x, diff --git a/R/stabilize_int.R b/R/stabilize_int.R index fba91b4..e40cffe 100644 --- a/R/stabilize_int.R +++ b/R/stabilize_int.R @@ -38,8 +38,8 @@ stabilize_int <- function(x, max_size = NULL, min_value = NULL, max_value = NULL, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { .stabilize_cls( x, @@ -66,8 +66,8 @@ stabilize_int <- function(x, .check_value_int <- function(x, min_value, max_value, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env()) { + x_arg = caller_arg(x), + call = caller_env()) { min_value <- to_int_scalar(min_value, call = call) max_value <- to_int_scalar(max_value, call = call) @@ -87,5 +87,5 @@ stabilize_int <- function(x, x = "Values are too high at locations {max_failure_locations}." ) - cli::cli_abort(c(min_msg, max_msg), call = call) + cli_abort(c(min_msg, max_msg), call = call) } diff --git a/R/stabilize_int_scalar.R b/R/stabilize_int_scalar.R index e7ef9cc..d73a736 100644 --- a/R/stabilize_int_scalar.R +++ b/R/stabilize_int_scalar.R @@ -24,8 +24,8 @@ stabilize_int_scalar <- function(x, coerce_factor = TRUE, min_value = NULL, max_value = NULL, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { .stabilize_cls_scalar( x, diff --git a/R/stabilize_lgl.R b/R/stabilize_lgl.R index 1ba2a4d..9f9b8ad 100644 --- a/R/stabilize_lgl.R +++ b/R/stabilize_lgl.R @@ -26,8 +26,8 @@ stabilize_lgl <- function(x, allow_na = TRUE, min_size = NULL, max_size = NULL, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { .stabilize_cls( x, diff --git a/R/stabilize_lgl_scalar.R b/R/stabilize_lgl_scalar.R index 3175287..6ff225f 100644 --- a/R/stabilize_lgl_scalar.R +++ b/R/stabilize_lgl_scalar.R @@ -20,8 +20,8 @@ stabilize_lgl_scalar <- function(x, allow_null = TRUE, allow_zero_length = TRUE, allow_na = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { .stabilize_cls_scalar( x, diff --git a/R/stbl-package.R b/R/stbl-package.R index a65cf64..e4bee5c 100644 --- a/R/stbl-package.R +++ b/R/stbl-package.R @@ -2,5 +2,17 @@ "_PACKAGE" ## usethis namespace: start +#' @importFrom cli cli_abort +#' @importFrom cli no +#' @importFrom glue glue +#' @importFrom rlang check_dots_empty0 +#' @importFrom rlang inject +#' @importFrom rlang is_scalar_character +#' @importFrom rlang is_scalar_integer +#' @importFrom rlang is_scalar_logical +#' @importFrom rlang is_scalar_vector +#' @importFrom rlang try_fetch +#' @importFrom vctrs vec_cast +#' @importFrom vctrs vec_size ## usethis namespace: end NULL diff --git a/R/to_chr.R b/R/to_chr.R index 11c0a28..8074cbe 100644 --- a/R/to_chr.R +++ b/R/to_chr.R @@ -26,8 +26,8 @@ #' try(to_chr(NULL, allow_null = FALSE)) to_chr <- function(x, allow_null = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { UseMethod("to_chr") } @@ -41,16 +41,16 @@ to_chr.character <- function(x, ...) { to_chr.NULL <- function(x, ..., allow_null = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env()) { + x_arg = caller_arg(x), + call = caller_env()) { to_null(x, allow_null = allow_null, x_arg = x_arg, call = call) } #' @export to_chr.list <- function(x, ..., - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { .stop_cant_coerce( from_class = x_class, @@ -63,8 +63,8 @@ to_chr.list <- function(x, #' @export to_chr.data.frame <- function(x, ..., - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { .stop_cant_coerce( from_class = x_class, @@ -77,10 +77,10 @@ to_chr.data.frame <- function(x, #' @export to_chr.default <- function(x, ..., - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { - rlang::try_fetch( + try_fetch( as.character(x), error = function(cnd) { .stop_cant_coerce( diff --git a/R/to_chr_scalar.R b/R/to_chr_scalar.R index a9e6ba5..c85c91b 100644 --- a/R/to_chr_scalar.R +++ b/R/to_chr_scalar.R @@ -15,12 +15,12 @@ to_chr_scalar <- function(x, allow_null = TRUE, allow_zero_length = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { .to_cls_scalar( x, - is_rlang_cls_scalar = rlang::is_scalar_character, + is_rlang_cls_scalar = is_scalar_character, to_cls_fn = to_chr, allow_null = allow_null, allow_zero_length = allow_zero_length, diff --git a/R/to_int.R b/R/to_int.R index 9297eb0..3ecafd4 100644 --- a/R/to_int.R +++ b/R/to_int.R @@ -28,8 +28,8 @@ to_int <- function(x, allow_null = TRUE, coerce_character = TRUE, coerce_factor = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { UseMethod("to_int") } @@ -43,33 +43,33 @@ to_int.integer <- function(x, ...) { to_int.NULL <- function(x, ..., allow_null = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env()) { + x_arg = caller_arg(x), + call = caller_env()) { to_null(x, allow_null = allow_null, x_arg = x_arg, call = call) } #' @export to_int.double <- function(x, ..., - x_arg = rlang::caller_arg(x), - call = rlang::caller_env()) { - vctrs::vec_cast(x, integer(), x_arg = x_arg, call = call) + x_arg = caller_arg(x), + call = caller_env()) { + vec_cast(x, integer(), x_arg = x_arg, call = call) } #' @export to_int.logical <- function(x, ..., - x_arg = rlang::caller_arg(x), - call = rlang::caller_env()) { - vctrs::vec_cast(x, integer(), x_arg = x_arg, call = call) + x_arg = caller_arg(x), + call = caller_env()) { + vec_cast(x, integer(), x_arg = x_arg, call = call) } #' @export to_int.character <- function(x, ..., coerce_character = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { coerce_character <- to_lgl_scalar( coerce_character, @@ -109,8 +109,8 @@ to_int.character <- function(x, to_int.factor <- function(x, ..., coerce_factor = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { coerce_factor <- to_lgl_scalar(coerce_factor, allow_null = FALSE, call = call) if (coerce_factor) { @@ -135,8 +135,8 @@ to_int.factor <- function(x, #' @export to_int.complex <- function(x, ..., - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { cast <- suppressWarnings(as.integer(x)) x_na <- is.na(x) @@ -153,7 +153,7 @@ to_int.complex <- function(x, #' @export to_int.default <- function(x, ..., - x_arg = rlang::caller_arg(x), - call = rlang::caller_env()) { - vctrs::vec_cast(x, integer(), x_arg = x_arg, call = call) + x_arg = caller_arg(x), + call = caller_env()) { + vec_cast(x, integer(), x_arg = x_arg, call = call) } diff --git a/R/to_int_scalar.R b/R/to_int_scalar.R index f68e8d7..e8f1ac2 100644 --- a/R/to_int_scalar.R +++ b/R/to_int_scalar.R @@ -17,12 +17,12 @@ to_int_scalar <- function(x, allow_zero_length = TRUE, coerce_character = TRUE, coerce_factor = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { .to_cls_scalar( x, - is_rlang_cls_scalar = rlang::is_scalar_integer, + is_rlang_cls_scalar = is_scalar_integer, to_cls_fn = to_int, to_cls_args = list( coerce_character = coerce_character, diff --git a/R/to_lgl.R b/R/to_lgl.R index 0a60ca9..224d9db 100644 --- a/R/to_lgl.R +++ b/R/to_lgl.R @@ -20,8 +20,8 @@ #' try(to_lgl(list(TRUE))) to_lgl <- function(x, allow_null = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { UseMethod("to_lgl") } @@ -35,32 +35,32 @@ to_lgl.logical <- function(x, ...) { to_lgl.NULL <- function(x, ..., allow_null = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env()) { + x_arg = caller_arg(x), + call = caller_env()) { to_null(x, allow_null = allow_null, x_arg = x_arg, call = call) } #' @export to_lgl.integer <- function(x, ..., - x_arg = rlang::caller_arg(x), - call = rlang::caller_env()) { + x_arg = caller_arg(x), + call = caller_env()) { return(as.logical(x)) } #' @export to_lgl.double <- function(x, ..., - x_arg = rlang::caller_arg(x), - call = rlang::caller_env()) { + x_arg = caller_arg(x), + call = caller_env()) { return(as.logical(x)) } #' @export to_lgl.character <- function(x, ..., - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { cast <- as.logical(toupper(x)) failures <- xor(is.na(x), is.na(cast)) @@ -78,8 +78,8 @@ to_lgl.character <- function(x, #' @export to_lgl.factor <- function(x, ..., - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { return( to_lgl.character( @@ -95,8 +95,8 @@ to_lgl.factor <- function(x, #' @export to_lgl.default <- function(x, ..., - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { .stop_cant_coerce( from_class = x_class, diff --git a/R/to_lgl_scalar.R b/R/to_lgl_scalar.R index 6c76354..117ed0f 100644 --- a/R/to_lgl_scalar.R +++ b/R/to_lgl_scalar.R @@ -15,12 +15,12 @@ to_lgl_scalar <- function(x, allow_null = TRUE, allow_zero_length = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x)) { .to_cls_scalar( x, - is_rlang_cls_scalar = rlang::is_scalar_logical, + is_rlang_cls_scalar = is_scalar_logical, to_cls_fn = to_lgl, allow_null = allow_null, allow_zero_length = allow_zero_length, diff --git a/R/to_null.R b/R/to_null.R index 7dda532..472bd96 100644 --- a/R/to_null.R +++ b/R/to_null.R @@ -1,7 +1,7 @@ to_null <- function(x, allow_null = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env()) { + x_arg = caller_arg(x), + call = caller_env()) { if (missing(x)) { .stop_must("must not be missing.", x_arg = "unknown arg", call = call) } diff --git a/R/utils.R b/R/utils.R index 471b739..56cd714 100644 --- a/R/utils.R +++ b/R/utils.R @@ -1,5 +1,5 @@ -.glue2 <- function(..., env = rlang::caller_env()) { - glue::glue(..., .envir = env, .open = "[", .close = "]") +.glue2 <- function(..., env = caller_env()) { + glue(..., .envir = env, .open = "[", .close = "]") } `%&&%` <- function(x, y) { diff --git a/man/reexports.Rd b/man/reexports.Rd new file mode 100644 index 0000000..6c95db8 --- /dev/null +++ b/man/reexports.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/msgs_common.R +\docType{import} +\name{reexports} +\alias{reexports} +\alias{caller_arg} +\alias{caller_env} +\title{Objects exported from other packages} +\keyword{internal} +\description{ +These objects are imported from other packages. Follow the links +below to see their documentation. + +\describe{ + \item{rlang}{\code{\link[rlang]{caller_arg}}, \code{\link[rlang:stack]{caller_env}}} +}} + diff --git a/man/stabilize_arg.Rd b/man/stabilize_arg.Rd index b1e507f..1ad6e23 100644 --- a/man/stabilize_arg.Rd +++ b/man/stabilize_arg.Rd @@ -11,8 +11,8 @@ stabilize_arg( allow_na = TRUE, min_size = NULL, max_size = NULL, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x) ) } diff --git a/man/stabilize_arg_scalar.Rd b/man/stabilize_arg_scalar.Rd index a89c6a8..af24bdc 100644 --- a/man/stabilize_arg_scalar.Rd +++ b/man/stabilize_arg_scalar.Rd @@ -10,8 +10,8 @@ stabilize_arg_scalar( allow_null = TRUE, allow_zero_length = TRUE, allow_na = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x) ) } diff --git a/man/stabilize_chr.Rd b/man/stabilize_chr.Rd index 5fa5fb7..3bf3615 100644 --- a/man/stabilize_chr.Rd +++ b/man/stabilize_chr.Rd @@ -12,8 +12,8 @@ stabilize_chr( min_size = NULL, max_size = NULL, regex = NULL, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x) ) } diff --git a/man/stabilize_chr_scalar.Rd b/man/stabilize_chr_scalar.Rd index 710ebff..11483bf 100644 --- a/man/stabilize_chr_scalar.Rd +++ b/man/stabilize_chr_scalar.Rd @@ -11,8 +11,8 @@ stabilize_chr_scalar( allow_zero_length = TRUE, allow_na = TRUE, regex = NULL, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x) ) } diff --git a/man/stabilize_int.Rd b/man/stabilize_int.Rd index a3444c2..46c646c 100644 --- a/man/stabilize_int.Rd +++ b/man/stabilize_int.Rd @@ -15,8 +15,8 @@ stabilize_int( max_size = NULL, min_value = NULL, max_value = NULL, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x) ) } diff --git a/man/stabilize_int_scalar.Rd b/man/stabilize_int_scalar.Rd index efc7c80..b02e916 100644 --- a/man/stabilize_int_scalar.Rd +++ b/man/stabilize_int_scalar.Rd @@ -14,8 +14,8 @@ stabilize_int_scalar( coerce_factor = TRUE, min_value = NULL, max_value = NULL, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x) ) } diff --git a/man/stabilize_lgl.Rd b/man/stabilize_lgl.Rd index cd5b780..9cb7195 100644 --- a/man/stabilize_lgl.Rd +++ b/man/stabilize_lgl.Rd @@ -11,8 +11,8 @@ stabilize_lgl( allow_na = TRUE, min_size = NULL, max_size = NULL, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x) ) } diff --git a/man/stabilize_lgl_scalar.Rd b/man/stabilize_lgl_scalar.Rd index 0f93b7b..674caf6 100644 --- a/man/stabilize_lgl_scalar.Rd +++ b/man/stabilize_lgl_scalar.Rd @@ -10,8 +10,8 @@ stabilize_lgl_scalar( allow_null = TRUE, allow_zero_length = TRUE, allow_na = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x) ) } diff --git a/man/to_chr.Rd b/man/to_chr.Rd index 117ff7d..21fe716 100644 --- a/man/to_chr.Rd +++ b/man/to_chr.Rd @@ -7,8 +7,8 @@ to_chr( x, allow_null = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x) ) } diff --git a/man/to_chr_scalar.Rd b/man/to_chr_scalar.Rd index e188026..cf073a4 100644 --- a/man/to_chr_scalar.Rd +++ b/man/to_chr_scalar.Rd @@ -8,8 +8,8 @@ to_chr_scalar( x, allow_null = TRUE, allow_zero_length = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x) ) } diff --git a/man/to_int.Rd b/man/to_int.Rd index f9478cb..133fef8 100644 --- a/man/to_int.Rd +++ b/man/to_int.Rd @@ -9,8 +9,8 @@ to_int( allow_null = TRUE, coerce_character = TRUE, coerce_factor = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x) ) } diff --git a/man/to_int_scalar.Rd b/man/to_int_scalar.Rd index 044f109..f525273 100644 --- a/man/to_int_scalar.Rd +++ b/man/to_int_scalar.Rd @@ -10,8 +10,8 @@ to_int_scalar( allow_zero_length = TRUE, coerce_character = TRUE, coerce_factor = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x) ) } diff --git a/man/to_lgl.Rd b/man/to_lgl.Rd index 74824df..6edcbd5 100644 --- a/man/to_lgl.Rd +++ b/man/to_lgl.Rd @@ -7,8 +7,8 @@ to_lgl( x, allow_null = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x) ) } diff --git a/man/to_lgl_scalar.Rd b/man/to_lgl_scalar.Rd index e3e6d6e..2240a4d 100644 --- a/man/to_lgl_scalar.Rd +++ b/man/to_lgl_scalar.Rd @@ -8,8 +8,8 @@ to_lgl_scalar( x, allow_null = TRUE, allow_zero_length = TRUE, - x_arg = rlang::caller_arg(x), - call = rlang::caller_env(), + x_arg = caller_arg(x), + call = caller_env(), x_class = object_type(x) ) }