From a4713bdb1430a4a76131a1fc21346141cf955838 Mon Sep 17 00:00:00 2001 From: Davis Vaughan Date: Wed, 21 Aug 2024 16:50:46 -0400 Subject: [PATCH] Use non-deprecated `obj_*()` family --- R/list-combine.R | 4 ++-- R/list-flatten.R | 4 ++-- R/list-simplify.R | 4 ++-- R/modify-tree.R | 4 ++-- R/modify.R | 6 +++--- R/utils.R | 2 +- man/list_assign.Rd | 2 +- man/map_depth.Rd | 2 +- man/modify_tree.Rd | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/R/list-combine.R b/R/list-combine.R index ea31d5de..65af1953 100644 --- a/R/list-combine.R +++ b/R/list-combine.R @@ -38,7 +38,7 @@ #' #' list_cbind(x2) list_c <- function(x, ..., ptype = NULL) { - vec_check_list(x) + obj_check_list(x) check_dots_empty() # For `list_c()`, we don't expose `list_unchop()`'s `name_spec` arg, @@ -77,7 +77,7 @@ list_rbind <- function(x, ..., names_to = rlang::zap(), ptype = NULL) { check_list_of_data_frames <- function(x, error_call = caller_env()) { - vec_check_list(x, call = error_call) + obj_check_list(x, call = error_call) is_df_or_null <- map_lgl(x, function(x) is.data.frame(x) || is.null(x)) diff --git a/R/list-flatten.R b/R/list-flatten.R index 65504161..8e096696 100644 --- a/R/list-flatten.R +++ b/R/list-flatten.R @@ -46,7 +46,7 @@ list_flatten <- function( name_spec = "{outer}_{inner}", name_repair = c("minimal", "unique", "check_unique", "universal") ) { - vec_check_list(x) + obj_check_list(x) check_dots_empty() check_string(name_spec) @@ -55,7 +55,7 @@ list_flatten <- function( # Unclass S3 lists to avoid their coercion methods. Wrap atoms in a # list of size 1 so the elements can be concatenated in a single list. - proxy <- map_if(proxy, vec_is_list, unclass, .else = list) + proxy <- map_if(proxy, obj_is_list, unclass, .else = list) out <- list_unchop( proxy, diff --git a/R/list-simplify.R b/R/list-simplify.R index ab5f82d1..52e992cb 100644 --- a/R/list-simplify.R +++ b/R/list-simplify.R @@ -8,7 +8,7 @@ #' #' @param x A list. #' @param strict What should happen if simplification fails? If `TRUE` -#' (the default) it will error. If `FALSE` and `ptype` is not supplied, +#' (the default) it will error. If `FALSE` and `ptype` is not supplied, #' it will return `x` unchanged. #' @param ptype An optional prototype to ensure that the output type is always #' the same. @@ -66,7 +66,7 @@ simplify_impl <- function(x, ptype = NULL, error_arg = caller_arg(x), error_call = caller_env()) { - vec_check_list(x, arg = error_arg, call = error_call) + obj_check_list(x, arg = error_arg, call = error_call) # Handle the cases where we definitely can't simplify if (strict) { diff --git a/R/modify-tree.R b/R/modify-tree.R index af4c5f87..3fc25938 100644 --- a/R/modify-tree.R +++ b/R/modify-tree.R @@ -10,7 +10,7 @@ #' a node (by returning `TRUE`) or a leaf (by returning `FALSE`). The #' default value, `NULL`, treats simple lists as nodes and everything else #' (including richer objects like data frames and linear models) as leaves, -#' using [vctrs::vec_is_list()]. To recurse into all objects built on lists +#' using [vctrs::obj_is_list()]. To recurse into all objects built on lists #' use [is.list()]. #' @param pre,post Functions applied to each node. `pre` is applied on the #' way "down", i.e. before the leaves are transformed with `leaf`, while @@ -62,7 +62,7 @@ modify_tree <- function(x, as_is_node <- function(f, error_call = caller_env(), error_arg = caller_arg(f)) { if (is.null(f)) { - vec_is_list + obj_is_list } else { is_node_f <- rlang::as_function(f, call = error_call, arg = error_arg) as_predicate( diff --git a/R/modify.R b/R/modify.R index e0f9eda3..180b89f0 100644 --- a/R/modify.R +++ b/R/modify.R @@ -87,7 +87,7 @@ modify <- function(.x, .f, ...) { .f <- as_mapper(.f, ...) - if (vec_is_list(.x)) { + if (obj_is_list(.x)) { out <- map(vec_proxy(.x), .f, ...) vec_restore(out, .x) } else if (is.data.frame(.x)) { @@ -137,7 +137,7 @@ modify_at <- function(.x, .at, .f, ...) { modify2 <- function(.x, .y, .f, ...) { .f <- as_mapper(.f, ...) - if (vec_is_list(.x)) { + if (obj_is_list(.x)) { out <- map2(vec_proxy(.x), .y, .f, ...) vec_restore(out, .x) } else if (is.data.frame(.x)) { @@ -172,7 +172,7 @@ imodify <- function(.x, .f, ...) { # helpers ----------------------------------------------------------------- modify_where <- function(.x, .where, .f, ..., .purrr_error_call = caller_env()) { - if (vec_is_list(.x)) { + if (obj_is_list(.x)) { out <- vec_proxy(.x) out[.where] <- no_zap(map(out[.where], .f, ...), .purrr_error_call) vec_restore(out, .x) diff --git a/R/utils.R b/R/utils.R index ffec7cd6..a4ea3b77 100644 --- a/R/utils.R +++ b/R/utils.R @@ -105,7 +105,7 @@ vctrs_list_compat <- function(x, error_call = caller_env(), error_arg = caller_arg(x)) { out <- vctrs_vec_compat(x, user_env) - vec_check_list(out, call = error_call, arg = error_arg) + obj_check_list(out, call = error_call, arg = error_arg) out } diff --git a/man/list_assign.Rd b/man/list_assign.Rd index 20676e6e..17c4cbdc 100644 --- a/man/list_assign.Rd +++ b/man/list_assign.Rd @@ -29,7 +29,7 @@ replacement values are stored in a list, you can splice that in with a node (by returning \code{TRUE}) or a leaf (by returning \code{FALSE}). The default value, \code{NULL}, treats simple lists as nodes and everything else (including richer objects like data frames and linear models) as leaves, -using \code{\link[vctrs:vec_is_list]{vctrs::vec_is_list()}}. To recurse into all objects built on lists +using \code{\link[vctrs:obj_is_list]{vctrs::obj_is_list()}}. To recurse into all objects built on lists use \code{\link[=is.list]{is.list()}}.} } \description{ diff --git a/man/map_depth.Rd b/man/map_depth.Rd index 1d85c0f9..2425f81c 100644 --- a/man/map_depth.Rd +++ b/man/map_depth.Rd @@ -55,7 +55,7 @@ no elements at depth \code{.depth}.} a node (by returning \code{TRUE}) or a leaf (by returning \code{FALSE}). The default value, \code{NULL}, treats simple lists as nodes and everything else (including richer objects like data frames and linear models) as leaves, -using \code{\link[vctrs:vec_is_list]{vctrs::vec_is_list()}}. To recurse into all objects built on lists +using \code{\link[vctrs:obj_is_list]{vctrs::obj_is_list()}}. To recurse into all objects built on lists use \code{\link[=is.list]{is.list()}}.} } \description{ diff --git a/man/modify_tree.Rd b/man/modify_tree.Rd index c348202b..111357af 100644 --- a/man/modify_tree.Rd +++ b/man/modify_tree.Rd @@ -24,7 +24,7 @@ modify_tree( a node (by returning \code{TRUE}) or a leaf (by returning \code{FALSE}). The default value, \code{NULL}, treats simple lists as nodes and everything else (including richer objects like data frames and linear models) as leaves, -using \code{\link[vctrs:vec_is_list]{vctrs::vec_is_list()}}. To recurse into all objects built on lists +using \code{\link[vctrs:obj_is_list]{vctrs::obj_is_list()}}. To recurse into all objects built on lists use \code{\link[=is.list]{is.list()}}.} \item{pre, post}{Functions applied to each node. \code{pre} is applied on the