Normally, you invoke a R function by typing arguments manually. A
powerful alternative is to call a function with a list of arguments
assembled programmatically. This is the purpose of invoke()
.
invoke(.fn, .args = list(), ..., .env = caller_env(), .bury = c(".fn", ""))
.fn | A function to invoke. Can be a function object or the
name of a function in scope of |
---|---|
.args, ... | List of arguments (possibly named) to be passed to
|
.env | The environment in which to call |
.bury | A character vector of length 2. The first string
specifies which name should the function have in the call
recorded in the evaluation stack. The second string specifies a
prefix for the argument names. Set |
Technically, invoke()
is basically a version of base::do.call()
that creates cleaner call traces because it does not inline the
function and the arguments in the call (see examples). To achieve
this, invoke()
creates a child environment of .env
with .fn
and all arguments bound to new symbols (see env_bury()
). It then
uses the same strategy as eval_bare()
to evaluate with minimal
noise.
invoke()
is soft-deprecated in favour of exec()
. Now that we
understand better the interaction between unquoting and dots
capture, we can take a simpler approach in exec()
.
If you need finer control over the generated call, you should construct an environment and call yourself, manually burying large objects or complex expressions.
# invoke() has the same purpose as do.call(): invoke(paste, letters) #> Warning: `invoke()` is deprecated as of rlang 0.4.0. #> Please use `exec()` or `eval(expr())`instead. #> This warning is displayed once per session. #> [1] "a b c d e f g h i j k l m n o p q r s t u v w x y z" # But it creates much cleaner calls: invoke(call_inspect, mtcars) #> .fn(mpg = `1`, cyl = `2`, disp = `3`, hp = `4`, drat = `5`, wt = `6`, #> qsec = `7`, vs = `8`, am = `9`, gear = `10`, carb = `11`) # and stacktraces: fn <- function(...) sys.calls() invoke(fn, list(mtcars)) #> [[1]] #> tryCatch(withCallingHandlers({ #> NULL #> saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpVTMEEO/callr-fun-e127c12e3e3"), #> list(envir = .GlobalEnv, quote = TRUE)), envir = .GlobalEnv, #> quote = TRUE), file = "/tmp/RtmpVTMEEO/callr-res-e12216abce") #> flush(stdout()) #> flush(stderr()) #> NULL #> invisible() #> }, error = function(e) { #> { #> callr_data <- as.environment("tools:callr")$`__callr_data__` #> err <- callr_data$err #> assign(".Traceback", .traceback(4), envir = callr_data) #> dump.frames("__callr_dump__") #> assign(".Last.dump", .GlobalEnv$`__callr_dump__`, envir = callr_data) #> rm("__callr_dump__", envir = .GlobalEnv) #> e$call <- deparse(conditionCall(e), nlines = 6) #> e2 <- err$new_error(conditionMessage(e), call. = conditionCall(e)) #> class(e2) <- c("callr_remote_error", class(e2)) #> e2$error <- e #> calls <- sys.calls() #> dcframe <- which(vapply(calls, function(x) length(x) >= #> 1 && identical(x[[1]], quote(do.call)), logical(1)))[1] #> if (!is.na(dcframe)) #> e2$`_ignore` <- list(c(1, dcframe + 1L)) #> e2$`_pid` <- Sys.getpid() #> e2$`_timestamp` <- Sys.time() #> if (inherits(e, "rlib_error_2_0")) #> e2$parent <- e$parent #> e2 <- err$add_trace_back(e2, embed = FALSE) #> saveRDS(list("error", e2), file = paste0("/tmp/RtmpVTMEEO/callr-res-e12216abce", #> ".error")) #> } #> }, interrupt = function(e) { #> { #> callr_data <- as.environment("tools:callr")$`__callr_data__` #> err <- callr_data$err #> assign(".Traceback", .traceback(4), envir = callr_data) #> dump.frames("__callr_dump__") #> assign(".Last.dump", .GlobalEnv$`__callr_dump__`, envir = callr_data) #> rm("__callr_dump__", envir = .GlobalEnv) #> e$call <- deparse(conditionCall(e), nlines = 6) #> e2 <- err$new_error(conditionMessage(e), call. = conditionCall(e)) #> class(e2) <- c("callr_remote_error", class(e2)) #> e2$error <- e #> calls <- sys.calls() #> dcframe <- which(vapply(calls, function(x) length(x) >= #> 1 && identical(x[[1]], quote(do.call)), logical(1)))[1] #> if (!is.na(dcframe)) #> e2$`_ignore` <- list(c(1, dcframe + 1L)) #> e2$`_pid` <- Sys.getpid() #> e2$`_timestamp` <- Sys.time() #> if (inherits(e, "rlib_error_2_0")) #> e2$parent <- e$parent #> e2 <- err$add_trace_back(e2, embed = FALSE) #> saveRDS(list("error", e2), file = paste0("/tmp/RtmpVTMEEO/callr-res-e12216abce", #> ".error")) #> } #> }, callr_message = function(e) { #> try(signalCondition(e)) #> }), error = function(e) { #> NULL #> try(stop(e)) #> }, interrupt = function(e) { #> NULL #> e #> }) #> #> [[2]] #> tryCatchList(expr, classes, parentenv, handlers) #> #> [[3]] #> tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), #> names[nh], parentenv, handlers[[nh]]) #> #> [[4]] #> doTryCatch(return(expr), name, parentenv, handler) #> #> [[5]] #> tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> #> [[6]] #> tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> #> [[7]] #> doTryCatch(return(expr), name, parentenv, handler) #> #> [[8]] #> withCallingHandlers({ #> NULL #> saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpVTMEEO/callr-fun-e127c12e3e3"), #> list(envir = .GlobalEnv, quote = TRUE)), envir = .GlobalEnv, #> quote = TRUE), file = "/tmp/RtmpVTMEEO/callr-res-e12216abce") #> flush(stdout()) #> flush(stderr()) #> NULL #> invisible() #> }, error = function(e) { #> { #> callr_data <- as.environment("tools:callr")$`__callr_data__` #> err <- callr_data$err #> assign(".Traceback", .traceback(4), envir = callr_data) #> dump.frames("__callr_dump__") #> assign(".Last.dump", .GlobalEnv$`__callr_dump__`, envir = callr_data) #> rm("__callr_dump__", envir = .GlobalEnv) #> e$call <- deparse(conditionCall(e), nlines = 6) #> e2 <- err$new_error(conditionMessage(e), call. = conditionCall(e)) #> class(e2) <- c("callr_remote_error", class(e2)) #> e2$error <- e #> calls <- sys.calls() #> dcframe <- which(vapply(calls, function(x) length(x) >= #> 1 && identical(x[[1]], quote(do.call)), logical(1)))[1] #> if (!is.na(dcframe)) #> e2$`_ignore` <- list(c(1, dcframe + 1L)) #> e2$`_pid` <- Sys.getpid() #> e2$`_timestamp` <- Sys.time() #> if (inherits(e, "rlib_error_2_0")) #> e2$parent <- e$parent #> e2 <- err$add_trace_back(e2, embed = FALSE) #> saveRDS(list("error", e2), file = paste0("/tmp/RtmpVTMEEO/callr-res-e12216abce", #> ".error")) #> } #> }, interrupt = function(e) { #> { #> callr_data <- as.environment("tools:callr")$`__callr_data__` #> err <- callr_data$err #> assign(".Traceback", .traceback(4), envir = callr_data) #> dump.frames("__callr_dump__") #> assign(".Last.dump", .GlobalEnv$`__callr_dump__`, envir = callr_data) #> rm("__callr_dump__", envir = .GlobalEnv) #> e$call <- deparse(conditionCall(e), nlines = 6) #> e2 <- err$new_error(conditionMessage(e), call. = conditionCall(e)) #> class(e2) <- c("callr_remote_error", class(e2)) #> e2$error <- e #> calls <- sys.calls() #> dcframe <- which(vapply(calls, function(x) length(x) >= #> 1 && identical(x[[1]], quote(do.call)), logical(1)))[1] #> if (!is.na(dcframe)) #> e2$`_ignore` <- list(c(1, dcframe + 1L)) #> e2$`_pid` <- Sys.getpid() #> e2$`_timestamp` <- Sys.time() #> if (inherits(e, "rlib_error_2_0")) #> e2$parent <- e$parent #> e2 <- err$add_trace_back(e2, embed = FALSE) #> saveRDS(list("error", e2), file = paste0("/tmp/RtmpVTMEEO/callr-res-e12216abce", #> ".error")) #> } #> }, callr_message = function(e) { #> try(signalCondition(e)) #> }) #> #> [[9]] #> saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpVTMEEO/callr-fun-e127c12e3e3"), #> list(envir = .GlobalEnv, quote = TRUE)), envir = .GlobalEnv, #> quote = TRUE), file = "/tmp/RtmpVTMEEO/callr-res-e12216abce") #> #> [[10]] #> do.call(do.call, c(readRDS("/tmp/RtmpVTMEEO/callr-fun-e127c12e3e3"), #> list(envir = .GlobalEnv, quote = TRUE)), envir = .GlobalEnv, #> quote = TRUE) #> #> [[11]] #> (function (what, args, quote = FALSE, envir = parent.frame()) #> { #> if (!is.list(args)) #> stop("second argument must be a list") #> if (quote) #> args <- lapply(args, enquote) #> .Internal(do.call(what, args, envir)) #> })(base::quote(function (..., crayon_enabled, crayon_colors, #> pkgdown_internet) #> { #> options(crayon.enabled = crayon_enabled, crayon.colors = crayon_colors, #> pkgdown.internet = pkgdown_internet) #> pkgdown::build_site(...) #> }), base::quote(list(pkg = list(package = "rlang", version = "0.4.12", #> src_path = "/tmp/RtmpVTMEEO/rlang-0.4.12", dst_path = "/tmp/RtmpVTMEEO/rlang-0.4.12/docs", #> install_metadata = FALSE, desc = <environment>, meta = list( #> url = "mpn.metworx.com/packages/rlang/0.4.12", home = list( #> links = list(list(text = "Programming with dplyr", #> href = "https://dplyr.tidyverse.org/articles/programming.html"), #> list(text = "Using ggplot2 in packages", href = "https://ggplot2.tidyverse.org/articles/ggplot2-in-packages.html"))), #> navbar = list(structure = list(left = c("home", "reference", #> "lifecycle", "news"), right = "github"), components = list( #> lifecycle = list(text = "Life cycle", href = "reference/lifecycle.html"), #> news = list(text = "News", menu = list(list(text = "Release notes"), #> list(text = "Version 0.4.3", href = "https://www.tidyverse.org/blog/2020/02/glue-strings-and-tidy-eval/"), #> list(text = "Version 0.4.0", href = "https://www.tidyverse.org/articles/2019/06/rlang-0-4-0/"), #> list(text = "Version 0.3.1", href = "https://www.tidyverse.org/articles/2019/01/rlang-0-3-1/"), #> list(text = "Version 0.3.0", href = "https://www.tidyverse.org/articles/2018/10/rlang-0-3-0/"), #> list(text = "Version 0.2.0", href = "https://www.tidyverse.org/articles/2018/03/rlang-0.2.0/"), #> list(text = "------------------"), list(text = "Change log", #> href = "news/index.html"))))), reference = list( #> list(title = "Tidy evaluation", desc = "Quote arguments and expressions with unquoting support. The quosure variants wrap an environment with the expression.\n", #> contents = c("quo", "quos", "enquo", "enquos", #> "expr", "exprs", "enexpr", "enexprs", "nse-force", #> "nse-defuse", "as_label", "as_name")), list(title = "Tidy dots", #> desc = "Collect arguments contained in `...` with `!!!` and name-unquoting support.\n", #> contents = c("dyn-dots", "list2", "dots_list", #> "pairlist2")), list(title = "Errors, conditions, and backtraces", #> contents = c("abort", "warn", "inform", "signal", #> "cnd_message", "format_error_bullets", "trace_back", #> "with_abort", "entrace", "cnd_signal", "last_error", #> "rlang_backtrace_on_error", "catch_cnd")), list( #> title = "Evaluate expressions", contents = c("eval_tidy", #> "eval_bare", "exec")), list(title = "Symbols", #> contents = c("sym", "syms", "is_symbol", "as_string" #> )), list(title = "Calls", contents = c("starts_with(\"call_\")", #> "call2", "is_call")), list(title = "Expressions", #> contents = c("starts_with(\"expr_\")", "starts_with(\"exprs_\")", #> "starts_with(\"parse_\")", "is_expression", "is_symbolic", #> "expr_text", "expr_label", "expr_name", "set_expr", #> "get_expr")), list(title = "Quosures", contents = c("starts_with(\"quo_\")", #> "new_quosure", "is_quosure", "as_quosure", "is_quosures", #> "quos_auto_name")), list(title = "Formulas", contents = c("starts_with(\"f_\")", #> "new_formula", "is_formula", "is_bare_formula")), #> list(title = "Functions", contents = c("starts_with(\"fn_\")", #> "new_function", "is_function", "is_closure", "is_primitive", #> "as_function", "as_closure")), list(title = "Environments", #> contents = c("env", "new_environment", "env_print", #> "env_parent", "env_tail", "env_parents", "env_depth", #> "get_env", "set_env", "env_clone", "env_inherits", #> "is_environment", "is_bare_environment", "as_environment", #> "caller_env")), list(title = "Environment bindings", #> contents = c("env_bind", "env_bind_lazy", "env_bind_active", #> "env_unbind", "env_poke", "with_bindings", "scoped_bindings", #> "env_has", "env_get", "env_get_list", "env_names", #> "env_length", "env_poke")), list(title = "Search path and namespaces", #> contents = c("search_envs", "search_env", "base_env", #> "global_env", "empty_env", "is_installed", "is_namespace", #> "ns_env", "pkg_env", "env_name", "env_label")), #> list(title = "S3", contents = c("inherits_any", "inherits_all", #> "inherits_only", "new_box", "is_box", "as_box", "as_box_if", #> "unbox", "zap", "is_zap", "done")), list(title = "Create vectors", #> desc = "Atomic vector constructors have implicit splicing (i.e. splice lists automatically), while the list constructor has explicit splicing.\n", #> contents = c("lgl", "int", "dbl", "cpl", "chr", #> "list2", "rep_along", "rep_named", "seq2", "seq2_along" #> )), list(title = "Attributes", contents = c("set_names", #> "names2", "has_name", "is_named")), list(title = "Type predicates", #> contents = c("is_list", "is_atomic", "is_vector", #> "is_integer", "is_double", "is_character", "is_logical", #> "is_raw", "is_bytes", "is_scalar_list", "is_scalar_atomic", #> "is_scalar_vector", "is_scalar_integer", "is_scalar_double", #> "is_scalar_character", "is_scalar_logical", "is_scalar_raw", #> "is_scalar_bytes", "is_bare_list", "is_bare_atomic", #> "is_bare_vector", "is_bare_double", "is_bare_integer", #> "is_bare_numeric", "is_bare_character", "is_bare_logical", #> "is_bare_raw", "is_bare_bytes", "is_empty", "is_integerish", #> "is_bare_integerish", "is_scalar_integerish", #> "is_null", "is_true", "is_false", "is_string", #> "is_bool", "is_bare_string")), list(title = "Operators", #> contents = c("`%||%`", "`%|%`", "`%@%`")), list( #> title = "Function arguments", contents = c("arg_match", #> "missing_arg", "is_missing", "maybe_missing")), #> list(title = "Create tidy evaluation APIs", desc = "Create data masking APIs à-la dplyr or tidyr. These functions are meant for developers rather than users.\n", #> contents = c("`tidyeval-data`", "eval_tidy", #> "as_data_mask", "new_data_mask", "as_data_pronoun" #> )), list(title = "Condition handlers", contents = c("with_handlers", #> "calling")), list(title = "Session state", contents = c("matches(\"interactive\")", #> "matches(\"option\")")), list(title = "Weak references", #> contents = c("matches(\"weakref\")", "matches(\"wref\")" #> )), list(title = "FAQ", contents = "matches(\"faq\")"))), #> figures = list(dev = "ragg::agg_png", dpi = 96L, dev.args = list(), #> fig.ext = "png", fig.width = 7.29166666666667, fig.height = NULL, #> fig.retina = 2L, fig.asp = 0.618046971569839, bg = NULL), #> repo = list(url = list(home = "https://github.com/r-lib/rlang/", #> source = "https://github.com/r-lib/rlang/blob/master/", #> issue = "https://github.com/r-lib/rlang/issues/", user = "https://github.com/")), #> development = list(destination = "dev", mode = "release", #> version_label = "default", version_tooltip = "Released version", #> in_dev = FALSE), topics = list(name = c(abort.Rd = "abort", #> are_na.Rd = "are_na", arg_match.Rd = "arg_match", as_box.Rd = "as_box", #> as_bytes.Rd = "as_bytes", as_data_mask.Rd = "as_data_mask", #> as_env.Rd = "as_env", as_environment.Rd = "as_environment", #> as_function.Rd = "as_function", as_label.Rd = "as_label", #> as_name.Rd = "as_name", as_overscope.Rd = "as_overscope", #> as_pairlist.Rd = "as_pairlist", as_quosure.Rd = "as_quosure", #> as_string.Rd = "as_string", as_utf8_character.Rd = "as_utf8_character", #> `bare-type-predicates.Rd` = "bare-type-predicates", box.Rd = "box", #> call2.Rd = "call2", call_args.Rd = "call_args", call_fn.Rd = "call_fn", #> call_inspect.Rd = "call_inspect", call_modify.Rd = "call_modify", #> call_name.Rd = "call_name", call_parse_type.Rd = "call_parse_type", #> call_standardise.Rd = "call_standardise", caller_env.Rd = "caller_env", #> caller_fn.Rd = "caller_fn", caller_frame.Rd = "caller_frame", #> catch_cnd.Rd = "catch_cnd", chr_unserialise_unicode.Rd = "chr_unserialise_unicode", #> cnd.Rd = "error_cnd", cnd_message.Rd = "cnd_message", cnd_muffle.Rd = "cnd_muffle", #> cnd_signal.Rd = "cnd_signal", cnd_type.Rd = "cnd_type", done.Rd = "done", #> dots_definitions.Rd = "dots_definitions", dots_n.Rd = "dots_n", #> dots_values.Rd = "dots_values", duplicate.Rd = "duplicate", #> `dyn-dots.Rd` = "dyn-dots", empty_env.Rd = "empty_env", enquo0.Rd = "enquo0", #> entrace.Rd = "entrace", env.Rd = "env", env_bind.Rd = "env_bind", #> env_bind_exprs.Rd = "env_bind_exprs", env_binding_are_active.Rd = "env_binding_are_active", #> env_binding_lock.Rd = "env_binding_lock", env_browse.Rd = "env_browse", #> env_bury.Rd = "env_bury", env_clone.Rd = "env_clone", env_depth.Rd = "env_depth", #> env_get.Rd = "env_get", env_has.Rd = "env_has", env_inherits.Rd = "env_inherits", #> env_lock.Rd = "env_lock", env_name.Rd = "env_name", env_names.Rd = "env_names", #> env_parent.Rd = "env_parent", env_poke.Rd = "env_poke", env_print.Rd = "env_print", #> env_unbind.Rd = "env_unbind", env_unlock.Rd = "env_unlock", #> eval_bare.Rd = "eval_bare", eval_tidy.Rd = "eval_tidy", exec.Rd = "exec", #> exiting.Rd = "exiting", expr_interp.Rd = "expr_interp", expr_label.Rd = "expr_label", #> expr_print.Rd = "expr_print", exprs_auto_name.Rd = "exprs_auto_name", #> f_rhs.Rd = "f_rhs", f_text.Rd = "f_text", `faq-options.Rd` = "faq-options", #> flatten.Rd = "flatten", fn_body.Rd = "fn_body", fn_env.Rd = "fn_env", #> fn_fmls.Rd = "fn_fmls", format_error_bullets.Rd = "format_error_bullets", #> frame_position.Rd = "frame_position", friendly_type.Rd = "friendly_type", #> get_env.Rd = "get_env", has_length.Rd = "has_length", has_name.Rd = "has_name", #> hash.Rd = "hash", inherits_any.Rd = "inherits_any", inject.Rd = "inject", #> invoke.Rd = "invoke", is_call.Rd = "is_call", is_callable.Rd = "is_callable", #> is_condition.Rd = "is_condition", is_copyable.Rd = "is_copyable", #> is_empty.Rd = "is_empty", is_env.Rd = "is_env", is_environment.Rd = "is_environment", #> is_expr.Rd = "is_expr", is_expression.Rd = "is_expression", #> is_formula.Rd = "is_formula", is_frame.Rd = "is_frame", is_function.Rd = "is_function", #> is_installed.Rd = "is_installed", is_integerish.Rd = "is_integerish", #> is_interactive.Rd = "is_interactive", is_lang.Rd = "is_lang", #> is_named.Rd = "is_named", is_namespace.Rd = "is_namespace", #> is_pairlist.Rd = "is_pairlist", is_reference.Rd = "is_reference", #> is_stack.Rd = "is_stack", is_symbol.Rd = "is_symbol", is_true.Rd = "is_true", #> is_weakref.Rd = "is_weakref", lang.Rd = "lang", lang_head.Rd = "lang_head", #> lang_modify.Rd = "lang_modify", last_error.Rd = "last_error", #> lifecycle.Rd = "lifecycle", list2.Rd = "list2", local_bindings.Rd = "local_bindings", #> local_options.Rd = "local_options", missing.Rd = "missing", #> missing_arg.Rd = "missing_arg", mut_node_car.Rd = "mut_node_car", #> names2.Rd = "names2", `new-vector-along-retired.Rd` = "new-vector-along-retired", #> `new-vector.Rd` = "new-vector", new_call.Rd = "new_call", #> new_formula.Rd = "new_formula", new_function.Rd = "new_function", #> new_node.Rd = "new_node", new_quosures.Rd = "new_quosures", #> new_weakref.Rd = "new_weakref", ns_env.Rd = "ns_env", `nse-defuse.Rd` = "nse-defuse", #> `nse-force.Rd` = "nse-force", `op-definition.Rd` = "op-definition", #> `op-get-attr.Rd` = "op-get-attr", `op-na-default.Rd` = "op-na-default", #> `op-null-default.Rd` = "op-null-default", overscope_eval_next.Rd = "overscope_eval_next", #> pairlist2.Rd = "pairlist2", parse_expr.Rd = "parse_expr", #> parse_quosure.Rd = "parse_quosure", prepend.Rd = "prepend", #> prim_name.Rd = "prim_name", quo_expr.Rd = "quo_expr", quo_label.Rd = "quo_label", #> quo_squash.Rd = "quo_squash", quosure.Rd = "quosure", raw_deparse_str.Rd = "raw_deparse_str", #> rep_along.Rd = "rep_along", restarting.Rd = "restarting", #> return_from.Rd = "return_from", rlang_backtrace_on_error.Rd = "rlang_backtrace_on_error", #> rst_abort.Rd = "rst_abort", rst_list.Rd = "rst_list", `scalar-type-predicates.Rd` = "scalar-type-predicates", #> scoped_env.Rd = "scoped_env", scoped_interactive.Rd = "scoped_interactive", #> search_envs.Rd = "search_envs", seq2.Rd = "seq2", set_attrs.Rd = "set_attrs", #> set_expr.Rd = "set_expr", set_names.Rd = "set_names", splice.Rd = "splice", #> stack.Rd = "stack", stack_trim.Rd = "stack_trim", string.Rd = "string", #> switch_type.Rd = "switch_type", sym.Rd = "sym", `tidyeval-data.Rd` = "tidyeval-data", #> trace_back.Rd = "trace_back", `type-predicates.Rd` = "type-predicates", #> type_of.Rd = "type_of", vec_poke_n.Rd = "vec_poke_n", `vector-coercion.Rd` = "vector-coercion", #> `vector-construction.Rd` = "vector-construction", `vector-old-ctors.Rd` = "node", #> with_abort.Rd = "with_abort", with_env.Rd = "with_env", with_handlers.Rd = "with_handlers", #> with_restarts.Rd = "with_restarts", wref_key.Rd = "wref_key", #> zap.Rd = "zap", zap_srcref.Rd = "zap_srcref"), file_in = c("abort.Rd", #> "are_na.Rd", "arg_match.Rd", "as_box.Rd", "as_bytes.Rd", #> "as_data_mask.Rd", "as_env.Rd", "as_environment.Rd", "as_function.Rd", #> "as_label.Rd", "as_name.Rd", "as_overscope.Rd", "as_pairlist.Rd", #> "as_quosure.Rd", "as_string.Rd", "as_utf8_character.Rd", #> "bare-type-predicates.Rd", "box.Rd", "call2.Rd", "call_args.Rd", #> "call_fn.Rd", "call_inspect.Rd", "call_modify.Rd", "call_name.Rd", #> "call_parse_type.Rd", "call_standardise.Rd", "caller_env.Rd", #> "caller_fn.Rd", "caller_frame.Rd", "catch_cnd.Rd", "chr_unserialise_unicode.Rd", #> "cnd.Rd", "cnd_message.Rd", "cnd_muffle.Rd", "cnd_signal.Rd", #> "cnd_type.Rd", "done.Rd", "dots_definitions.Rd", "dots_n.Rd", #> "dots_values.Rd", "duplicate.Rd", "dyn-dots.Rd", "empty_env.Rd", #> "enquo0.Rd", "entrace.Rd", "env.Rd", "env_bind.Rd", "env_bind_exprs.Rd", #> "env_binding_are_active.Rd", "env_binding_lock.Rd", "env_browse.Rd", #> "env_bury.Rd", "env_clone.Rd", "env_depth.Rd", "env_get.Rd", #> "env_has.Rd", "env_inherits.Rd", "env_lock.Rd", "env_name.Rd", #> "env_names.Rd", "env_parent.Rd", "env_poke.Rd", "env_print.Rd", #> "env_unbind.Rd", "env_unlock.Rd", "eval_bare.Rd", "eval_tidy.Rd", #> "exec.Rd", "exiting.Rd", "expr_interp.Rd", "expr_label.Rd", #> "expr_print.Rd", "exprs_auto_name.Rd", "f_rhs.Rd", "f_text.Rd", #> "faq-options.Rd", "flatten.Rd", "fn_body.Rd", "fn_env.Rd", #> "fn_fmls.Rd", "format_error_bullets.Rd", "frame_position.Rd", #> "friendly_type.Rd", "get_env.Rd", "has_length.Rd", "has_name.Rd", #> "hash.Rd", "inherits_any.Rd", "inject.Rd", "invoke.Rd", "is_call.Rd", #> "is_callable.Rd", "is_condition.Rd", "is_copyable.Rd", "is_empty.Rd", #> "is_env.Rd", "is_environment.Rd", "is_expr.Rd", "is_expression.Rd", #> "is_formula.Rd", "is_frame.Rd", "is_function.Rd", "is_installed.Rd", #> "is_integerish.Rd", "is_interactive.Rd", "is_lang.Rd", "is_named.Rd", #> "is_namespace.Rd", "is_pairlist.Rd", "is_reference.Rd", "is_stack.Rd", #> "is_symbol.Rd", "is_true.Rd", "is_weakref.Rd", "lang.Rd", #> "lang_head.Rd", "lang_modify.Rd", "last_error.Rd", "lifecycle.Rd", #> "list2.Rd", "local_bindings.Rd", "local_options.Rd", "missing.Rd", #> "missing_arg.Rd", "mut_node_car.Rd", "names2.Rd", "new-vector-along-retired.Rd", #> "new-vector.Rd", "new_call.Rd", "new_formula.Rd", "new_function.Rd", #> "new_node.Rd", "new_quosures.Rd", "new_weakref.Rd", "ns_env.Rd", #> "nse-defuse.Rd", "nse-force.Rd", "op-definition.Rd", "op-get-attr.Rd", #> "op-na-default.Rd", "op-null-default.Rd", "overscope_eval_next.Rd", #> "pairlist2.Rd", "parse_expr.Rd", "parse_quosure.Rd", "prepend.Rd", #> "prim_name.Rd", "quo_expr.Rd", "quo_label.Rd", "quo_squash.Rd", #> "quosure.Rd", "raw_deparse_str.Rd", "rep_along.Rd", "restarting.Rd", #> "return_from.Rd", "rlang_backtrace_on_error.Rd", "rst_abort.Rd", #> "rst_list.Rd", "scalar-type-predicates.Rd", "scoped_env.Rd", #> "scoped_interactive.Rd", "search_envs.Rd", "seq2.Rd", "set_attrs.Rd", #> "set_expr.Rd", "set_names.Rd", "splice.Rd", "stack.Rd", "stack_trim.Rd", #> "string.Rd", "switch_type.Rd", "sym.Rd", "tidyeval-data.Rd", #> "trace_back.Rd", "type-predicates.Rd", "type_of.Rd", "vec_poke_n.Rd", #> "vector-coercion.Rd", "vector-construction.Rd", "vector-old-ctors.Rd", #> "with_abort.Rd", "with_env.Rd", "with_handlers.Rd", "with_restarts.Rd", #> "wref_key.Rd", "zap.Rd", "zap_srcref.Rd"), file_out = c("abort.html", #> "are_na.html", "arg_match.html", "as_box.html", "as_bytes.html", #> "as_data_mask.html", "as_env.html", "as_environment.html", #> "as_function.html", "as_label.html", "as_name.html", "as_overscope.html", #> "as_pairlist.html", "as_quosure.html", "as_string.html", #> "as_utf8_character.html", "bare-type-predicates.html", "box.html", #> "call2.html", "call_args.html", "call_fn.html", "call_inspect.html", #> "call_modify.html", "call_name.html", "call_parse_type.html", #> "call_standardise.html", "caller_env.html", "caller_fn.html", #> "caller_frame.html", "catch_cnd.html", "chr_unserialise_unicode.html", #> "cnd.html", "cnd_message.html", "cnd_muffle.html", "cnd_signal.html", #> "cnd_type.html", "done.html", "dots_definitions.html", "dots_n.html", #> "dots_values.html", "duplicate.html", "dyn-dots.html", "empty_env.html", #> "enquo0.html", "entrace.html", "env.html", "env_bind.html", #> "env_bind_exprs.html", "env_binding_are_active.html", "env_binding_lock.html", #> "env_browse.html", "env_bury.html", "env_clone.html", "env_depth.html", #> "env_get.html", "env_has.html", "env_inherits.html", "env_lock.html", #> "env_name.html", "env_names.html", "env_parent.html", "env_poke.html", #> "env_print.html", "env_unbind.html", "env_unlock.html", "eval_bare.html", #> "eval_tidy.html", "exec.html", "exiting.html", "expr_interp.html", #> "expr_label.html", "expr_print.html", "exprs_auto_name.html", #> "f_rhs.html", "f_text.html", "faq-options.html", "flatten.html", #> "fn_body.html", "fn_env.html", "fn_fmls.html", "format_error_bullets.html", #> "frame_position.html", "friendly_type.html", "get_env.html", #> "has_length.html", "has_name.html", "hash.html", "inherits_any.html", #> "inject.html", "invoke.html", "is_call.html", "is_callable.html", #> "is_condition.html", "is_copyable.html", "is_empty.html", #> "is_env.html", "is_environment.html", "is_expr.html", "is_expression.html", #> "is_formula.html", "is_frame.html", "is_function.html", "is_installed.html", #> "is_integerish.html", "is_interactive.html", "is_lang.html", #> "is_named.html", "is_namespace.html", "is_pairlist.html", #> "is_reference.html", "is_stack.html", "is_symbol.html", "is_true.html", #> "is_weakref.html", "lang.html", "lang_head.html", "lang_modify.html", #> "last_error.html", "lifecycle.html", "list2.html", "local_bindings.html", #> "local_options.html", "missing.html", "missing_arg.html", #> "mut_node_car.html", "names2.html", "new-vector-along-retired.html", #> "new-vector.html", "new_call.html", "new_formula.html", "new_function.html", #> "new_node.html", "new_quosures.html", "new_weakref.html", #> "ns_env.html", "nse-defuse.html", "nse-force.html", "op-definition.html", #> "op-get-attr.html", "op-na-default.html", "op-null-default.html", #> "overscope_eval_next.html", "pairlist2.html", "parse_expr.html", #> "parse_quosure.html", "prepend.html", "prim_name.html", "quo_expr.html", #> "quo_label.html", "quo_squash.html", "quosure.html", "raw_deparse_str.html", #> "rep_along.html", "restarting.html", "return_from.html", #> "rlang_backtrace_on_error.html", "rst_abort.html", "rst_list.html", #> "scalar-type-predicates.html", "scoped_env.html", "scoped_interactive.html", #> "search_envs.html", "seq2.html", "set_attrs.html", "set_expr.html", #> "set_names.html", "splice.html", "stack.html", "stack_trim.html", #> "string.html", "switch_type.html", "sym.html", "tidyeval-data.html", #> "trace_back.html", "type-predicates.html", "type_of.html", #> "vec_poke_n.html", "vector-coercion.html", "vector-construction.html", #> "vector-old-ctors.html", "with_abort.html", "with_env.html", #> "with_handlers.html", "with_restarts.html", "wref_key.html", #> "zap.html", "zap_srcref.html"), alias = list(abort.Rd = c("abort", #> "warn", "inform", "signal", "interrupt"), are_na.Rd = c("are_na", #> "is_na", "is_lgl_na", "is_int_na", "is_dbl_na", "is_chr_na", #> "is_cpl_na"), arg_match.Rd = c("arg_match", "arg_match0"), #> as_box.Rd = c("as_box", "as_box_if"), as_bytes.Rd = "as_bytes", #> as_data_mask.Rd = c("as_data_mask", "as_data_pronoun", #> "new_data_mask"), as_env.Rd = "as_env", as_environment.Rd = "as_environment", #> as_function.Rd = c("as_function", "is_lambda", "as_closure" #> ), as_label.Rd = "as_label", as_name.Rd = "as_name", #> as_overscope.Rd = c("as_overscope", "new_overscope", #> "overscope_clean"), as_pairlist.Rd = "as_pairlist", as_quosure.Rd = c("as_quosure", #> "new_quosure"), as_string.Rd = "as_string", as_utf8_character.Rd = "as_utf8_character", #> `bare-type-predicates.Rd` = c("bare-type-predicates", #> "is_bare_list", "is_bare_atomic", "is_bare_vector", "is_bare_double", #> "is_bare_integer", "is_bare_numeric", "is_bare_character", #> "is_bare_logical", "is_bare_raw", "is_bare_string", "is_bare_bytes" #> ), box.Rd = c("box", "new_box", "is_box", "unbox"), call2.Rd = "call2", #> call_args.Rd = c("call_args", "call_args_names"), call_fn.Rd = "call_fn", #> call_inspect.Rd = "call_inspect", call_modify.Rd = "call_modify", #> call_name.Rd = c("call_name", "call_ns"), call_parse_type.Rd = "call_parse_type", #> call_standardise.Rd = "call_standardise", caller_env.Rd = c("caller_env", #> "current_env"), caller_fn.Rd = c("caller_fn", "current_fn" #> ), caller_frame.Rd = "caller_frame", catch_cnd.Rd = "catch_cnd", #> chr_unserialise_unicode.Rd = "chr_unserialise_unicode", #> cnd.Rd = c("error_cnd", "cnd", "warning_cnd", "message_cnd" #> ), cnd_message.Rd = c("cnd_message", "cnd_header", "cnd_body", #> "cnd_footer"), cnd_muffle.Rd = "cnd_muffle", cnd_signal.Rd = "cnd_signal", #> cnd_type.Rd = "cnd_type", done.Rd = c("done", "is_done_box" #> ), dots_definitions.Rd = "dots_definitions", dots_n.Rd = "dots_n", #> dots_values.Rd = "dots_values", duplicate.Rd = "duplicate", #> `dyn-dots.Rd` = c("dyn-dots", "tidy-dots"), empty_env.Rd = "empty_env", #> enquo0.Rd = c("enquo0", "enquos0"), entrace.Rd = c("entrace", #> "cnd_entrace"), env.Rd = c("env", "child_env", "new_environment" #> ), env_bind.Rd = c("env_bind", "env_bind_lazy", "env_bind_active", #> "%<~%"), env_bind_exprs.Rd = c("env_bind_exprs", "env_bind_fns" #> ), env_binding_are_active.Rd = c("env_binding_are_active", #> "env_binding_are_lazy"), env_binding_lock.Rd = c("env_binding_lock", #> "env_binding_unlock", "env_binding_are_locked"), env_browse.Rd = c("env_browse", #> "env_is_browsed"), env_bury.Rd = "env_bury", env_clone.Rd = "env_clone", #> env_depth.Rd = "env_depth", env_get.Rd = c("env_get", #> "env_get_list"), env_has.Rd = "env_has", env_inherits.Rd = "env_inherits", #> env_lock.Rd = c("env_lock", "env_is_locked"), env_name.Rd = c("env_name", #> "env_label"), env_names.Rd = c("env_names", "env_length" #> ), env_parent.Rd = c("env_parent", "env_tail", "env_parents" #> ), env_poke.Rd = "env_poke", env_print.Rd = "env_print", #> env_unbind.Rd = "env_unbind", env_unlock.Rd = "env_unlock", #> eval_bare.Rd = "eval_bare", eval_tidy.Rd = "eval_tidy", #> exec.Rd = "exec", exiting.Rd = "exiting", expr_interp.Rd = "expr_interp", #> expr_label.Rd = c("expr_label", "expr_name", "expr_text" #> ), expr_print.Rd = c("expr_print", "expr_deparse"), exprs_auto_name.Rd = c("exprs_auto_name", #> "quos_auto_name"), f_rhs.Rd = c("f_rhs", "f_rhs<-", "f_lhs", #> "f_lhs<-", "f_env", "f_env<-"), f_text.Rd = c("f_text", #> "f_name", "f_label"), `faq-options.Rd` = "faq-options", #> flatten.Rd = c("flatten", "flatten_lgl", "flatten_int", #> "flatten_dbl", "flatten_cpl", "flatten_chr", "flatten_raw", #> "squash", "squash_lgl", "squash_int", "squash_dbl", "squash_cpl", #> "squash_chr", "squash_raw", "flatten_if", "squash_if" #> ), fn_body.Rd = c("fn_body", "fn_body<-"), fn_env.Rd = c("fn_env", #> "fn_env<-"), fn_fmls.Rd = c("fn_fmls", "fn_fmls_names", #> "fn_fmls_syms", "fn_fmls<-", "fn_fmls_names<-"), format_error_bullets.Rd = "format_error_bullets", #> frame_position.Rd = "frame_position", friendly_type.Rd = "friendly_type", #> get_env.Rd = c("get_env", "set_env", "env_poke_parent" #> ), has_length.Rd = "has_length", has_name.Rd = "has_name", #> hash.Rd = "hash", inherits_any.Rd = c("inherits_any", #> "inherits_all", "inherits_only"), inject.Rd = "inject", #> invoke.Rd = "invoke", is_call.Rd = "is_call", is_callable.Rd = "is_callable", #> is_condition.Rd = "is_condition", is_copyable.Rd = "is_copyable", #> is_empty.Rd = "is_empty", is_env.Rd = c("is_env", "is_bare_env" #> ), is_environment.Rd = c("is_environment", "is_bare_environment" #> ), is_expr.Rd = "is_expr", is_expression.Rd = c("is_expression", #> "is_syntactic_literal", "is_symbolic"), is_formula.Rd = c("is_formula", #> "is_bare_formula"), is_frame.Rd = "is_frame", is_function.Rd = c("is_function", #> "is_closure", "is_primitive", "is_primitive_eager", "is_primitive_lazy" #> ), is_installed.Rd = c("is_installed", "check_installed" #> ), is_integerish.Rd = c("is_integerish", "is_bare_integerish", #> "is_scalar_integerish"), is_interactive.Rd = c("is_interactive", #> "local_interactive", "with_interactive"), is_lang.Rd = c("is_lang", #> "is_unary_lang", "is_binary_lang", "quo_is_lang"), is_named.Rd = c("is_named", #> "is_dictionaryish", "have_name"), is_namespace.Rd = "is_namespace", #> is_pairlist.Rd = c("is_pairlist", "is_node", "is_node_list" #> ), is_reference.Rd = "is_reference", is_stack.Rd = c("is_stack", #> "is_eval_stack", "is_call_stack"), is_symbol.Rd = "is_symbol", #> is_true.Rd = c("is_true", "is_false"), is_weakref.Rd = "is_weakref", #> lang.Rd = c("lang", "new_language"), lang_head.Rd = c("lang_head", #> "lang_tail"), lang_modify.Rd = c("lang_modify", "lang_standardise", #> "lang_fn", "lang_name", "lang_args", "lang_args_names" #> ), last_error.Rd = c("last_error", "last_trace"), lifecycle.Rd = "lifecycle", #> list2.Rd = c("list2", "ll", "dots_list"), local_bindings.Rd = c("local_bindings", #> "with_bindings"), local_options.Rd = c("local_options", #> "with_options", "push_options", "peek_options", "peek_option" #> ), missing.Rd = c("missing", "na_lgl", "na_int", "na_dbl", #> "na_chr", "na_cpl"), missing_arg.Rd = c("missing_arg", #> "is_missing", "maybe_missing"), mut_node_car.Rd = c("mut_node_car", #> "mut_node_cdr", "mut_node_caar", "mut_node_cadr", "mut_node_cdar", #> "mut_node_cddr", "mut_node_tag"), names2.Rd = "names2", #> `new-vector-along-retired.Rd` = c("new-vector-along-retired", #> "new_logical_along", "new_integer_along", "new_double_along", #> "new_character_along", "new_complex_along", "new_raw_along", #> "new_list_along"), `new-vector.Rd` = c("new-vector", #> "new_logical", "new_integer", "new_double", "new_character", #> "new_complex", "new_raw", "new_list"), new_call.Rd = "new_call", #> new_formula.Rd = "new_formula", new_function.Rd = "new_function", #> new_node.Rd = c("new_node", "node_car", "node_cdr", "node_caar", #> "node_cadr", "node_cdar", "node_cddr", "node_poke_car", #> "node_poke_cdr", "node_poke_caar", "node_poke_cadr", #> "node_poke_cdar", "node_poke_cddr", "node_tag", "node_poke_tag" #> ), new_quosures.Rd = c("new_quosures", "as_quosures", #> "is_quosures"), new_weakref.Rd = "new_weakref", ns_env.Rd = c("ns_env", #> "ns_imports_env", "ns_env_name"), `nse-defuse.Rd` = c("nse-defuse", #> "quotation", "expr", "enexpr", "exprs", "enexprs", "ensym", #> "ensyms", "quo", "enquo", "quos", "enquos"), `nse-force.Rd` = c("nse-force", #> "quasiquotation", "UQ", "UQS", "{{}}", "{{", "!!", "!!!", #> ":=", "qq_show"), `op-definition.Rd` = c("op-definition", #> "is_definition", "new_definition", "is_formulaish"), #> `op-get-attr.Rd` = c("op-get-attr", "%@%", "%@%<-"), #> `op-na-default.Rd` = c("op-na-default", "%|%"), `op-null-default.Rd` = c("op-null-default", #> "%||%"), overscope_eval_next.Rd = "overscope_eval_next", #> pairlist2.Rd = "pairlist2", parse_expr.Rd = c("parse_expr", #> "parse_exprs", "parse_quo", "parse_quos"), parse_quosure.Rd = c("parse_quosure", #> "parse_quosures"), prepend.Rd = c("prepend", "modify" #> ), prim_name.Rd = "prim_name", quo_expr.Rd = "quo_expr", #> quo_label.Rd = c("quo_label", "quo_text", "quo_name"), #> quo_squash.Rd = "quo_squash", quosure.Rd = c("quosure", #> "is_quosure", "quo_is_missing", "quo_is_symbol", "quo_is_call", #> "quo_is_symbolic", "quo_is_null", "quo_get_expr", "quo_get_env", #> "quo_set_expr", "quo_set_env"), raw_deparse_str.Rd = "raw_deparse_str", #> rep_along.Rd = c("rep_along", "rep_named"), restarting.Rd = "restarting", #> return_from.Rd = c("return_from", "return_to"), rlang_backtrace_on_error.Rd = c("rlang_backtrace_on_error", #> "add_backtrace"), rst_abort.Rd = "rst_abort", rst_list.Rd = c("rst_list", #> "rst_exists", "rst_jump", "rst_maybe_jump"), `scalar-type-predicates.Rd` = c("scalar-type-predicates", #> "is_scalar_list", "is_scalar_atomic", "is_scalar_vector", #> "is_scalar_integer", "is_scalar_double", "is_scalar_character", #> "is_scalar_logical", "is_scalar_raw", "is_string", "is_scalar_bytes", #> "is_bool"), scoped_env.Rd = c("scoped_env", "is_scoped", #> "scoped_envs", "scoped_names"), scoped_interactive.Rd = c("scoped_interactive", #> "scoped_options", "scoped_bindings"), search_envs.Rd = c("search_envs", #> "search_env", "pkg_env", "pkg_env_name", "is_attached", #> "base_env", "global_env"), seq2.Rd = c("seq2", "seq2_along" #> ), set_attrs.Rd = c("set_attrs", "mut_attrs"), set_expr.Rd = c("set_expr", #> "get_expr"), set_names.Rd = "set_names", splice.Rd = c("splice", #> "is_spliced", "is_spliced_bare", "dots_splice"), stack.Rd = c("stack", #> "global_frame", "current_frame", "ctxt_frame", "call_frame", #> "ctxt_depth", "call_depth", "ctxt_stack", "call_stack" #> ), stack_trim.Rd = "stack_trim", string.Rd = "string", #> switch_type.Rd = c("switch_type", "coerce_type", "switch_class", #> "coerce_class"), sym.Rd = c("sym", "syms"), `tidyeval-data.Rd` = c("tidyeval-data", #> ".data", ".env"), trace_back.Rd = c("trace_back", "trace_length" #> ), `type-predicates.Rd` = c("type-predicates", "is_list", #> "is_atomic", "is_vector", "is_integer", "is_double", #> "is_character", "is_logical", "is_raw", "is_bytes", "is_null" #> ), type_of.Rd = "type_of", vec_poke_n.Rd = c("vec_poke_n", #> "vec_poke_range"), `vector-coercion.Rd` = c("vector-coercion", #> "as_logical", "as_integer", "as_double", "as_complex", #> "as_character", "as_list"), `vector-construction.Rd` = c("vector-construction", #> "lgl", "int", "dbl", "cpl", "chr", "bytes"), `vector-old-ctors.Rd` = c("node", #> "vector-old-ctors", "lgl_len", "int_len", "dbl_len", #> "chr_len", "cpl_len", "raw_len", "bytes_len", "list_len", #> "lgl_along", "int_along", "dbl_along", "chr_along", "cpl_along", #> "raw_along", "bytes_along", "list_along"), with_abort.Rd = "with_abort", #> with_env.Rd = c("with_env", "locally"), with_handlers.Rd = c("with_handlers", #> "calling"), with_restarts.Rd = "with_restarts", wref_key.Rd = c("wref_key", #> "wref_value"), zap.Rd = c("zap", "is_zap"), zap_srcref.Rd = "zap_srcref"), #> funs = list(abort.Rd = c("abort()", "warn()", "inform()", #> "signal()", "interrupt()"), are_na.Rd = c("are_na()", #> "is_na()", "is_lgl_na()", "is_int_na()", "is_dbl_na()", #> "is_chr_na()", "is_cpl_na()"), arg_match.Rd = c("arg_match()", #> "arg_match0()"), as_box.Rd = c("as_box()", "as_box_if()" #> ), as_bytes.Rd = "as_bytes()", as_data_mask.Rd = c("as_data_mask()", #> "as_data_pronoun()", "new_data_mask()"), as_env.Rd = "as_env()", #> as_environment.Rd = "as_environment()", as_function.Rd = c("as_function()", #> "is_lambda()", "as_closure()"), as_label.Rd = "as_label()", #> as_name.Rd = "as_name()", as_overscope.Rd = c("as_overscope()", #> "new_overscope()", "overscope_clean()"), as_pairlist.Rd = "as_pairlist()", #> as_quosure.Rd = c("as_quosure()", "new_quosure()" #> ), as_string.Rd = "as_string()", as_utf8_character.Rd = "as_utf8_character()", #> `bare-type-predicates.Rd` = c("is_bare_list()", "is_bare_atomic()", #> "is_bare_vector()", "is_bare_double()", "is_bare_integer()", #> "is_bare_numeric()", "is_bare_character()", "is_bare_logical()", #> "is_bare_raw()", "is_bare_string()", "is_bare_bytes()" #> ), box.Rd = c("new_box()", "is_box()", "unbox()"), #> call2.Rd = "call2()", call_args.Rd = c("call_args()", #> "call_args_names()"), call_fn.Rd = "call_fn()", call_inspect.Rd = "call_inspect()", #> call_modify.Rd = "call_modify()", call_name.Rd = c("call_name()", #> "call_ns()"), call_parse_type.Rd = "call_parse_type()", #> call_standardise.Rd = "call_standardise()", caller_env.Rd = c("caller_env()", #> "current_env()"), caller_fn.Rd = c("caller_fn()", #> "current_fn()"), caller_frame.Rd = "caller_frame()", #> catch_cnd.Rd = "catch_cnd()", chr_unserialise_unicode.Rd = "chr_unserialise_unicode()", #> cnd.Rd = c("error_cnd()", "cnd()", "warning_cnd()", #> "message_cnd()"), cnd_message.Rd = c("cnd_message()", #> "cnd_header()", "cnd_body()", "cnd_footer()"), cnd_muffle.Rd = "cnd_muffle()", #> cnd_signal.Rd = "cnd_signal()", cnd_type.Rd = "cnd_type()", #> done.Rd = c("done()", "is_done_box()"), dots_definitions.Rd = "dots_definitions()", #> dots_n.Rd = "dots_n()", dots_values.Rd = "dots_values()", #> duplicate.Rd = "duplicate()", `dyn-dots.Rd` = character(0), #> empty_env.Rd = "empty_env()", enquo0.Rd = c("enquo0()", #> "enquos0()"), entrace.Rd = c("entrace()", "cnd_entrace()" #> ), env.Rd = c("env()", "child_env()", "new_environment()" #> ), env_bind.Rd = c("env_bind()", "env_bind_lazy()", #> "env_bind_active()", "`%<~%`"), env_bind_exprs.Rd = c("env_bind_exprs()", #> "env_bind_fns()"), env_binding_are_active.Rd = c("env_binding_are_active()", #> "env_binding_are_lazy()"), env_binding_lock.Rd = c("env_binding_lock()", #> "env_binding_unlock()", "env_binding_are_locked()" #> ), env_browse.Rd = c("env_browse()", "env_is_browsed()" #> ), env_bury.Rd = "env_bury()", env_clone.Rd = "env_clone()", #> env_depth.Rd = "env_depth()", env_get.Rd = c("env_get()", #> "env_get_list()"), env_has.Rd = "env_has()", env_inherits.Rd = "env_inherits()", #> env_lock.Rd = c("env_lock()", "env_is_locked()"), #> env_name.Rd = c("env_name()", "env_label()"), env_names.Rd = c("env_names()", #> "env_length()"), env_parent.Rd = c("env_parent()", #> "env_tail()", "env_parents()"), env_poke.Rd = "env_poke()", #> env_print.Rd = "env_print()", env_unbind.Rd = "env_unbind()", #> env_unlock.Rd = "env_unlock()", eval_bare.Rd = "eval_bare()", #> eval_tidy.Rd = "eval_tidy()", exec.Rd = "exec()", #> exiting.Rd = "exiting()", expr_interp.Rd = "expr_interp()", #> expr_label.Rd = c("expr_label()", "expr_name()", #> "expr_text()"), expr_print.Rd = c("expr_print()", #> "expr_deparse()"), exprs_auto_name.Rd = c("exprs_auto_name()", #> "quos_auto_name()"), f_rhs.Rd = c("f_rhs()", "`f_rhs<-`()", #> "f_lhs()", "`f_lhs<-`()", "f_env()", "`f_env<-`()" #> ), f_text.Rd = c("f_text()", "f_name()", "f_label()" #> ), `faq-options.Rd` = character(0), flatten.Rd = c("flatten()", #> "flatten_lgl()", "flatten_int()", "flatten_dbl()", #> "flatten_cpl()", "flatten_chr()", "flatten_raw()", #> "squash()", "squash_lgl()", "squash_int()", "squash_dbl()", #> "squash_cpl()", "squash_chr()", "squash_raw()", "flatten_if()", #> "squash_if()"), fn_body.Rd = c("fn_body()", "`fn_body<-`()" #> ), fn_env.Rd = c("fn_env()", "`fn_env<-`()"), #> fn_fmls.Rd = c("fn_fmls()", "fn_fmls_names()", "fn_fmls_syms()", #> "`fn_fmls<-`()", "`fn_fmls_names<-`()"), format_error_bullets.Rd = "format_error_bullets()", #> frame_position.Rd = "frame_position()", friendly_type.Rd = "friendly_type()", #> get_env.Rd = c("get_env()", "set_env()", "env_poke_parent()" #> ), has_length.Rd = "has_length()", has_name.Rd = "has_name()", #> hash.Rd = "hash()", inherits_any.Rd = c("inherits_any()", #> "inherits_all()", "inherits_only()"), inject.Rd = "inject()", #> invoke.Rd = "invoke()", is_call.Rd = "is_call()", #> is_callable.Rd = "is_callable()", is_condition.Rd = "is_condition()", #> is_copyable.Rd = "is_copyable()", is_empty.Rd = "is_empty()", #> is_env.Rd = c("is_env()", "is_bare_env()"), is_environment.Rd = c("is_environment()", #> "is_bare_environment()"), is_expr.Rd = "is_expr()", #> is_expression.Rd = c("is_expression()", "is_syntactic_literal()", #> "is_symbolic()"), is_formula.Rd = c("is_formula()", #> "is_bare_formula()"), is_frame.Rd = "is_frame()", #> is_function.Rd = c("is_function()", "is_closure()", #> "is_primitive()", "is_primitive_eager()", "is_primitive_lazy()" #> ), is_installed.Rd = c("is_installed()", "check_installed()" #> ), is_integerish.Rd = c("is_integerish()", "is_bare_integerish()", #> "is_scalar_integerish()"), is_interactive.Rd = c("is_interactive()", #> "local_interactive()", "with_interactive()"), is_lang.Rd = c("is_lang()", #> "is_unary_lang()", "is_binary_lang()", "quo_is_lang()" #> ), is_named.Rd = c("is_named()", "is_dictionaryish()", #> "have_name()"), is_namespace.Rd = "is_namespace()", #> is_pairlist.Rd = c("is_pairlist()", "is_node()", #> "is_node_list()"), is_reference.Rd = "is_reference()", #> is_stack.Rd = c("is_stack()", "is_eval_stack()", #> "is_call_stack()"), is_symbol.Rd = "is_symbol()", #> is_true.Rd = c("is_true()", "is_false()"), is_weakref.Rd = "is_weakref()", #> lang.Rd = c("lang()", "new_language()"), lang_head.Rd = c("lang_head()", #> "lang_tail()"), lang_modify.Rd = c("lang_modify()", #> "lang_standardise()", "lang_fn()", "lang_name()", #> "lang_args()", "lang_args_names()"), last_error.Rd = c("last_error()", #> "last_trace()"), lifecycle.Rd = character(0), list2.Rd = c("list2()", #> "dots_list()"), local_bindings.Rd = c("local_bindings()", #> "with_bindings()"), local_options.Rd = c("local_options()", #> "with_options()", "push_options()", "peek_options()", #> "peek_option()"), missing.Rd = c("na_lgl", "na_int", #> "na_dbl", "na_chr", "na_cpl"), missing_arg.Rd = c("missing_arg()", #> "is_missing()", "maybe_missing()"), mut_node_car.Rd = c("mut_node_car()", #> "mut_node_cdr()", "mut_node_caar()", "mut_node_cadr()", #> "mut_node_cdar()", "mut_node_cddr()", "mut_node_tag()" #> ), names2.Rd = "names2()", `new-vector-along-retired.Rd` = c("new_logical_along()", #> "new_integer_along()", "new_double_along()", "new_character_along()", #> "new_complex_along()", "new_raw_along()", "new_list_along()" #> ), `new-vector.Rd` = c("new_logical()", "new_integer()", #> "new_double()", "new_character()", "new_complex()", #> "new_raw()", "new_list()"), new_call.Rd = "new_call()", #> new_formula.Rd = "new_formula()", new_function.Rd = "new_function()", #> new_node.Rd = c("new_node()", "node_car()", "node_cdr()", #> "node_caar()", "node_cadr()", "node_cdar()", "node_cddr()", #> "node_poke_car()", "node_poke_cdr()", "node_poke_caar()", #> "node_poke_cadr()", "node_poke_cdar()", "node_poke_cddr()", #> "node_tag()", "node_poke_tag()"), new_quosures.Rd = c("new_quosures()", #> "as_quosures()", "is_quosures()"), new_weakref.Rd = "new_weakref()", #> ns_env.Rd = c("ns_env()", "ns_imports_env()", "ns_env_name()" #> ), `nse-defuse.Rd` = c("expr()", "enexpr()", "exprs()", #> "enexprs()", "ensym()", "ensyms()", "quo()", "enquo()", #> "quos()", "enquos()"), `nse-force.Rd` = "qq_show()", #> `op-definition.Rd` = c("is_definition()", "new_definition()", #> "is_formulaish()"), `op-get-attr.Rd` = c("`%@%`", #> "`%@%<-`()"), `op-na-default.Rd` = "`%|%`", `op-null-default.Rd` = "`%||%`", #> overscope_eval_next.Rd = "overscope_eval_next()", #> pairlist2.Rd = "pairlist2()", parse_expr.Rd = c("parse_expr()", #> "parse_exprs()", "parse_quo()", "parse_quos()"), #> parse_quosure.Rd = c("parse_quosure()", "parse_quosures()" #> ), prepend.Rd = c("prepend()", "modify()"), prim_name.Rd = "prim_name()", #> quo_expr.Rd = "quo_expr()", quo_label.Rd = c("quo_label()", #> "quo_text()", "quo_name()"), quo_squash.Rd = "quo_squash()", #> quosure.Rd = c("is_quosure()", "quo_is_missing()", #> "quo_is_symbol()", "quo_is_call()", "quo_is_symbolic()", #> "quo_is_null()", "quo_get_expr()", "quo_get_env()", #> "quo_set_expr()", "quo_set_env()"), raw_deparse_str.Rd = "raw_deparse_str()", #> rep_along.Rd = c("rep_along()", "rep_named()"), restarting.Rd = "restarting()", #> return_from.Rd = c("return_from()", "return_to()" #> ), rlang_backtrace_on_error.Rd = character(0), rst_abort.Rd = "rst_abort()", #> rst_list.Rd = c("rst_list()", "rst_exists()", "rst_jump()", #> "rst_maybe_jump()"), `scalar-type-predicates.Rd` = c("is_scalar_list()", #> "is_scalar_atomic()", "is_scalar_vector()", "is_scalar_integer()", #> "is_scalar_double()", "is_scalar_character()", "is_scalar_logical()", #> "is_scalar_raw()", "is_string()", "is_scalar_bytes()", #> "is_bool()"), scoped_env.Rd = c("scoped_env()", "is_scoped()", #> "scoped_envs()", "scoped_names()"), scoped_interactive.Rd = c("scoped_interactive()", #> "scoped_options()", "scoped_bindings()"), search_envs.Rd = c("search_envs()", #> "search_env()", "pkg_env()", "pkg_env_name()", "is_attached()", #> "base_env()", "global_env()"), seq2.Rd = c("seq2()", #> "seq2_along()"), set_attrs.Rd = c("set_attrs()", #> "mut_attrs()"), set_expr.Rd = c("set_expr()", "get_expr()" #> ), set_names.Rd = "set_names()", splice.Rd = c("splice()", #> "is_spliced()", "is_spliced_bare()", "dots_splice()" #> ), stack.Rd = c("global_frame()", "current_frame()", #> "ctxt_frame()", "call_frame()", "ctxt_depth()", "call_depth()", #> "ctxt_stack()", "call_stack()"), stack_trim.Rd = "stack_trim()", #> string.Rd = "string()", switch_type.Rd = c("switch_type()", #> "coerce_type()", "switch_class()", "coerce_class()" #> ), sym.Rd = c("sym()", "syms()"), `tidyeval-data.Rd` = c(".data", #> ".env"), trace_back.Rd = c("trace_back()", "trace_length()" #> ), `type-predicates.Rd` = c("is_list()", "is_atomic()", #> "is_vector()", "is_integer()", "is_double()", "is_character()", #> "is_logical()", "is_raw()", "is_bytes()", "is_null()" #> ), type_of.Rd = "type_of()", vec_poke_n.Rd = c("vec_poke_n()", #> "vec_poke_range()"), `vector-coercion.Rd` = c("as_logical()", #> "as_integer()", "as_double()", "as_complex()", "as_character()", #> "as_list()"), `vector-construction.Rd` = c("lgl()", #> "int()", "dbl()", "cpl()", "chr()", "bytes()"), `vector-old-ctors.Rd` = c("node()", #> "lgl_len()", "int_len()", "dbl_len()", "chr_len()", #> "cpl_len()", "raw_len()", "bytes_len()", "list_len()", #> "lgl_along()", "int_along()", "dbl_along()", "chr_along()", #> "cpl_along()", "raw_along()", "bytes_along()", "list_along()" #> ), with_abort.Rd = "with_abort()", with_env.Rd = c("with_env()", #> "locally()"), with_handlers.Rd = c("with_handlers()", #> "calling()"), with_restarts.Rd = "with_restarts()", #> wref_key.Rd = c("wref_key()", "wref_value()"), zap.Rd = c("zap()", #> "is_zap()"), zap_srcref.Rd = "zap_srcref()"), title = c(abort.Rd = "Signal an error, warning, or message", #> are_na.Rd = "Test for missing values", arg_match.Rd = "Match an argument to a character vector", #> as_box.Rd = "Convert object to a box", as_bytes.Rd = "Coerce to a raw vector", #> as_data_mask.Rd = "Create a data mask", as_env.Rd = "Coerce to an environment", #> as_environment.Rd = "Coerce to an environment", as_function.Rd = "Convert to function or closure", #> as_label.Rd = "Create a default name for an R object", #> as_name.Rd = "Extract names from symbols", as_overscope.Rd = "Create an overscope", #> as_pairlist.Rd = "Coerce to pairlist", as_quosure.Rd = "Coerce object to quosure", #> as_string.Rd = "Cast symbol to string", as_utf8_character.Rd = "Coerce to a character vector and attempt encoding conversion", #> `bare-type-predicates.Rd` = "Bare type predicates", box.Rd = "Box a value", #> call2.Rd = "Create a call", call_args.Rd = "Extract arguments from a call", #> call_fn.Rd = "Extract function from a call", call_inspect.Rd = "Inspect a call", #> call_modify.Rd = "Modify the arguments of a call", call_name.Rd = "Extract function name or namespace of a call", #> call_parse_type.Rd = "What is the parser type of a call?", #> call_standardise.Rd = "Standardise a call", caller_env.Rd = "Get the current or caller environment", #> caller_fn.Rd = "Get properties of the current or caller frame", #> caller_frame.Rd = "Get caller frame", catch_cnd.Rd = "Catch a condition", #> chr_unserialise_unicode.Rd = "Translate unicode points to UTF-8", #> cnd.Rd = "Create a condition object", cnd_message.Rd = "Build an error message from parts", #> cnd_muffle.Rd = "Muffle a condition", cnd_signal.Rd = "Signal a condition object", #> cnd_type.Rd = "What type is a condition?", done.Rd = "Box a final value for early termination", #> dots_definitions.Rd = "Capture definition objects", dots_n.Rd = "How many arguments are currently forwarded in dots?", #> dots_values.Rd = "Evaluate dots with preliminary splicing", #> duplicate.Rd = "Duplicate an R object", `dyn-dots.Rd` = "Dynamic dots", #> empty_env.Rd = "Get the empty environment", enquo0.Rd = "Defuse arguments without automatic injection", #> entrace.Rd = "Add backtrace from error handler", env.Rd = "Create a new environment", #> env_bind.Rd = "Bind symbols to objects in an environment", #> env_bind_exprs.Rd = "Bind a promise or active binding", #> env_binding_are_active.Rd = "What kind of environment binding?", #> env_binding_lock.Rd = "Lock or unlock environment bindings", #> env_browse.Rd = "Browse environments", env_bury.Rd = "Mask bindings by defining symbols deeper in a scope", #> env_clone.Rd = "Clone an environment", env_depth.Rd = "Depth of an environment chain", #> env_get.Rd = "Get an object in an environment", env_has.Rd = "Does an environment have or see bindings?", #> env_inherits.Rd = "Does environment inherit from another environment?", #> env_lock.Rd = "Lock an environment", env_name.Rd = "Label of an environment", #> env_names.Rd = "Names and numbers of symbols bound in an environment", #> env_parent.Rd = "Get parent environments", env_poke.Rd = "Poke an object in an environment", #> env_print.Rd = "Pretty-print an environment", env_unbind.Rd = "Remove bindings from an environment", #> env_unlock.Rd = "Unlock an environment", eval_bare.Rd = "Evaluate an expression in an environment", #> eval_tidy.Rd = "Evaluate an expression with quosures and pronoun support", #> exec.Rd = "Execute a function", exiting.Rd = "Exiting handler", #> expr_interp.Rd = "Process unquote operators in a captured expression", #> expr_label.Rd = "Turn an expression to a label", expr_print.Rd = "Print an expression", #> exprs_auto_name.Rd = "Ensure that all elements of a list of expressions are named", #> f_rhs.Rd = "Get or set formula components", f_text.Rd = "Turn RHS of formula into a string or label", #> `faq-options.Rd` = "Global options for rlang", flatten.Rd = "Flatten or squash a list of lists into a simpler vector", #> fn_body.Rd = "Get or set function body", fn_env.Rd = "Return the closure environment of a function", #> fn_fmls.Rd = "Extract arguments from a function", format_error_bullets.Rd = "Format bullets for error messages", #> frame_position.Rd = "Find the position or distance of a frame on the evaluation stack", #> friendly_type.Rd = "Format a type for error messages", #> get_env.Rd = "Get or set the environment of an object", #> has_length.Rd = "How long is an object?", has_name.Rd = "Does an object have an element with this name?", #> hash.Rd = "Hash an object", inherits_any.Rd = "Does an object inherit from a set of classes?", #> inject.Rd = "Inject objects in an R expression", invoke.Rd = "Invoke a function with a list of arguments", #> is_call.Rd = "Is object a call?", is_callable.Rd = "Is an object callable?", #> is_condition.Rd = "Is object a condition?", is_copyable.Rd = "Is an object copyable?", #> is_empty.Rd = "Is object an empty vector or NULL?", is_env.Rd = "Is an object an environment?", #> is_environment.Rd = "Is object an environment?", is_expr.Rd = "Is an object an expression?", #> is_expression.Rd = "Is an object an expression?", is_formula.Rd = "Is object a formula?", #> is_frame.Rd = "Is object a frame?", is_function.Rd = "Is object a function?", #> is_installed.Rd = "Are packages installed in any of the libraries?", #> is_integerish.Rd = "Is a vector integer-like?", is_interactive.Rd = "Is R running interactively?", #> is_lang.Rd = "Is object a call?", is_named.Rd = "Is object named?", #> is_namespace.Rd = "Is an object a namespace environment?", #> is_pairlist.Rd = "Is object a node or pairlist?", is_reference.Rd = "Is an object referencing another?", #> is_stack.Rd = "Is object a stack?", is_symbol.Rd = "Is object a symbol?", #> is_true.Rd = "Is object identical to TRUE or FALSE?", #> is_weakref.Rd = "Is object a weak reference?", lang.Rd = "Create a call", #> lang_head.Rd = "Return the head or tail of a call", lang_modify.Rd = "Manipulate or access a call", #> last_error.Rd = "Last <code>abort()</code> error", lifecycle.Rd = "Life cycle of the rlang package", #> list2.Rd = "Collect dots in a list", local_bindings.Rd = "Temporarily change bindings of an environment", #> local_options.Rd = "Change global options", missing.Rd = "Missing values", #> missing_arg.Rd = "Generate or handle a missing argument", #> mut_node_car.Rd = "Mutate node components", names2.Rd = "Get names of a vector", #> `new-vector-along-retired.Rd` = "Create vectors matching the length of a given vector", #> `new-vector.Rd` = "Create vectors matching a given length", #> new_call.Rd = "Create a new call from components", new_formula.Rd = "Create a formula", #> new_function.Rd = "Create a function", new_node.Rd = "Helpers for pairlist and language nodes", #> new_quosures.Rd = "Create a list of quosures", new_weakref.Rd = "Create a weak reference", #> ns_env.Rd = "Get the namespace of a package", `nse-defuse.Rd` = "Defuse R expressions", #> `nse-force.Rd` = "Force parts of an expression", `op-definition.Rd` = "Definition operator", #> `op-get-attr.Rd` = "Infix attribute accessor and setter", #> `op-na-default.Rd` = "Replace missing values", `op-null-default.Rd` = "Default value for <code>NULL</code>", #> overscope_eval_next.Rd = "Evaluate next quosure in a data mask", #> pairlist2.Rd = "Create pairlists with splicing support", #> parse_expr.Rd = "Parse R code", parse_quosure.Rd = "Parse text into a quosure", #> prepend.Rd = "Prepend a vector", prim_name.Rd = "Name of a primitive function", #> quo_expr.Rd = "Squash a quosure", quo_label.Rd = "Format quosures for printing or labelling", #> quo_squash.Rd = "Squash a quosure", quosure.Rd = "Quosure getters, setters and testers", #> raw_deparse_str.Rd = "Serialize a raw vector to a string", #> rep_along.Rd = "Create vectors matching the length of a given vector", #> restarting.Rd = "Create a restarting handler", return_from.Rd = "Jump to or from a frame", #> rlang_backtrace_on_error.Rd = "Display backtrace on error", #> rst_abort.Rd = "Jump to the abort restart", rst_list.Rd = "Restarts utilities", #> `scalar-type-predicates.Rd` = "Scalar type predicates", #> scoped_env.Rd = "Retired <code>scoped</code> functions", #> scoped_interactive.Rd = "Questioning <code>scoped_</code> functions", #> search_envs.Rd = "Search path environments", seq2.Rd = "Increasing sequence of integers in an interval", #> set_attrs.Rd = "Add attributes to an object", set_expr.Rd = "Set and get an expression", #> set_names.Rd = "Set names of a vector", splice.Rd = "Splice lists", #> stack.Rd = "Call stack information", stack_trim.Rd = "Trim top call layers from the evaluation stack", #> string.Rd = "Create a string", switch_type.Rd = "Dispatch on base types", #> sym.Rd = "Create a symbol or list of symbols", `tidyeval-data.Rd` = "Data pronouns for tidy evaluation", #> trace_back.Rd = "Capture a backtrace", `type-predicates.Rd` = "Type predicates", #> type_of.Rd = "Base type of an object", vec_poke_n.Rd = "Poke values into a vector", #> `vector-coercion.Rd` = "Coerce an object to a base type", #> `vector-construction.Rd` = "Create vectors", `vector-old-ctors.Rd` = "Retired vector construction by length", #> with_abort.Rd = "Promote all errors to rlang errors", #> with_env.Rd = "Evaluate an expression within a given environment", #> with_handlers.Rd = "Establish handlers on the stack", #> with_restarts.Rd = "Establish a restart point on the stack", #> wref_key.Rd = "Get key/value from a weak reference object", #> zap.Rd = "Create zap objects", zap_srcref.Rd = "Zap source references" #> ), rd = list(abort.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-abort.R, R/cnd-signal.R", #> "\n", list("abort"), "\n", list("abort"), "\n", list( #> "warn"), "\n", list("inform"), "\n", list("signal"), #> "\n", list("interrupt"), "\n", list("Signal an error, warning, or message"), #> "\n", list("\n", "abort(\n", " message = NULL,\n", #> " class = NULL,\n", " ...,\n", " trace = NULL,\n", #> " parent = NULL,\n", " .subclass = deprecated()\n", #> ")\n", "\n", "warn(\n", " message = NULL,\n", #> " class = NULL,\n", " ...,\n", " .frequency = c(\"always\", \"regularly\", \"once\"),\n", #> " .frequency_id = NULL,\n", " .subclass = deprecated()\n", #> ")\n", "\n", "inform(\n", " message = NULL,\n", #> " class = NULL,\n", " ...,\n", " .file = NULL,\n", #> " .frequency = c(\"always\", \"regularly\", \"once\"),\n", #> " .frequency_id = NULL,\n", " .subclass = deprecated()\n", #> ")\n", "\n", "signal(message, class, ..., .subclass = deprecated())\n", #> "\n", "interrupt()\n"), "\n", list("\n", list( #> list("message"), list("The message to display. Character vectors are\n", #> "formatted with ", list(list("format_error_bullets()")), #> ". The first element\n", "defines a message header and the rest of the vector defines\n", #> "bullets. Bullets named ", list("i"), " and ", #> list("x"), " define info and error bullets\n", #> "respectively, with special Unicode and colour formatting applied\n", #> "if possible.\n", "\n", "If a message is not supplied, it is expected that the message is\n", #> "generated lazily through ", list("conditionMessage()"), #> ". In\n", "that case, ", list("class"), " must be supplied. Only ", #> list("inform()"), " allows empty\n", "messages as it is occasionally useful to build user output\n", #> "incrementally.")), "\n", "\n", list(list("class"), #> list("Subclass of the condition. This allows your users\n", #> "to selectively handle the conditions signalled by your functions.")), #> "\n", "\n", list(list("..."), list("Additional data to be stored in the condition object.")), #> "\n", "\n", list(list("trace"), list("A ", list( #> "trace"), " object created by ", list(list( #> "trace_back()")), ".")), "\n", "\n", list(list( #> "parent"), list("A parent condition object created by ", #> list(list("abort()")), ".")), "\n", "\n", list( #> list(".subclass"), list("This argument was renamed to ", #> list("class"), " in rlang\n", "0.4.2. It will be deprecated in the next major version. This is\n", #> "for consistency with our conventions for class constructors\n", #> "documented in ", list("https://adv-r.hadley.nz/s3.html#s3-subclassing"), #> ".")), "\n", "\n", list(list(".frequency"), #> list("How frequently should the warning or message be\n", #> "displayed? By default (", list("\"always\""), #> ") it is displayed at each\n", "time. If ", #> list("\"regularly\""), ", it is displayed once every 8 hours. If\n", #> list("\"once\""), ", it is displayed once per session.")), #> "\n", "\n", list(list(".frequency_id"), list( #> "A unique identifier for the warning or\n", #> "message. This is used when ", list(".frequency"), #> " is supplied to recognise\n", "recurring conditions. This argument must be supplied if\n", #> list(".frequency"), " is not set to ", list( #> "\"always\""), ".")), "\n", "\n", list(list( #> ".file"), list("Where the message is printed. This should be a\n", #> "connection or character string which will be passed to ", #> list(list("cat()")), ".\n", "\n", "By default, ", #> list("inform()"), " prints to standard output in interactive\n", #> "sessions and standard error otherwise. This way IDEs can treat\n", #> "messages distinctly from warnings and errors, and R scripts can\n", #> "still filter out the messages easily by redirecting ", #> list("stderr"), ". If\n", "a sink is active, either on output or on messages, messages are\n", #> "printed to ", list("stderr"), ". This ensures consistency of behaviour in\n", #> "interactive and non-interactive sessions.")), #> "\n"), "\n", list("\n", "These functions are equivalent to base functions ", #> list(list("base::stop()")), ",\n", list(list( #> "base::warning()")), ", and ", list(list("base::message()")), #> ", but make it easy to supply\n", "condition metadata:\n", #> list("\n", list(), " Supply ", list("class"), #> " to create a classed condition. Typed\n", #> "conditions can be captured or handled selectively, allowing for\n", #> "finer-grained error handling.\n", list(), #> " Supply metadata with named ", list("..."), #> " arguments. This data will be\n", "stored in the condition object and can be examined by handlers.\n"), #> "\n", "\n", list("interrupt()"), " allows R code to simulate a user interrupt of the\n", #> "kind that is signalled with ", list("Ctrl-C"), #> ". It is currently not possible\n", "to create custom interrupt condition objects.\n"), #> "\n", list(list("Backtrace"), list("\n", "\n", "\n", #> "Unlike ", list("stop()"), " and ", list("warning()"), #> ", these functions don't include call\n", "information by default. This saves you from typing ", #> list("call. = FALSE"), "\n", "and produces cleaner error messages.\n", #> "\n", "A backtrace is always saved into error objects. You can print a\n", #> "simplified backtrace of the last error by calling ", #> list(list("last_error()")), "\n", "and a full backtrace with ", #> list("summary(last_error())"), ".\n", "\n", "You can also display a backtrace with the error message by setting\n", #> "the option ", list(list("rlang_backtrace_on_error")), #> ". It supports the following\n", "values:\n", #> list("\n", list(), " ", list("\"reminder\""), #> ": Invite users to call ", list("rlang::last_error()"), #> " to see a\n", "backtrace.\n", list(), " ", #> list("\"branch\""), ": Display a simplified backtrace.\n", #> list(), " ", list("\"collapse\""), ": Display a collapsed backtrace tree.\n", #> list(), " ", list("\"full\""), ": Display a full backtrace tree.\n", #> list(), " ", list("\"none\""), ": Display nothing.\n"), #> "\n")), "\n", "\n", list(list("Mufflable conditions"), #> list("\n", "\n", "\n", "Signalling a condition with ", #> list("inform()"), " or ", list("warn()"), " causes a message\n", #> "to be displayed in the console. These messages can be muffled with\n", #> list(list("base::suppressMessages()")), " or ", #> list(list("base::suppressWarnings()")), ".\n", #> "\n", "On recent R versions (>= R 3.5.0), interrupts are typically\n", #> "signalled with a ", list("\"resume\""), " restart. This is however not\n", #> "guaranteed.\n")), "\n", "\n", list("\n", "# These examples are guarded to avoid throwing errors\n", #> "if (FALSE) {\n", "\n", "# Signal an error with a message just like stop():\n", #> "abort(\"Something bad happened\")\n", "\n", #> "# Give a class to the error:\n", "abort(\"Something bad happened\", \"somepkg_bad_error\")\n", #> "\n", "# This will allow your users to handle the error selectively\n", #> "tryCatch(\n", " somepkg_function(),\n", " somepkg_bad_error = function(err) {\n", #> " warn(conditionMessage(err)) # Demote the error to a warning\n", #> " NA # Return an alternative value\n", #> " }\n", ")\n", "\n", "# You can also specify metadata that will be stored in the condition:\n", #> "abort(\"Something bad happened\", \"somepkg_bad_error\", data = 1:10)\n", #> "\n", "# This data can then be consulted by user handlers:\n", #> "tryCatch(\n", " somepkg_function(),\n", " somepkg_bad_error = function(err) {\n", #> " # Compute an alternative return value with the data:\n", #> " recover_error(err$data)\n", " }\n", ")\n", #> "\n", "# If you call low-level APIs it is good practice to handle\n", #> "# technical errors and rethrow them with a more meaningful\n", #> "# message. Always prefer doing this from `withCallinghandlers()`\n", #> "# rather than `tryCatch()` because the former preserves the stack\n", #> "# on error and makes it possible for users to use `recover()`.\n", #> "file <- \"http://foo.bar/baz\"\n", "try(withCallinghandlers(\n", #> " download(file),\n", " error = function(err) {\n", #> " msg <- sprintf(\"Can't download `%s`\", file)\n", #> " abort(msg, parent = err)\n", "}))\n", "# Note how we supplied the parent error to `abort()` as `parent` to\n", #> "# get a decomposition of error messages across error contexts.\n", #> "\n", "# Unhandled errors are saved automatically by `abort()` and can be\n", #> "# retrieved with `last_error()`. The error prints with a simplified\n", #> "# backtrace:\n", "abort(\"Saved error?\")\n", #> "last_error()\n", "\n", "# Use `summary()` to print the full backtrace and the condition fields:\n", #> "summary(last_error())\n", "\n", "}\n"), "\n", #> list("\n", list(list("with_abort()")), " to convert all errors to rlang errors.\n"), #> "\n"), are_na.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-na.R", #> "\n", list("are_na"), "\n", list("are_na"), "\n", #> list("is_na"), "\n", list("is_lgl_na"), "\n", list( #> "is_int_na"), "\n", list("is_dbl_na"), "\n", #> list("is_chr_na"), "\n", list("is_cpl_na"), "\n", #> list("Test for missing values"), "\n", list("\n", #> "are_na(x)\n", "\n", "is_na(x)\n", "\n", "is_lgl_na(x)\n", #> "\n", "is_int_na(x)\n", "\n", "is_dbl_na(x)\n", #> "\n", "is_chr_na(x)\n", "\n", "is_cpl_na(x)\n"), #> "\n", list("\n", list(list("x"), list("An object to test")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", list("are_na()"), " checks for missing values in a vector and is equivalent\n", #> "to ", list(list("base::is.na()")), ". It is a vectorised predicate, meaning that its\n", #> "output is always the same length as its input. On the other hand,\n", #> list("is_na()"), " is a scalar predicate and always returns a scalar\n", #> "boolean, ", list("TRUE"), " or ", list("FALSE"), #> ". If its input is not scalar, it returns\n", #> list("FALSE"), ". Finally, there are typed versions that check for\n", #> "particular ", list("missing types"), ".\n"), #> "\n", list("\n", "The scalar predicates accept non-vector inputs. They are equivalent\n", #> "to ", list(list("is_null()")), " in that respect. In contrast the vectorised\n", #> "predicate ", list("are_na()"), " requires a vector input since it is defined\n", #> "over vector values.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "These functions might be moved to the vctrs package at some\n", #> "point. This is why they are marked as questioning.\n")), #> "\n", "\n", list("\n", "# are_na() is vectorised and works regardless of the type\n", #> "are_na(c(1, 2, NA))\n", "are_na(c(1L, NA, 3L))\n", #> "\n", "# is_na() checks for scalar input and works for all types\n", #> "is_na(NA)\n", "is_na(na_dbl)\n", "is_na(character(0))\n", #> "\n", "# There are typed versions as well:\n", #> "is_lgl_na(NA)\n", "is_lgl_na(na_dbl)\n"), "\n", #> list("internal"), "\n"), arg_match.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/arg.R", "\n", #> list("arg_match"), "\n", list("arg_match"), "\n", #> list("arg_match0"), "\n", list("Match an argument to a character vector"), #> "\n", list("\n", "arg_match(arg, values = NULL)\n", #> "\n", "arg_match0(arg, values, arg_nm = as_label(substitute(arg)))\n"), #> "\n", list("\n", list(list("arg"), list("A symbol referring to an argument accepting strings.")), #> "\n", "\n", list(list("values"), list("The possible values that ", #> list("arg"), " can take.")), "\n", "\n", list( #> list("arg_nm"), list("The label to be used for ", #> list("arg"), " in error messages.")), "\n"), #> "\n", list("\n", "The string supplied to ", list( #> "arg"), ".\n"), "\n", list("\n", "This is equivalent to ", #> list(list("base::match.arg()")), " with a few differences:\n", #> list("\n", list(), " Partial matches trigger an error.\n", #> list(), " Error messages are a bit more informative and obey the tidyverse\n", #> "standards.\n"), "\n", "\n", list("arg_match()"), #> " derives the possible values from the\n", list( #> "caller frame"), ".\n", "\n", list("arg_match0()"), #> " is a bare-bones version if performance is at a premium.\n", #> "It requires a string as ", list("arg"), " and explicit ", #> list("values"), ".\n", "For convenience, ", list( #> "arg"), " may also be a character vector containing\n", #> "every element of ", list("values"), ", possibly permuted.\n", #> "In this case, the first element of ", list("arg"), #> " is used.\n"), "\n", list("\n", "fn <- function(x = c(\"foo\", \"bar\")) arg_match(x)\n", #> "fn(\"bar\")\n", "\n", "# Throws an informative error for mismatches:\n", #> "try(fn(\"b\"))\n", "try(fn(\"baz\"))\n", "\n", #> "# Use the bare-bones version with explicit values for speed:\n", #> "arg_match0(\"bar\", c(\"foo\", \"bar\", \"baz\"))\n", #> "\n", "# For convenience:\n", "fn1 <- function(x = c(\"bar\", \"baz\", \"foo\")) fn3(x)\n", #> "fn2 <- function(x = c(\"baz\", \"bar\", \"foo\")) fn3(x)\n", #> "fn3 <- function(x) arg_match0(x, c(\"foo\", \"bar\", \"baz\"))\n", #> "fn1()\n", "fn2(\"bar\")\n", "try(fn3(\"zoo\"))\n"), #> "\n"), as_box.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/s3.R", "\n", #> list("as_box"), "\n", list("as_box"), "\n", list( #> "as_box_if"), "\n", list("Convert object to a box"), #> "\n", list("\n", "as_box(x, class = NULL)\n", "\n", #> "as_box_if(.x, .p, .class = NULL, ...)\n"), "\n", #> list("\n", list(list("x"), list("An R object.")), #> "\n", "\n", list(list("class, .class"), list( #> "A box class. If the input is already a box of\n", #> "that class, it is returned as is. If the input needs to be boxed,\n", #> list("class"), " is passed to ", list(list( #> "new_box()")), ".")), "\n", "\n", list(list( #> ".x"), list("An R object.")), "\n", "\n", list( #> list(".p"), list("A predicate function.")), #> "\n", "\n", list(list("..."), list("Arguments passed to ", #> list(".p"), ".")), "\n"), "\n", list("\n", #> list("\n", list(), " ", list("as_box()"), " boxes its input only if it is not already a box. The\n", #> "class is also checked if supplied.\n", list(), #> " ", list("as_box_if()"), " boxes its input only if it not already a box, or if\n", #> "the predicate ", list(".p"), " returns ", #> list("TRUE"), ".\n"), "\n"), "\n"), as_bytes.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/utils-encoding.R", #> "\n", list("as_bytes"), "\n", list("as_bytes"), "\n", #> list("Coerce to a raw vector"), "\n", list("\n", #> "as_bytes(x)\n"), "\n", list("\n", list(list( #> "x"), list("A string.")), "\n"), "\n", list("\n", #> "A raw vector of bytes.\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "This currently only works with strings, and returns its hexadecimal\n", #> "representation.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "Raw vector functions are experimental.\n")), #> "\n", "\n", list("internal"), "\n"), as_data_mask.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/eval-tidy.R", "\n", #> list("as_data_mask"), "\n", list("as_data_mask"), #> "\n", list("as_data_pronoun"), "\n", list("new_data_mask"), #> "\n", list("Create a data mask"), "\n", list("\n", #> "as_data_mask(data)\n", "\n", "as_data_pronoun(data)\n", #> "\n", "new_data_mask(bottom, top = bottom)\n"), #> "\n", list("\n", list(list("data"), list("A data frame or named vector of masking data.")), #> "\n", "\n", list(list("bottom"), list("The environment containing masking objects if the\n", #> "data mask is one environment deep. The bottom environment if the\n", #> "data mask comprises multiple environment.\n", #> "\n", "If you haven't supplied ", list("top"), #> ", this ", list("must"), " be an environment\n", #> "that you own, i.e. that you have created yourself.")), #> "\n", "\n", list(list("top"), list("The last environment of the data mask. If the data mask\n", #> "is only one environment deep, ", list("top"), #> " should be the same as\n", list("bottom"), #> ".\n", "\n", "This ", list("must"), " be an environment that you own, i.e. that you have\n", #> "created yourself. The parent of ", list("top"), #> " will be changed by the tidy\n", "eval engine and should be considered undetermined. Never make\n", #> "assumption about the parent of ", list("top"), #> ".")), "\n"), "\n", list("\n", "A data mask that you can supply to ", #> list(list("eval_tidy()")), ".\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", "A data mask is an environment (or possibly multiple environments\n", #> "forming an ancestry) containing user-supplied objects. Objects in\n", #> "the mask have precedence over objects in the environment (i.e. they\n", #> "mask those objects). Many R functions evaluate quoted expressions\n", #> "in a data mask so these expressions can refer to objects within the\n", #> "user data.\n", "\n", "These functions let you construct a tidy eval data mask manually.\n", #> "They are meant for developers of tidy eval interfaces rather than\n", #> "for end users.\n"), "\n", list(list("Why build a data mask?"), #> list("\n", "\n", "\n", "Most of the time you can just call ", #> list(list("eval_tidy()")), " with a list or a\n", #> "data frame and the data mask will be constructed automatically.\n", #> "There are three main use cases for manual creation of data masks:\n", #> list("\n", list(), " When ", list(list("eval_tidy()")), #> " is called with the same data in a tight loop.\n", #> "Because there is some overhead to creating tidy eval data masks,\n", #> "constructing the mask once and reusing it for subsequent\n", #> "evaluations may improve performance.\n", #> list(), " When several expressions should be evaluated in the exact same\n", #> "environment because a quoted expression might create new objects\n", #> "that can be referred in other quoted expressions evaluated at a\n", #> "later time. One example of this is ", list( #> "tibble::lst()"), " where new\n", "columns can refer to previous ones.\n", #> list(), " When your data mask requires special features. For instance the\n", #> "data frame columns in dplyr data masks are implemented with\n", #> list("active bindings"), ".\n"), "\n")), #> "\n", "\n", list(list("Building your own data mask"), #> list("\n", "\n", "\n", "Unlike ", list(list("base::eval()")), #> " which takes any kind of environments as data\n", #> "mask, ", list(list("eval_tidy()")), " has specific requirements in order to support\n", #> list("quosures"), ". For this reason you can't supply bare\n", #> "environments.\n", "\n", "There are two ways of constructing an rlang data mask manually:\n", #> list("\n", list(), " ", list("as_data_mask()"), #> " transforms a list or data frame to a data mask.\n", #> "It automatically installs the data pronoun ", #> list(list(".data")), ".\n", list(), " ", #> list("new_data_mask()"), " is a bare bones data mask constructor for\n", #> "environments. You can supply a bottom and a top environment in\n", #> "case your data mask comprises multiple environments (see section\n", #> "below).\n", "\n", "Unlike ", list("as_data_mask()"), #> " it does not install the ", list(".data"), #> " pronoun\n", "so you need to provide one yourself. You can provide a pronoun\n", #> "constructed with ", list("as_data_pronoun()"), #> " or your own pronoun class.\n", "\n", list( #> "as_data_pronoun()"), " will create a pronoun from a list, an\n", #> "environment, or an rlang data mask. In the latter case, the whole\n", #> "ancestry is looked up from the bottom to the top of the mask.\n", #> "Functions stored in the mask are bypassed by the pronoun.\n"), #> "\n", "\n", "Once you have built a data mask, simply pass it to ", #> list(list("eval_tidy()")), " as\n", "the ", #> list("data"), " argument. You can repeat this as many times as\n", #> "needed. Note that any objects created there (perhaps because of a\n", #> "call to ", list("<-"), ") will persist in subsequent evaluations.\n")), #> "\n", "\n", list(list("Top and bottom of data mask"), #> list("\n", "\n", "\n", "In some cases you'll need several levels in your data mask. One\n", #> "good reason is when you include functions in the mask. It's a good\n", #> "idea to keep data objects one level lower than function objects, so\n", #> "that the former cannot override the definitions of the latter (see\n", #> "examples).\n", "\n", "In that case, set up all your environments and keep track of the\n", #> "bottom child and the top parent. You'll need to pass both to\n", #> list("new_data_mask()"), ".\n", "\n", "Note that the parent of the top environment is completely\n", #> "undetermined, you shouldn't expect it to remain the same at all\n", #> "times. This parent is replaced during evaluation by ", #> list(list("eval_tidy()")), "\n", "to one of the following environments:\n", #> list("\n", list(), " The default environment passed as the ", #> list("env"), " argument of ", list("eval_tidy()"), #> ".\n", list(), " The environment of the current quosure being evaluated, if applicable.\n"), #> "\n", "\n", "Consequently, all masking data should be contained between the\n", #> "bottom and top environment of the data mask.\n")), #> "\n", "\n", list("\n", "# Evaluating in a tidy evaluation environment enables all tidy\n", #> "# features:\n", "mask <- as_data_mask(mtcars)\n", #> "eval_tidy(quo(letters), mask)\n", "\n", "# You can install new pronouns in the mask:\n", #> "mask$.pronoun <- as_data_pronoun(list(foo = \"bar\", baz = \"bam\"))\n", #> "eval_tidy(quo(.pronoun$foo), mask)\n", "\n", #> "# In some cases the data mask can leak to the user, for example if\n", #> "# a function or formula is created in the data mask environment:\n", #> "cyl <- \"user variable from the context\"\n", #> "fn <- eval_tidy(quote(function() cyl), mask)\n", #> "fn()\n", "\n", "# If new objects are created in the mask, they persist in the\n", #> "# subsequent calls:\n", "eval_tidy(quote(new <- cyl + am), mask)\n", #> "eval_tidy(quote(new * 2), mask)\n", "\n", "\n", #> "# In some cases your data mask is a whole chain of environments\n", #> "# rather than a single environment. You'll have to use\n", #> "# `new_data_mask()` and let it know about the bottom of the mask\n", #> "# (the last child of the environment chain) and the topmost parent.\n", #> "\n", "# A common situation where you'll want a multiple-environment mask\n", #> "# is when you include functions in your mask. In that case you'll\n", #> "# put functions in the top environment and data in the bottom. This\n", #> "# will prevent the data from overwriting the functions.\n", #> "top <- new_environment(list(`+` = base::paste, c = base::paste))\n", #> "\n", "# Let's add a middle environment just for sport:\n", #> "middle <- env(top)\n", "\n", "# And finally the bottom environment containing data:\n", #> "bottom <- env(middle, a = \"a\", b = \"b\", c = \"c\")\n", #> "\n", "# We can now create a mask by supplying the top and bottom\n", #> "# environments:\n", "mask <- new_data_mask(bottom, top = top)\n", #> "\n", "# This data mask can be passed to eval_tidy() instead of a list or\n", #> "# data frame:\n", "eval_tidy(quote(a + b + c), data = mask)\n", #> "\n", "# Note how the function `c()` and the object `c` are looked up\n", #> "# properly because of the multi-level structure:\n", #> "eval_tidy(quote(c(a, b, c)), data = mask)\n", #> "\n", "# new_data_mask() does not create data pronouns, but\n", #> "# data pronouns can be added manually:\n", "mask$.fns <- as_data_pronoun(top)\n", #> "\n", "# The `.data` pronoun should generally be created from the\n", #> "# mask. This will ensure data is looked up throughout the whole\n", #> "# ancestry. Only non-function objects are looked up from this\n", #> "# pronoun:\n", "mask$.data <- as_data_pronoun(mask)\n", #> "mask$.data$c\n", "\n", "# Now we can reference the values with the pronouns:\n", #> "eval_tidy(quote(c(.data$a, .data$b, .data$c)), data = mask)\n"), #> "\n"), as_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("as_env"), "\n", list("as_env"), "\n", #> list("Coerce to an environment"), "\n", list("\n", #> "as_env(x, parent = NULL)\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"deprecated\")"), "\n", #> "\n", "This function is deprecated as it was renamed to ", #> list(list("as_environment()")), "\n", "in rlang 0.2.0.\n"), #> "\n", list("internal"), "\n"), as_environment.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/env.R", "\n", list( #> "as_environment"), "\n", list("as_environment"), #> "\n", list("Coerce to an environment"), "\n", list( #> "\n", "as_environment(x, parent = NULL)\n"), #> "\n", list("\n", list(list("x"), list("An object to coerce.")), #> "\n", "\n", list(list("parent"), list("A parent environment, ", #> list(list("empty_env()")), " by default. This\n", #> "argument is only used when ", list("x"), " is data actually coerced to an\n", #> "environment (as opposed to data representing an environment, like\n", #> list("NULL"), " representing the empty environment).")), #> "\n"), "\n", list("\n", list("as_environment()"), #> " coerces named vectors (including lists) to an\n", #> "environment. The names must be unique. If supplied an unnamed\n", #> "string, it returns the corresponding package environment (see\n", #> list(list("pkg_env()")), ").\n"), "\n", list( #> "\n", "If ", list("x"), " is an environment and ", #> list("parent"), " is not ", list("NULL"), ", the\n", #> "environment is duplicated before being set a new parent. The return\n", #> "value is therefore a different environment than ", #> list("x"), ".\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", list("as_env()"), " was soft-deprecated and renamed to ", #> list("as_environment()"), " in\n", "rlang 0.2.0. This is for consistency as type predicates should not\n", #> "be abbreviated.\n")), "\n", "\n", list("\n", #> "# Coerce a named vector to an environment:\n", #> "env <- as_environment(mtcars)\n", "\n", "# By default it gets the empty environment as parent:\n", #> "identical(env_parent(env), empty_env())\n", #> "\n", "\n", "# With strings it is a handy shortcut for pkg_env():\n", #> "as_environment(\"base\")\n", "as_environment(\"rlang\")\n", #> "\n", "# With NULL it returns the empty environment:\n", #> "as_environment(NULL)\n"), "\n"), as_function.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/fn.R", "\n", list( #> "as_function"), "\n", list("as_function"), "\n", #> list("is_lambda"), "\n", list("as_closure"), "\n", #> list("Convert to function or closure"), "\n", list( #> "\n", "as_function(x, env = caller_env())\n", #> "\n", "is_lambda(x)\n", "\n", "as_closure(x, env = caller_env())\n"), #> "\n", list("\n", list(list("x"), list("A function or formula.\n", #> "\n", "If a ", list("function"), ", it is used as is.\n", #> "\n", "If a ", list("formula"), ", e.g. ", list( #> "~ .x + 2"), ", it is converted to a function\n", #> "with up to two arguments: ", list(".x"), " (single argument) or ", #> list(".x"), " and ", list(".y"), "\n", "(two arguments). The ", #> list("."), " placeholder can be used instead of ", #> list(".x"), ".\n", "This allows you to create very compact anonymous functions (lambdas) with up\n", #> "to two inputs. Functions created from formulas have a special\n", #> "class. Use ", list("is_lambda()"), " to test for it.\n", #> "\n", "Lambdas currently do not support ", list( #> "nse-force"), ",\n", "due to the way the arguments are handled internally.")), #> "\n", "\n", list(list("env"), list("Environment in which to fetch the function in case ", #> list("x"), "\n", "is a string.")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", list("\n", list(), " ", list("as_function()"), #> " transforms a one-sided formula into a function.\n", #> "This powers the lambda syntax in packages like purrr.\n", #> list(), " ", list("as_closure()"), " first passes its argument to ", #> list("as_function()"), ". If\n", "the result is a primitive function, it regularises it to a proper\n", #> list("closure"), " (see ", list(list("is_function()")), #> " about primitive functions). Some\n", "special control flow primitives like ", #> list("if"), ", ", list("for"), ", or ", list( #> "break"), "\n", "can't be coerced to a closure.\n"), #> "\n"), "\n", list("\n", "f <- as_function(~ .x + 1)\n", #> "f(10)\n", "\n", "g <- as_function(~ -1 * .)\n", #> "g(4)\n", "\n", "h <- as_function(~ .x - .y)\n", #> "h(6, 3)\n", "\n", "# Functions created from a formula have a special class:\n", #> "is_lambda(f)\n", "is_lambda(as_function(function() \"foo\"))\n", #> "\n", "# Primitive functions are regularised as closures\n", #> "as_closure(list)\n", "as_closure(\"list\")\n", #> "\n", "# Operators have `.x` and `.y` as arguments, just like lambda\n", #> "# functions created with the formula syntax:\n", #> "as_closure(`+`)\n", "as_closure(`~`)\n", "\n", #> "# Use a regular function for tidy evaluation, also when calling functions\n", #> "# that use tidy evaluation:\n", "## Bad:\n", #> "e <- as_function(~ as_label(ensym(.x)))\n", #> "## Good:\n", "e <- as_function(function(x) as_label(ensym(x)))\n", #> "\n", "e(y)\n"), "\n"), as_label.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/deparse.R", #> "\n", list("as_label"), "\n", list("as_label"), "\n", #> list("Create a default name for an R object"), "\n", #> list("\n", "as_label(x)\n"), "\n", list("\n", list( #> list("x"), list("An object.")), "\n"), "\n", #> list("\n", list("as_label()"), " transforms R objects into a short, human-readable\n", #> "description. You can use labels to:\n", list( #> "\n", list(), " Display an object in a concise way, for example to labellise axes\n", #> "in a graphical plot.\n", list(), " Give default names to columns in a data frame. In this case,\n", #> "labelling is the first step before name repair.\n"), #> "\n", "\n", "See also ", list(list("as_name()")), #> " for transforming symbols back to a\n", "string. Unlike ", #> list("as_label()"), ", ", list("as_string()"), #> " is a well defined\n", "operation that guarantees the roundtrip symbol -> string ->\n", #> "symbol.\n", "\n", "In general, if you don't know for sure what kind of object you're\n", #> "dealing with (a call, a symbol, an unquoted constant), use\n", #> list("as_label()"), " and make no assumption about the resulting string. If\n", #> "you know you have a symbol and need the name of the object it\n", #> "refers to, use ", list(list("as_string()")), #> ". For instance, use ", list("as_label()"), " with\n", #> "objects captured with ", list("enquo()"), " and ", #> list("as_string()"), " with symbols\n", "captured with ", #> list("ensym()"), ".\n"), "\n", list(list("Transformation to string"), #> list("\n", "\n", list("\n", list(), " Quosures are ", #> list("squashed"), " before being labelled.\n", #> list(), " Symbols are transformed to string with ", #> list("as_string()"), ".\n", list(), " Calls are abbreviated.\n", #> list(), " Numbers are represented as such.\n", #> list(), " Other constants are represented by their type, such as ", #> list("<dbl>"), "\n", "or ", list("<data.frame>"), #> ".\n"), "\n", "\n", "Note that simple symbols should generally be transformed to strings\n", #> "with ", list(list("as_name()")), ". Labelling is not a well defined operation and\n", #> "no assumption should be made about how the label is created. On the\n", #> "other hand, ", list("as_name()"), " only works with symbols and is a well\n", #> "defined, deterministic operation.\n")), "\n", #> "\n", list("\n", "# as_label() is useful with quoted expressions:\n", #> "as_label(expr(foo(bar)))\n", "as_label(expr(foobar))\n", #> "\n", "# It works with any R object. This is also useful for quoted\n", #> "# arguments because the user might unquote constant objects:\n", #> "as_label(1:3)\n", "as_label(base::list)\n"), #> "\n", list("\n", list(list("as_name()")), " for transforming symbols back to a string\n", #> "deterministically.\n"), "\n"), as_name.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/deparse.R", "\n", #> list("as_name"), "\n", list("as_name"), "\n", list( #> "Extract names from symbols"), "\n", list("\n", #> "as_name(x)\n"), "\n", list("\n", list(list("x"), #> list("A string or symbol, possibly wrapped in a ", #> list("quosure"), ".\n", "If a string, the attributes are removed, if any.")), #> "\n"), "\n", list("\n", "A character vector of length 1.\n"), #> "\n", list("\n", list("as_name()"), " converts ", #> list("symbols"), " to character strings. The\n", #> "conversion is deterministic. That is, the roundtrip symbol -> name\n", #> "-> symbol always gets the same result.\n", list( #> "\n", list(), " Use ", list("as_name()"), " when you need to transform a symbol to a string\n", #> "to ", list("refer"), " to an object by its name.\n", #> list(), " Use ", list(list("as_label()")), #> " when you need to transform any kind of object to\n", #> "a string to ", list("represent"), " that object with a short description.\n"), #> "\n", "\n", "Expect ", list("as_name()"), " to gain\n", #> list(list("https://principles.tidyverse.org/names-attribute.html#minimal-unique-universal"), #> list("name-repairing")), "\n", "features in the future.\n", #> "\n", "Note that ", list("rlang::as_name()"), #> " is the ", list("opposite"), " of\n", list(list( #> "base::as.name()")), ". If you're writing base R code, we recommend\n", #> "using ", list(list("base::as.symbol()")), " which is an alias of ", #> list("as.name()"), " that\n", "follows a more modern terminology (R types instead of S modes).\n"), #> "\n", list("\n", "# Let's create some symbols:\n", #> "foo <- quote(foo)\n", "bar <- sym(\"bar\")\n", #> "\n", "# as_name() converts symbols to strings:\n", #> "foo\n", "as_name(foo)\n", "\n", "typeof(bar)\n", #> "typeof(as_name(bar))\n", "\n", "# as_name() unwraps quosured symbols automatically:\n", #> "as_name(quo(foo))\n"), "\n", list("\n", list( #> list("as_label()")), " for converting any object to a single string\n", #> "suitable as a label. ", list(list("as_string()")), #> " for a lower-level version that\n", "doesn't unwrap quosures.\n"), #> "\n"), as_overscope.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("as_overscope"), "\n", list("as_overscope"), #> "\n", list("new_overscope"), "\n", list("overscope_clean"), #> "\n", list("Create an overscope"), "\n", list("\n", #> "as_overscope(quo, data = NULL)\n", "\n", "new_overscope(bottom, top = NULL, enclosure = NULL)\n", #> "\n", "overscope_clean(overscope)\n"), "\n", #> list("\n", list(list("quo"), list("A ", list("quosure"), #> ".")), "\n", "\n", list(list("data"), list("A data frame or named vector of masking data.")), #> "\n", "\n", list(list("bottom"), list("The environment containing masking objects if the\n", #> "data mask is one environment deep. The bottom environment if the\n", #> "data mask comprises multiple environment.\n", #> "\n", "If you haven't supplied ", list("top"), #> ", this ", list("must"), " be an environment\n", #> "that you own, i.e. that you have created yourself.")), #> "\n", "\n", list(list("top"), list("The last environment of the data mask. If the data mask\n", #> "is only one environment deep, ", list("top"), #> " should be the same as\n", list("bottom"), #> ".\n", "\n", "This ", list("must"), " be an environment that you own, i.e. that you have\n", #> "created yourself. The parent of ", list("top"), #> " will be changed by the tidy\n", "eval engine and should be considered undetermined. Never make\n", #> "assumption about the parent of ", list("top"), #> ".")), "\n", "\n", list(list("enclosure"), #> list("The ", list("parent"), " argument of ", #> list(list("new_data_mask()")), ".")), "\n", #> "\n", list(list("overscope"), list("A data mask.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions have been deprecated in rlang 0.2.0. Please use\n", #> list(list("as_data_mask()")), " and ", list(list( #> "new_data_mask()")), " instead. We no longer\n", #> "require the mask to be cleaned up so ", list( #> "overscope_clean()"), " does not\n", "have a replacement.\n"), #> "\n", list("internal"), "\n"), as_pairlist.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/node.R", "\n", #> list("as_pairlist"), "\n", list("as_pairlist"), "\n", #> list("Coerce to pairlist"), "\n", list("\n", "as_pairlist(x)\n"), #> "\n", list("\n", list(list("x"), list("An object to coerce.")), #> "\n"), "\n", list("\n", "This transforms vector objects to a linked pairlist of nodes. See\n", #> "the ", list("pairlist"), " type help page.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", "\n", #> list("as_pairlist()"), " is experimental because we are still figuring out\n", #> "the naming scheme for pairlists and node-like objects.\n")), #> "\n", "\n", list("internal"), "\n"), as_quosure.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/quo.R", "\n", list( #> "as_quosure"), "\n", list("as_quosure"), "\n", #> list("new_quosure"), "\n", list("Coerce object to quosure"), #> "\n", list("\n", "as_quosure(x, env = NULL)\n", "\n", #> "new_quosure(expr, env = caller_env())\n"), "\n", #> list("\n", list(list("x"), list("An object to convert. Either an ", #> list("expression"), " or a\n", "formula.")), #> "\n", "\n", list(list("env"), list("The environment in which the expression should be\n", #> "evaluated. Only used for symbols and calls. This should typically\n", #> "be the environment in which the expression was created.")), #> "\n", "\n", list(list("expr"), list("The expression wrapped by the quosure.")), #> "\n"), "\n", list("\n", "While ", list("new_quosure()"), #> " wraps any R object (including expressions,\n", #> "formulas, or other quosures) into a quosure, ", #> list("as_quosure()"), "\n", "converts formulas and quosures and does not double-wrap.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", list( #> "\n", list(), " ", list("as_quosure()"), " now requires an explicit default environment for\n", #> "creating quosures from symbols and calls.\n", #> list(), " ", list("as_quosureish()"), " is deprecated as of rlang 0.2.0. This function\n", #> "assumes that quosures are formulas which is currently true but\n", #> "might not be in the future.\n"), "\n")), "\n", #> "\n", list("\n", "# as_quosure() converts expressions or any R object to a validly\n", #> "# scoped quosure:\n", "env <- env(var = \"thing\")\n", #> "as_quosure(quote(var), env)\n", "\n", "\n", #> "# The environment is ignored for formulas:\n", #> "as_quosure(~foo, env)\n", "as_quosure(~foo)\n", #> "\n", "# However you must supply it for symbols and calls:\n", #> "try(as_quosure(quote(var)))\n"), "\n", list( #> "\n", list(list("quo()")), ", ", list(list("is_quosure()")), #> "\n"), "\n"), as_string.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/sym.R", "\n", #> list("as_string"), "\n", list("as_string"), "\n", #> list("Cast symbol to string"), "\n", list("\n", "as_string(x)\n"), #> "\n", list("\n", list(list("x"), list("A string or symbol. If a string, the attributes are\n", #> "removed, if any.")), "\n"), "\n", list("\n", #> "A character vector of length 1.\n"), "\n", list( #> "\n", list("as_string()"), " converts ", list( #> "symbols"), " to character strings.\n"), "\n", #> list(list("Unicode tags"), list("\n", "\n", "\n", #> "Unlike ", list(list("base::as.symbol()")), " and ", #> list(list("base::as.name()")), ", ", list("as_string()"), #> "\n", "automatically transforms unicode tags such as ", #> list("\"<U+5E78>\""), " to the\n", "proper UTF-8 character. This is important on Windows because:\n", #> list("\n", list(), " R on Windows has no UTF-8 support, and uses native encoding instead.\n", #> list(), " The native encodings do not cover all Unicode characters. For\n", #> "example, Western encodings do not support CKJ characters.\n", #> list(), " When a lossy UTF-8 -> native transformation occurs, uncovered\n", #> "characters are transformed to an ASCII unicode tag like ", #> list("\"<U+5E78>\""), ".\n", list(), " Symbols are always encoded in native. This means that\n", #> "transforming the column names of a data frame to symbols might be\n", #> "a lossy operation.\n", list(), " This operation is very common in the tidyverse because of data\n", #> "masking APIs like dplyr where data frames are transformed to\n", #> "environments. While the names of a data frame are stored as a\n", #> "character vector, the bindings of environments are stored as\n", #> "symbols.\n"), "\n", "\n", "Because it reencodes the ASCII unicode tags to their UTF-8\n", #> "representation, the string -> symbol -> string roundtrip is\n", #> "more stable with ", list("as_string()"), ".\n")), #> "\n", "\n", list("\n", "# Let's create some symbols:\n", #> "foo <- quote(foo)\n", "bar <- sym(\"bar\")\n", #> "\n", "# as_string() converts symbols to strings:\n", #> "foo\n", "as_string(foo)\n", "\n", "typeof(bar)\n", #> "typeof(as_string(bar))\n"), "\n", list("\n", #> list(list("as_name()")), " for a higher-level variant of ", #> list("as_string()"), "\n", "that automatically unwraps quosures.\n"), #> "\n"), as_utf8_character.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/utils-encoding.R", #> "\n", list("as_utf8_character"), "\n", list("as_utf8_character"), #> "\n", list("Coerce to a character vector and attempt encoding conversion"), #> "\n", list("\n", "as_utf8_character(x)\n"), "\n", #> list("\n", list(list("x"), list("An object to coerce.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "Unlike specifying the ", list("encoding"), #> " argument in ", list("as_string()"), " and\n", #> list("as_character()"), ", which is only declarative, these functions\n", #> "actually attempt to convert the encoding of their input. There are\n", #> "two possible cases:\n", list("\n", list(), " The string is tagged as UTF-8 or latin1, the only two encodings\n", #> "for which R has specific support. In this case, converting to the\n", #> "same encoding is a no-op, and converting to native always works\n", #> "as expected, as long as the native encoding, the one specified by\n", #> "the ", list("LC_CTYPE"), " locale has support for all characters occurring in\n", #> "the strings. Unrepresentable characters are serialised as unicode\n", #> "points: \"<U+xxxx>\".\n", list(), " The string is not tagged. R assumes that it is encoded in the\n", #> "native encoding. Conversion to native is a no-op, and conversion\n", #> "to UTF-8 should work as long as the string is actually encoded in\n", #> "the locale codeset.\n"), "\n", "\n", "When translating to UTF-8, the strings are parsed for serialised\n", #> "unicode points (e.g. strings looking like \"U+xxxx\") with\n", #> list(list("chr_unserialise_unicode()")), ". This helps to alleviate the effects of\n", #> "character-to-symbol-to-character roundtrips on systems with\n", #> "non-UTF-8 native encoding.\n"), "\n", list("\n", #> "# Let's create a string marked as UTF-8 (which is guaranteed by the\n", #> "# Unicode escaping in the string):\n", "utf8 <- \"caf\\uE9\"\n", #> "Encoding(utf8)\n", "as_bytes(utf8)\n"), "\n", #> list("internal"), "\n"), `bare-type-predicates.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/types.R", "\n", #> list("bare-type-predicates"), "\n", list("bare-type-predicates"), #> "\n", list("is_bare_list"), "\n", list("is_bare_atomic"), #> "\n", list("is_bare_vector"), "\n", list("is_bare_double"), #> "\n", list("is_bare_integer"), "\n", list("is_bare_numeric"), #> "\n", list("is_bare_character"), "\n", list("is_bare_logical"), #> "\n", list("is_bare_raw"), "\n", list("is_bare_string"), #> "\n", list("is_bare_bytes"), "\n", list("Bare type predicates"), #> "\n", list("\n", "is_bare_list(x, n = NULL)\n", "\n", #> "is_bare_atomic(x, n = NULL)\n", "\n", "is_bare_vector(x, n = NULL)\n", #> "\n", "is_bare_double(x, n = NULL)\n", "\n", #> "is_bare_integer(x, n = NULL)\n", "\n", "is_bare_numeric(x, n = NULL)\n", #> "\n", "is_bare_character(x, n = NULL)\n", "\n", #> "is_bare_logical(x, n = NULL)\n", "\n", "is_bare_raw(x, n = NULL)\n", #> "\n", "is_bare_string(x, n = NULL)\n", "\n", #> "is_bare_bytes(x, n = NULL)\n"), "\n", list("\n", #> list(list("x"), list("Object to be tested.")), #> "\n", "\n", list(list("n"), list("Expected length of a vector.")), #> "\n"), "\n", list("\n", "These predicates check for a given type but only return ", #> list("TRUE"), " for\n", "bare R objects. Bare objects have no class attributes. For example,\n", #> "a data frame is a list, but not a bare list.\n"), #> "\n", list("\n", list("\n", list(), " The predicates for vectors include the ", #> list("n"), " argument for\n", "pattern-matching on the vector length.\n", #> list(), " Like ", list(list("is_atomic()")), #> " and unlike base R ", list("is.atomic()"), ",\n", #> list("is_bare_atomic()"), " does not return ", #> list("TRUE"), " for ", list("NULL"), ".\n", list(), #> " Unlike base R ", list("is.numeric()"), ", ", #> list("is_bare_double()"), " only returns\n", #> list("TRUE"), " for floating point numbers.\n"), #> "\n"), "\n", list("\n", list("type-predicates"), #> ", ", list("scalar-type-predicates"), "\n"), #> "\n"), box.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/s3.R", "\n", #> list("box"), "\n", list("box"), "\n", list("new_box"), #> "\n", list("is_box"), "\n", list("unbox"), "\n", #> list("Box a value"), "\n", list("\n", "new_box(.x, class = NULL, ...)\n", #> "\n", "is_box(x, class = NULL)\n", "\n", "unbox(box)\n"), #> "\n", list("\n", list(list("class"), list("For ", #> list("new_box()"), ", an additional class for the\n", #> "boxed value (in addition to ", list("rlang_box"), #> "). For ", list("is_box()"), ", a class\n", "or vector of classes passed to ", #> list(list("inherits_all()")), ".")), "\n", "\n", #> list(list("..."), list("Additional attributes passed to ", #> list(list("base::structure()")), ".")), "\n", #> "\n", list(list("x, .x"), list("An R object.")), #> "\n", "\n", list(list("box"), list("A boxed value to unbox.")), #> "\n"), "\n", list("\n", list("new_box()"), " is similar to ", #> list(list("base::I()")), " but it protects a value by\n", #> "wrapping it in a scalar list rather than by adding an attribute.\n", #> list("unbox()"), " retrieves the boxed value. ", #> list("is_box()"), " tests whether an\n", "object is boxed with optional class. ", #> list("as_box()"), " ensures that a\n", "value is wrapped in a box. ", #> list("as_box_if()"), " does the same but only if\n", #> "the value matches a predicate.\n"), "\n", list( #> "\n", "boxed <- new_box(letters, \"mybox\")\n", #> "is_box(boxed)\n", "is_box(boxed, \"mybox\")\n", #> "is_box(boxed, \"otherbox\")\n", "\n", "unbox(boxed)\n", #> "\n", "# as_box() avoids double-boxing:\n", "boxed2 <- as_box(boxed, \"mybox\")\n", #> "boxed2\n", "unbox(boxed2)\n", "\n", "# Compare to:\n", #> "boxed_boxed <- new_box(boxed, \"mybox\")\n", #> "boxed_boxed\n", "unbox(unbox(boxed_boxed))\n", #> "\n", "# Use `as_box_if()` with a predicate if you need to ensure a box\n", #> "# only for a subset of values:\n", "as_box_if(NULL, is_null, \"null_box\")\n", #> "as_box_if(\"foo\", is_null, \"null_box\")\n"), #> "\n"), call2.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call2"), "\n", list("call2"), "\n", list( #> "Create a call"), "\n", list("\n", "call2(.fn, ..., .ns = NULL)\n"), #> "\n", list("\n", list(list(".fn"), list("Function to call. Must be a callable object: a string,\n", #> "symbol, call, or a function.")), "\n", "\n", #> list(list("..."), list("<", list("dynamic"), #> "> Arguments for the function\n", "call. Empty arguments are preserved.")), #> "\n", "\n", list(list(".ns"), list("Namespace with which to prefix ", #> list(".fn"), ". Must be a string\n", "or symbol.")), #> "\n"), "\n", list("\n", "Quoted function calls are one of the two types of\n", #> list("symbolic"), " objects in R. They represent the action of\n", #> "calling a function, possibly with arguments. There are two ways of\n", #> "creating a quoted call:\n", list("\n", list(), #> " By ", list("quoting"), " it. Quoting prevents functions from being\n", #> "called. Instead, you get the description of the function call as\n", #> "an R object. That is, a quoted function call.\n", #> list(), " By constructing it with ", list(list( #> "base::call()")), ", ", list(list("base::as.call()")), #> ", or\n", list("call2()"), ". In this case, you pass the call elements (the function\n", #> "to call and the arguments to call it with) separately.\n"), #> "\n", "\n", "See section below for the difference between ", #> list("call2()"), " and the base\n", "constructors.\n"), #> "\n", list(list("Difference with base constructors"), #> list("\n", "\n", "\n", list("call2()"), " is more flexible and convenient than ", #> list("base::call()"), ":\n", list("\n", list(), #> " The function to call can be a string or a ", #> list("callable"), "\n", "object: a symbol, another call (e.g. a ", #> list("$"), " or ", list("[["), " call), or a\n", #> "function to inline. ", list("base::call()"), #> " only supports strings and you\n", "need to use ", #> list("base::as.call()"), " to construct a call with a callable\n", #> "object.", list("call2(list, 1, 2)\n", "\n", #> "as.call(list(list, 1, 2))\n"), "\n", list(), #> " The ", list(".ns"), " argument is convenient for creating namespaced calls.", #> list("call2(\"list\", 1, 2, .ns = \"base\")\n", #> "\n", "ns_call <- as.call(list(as.name(\"::\"), as.name(\"list\"), as.name(\"base\")))\n", #> "as.call(list(ns_call, 1, 2))\n"), "\n", #> list(), " ", list("call2()"), " has ", list( #> "tidy dots"), " support and you can splice lists\n", #> "of arguments with ", list("!!!"), ". With base R, you need to use ", #> list("as.call()"), "\n", "instead of ", list( #> "call()"), " if the arguments are in a list.", #> list("args <- list(na.rm = TRUE, trim = 0)\n", #> "\n", "call2(\"mean\", 1:10, !!!args)\n", #> "\n", "as.call(c(list(as.name(\"mean\"), 1:10), args))\n"), #> "\n"), "\n")), "\n", "\n", list(list("Caveats of inlining objects in calls"), #> list("\n", "\n", "\n", list("call2()"), " makes it possible to inline objects in calls, both in\n", #> "function and argument positions. Inlining an object or a function\n", #> "has the advantage that the correct object is used in all\n", #> "environments. If all components of the code are inlined, you can\n", #> "even evaluate in the ", list("empty environment"), #> ".\n", "\n", "However inlining also has drawbacks. It can cause issues with NSE\n", #> "functions that expect symbolic arguments. The objects may also leak\n", #> "in representations of the call stack, such as ", #> list(list("traceback()")), ".\n")), "\n", "\n", #> list("\n", "# fn can either be a string, a symbol or a call\n", #> "call2(\"f\", a = 1)\n", "call2(quote(f), a = 1)\n", #> "call2(quote(f()), a = 1)\n", "\n", "#' Can supply arguments individually or in a list\n", #> "call2(quote(f), a = 1, b = 2)\n", "call2(quote(f), !!!list(a = 1, b = 2))\n", #> "\n", "# Creating namespaced calls is easy:\n", #> "call2(\"fun\", arg = quote(baz), .ns = \"mypkg\")\n", #> "\n", "# Empty arguments are preserved:\n", "call2(\"[\", quote(x), , drop = )\n"), #> "\n", list("\n", "call_modify\n"), "\n"), call_args.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/call.R", "\n", #> list("call_args"), "\n", list("call_args"), "\n", #> list("call_args_names"), "\n", list("Extract arguments from a call"), #> "\n", list("\n", "call_args(call)\n", "\n", "call_args_names(call)\n"), #> "\n", list("\n", list(list("call"), list("Can be a call or a quosure that wraps a call.")), #> "\n"), "\n", list("\n", "A named list of arguments.\n"), #> "\n", list("\n", "Extract arguments from a call\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", "\n", #> "In rlang 0.2.0, ", list("lang_args()"), " and ", #> list("lang_args_names()"), " were\n", "deprecated and renamed to ", #> list("call_args()"), " and ", list("call_args_names()"), #> ".\n", "See lifecycle section in ", list(list( #> "call2()")), " for more about this change.\n")), #> "\n", "\n", list("\n", "call <- quote(f(a, b))\n", #> "\n", "# Subsetting a call returns the arguments converted to a language\n", #> "# object:\n", "call[-1]\n", "\n", "# On the other hand, call_args() returns a regular list that is\n", #> "# often easier to work with:\n", "str(call_args(call))\n", #> "\n", "# When the arguments are unnamed, a vector of empty strings is\n", #> "# supplied (rather than NULL):\n", "call_args_names(call)\n"), #> "\n", list("\n", list(list("fn_fmls()")), " and ", #> list(list("fn_fmls_names()")), "\n"), "\n"), #> call_fn.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call_fn"), "\n", list("call_fn"), #> "\n", list("Extract function from a call"), "\n", #> list("\n", "call_fn(call, env = caller_env())\n"), #> "\n", list("\n", list(list("call"), list("Can be a call or a quosure that wraps a call.")), #> "\n", "\n", list(list("env"), list("The environment where to find the definition of the\n", #> "function quoted in ", list("call"), " in case ", #> list("call"), " is not wrapped in a\n", "quosure.")), #> "\n"), "\n", list("\n", "If a frame or formula, the function will be retrieved from the\n", #> "associated environment. Otherwise, it is looked up in the calling\n", #> "frame.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "In rlang 0.2.0, ", #> list("lang_fn()"), " was deprecated and renamed to\n", #> list("call_fn()"), ". See lifecycle section in ", #> list(list("call2()")), " for more about this\n", #> "change.\n")), "\n", "\n", list("\n", "# Extract from a quoted call:\n", #> "call_fn(quote(matrix()))\n", "call_fn(quo(matrix()))\n", #> "\n", "# Extract the calling function\n", "test <- function() call_fn(call_frame())\n", #> "test()\n"), "\n", list("\n", list(list("call_name()")), #> "\n"), "\n"), call_inspect.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/stack.R", #> "\n", list("call_inspect"), "\n", list("call_inspect"), #> "\n", list("Inspect a call"), "\n", list("\n", #> "call_inspect(...)\n"), "\n", list("\n", list( #> list("..."), list("Arguments to display in the returned call.")), #> "\n"), "\n", list("\n", "This function is useful for quick testing and debugging when you\n", #> "manipulate expressions and calls. It lets you check that a function\n", #> "is called with the right arguments. This can be useful in unit\n", #> "tests for instance. Note that this is just a simple wrapper around\n", #> list(list("base::match.call()")), ".\n"), "\n", #> list("\n", "call_inspect(foo(bar), \"\" %>% identity())\n"), #> "\n"), call_modify.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call_modify"), "\n", list("call_modify"), #> "\n", list("Modify the arguments of a call"), #> "\n", list("\n", "call_modify(\n", " .call,\n", #> " ...,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .standardise = NULL,\n", " .env = caller_env()\n", #> ")\n"), "\n", list("\n", list(list(".call"), #> list("Can be a call, a formula quoting a call in the\n", #> "right-hand side, or a frame object from which to extract the call\n", #> "expression.")), "\n", "\n", list(list("..."), #> list("<", list("dynamic"), "> Named or unnamed expressions\n", #> "(constants, names or calls) used to modify the call. Use ", #> list(list("zap()")), "\n", "to remove arguments. Empty arguments are preserved.")), #> "\n", "\n", list(list(".homonyms"), list("How to treat arguments with the same name. The\n", #> "default, ", list("\"keep\""), ", preserves these arguments. Set ", #> list(".homonyms"), " to\n", list("\"first\""), #> " to only keep the first occurrences, to ", #> list("\"last\""), " to keep\n", "the last occurrences, and to ", #> list("\"error\""), " to raise an informative\n", #> "error and indicate what arguments have duplicated names.")), #> "\n", "\n", list(list(".standardise, .env"), #> list("Soft-deprecated as of rlang 0.3.0. Please\n", #> "call ", list(list("call_standardise()")), #> " manually.")), "\n"), "\n", list("\n", #> "A quosure if ", list(".call"), " is a quosure, a call otherwise.\n"), #> "\n", list("\n", "If you are working with a user-supplied call, make sure the\n", #> "arguments are standardised with ", list(list( #> "call_standardise()")), " before\n", "modifying the call.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> list("\n", list(), " The ", list(".standardise"), #> " argument is deprecated as of rlang 0.3.0.\n", #> list(), " In rlang 0.2.0, ", list("lang_modify()"), #> " was deprecated and renamed to\n", list( #> "call_modify()"), ". See lifecycle section in ", #> list(list("call2()")), " for more about\n", #> "this change.\n"), "\n")), "\n", "\n", list( #> "\n", "call <- quote(mean(x, na.rm = TRUE))\n", #> "\n", "# Modify an existing argument\n", "call_modify(call, na.rm = FALSE)\n", #> "call_modify(call, x = quote(y))\n", "\n", #> "# Remove an argument\n", "call_modify(call, na.rm = zap())\n", #> "\n", "# Add a new argument\n", "call_modify(call, trim = 0.1)\n", #> "\n", "# Add an explicit missing argument:\n", #> "call_modify(call, na.rm = )\n", "\n", "# Supply a list of new arguments with `!!!`\n", #> "newargs <- list(na.rm = NULL, trim = 0.1)\n", #> "call <- call_modify(call, !!!newargs)\n", #> "call\n", "\n", "# Remove multiple arguments by splicing zaps:\n", #> "newargs <- rep_named(c(\"na.rm\", \"trim\"), list(zap()))\n", #> "call <- call_modify(call, !!!newargs)\n", #> "call\n", "\n", "\n", "# Modify the `...` arguments as if it were a named argument:\n", #> "call <- call_modify(call, ... = )\n", "call\n", #> "\n", "call <- call_modify(call, ... = zap())\n", #> "call\n", "\n", "\n", "# When you're working with a user-supplied call, standardise it\n", #> "# beforehand because it might contain unmatched arguments:\n", #> "user_call <- quote(matrix(x, nc = 3))\n", #> "call_modify(user_call, ncol = 1)\n", "\n", #> "# Standardising applies the usual argument matching rules:\n", #> "user_call <- call_standardise(user_call)\n", #> "user_call\n", "call_modify(user_call, ncol = 1)\n", #> "\n", "\n", "# You can also modify quosures inplace:\n", #> "f <- quo(matrix(bar))\n", "call_modify(f, quote(foo))\n", #> "\n", "\n", "# By default, arguments with the same name are kept. This has\n", #> "# subtle implications, for instance you can move an argument to\n", #> "# last position by removing it and remapping it:\n", #> "call <- quote(foo(bar = , baz))\n", "call_modify(call, bar = NULL, bar = missing_arg())\n", #> "\n", "# You can also choose to keep only the first or last homonym\n", #> "# arguments:\n", "args <- list(bar = NULL, bar = missing_arg())\n", #> "call_modify(call, !!!args, .homonyms = \"first\")\n", #> "call_modify(call, !!!args, .homonyms = \"last\")\n"), #> "\n"), call_name.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call_name"), "\n", list("call_name"), #> "\n", list("call_ns"), "\n", list("Extract function name or namespace of a call"), #> "\n", list("\n", "call_name(call)\n", "\n", "call_ns(call)\n"), #> "\n", list("\n", list(list("call"), list("Can be a call or a quosure that wraps a call.")), #> "\n"), "\n", list("\n", "A string with the function name, or ", #> list("NULL"), " if the function\n", "is anonymous.\n"), #> "\n", list("\n", "Extract function name or namespace of a call\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "In rlang 0.2.0, ", list("lang_name()"), #> " was deprecated and renamed to\n", list("call_name()"), #> ". See lifecycle section in ", list(list("call2()")), #> " for more about\n", "this change.\n")), "\n", #> "\n", list("\n", "# Extract the function name from quoted calls:\n", #> "call_name(quote(foo(bar)))\n", "call_name(quo(foo(bar)))\n", #> "\n", "# Namespaced calls are correctly handled:\n", #> "call_name(~base::matrix(baz))\n", "\n", "# Anonymous and subsetted functions return NULL:\n", #> "call_name(quote(foo$bar()))\n", "call_name(quote(foo[[bar]]()))\n", #> "call_name(quote(foo()()))\n", "\n", "# Extract namespace of a call with call_ns():\n", #> "call_ns(quote(base::bar()))\n", "\n", "# If not namespaced, call_ns() returns NULL:\n", #> "call_ns(quote(bar()))\n"), "\n", list("\n", #> list(list("call_fn()")), "\n"), "\n"), call_parse_type.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call_parse_type"), "\n", list("call_parse_type"), #> "\n", list("What is the parser type of a call?"), #> "\n", list("\n", "call_parse_type(call)\n"), #> "\n", list("\n", "What is the parser type of a call?\n"), #> "\n", list("internal"), "\n"), call_standardise.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call_standardise"), "\n", list("call_standardise"), #> "\n", list("Standardise a call"), "\n", list( #> "\n", "call_standardise(call, env = caller_env())\n"), #> "\n", list("\n", list(list("call"), list("Can be a call or a quosure that wraps a call.")), #> "\n", "\n", list(list("env"), list("The environment where to find the definition of the\n", #> "function quoted in ", list("call"), " in case ", #> list("call"), " is not wrapped in a\n", "quosure.")), #> "\n"), "\n", list("\n", "A quosure if ", list( #> "call"), " is a quosure, a raw call otherwise.\n"), #> "\n", list("\n", "This is essentially equivalent to ", #> list(list("base::match.call()")), ", but with\n", #> "experimental handling of primitive functions.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "In rlang 0.2.0, ", list("lang_standardise()"), #> " was deprecated and renamed to\n", list("call_standardise()"), #> ". See lifecycle section in ", list(list("call2()")), #> " for more\n", "about this change.\n")), "\n", #> "\n"), caller_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("caller_env"), "\n", list("caller_env"), #> "\n", list("current_env"), "\n", list("Get the current or caller environment"), #> "\n", list("\n", "caller_env(n = 1)\n", "\n", #> "current_env()\n"), "\n", list("\n", list(list( #> "n"), list("Number of frames to go back.")), #> "\n"), "\n", list("\n", list("\n", list(), #> " The current environment is the execution environment of the\n", #> "current function (the one currently being evaluated).\n", #> list(), " The caller environment is the execution environment of the\n", #> "function that called the current function.\n"), #> "\n"), "\n", list("\n", "if (FALSE) {\n", "\n", #> "# Let's create a function that returns its current environment and\n", #> "# its caller environment:\n", "fn <- function() list(current = current_env(), caller = caller_env())\n", #> "\n", "# The current environment is an unique execution environment\n", #> "# created when `fn()` was called. The caller environment is the\n", #> "# global env because that's where we called `fn()`.\n", #> "fn()\n", "\n", "# Let's call `fn()` again but this time within a function:\n", #> "g <- function() fn()\n", "\n", "# Now the caller environment is also a unique execution environment.\n", #> "# This is the exec env created by R for our call to g():\n", #> "g()\n", "\n", "}\n"), "\n", list("\n", list( #> list("caller_frame()")), " and ", list(list( #> "current_frame()")), "\n"), "\n"), caller_fn.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/stack.R", #> "\n", list("caller_fn"), "\n", list("caller_fn"), #> "\n", list("current_fn"), "\n", list("Get properties of the current or caller frame"), #> "\n", list("\n", "caller_fn(n = 1)\n", "\n", #> "current_fn()\n"), "\n", list("\n", list(list( #> "n"), list("The number of generations to go back.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", list("\n", list(), " The current frame is the execution context of the function that\n", #> "is currently being evaluated.\n", list(), #> " The caller frame is the execution context of the function that\n", #> "called the function currently being evaluated.\n"), #> "\n", "\n", "See the ", list("call stack"), #> " topic for more information.\n"), "\n", list( #> list("Life cycle"), list("\n", "\n", "\n", #> "These functions are experimental.\n")), #> "\n", "\n", list("\n", list(list("caller_env()")), #> " and ", list(list("current_env()")), "\n"), #> "\n", list("internal"), "\n"), caller_frame.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("caller_frame"), "\n", list("caller_frame"), #> "\n", list("Get caller frame"), "\n", list("\n", #> "caller_frame(n = 1)\n"), "\n", list("\n", #> list(list("n"), list("Number of frames to go back.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n"), "\n", list("internal"), "\n"), catch_cnd.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-handlers.R", #> "\n", list("catch_cnd"), "\n", list("catch_cnd"), #> "\n", list("Catch a condition"), "\n", list("\n", #> "catch_cnd(expr, classes = \"condition\")\n"), #> "\n", list("\n", list(list("expr"), list("Expression to be evaluated with a catching condition\n", #> "handler.")), "\n", "\n", list(list("classes"), #> list("A character vector of condition classes to catch. By\n", #> "default, catches all conditions.")), "\n"), #> "\n", list("\n", "A condition if any was signalled, ", #> list("NULL"), " otherwise.\n"), "\n", list( #> "\n", "This is a small wrapper around ", list( #> "tryCatch()"), " that captures any\n", "condition signalled while evaluating its argument. It is useful for\n", #> "situations where you expect a specific condition to be signalled,\n", #> "for debugging, and for unit testing.\n"), #> "\n", list("\n", "catch_cnd(10)\n", "catch_cnd(abort(\"an error\"))\n", #> "catch_cnd(signal(\"my_condition\", message = \"a condition\"))\n"), #> "\n"), chr_unserialise_unicode.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/utils-encoding.R", #> "\n", list("chr_unserialise_unicode"), "\n", #> list("chr_unserialise_unicode"), "\n", list("Translate unicode points to UTF-8"), #> "\n", list("\n", "chr_unserialise_unicode(chr)\n"), #> "\n", list("\n", list(list("chr"), list("A character vector.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "For historical reasons, R translates strings to the native encoding\n", #> "when they are converted to symbols. This string-to-symbol\n", #> "conversion is not a rare occurrence and happens for instance to the\n", #> "names of a list of arguments converted to a call by ", #> list("do.call()"), ".\n", "\n", "If the string contains unicode characters that cannot be\n", #> "represented in the native encoding, R serialises those as an ASCII\n", #> "sequence representing the unicode point. This is why Windows users\n", #> "with western locales often see strings looking like ", #> list("<U+xxxx>"), ". To\n", "alleviate some of the pain, rlang parses strings and looks for\n", #> "serialised unicode points to translate them back to the proper\n", #> "UTF-8 representation. This transformation occurs automatically in\n", #> "functions like ", list(list("env_names()")), #> " and can be manually triggered with\n", list( #> "as_utf8_character()"), " and ", list("chr_unserialise_unicode()"), #> ".\n"), "\n", list(list("Life cycle"), list( #> "\n", "\n", "\n", "This function is experimental.\n")), #> "\n", "\n", list("\n", "ascii <- \"<U+5E78>\"\n", #> "chr_unserialise_unicode(ascii)\n", "\n", "identical(chr_unserialise_unicode(ascii), \"\\u5e78\")\n"), #> "\n", list("internal"), "\n"), cnd.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-error.R, R/cnd.R", #> "\n", list("error_cnd"), "\n", list("error_cnd"), #> "\n", list("cnd"), "\n", list("warning_cnd"), #> "\n", list("message_cnd"), "\n", list("Create a condition object"), #> "\n", list("\n", "error_cnd(class = NULL, ..., message = \"\", trace = NULL, parent = NULL)\n", #> "\n", "cnd(class, ..., message = \"\")\n", #> "\n", "warning_cnd(class = NULL, ..., message = \"\")\n", #> "\n", "message_cnd(class = NULL, ..., message = \"\")\n"), #> "\n", list("\n", list(list("class"), list("The condition subclass.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> Named data fields stored inside\n", #> "the condition object.")), "\n", "\n", list( #> list("message"), list("A default message to inform the user about the\n", #> "condition when it is signalled.")), "\n", #> "\n", list(list("trace"), list("A ", list("trace"), #> " object created by ", list(list("trace_back()")), #> ".")), "\n", "\n", list(list("parent"), list( #> "A parent condition object created by ", #> list(list("abort()")), ".")), "\n"), "\n", #> list("\n", "These constructors make it easy to create subclassed conditions.\n", #> "Conditions are objects that power the error system in R. They can\n", #> "also be used for passing messages to pre-established handlers.\n"), #> "\n", list("\n", list("cnd()"), " creates objects inheriting from ", #> list("condition"), ". Conditions\n", "created with ", #> list("error_cnd()"), ", ", list("warning_cnd()"), #> " and ", list("message_cnd()"), "\n", "inherit from ", #> list("error"), ", ", list("warning"), " or ", #> list("message"), ".\n"), "\n", list("\n", "# Create a condition inheriting from the s3 type \"foo\":\n", #> "cnd <- cnd(\"foo\")\n", "\n", "# Signal the condition to potential handlers. Since this is a bare\n", #> "# condition the signal has no effect if no handlers are set up:\n", #> "cnd_signal(cnd)\n", "\n", "# When a relevant handler is set up, the signal causes the handler\n", #> "# to be called:\n", "with_handlers(cnd_signal(cnd), foo = exiting(function(c) \"caught!\"))\n", #> "\n", "# Handlers can be thrown or executed inplace. See with_handlers()\n", #> "# documentation for more on this.\n", "\n", #> "# Signalling an error condition aborts the current computation:\n", #> "err <- error_cnd(\"foo\", message = \"I am an error\")\n", #> "try(cnd_signal(err))\n"), "\n", list("\n", #> list(list("cnd_signal()")), ", ", list(list( #> "with_handlers()")), ".\n"), "\n", list("internal"), #> "\n"), cnd_message.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-message.R", #> "\n", list("cnd_message"), "\n", list("cnd_message"), #> "\n", list("cnd_header"), "\n", list("cnd_body"), #> "\n", list("cnd_footer"), "\n", list("Build an error message from parts"), #> "\n", list("\n", "cnd_message(cnd)\n", "\n", #> "cnd_header(cnd, ...)\n", "\n", "cnd_body(cnd, ...)\n", #> "\n", "cnd_footer(cnd, ...)\n"), "\n", list( #> "\n", list(list("cnd"), list("A condition object.")), #> "\n", "\n", list(list("..."), list("Arguments passed to methods.")), #> "\n"), "\n", list("\n", list("cnd_message()"), #> " assembles an error message from three generics:\n", #> list("\n", list(), " ", list("cnd_header()"), #> "\n", list(), " ", list("cnd_body()"), "\n", #> list(), " ", list("cnd_footer()"), "\n"), #> "\n", "\n", "The default method for the error header returns the ", #> list("message"), " field\n", "of the condition object. The default methods for the body and\n", #> "footer return empty character vectors. In general, methods for\n", #> "these generics should return a character vector. The elements are\n", #> "combined into a single string with a newline separator.\n", #> "\n", list("cnd_message()"), " is automatically called by the ", #> list("conditionMessage()"), "\n", "for rlang errors. Error classes created with ", #> list(list("abort()")), " only need to\n", "implement header, body or footer methods. This provides a lot of\n", #> "flexibility for hierarchies of error classes, for instance you\n", #> "could inherit the body of an error message from a parent class\n", #> "while overriding the header and footer.\n"), #> "\n", list(list("Overriding ", list("cnd_body()")), #> list("\n", "\n", "\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "Sometimes the contents of an error message depends on the state of\n", #> "your checking routine. In that case, it can be tricky to lazily\n", #> "generate error messages with ", list("cnd_body()"), #> ": you have the choice\n", "between overspecifying your error class hierarchies with one class\n", #> "per state, or replicating the type-checking control flow within the\n", #> list("cnd_body()"), " method. None of these options are ideal.\n", #> "\n", "A better option is to define a ", #> list("body"), " field in your error object\n", #> "containing a static string, a ", list("lambda-formula"), #> ", or a\n", "function with the same signature as ", #> list("cnd_body()"), ". This field\n", "overrides the ", #> list("cnd_body()"), " generic and makes it easy to generate an\n", #> "error message tailored to the state in which the error was\n", #> "constructed.\n")), "\n", "\n"), cnd_muffle.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-handlers.R", #> "\n", list("cnd_muffle"), "\n", list("cnd_muffle"), #> "\n", list("Muffle a condition"), "\n", list( #> "\n", "cnd_muffle(cnd)\n"), "\n", list("\n", #> list(list("cnd"), list("A condition to muffle.")), #> "\n"), "\n", list("\n", "If ", list("cnd"), #> " is mufflable, ", list("cnd_muffle()"), " jumps to the muffle\n", #> "restart and doesn't return. Otherwise, it returns ", #> list("FALSE"), ".\n"), "\n", list("\n", "Unlike ", #> list(list("exiting()")), " handlers, ", list( #> list("calling()")), " handlers must be explicit\n", #> "that they have handled a condition to stop it from propagating to\n", #> "other handlers. Use ", list("cnd_muffle()"), #> " within a calling handler (or as\n", "a calling handler, see examples) to prevent any other handlers from\n", #> "being called for that condition.\n"), "\n", #> list(list("Mufflable conditions"), list("\n", #> "\n", "\n", "Most conditions signalled by base R are muffable, although the name\n", #> "of the restart varies. cnd_muffle() will automatically call the\n", #> "correct restart for you. It is compatible with the following\n", #> "conditions:\n", list("\n", list(), " ", list( #> "warning"), " and ", list("message"), " conditions. In this case ", #> list("cnd_muffle()"), "\n", "is equivalent to ", #> list(list("base::suppressMessages()")), " and\n", #> list(list("base::suppressWarnings()")), ".\n", #> list(), " Bare conditions signalled with ", #> list("signal()"), " or ", list(list("cnd_signal()")), #> ". Note\n", "that conditions signalled with ", #> list(list("base::signalCondition()")), " are not\n", #> "mufflable.\n", list(), " Interrupts are sometimes signalled with a ", #> list("resume"), " restart on\n", "recent R versions. When this is the case, you can muffle the\n", #> "interrupt with ", list("cnd_muffle()"), #> ". Check if a restart is available\n", "with ", #> list("base::findRestart(\"resume\")"), ".\n"), #> "\n", "\n", "If you call ", list("cnd_muffle()"), #> " with a condition that is not mufflable\n", #> "you will cause a new error to be signalled.\n", #> list("\n", list(), " Errors are not mufflable since they are signalled in critical\n", #> "situations where execution cannot continue safely.\n", #> list(), " Conditions captured with ", list( #> list("base::tryCatch()")), ", ", list(list( #> "with_handlers()")), " or\n", list(list( #> "catch_cnd()")), " are no longer mufflable. Muffling restarts ", #> list("must"), "\n", "be called from a ", #> list("calling"), " handler.\n"), "\n")), #> "\n", "\n", list("\n", "fn <- function() {\n", #> " inform(\"Beware!\", \"my_particular_msg\")\n", #> " inform(\"On your guard!\")\n", " \"foobar\"\n", #> "}\n", "\n", "# Let's install a muffling handler for the condition thrown by `fn()`.\n", #> "# This will suppress all `my_particular_wng` warnings but let other\n", #> "# types of warnings go through:\n", "with_handlers(fn(),\n", #> " my_particular_msg = calling(function(cnd) {\n", #> " inform(\"Dealt with this particular message\")\n", #> " cnd_muffle(cnd)\n", " })\n", ")\n", "\n", #> "# Note how execution of `fn()` continued normally after dealing\n", #> "# with that particular message.\n", "\n", #> "# cnd_muffle() can also be passed to with_handlers() as a calling\n", #> "# handler:\n", "with_handlers(fn(),\n", " my_particular_msg = calling(cnd_muffle)\n", #> ")\n"), "\n", list("internal"), "\n"), cnd_signal.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-signal.R", #> "\n", list("cnd_signal"), "\n", list("cnd_signal"), #> "\n", list("Signal a condition object"), "\n", #> list("\n", "cnd_signal(cnd, ...)\n"), "\n", list( #> "\n", list(list("cnd"), list("A condition object (see ", #> list(list("cnd()")), "). If ", list("NULL"), #> ",\n", list("cnd_signal()"), " returns without signalling a condition.")), #> "\n", "\n", list(list("..."), list("These dots are for extensions and must be empty.")), #> "\n"), "\n", list("\n", "The type of signal depends on the class of the condition:\n", #> list("\n", list(), " A message is signalled if the condition inherits from\n", #> list("\"message\""), ". This is equivalent to signalling with ", #> list(list("inform()")), " or\n", list(list( #> "base::message()")), ".\n", list(), " A warning is signalled if the condition inherits from\n", #> list("\"warning\""), ". This is equivalent to signalling with ", #> list(list("warn()")), " or\n", list(list( #> "base::warning()")), ".\n", list(), " An error is signalled if the condition inherits from\n", #> list("\"error\""), ". This is equivalent to signalling with ", #> list(list("abort()")), " or\n", list(list( #> "base::stop()")), ".\n", list(), " An interrupt is signalled if the condition inherits from\n", #> list("\"interrupt\""), ". This is equivalent to signalling with\n", #> list(list("interrupt()")), ".\n"), "\n", #> "\n", "Use ", list(list("cnd_type()")), " to determine the type of a condition.\n"), #> "\n", list("\n", "# The type of signal depends on the class. If the condition\n", #> "# inherits from \"warning\", a warning is issued:\n", #> "cnd <- warning_cnd(\"my_warning_class\", message = \"This is a warning\")\n", #> "cnd_signal(cnd)\n", "\n", "# If it inherits from \"error\", an error is raised:\n", #> "cnd <- error_cnd(\"my_error_class\", message = \"This is an error\")\n", #> "try(cnd_signal(cnd))\n"), "\n", list("\n", #> list(list("abort()")), ", ", list(list("warn()")), #> " and ", list(list("inform()")), " for creating and\n", #> "signalling structured R conditions. See ", #> list(list("with_handlers()")), " for\n", "establishing condition handlers.\n"), #> "\n"), cnd_type.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd.R", #> "\n", list("cnd_type"), "\n", list("cnd_type"), #> "\n", list("What type is a condition?"), "\n", #> list("\n", "cnd_type(cnd)\n"), "\n", list("\n", #> list(list("cnd"), list("A condition object.")), #> "\n"), "\n", list("\n", "A string, either ", #> list("\"condition\""), ", ", list("\"message\""), #> ", ", list("\"warning\""), ",\n", list("\"error\""), #> " or ", list("\"interrupt\""), ".\n"), "\n", #> list("\n", "Use ", list("cnd_type()"), " to check what type a condition is.\n"), #> "\n", list("\n", "cnd_type(catch_cnd(abort(\"Abort!\")))\n", #> "cnd_type(catch_cnd(interrupt()))\n"), "\n", #> list("internal"), "\n"), done.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/s3.R", #> "\n", list("done"), "\n", list("done"), "\n", #> list("is_done_box"), "\n", list("Box a final value for early termination"), #> "\n", list("\n", "done(x)\n", "\n", "is_done_box(x, empty = NULL)\n"), #> "\n", list("\n", list(list("x"), list("For ", #> list("done()"), ", a value to box. For ", list( #> "is_done_box()"), ", a\n", "value to test.")), #> "\n", "\n", list(list("empty"), list("Whether the box is empty. If ", #> list("NULL"), ", ", list("is_done_box()"), #> "\n", "returns ", list("TRUE"), " for all done boxes. If ", #> list("TRUE"), ", it returns ", list("TRUE"), #> "\n", "only for empty boxes. Otherwise it returns ", #> list("TRUE"), " only for\n", "non-empty boxes.")), #> "\n"), "\n", list("\n", "A ", list("boxed"), #> " value.\n"), "\n", list("\n", "A value boxed with ", #> list("done()"), " signals to its caller that it\n", #> "should stop iterating. Use it to shortcircuit a loop.\n"), #> "\n", list("\n", "done(3)\n", "\n", "x <- done(3)\n", #> "is_done_box(x)\n"), "\n"), dots_definitions.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("dots_definitions"), "\n", list("dots_definitions"), #> "\n", list("Capture definition objects"), "\n", #> list("\n", "dots_definitions(\n", " ...,\n", #> " .named = FALSE,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\")\n", #> ")\n"), "\n", list("\n", list(list("..."), #> list("For ", list("enexprs()"), ", ", list( #> "ensyms()"), " and ", list("enquos()"), ", names of\n", #> "arguments to capture without evaluation (including ", #> list("..."), "). For\n", list("exprs()"), #> " and ", list("quos()"), ", the expressions to capture unevaluated\n", #> "(including expressions contained in ", list( #> "..."), ").")), "\n", "\n", list(list(".named"), #> list("Whether to ensure all dots are named. Unnamed\n", #> "elements are processed with ", list(list( #> "as_label()")), " to build a default\n", #> "name.")), "\n", "\n", list(list(".ignore_empty"), #> list("Whether to ignore empty arguments. Can be one\n", #> "of ", list("\"trailing\""), ", ", list("\"none\""), #> ", ", list("\"all\""), ". If ", list("\"trailing\""), #> ", only the\n", "last argument is ignored if it is empty. Note that ", #> list("\"trailing\""), "\n", "applies only to arguments passed in ", #> list("..."), ", not to named\n", "arguments. On the other hand, ", #> list("\"all\""), " also applies to named\n", #> "arguments.")), "\n"), "\n", list("\n", "Capture definition objects\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", list("dots_definitions()"), " is experimental. Expect API changes.\n")), #> "\n", "\n", list("internal"), "\n"), dots_n.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("dots_n"), "\n", list("dots_n"), "\n", #> list("How many arguments are currently forwarded in dots?"), #> "\n", list("\n", "dots_n(...)\n"), "\n", list( #> "\n", list(list("..."), list("Forwarded arguments.")), #> "\n"), "\n", list("\n", "This returns the number of arguments currently forwarded in ", #> list("..."), "\n", "as an integer.\n"), "\n", #> list("\n", "fn <- function(...) dots_n(..., baz)\n", #> "fn(foo, bar)\n"), "\n", list("internal"), #> "\n"), dots_values.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("dots_values"), "\n", list("dots_values"), #> "\n", list("Evaluate dots with preliminary splicing"), #> "\n", list("\n", "dots_values(\n", " ...,\n", #> " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .preserve_empty = FALSE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n"), "\n", #> list("\n", list(list("..."), list("Arguments to evaluate and process splicing operators.")), #> "\n", "\n", list(list(".ignore_empty"), list( #> "Whether to ignore empty arguments. Can be one\n", #> "of ", list("\"trailing\""), ", ", list("\"none\""), #> ", ", list("\"all\""), ". If ", list("\"trailing\""), #> ", only the\n", "last argument is ignored if it is empty.")), #> "\n", "\n", list(list(".preserve_empty"), list( #> "Whether to preserve the empty arguments that\n", #> "were not ignored. If ", list("TRUE"), ", empty arguments are stored with\n", #> list(list("missing_arg()")), " values. If ", #> list("FALSE"), " (the default) an error is\n", #> "thrown when an empty argument is detected.")), #> "\n", "\n", list(list(".homonyms"), list("How to treat arguments with the same name. The\n", #> "default, ", list("\"keep\""), ", preserves these arguments. Set ", #> list(".homonyms"), " to\n", list("\"first\""), #> " to only keep the first occurrences, to ", #> list("\"last\""), " to keep\n", "the last occurrences, and to ", #> list("\"error\""), " to raise an informative\n", #> "error and indicate what arguments have duplicated names.")), #> "\n", "\n", list(list(".check_assign"), list( #> "Whether to check for ", list("<-"), " calls passed in\n", #> "dots. When ", list("TRUE"), " and a ", list( #> "<-"), " call is detected, a warning is\n", #> "issued to advise users to use ", list("="), #> " if they meant to match a\n", "function parameter, or wrap the ", #> list("<-"), " call in braces otherwise.\n", #> "This ensures assignments are explicit.")), #> "\n"), "\n", list("\n", "This is a tool for advanced users. It captures dots, processes\n", #> "unquoting and splicing operators, and evaluates them. Unlike\n", #> list(list("dots_list()")), ", it does not flatten spliced objects, instead they\n", #> "are attributed a ", list("spliced"), " class (see ", #> list(list("splice()")), "). You can process\n", #> "spliced objects manually, perhaps with a custom predicate (see\n", #> list(list("flatten_if()")), ").\n"), "\n", #> list("\n", "dots <- dots_values(!!! list(1, 2), 3)\n", #> "dots\n", "\n", "# Flatten the objects marked as spliced:\n", #> "flatten_if(dots, is_spliced)\n"), "\n", list( #> "internal"), "\n"), duplicate.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/sexp.R", #> "\n", list("duplicate"), "\n", list("duplicate"), #> "\n", list("Duplicate an R object"), "\n", list( #> "\n", "duplicate(x, shallow = FALSE)\n"), "\n", #> list("\n", list(list("x"), list("Any R object. However, uncopyable types like symbols and\n", #> "environments are returned as is (just like with ", #> list("<-"), ").")), "\n", "\n", list(list("shallow"), #> list("This is relevant for recursive data structures like\n", #> "lists, calls and pairlists. A shallow copy only duplicates the\n", #> "top-level data structure. The objects contained in the list are\n", #> "still the same.")), "\n"), "\n", list("\n", #> "In R semantics, objects are copied by value. This means that\n", #> "modifying the copy leaves the original object intact. Since\n", #> "copying data in memory is an expensive operation, copies in R are\n", #> "as lazy as possible. They only happen when the new object is\n", #> "actually modified. However, some operations (like ", #> list(list("node_poke_car()")), "\n", "or ", #> list(list("node_poke_cdr()")), ") do not support copy-on-write. In those cases,\n", #> "it is necessary to duplicate the object manually in order to\n", #> "preserve copy-by-value semantics.\n"), "\n", #> list("\n", "Some objects are not duplicable, like symbols and environments.\n", #> list("duplicate()"), " returns its input for these unique objects.\n"), #> "\n", list("\n", "pairlist\n"), "\n", list("internal"), #> "\n"), `dyn-dots.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("dyn-dots"), "\n", list("dyn-dots"), #> "\n", list("tidy-dots"), "\n", list("Dynamic dots"), #> "\n", list("\n", "The ", list("..."), " syntax of base R allows you to:\n", #> list("\n", list(), " ", list("Forward"), " arguments from function to function, matching them\n", #> "along the way to function parameters.\n", #> list(), " ", list("Collect"), " arguments inside data structures, e.g. with ", #> list(list("c()")), " or\n", list(list("list()")), #> ".\n"), "\n", "\n", "Dynamic dots offer a few additional features:\n", #> list("\n", list(), " You can ", list("splice"), #> " arguments saved in a list with the ", list( #> "big bang"), " operator ", list("!!!"), #> ".\n", list(), " You can ", list("unquote"), #> " names by using the ", list("glue"), " syntax\n", #> "or the ", list("bang bang"), " operator ", #> list("!!"), " on the\n", "left-hand side of ", #> list(":="), ".\n", list(), " Trailing commas are ignored, making it easier to copy and paste\n", #> "lines of arguments.\n"), "\n"), "\n", list( #> list("Add dynamic dots support in your functions"), #> list("\n", "\n", "\n", "If your function takes dots, adding support for dynamic features is\n", #> "as easy as collecting the dots with ", list( #> list("list2()")), " instead of ", list( #> list("list()")), ".\n", "\n", "Other dynamic dots collectors are ", #> list(list("dots_list()")), ", which is more\n", #> "configurable than ", list(list("list2()")), #> ", ", list("vars()"), " which doesn't force its\n", #> "arguments, and ", list(list("call2()")), #> " for creating calls.\n", "\n", "Document dynamic docs using this standard tag:", #> list(" @param ... <[`dynamic-dots`][rlang::dyn-dots]> What these dots do.\n"), #> "\n")), "\n", "\n", list("\n", "f <- function(...) {\n", #> " out <- list2(...)\n", " rev(out)\n", "}\n", #> "\n", "# Splice\n", "x <- list(alpha = \"first\", omega = \"last\")\n", #> "f(!!!x)\n", "\n", "# Unquote a name, showing both the `!!` bang bang and `{}` glue style\n", #> "nm <- \"key\"\n", "f(!!nm := \"value\")\n", #> "f(\"{nm}\" := \"value\")\n", "f(\"prefix_{nm}\" := \"value\")\n", #> "\n", "# Tolerate a trailing comma\n", "f(this = \"that\", )\n"), #> "\n"), empty_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("empty_env"), "\n", list("empty_env"), #> "\n", list("Get the empty environment"), "\n", #> list("\n", "empty_env()\n"), "\n", list("\n", #> "The empty environment is the only one that does not have a parent.\n", #> "It is always used as the tail of an environment chain such as the\n", #> "search path (see ", list(list("search_envs()")), #> ").\n"), "\n", list("\n", "# Create environments with nothing in scope:\n", #> "child_env(empty_env())\n"), "\n"), enquo0.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/nse-defuse.R", #> "\n", list("enquo0"), "\n", list("enquo0"), "\n", #> list("enquos0"), "\n", list("Defuse arguments without automatic injection"), #> "\n", list("\n", "enquo0(arg)\n", "\n", "enquos0(...)\n"), #> "\n", list("\n", list(list("arg"), list("A symbol for a function argument to defuse.")), #> "\n", "\n", list(list("..."), list("Dots to defuse.")), #> "\n"), "\n", list("\n", "The 0-suffixed variants of ", #> list(list("enquo()")), " and ", list(list("enquos()")), #> " defuse function\n", "arguments without automatic injection (unquotation). They are\n", #> "useful when defusing expressions that potentially include ", #> list("!!"), ",\n", list("!!!"), ", or ", list( #> "{{"), " operations, for instance tidyverse code. In that\n", #> "case, ", list("enquo()"), " would process these operators too early, creating a\n", #> "confusing experience for users. Callers can still inject objects\n", #> "or expressions using manual injection with ", #> list(list("inject()")), ".\n"), "\n", list( #> "\n", "None of the features of ", list("dynamic dots"), #> " are available when\n", "defusing with ", #> list("enquos0()"), ". For instance, trailing empty arguments\n", #> "are not automatically trimmed.\n"), "\n", #> list("\n", "automatic_injection <- function(x) enquo(x)\n", #> "no_injection <- function(x) enquo0(x)\n", #> "\n", "automatic_injection(foo(!!!1:3))\n", #> "no_injection(foo(!!!1:3))\n"), "\n", list( #> "\n", list(list("enquo()")), " and ", list( #> list("enquos()")), "\n"), "\n"), entrace.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-entrace.R", #> "\n", list("entrace"), "\n", list("entrace"), #> "\n", list("cnd_entrace"), "\n", list("Add backtrace from error handler"), #> "\n", list("\n", "entrace(cnd, ..., top = NULL, bottom = NULL)\n", #> "\n", "cnd_entrace(cnd, ..., top = NULL, bottom = NULL)\n"), #> "\n", list("\n", list(list("cnd"), list("When ", #> list("entrace()"), " is used as a calling handler, ", #> list("cnd"), " is\n", "the condition to handle.")), #> "\n", "\n", list(list("..."), list("Unused. These dots are for future extensions.")), #> "\n", "\n", list(list("top"), list("The first frame environment to be included in the\n", #> "backtrace. This becomes the top of the backtrace tree and\n", #> "represents the oldest call in the backtrace.\n", #> "\n", "This is needed in particular when you call ", #> list("trace_back()"), "\n", "indirectly or from a larger context, for example in tests or\n", #> "inside an RMarkdown document where you don't want all of the\n", #> "knitr evaluation mechanisms to appear in the backtrace.")), #> "\n", "\n", list(list("bottom"), list("The last frame environment to be included in the\n", #> "backtrace. This becomes the rightmost leaf of the backtrace tree\n", #> "and represents the youngest call in the backtrace.\n", #> "\n", "Set this when you would like to capture a backtrace without the\n", #> "capture context.\n", "\n", "Can also be an integer that will be passed to ", #> list(list("caller_env()")), ".")), "\n"), #> "\n", list("\n", list("entrace()"), " interrupts an error throw to add an ", #> list("rlang backtrace"), " to the error. The error throw is\n", #> "immediately resumed. ", list("cnd_entrace()"), #> " adds a backtrace to a\n", "condition object, without any other effect. Both functions should\n", #> "be called directly from an error handler.\n", #> "\n", "Set the ", list("error"), " global option to ", #> list("rlang::entrace"), " to\n", "transform base errors to rlang errors. These enriched errors\n", #> "include a backtrace. The RProfile is a good place to set the\n", #> "handler. See ", list(list("rlang_backtrace_on_error")), #> " for details.\n", "\n", list("entrace()"), #> " also works as a ", list("calling"), " handler, though it\n", #> "is often more practical to use the higher-level function\n", #> list(list("with_abort()")), ".\n"), "\n", list( #> "\n", "if (FALSE) { # Not run\n", "\n", "# Set the error handler in your RProfile like this:\n", #> "if (requireNamespace(\"rlang\", quietly = TRUE)) {\n", #> " options(error = rlang::entrace)\n", "}\n", #> "\n", "}\n"), "\n", list("\n", list(list("with_abort()")), #> " to promote conditions to rlang errors.\n", #> list(list("cnd_entrace()")), " to manually add a backtrace to a condition.\n"), #> "\n"), env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env"), "\n", list("env"), "\n", list( #> "child_env"), "\n", list("new_environment"), #> "\n", list("Create a new environment"), "\n", #> list("\n", "env(...)\n", "\n", "child_env(.parent, ...)\n", #> "\n", "new_environment(data = list(), parent = empty_env())\n"), #> "\n", list("\n", list(list("..., data"), list( #> "<", list("dynamic"), "> Named values. You can\n", #> "supply one unnamed to specify a custom parent, otherwise it\n", #> "defaults to the current environment.")), "\n", #> "\n", list(list(".parent, parent"), list("A parent environment. Can be an object\n", #> "supported by ", list(list("as_environment()")), #> ".")), "\n"), "\n", list("\n", "These functions create new environments.\n", #> list("\n", list(), " ", list("env()"), " creates a child of the current environment by default\n", #> "and takes a variable number of named objects to populate it.\n", #> list(), " ", list("new_environment()"), " creates a child of the empty environment by\n", #> "default and takes a named list of objects to populate it.\n"), #> "\n"), "\n", list(list("Environments as objects"), #> list("\n", "\n", "\n", "Environments are containers of uniquely named objects. Their most\n", #> "common use is to provide a scope for the evaluation of R\n", #> "expressions. Not all languages have first class environments,\n", #> "i.e. can manipulate scope as regular objects. Reification of scope\n", #> "is one of the most powerful features of R as it allows you to change\n", #> "what objects a function or expression sees when it is evaluated.\n", #> "\n", "Environments also constitute a data structure in their own\n", #> "right. They are a collection of uniquely named objects, subsettable\n", #> "by name and modifiable by reference. This latter property (see\n", #> "section on reference semantics) is especially useful for creating\n", #> "mutable OO systems (cf the ", list(list( #> "https://github.com/r-lib/R6"), list("R6 package")), #> "\n", "and the ", list(list("https://ggplot2.tidyverse.org/articles/extending-ggplot2.html"), #> list("ggproto system")), "\n", "for extending ggplot2).\n")), #> "\n", "\n", list(list("Inheritance"), list("\n", #> "\n", "\n", "All R environments (except the ", #> list("empty environment"), ") are\n", "defined with a parent environment. An environment and its\n", #> "grandparents thus form a linear hierarchy that is the basis for\n", #> list(list("https://en.wikipedia.org/wiki/Scope_(computer_science)"), #> list("lexical scoping")), " in\n", "R. When R evaluates an expression, it looks up symbols in a given\n", #> "environment. If it cannot find these symbols there, it keeps\n", #> "looking them up in parent environments. This way, objects defined\n", #> "in child environments have precedence over objects defined in\n", #> "parent environments.\n", "\n", "The ability of overriding specific definitions is used in the\n", #> "tidyeval framework to create powerful domain-specific grammars. A\n", #> "common use of masking is to put data frame columns in scope. See\n", #> "for example ", list(list("as_data_mask()")), #> ".\n")), "\n", "\n", list(list("Reference semantics"), #> list("\n", "\n", "\n", "Unlike regular objects such as vectors, environments are an\n", #> list("uncopyable"), " object type. This means that if you\n", #> "have multiple references to a given environment (by assigning the\n", #> "environment to another symbol with ", list( #> "<-"), " or passing the environment\n", #> "as argument to a function), modifying the bindings of one of those\n", #> "references changes all other references as well.\n")), #> "\n", "\n", list(list("Life cycle"), list("\n", #> "\n", list("\n", list(), " ", list("child_env()"), #> " is in the questioning stage. It is redundant now\n", #> "that ", list("env()"), " accepts parent environments.\n"), #> "\n")), "\n", "\n", list("\n", "# env() creates a new environment which has the current environment\n", #> "# as parent\n", "env <- env(a = 1, b = \"foo\")\n", #> "env$b\n", "identical(env_parent(env), current_env())\n", #> "\n", "# Supply one unnamed argument to override the default:\n", #> "env <- env(base_env(), a = 1, b = \"foo\")\n", #> "identical(env_parent(env), base_env())\n", #> "\n", "\n", "# child_env() lets you specify a parent:\n", #> "child <- child_env(env, c = \"bar\")\n", "identical(env_parent(child), env)\n", #> "\n", "# This child environment owns `c` but inherits `a` and `b` from `env`:\n", #> "env_has(child, c(\"a\", \"b\", \"c\", \"d\"))\n", #> "env_has(child, c(\"a\", \"b\", \"c\", \"d\"), inherit = TRUE)\n", #> "\n", "# `parent` is passed to as_environment() to provide handy\n", #> "# shortcuts. Pass a string to create a child of a package\n", #> "# environment:\n", "child_env(\"rlang\")\n", #> "env_parent(child_env(\"rlang\"))\n", "\n", #> "# Or `NULL` to create a child of the empty environment:\n", #> "child_env(NULL)\n", "env_parent(child_env(NULL))\n", #> "\n", "# The base package environment is often a good default choice for a\n", #> "# parent environment because it contains all standard base\n", #> "# functions. Also note that it will never inherit from other loaded\n", #> "# package environments since R keeps the base package at the tail\n", #> "# of the search path:\n", "base_child <- child_env(\"base\")\n", #> "env_has(base_child, c(\"lapply\", \"(\"), inherit = TRUE)\n", #> "\n", "# On the other hand, a child of the empty environment doesn't even\n", #> "# see a definition for `(`\n", "empty_child <- child_env(NULL)\n", #> "env_has(empty_child, c(\"lapply\", \"(\"), inherit = TRUE)\n", #> "\n", "# Note that all other package environments inherit from base_env()\n", #> "# as well:\n", "rlang_child <- child_env(\"rlang\")\n", #> "env_has(rlang_child, \"env\", inherit = TRUE) # rlang function\n", #> "env_has(rlang_child, \"lapply\", inherit = TRUE) # base function\n", #> "\n", "\n", "# Both env() and child_env() support tidy dots features:\n", #> "objs <- list(b = \"foo\", c = \"bar\")\n", #> "env <- env(a = 1, !!! objs)\n", "env$c\n", #> "\n", "# You can also unquote names with the definition operator `:=`\n", #> "var <- \"a\"\n", "env <- env(!!var := \"A\")\n", #> "env$a\n", "\n", "\n", "# Use new_environment() to create containers with the empty\n", #> "# environment as parent:\n", "env <- new_environment()\n", #> "env_parent(env)\n", "\n", "# Like other new_ constructors, it takes an object rather than dots:\n", #> "new_environment(list(a = \"foo\", b = \"bar\"))\n"), #> "\n", list("\n", list(list("env_has()")), ", ", #> list(list("env_bind()")), ".\n"), "\n"), env_bind.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_bind"), "\n", list("env_bind"), #> "\n", list("env_bind_lazy"), "\n", list("env_bind_active"), #> "\n", list("%<~%"), "\n", list("Bind symbols to objects in an environment"), #> "\n", list("\n", "env_bind(.env, ...)\n", "\n", #> "env_bind_lazy(.env, ..., .eval_env = caller_env())\n", #> "\n", "env_bind_active(.env, ...)\n", "\n", #> "lhs %<~% rhs\n"), "\n", list("\n", list(list( #> ".env"), list("An environment.")), "\n", "\n", #> list(list("..."), list("<", list("dynamic"), #> "> Named objects (", list("env_bind()"), #> "),\n", "expressions ", list("env_bind_lazy()"), #> ", or functions (", list("env_bind_active()"), #> ").\n", "Use ", list(list("zap()")), " to remove bindings.")), #> "\n", "\n", list(list(".eval_env"), list("The environment where the expressions will be\n", #> "evaluated when the symbols are forced.")), #> "\n", "\n", list(list("lhs"), list("The variable name to which ", #> list("rhs"), " will be lazily assigned.")), #> "\n", "\n", list(list("rhs"), list("An expression lazily evaluated and assigned to ", #> list("lhs"), ".")), "\n"), "\n", list("\n", #> "The input object ", list(".env"), ", with its associated environment\n", #> "modified in place, invisibly.\n"), "\n", list( #> "\n", "These functions create bindings in an environment. The bindings are\n", #> "supplied through ", list("..."), " as pairs of names and values or expressions.\n", #> list("env_bind()"), " is equivalent to evaluating a ", #> list("<-"), " expression within\n", "the given environment. This function should take care of the\n", #> "majority of use cases but the other variants can be useful for\n", #> "specific problems.\n", list("\n", list(), #> " ", list("env_bind()"), " takes named ", #> list("values"), " which are bound in ", list( #> ".env"), ".\n", list("env_bind()"), " is equivalent to ", #> list(list("base::assign()")), ".\n", list(), #> " ", list("env_bind_active()"), " takes named ", #> list("functions"), " and creates active\n", #> "bindings in ", list(".env"), ". This is equivalent to\n", #> list(list("base::makeActiveBinding()")), #> ". An active binding executes a\n", "function each time it is evaluated. The arguments are passed to\n", #> list(list("as_function()")), " so you can supply formulas instead of functions.\n", #> "\n", "Remember that functions are scoped in their own environment.\n", #> "These functions can thus refer to symbols from this enclosure\n", #> "that are not actually in scope in the dynamic environment where\n", #> "the active bindings are invoked. This allows creative solutions\n", #> "to difficult problems (see the implementations of ", #> list("dplyr::do()"), "\n", "methods for an example).\n", #> list(), " ", list("env_bind_lazy()"), " takes named ", #> list("expressions"), ". This is equivalent\n", #> "to ", list(list("base::delayedAssign()")), #> ". The arguments are captured with\n", list( #> list("exprs()")), " (and thus support call-splicing and unquoting) and\n", #> "assigned to symbols in ", list(".env"), #> ". These expressions are not\n", "evaluated immediately but lazily. Once a symbol is evaluated, the\n", #> "corresponding expression is evaluated in turn and its value is\n", #> "bound to the symbol (the expressions are thus evaluated only\n", #> "once, if at all).\n", list(), " ", list( #> "%<~%"), " is a shortcut for ", list("env_bind_lazy()"), #> ". It works like ", list("<-"), "\n", "but the RHS is evaluated lazily.\n"), #> "\n"), "\n", list(list("Side effects"), list( #> "\n", "\n", "\n", "Since environments have reference semantics (see relevant section\n", #> "in ", list(list("env()")), " documentation), modifying the bindings of an environment\n", #> "produces effects in all other references to that environment. In\n", #> "other words, ", list("env_bind()"), " and its variants have side effects.\n", #> "\n", "Like other side-effecty functions like ", #> list("par()"), " and ", list("options()"), #> ",\n", list("env_bind()"), " and variants return the old values invisibly.\n")), #> "\n", "\n", list(list("Life cycle"), list("\n", #> "\n", "\n", "Passing an environment wrapper like a formula or a function instead\n", #> "of an environment is soft-deprecated as of rlang 0.3.0. This\n", #> "internal genericity was causing confusion (see issue #427). You\n", #> "should now extract the environment separately before calling these\n", #> "functions.\n")), "\n", "\n", list("\n", "# env_bind() is a programmatic way of assigning values to symbols\n", #> "# with `<-`. We can add bindings in the current environment:\n", #> "env_bind(current_env(), foo = \"bar\")\n", #> "foo\n", "\n", "# Or modify those bindings:\n", #> "bar <- \"bar\"\n", "env_bind(current_env(), bar = \"BAR\")\n", #> "bar\n", "\n", "# You can remove bindings by supplying zap sentinels:\n", #> "env_bind(current_env(), foo = zap())\n", "try(foo)\n", #> "\n", "# Unquote-splice a named list of zaps\n", #> "zaps <- rep_named(c(\"foo\", \"bar\"), list(zap()))\n", #> "env_bind(current_env(), !!!zaps)\n", "try(bar)\n", #> "\n", "# It is most useful to change other environments:\n", #> "my_env <- env()\n", "env_bind(my_env, foo = \"foo\")\n", #> "my_env$foo\n", "\n", "# A useful feature is to splice lists of named values:\n", #> "vals <- list(a = 10, b = 20)\n", "env_bind(my_env, !!!vals, c = 30)\n", #> "my_env$b\n", "my_env$c\n", "\n", "# You can also unquote a variable referring to a symbol or a string\n", #> "# as binding name:\n", "var <- \"baz\"\n", #> "env_bind(my_env, !!var := \"BAZ\")\n", "my_env$baz\n", #> "\n", "\n", "# The old values of the bindings are returned invisibly:\n", #> "old <- env_bind(my_env, a = 1, b = 2, baz = \"baz\")\n", #> "old\n", "\n", "# You can restore the original environment state by supplying the\n", #> "# old values back:\n", "env_bind(my_env, !!!old)\n", #> "\n", "# env_bind_lazy() assigns expressions lazily:\n", #> "env <- env()\n", "env_bind_lazy(env, name = { cat(\"forced!\\n\"); \"value\" })\n", #> "\n", "# Referring to the binding will cause evaluation:\n", #> "env$name\n", "\n", "# But only once, subsequent references yield the final value:\n", #> "env$name\n", "\n", "# You can unquote expressions:\n", #> "expr <- quote(message(\"forced!\"))\n", "env_bind_lazy(env, name = !!expr)\n", #> "env$name\n", "\n", "\n", "# By default the expressions are evaluated in the current\n", #> "# environment. For instance we can create a local binding and refer\n", #> "# to it, even though the variable is bound in a different\n", #> "# environment:\n", "who <- \"mickey\"\n", #> "env_bind_lazy(env, name = paste(who, \"mouse\"))\n", #> "env$name\n", "\n", "# You can specify another evaluation environment with `.eval_env`:\n", #> "eval_env <- env(who = \"minnie\")\n", "env_bind_lazy(env, name = paste(who, \"mouse\"), .eval_env = eval_env)\n", #> "env$name\n", "\n", "# Or by unquoting a quosure:\n", #> "quo <- local({\n", " who <- \"fievel\"\n", #> " quo(paste(who, \"mouse\"))\n", "})\n", "env_bind_lazy(env, name = !!quo)\n", #> "env$name\n", "\n", "# You can create active bindings with env_bind_active(). Active\n", #> "# bindings execute a function each time they are evaluated:\n", #> "fn <- function() {\n", " cat(\"I have been called\\n\")\n", #> " rnorm(1)\n", "}\n", "\n", "env <- env()\n", #> "env_bind_active(env, symbol = fn)\n", "\n", #> "# `fn` is executed each time `symbol` is evaluated or retrieved:\n", #> "env$symbol\n", "env$symbol\n", "eval_bare(quote(symbol), env)\n", #> "eval_bare(quote(symbol), env)\n", "\n", "# All arguments are passed to as_function() so you can use the\n", #> "# formula shortcut:\n", "env_bind_active(env, foo = ~ runif(1))\n", #> "env$foo\n", "env$foo\n"), "\n", list("\n", #> list(list("env_poke()")), " for binding a single element.\n"), #> "\n"), env_bind_exprs.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("env_bind_exprs"), "\n", list("env_bind_exprs"), #> "\n", list("env_bind_fns"), "\n", list("Bind a promise or active binding"), #> "\n", list("\n", "env_bind_exprs(.env, ..., .eval_env = caller_env())\n", #> "\n", "env_bind_fns(.env, ...)\n"), "\n", list( #> "\n", list(list(".env"), list("An environment.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> Named objects (", list("env_bind()"), #> "),\n", "expressions ", list("env_bind_lazy()"), #> ", or functions (", list("env_bind_active()"), #> ").\n", "Use ", list(list("zap()")), " to remove bindings.")), #> "\n", "\n", list(list(".eval_env"), list("The environment where the expressions will be\n", #> "evaluated when the symbols are forced.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "As of rlang 0.3.0, ", list("env_bind_exprs()"), #> " and ", list("env_bind_fns()"), " have\n", #> "been renamed to ", list(list("env_bind_lazy()")), #> " and ", list(list("env_bind_active()")), " for\n", #> "consistency.\n"), "\n", list("internal"), #> "\n"), env_binding_are_active.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_binding_are_active"), "\n", list( #> "env_binding_are_active"), "\n", list("env_binding_are_lazy"), #> "\n", list("What kind of environment binding?"), #> "\n", list("\n", "env_binding_are_active(env, nms = NULL)\n", #> "\n", "env_binding_are_lazy(env, nms = NULL)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nms"), list("Names of bindings. Defaults to all bindings in ", #> list("env"), ".")), "\n"), "\n", list("\n", #> "A logical vector as long as ", list("nms"), #> " and named after it.\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"experimental\")"), #> "\n"), "\n", list("internal"), "\n"), env_binding_lock.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_binding_lock"), "\n", list("env_binding_lock"), #> "\n", list("env_binding_unlock"), "\n", list( #> "env_binding_are_locked"), "\n", list("Lock or unlock environment bindings"), #> "\n", list("\n", "env_binding_lock(env, nms = NULL)\n", #> "\n", "env_binding_unlock(env, nms = NULL)\n", #> "\n", "env_binding_are_locked(env, nms = NULL)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nms"), list("Names of bindings. Defaults to all bindings in ", #> list("env"), ".")), "\n"), "\n", list("\n", #> list("env_binding_are_unlocked()"), " returns a logical vector as\n", #> "long as ", list("nms"), " and named after it. ", #> list("env_binding_lock()"), " and\n", list( #> "env_binding_unlock()"), " return the old value of\n", #> list("env_binding_are_unlocked()"), " invisibly.\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "Locked environment bindings trigger an error when an attempt is\n", #> "made to redefine the binding.\n"), "\n", list( #> "\n", "# Bindings are unlocked by default:\n", #> "env <- env(a = \"A\", b = \"B\")\n", "env_binding_are_locked(env)\n", #> "\n", "# But can optionally be locked:\n", #> "env_binding_lock(env, \"a\")\n", "env_binding_are_locked(env)\n", #> "\n", "# If run, the following would now return an error because `a` is locked:\n", #> "# env_bind(env, a = \"foo\")\n", "# with_env(env, a <- \"bar\")\n", #> "\n", "# Let's unlock it. Note that the return value indicate which\n", #> "# bindings were locked:\n", "were_locked <- env_binding_unlock(env)\n", #> "were_locked\n", "\n", "# Now that it is unlocked we can modify it again:\n", #> "env_bind(env, a = \"foo\")\n", "with_env(env, a <- \"bar\")\n", #> "env$a\n"), "\n", list("\n", list(list("env_lock()")), #> " for locking an environment.\n"), "\n", list( #> "internal"), "\n"), env_browse.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_browse"), "\n", list("env_browse"), #> "\n", list("env_is_browsed"), "\n", list("Browse environments"), #> "\n", list("\n", "env_browse(env, value = TRUE)\n", #> "\n", "env_is_browsed(env)\n"), "\n", list( #> "\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("value"), list("Whether to browse ", #> list("env"), ".")), "\n"), "\n", list("\n", #> list("env_browse()"), " returns the previous value of\n", #> list("env_is_browsed()"), " (a logical), invisibly.\n"), #> "\n", list("\n", list("\n", list(), " ", list( #> "env_browse(env)"), " is equivalent to evaluating ", #> list("browser()"), " in\n", list("env"), ". It persistently sets the environment for step-debugging.\n", #> "Supply ", list("value = FALSE"), " to disable browsing.\n", #> list(), " ", list("env_is_browsed()"), " is a predicate that inspects whether an\n", #> "environment is being browsed.\n"), "\n"), #> "\n"), env_bury.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("env_bury"), "\n", list("env_bury"), #> "\n", list("Mask bindings by defining symbols deeper in a scope"), #> "\n", list("\n", "env_bury(.env, ...)\n"), "\n", #> list("\n", list(list(".env"), list("An environment.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> Named objects (", list("env_bind()"), #> "),\n", "expressions ", list("env_bind_lazy()"), #> ", or functions (", list("env_bind_active()"), #> ").\n", "Use ", list(list("zap()")), " to remove bindings.")), #> "\n"), "\n", list("\n", "A copy of ", list( #> ".env"), " enclosing the new environment containing\n", #> "bindings to ", list("..."), " arguments.\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"superseded\")"), #> "\n", "\n", "This function is superseded. Please use ", #> list(list("env()")), " (and possibly\n", list( #> list("set_env()")), " if you're masking the bindings for another object like\n", #> "a closure or a formula) instead.\n", "\n", #> list("env_bury()"), " is like ", list(list( #> "env_bind()")), " but it creates the bindings in a\n", #> "new child environment. This makes sure the new bindings have\n", #> "precedence over old ones, without altering existing environments.\n", #> "Unlike ", list("env_bind()"), ", this function does not have side effects and\n", #> "returns a new environment (or object wrapping that environment).\n"), #> "\n", list("\n", "orig_env <- env(a = 10)\n", #> "fn <- set_env(function() a, orig_env)\n", #> "\n", "# fn() currently sees `a` as the value `10`:\n", #> "fn()\n", "\n", "# env_bury() will bury the current scope of fn() behind a new\n", #> "# environment:\n", "fn <- env_bury(fn, a = 1000)\n", #> "fn()\n", "\n", "# Even though the symbol `a` is still defined deeper in the scope:\n", #> "orig_env$a\n"), "\n", list("\n", list(list( #> "env_bind()")), ", ", list(list("env_unbind()")), #> "\n"), "\n", list("internal"), "\n"), env_clone.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_clone"), "\n", list("env_clone"), #> "\n", list("Clone an environment"), "\n", list( #> "\n", "env_clone(env, parent = env_parent(env))\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("parent"), list("The parent of the cloned environment.")), #> "\n"), "\n", list("\n", "This creates a new environment containing exactly the same objects,\n", #> "optionally with a new parent.\n"), "\n", list( #> "\n", "env <- env(!!! mtcars)\n", "clone <- env_clone(env)\n", #> "identical(env, clone)\n", "identical(env$cyl, clone$cyl)\n"), #> "\n"), env_depth.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_depth"), "\n", list("env_depth"), #> "\n", list("Depth of an environment chain"), #> "\n", list("\n", "env_depth(env)\n"), "\n", list( #> "\n", list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "An integer.\n"), "\n", #> list("\n", "This function returns the number of environments between ", #> list("env"), " and\n", "the ", list("empty environment"), #> ", including ", list("env"), ". The depth of\n", #> list("env"), " is also the number of parents of ", #> list("env"), " (since the empty\n", "environment counts as a parent).\n"), #> "\n", list("\n", "env_depth(empty_env())\n", #> "env_depth(pkg_env(\"rlang\"))\n"), "\n", list( #> "\n", "The section on inheritance in ", list( #> list("env()")), " documentation.\n"), "\n"), #> env_get.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_get"), "\n", list("env_get"), #> "\n", list("env_get_list"), "\n", list("Get an object in an environment"), #> "\n", list("\n", "env_get(env = caller_env(), nm, default, inherit = FALSE)\n", #> "\n", "env_get_list(env = caller_env(), nms, default, inherit = FALSE)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nm, nms"), list("Names of bindings. ", #> list("nm"), " must be a single string.")), #> "\n", "\n", list(list("default"), list("A default value in case there is no binding for ", #> list("nm"), "\n", "in ", list("env"), ".")), #> "\n", "\n", list(list("inherit"), list("Whether to look for bindings in the parent\n", #> "environments.")), "\n"), "\n", list("\n", #> "An object if it exists. Otherwise, throws an error.\n"), #> "\n", list("\n", list("env_get()"), " extracts an object from an enviroment ", #> list("env"), ". By\n", "default, it does not look in the parent environments.\n", #> list("env_get_list()"), " extracts multiple objects from an environment into\n", #> "a named list.\n"), "\n", list("\n", "parent <- child_env(NULL, foo = \"foo\")\n", #> "env <- child_env(parent, bar = \"bar\")\n", #> "\n", "# This throws an error because `foo` is not directly defined in env:\n", #> "# env_get(env, \"foo\")\n", "\n", "# However `foo` can be fetched in the parent environment:\n", #> "env_get(env, \"foo\", inherit = TRUE)\n", #> "\n", "# You can also avoid an error by supplying a default value:\n", #> "env_get(env, \"foo\", default = \"FOO\")\n"), #> "\n"), env_has.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_has"), "\n", list("env_has"), #> "\n", list("Does an environment have or see bindings?"), #> "\n", list("\n", "env_has(env = caller_env(), nms, inherit = FALSE)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nms"), list("A character vector of binding names for which to check\n", #> "existence.")), "\n", "\n", list(list("inherit"), #> list("Whether to look for bindings in the parent\n", #> "environments.")), "\n"), "\n", list("\n", #> "A named logical vector as long as ", list( #> "nms"), ".\n"), "\n", list("\n", list("env_has()"), #> " is a vectorised predicate that queries whether an\n", #> "environment owns bindings personally (with ", #> list("inherit"), " set to\n", list("FALSE"), #> ", the default), or sees them in its own environment or in\n", #> "any of its parents (with ", list("inherit = TRUE"), #> ").\n"), "\n", list("\n", "parent <- child_env(NULL, foo = \"foo\")\n", #> "env <- child_env(parent, bar = \"bar\")\n", #> "\n", "# env does not own `foo` but sees it in its parent environment:\n", #> "env_has(env, \"foo\")\n", "env_has(env, \"foo\", inherit = TRUE)\n"), #> "\n"), env_inherits.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_inherits"), "\n", list("env_inherits"), #> "\n", list("Does environment inherit from another environment?"), #> "\n", list("\n", "env_inherits(env, ancestor)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("ancestor"), list("Another environment from which ", #> list("x"), " might inherit.")), "\n"), "\n", #> list("\n", "This returns ", list("TRUE"), " if ", #> list("x"), " has ", list("ancestor"), " among its parents.\n"), #> "\n"), env_lock.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_lock"), "\n", list("env_lock"), #> "\n", list("env_is_locked"), "\n", list("Lock an environment"), #> "\n", list("\n", "env_lock(env)\n", "\n", "env_is_locked(env)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "The old value of ", #> list("env_is_locked()"), " invisibly.\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "Locked environments cannot be modified. An important example is\n", #> "namespace environments which are locked by R when loaded in a\n", #> "session. Once an environment is locked it normally cannot be\n", #> "unlocked.\n", "\n", "Note that only the environment as a container is locked, not the\n", #> "individual bindings. You can't remove or add a binding but you can\n", #> "still modify the values of existing bindings. See\n", #> list(list("env_binding_lock()")), " for locking individual bindings.\n"), #> "\n", list("\n", "# New environments are unlocked by default:\n", #> "env <- env(a = 1)\n", "env_is_locked(env)\n", #> "\n", "# Use env_lock() to lock them:\n", "env_lock(env)\n", #> "env_is_locked(env)\n", "\n", "# Now that `env` is locked, it is no longer possible to remove or\n", #> "# add bindings. If run, the following would fail:\n", #> "# env_unbind(env, \"a\")\n", "# env_bind(env, b = 2)\n", #> "\n", "# Note that even though the environment as a container is locked,\n", #> "# the individual bindings are still unlocked and can be modified:\n", #> "env$a <- 10\n"), "\n", list("\n", list(list( #> "env_binding_lock()")), "\n"), "\n", list("internal"), #> "\n"), env_name.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("env_name"), "\n", list("env_name"), #> "\n", list("env_label"), "\n", list("Label of an environment"), #> "\n", list("\n", "env_name(env)\n", "\n", "env_label(env)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "Special environments like the global environment have their own\n", #> "names. ", list("env_name()"), " returns:\n", #> list("\n", list(), " \"global\" for the global environment.\n", #> list(), " \"empty\" for the empty environment.\n", #> list(), " \"base\" for the base package environment (the last environment on\n", #> "the search path).\n", list(), " \"namespace:pkg\" if ", #> list("env"), " is the namespace of the package \"pkg\".\n", #> list(), " The ", list("name"), " attribute of ", #> list("env"), " if it exists. This is how the\n", #> list("package environments"), " and the ", #> list("imports environments"), " store their names. The name of package\n", #> "environments is typically \"package:pkg\".\n", #> list(), " The empty string ", list("\"\""), #> " otherwise.\n"), "\n", "\n", list("env_label()"), #> " is exactly like ", list("env_name()"), " but returns the memory\n", #> "address of anonymous environments as fallback.\n"), #> "\n", list("\n", "# Some environments have specific names:\n", #> "env_name(global_env())\n", "env_name(ns_env(\"rlang\"))\n", #> "\n", "# Anonymous environments don't have names but are labelled by their\n", #> "# address in memory:\n", "env_name(env())\n", #> "env_label(env())\n"), "\n"), env_names.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_names"), "\n", list("env_names"), #> "\n", list("env_length"), "\n", list("Names and numbers of symbols bound in an environment"), #> "\n", list("\n", "env_names(env)\n", "\n", "env_length(env)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "A character vector of object names.\n"), #> "\n", list("\n", list("env_names()"), " returns object names from an enviroment ", #> list("env"), " as a\n", "character vector. All names are returned, even those starting with\n", #> "a dot. ", list("env_length()"), " returns the number of bindings.\n"), #> "\n", list(list("Names of symbols and objects"), #> list("\n", "\n", "\n", "Technically, objects are bound to symbols rather than strings,\n", #> "since the R interpreter evaluates symbols (see ", #> list(list("is_expression()")), " for a\n", #> "discussion of symbolic objects versus literal objects). However it\n", #> "is often more convenient to work with strings. In rlang\n", #> "terminology, the string corresponding to a symbol is called the\n", #> list("name"), " of the symbol (or by extension the name of an object bound\n", #> "to a symbol).\n")), "\n", "\n", list(list( #> "Encoding"), list("\n", "\n", "\n", "There are deep encoding issues when you convert a string to symbol\n", #> "and vice versa. Symbols are ", list("always"), #> " in the native encoding. If\n", "that encoding (let's say latin1) cannot support some characters,\n", #> "these characters are serialised to ASCII. That's why you sometimes\n", #> "see strings looking like ", list("<U+1234>"), #> ", especially if you're running\n", "Windows (as R doesn't support UTF-8 as native encoding on that\n", #> "platform).\n", "\n", "To alleviate some of the encoding pain, ", #> list("env_names()"), " always\n", "returns a UTF-8 character vector (which is fine even on Windows)\n", #> "with ASCII unicode points translated back to UTF-8.\n")), #> "\n", "\n", list("\n", "env <- env(a = 1, b = 2)\n", #> "env_names(env)\n"), "\n"), env_parent.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_parent"), "\n", list("env_parent"), #> "\n", list("env_tail"), "\n", list("env_parents"), #> "\n", list("Get parent environments"), "\n", #> list("\n", "env_parent(env = caller_env(), n = 1)\n", #> "\n", "env_tail(env = caller_env(), last = global_env())\n", #> "\n", "env_parents(env = caller_env(), last = global_env())\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("n"), list("The number of generations to go up.")), #> "\n", "\n", list(list("last"), list("The environment at which to stop. Defaults to the\n", #> "global environment. The empty environment is always a stopping\n", #> "condition so it is safe to leave the default even when taking the\n", #> "tail or the parents of an environment on the search path.\n", #> "\n", list("env_tail()"), " returns the environment which has ", #> list("last"), " as parent\n", "and ", list( #> "env_parents()"), " returns the list of environments up to ", #> list("last"), ".")), "\n"), "\n", list("\n", #> "An environment for ", list("env_parent()"), #> " and ", list("env_tail()"), ", a list\n", #> "of environments for ", list("env_parents()"), #> ".\n"), "\n", list("\n", list("\n", list(), #> " ", list("env_parent()"), " returns the parent environment of ", #> list("env"), " if called\n", "with ", list( #> "n = 1"), ", the grandparent with ", list( #> "n = 2"), ", etc.\n", list(), " ", list("env_tail()"), #> " searches through the parents and returns the one\n", #> "which has ", list(list("empty_env()")), " as parent.\n", #> list(), " ", list("env_parents()"), " returns the list of all parents, including the\n", #> "empty environment. This list is named using ", #> list(list("env_name()")), ".\n"), "\n", "\n", #> "See the section on ", list("inheritance"), #> " in ", list(list("env()")), "'s documentation.\n"), #> "\n", list("\n", "# Get the parent environment with env_parent():\n", #> "env_parent(global_env())\n", "\n", "# Or the tail environment with env_tail():\n", #> "env_tail(global_env())\n", "\n", "# By default, env_parent() returns the parent environment of the\n", #> "# current evaluation frame. If called at top-level (the global\n", #> "# frame), the following two expressions are equivalent:\n", #> "env_parent()\n", "env_parent(base_env())\n", #> "\n", "# This default is more handy when called within a function. In this\n", #> "# case, the enclosure environment of the function is returned\n", #> "# (since it is the parent of the evaluation frame):\n", #> "enclos_env <- env()\n", "fn <- set_env(function() env_parent(), enclos_env)\n", #> "identical(enclos_env, fn())\n"), "\n"), env_poke.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_poke"), "\n", list("env_poke"), #> "\n", list("Poke an object in an environment"), #> "\n", list("\n", "env_poke(env = caller_env(), nm, value, inherit = FALSE, create = !inherit)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nm"), list("Names of bindings. ", #> list("nm"), " must be a single string.")), #> "\n", "\n", list(list("value"), list("The value for a new binding.")), #> "\n", "\n", list(list("inherit"), list("Whether to look for bindings in the parent\n", #> "environments.")), "\n", "\n", list(list( #> "create"), list("Whether to create a binding if it does not already\n", #> "exist in the environment.")), "\n"), "\n", #> list("\n", "The old value of ", list("nm"), " or a ", #> list("zap sentinel"), " if the\n", "binding did not exist yet.\n"), #> "\n", list("\n", list("env_poke()"), " will assign or reassign a binding in ", #> list("env"), " if ", list("create"), "\n", #> "is ", list("TRUE"), ". If ", list("create"), #> " is ", list("FALSE"), " and a binding does not already\n", #> "exists, an error is issued.\n"), "\n", list( #> "\n", "If ", list("inherit"), " is ", list( #> "TRUE"), ", the parents environments are checked for\n", #> "an existing binding to reassign. If not found and ", #> list("create"), " is\n", list("TRUE"), ", a new binding is created in ", #> list("env"), ". The default value for\n", list( #> "create"), " is a function of ", list("inherit"), #> ": ", list("FALSE"), " when inheriting,\n", #> list("TRUE"), " otherwise.\n", "\n", "This default makes sense because the inheriting case is mostly\n", #> "for overriding an existing binding. If not found, something\n", #> "probably went wrong and it is safer to issue an error. Note that\n", #> "this is different to the base R operator ", #> list("<<-"), " which will create\n", "a binding in the global environment instead of the current\n", #> "environment when no existing binding is found in the parents.\n"), #> "\n", list("\n", list(list("env_bind()")), " for binding multiple elements.\n"), #> "\n"), env_print.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_print"), "\n", list("env_print"), #> "\n", list("Pretty-print an environment"), "\n", #> list("\n", "env_print(env = caller_env())\n"), #> "\n", list("\n", list(list("env"), list("An environment, or object that can be converted to an\n", #> "environment by ", list(list("get_env()")), #> ".")), "\n"), "\n", list("\n", "This prints:\n", #> list("\n", list(), " The ", list("label"), #> " and the parent label.\n", list(), " Whether the environment is ", #> list("locked"), ".\n", list(), " The bindings in the environment (up to 20 bindings). They are\n", #> "printed succintly using ", list("pillar::type_sum()"), #> " (if available,\n", "otherwise uses an internal version of that generic). In addition\n", #> list("fancy bindings"), " (actives and promises) are\n", #> "indicated as such.\n", list(), " Locked bindings get a ", #> list("[L]"), " tag\n"), "\n", "\n", "Note that printing a package namespace (see ", #> list(list("ns_env()")), ") with\n", list("env_print()"), #> " will typically tag function bindings as ", #> list("<lazy>"), "\n", "until they are evaluated the first time. This is because package\n", #> "functions are lazily-loaded from disk to improve performance when\n", #> "loading a package.\n"), "\n"), env_unbind.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_unbind"), "\n", list("env_unbind"), #> "\n", list("Remove bindings from an environment"), #> "\n", list("\n", "env_unbind(env = caller_env(), nms, inherit = FALSE)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nms"), list("A character vector of binding names to remove.")), #> "\n", "\n", list(list("inherit"), list("Whether to look for bindings in the parent\n", #> "environments.")), "\n"), "\n", list("\n", #> "The input object ", list("env"), " with its associated environment\n", #> "modified in place, invisibly.\n"), "\n", list( #> "\n", list("env_unbind()"), " is the complement of ", #> list(list("env_bind()")), ". Like ", list("env_has()"), #> ",\n", "it ignores the parent environments of ", #> list("env"), " by default. Set\n", list("inherit"), #> " to ", list("TRUE"), " to track down bindings in parent environments.\n"), #> "\n", list("\n", "env <- env(foo = 1, bar = 2)\n", #> "env_has(env, c(\"foo\", \"bar\"))\n", "\n", #> "# Remove bindings with `env_unbind()`\n", #> "env_unbind(env, c(\"foo\", \"bar\"))\n", "env_has(env, c(\"foo\", \"bar\"))\n", #> "\n", "# With inherit = TRUE, it removes bindings in parent environments\n", #> "# as well:\n", "parent <- env(empty_env(), foo = 1, bar = 2)\n", #> "env <- env(parent, foo = \"b\")\n", "\n", #> "env_unbind(env, \"foo\", inherit = TRUE)\n", #> "env_has(env, c(\"foo\", \"bar\"))\n", "env_has(env, c(\"foo\", \"bar\"), inherit = TRUE)\n"), #> "\n"), env_unlock.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_unlock"), "\n", list("env_unlock"), #> "\n", list("Unlock an environment"), "\n", list( #> "\n", "env_unlock(env)\n"), "\n", list("\n", #> list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "Whether the environment has been unlocked.\n"), #> "\n", list("\n", "This function should only be used in development tools or\n", #> "interactively.\n"), "\n", list("internal"), #> "\n"), eval_bare.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval.R", #> "\n", list("eval_bare"), "\n", list("eval_bare"), #> "\n", list("Evaluate an expression in an environment"), #> "\n", list("\n", "eval_bare(expr, env = parent.frame())\n"), #> "\n", list("\n", list(list("expr"), list("An expression to evaluate.")), #> "\n", "\n", list(list("env"), list("The environment in which to evaluate the expression.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", list("eval_bare()"), " is a lower-level version of function ", #> list(list("base::eval()")), ".\n", "Technically, it is a simple wrapper around the C function\n", #> list("Rf_eval()"), ". You generally don't need to use ", #> list("eval_bare()"), " instead\n", "of ", list( #> "eval()"), ". Its main advantage is that it handles stack-sensitive\n", #> "(calls such as ", list("return()"), ", ", #> list("on.exit()"), " or ", list("parent.frame()"), #> ") more\n", "consistently when you pass an enviroment of a frame on the call\n", #> "stack.\n"), "\n", list("\n", "These semantics are possible because ", #> list("eval_bare()"), " creates only one\n", #> "frame on the call stack whereas ", list("eval()"), #> " creates two frames, the\n", "second of which has the user-supplied environment as frame\n", #> "environment. When you supply an existing frame environment to\n", #> list("base::eval()"), " there will be two frames on the stack with the same\n", #> "frame environment. Stack-sensitive functions only detect the\n", #> "topmost of these frames. We call these evaluation semantics\n", #> "\"stack inconsistent\".\n", "\n", "Evaluating expressions in the actual frame environment has useful\n", #> "practical implications for ", list("eval_bare()"), #> ":\n", list("\n", list(), " ", list("return()"), #> " calls are evaluated in frame environments that might\n", #> "be burried deep in the call stack. This causes a long return that\n", #> "unwinds multiple frames (triggering the ", #> list("on.exit()"), " event for\n", "each frame). By contrast ", #> list("eval()"), " only returns from the ", #> list("eval()"), "\n", "call, one level up.\n", #> list(), " ", list("on.exit()"), ", ", list( #> "parent.frame()"), ", ", list("sys.call()"), #> ", and generally all\n", "the stack inspection functions ", #> list("sys.xxx()"), " are evaluated in the\n", #> "correct frame environment. This is similar to how this type of\n", #> "calls can be evaluated deep in the call stack because of lazy\n", #> "evaluation, when you force an argument that has been passed\n", #> "around several times.\n"), "\n", "\n", "The flip side of the semantics of ", #> list("eval_bare()"), " is that it can't\n", #> "evaluate ", list("break"), " or ", list("next"), #> " expressions even if called within a\n", "loop.\n"), #> "\n", list("\n", "# eval_bare() works just like base::eval() but you have to create\n", #> "# the evaluation environment yourself:\n", #> "eval_bare(quote(foo), env(foo = \"bar\"))\n", #> "\n", "# eval() has different evaluation semantics than eval_bare(). It\n", #> "# can return from the supplied environment even if its an\n", #> "# environment that is not on the call stack (i.e. because you've\n", #> "# created it yourself). The following would trigger an error with\n", #> "# eval_bare():\n", "ret <- quote(return(\"foo\"))\n", #> "eval(ret, env())\n", "# eval_bare(ret, env()) # \"no function to return from\" error\n", #> "\n", "# Another feature of eval() is that you can control surround loops:\n", #> "bail <- quote(break)\n", "while (TRUE) {\n", #> " eval(bail)\n", " # eval_bare(bail) # \"no loop for break/next\" error\n", #> "}\n", "\n", "# To explore the consequences of stack inconsistent semantics, let's\n", #> "# create a function that evaluates `parent.frame()` deep in the call\n", #> "# stack, in an environment corresponding to a frame in the middle of\n", #> "# the stack. For consistency with R's lazy evaluation semantics, we'd\n", #> "# expect to get the caller of that frame as result:\n", #> "fn <- function(eval_fn) {\n", " list(\n", #> " returned_env = middle(eval_fn),\n", " actual_env = current_env()\n", #> " )\n", "}\n", "middle <- function(eval_fn) {\n", #> " deep(eval_fn, current_env())\n", "}\n", #> "deep <- function(eval_fn, eval_env) {\n", #> " expr <- quote(parent.frame())\n", " eval_fn(expr, eval_env)\n", #> "}\n", "\n", "# With eval_bare(), we do get the expected environment:\n", #> "fn(rlang::eval_bare)\n", "\n", "# But that's not the case with base::eval():\n", #> "fn(base::eval)\n"), "\n", list("\n", list( #> list("eval_tidy()")), " for evaluation with data mask and quosure\n", #> "support.\n"), "\n"), eval_tidy.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval-tidy.R", #> "\n", list("eval_tidy"), "\n", list("eval_tidy"), #> "\n", list("Evaluate an expression with quosures and pronoun support"), #> "\n", list("\n", "eval_tidy(expr, data = NULL, env = caller_env())\n"), #> "\n", list("\n", list(list("expr"), list("An expression or quosure to evaluate.")), #> "\n", "\n", list(list("data"), list("A data frame, or named list or vector. Alternatively, a\n", #> "data mask created with ", list(list("as_data_mask()")), #> " or\n", list(list("new_data_mask()")), ". Objects in ", #> list("data"), " have priority over those in\n", #> list("env"), ". See the section about data masking.")), #> "\n", "\n", list(list("env"), list("The environment in which to evaluate ", #> list("expr"), ". This\n", "environment is not applicable for quosures because they have\n", #> "their own environments.")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", list("eval_tidy()"), " is a variant of ", #> list(list("base::eval()")), " that powers the tidy\n", #> "evaluation framework. Like ", list("eval()"), #> " it accepts user data as\n", "argument. Whereas ", #> list("eval()"), " simply transforms the data to an\n", #> "environment, ", list("eval_tidy()"), " transforms it to a ", #> list("data mask"), " with\n", list(list("as_data_mask()")), #> ". Evaluating in a data mask enables the following\n", #> "features:\n", list("\n", list(), " ", list( #> "Quosures"), ". Quosures are expressions bundled with an\n", #> "environment. If ", list("data"), " is supplied, objects in the data mask\n", #> "always have precedence over the quosure environment, i.e. the\n", #> "data masks the environment.\n", list(), #> " ", list("Pronouns"), ". If ", list("data"), #> " is supplied, the ", list(".env"), " and ", #> list(".data"), "\n", "pronouns are installed in the data mask. ", #> list(".env"), " is a reference to\n", "the calling environment and ", #> list(".data"), " refers to the ", list("data"), #> " argument.\n", "These pronouns lets you be explicit about where to find\n", #> "values and throw errors if you try to access non-existent values.\n"), #> "\n"), "\n", list(list("Data masking"), list( #> "\n", "\n", "\n", "Data masking refers to how columns or objects inside ", #> list("data"), " have\n", "priority over objects defined in ", #> list("env"), " (or in the quosure\n", "environment, if applicable). If there is a column ", #> list("var"), " in ", list("data"), "\n", "and an object ", #> list("var"), " in ", list("env"), ", and ", #> list("expr"), " refers to ", list("var"), ", the\n", #> "column has priority:", list("var <- \"this one?\"\n", #> "data <- data.frame(var = rep(\"Or that one?\", 3))\n", #> "\n", "within <- function(data, expr) {\n", #> " eval_tidy(enquo(expr), data)\n", "}\n", #> "\n", "within(data, toupper(var))\n", "#> [1] \"OR THAT ONE?\" \"OR THAT ONE?\" \"OR THAT ONE?\"\n"), #> "\n", "\n", "Because the columns or objects in ", #> list("data"), " are always found first,\n", #> "before objects from ", list("env"), ", we say that the data \"masks\" the\n", #> "environment.\n")), "\n", "\n", list(list("When should eval_tidy() be used instead of eval()?"), #> list("\n", "\n", "\n", list("base::eval()"), #> " is sufficient for simple evaluation. Use\n", #> list("eval_tidy()"), " when you'd like to support expressions referring to\n", #> "the ", list(".data"), " pronoun, or when you need to support quosures.\n", #> "\n", "If you're evaluating an expression captured with quasiquotation\n", #> "support, it is recommended to use ", list( #> "eval_tidy()"), " because users will\n", #> "likely unquote quosures.\n", "\n", "Note that unwrapping a quosure with ", #> list(list("quo_get_expr()")), " does not\n", #> "guarantee that there is no quosures inside the expression. Quosures\n", #> "might be unquoted anywhere. For instance, the following does not\n", #> "work reliably in the presence of nested quosures:", #> list("my_quoting_fn <- function(x) {\n", #> " x <- enquo(x)\n", " expr <- quo_get_expr(x)\n", #> " env <- quo_get_env(x)\n", " eval(expr, env)\n", #> "}\n", "\n", "# Works:\n", "my_quoting_fn(toupper(letters))\n", #> "\n", "# Fails because of a nested quosure:\n", #> "my_quoting_fn(toupper(!!quo(letters)))\n"), #> "\n")), "\n", "\n", list(list("Stack semantics of ", #> list("eval_tidy()")), list("\n", "\n", "\n", #> list("eval_tidy()"), " always evaluates in a data mask, even when ", #> list("data"), " is\n", list("NULL"), ". Because of this, it has different stack semantics than\n", #> list(list("base::eval()")), ":\n", list("\n", #> list(), " Lexical side effects, such as assignment with ", #> list("<-"), ", occur in the\n", "mask rather than ", #> list("env"), ".\n", list(), " Functions that require the evaluation environment to correspond\n", #> "to a frame on the call stack do not work. This is why ", #> list("return()"), "\n", "called from a quosure does not work.\n", #> list(), " The mask environment creates a new branch in the tree\n", #> "representation of backtraces (which you can visualise in a\n", #> list(list("browser()")), " session with ", #> list("lobstr::cst()"), ").\n"), "\n", "\n", #> "See also ", list(list("eval_bare()")), " for more information about these differences.\n")), #> "\n", "\n", list(list("Life cycle"), list("\n", #> "\n", "\n", list("rlang 0.3.0"), "\n", "\n", #> "Passing an environment to ", list("data"), #> " is deprecated. Please construct an\n", "rlang data mask with ", #> list(list("new_data_mask()")), ".\n")), "\n", #> "\n", list("\n", "\n", "# With simple quoted expressions eval_tidy() works the same way as\n", #> "# eval():\n", "apple <- \"apple\"\n", "kiwi <- \"kiwi\"\n", #> "expr <- quote(paste(apple, kiwi))\n", "expr\n", #> "\n", "eval(expr)\n", "eval_tidy(expr)\n", #> "\n", "# Both accept a data mask as argument:\n", #> "data <- list(apple = \"CARROT\", kiwi = \"TOMATO\")\n", #> "eval(expr, data)\n", "eval_tidy(expr, data)\n", #> "\n", "\n", "# In addition eval_tidy() has support for quosures:\n", #> "with_data <- function(data, expr) {\n", " quo <- enquo(expr)\n", #> " eval_tidy(quo, data)\n", "}\n", "with_data(NULL, apple)\n", #> "with_data(data, apple)\n", "with_data(data, list(apple, kiwi))\n", #> "\n", "# Secondly eval_tidy() installs handy pronouns that allow users to\n", #> "# be explicit about where to find symbols:\n", #> "with_data(data, .data$apple)\n", "with_data(data, .env$apple)\n", #> "\n", "\n", "# Note that instead of using `.env` it is often equivalent and may\n", #> "# be preferred to unquote a value. There are two differences. First\n", #> "# unquoting happens earlier, when the quosure is created. Secondly,\n", #> "# subsetting `.env` with the `$` operator may be brittle because\n", #> "# `$` does not look through the parents of the environment.\n", #> "#\n", "# For instance using `.env$name` in a magrittr pipeline is an\n", #> "# instance where this poses problem, because the magrittr pipe\n", #> "# currently (as of v1.5.0) evaluates its operands in a *child* of\n", #> "# the current environment (this child environment is where it\n", #> "# defines the pronoun `.`).\n", list("\n", #> " data %>% with_data(!!kiwi) # \"kiwi\"\n", #> " data %>% with_data(.env$kiwi) # NULL\n"), #> "\n"), "\n", list("\n", list("nse-force"), #> " for the second leg of the tidy evaluation\n", #> "framework.\n"), "\n"), exec.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval.R", #> "\n", list("exec"), "\n", list("exec"), "\n", #> list("Execute a function"), "\n", list("\n", #> "exec(.fn, ..., .env = caller_env())\n"), "\n", #> list("\n", list(list(".fn"), list("A function, or function name as a string.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> Arguments for ", list(".fn"), #> ".")), "\n", "\n", list(list(".env"), list( #> "Environment in which to evaluate the call. This will be\n", #> "most useful if ", list("f"), " is a string, or the function has side-effects.")), #> "\n"), "\n", list("\n", "This function constructs and evaluates a call to ", #> list(".fn"), ".\n", "It has two primary uses:\n", #> list("\n", list(), " To call a function with arguments stored in a list (if the\n", #> "function doesn't support ", list("dynamic dots"), #> "). Splice the\n", "list of arguments with ", #> list("!!!"), ".\n", list(), " To call every function stored in a list (in conjunction with ", #> list("map()"), "/\n", list(list("lapply()")), #> ")\n"), "\n"), "\n", list("\n", "args <- list(x = c(1:10, 100, NA), na.rm = TRUE)\n", #> "exec(\"mean\", !!!args)\n", "exec(\"mean\", !!!args, trim = 0.2)\n", #> "\n", "fs <- list(a = function() \"a\", b = function() \"b\")\n", #> "lapply(fs, exec)\n", "\n", "# Compare to do.call it will not automatically inline expressions\n", #> "# into the evaluated call.\n", "x <- 10\n", #> "args <- exprs(x1 = x + 1, x2 = x * 2)\n", #> "exec(list, !!!args)\n", "do.call(list, args)\n", #> "\n", "# exec() is not designed to generate pretty function calls. This is\n", #> "# most easily seen if you call a function that captures the call:\n", #> "f <- disp ~ cyl\n", "exec(\"lm\", f, data = mtcars)\n", #> "\n", "# If you need finer control over the generated call, you'll need to\n", #> "# construct it yourself. This may require creating a new environment\n", #> "# with carefully constructed bindings\n", #> "data_env <- env(data = mtcars)\n", "eval(expr(lm(!!f, data)), data_env)\n"), #> "\n"), exiting.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("exiting"), "\n", list("exiting"), #> "\n", list("Exiting handler"), "\n", list("\n", #> "exiting(handler)\n"), "\n", list("\n", list( #> "rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", "\n", list("exiting()"), " is no longer necessary as handlers are exiting by default.\n"), #> "\n", list("internal"), "\n"), expr_interp.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/nse-force.R", #> "\n", list("expr_interp"), "\n", list("expr_interp"), #> "\n", list("Process unquote operators in a captured expression"), #> "\n", list("\n", "expr_interp(x, env = NULL)\n"), #> "\n", list("\n", list(list("x"), list("A function, raw expression, or formula to interpolate.")), #> "\n", "\n", list(list("env"), list("The environment in which unquoted expressions should be\n", #> "evaluated. By default, the formula or closure environment if a\n", #> "formula or a function, or the current environment otherwise.")), #> "\n"), "\n", list("\n", "While all capturing functions in the tidy evaluation framework\n", #> "perform unquote on capture (most notably ", #> list(list("quo()")), "),\n", list("expr_interp()"), #> " manually processes unquoting operators in\n", #> "expressions that are already captured. ", #> list("expr_interp()"), " should be\n", "called in all user-facing functions expecting a formula as argument\n", #> "to provide the same quasiquotation functionality as NSE functions.\n"), #> "\n", list("\n", "# All tidy NSE functions like quo() unquote on capture:\n", #> "quo(list(!!(1 + 2)))\n", "\n", "# expr_interp() is meant to provide the same functionality when you\n", #> "# have a formula or expression that might contain unquoting\n", #> "# operators:\n", "f <- ~list(!!(1 + 2))\n", #> "expr_interp(f)\n", "\n", "# Note that only the outer formula is unquoted (which is a reason\n", #> "# to use expr_interp() as early as possible in all user-facing\n", #> "# functions):\n", "f <- ~list(~!!(1 + 2), !!(1 + 2))\n", #> "expr_interp(f)\n", "\n", "\n", "# Another purpose for expr_interp() is to interpolate a closure's\n", #> "# body. This is useful to inline a function within another. The\n", #> "# important limitation is that all formal arguments of the inlined\n", #> "# function should be defined in the receiving function:\n", #> "other_fn <- function(x) toupper(x)\n", "\n", #> "fn <- expr_interp(function(x) {\n", " x <- paste0(x, \"_suffix\")\n", #> " !!! body(other_fn)\n", "})\n", "fn\n", "fn(\"foo\")\n"), #> "\n"), expr_label.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/expr.R", #> "\n", list("expr_label"), "\n", list("expr_label"), #> "\n", list("expr_name"), "\n", list("expr_text"), #> "\n", list("Turn an expression to a label"), #> "\n", list("\n", "expr_label(expr)\n", "\n", #> "expr_name(expr)\n", "\n", "expr_text(expr, width = 60L, nlines = Inf)\n"), #> "\n", list("\n", list(list("expr"), list("An expression to labellise.")), #> "\n", "\n", list(list("width"), list("Width of each line.")), #> "\n", "\n", list(list("nlines"), list("Maximum number of lines to extract.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", list("expr_text()"), " turns the expression into a single string, which\n", #> "might be multi-line. ", list("expr_name()"), #> " is suitable for formatting\n", "names. It works best with symbols and scalar types, but also\n", #> "accepts calls. ", list("expr_label()"), " formats the expression nicely for use\n", #> "in messages.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "These functions are in the questioning stage because they are\n", #> "redundant with the ", list("quo_"), " variants and do not handle quosures.\n")), #> "\n", "\n", list("\n", "# To labellise a function argument, first capture it with\n", #> "# substitute():\n", "fn <- function(x) expr_label(substitute(x))\n", #> "fn(x:y)\n", "\n", "# Strings are encoded\n", #> "expr_label(\"a\\nb\")\n", "\n", "# Names and expressions are quoted with ``\n", #> "expr_label(quote(x))\n", "expr_label(quote(a + b + c))\n", #> "\n", "# Long expressions are collapsed\n", #> "expr_label(quote(foo({\n", " 1 + 2\n", " print(x)\n", #> "})))\n"), "\n"), expr_print.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/expr.R", #> "\n", list("expr_print"), "\n", list("expr_print"), #> "\n", list("expr_deparse"), "\n", list("Print an expression"), #> "\n", list("\n", "expr_print(x, width = peek_option(\"width\"))\n", #> "\n", "expr_deparse(x, width = peek_option(\"width\"))\n"), #> "\n", list("\n", list(list("x"), list("An object or expression to print.")), #> "\n", "\n", list(list("width"), list("The width of the deparsed or printed expression.\n", #> "Defaults to the global option ", list("width"), #> ".")), "\n"), "\n", list("\n", list("expr_print()"), #> ", powered by ", list("expr_deparse()"), ", is an alternative\n", #> "printer for R expressions with a few improvements over the base R\n", #> "printer.\n", list("\n", list(), " It colourises ", #> list("quosures"), " according to their environment.\n", #> "Quosures from the global environment are printed normally while\n", #> "quosures from local environments are printed in unique colour (or\n", #> "in italic when all colours are taken).\n", #> list(), " It wraps inlined objects in angular brackets. For instance, an\n", #> "integer vector unquoted in a function call (e.g.\n", #> list("expr(foo(!!(1:3)))"), ") is printed like this: ", #> list("foo(<int: 1L, 2L, 3L>)"), " while by default R prints the code to create that vector:\n", #> list("foo(1:3)"), " which is ambiguous.\n", #> list(), " It respects the width boundary (from the global option ", #> list("width"), ")\n", "in more cases.\n"), #> "\n"), "\n", list("\n", "# It supports any object. Non-symbolic objects are always printed\n", #> "# within angular brackets:\n", "expr_print(1:3)\n", #> "expr_print(function() NULL)\n", "\n", "# Contrast this to how the code to create these objects is printed:\n", #> "expr_print(quote(1:3))\n", "expr_print(quote(function() NULL))\n", #> "\n", "# The main cause of non-symbolic objects in expressions is\n", #> "# quasiquotation:\n", "expr_print(expr(foo(!!(1:3))))\n", #> "\n", "\n", "# Quosures from the global environment are printed normally:\n", #> "expr_print(quo(foo))\n", "expr_print(quo(foo(!!quo(bar))))\n", #> "\n", "# Quosures from local environments are colourised according to\n", #> "# their environments (if you have crayon installed):\n", #> "local_quo <- local(quo(foo))\n", "expr_print(local_quo)\n", #> "\n", "wrapper_quo <- local(quo(bar(!!local_quo, baz)))\n", #> "expr_print(wrapper_quo)\n"), "\n"), exprs_auto_name.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/nse-defuse.R", #> "\n", list("exprs_auto_name"), "\n", list("exprs_auto_name"), #> "\n", list("quos_auto_name"), "\n", list("Ensure that all elements of a list of expressions are named"), #> "\n", list("\n", "exprs_auto_name(exprs, width = NULL, printer = NULL)\n", #> "\n", "quos_auto_name(quos, width = NULL)\n"), #> "\n", list("\n", list(list("exprs"), list("A list of expressions.")), #> "\n", "\n", list(list("width"), list("Deprecated. Maximum width of names.")), #> "\n", "\n", list(list("printer"), list("Deprecated. A function that takes an expression\n", #> "and converts it to a string. This function must take an\n", #> "expression as the first argument and ", #> list("width"), " as the second\n", "argument.")), #> "\n", "\n", list(list("quos"), list("A list of quosures.")), #> "\n"), "\n", list("\n", "This gives default names to unnamed elements of a list of\n", #> "expressions (or expression wrappers such as formulas or\n", #> "quosures). ", list("exprs_auto_name()"), " deparses the expressions with\n", #> list(list("expr_name()")), " by default. ", #> list("quos_auto_name()"), " deparses with\n", #> list(list("quo_name()")), ".\n"), "\n"), f_rhs.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/formula.R", #> "\n", list("f_rhs"), "\n", list("f_rhs"), "\n", #> list("f_rhs<-"), "\n", list("f_lhs"), "\n", list( #> "f_lhs<-"), "\n", list("f_env"), "\n", list( #> "f_env<-"), "\n", list("Get or set formula components"), #> "\n", list("\n", "f_rhs(f)\n", "\n", "f_rhs(x) <- value\n", #> "\n", "f_lhs(f)\n", "\n", "f_lhs(x) <- value\n", #> "\n", "f_env(f)\n", "\n", "f_env(x) <- value\n"), #> "\n", list("\n", list(list("f, x"), list("A formula")), #> "\n", "\n", list(list("value"), list("The value to replace with.")), #> "\n"), "\n", list("\n", list("f_rhs"), " and ", #> list("f_lhs"), " return language objects (i.e. atomic\n", #> "vectors of length 1, a name, or a call). ", #> list("f_env"), " returns an\n", "environment.\n"), #> "\n", list("\n", list("f_rhs"), " extracts the righthand side, ", #> list("f_lhs"), " extracts the lefthand\n", #> "side, and ", list("f_env"), " extracts the environment. All functions throw an\n", #> "error if ", list("f"), " is not a formula.\n"), #> "\n", list("\n", "f_rhs(~ 1 + 2 + 3)\n", "f_rhs(~ x)\n", #> "f_rhs(~ \"A\")\n", "f_rhs(1 ~ 2)\n", "\n", #> "f_lhs(~ y)\n", "f_lhs(x ~ y)\n", "\n", "f_env(~ x)\n"), #> "\n"), f_text.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/formula.R", #> "\n", list("f_text"), "\n", list("f_text"), "\n", #> list("f_name"), "\n", list("f_label"), "\n", #> list("Turn RHS of formula into a string or label"), #> "\n", list("\n", "f_text(x, width = 60L, nlines = Inf)\n", #> "\n", "f_name(x)\n", "\n", "f_label(x)\n"), #> "\n", list("\n", list(list("x"), list("A formula.")), #> "\n", "\n", list(list("width"), list("Width of each line.")), #> "\n", "\n", list(list("nlines"), list("Maximum number of lines to extract.")), #> "\n"), "\n", list("\n", "Equivalent of ", list( #> list("expr_text()")), " and ", list(list("expr_label()")), #> " for formulas.\n"), "\n", list("\n", "f <- ~ a + b + bc\n", #> "f_text(f)\n", "f_label(f)\n", "\n", "# Names a quoted with ``\n", #> "f_label(~ x)\n", "# Strings are encoded\n", #> "f_label(~ \"a\\nb\")\n", "# Long expressions are collapsed\n", #> "f_label(~ foo({\n", " 1 + 2\n", " print(x)\n", #> "}))\n"), "\n"), `faq-options.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/faq.R", #> "\n", list("faq-options"), "\n", list("faq-options"), #> "\n", list("Global options for rlang"), "\n", #> list("\n", "rlang has several options which may be set globally to control\n", #> "behavior. A brief description of each is given here. If any functions\n", #> "are referenced, refer to their documentation for additional details.\n", #> list("\n", list(), " ", list("rlang_interactive"), #> ": A logical value used by ", list(list("is_interactive()")), #> ". This\n", "can be set to ", list("TRUE"), #> " to test interactive behavior in unit tests,\n", #> "for example.\n", list(), " ", list("rlang_backtrace_on_error"), #> ": A character string which controls whether\n", #> "backtraces are displayed with error messages, and the level of\n", #> "detail they print. See ", list("rlang_backtrace_on_error"), #> " for the possible option values.\n", list(), #> " ", list("rlang_trace_format_srcrefs"), #> ": A logical value used to control whether\n", #> "srcrefs are printed as part of the backtrace.\n", #> list(), " ", list("rlang_trace_top_env"), #> ": An environment which will be treated as the\n", #> "top-level environment when printing traces. See ", #> list(list("trace_back()")), "\n", "for examples.\n"), #> "\n"), "\n"), flatten.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-squash.R", #> "\n", list("flatten"), "\n", list("flatten"), #> "\n", list("flatten_lgl"), "\n", list("flatten_int"), #> "\n", list("flatten_dbl"), "\n", list("flatten_cpl"), #> "\n", list("flatten_chr"), "\n", list("flatten_raw"), #> "\n", list("squash"), "\n", list("squash_lgl"), #> "\n", list("squash_int"), "\n", list("squash_dbl"), #> "\n", list("squash_cpl"), "\n", list("squash_chr"), #> "\n", list("squash_raw"), "\n", list("flatten_if"), #> "\n", list("squash_if"), "\n", list("Flatten or squash a list of lists into a simpler vector"), #> "\n", list("\n", "flatten(x)\n", "\n", "flatten_lgl(x)\n", #> "\n", "flatten_int(x)\n", "\n", "flatten_dbl(x)\n", #> "\n", "flatten_cpl(x)\n", "\n", "flatten_chr(x)\n", #> "\n", "flatten_raw(x)\n", "\n", "squash(x)\n", #> "\n", "squash_lgl(x)\n", "\n", "squash_int(x)\n", #> "\n", "squash_dbl(x)\n", "\n", "squash_cpl(x)\n", #> "\n", "squash_chr(x)\n", "\n", "squash_raw(x)\n", #> "\n", "flatten_if(x, predicate = is_spliced)\n", #> "\n", "squash_if(x, predicate = is_spliced)\n"), #> "\n", list("\n", list(list("x"), list("A list to flatten or squash. The contents of the list can\n", #> "be anything for unsuffixed functions ", list( #> "flatten()"), " and ", list("squash()"), #> "\n", "(as a list is returned), but the contents must match the type for\n", #> "the other functions.")), "\n", "\n", list( #> list("predicate"), list("A function of one argument returning whether it\n", #> "should be spliced.")), "\n"), "\n", list( #> "\n", list("flatten()"), " returns a list, ", #> list("flatten_lgl()"), " a logical\n", "vector, ", #> list("flatten_int()"), " an integer vector, ", #> list("flatten_dbl()"), " a\n", "double vector, and ", #> list("flatten_chr()"), " a character vector. Similarly\n", #> "for ", list("squash()"), " and the typed variants (", #> list("squash_lgl()"), " etc).\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", list("flatten()"), " removes one level hierarchy from a list, while\n", #> list("squash()"), " removes all levels. These functions are similar to\n", #> list(list("unlist()")), " but they are type-stable so you always know what the\n", #> "type of the output is.\n"), "\n", list(list( #> "Life cycle"), list("\n", "\n", "\n", "These functions are in the questioning stage. They have slightly\n", #> "different semantics than the flattening functions in purrr and we\n", #> "are currently rethinking our approach to flattening with the new\n", #> "typing facilities of the vctrs package.\n")), #> "\n", "\n", list("\n", "x <- replicate(2, sample(4), simplify = FALSE)\n", #> "x\n", "\n", "flatten(x)\n", "flatten_int(x)\n", #> "\n", "# With flatten(), only one level gets removed at a time:\n", #> "deep <- list(1, list(2, list(3)))\n", "flatten(deep)\n", #> "flatten(flatten(deep))\n", "\n", "# But squash() removes all levels:\n", #> "squash(deep)\n", "squash_dbl(deep)\n", "\n", #> "# The typed flatten functions remove one level and coerce to an atomic\n", #> "# vector at the same time:\n", "flatten_dbl(list(1, list(2)))\n", #> "\n", "# Only bare lists are flattened, but you can splice S3 lists\n", #> "# explicitly:\n", "foo <- set_attrs(list(\"bar\"), class = \"foo\")\n", #> "str(flatten(list(1, foo, list(100))))\n", #> "str(flatten(list(1, splice(foo), list(100))))\n", #> "\n", "# Instead of splicing manually, flatten_if() and squash_if() let\n", #> "# you specify a predicate function:\n", "is_foo <- function(x) inherits(x, \"foo\") || is_bare_list(x)\n", #> "str(flatten_if(list(1, foo, list(100)), is_foo))\n", #> "\n", "# squash_if() does the same with deep lists:\n", #> "deep_foo <- list(1, list(foo, list(foo, 100)))\n", #> "str(deep_foo)\n", "\n", "str(squash(deep_foo))\n", #> "str(squash_if(deep_foo, is_foo))\n"), "\n", #> list("internal"), "\n"), fn_body.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("fn_body"), "\n", list("fn_body"), #> "\n", list("fn_body<-"), "\n", list("Get or set function body"), #> "\n", list("\n", "fn_body(fn = caller_fn())\n", #> "\n", "fn_body(fn) <- value\n"), "\n", list( #> "\n", list(list("fn"), list("A function. It is lookep up in the calling frame if not\n", #> "supplied.")), "\n", "\n", list(list("value"), #> list("New formals or formals names for ", #> list("fn"), ".")), "\n"), "\n", list("\n", #> list("fn_body()"), " is a simple wrapper around ", #> list(list("base::body()")), ". It always\n", #> "returns a ", list("\\{"), " expression and throws an error when the input is a\n", #> "primitive function (whereas ", list("body()"), #> " returns ", list("NULL"), "). The setter\n", #> "version preserves attributes, unlike ", list( #> "body<-"), ".\n"), "\n", list("\n", "# fn_body() is like body() but always returns a block:\n", #> "fn <- function() do()\n", "body(fn)\n", "fn_body(fn)\n", #> "\n", "# It also throws an error when used on a primitive function:\n", #> "try(fn_body(base::list))\n"), "\n"), fn_env.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("fn_env"), "\n", list("fn_env"), "\n", #> list("fn_env<-"), "\n", list("Return the closure environment of a function"), #> "\n", list("\n", "fn_env(fn)\n", "\n", "fn_env(x) <- value\n"), #> "\n", list("\n", list(list("fn, x"), list("A function.")), #> "\n", "\n", list(list("value"), list("A new closure environment for the function.")), #> "\n"), "\n", list("\n", "Closure environments define the scope of functions (see ", #> list(list("env()")), ").\n", "When a function call is evaluated, R creates an evaluation frame\n", #> "(see ", list(list("ctxt_stack()")), ") that inherits from the closure environment.\n", #> "This makes all objects defined in the closure environment and all\n", #> "its parents available to code executed within the function.\n"), #> "\n", list("\n", list("fn_env()"), " returns the closure environment of ", #> list("fn"), ". There is also\n", "an assignment method to set a new closure environment.\n"), #> "\n", list("\n", "env <- child_env(\"base\")\n", #> "fn <- with_env(env, function() NULL)\n", "identical(fn_env(fn), env)\n", #> "\n", "other_env <- child_env(\"base\")\n", #> "fn_env(fn) <- other_env\n", "identical(fn_env(fn), other_env)\n"), #> "\n"), fn_fmls.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("fn_fmls"), "\n", list("fn_fmls"), #> "\n", list("fn_fmls_names"), "\n", list("fn_fmls_syms"), #> "\n", list("fn_fmls<-"), "\n", list("fn_fmls_names<-"), #> "\n", list("Extract arguments from a function"), #> "\n", list("\n", "fn_fmls(fn = caller_fn())\n", #> "\n", "fn_fmls_names(fn = caller_fn())\n", #> "\n", "fn_fmls_syms(fn = caller_fn())\n", "\n", #> "fn_fmls(fn) <- value\n", "\n", "fn_fmls_names(fn) <- value\n"), #> "\n", list("\n", list(list("fn"), list("A function. It is lookep up in the calling frame if not\n", #> "supplied.")), "\n", "\n", list(list("value"), #> list("New formals or formals names for ", list( #> "fn"), ".")), "\n"), "\n", list("\n", list( #> "fn_fmls()"), " returns a named list of formal arguments.\n", #> list("fn_fmls_names()"), " returns the names of the arguments.\n", #> list("fn_fmls_syms()"), " returns formals as a named list of symbols. This\n", #> "is especially useful for forwarding arguments in ", #> list("constructed calls"), ".\n"), "\n", list( #> "\n", "Unlike ", list("formals()"), ", these helpers throw an error with primitive\n", #> "functions instead of returning ", list("NULL"), #> ".\n"), "\n", list("\n", "# Extract from current call:\n", #> "fn <- function(a = 1, b = 2) fn_fmls()\n", #> "fn()\n", "\n", "# fn_fmls_syms() makes it easy to forward arguments:\n", #> "call2(\"apply\", !!! fn_fmls_syms(lapply))\n", #> "\n", "# You can also change the formals:\n", #> "fn_fmls(fn) <- list(A = 10, B = 20)\n", "fn()\n", #> "\n", "fn_fmls_names(fn) <- c(\"foo\", \"bar\")\n", #> "fn()\n"), "\n", list("\n", list(list("call_args()")), #> " and ", list(list("call_args_names()")), "\n"), #> "\n"), format_error_bullets.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-message.R", #> "\n", list("format_error_bullets"), "\n", list( #> "format_error_bullets"), "\n", list("Format bullets for error messages"), #> "\n", list("\n", "format_error_bullets(x)\n"), #> "\n", list("\n", list(list("x"), list("A named character vector of messages. Elements named as\n", #> list("x"), " or ", list("i"), " are prefixed with the corresponding bullet.")), #> "\n"), "\n", list("\n", list("format_error_bullets()"), #> " takes a character vector and returns a single\n", #> "string (or an empty vector if the input is empty). The elements of\n", #> "the input vector are assembled as a list of bullets, depending on\n", #> "their names:\n", list("\n", list(), " Elements named ", #> list("\"i\""), " are bulleted with a blue \"info\" symbol.\n", #> list(), " Elements named ", list("\"x\""), #> " are bulleted with a red \"cross\" symbol.\n", #> list(), " Unnamed elements are bulleted with a \"*\" symbol.\n"), #> "\n", "\n", "This experimental infrastructure is based on the idea that\n", #> "sentences in error messages are best kept short and simple. From\n", #> "this point of view, the best way to present the information is in\n", #> "the ", list(list("cnd_body()")), " method of an error conditon, as a bullet list of\n", #> "simple sentences containing a single clause. The info and cross\n", #> "symbols of the bullets provide hints on how to interpret the bullet\n", #> "relative to the general error issue, which should be supplied as\n", #> list(list("cnd_header()")), ".\n"), "\n"), #> frame_position.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("frame_position"), "\n", list("frame_position"), #> "\n", list("Find the position or distance of a frame on the evaluation stack"), #> "\n", list("\n", "frame_position(frame, from = c(\"global\", \"current\"))\n"), #> "\n", list("\n", list(list("frame"), list("The environment of a frame. Can be any object with a\n", #> list(list("get_env()")), " method. Note that for frame objects, the position from\n", #> "the global frame is simply ", list("frame$pos"), #> ". Alternatively, ", list("frame"), "\n", "can be an integer that represents the position on the stack (and\n", #> "is thus returned as is if ", list("from"), #> " is \"global\".")), "\n", "\n", list(list( #> "from"), list("Whether to compute distance from the global frame (the\n", #> "bottom of the evaluation stack), or from the current frame (the\n", #> "top of the evaluation stack).")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "The frame position on the stack can be computed by counting frames\n", #> "from the global frame (the bottom of the stack, the default) or\n", #> "from the current frame (the top of the stack).\n"), #> "\n", list("\n", "While this function returns the position of the frame on the\n", #> "evaluation stack, it can safely be called with intervening frames\n", #> "as those will be discarded.\n"), "\n", list( #> list("Life cycle"), list("\n", "\n", "\n", #> "These functions are deprecated and replaced by ", #> list(list("trace_back()")), ".\n")), "\n", #> "\n", list("\n", "fn <- function() g(environment())\n", #> "g <- function(env) frame_position(env)\n", #> "\n", "# frame_position() returns the position of the frame on the evaluation stack:\n", #> "fn()\n", "identity(identity(fn()))\n", "\n", #> "# Note that it trims off intervening calls before counting so you\n", #> "# can safely nest it within other calls:\n", #> "g <- function(env) identity(identity(frame_position(env)))\n", #> "fn()\n", "\n", "# You can also ask for the position from the current frame rather\n", #> "# than the global frame:\n", "fn <- function() g(environment())\n", #> "g <- function(env) h(env)\n", "h <- function(env) frame_position(env, from = \"current\")\n", #> "fn()\n"), "\n", list("internal"), "\n"), friendly_type.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("friendly_type"), "\n", list("friendly_type"), #> "\n", list("Format a type for error messages"), #> "\n", list("\n", "friendly_type(type)\n"), "\n", #> list("\n", list(list("type"), list("A type as returned by ", #> list(list("typeof()")), ".")), "\n"), "\n", #> list("\n", "A string of the prettified type, qualified with an\n", #> "indefinite article.\n"), "\n", list("\n", #> "Format a type for error messages\n"), "\n", #> list(list("Life cycle"), list("\n", "\n", list( #> "\n", list(), " ", list("friendly_type()"), #> " is experimental.\n"), "\n")), "\n", "\n", #> list("\n", "friendly_type(\"logical\")\n", "friendly_type(\"integer\")\n", #> "friendly_type(\"string\")\n"), "\n", list( #> "internal"), "\n"), get_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("get_env"), "\n", list("get_env"), #> "\n", list("set_env"), "\n", list("env_poke_parent"), #> "\n", list("Get or set the environment of an object"), #> "\n", list("\n", "get_env(env, default = NULL)\n", #> "\n", "set_env(env, new_env = caller_env())\n", #> "\n", "env_poke_parent(env, new_env)\n"), "\n", #> list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("default"), list("The default environment in case ", #> list("env"), " does not wrap\n", "an environment. If ", #> list("NULL"), " and no environment could be extracted,\n", #> "an error is issued.")), "\n", "\n", list( #> list("new_env"), list("An environment to replace ", #> list("env"), " with.")), "\n"), "\n", list( #> "\n", "These functions dispatch internally with methods for functions,\n", #> "formulas and frames. If called with a missing argument, the\n", #> "environment of the current evaluation frame (see ", #> list(list("ctxt_stack()")), ") is\n", "returned. If you call ", #> list("get_env()"), " with an environment, it acts as\n", #> "the identity function and the environment is simply returned (this\n", #> "helps simplifying code when writing generic functions for\n", #> "environments).\n"), "\n", list("\n", "While ", #> list("set_env()"), " returns a modified copy and does not have side\n", #> "effects, ", list("env_poke_parent()"), " operates changes the environment by\n", #> "side effect. This is because environments are\n", #> list("uncopyable"), ". Be careful not to change environments\n", #> "that you don't own, e.g. a parent environment of a function from a\n", #> "package.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", list("\n", list(), " Using ", #> list("get_env()"), " without supplying ", #> list("env"), " is deprecated as\n", "of rlang 0.3.0. Please use ", #> list(list("current_env()")), " to retrieve the\n", #> "current environment.\n", list(), " Passing environment wrappers like formulas or functions instead\n", #> "of bare environments is deprecated as of rlang 0.3.0. This\n", #> "internal genericity was causing confusion (see issue #427). You\n", #> "should now extract the environment separately before calling\n", #> "these functions.\n"), "\n")), "\n", "\n", #> list("\n", "# Environment of closure functions:\n", #> "fn <- function() \"foo\"\n", "get_env(fn)\n", #> "\n", "# Or of quosures or formulas:\n", "get_env(~foo)\n", #> "get_env(quo(foo))\n", "\n", "\n", "# Provide a default in case the object doesn't bundle an environment.\n", #> "# Let's create an unevaluated formula:\n", #> "f <- quote(~foo)\n", "\n", "# The following line would fail if run because unevaluated formulas\n", #> "# don't bundle an environment (they didn't have the chance to\n", #> "# record one yet):\n", "# get_env(f)\n", "\n", #> "# It is often useful to provide a default when you're writing\n", #> "# functions accepting formulas as input:\n", #> "default <- env()\n", "identical(get_env(f, default), default)\n", #> "\n", "# set_env() can be used to set the enclosure of functions and\n", #> "# formulas. Let's create a function with a particular environment:\n", #> "env <- child_env(\"base\")\n", "fn <- set_env(function() NULL, env)\n", #> "\n", "# That function now has `env` as enclosure:\n", #> "identical(get_env(fn), env)\n", "identical(get_env(fn), current_env())\n", #> "\n", "# set_env() does not work by side effect. Setting a new environment\n", #> "# for fn has no effect on the original function:\n", #> "other_env <- child_env(NULL)\n", "set_env(fn, other_env)\n", #> "identical(get_env(fn), other_env)\n", "\n", #> "# Since set_env() returns a new function with a different\n", #> "# environment, you'll need to reassign the result:\n", #> "fn <- set_env(fn, other_env)\n", "identical(get_env(fn), other_env)\n"), #> "\n", list("\n", list(list("quo_get_env()")), #> " and ", list(list("quo_set_env()")), " for versions of\n", #> list(list("get_env()")), " and ", list(list( #> "set_env()")), " that only work on quosures.\n"), #> "\n"), has_length.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("has_length"), "\n", list("has_length"), #> "\n", list("How long is an object?"), "\n", list( #> "\n", "has_length(x, n = NULL)\n"), "\n", list( #> "\n", list(list("x"), list("A R object.")), #> "\n", "\n", list(list("n"), list("A specific length to test ", #> list("x"), " with. If ", list("NULL"), ",\n", #> list("has_length()"), " returns ", list("TRUE"), #> " if ", list("x"), " has length greater than\n", #> "zero, and ", list("FALSE"), " otherwise.")), #> "\n"), "\n", list("\n", "This is a function for the common task of testing the length of an\n", #> "object. It checks the length of an object in a non-generic way:\n", #> list(list("base::length()")), " methods are ignored.\n"), #> "\n", list("\n", "has_length(list())\n", "has_length(list(), 0)\n", #> "\n", "has_length(letters)\n", "has_length(letters, 20)\n", #> "has_length(letters, 26)\n"), "\n", list("internal"), #> "\n"), has_name.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("has_name"), "\n", list("has_name"), #> "\n", list("Does an object have an element with this name?"), #> "\n", list("\n", "has_name(x, name)\n"), "\n", #> list("\n", list(list("x"), list("A data frame or another named object")), #> "\n", "\n", list(list("name"), list("Element name(s) to check")), #> "\n"), "\n", list("\n", "A logical vector of the same length as ", #> list("name"), "\n"), "\n", list("\n", "This function returns a logical value that indicates if a data\n", #> "frame or another named object contains an element with a specific\n", #> "name. Note that ", list("has_name()"), " only works with vectors. For instance,\n", #> "environments need the specialised function ", #> list(list("env_has()")), ".\n"), "\n", list( #> "\n", "Unnamed objects are treated as if all names are empty strings. ", #> list("NA"), "\n", "input gives ", list("FALSE"), #> " as output.\n"), "\n", list("\n", "has_name(iris, \"Species\")\n", #> "has_name(mtcars, \"gears\")\n"), "\n"), hash.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/hash.R", #> "\n", list("hash"), "\n", list("hash"), "\n", #> list("Hash an object"), "\n", list("\n", "hash(x)\n"), #> "\n", list("\n", list(list("x"), list("An object.")), #> "\n"), "\n", list("\n", list("hash()"), " hashes an arbitrary R object.\n", #> "\n", "The generated hash is guaranteed to be reproducible across platforms, but\n", #> "not across R versions.\n"), "\n", list("\n", #> list("hash()"), " uses the XXH128 hash algorithm of the xxHash library, which\n", #> "generates a 128-bit hash. It is implemented as a streaming hash, which\n", #> "generates the hash with minimal extra memory usage.\n", #> "\n", "Objects are converted to binary using R's native serialization tools.\n", #> "On R >= 3.5.0, serialization version 3 is used, otherwise version 2 is used.\n", #> "See ", list(list("serialize()")), " for more information about the serialization version.\n"), #> "\n", list("\n", "hash(c(1, 2, 3))\n", "hash(mtcars)\n"), #> "\n"), inherits_any.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/s3.R", #> "\n", list("inherits_any"), "\n", list("inherits_any"), #> "\n", list("inherits_all"), "\n", list("inherits_only"), #> "\n", list("Does an object inherit from a set of classes?"), #> "\n", list("\n", "inherits_any(x, class)\n", #> "\n", "inherits_all(x, class)\n", "\n", "inherits_only(x, class)\n"), #> "\n", list("\n", list(list("x"), list("An object to test for inheritance.")), #> "\n", "\n", list(list("class"), list("A character vector of classes.")), #> "\n"), "\n", list("\n", list("\n", list(), #> " ", list("inherits_any()"), " is like ", list( #> list("base::inherits()")), " but is more explicit\n", #> "about its behaviour with multiple classes. If ", #> list("classes"), " contains\n", "several elements and the object inherits from at least one of\n", #> "them, ", list("inherits_any()"), " returns ", #> list("TRUE"), ".\n", list(), " ", list("inherits_all()"), #> " tests that an object inherits from all of the\n", #> "classes in the supplied order. This is usually the best way to\n", #> "test for inheritance of multiple classes.\n", #> list(), " ", list("inherits_only()"), " tests that the class vectors are identical. It\n", #> "is a shortcut for ", list("identical(class(x), class)"), #> ".\n"), "\n"), "\n", list("\n", "obj <- structure(list(), class = c(\"foo\", \"bar\", \"baz\"))\n", #> "\n", "# With the _any variant only one class must match:\n", #> "inherits_any(obj, c(\"foobar\", \"bazbaz\"))\n", #> "inherits_any(obj, c(\"foo\", \"bazbaz\"))\n", #> "\n", "# With the _all variant all classes must match:\n", #> "inherits_all(obj, c(\"foo\", \"bazbaz\"))\n", #> "inherits_all(obj, c(\"foo\", \"baz\"))\n", #> "\n", "# The order of classes must match as well:\n", #> "inherits_all(obj, c(\"baz\", \"foo\"))\n", #> "\n", "# inherits_only() checks that the class vectors are identical:\n", #> "inherits_only(obj, c(\"foo\", \"baz\"))\n", #> "inherits_only(obj, c(\"foo\", \"bar\", \"baz\"))\n"), #> "\n"), inject.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval.R", #> "\n", list("inject"), "\n", list("inject"), "\n", #> list("Inject objects in an R expression"), "\n", #> list("\n", "inject(expr, env = caller_env())\n"), #> "\n", list("\n", list(list("expr"), list("An argument to evaluate. This argument is immediately\n", #> "evaluated in ", list("env"), " (the current environment by default) with\n", #> "injected objects and expressions.")), "\n", #> "\n", list(list("env"), list("The environment in which to evaluate ", #> list("expr"), ". Defaults to\n", "the current environment. For expert use only.")), #> "\n"), "\n", list("\n", list("inject()"), " evaluates an expression with ", #> list("injection"), "\n", "(unquotation) support. There are three main usages:\n"), #> "\n", list("\n", list("\n", list(), " ", list( #> "Splicing"), " lists of arguments in a function call.\n", #> list(), " Inline objects or other expressions in an expression with ", #> list("!!"), "\n", "and ", list("!!!"), ". For instance to create functions or formulas\n", #> "programmatically.\n", list(), " Pass arguments to NSE functions that ", #> list("defuse"), " their\n", "arguments without injection support (see for instance\n", #> list(list("enquo0()")), "). You can use ", #> list("{{ arg }}"), " with functions documented\n", #> "to support quosures. Otherwise, use ", list( #> "!!enexpr(arg)"), ".\n"), "\n"), "\n", list( #> "\n", "# inject() simply evaluates its argument with injection\n", #> "# support. These expressions are equivalent:\n", #> "2 * 3\n", "inject(2 * 3)\n", "inject(!!2 * !!3)\n", #> "\n", "# Injection with `!!` can be useful to insert objects or\n", #> "# expressions within other expressions, like formulas:\n", #> "lhs <- sym(\"foo\")\n", "rhs <- sym(\"bar\")\n", #> "inject(!!lhs ~ !!rhs + 10)\n", "\n", "# Injection with `!!!` splices lists of arguments in function\n", #> "# calls:\n", "args <- list(na.rm = TRUE, finite = 0.2)\n", #> "inject(mean(1:10, !!!args))\n"), "\n"), invoke.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval.R", #> "\n", list("invoke"), "\n", list("invoke"), "\n", #> list("Invoke a function with a list of arguments"), #> "\n", list("\n", "invoke(.fn, .args = list(), ..., .env = caller_env(), .bury = c(\".fn\", \"\"))\n"), #> "\n", list("\n", list(list(".fn"), list("A function to invoke. Can be a function object or the\n", #> "name of a function in scope of ", list(".env"), #> ".")), "\n", "\n", list(list(".args, ..."), #> list("List of arguments (possibly named) to be passed to\n", #> list(".fn"), ".")), "\n", "\n", list(list( #> ".env"), list("The environment in which to call ", #> list(".fn"), ".")), "\n", "\n", list(list(".bury"), #> list("A character vector of length 2. The first string\n", #> "specifies which name should the function have in the call\n", #> "recorded in the evaluation stack. The second string specifies a\n", #> "prefix for the argument names. Set ", list( #> ".bury"), " to ", list("NULL"), " if you\n", #> "prefer to inline the function and its arguments in the call.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", "\n", "Normally, you invoke a R function by typing arguments manually. A\n", #> "powerful alternative is to call a function with a list of arguments\n", #> "assembled programmatically. This is the purpose of ", #> list("invoke()"), ".\n"), "\n", list("\n", #> "Technically, ", list("invoke()"), " is basically a version of ", #> list(list("base::do.call()")), "\n", "that creates cleaner call traces because it does not inline the\n", #> "function and the arguments in the call (see examples). To achieve\n", #> "this, ", list("invoke()"), " creates a child environment of ", #> list(".env"), " with ", list(".fn"), "\n", #> "and all arguments bound to new symbols (see ", #> list(list("env_bury()")), "). It then\n", "uses the same strategy as ", #> list(list("eval_bare()")), " to evaluate with minimal\n", #> "noise.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", list("invoke()"), " is soft-deprecated in favour of ", #> list(list("exec()")), ". Now that we\n", #> "understand better the interaction between unquoting and dots\n", #> "capture, we can take a simpler approach in ", #> list("exec()"), ".\n", "\n", "If you need finer control over the generated call, you should construct\n", #> "an environment and call yourself, manually burying large objects\n", #> "or complex expressions.\n")), "\n", "\n", #> list("\n", "# invoke() has the same purpose as do.call():\n", #> "invoke(paste, letters)\n", "\n", "# But it creates much cleaner calls:\n", #> "invoke(call_inspect, mtcars)\n", "\n", "# and stacktraces:\n", #> "fn <- function(...) sys.calls()\n", "invoke(fn, list(mtcars))\n", #> "\n", "# Compare to do.call():\n", "do.call(call_inspect, mtcars)\n", #> "do.call(fn, list(mtcars))\n", "\n", "\n", #> "# Specify the function name either by supplying a string\n", #> "# identifying the function (it should be visible in .env):\n", #> "invoke(\"call_inspect\", letters)\n", "\n", #> "# Or by changing the .bury argument, with which you can also change\n", #> "# the argument prefix:\n", "invoke(call_inspect, mtcars, .bury = c(\"inspect!\", \"col\"))\n"), #> "\n", list("internal"), "\n"), is_call.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("is_call"), "\n", list("is_call"), #> "\n", list("Is object a call?"), "\n", list("\n", #> "is_call(x, name = NULL, n = NULL, ns = NULL)\n"), #> "\n", list("\n", list(list("x"), list("An object to test. If a formula, the right-hand side is\n", #> "extracted.")), "\n", "\n", list(list("name"), #> list("An optional name that the call should match. It is\n", #> "passed to ", list(list("sym()")), " before matching. This argument is vectorised\n", #> "and you can supply a vector of names to match. In this case,\n", #> list("is_call()"), " returns ", list("TRUE"), #> " if at least one name matches.")), "\n", #> "\n", list(list("n"), list("An optional number of arguments that the call should\n", #> "match.")), "\n", "\n", list(list("ns"), #> list("The namespace of the call. If ", list( #> "NULL"), ", the namespace\n", "doesn't participate in the pattern-matching. If an empty string\n", #> list("\"\""), " and ", list("x"), " is a namespaced call, ", #> list("is_call()"), " returns\n", list("FALSE"), #> ". If any other string, ", list("is_call()"), #> " checks that ", list("x"), " is\n", "namespaced within ", #> list("ns"), ".\n", "\n", "Can be a character vector of namespaces, in which case the call\n", #> "has to match at least one of them, otherwise ", #> list("is_call()"), " returns\n", list("FALSE"), #> ".")), "\n"), "\n", list("\n", "This function tests if ", #> list("x"), " is a ", list("call"), ". This is a\n", #> "pattern-matching predicate that returns ", #> list("FALSE"), " if ", list("name"), " and ", #> list("n"), "\n", "are supplied and the call does not match these properties.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", list("is_lang()"), " has been soft-deprecated and renamed to ", #> list("is_call()"), " in\n", "rlang 0.2.0 and similarly for ", #> list("is_unary_lang()"), " and\n", list("is_binary_lang()"), #> ". This renaming follows the general switch from\n", #> "\"language\" to \"call\" in the rlang type nomenclature. See lifecycle\n", #> "section in ", list(list("call2()")), ".\n")), #> "\n", "\n", list("\n", "is_call(quote(foo(bar)))\n", #> "\n", "# You can pattern-match the call with additional arguments:\n", #> "is_call(quote(foo(bar)), \"foo\")\n", "is_call(quote(foo(bar)), \"bar\")\n", #> "is_call(quote(foo(bar)), quote(foo))\n", "\n", #> "# Match the number of arguments with is_call():\n", #> "is_call(quote(foo(bar)), \"foo\", 1)\n", "is_call(quote(foo(bar)), \"foo\", 2)\n", #> "\n", "\n", "# By default, namespaced calls are tested unqualified:\n", #> "ns_expr <- quote(base::list())\n", "is_call(ns_expr, \"list\")\n", #> "\n", "# You can also specify whether the call shouldn't be namespaced by\n", #> "# supplying an empty string:\n", "is_call(ns_expr, \"list\", ns = \"\")\n", #> "\n", "# Or if it should have a namespace:\n", #> "is_call(ns_expr, \"list\", ns = \"utils\")\n", #> "is_call(ns_expr, \"list\", ns = \"base\")\n", #> "\n", "# You can supply multiple namespaces:\n", #> "is_call(ns_expr, \"list\", ns = c(\"utils\", \"base\"))\n", #> "is_call(ns_expr, \"list\", ns = c(\"utils\", \"stats\"))\n", #> "\n", "# If one of them is \"\", unnamespaced calls will match as well:\n", #> "is_call(quote(list()), \"list\", ns = \"base\")\n", #> "is_call(quote(list()), \"list\", ns = c(\"base\", \"\"))\n", #> "is_call(quote(base::list()), \"list\", ns = c(\"base\", \"\"))\n", #> "\n", "\n", "# The name argument is vectorised so you can supply a list of names\n", #> "# to match with:\n", "is_call(quote(foo(bar)), c(\"bar\", \"baz\"))\n", #> "is_call(quote(foo(bar)), c(\"bar\", \"foo\"))\n", #> "is_call(quote(base::list), c(\"::\", \":::\", \"$\", \"@\"))\n"), #> "\n", list("\n", list(list("is_expression()")), #> "\n"), "\n"), is_callable.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("is_callable"), "\n", list("is_callable"), #> "\n", list("Is an object callable?"), "\n", list( #> "\n", "is_callable(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", "A callable object is an object that can appear in the function\n", #> "position of a call (as opposed to argument position). This includes\n", #> list("symbolic objects"), " that evaluate to a function or\n", #> "literal functions embedded in the call.\n"), #> "\n", list("\n", "Note that strings may look like callable objects because\n", #> "expressions of the form ", list("\"list\"()"), #> " are valid R code. However,\n", "that's only because the R parser transforms strings to symbols. It\n", #> "is not legal to manually set language heads to strings.\n"), #> "\n", list("\n", "# Symbolic objects and functions are callable:\n", #> "is_callable(quote(foo))\n", "is_callable(base::identity)\n", #> "\n", "# node_poke_car() lets you modify calls without any checking:\n", #> "lang <- quote(foo(10))\n", "node_poke_car(lang, current_env())\n", #> "\n", "# Use is_callable() to check an input object is safe to put as CAR:\n", #> "obj <- base::identity\n", "\n", "if (is_callable(obj)) {\n", #> " lang <- node_poke_car(lang, obj)\n", "} else {\n", #> " abort(\"`obj` must be callable\")\n", "}\n", #> "\n", "eval_bare(lang)\n"), "\n", list("internal"), #> "\n"), is_condition.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd.R", #> "\n", list("is_condition"), "\n", list("is_condition"), #> "\n", list("Is object a condition?"), "\n", list( #> "\n", "is_condition(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", "Is object a condition?\n"), #> "\n", list("internal"), "\n"), is_copyable.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_copyable"), "\n", list("is_copyable"), #> "\n", list("Is an object copyable?"), "\n", list( #> "\n", "is_copyable(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", "When an object is modified, R generally copies it (sometimes\n", #> "lazily) to enforce ", list(list("https://en.wikipedia.org/wiki/Value_semantics"), #> list("value semantics")), ".\n", "However, some internal types are uncopyable. If you try to copy\n", #> "them, either with ", list("<-"), " or by argument passing, you actually create\n", #> "references to the original object rather than actual\n", #> "copies. Modifying these references can thus have far reaching side\n", #> "effects.\n"), "\n", list("\n", "# Let's add attributes with structure() to uncopyable types. Since\n", #> "# they are not copied, the attributes are changed in place:\n", #> "env <- env()\n", "structure(env, foo = \"bar\")\n", #> "env\n", "\n", "# These objects that can only be changed with side effect are not\n", #> "# copyable:\n", "is_copyable(env)\n", "\n", #> "structure(base::list, foo = \"bar\")\n", "str(base::list)\n"), #> "\n", list("internal"), "\n"), is_empty.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_empty"), "\n", list("is_empty"), #> "\n", list("Is object an empty vector or NULL?"), #> "\n", list("\n", "is_empty(x)\n"), "\n", list( #> "\n", list(list("x"), list("object to test")), #> "\n"), "\n", list("\n", "Is object an empty vector or NULL?\n"), #> "\n", list("\n", "is_empty(NULL)\n", "is_empty(list())\n", #> "is_empty(list(NULL))\n"), "\n"), is_env.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("is_env"), "\n", list("is_env"), "\n", #> list("is_bare_env"), "\n", list("Is an object an environment?"), #> "\n", list("\n", "is_env(x)\n", "\n", "is_bare_env(x)\n"), #> "\n", list("\n", list(list("x"), list("object to test")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions were deprecated and renamed to ", #> list(list("is_environment()")), "\n", "and ", #> list(list("is_bare_environment()")), " in rlang 0.2.0. This is for consistency\n", #> "with other type predicates which are not abbreviated.\n"), #> "\n", list("internal"), "\n"), is_environment.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_environment"), "\n", list("is_environment"), #> "\n", list("is_bare_environment"), "\n", list( #> "Is object an environment?"), "\n", list("\n", #> "is_environment(x)\n", "\n", "is_bare_environment(x)\n"), #> "\n", list("\n", list(list("x"), list("object to test")), #> "\n"), "\n", list("\n", list("is_bare_environment()"), #> " tests whether ", list("x"), " is an environment without a s3 or\n", #> "s4 class.\n"), "\n"), is_expr.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("is_expr"), "\n", list("is_expr"), #> "\n", list("Is an object an expression?"), "\n", #> list("\n", "is_expr(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "This function was deprecated and renamed to ", #> list(list("is_expression()")), " in\n", "rlang 0.2.0. This is for consistency with other type predicates\n", #> "which are not abbreviated.\n"), "\n", list( #> "internal"), "\n"), is_expression.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/expr.R", #> "\n", list("is_expression"), "\n", list("is_expression"), #> "\n", list("is_syntactic_literal"), "\n", list( #> "is_symbolic"), "\n", list("Is an object an expression?"), #> "\n", list("\n", "is_expression(x)\n", "\n", #> "is_syntactic_literal(x)\n", "\n", "is_symbolic(x)\n"), #> "\n", list("\n", list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", list("is_expression()"), #> " tests for expressions, the set of objects that can be\n", #> "obtained from parsing R code. An expression can be one of two\n", #> "things: either a symbolic object (for which ", #> list("is_symbolic()"), " returns\n", list("TRUE"), #> "), or a syntactic literal (testable with\n", #> list("is_syntactic_literal()"), "). Technically, calls can contain any R\n", #> "object, not necessarily symbolic objects or syntactic\n", #> "literals. However, this only happens in artificial\n", #> "situations. Expressions as we define them only contain numbers,\n", #> "strings, ", list("NULL"), ", symbols, and calls: this is the complete set of R\n", #> "objects that can be created when R parses source code (e.g. from\n", #> "using ", list(list("parse_expr()")), ").\n", #> "\n", "Note that we are using the term expression in its colloquial sense\n", #> "and not to refer to ", list(list("expression()")), #> " vectors, a data type that wraps\n", "expressions in a vector and which isn't used much in modern R code.\n"), #> "\n", list("\n", list("is_symbolic()"), " returns ", #> list("TRUE"), " for symbols and calls (objects with\n", #> "type ", list("language"), "). Symbolic objects are replaced by their value\n", #> "during evaluation. Literals are the complement of symbolic\n", #> "objects. They are their own value and return themselves during\n", #> "evaluation.\n", "\n", list("is_syntactic_literal()"), #> " is a predicate that returns ", list("TRUE"), #> " for the\n", "subset of literals that are created by R when parsing text (see\n", #> list(list("parse_expr()")), "): numbers, strings and ", #> list("NULL"), ". Along with symbols,\n", "these literals are the terminating nodes in an AST.\n", #> "\n", "Note that in the most general sense, a literal is any R object that\n", #> "evaluates to itself and that can be evaluated in the empty\n", #> "environment. For instance, ", list("quote(c(1, 2))"), #> " is not a literal, it is\n", "a call. However, the result of evaluating it in ", #> list(list("base_env()")), " is a\n", "literal(in this case an atomic vector).\n", #> "\n", "Pairlists are also a kind of language objects. However, since they\n", #> "are mostly an internal data structure, ", #> list("is_expression()"), " returns ", list( #> "FALSE"), "\n", "for pairlists. You can use ", #> list("is_pairlist()"), " to explicitly check for\n", #> "them. Pairlists are the data structure for function arguments. They\n", #> "usually do not arise from R code because subsetting a call is a\n", #> "type-preserving operation. However, you can obtain the pairlist of\n", #> "arguments by taking the CDR of the call object from C code. The\n", #> "rlang function ", list(list("node_cdr()")), #> " will do it from R. Another way in\n", "which pairlist of arguments arise is by extracting the argument\n", #> "list of a closure with ", list(list("base::formals()")), #> " or ", list(list("fn_fmls()")), ".\n"), "\n", #> list("\n", "q1 <- quote(1)\n", "is_expression(q1)\n", #> "is_syntactic_literal(q1)\n", "\n", "q2 <- quote(x)\n", #> "is_expression(q2)\n", "is_symbol(q2)\n", "\n", #> "q3 <- quote(x + 1)\n", "is_expression(q3)\n", #> "is_call(q3)\n", "\n", "\n", "# Atomic expressions are the terminating nodes of a call tree:\n", #> "# NULL or a scalar atomic vector:\n", "is_syntactic_literal(\"string\")\n", #> "is_syntactic_literal(NULL)\n", "\n", "is_syntactic_literal(letters)\n", #> "is_syntactic_literal(quote(call()))\n", "\n", #> "# Parsable literals have the property of being self-quoting:\n", #> "identical(\"foo\", quote(\"foo\"))\n", "identical(1L, quote(1L))\n", #> "identical(NULL, quote(NULL))\n", "\n", "# Like any literals, they can be evaluated within the empty\n", #> "# environment:\n", "eval_bare(quote(1L), empty_env())\n", #> "\n", "# Whereas it would fail for symbolic expressions:\n", #> "# eval_bare(quote(c(1L, 2L)), empty_env())\n", #> "\n", "\n", "# Pairlists are also language objects representing argument lists.\n", #> "# You will usually encounter them with extracted formals:\n", #> "fmls <- formals(is_expression)\n", "typeof(fmls)\n", #> "\n", "# Since they are mostly an internal data structure, is_expression()\n", #> "# returns FALSE for pairlists, so you will have to check explicitly\n", #> "# for them:\n", "is_expression(fmls)\n", "is_pairlist(fmls)\n"), #> "\n", list("\n", list(list("is_call()")), " for a call predicate.\n"), #> "\n"), is_formula.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/formula.R", #> "\n", list("is_formula"), "\n", list("is_formula"), #> "\n", list("is_bare_formula"), "\n", list("Is object a formula?"), #> "\n", list("\n", "is_formula(x, scoped = NULL, lhs = NULL)\n", #> "\n", "is_bare_formula(x, scoped = NULL, lhs = NULL)\n"), #> "\n", list("\n", list(list("x"), list("An object to test.")), #> "\n", "\n", list(list("scoped"), list("A boolean indicating whether the quosure is scoped,\n", #> "that is, has a valid environment attribute. If ", #> list("NULL"), ", the scope\n", "is not inspected.")), #> "\n", "\n", list(list("lhs"), list("A boolean indicating whether the ", #> list("formula"), "\n", "or ", list("definition"), #> " has a left-hand side. If ", list("NULL"), #> ",\n", "the LHS is not inspected.")), "\n"), #> "\n", list("\n", list("is_formula()"), " tests if ", #> list("x"), " is a call to ", list("~"), ". ", #> list("is_bare_formula()"), "\n", "tests in addition that ", #> list("x"), " does not inherit from anything else than\n", #> list("\"formula\""), ".\n"), "\n", list("\n", #> "The ", list("scoped"), " argument patterns-match on whether the scoped bundled\n", #> "with the quosure is valid or not. Invalid scopes may happen in\n", #> "nested quotations like ", list("~~expr"), #> ", where the outer quosure is validly\n", "scoped but not the inner one. This is because ", #> list("~"), " saves the\n", "environment when it is evaluated, and quoted formulas are by\n", #> "definition not evaluated.\n"), "\n", list( #> "\n", "x <- disp ~ am\n", "is_formula(x)\n", #> "\n", "is_formula(~10)\n", "is_formula(10)\n", #> "\n", "is_formula(quo(foo))\n", "is_bare_formula(quo(foo))\n", #> "\n", "# Note that unevaluated formulas are treated as bare formulas even\n", #> "# though they don't inherit from \"formula\":\n", #> "f <- quote(~foo)\n", "is_bare_formula(f)\n", #> "\n", "# However you can specify `scoped` if you need the predicate to\n", #> "# return FALSE for these unevaluated formulas:\n", #> "is_bare_formula(f, scoped = TRUE)\n", "is_bare_formula(eval(f), scoped = TRUE)\n"), #> "\n"), is_frame.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("is_frame"), "\n", list("is_frame"), #> "\n", list("Is object a frame?"), "\n", list( #> "\n", "is_frame(x)\n"), "\n", list("\n", list( #> list("x"), list("Object to test")), "\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n"), "\n", list("internal"), "\n"), is_function.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("is_function"), "\n", list("is_function"), #> "\n", list("is_closure"), "\n", list("is_primitive"), #> "\n", list("is_primitive_eager"), "\n", list( #> "is_primitive_lazy"), "\n", list("Is object a function?"), #> "\n", list("\n", "is_function(x)\n", "\n", "is_closure(x)\n", #> "\n", "is_primitive(x)\n", "\n", "is_primitive_eager(x)\n", #> "\n", "is_primitive_lazy(x)\n"), "\n", list( #> "\n", list(list("x"), list("Object to be tested.")), #> "\n"), "\n", list("\n", "The R language defines two different types of functions: primitive\n", #> "functions, which are low-level, and closures, which are the regular\n", #> "kind of functions.\n"), "\n", list("\n", "Closures are functions written in R, named after the way their\n", #> "arguments are scoped within nested environments (see\n", #> list("https://en.wikipedia.org/wiki/Closure_(computer_programming)"), #> "). The\n", "root environment of the closure is called the closure\n", #> "environment. When closures are evaluated, a new environment called\n", #> "the evaluation frame is created with the closure environment as\n", #> "parent. This is where the body of the closure is evaluated. These\n", #> "closure frames appear on the evaluation stack (see ", #> list(list("ctxt_stack()")), "),\n", "as opposed to primitive functions which do not necessarily have\n", #> "their own evaluation frame and never appear on the stack.\n", #> "\n", "Primitive functions are more efficient than closures for two\n", #> "reasons. First, they are written entirely in fast low-level\n", #> "code. Second, the mechanism by which they are passed arguments is\n", #> "more efficient because they often do not need the full procedure of\n", #> "argument matching (dealing with positional versus named arguments,\n", #> "partial matching, etc). One practical consequence of the special\n", #> "way in which primitives are passed arguments is that they\n", #> "technically do not have formal arguments, and ", #> list(list("formals()")), " will\n", "return ", #> list("NULL"), " if called on a primitive function. Finally, primitive\n", #> "functions can either take arguments lazily, like R closures do,\n", #> "or evaluate them eagerly before being passed on to the C code.\n", #> "The former kind of primitives are called \"special\" in R terminology,\n", #> "while the latter is referred to as \"builtin\". ", #> list("is_primitive_eager()"), "\n", "and ", #> list("is_primitive_lazy()"), " allow you to check whether a primitive\n", #> "function evaluates arguments eagerly or lazily.\n", #> "\n", "You will also encounter the distinction between primitive and\n", #> "internal functions in technical documentation. Like primitive\n", #> "functions, internal functions are defined at a low level and\n", #> "written in C. However, internal functions have no representation in\n", #> "the R language. Instead, they are called via a call to\n", #> list(list("base::.Internal()")), " within a regular closure. This ensures that\n", #> "they appear as normal R function objects: they obey all the usual\n", #> "rules of argument passing, and they appear on the evaluation stack\n", #> "as any other closures. As a result, ", list( #> list("fn_fmls()")), " does not need to\n", #> "look in the ", list(".ArgsEnv"), " environment to obtain a representation of\n", #> "their arguments, and there is no way of querying from R whether\n", #> "they are lazy ('special' in R terminology) or eager ('builtin').\n", #> "\n", "You can call primitive functions with ", #> list(list(".Primitive()")), " and internal\n", #> "functions with ", list(list(".Internal()")), #> ". However, calling internal functions\n", #> "in a package is forbidden by CRAN's policy because they are\n", #> "considered part of the private API. They often assume that they\n", #> "have been called with correctly formed arguments, and may cause R\n", #> "to crash if you call them with unexpected objects.\n"), #> "\n", list("\n", "# Primitive functions are not closures:\n", #> "is_closure(base::c)\n", "is_primitive(base::c)\n", #> "\n", "# On the other hand, internal functions are wrapped in a closure\n", #> "# and appear as such from the R side:\n", #> "is_closure(base::eval)\n", "\n", "# Both closures and primitives are functions:\n", #> "is_function(base::c)\n", "is_function(base::eval)\n", #> "\n", "# Primitive functions never appear in evaluation stacks:\n", #> "is_primitive(base::`[[`)\n", "is_primitive(base::list)\n", #> "list(ctxt_stack())[[1]]\n", "\n", "# While closures do:\n", #> "identity(identity(ctxt_stack()))\n", "\n", #> "# Many primitive functions evaluate arguments eagerly:\n", #> "is_primitive_eager(base::c)\n", "is_primitive_eager(base::list)\n", #> "is_primitive_eager(base::`+`)\n", "\n", "# However, primitives that operate on expressions, like quote() or\n", #> "# substitute(), are lazy:\n", "is_primitive_lazy(base::quote)\n", #> "is_primitive_lazy(base::substitute)\n"), "\n"), #> is_installed.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("is_installed"), "\n", list("is_installed"), #> "\n", list("check_installed"), "\n", list("Are packages installed in any of the libraries?"), #> "\n", list("\n", "is_installed(pkg)\n", "\n", #> "check_installed(pkg, reason = NULL)\n"), "\n", #> list("\n", list(list("pkg"), list("The package names.")), #> "\n", "\n", list(list("reason"), list("Optional string indicating why is ", #> list("pkg"), " needed.\n", "Appears in error messages (if non-interactive) and user prompts\n", #> "(if interactive).")), "\n"), "\n", list( #> "\n", list("is_installed()"), " returns ", #> list("TRUE"), " if ", list("all"), " package names\n", #> "provided in ", list("pkg"), " are installed, ", #> list("FALSE"), "\n", "otherwise. ", list("check_installed()"), #> " either doesn't return or returns\n", list( #> "NULL"), ".\n"), "\n", list("\n", "These functions check that packages are installed with minimal side\n", #> "effects. If installed, the packages will be loaded but not\n", #> "attached.\n", list("\n", list(), " ", list( #> "is_installed()"), " doesn't interact with the user. It simply\n", #> "returns ", list("TRUE"), " or ", list("FALSE"), #> " depending on whether the packages are\n", #> "installed.\n", list(), " In interactive sessions, ", #> list("check_installed()"), " asks the user\n", #> "whether to install missing packages. If the user accepts, the\n", #> "packages are installed with ", list("pak::pkg_install()"), #> " if available, or\n", list(list("utils::install.packages()")), #> " otherwise. If the session is non\n", "interactive or if the user chooses not to install the packages,\n", #> "the current evaluation is aborted.\n"), #> "\n"), "\n", list("\n", "is_installed(\"utils\")\n", #> "is_installed(c(\"base\", \"ggplot5\"))\n"), #> "\n"), is_integerish.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_integerish"), "\n", list("is_integerish"), #> "\n", list("is_bare_integerish"), "\n", list( #> "is_scalar_integerish"), "\n", list("Is a vector integer-like?"), #> "\n", list("\n", "is_integerish(x, n = NULL, finite = NULL)\n", #> "\n", "is_bare_integerish(x, n = NULL, finite = NULL)\n", #> "\n", "is_scalar_integerish(x, finite = NULL)\n"), #> "\n", list("\n", list(list("x"), list("Object to be tested.")), #> "\n", "\n", list(list("n"), list("Expected length of a vector.")), #> "\n", "\n", list(list("finite"), list("Whether all values of the vector are finite. The\n", #> "non-finite values are ", list("NA"), ", ", #> list("Inf"), ", ", list("-Inf"), " and ", #> list("NaN"), ". Setting this\n", "to something other than ", #> list("NULL"), " can be expensive because the whole\n", #> "vector needs to be traversed and checked.")), #> "\n"), "\n", list("\n", "These predicates check whether R considers a number vector to be\n", #> "integer-like, according to its own tolerance check (which is in\n", #> "fact delegated to the C library). This function is not adapted to\n", #> "data analysis, see the help for ", list(list( #> "base::is.integer()")), " for examples\n", #> "of how to check for whole numbers.\n", "\n", #> "Things to consider when checking for integer-like doubles:\n", #> list("\n", list(), " This check can be expensive because the whole double vector has\n", #> "to be traversed and checked.\n", list(), #> " Large double values may be integerish but may still not be\n", #> "coercible to integer. This is because integers in R only support\n", #> "values up to ", list("2^31 - 1"), " while numbers stored as double can be\n", #> "much larger.\n"), "\n"), "\n", list("\n", #> "is_integerish(10L)\n", "is_integerish(10.0)\n", #> "is_integerish(10.0, n = 2)\n", "is_integerish(10.000001)\n", #> "is_integerish(TRUE)\n"), "\n", list("\n", #> list(list("is_bare_numeric()")), " for testing whether an object is a\n", #> "base numeric type (a bare double or integer vector).\n"), #> "\n"), is_interactive.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/state.R", #> "\n", list("is_interactive"), "\n", list("is_interactive"), #> "\n", list("local_interactive"), "\n", list("with_interactive"), #> "\n", list("Is R running interactively?"), "\n", #> list("\n", "is_interactive()\n", "\n", "local_interactive(value = TRUE, frame = caller_env())\n", #> "\n", "with_interactive(expr, value = TRUE)\n"), #> "\n", list("\n", list(list("value"), list("A single ", #> list("TRUE"), " or ", list("FALSE"), ". This overrides the return\n", #> "value of ", list("is_interactive()"), ".")), #> "\n", "\n", list(list("frame"), list("The environment of a running function which defines\n", #> "the scope of the temporary options. When the function returns,\n", #> "the options are reset to their original values.")), #> "\n", "\n", list(list("expr"), list("An expression to evaluate with interactivity set to\n", #> list("value"), ".")), "\n"), "\n", list("\n", #> "Like ", list(list("base::interactive()")), #> ", ", list("is_interactive()"), " returns ", #> list("TRUE"), " when\n", "the function runs interactively and ", #> list("FALSE"), " when it runs in batch\n", #> "mode. It also checks, in this order:\n", list( #> "\n", list(), " The ", list("rlang_interactive"), #> " global option. If set to a single ", list( #> "TRUE"), "\n", "or ", list("FALSE"), ", ", #> list("is_interactive()"), " returns that value immediately. This\n", #> "escape hatch is useful in unit tests or to manually turn on\n", #> "interactive features in RMarkdown outputs.\n", #> list(), " Whether knitr or testthat is in progress, in which case\n", #> list("is_interactive()"), " returns ", list( #> "FALSE"), ".\n"), "\n", "\n", list("with_interactive()"), #> " and ", list("local_interactive()"), " set the global\n", #> "option conveniently.\n"), "\n"), is_lang.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("is_lang"), "\n", list("is_lang"), #> "\n", list("is_unary_lang"), "\n", list("is_binary_lang"), #> "\n", list("quo_is_lang"), "\n", list("Is object a call?"), #> "\n", list("\n", "is_lang(x, name = NULL, n = NULL, ns = NULL)\n", #> "\n", "is_unary_lang(x, name = NULL, ns = NULL)\n", #> "\n", "is_binary_lang(x, name = NULL, ns = NULL)\n", #> "\n", "quo_is_lang(quo)\n"), "\n", list("\n", #> list(list("x"), list("An object to test. If a formula, the right-hand side is\n", #> "extracted.")), "\n", "\n", list(list("name"), #> list("An optional name that the call should match. It is\n", #> "passed to ", list(list("sym()")), " before matching. This argument is vectorised\n", #> "and you can supply a vector of names to match. In this case,\n", #> list("is_call()"), " returns ", list("TRUE"), #> " if at least one name matches.")), "\n", #> "\n", list(list("n"), list("An optional number of arguments that the call should\n", #> "match.")), "\n", "\n", list(list("ns"), #> list("The namespace of the call. If ", list( #> "NULL"), ", the namespace\n", "doesn't participate in the pattern-matching. If an empty string\n", #> list("\"\""), " and ", list("x"), " is a namespaced call, ", #> list("is_call()"), " returns\n", list("FALSE"), #> ". If any other string, ", list("is_call()"), #> " checks that ", list("x"), " is\n", "namespaced within ", #> list("ns"), ".\n", "\n", "Can be a character vector of namespaces, in which case the call\n", #> "has to match at least one of them, otherwise ", #> list("is_call()"), " returns\n", list("FALSE"), #> ".")), "\n", "\n", list(list("quo"), list( #> "A quosure to test.")), "\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions are deprecated, please use ", #> list(list("is_call()")), " and its ", list( #> "n"), "\n", "argument instead.\n"), "\n", #> list("internal"), "\n"), is_named.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("is_named"), "\n", list("is_named"), #> "\n", list("is_dictionaryish"), "\n", list("have_name"), #> "\n", list("Is object named?"), "\n", list("\n", #> "is_named(x)\n", "\n", "is_dictionaryish(x)\n", #> "\n", "have_name(x)\n"), "\n", list("\n", list( #> list("x"), list("An object to test.")), "\n"), #> "\n", list("\n", list("is_named()"), " and ", #> list("is_dictionaryish()"), " are scalar predicates\n", #> "and return ", list("TRUE"), " or ", list("FALSE"), #> ". ", list("have_name()"), " is vectorised and\n", #> "returns a logical vector as long as the input.\n"), #> "\n", list("\n", list("is_named()"), " checks that ", #> list("x"), " has names attributes, and that none of\n", #> "the names are missing or empty (", list("NA"), #> " or ", list("\"\""), "). ", list("is_dictionaryish()"), #> "\n", "checks that an object is a dictionary: that it has actual names and\n", #> "in addition that there are no duplicated names. ", #> list("have_name()"), "\n", "is a vectorised version of ", #> list("is_named()"), ".\n"), "\n", list("\n", #> "# A data frame usually has valid, unique names\n", #> "is_named(mtcars)\n", "have_name(mtcars)\n", #> "is_dictionaryish(mtcars)\n", "\n", "# But data frames can also have duplicated columns:\n", #> "dups <- cbind(mtcars, cyl = seq_len(nrow(mtcars)))\n", #> "is_dictionaryish(dups)\n", "\n", "# The names are still valid:\n", #> "is_named(dups)\n", "have_name(dups)\n", "\n", #> "\n", "# For empty objects the semantics are slightly different.\n", #> "# is_dictionaryish() returns TRUE for empty objects:\n", #> "is_dictionaryish(list())\n", "\n", "# But is_named() will only return TRUE if there is a names\n", #> "# attribute (a zero-length character vector in this case):\n", #> "x <- set_names(list(), character(0))\n", "is_named(x)\n", #> "\n", "\n", "# Empty and missing names are invalid:\n", #> "invalid <- dups\n", "names(invalid)[2] <- \"\"\n", #> "names(invalid)[5] <- NA\n", "\n", "# is_named() performs a global check while have_name() can show you\n", #> "# where the problem is:\n", "is_named(invalid)\n", #> "have_name(invalid)\n", "\n", "# have_name() will work even with vectors that don't have a names\n", #> "# attribute:\n", "have_name(letters)\n"), #> "\n"), is_namespace.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("is_namespace"), "\n", list("is_namespace"), #> "\n", list("Is an object a namespace environment?"), #> "\n", list("\n", "is_namespace(x)\n"), "\n", #> list("\n", list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", "Is an object a namespace environment?\n"), #> "\n"), is_pairlist.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/node.R", #> "\n", list("is_pairlist"), "\n", list("is_pairlist"), #> "\n", list("is_node"), "\n", list("is_node_list"), #> "\n", list("Is object a node or pairlist?"), #> "\n", list("\n", "is_pairlist(x)\n", "\n", "is_node(x)\n", #> "\n", "is_node_list(x)\n"), "\n", list("\n", #> list(list("x"), list("Object to test.")), "\n"), #> "\n", list("\n", list("\n", list(), " ", list( #> "is_pairlist()"), " checks that ", list("x"), #> " has type ", list("pairlist"), ".\n", list(), #> " ", list("is_node()"), " checks that ", list( #> "x"), " has type ", list("pairlist"), " or ", #> list("language"), ".\n", "It tests whether ", #> list("x"), " is a node that has a CAR and a CDR,\n", #> "including callable nodes (language objects).\n", #> list(), " ", list("is_node_list()"), " checks that ", #> list("x"), " has type ", list("pairlist"), #> " or ", list("NULL"), ".\n", list("NULL"), #> " is the empty node list.\n"), "\n"), "\n", #> list(list("Life cycle"), list("\n", "\n", "\n", #> "These functions are experimental. We are still figuring out a good\n", #> "naming convention to refer to the different lisp-like lists in R.\n")), #> "\n", "\n", list("\n", list(list("is_call()")), #> " tests for language nodes.\n"), "\n", list( #> "internal"), "\n"), is_reference.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_reference"), "\n", list("is_reference"), #> "\n", list("Is an object referencing another?"), #> "\n", list("\n", "is_reference(x, y)\n"), "\n", #> list("\n", list(list("x, y"), list("R objects.")), #> "\n"), "\n", list("\n", "There are typically two situations where two symbols may refer to\n", #> "the same object.\n", list("\n", list(), " R objects usually have copy-on-write semantics. This is an\n", #> "optimisation that ensures that objects are only copied if\n", #> "needed. When you copy a vector, no memory is actually copied\n", #> "until you modify either the original object or the copy is\n", #> "modified.\n", "\n", "Note that the copy-on-write optimisation is an implementation\n", #> "detail that is not guaranteed by the specification of the R\n", #> "language.\n", list(), " Assigning an ", #> list("uncopyable"), " object (like an\n", #> "environment) creates a reference. These objects are never copied\n", #> "even if you modify one of the references.\n"), #> "\n"), "\n", list("\n", "# Reassigning an uncopyable object such as an environment creates a\n", #> "# reference:\n", "env <- env()\n", "ref <- env\n", #> "is_reference(ref, env)\n", "\n", "# Due to copy-on-write optimisation, a copied vector can\n", #> "# temporarily reference the original vector:\n", #> "vec <- 1:10\n", "copy <- vec\n", "is_reference(copy, vec)\n", #> "\n", "# Once you modify on of them, the copy is triggered in the\n", #> "# background and the objects cease to reference each other:\n", #> "vec[[1]] <- 100\n", "is_reference(copy, vec)\n"), #> "\n", list("internal"), "\n"), is_stack.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("is_stack"), "\n", list("is_stack"), #> "\n", list("is_eval_stack"), "\n", list("is_call_stack"), #> "\n", list("Is object a stack?"), "\n", list( #> "\n", "is_stack(x)\n", "\n", "is_eval_stack(x)\n", #> "\n", "is_call_stack(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n"), "\n", list("internal"), "\n"), is_symbol.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/sym.R", #> "\n", list("is_symbol"), "\n", list("is_symbol"), #> "\n", list("Is object a symbol?"), "\n", list( #> "\n", "is_symbol(x, name = NULL)\n"), "\n", #> list("\n", list(list("x"), list("An object to test.")), #> "\n", "\n", list(list("name"), list("An optional name or vector of names that the symbol\n", #> "should match.")), "\n"), "\n", list("\n", #> "Is object a symbol?\n"), "\n"), is_true.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_true"), "\n", list("is_true"), #> "\n", list("is_false"), "\n", list("Is object identical to TRUE or FALSE?"), #> "\n", list("\n", "is_true(x)\n", "\n", "is_false(x)\n"), #> "\n", list("\n", list(list("x"), list("object to test")), #> "\n"), "\n", list("\n", "These functions bypass R's automatic conversion rules and check\n", #> "that ", list("x"), " is literally ", list( #> "TRUE"), " or ", list("FALSE"), ".\n"), "\n", #> list("\n", "is_true(TRUE)\n", "is_true(1)\n", #> "\n", "is_false(FALSE)\n", "is_false(0)\n"), #> "\n"), is_weakref.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/weakref.R", #> "\n", list("is_weakref"), "\n", list("is_weakref"), #> "\n", list("Is object a weak reference?"), "\n", #> list("\n", "is_weakref(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", "Is object a weak reference?\n"), #> "\n"), lang.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("lang"), "\n", list("lang"), "\n", #> list("new_language"), "\n", list("Create a call"), #> "\n", list("\n", "lang(.fn, ..., .ns = NULL)\n", #> "\n", "new_language(head, tail = NULL)\n"), #> "\n", list("\n", list(list(".fn"), list("Function to call. Must be a callable object: a string,\n", #> "symbol, call, or a function.")), "\n", "\n", #> list(list("..."), list("<", list("dynamic"), #> "> Arguments for the function\n", "call. Empty arguments are preserved.")), #> "\n", "\n", list(list(".ns"), list("Namespace with which to prefix ", #> list(".fn"), ". Must be a string\n", "or symbol.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions are deprecated, please use ", #> list(list("call2()")), " and\n", list(list( #> "new_call()")), " instead.\n"), "\n", list( #> "internal"), "\n"), lang_head.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("lang_head"), "\n", list("lang_head"), #> "\n", list("lang_tail"), "\n", list("Return the head or tail of a call"), #> "\n", list("\n", "lang_head(lang)\n", "\n", "lang_tail(lang)\n"), #> "\n", list("\n", list(list("lang"), list("A call.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "As of rlang 0.2.0 these functions are retired (deprecated for now)\n", #> "because they are low level accessors that are rarely needed for end\n", #> "users.\n"), "\n", list("internal"), "\n"), #> lang_modify.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("lang_modify"), "\n", list("lang_modify"), #> "\n", list("lang_standardise"), "\n", list("lang_fn"), #> "\n", list("lang_name"), "\n", list("lang_args"), #> "\n", list("lang_args_names"), "\n", list("Manipulate or access a call"), #> "\n", list("\n", "lang_modify(.lang, ..., .standardise = FALSE)\n", #> "\n", "lang_standardise(lang)\n", "\n", "lang_fn(lang)\n", #> "\n", "lang_name(lang)\n", "\n", "lang_args(lang)\n", #> "\n", "lang_args_names(lang)\n"), "\n", list( #> "\n", list(list("..."), list("<", list("dynamic"), #> "> Named or unnamed expressions\n", "(constants, names or calls) used to modify the call. Use ", #> list(list("zap()")), "\n", "to remove arguments. Empty arguments are preserved.")), #> "\n", "\n", list(list(".standardise"), list( #> "Soft-deprecated as of rlang 0.3.0. Please\n", #> "call ", list(list("call_standardise()")), #> " manually.")), "\n", "\n", list(list("lang, .lang"), #> list("The ", list("call"), " or ", list(".call"), #> " argument of the renamed\n", "functions.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions are deprecated, please use ", #> list(list("call_modify()")), ",\n", list(list( #> "call_standardise()")), ", or ", list(list( #> "call_fn()")), " instead.\n"), "\n", list( #> "internal"), "\n"), last_error.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-abort.R", #> "\n", list("last_error"), "\n", list("last_error"), #> "\n", list("last_trace"), "\n", list("Last ", #> list("abort()"), " error"), "\n", list("\n", #> "last_error()\n", "\n", "last_trace()\n"), #> "\n", list("\n", list("\n", list(), " ", list( #> "last_error()"), " returns the last error thrown with ", #> list(list("abort()")), ". The\n", "error is printed with a backtrace in simplified form.\n", #> list(), " ", list("last_trace()"), " is a shortcut to return the backtrace stored in\n", #> "the last error. This backtrace is printed in full form.\n"), #> "\n"), "\n"), lifecycle.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle.R", #> "\n", list("lifecycle"), "\n", list("lifecycle"), #> "\n", list("Life cycle of the rlang package"), #> "\n", list("\n", list("rlang:::lifecycle(\"maturing\")"), #> "\n", "\n", "The rlang package is currently maturing. Unless otherwise stated,\n", #> "this applies to all its exported functions. Maturing functions are\n", #> "susceptible to API changes. Only use these in packages if you're\n", #> "prepared to make changes as the package evolves. See sections below\n", #> "for a list of functions marked as stable.\n", #> "\n", "The documentation pages of retired functions contain life cycle\n", #> "sections that explain the reasons for their retirements.\n"), #> "\n", list(list("Stable functions"), list("\n", #> "\n", "\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", list("\n", list(), " ", list(list("eval_tidy()")), #> "\n", list(), " ", list("!!"), ", ", list( #> "!!!"), "\n", list(), " ", list(list("enquo()")), #> ", ", list(list("quo()")), ", ", list(list( #> "quos()")), "\n", list(), " ", list(list( #> "enexpr()")), ", ", list(list("expr()")), #> ", ", list(list("exprs()")), "\n", list(), #> " ", list(list("sym()")), ", ", list(list( #> "syms()")), "\n", list(), " ", list(list( #> "new_quosure()")), ", ", list(list("is_quosure()")), #> "\n", list(), " ", list(list("missing_arg()")), #> ", ", list(list("is_missing()")), "\n", list(), #> " ", list(list("quo_get_expr()")), ", ", #> list(list("quo_set_expr()")), "\n", list(), #> " ", list(list("quo_get_env()")), ", ", list( #> list("quo_set_env()")), "\n", list(), " ", #> list(list("eval_bare()")), "\n", list(), #> " ", list(list("set_names()")), ", ", list( #> list("names2()")), "\n", list(), " ", list( #> list("as_function()")), ", ", list(list( #> "new_function()")), "\n"), "\n")), "\n", #> "\n", list(list("Experimental functions"), list( #> "\n", "\n", "\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "These functions are not yet part of the rlang API. Expect breaking\n", #> "changes.\n", list("\n", list(), " ", list( #> list("with_env()")), ", ", list(list("locally()")), #> ", ", list(list("env_poke()")), "\n", list(), #> " ", list(list("pkg_env()")), ", ", list( #> list("pkg_env_name()")), ", ", list(list( #> "ns_env()")), ", ", list(list("ns_imports_env()")), #> ", ", list(list("ns_env_name()")), "\n", #> list(), " ", list(list("is_pairlist()")), #> ", ", list(list("as_pairlist()")), ", ", #> list(list("is_node()")), ", ", list(list( #> "is_node_list()")), "\n", list(), " ", #> list(list("is_definition()")), ", ", list( #> list("new_definition()")), ", ", list(list( #> "is_formulaish()")), ",\n", list(list("dots_definitions()")), #> "\n", list(), " ", list(list("local_options()")), #> ", ", list(list("with_options()")), ", ", #> list(list("push_options()")), ",\n", list( #> list("peek_options()")), ", ", list(list( #> "peek_option()")), "\n", list(), " ", list( #> list("as_bytes()")), ", ", list(list("chr_unserialise_unicode()")), #> "\n", list(), " ", list(list("caller_fn()")), #> ", ", list(list("current_fn()")), "\n"), #> "\n")), "\n", "\n", list(list("Questioning stage"), #> list("\n", "\n", "\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", list("In the questioning stage as of rlang 0.4.0"), #> "\n", "\n", "These functions are likely to be moved to the vctrs package:\n", #> list("\n", list(), " ", list(list("lgl()")), #> ", ", list(list("int()")), ", etc.\n", #> list(), " ", list(list("new_logical()")), #> ", ", list(list("new_integer()")), ", etc.\n", #> list(), " ", list("na_lgl"), ", ", list( #> "na_int"), ", ", list(list("is_lgl_na()")), #> ", ", list(list("is_int_na()")), ", etc.\n"), #> "\n", "\n", list("In the questioning stage as of rlang 0.3.0"), #> "\n", list("\n", list(), " ", list(list("child_env()")), #> "\n", list(), " ", list(list("flatten()")), #> ", ", list(list("squash()")), ", and their atomic vector variants\n", #> list(), " ", list(list("modify()")), " and ", #> list(list("prepend()")), "\n", list(), #> " ", list(list("with_restarts()")), ", ", #> list(list("rst_list()")), ", ", list(list( #> "rst_exists()")), ", ", list(list("rst_jump()")), #> ",\n", list(list("rst_maybe_jump()")), #> ", ", list(list("rst_abort()")), ". It is not clear yet whether we\n", #> "want to recommend restarts as a style of programming in R.\n", #> list(), " ", list(list("return_from()")), #> " and ", list(list("return_to()")), ".\n", #> list(), " ", list(list("expr_label()")), #> ", ", list(list("expr_name()")), ", and ", #> list(list("expr_text()")), ".\n"), "\n", #> "\n", list("In the questioning stage as of rlang 0.2.0"), #> "\n", list("\n", list(), " ", list(list("UQ()")), #> ", ", list(list("UQS()")), "\n", list(), #> " ", list(list("dots_splice()")), ", ", #> list(list("splice()")), "\n"), "\n")), #> "\n", "\n", list(list("Soft-deprecated functions and arguments"), #> list("\n", "\n", "\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", "\n", list("Soft-deprecated in rlang 0.4.0"), #> "\n", list("\n", list(), " ", list(list("exiting()")), #> ": Handlers are now treated as exiting by default.\n", #> list(), " ", list(list("invoke()")), ": Use the simpler ", #> list(list("exec()")), " instead.\n", list(), #> " ", list(list("as_logical()")), ", ", #> list(list("as_integer()")), ", etc. => ", #> list("vctrs::vec_cast()"), ".\n", list(), #> " ", list(list("type_of()")), ", ", list( #> list("switch_type()")), ", ", list(list( #> "coerce_type()")), ", ", list(list("switch_class()")), #> ",\n", list(list("coerce_class()")), "\n"), #> "\n")), "\n", "\n", list(list("Deprecated functions and arguments"), #> list("\n", "\n", "\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", list("Bumped to deprecated in rlang 0.4.0"), #> "\n", list("\n", list(), " ", list(list("modify()")), #> " and ", list(list("prepend()")), ".\n", #> list(), " ", list("new_logical_along()"), #> ", ", list("new_integer_along()"), ",\n", #> list("new_double_along()"), ", ", list( #> "new_complex_along()"), ",\n", list("new_character_along()"), #> ", ", list("new_raw_along()"), ", ", list( #> "new_list_along()"), ".\n", list(), " ", #> list(list("lang_modify()")), " => ", list( #> list("call_modify()")), "\n", list(), #> " ", list(list("lang_standardise()")), #> " => ", list(list("call_standardise()")), #> "\n", list(), " ", list(list("lang_fn()")), #> " => ", list(list("call_fn()")), "\n", #> list(), " ", list(list("lang_name()")), #> " => ", list(list("call_name()")), "\n", #> list(), " ", list(list("lang_args()")), #> " => ", list(list("call_args()")), "\n", #> list(), " ", list(list("lang_args_names()")), #> " => ", list(list("call_args_names()")), #> "\n", list(), " ", list(list("lang_head()")), #> ", ", list(list("lang_tail()")), "\n", #> list(), " ", list(list("lang()")), " => ", #> list(list("call2()")), "\n", list(), " ", #> list(list("new_language()")), " => ", list( #> list("new_call()")), "\n", list(), " ", #> list(list("is_lang()")), " => ", list(list( #> "is_call()")), "\n", list(), " ", list( #> list("is_unary_lang()")), " => Use the ", #> list("n"), " argument of ", list(list("is_call()")), #> "\n", list(), " ", list(list("is_binary_lang()")), #> " => Use the ", list("n"), " argument of ", #> list(list("is_call()")), "\n", list(), #> " ", list(list("quo_is_lang()")), " => ", #> list(list("quo_is_call()")), "\n", list(), #> " ", list(list("call_modify()")), ": ", #> list(".standardise"), " and ", list(".env"), #> " arguments.\n", list(), " ", list(list( #> "is_expr()")), " => ", list(list("is_expression()")), #> "\n", list(), " ", list("quo_expr()"), #> " => ", list(list("quo_squash()")), "\n", #> list(), " ", list(list("parse_quosure()")), #> " => ", list(list("parse_quo()")), "\n", #> list(), " ", list(list("parse_quosures()")), #> " => ", list(list("parse_quos()")), "\n", #> list(), " Assigning non-quosure objects to quosure lists.\n", #> list(), " ", list("as.character()"), " on quosures.\n", #> list(), " ", list(list("cnd_signal()")), #> ": ", list(".cnd"), " => ", list("cnd"), #> "\n", list(), " ", list(list("cnd_signal()")), #> ": The ", list(".mufflable"), " argument no longer has any effect\n", #> list(), " ", list("scoped_names()"), " => ", #> list(list("base::search()")), "\n", list(), #> " ", list("is_scoped()"), " => ", list( #> list("is_attached()")), "\n", list(), #> " ", list("scoped_env()"), " => ", list( #> list("search_env()")), "\n", list(), #> " ", list("scoped_envs()"), " => ", list( #> list("search_envs()")), "\n", list(), #> " ", list("env_bind_exprs()"), " => ", #> list(list("env_bind_lazy()")), "\n", list(), #> " ", list("env_bind_fns()"), " => ", list( #> list("env_bind_active()")), "\n", list(), #> " Passing a function or formula to ", list( #> "env_depth()"), ",\n", list("env_poke_parent()"), #> ", ", list("env_parent<-"), ", ", list( #> "env_tail()"), ", ", list("set_env()"), #> ",\n", list("env_clone()"), ", ", list( #> "env_inherits()"), ", ", list("env_bind()"), #> ",\n", list("local_bindings()"), ", ", #> list("with_bindings()"), ", ", list("env_poke()"), #> ",\n", list("env_has()"), ", ", list("env_get()"), #> ", ", list("env_names()"), ", ", list("env_bind_exprs()"), #> " and\n", list("env_bind_fns()"), ". This internal genericity was causing confusion\n", #> "(see issue #427). You should now extract the environment\n", #> "separately before calling these functions.\n", #> list(), " ", list(list("get_env()")), ": The ", #> list("env"), " argument no longer has a default and must be supplied\n", #> list(), " ", list(list("is_frame()")), #> ", ", list(list("global_frame()")), ", ", #> list(list("current_frame()")), ",\n", list( #> list("ctxt_frame()")), ", ", list(list( #> "call_frame()")), ", ", list(list("frame_position()")), #> ",\n", list(list("caller_frame()")), "\n", #> list(), " ", list(list("ctxt_depth()")), #> ", ", list(list("call_depth()")), ", ", #> list(list("ctxt_stack()")), ", ", list( #> list("call_stack()")), ",\n", list(list( #> "stack_trim()")), "\n", list(), " ", #> list(list("set_attrs()")), ", ", list(list( #> "mut_attrs()")), "\n", list(), " The ", #> list("width"), " and ", list("printer"), #> " arguments of ", list(list("exprs_auto_name()")), #> " and\n", list(list("quos_auto_name()")), #> " no longer have any effect. For the same\n", #> "reason, passing a width as ", list(".named"), #> " argument of dots collectors\n", "like ", #> list("quos()"), " is deprecated.\n", list(), #> " ", list("as_overscope()"), " => ", list( #> list("as_data_mask()")), "\n", list(), #> " ", list("new_overscope()"), " => ", list( #> list("new_data_mask()")), "\n", list(), #> " ", list("overscope_eval_next()"), " => ", #> list(list("eval_tidy()")), "\n", list(), #> " ", list("overscope_clean()"), "\n"), #> "\n")), "\n", "\n", list(list("Defunct functions and arguments"), #> list("\n", "\n", "\n", list("rlang:::lifecycle(\"defunct\")"), #> "\n", "\n", list("Defunct as of rlang 0.4.0"), #> "\n", list("\n", list(), " ", list("length()"), #> " and ", list("names()"), " on tidy eval ", #> list(".data"), " pronouns.\n", list(), #> " Supplying a named ", list("!!!"), " call.\n"), #> "\n")), "\n", "\n", list("internal"), "\n"), #> list2.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("list2"), "\n", list("list2"), "\n", #> list("ll"), "\n", list("dots_list"), "\n", list( #> "Collect dots in a list"), "\n", list("\n", #> "list2(...)\n", "\n", "dots_list(\n", " ...,\n", #> " .named = FALSE,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .preserve_empty = FALSE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n"), "\n", #> list("\n", list(list("..."), list("Arguments to collect in a list. These dots are\n", #> list("dynamic"), ".")), "\n", "\n", list(list( #> ".named"), list("Whether to ensure all dots are named. Unnamed\n", #> "elements are processed with ", list(list("as_label()")), #> " to build a default\n", "name.")), "\n", "\n", #> list(list(".ignore_empty"), list("Whether to ignore empty arguments. Can be one\n", #> "of ", list("\"trailing\""), ", ", list("\"none\""), #> ", ", list("\"all\""), ". If ", list("\"trailing\""), #> ", only the\n", "last argument is ignored if it is empty.")), #> "\n", "\n", list(list(".preserve_empty"), list( #> "Whether to preserve the empty arguments that\n", #> "were not ignored. If ", list("TRUE"), ", empty arguments are stored with\n", #> list(list("missing_arg()")), " values. If ", #> list("FALSE"), " (the default) an error is\n", #> "thrown when an empty argument is detected.")), #> "\n", "\n", list(list(".homonyms"), list("How to treat arguments with the same name. The\n", #> "default, ", list("\"keep\""), ", preserves these arguments. Set ", #> list(".homonyms"), " to\n", list("\"first\""), #> " to only keep the first occurrences, to ", #> list("\"last\""), " to keep\n", "the last occurrences, and to ", #> list("\"error\""), " to raise an informative\n", #> "error and indicate what arguments have duplicated names.")), #> "\n", "\n", list(list(".check_assign"), list( #> "Whether to check for ", list("<-"), " calls passed in\n", #> "dots. When ", list("TRUE"), " and a ", list( #> "<-"), " call is detected, a warning is\n", #> "issued to advise users to use ", list("="), #> " if they meant to match a\n", "function parameter, or wrap the ", #> list("<-"), " call in braces otherwise.\n", #> "This ensures assignments are explicit.")), #> "\n"), "\n", list("\n", "A list containing the ", #> list("..."), " inputs.\n"), "\n", list("\n", #> list("list2(...)"), " is equivalent to ", list( #> "list(...)"), " with a few additional\n", #> "features, collectively called ", list("dynamic dots"), #> ". While\n", list("list2()"), " hard-code these features, ", #> list("dots_list()"), " is a lower-level\n", #> "version that offers more control.\n"), "\n", #> list("\n", "# Let's create a function that takes a variable number of arguments:\n", #> "numeric <- function(...) {\n", " dots <- list2(...)\n", #> " num <- as.numeric(dots)\n", " set_names(num, names(dots))\n", #> "}\n", "numeric(1, 2, 3)\n", "\n", "# The main difference with list(...) is that list2(...) enables\n", #> "# the `!!!` syntax to splice lists:\n", "x <- list(2, 3)\n", #> "numeric(1, !!! x, 4)\n", "\n", "# As well as unquoting of names:\n", #> "nm <- \"yup!\"\n", "numeric(!!nm := 1)\n", #> "\n", "\n", "# One useful application of splicing is to work around exact and\n", #> "# partial matching of arguments. Let's create a function taking\n", #> "# named arguments and dots:\n", "fn <- function(data, ...) {\n", #> " list2(...)\n", "}\n", "\n", "# You normally cannot pass an argument named `data` through the dots\n", #> "# as it will match `fn`'s `data` argument. The splicing syntax\n", #> "# provides a workaround:\n", "fn(\"wrong!\", data = letters) # exact matching of `data`\n", #> "fn(\"wrong!\", dat = letters) # partial matching of `data`\n", #> "fn(some_data, !!!list(data = letters)) # no matching\n", #> "\n", "\n", "# Empty arguments trigger an error by default:\n", #> "try(fn(, ))\n", "\n", "# You can choose to preserve empty arguments instead:\n", #> "list3 <- function(...) dots_list(..., .preserve_empty = TRUE)\n", #> "\n", "# Note how the last empty argument is still ignored because\n", #> "# `.ignore_empty` defaults to \"trailing\":\n", #> "list3(, )\n", "\n", "# The list with preserved empty arguments is equivalent to:\n", #> "list(missing_arg())\n", "\n", "\n", "# Arguments with duplicated names are kept by default:\n", #> "list2(a = 1, a = 2, b = 3, b = 4, 5, 6)\n", #> "\n", "# Use the `.homonyms` argument to keep only the first of these:\n", #> "dots_list(a = 1, a = 2, b = 3, b = 4, 5, 6, .homonyms = \"first\")\n", #> "\n", "# Or the last:\n", "dots_list(a = 1, a = 2, b = 3, b = 4, 5, 6, .homonyms = \"last\")\n", #> "\n", "# Or raise an informative error:\n", #> "try(dots_list(a = 1, a = 2, b = 3, b = 4, 5, 6, .homonyms = \"error\"))\n", #> "\n", "\n", "# dots_list() can be configured to warn when a `<-` call is\n", #> "# detected:\n", "my_list <- function(...) dots_list(..., .check_assign = TRUE)\n", #> "my_list(a <- 1)\n", "\n", "# There is no warning if the assignment is wrapped in braces.\n", #> "# This requires users to be explicit about their intent:\n", #> "my_list({ a <- 1 })\n"), "\n"), local_bindings.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("local_bindings"), "\n", list("local_bindings"), #> "\n", list("with_bindings"), "\n", list("Temporarily change bindings of an environment"), #> "\n", list("\n", "local_bindings(..., .env = .frame, .frame = caller_env())\n", #> "\n", "with_bindings(.expr, ..., .env = caller_env())\n"), #> "\n", list("\n", list(list("..."), list("Pairs of names and values. These dots support splicing\n", #> "(with value semantics) and name unquoting.")), #> "\n", "\n", list(list(".env"), list("An environment.")), #> "\n", "\n", list(list(".frame"), list("The frame environment that determines the scope of\n", #> "the temporary bindings. When that frame is popped from the call\n", #> "stack, bindings are switched back to their original values.")), #> "\n", "\n", list(list(".expr"), list("An expression to evaluate with temporary bindings.")), #> "\n"), "\n", list("\n", list("local_bindings()"), #> " returns the values of old bindings\n", "invisibly; ", #> list("with_bindings()"), " returns the value of ", #> list("expr"), ".\n"), "\n", list("\n", list( #> "\n", list(), " ", list("local_bindings()"), #> " temporarily changes bindings in ", list(".env"), #> " (which\n", "is by default the caller environment). The bindings are reset to\n", #> "their original values when the current frame (or an arbitrary one\n", #> "if you specify ", list(".frame"), ") goes out of scope.\n", #> list(), " ", list("with_bindings()"), " evaluates ", #> list("expr"), " with temporary bindings. When\n", #> list("with_bindings()"), " returns, bindings are reset to their original\n", #> "values. It is a simple wrapper around ", list( #> "local_bindings()"), ".\n"), "\n"), "\n", #> list("\n", "foo <- \"foo\"\n", "bar <- \"bar\"\n", #> "\n", "# `foo` will be temporarily rebinded while executing `expr`\n", #> "with_bindings(paste(foo, bar), foo = \"rebinded\")\n", #> "paste(foo, bar)\n"), "\n"), local_options.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/state.R", #> "\n", list("local_options"), "\n", list("local_options"), #> "\n", list("with_options"), "\n", list("push_options"), #> "\n", list("peek_options"), "\n", list("peek_option"), #> "\n", list("Change global options"), "\n", list( #> "\n", "local_options(..., .frame = caller_env())\n", #> "\n", "with_options(.expr, ...)\n", "\n", "push_options(...)\n", #> "\n", "peek_options(...)\n", "\n", "peek_option(name)\n"), #> "\n", list("\n", list(list("..."), list("For ", #> list("local_options()"), " and ", list("push_options()"), #> ", named\n", "values defining new option values. For ", #> list("peek_options()"), ", strings\n", "or character vectors of option names.")), #> "\n", "\n", list(list(".frame"), list("The environment of a stack frame which defines the\n", #> "scope of the temporary options. When the frame returns, the\n", #> "options are set back to their original values.")), #> "\n", "\n", list(list(".expr"), list("An expression to evaluate with temporary options.")), #> "\n", "\n", list(list("name"), list("An option name as string.")), #> "\n"), "\n", list("\n", "For ", list("local_options()"), #> " and ", list("push_options()"), ", the old option\n", #> "values. ", list("peek_option()"), " returns the current value of an option\n", #> "while the plural ", list("peek_options()"), #> " returns a list of current\n", "option values.\n"), #> "\n", list("\n", list("\n", list(), " ", list( #> "local_options()"), " changes options for the duration of a stack\n", #> "frame (by default the current one). Options are set back to their\n", #> "old values when the frame returns.\n", list(), #> " ", list("with_options()"), " changes options while an expression is\n", #> "evaluated. Options are restored when the expression returns.\n", #> list(), " ", list("push_options()"), " adds or changes options permanently.\n", #> list(), " ", list("peek_option()"), " and ", #> list("peek_options()"), " return option values. The\n", #> "former returns the option directly while the latter returns a\n", #> "list.\n"), "\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "These functions are experimental.\n")), #> "\n", "\n", list("\n", "# Store and retrieve a global option:\n", #> "push_options(my_option = 10)\n", "peek_option(\"my_option\")\n", #> "\n", "# Change the option temporarily:\n", #> "with_options(my_option = 100, peek_option(\"my_option\"))\n", #> "peek_option(\"my_option\")\n", "\n", "# The scoped variant is useful within functions:\n", #> "fn <- function() {\n", " local_options(my_option = 100)\n", #> " peek_option(\"my_option\")\n", "}\n", "fn()\n", #> "peek_option(\"my_option\")\n", "\n", "# The plural peek returns a named list:\n", #> "peek_options(\"my_option\")\n", "peek_options(\"my_option\", \"digits\")\n"), #> "\n", list("experimental"), "\n"), missing.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-na.R", #> "\n", list("data"), "\n", list("missing"), "\n", #> list("missing"), "\n", list("na_lgl"), "\n", #> list("na_int"), "\n", list("na_dbl"), "\n", list( #> "na_chr"), "\n", list("na_cpl"), "\n", list( #> "Missing values"), "\n", list("\n", "An object of class ", #> list("logical"), " of length 1.\n", "\n", "An object of class ", #> list("integer"), " of length 1.\n", "\n", "An object of class ", #> list("numeric"), " of length 1.\n", "\n", "An object of class ", #> list("character"), " of length 1.\n", "\n", #> "An object of class ", list("complex"), " of length 1.\n"), #> "\n", list("\n", "na_lgl\n", "\n", "na_int\n", #> "\n", "na_dbl\n", "\n", "na_chr\n", "\n", "na_cpl\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "Missing values are represented in R with the general symbol\n", #> list("NA"), ". They can be inserted in almost all data containers: all\n", #> "atomic vectors except raw vectors can contain missing values. To\n", #> "achieve this, R automatically converts the general ", #> list("NA"), " symbol to a\n", "typed missing value appropriate for the target vector. The objects\n", #> "provided here are aliases for those typed ", #> list("NA"), " objects.\n"), "\n", list("\n", #> "Typed missing values are necessary because R needs sentinel values\n", #> "of the same type (i.e. the same machine representation of the data)\n", #> "as the containers into which they are inserted. The official typed\n", #> "missing values are ", list("NA_integer_"), #> ", ", list("NA_real_"), ", ", list("NA_character_"), #> " and\n", list("NA_complex_"), ". The missing value for logical vectors is simply the\n", #> "default ", list("NA"), ". The aliases provided in rlang are consistently named\n", #> "and thus simpler to remember. Also, ", list( #> "na_lgl"), " is provided as an\n", "alias to ", #> list("NA"), " that makes intent clearer.\n", #> "\n", "Since ", list("na_lgl"), " is the default ", #> list("NA"), ", expressions such as ", list( #> "c(NA, NA)"), "\n", "yield logical vectors as no data is available to give a clue of the\n", #> "target type. In the same way, since lists and environments can\n", #> "contain any types, expressions like ", list( #> "list(NA)"), " store a logical\n", list("NA"), #> ".\n"), "\n", list(list("Life cycle"), list( #> "\n", "\n", "\n", "These shortcuts might be moved to the vctrs package at some\n", #> "point. This is why they are marked as questioning.\n")), #> "\n", "\n", list("\n", "typeof(NA)\n", "typeof(na_lgl)\n", #> "typeof(na_int)\n", "\n", "# Note that while the base R missing symbols cannot be overwritten,\n", #> "# that's not the case for rlang's aliases:\n", #> "na_dbl <- NA\n", "typeof(na_dbl)\n"), "\n", #> list("datasets"), "\n", list("internal"), "\n"), #> missing_arg.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/arg.R", #> "\n", list("missing_arg"), "\n", list("missing_arg"), #> "\n", list("is_missing"), "\n", list("maybe_missing"), #> "\n", list("Generate or handle a missing argument"), #> "\n", list("\n", "missing_arg()\n", "\n", "is_missing(x)\n", #> "\n", "maybe_missing(x, default = missing_arg())\n"), #> "\n", list("\n", list(list("x"), list("An object that might be the missing argument.")), #> "\n", "\n", list(list("default"), list("The object to return if the input is missing,\n", #> "defaults to ", list("missing_arg()"), ".")), #> "\n"), "\n", list("\n", "These functions help using the missing argument as a regular R\n", #> "object.\n", list("\n", list(), " ", list("missing_arg()"), #> " generates a missing argument.\n", list(), #> " ", list("is_missing()"), " is like ", list( #> list("base::missing()")), " but also supports\n", #> "testing for missing arguments contained in other objects like\n", #> "lists.\n", list(), " ", list("maybe_missing()"), #> " is useful to pass down an input that might be\n", #> "missing to another function, potentially substituting by a\n", #> "default value. It avoids triggering an \"argument is missing\" error.\n"), #> "\n"), "\n", list(list("Other ways to reify the missing argument"), #> list("\n", "\n", list("\n", list(), " ", list( #> "base::quote(expr = )"), " is the canonical way to create a missing\n", #> "argument object.\n", list(), " ", list("expr()"), #> " called without argument creates a missing argument.\n", #> list(), " ", list("quo()"), " called without argument creates an empty quosure, i.e. a\n", #> "quosure containing the missing argument object.\n"), #> "\n")), "\n", "\n", list(list("Fragility of the missing argument object"), #> list("\n", "\n", "\n", "The missing argument is an object that triggers an error if and\n", #> "only if it is the result of evaluating a symbol. No error is\n", #> "produced when a function call evaluates to the missing argument\n", #> "object. This means that expressions like ", #> list("x[[1]] <- missing_arg()"), "\n", "are perfectly safe. Likewise, ", #> list("x[[1]]"), " is safe even if the result\n", #> "is the missing object.\n", "\n", "However, as soon as the missing argument is passed down between\n", #> "functions through an argument, you're at risk of triggering a\n", #> "missing error. This is because arguments are passed through\n", #> "symbols. To work around this, ", list("is_missing()"), #> " and ", list("maybe_missing(x)"), "\n", #> "use a bit of magic to determine if the input is the missing\n", #> "argument without triggering a missing error.\n", #> "\n", list("maybe_missing()"), " is particularly useful for prototyping\n", #> "meta-programming algorithms in R. The missing argument is a likely\n", #> "input when computing on the language because it is a standard\n", #> "object in formals lists. While C functions are always allowed to\n", #> "return the missing argument and pass it to other C functions, this\n", #> "is not the case on the R side. If you're implementing your\n", #> "meta-programming algorithm in R, use ", #> list("maybe_missing()"), " when an\n", "input might be the missing argument object.\n")), #> "\n", "\n", list(list("Life cycle"), list("\n", #> "\n", list("\n", list(), " ", list("missing_arg()"), #> " and ", list("is_missing()"), " are stable.\n", #> list(), " Like the rest of rlang, ", list( #> "maybe_missing()"), " is maturing.\n"), #> "\n")), "\n", "\n", list("\n", "# The missing argument usually arises inside a function when the\n", #> "# user omits an argument that does not have a default:\n", #> "fn <- function(x) is_missing(x)\n", "fn()\n", #> "\n", "# Creating a missing argument can also be useful to generate calls\n", #> "args <- list(1, missing_arg(), 3, missing_arg())\n", #> "quo(fn(!!! args))\n", "\n", "# Other ways to create that object include:\n", #> "quote(expr = )\n", "expr()\n", "\n", "# It is perfectly valid to generate and assign the missing\n", #> "# argument in a list.\n", "x <- missing_arg()\n", #> "l <- list(missing_arg())\n", "\n", "# Just don't evaluate a symbol that contains the empty argument.\n", #> "# Evaluating the object `x` that we created above would trigger an\n", #> "# error.\n", "# x # Not run\n", "\n", "# On the other hand accessing a missing argument contained in a\n", #> "# list does not trigger an error because subsetting is a function\n", #> "# call:\n", "l[[1]]\n", "is.null(l[[1]])\n", #> "\n", "# In case you really need to access a symbol that might contain the\n", #> "# empty argument object, use maybe_missing():\n", #> "maybe_missing(x)\n", "is.null(maybe_missing(x))\n", #> "is_missing(maybe_missing(x))\n", "\n", "\n", #> "# Note that base::missing() only works on symbols and does not\n", #> "# support complex expressions. For this reason the following lines\n", #> "# would throw an error:\n", "\n", "#> missing(missing_arg())\n", #> "#> missing(l[[1]])\n", "\n", "# while is_missing() will work as expected:\n", #> "is_missing(missing_arg())\n", "is_missing(l[[1]])\n"), #> "\n"), mut_node_car.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("mut_node_car"), "\n", list("mut_node_car"), #> "\n", list("mut_node_cdr"), "\n", list("mut_node_caar"), #> "\n", list("mut_node_cadr"), "\n", list("mut_node_cdar"), #> "\n", list("mut_node_cddr"), "\n", list("mut_node_tag"), #> "\n", list("Mutate node components"), "\n", list( #> "\n", "mut_node_car(x, newcar)\n", "\n", "mut_node_cdr(x, newcdr)\n", #> "\n", "mut_node_caar(x, newcar)\n", "\n", "mut_node_cadr(x, newcar)\n", #> "\n", "mut_node_cdar(x, newcdr)\n", "\n", "mut_node_cddr(x, newcdr)\n", #> "\n", "mut_node_tag(x, newtag)\n"), "\n", list( #> "\n", list(list("x"), list("A language or pairlist node. Note that these functions are\n", #> "barebones and do not perform any type checking.")), #> "\n", "\n", list(list("newcar"), list("The new CAR or CDR for the node. These\n", #> "can be any R objects.")), "\n", "\n", list( #> list("newcdr"), list("The new CAR or CDR for the node. These\n", #> "can be any R objects.")), "\n", "\n", #> list(list("newtag"), list("The new tag for the node. This should be a symbol.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions were deprecated and renamed with ", #> list("node_poke_"), "\n", "prefix in rlang 0.2.0. This change follows a new naming convention\n", #> "where mutation is referred to as \"poking\".\n"), #> "\n", list("internal"), "\n"), names2.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("names2"), "\n", list("names2"), "\n", #> list("Get names of a vector"), "\n", list("\n", #> "names2(x)\n"), "\n", list("\n", list(list( #> "x"), list("A vector.")), "\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", "This names getter always returns a character vector, even when an\n", #> "object does not have a ", list("names"), " attribute. In this case, it returns\n", #> "a vector of empty names ", list("\"\""), ". It also standardises missing names to\n", #> list("\"\""), ".\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", list("names2()"), " is stable.\n")), #> "\n", "\n", list("\n", "names2(letters)\n", "\n", #> "# It also takes care of standardising missing names:\n", #> "x <- set_names(1:3, c(\"a\", NA, \"b\"))\n", #> "names2(x)\n"), "\n"), `new-vector-along-retired.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("new-vector-along-retired"), "\n", #> list("new-vector-along-retired"), "\n", list( #> "new_logical_along"), "\n", list("new_integer_along"), #> "\n", list("new_double_along"), "\n", list("new_character_along"), #> "\n", list("new_complex_along"), "\n", list("new_raw_along"), #> "\n", list("new_list_along"), "\n", list("Create vectors matching the length of a given vector"), #> "\n", list("\n", "new_logical_along(x, names = base::names(x))\n", #> "\n", "new_integer_along(x, names = base::names(x))\n", #> "\n", "new_double_along(x, names = base::names(x))\n", #> "\n", "new_character_along(x, names = base::names(x))\n", #> "\n", "new_complex_along(x, names = base::names(x))\n", #> "\n", "new_raw_along(x, names = base::names(x))\n", #> "\n", "new_list_along(x, names = base::names(x))\n"), #> "\n", list("\n", list(list("x"), list("A vector.")), #> "\n", "\n", list(list("names"), list("Names for the new vector.")), #> "\n"), "\n", list("\n", "These functions are deprecated as of rlang 0.3.0 because they\n", #> "are longer to type than the equivalent ", #> list(list("rep_along()")), " or\n", list(list( #> "rep_named()")), " calls without added clarity.\n"), #> "\n", list("internal"), "\n"), `new-vector.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-new.R", #> "\n", list("new-vector"), "\n", list("new-vector"), #> "\n", list("new_logical"), "\n", list("new_integer"), #> "\n", list("new_double"), "\n", list("new_character"), #> "\n", list("new_complex"), "\n", list("new_raw"), #> "\n", list("new_list"), "\n", list("Create vectors matching a given length"), #> "\n", list("\n", "new_logical(n, names = NULL)\n", #> "\n", "new_integer(n, names = NULL)\n", "\n", #> "new_double(n, names = NULL)\n", "\n", "new_character(n, names = NULL)\n", #> "\n", "new_complex(n, names = NULL)\n", "\n", #> "new_raw(n, names = NULL)\n", "\n", "new_list(n, names = NULL)\n"), #> "\n", list("\n", list(list("n"), list("The vector length.")), #> "\n", "\n", list(list("names"), list("Names for the new vector.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "These functions construct vectors of a given length, with attributes\n", #> "specified via dots. Except for ", list("new_list()"), #> " and ", list("new_raw()"), ", the\n", "empty vectors are filled with typed ", #> list("missing"), " values. This is in\n", "contrast to the base function ", #> list(list("base::vector()")), " which creates\n", #> "zero-filled vectors.\n"), "\n", list(list( #> "Lifecycle"), list("\n", "\n", "\n", "These functions are likely to be replaced by a vctrs equivalent in\n", #> "the future. They are in the questioning lifecycle stage.\n")), #> "\n", "\n", list("\n", "new_list(10)\n", "new_logical(10)\n"), #> "\n", list("\n", "rep_along\n"), "\n", list("internal"), #> "\n"), new_call.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/node.R", #> "\n", list("new_call"), "\n", list("new_call"), #> "\n", list("Create a new call from components"), #> "\n", list("\n", "new_call(car, cdr = NULL)\n"), #> "\n", list("\n", list(list("car"), list("The head of the call. It should be a\n", #> list("callable"), " object: a symbol, call, or literal\n", #> "function.")), "\n", "\n", list(list("cdr"), #> list("The tail of the call, i.e. a ", list( #> "node list"), " of\n", "arguments.")), "\n"), #> "\n", list("\n", "Create a new call from components\n"), #> "\n", list("internal"), "\n"), new_formula.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/formula.R", #> "\n", list("new_formula"), "\n", list("new_formula"), #> "\n", list("Create a formula"), "\n", list("\n", #> "new_formula(lhs, rhs, env = caller_env())\n"), #> "\n", list("\n", list(list("lhs, rhs"), list( #> "A call, name, or atomic vector.")), "\n", #> "\n", list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "A formula object.\n"), #> "\n", list("\n", "Create a formula\n"), "\n", #> list("\n", "new_formula(quote(a), quote(b))\n", #> "new_formula(NULL, quote(b))\n"), "\n", list( #> "\n", list(list("new_quosure()")), "\n"), "\n"), #> new_function.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("new_function"), "\n", list("new_function"), #> "\n", list("Create a function"), "\n", list("\n", #> "new_function(args, body, env = caller_env())\n"), #> "\n", list("\n", list(list("args"), list("A named list or pairlist of default arguments. Note\n", #> "that if you want arguments that don't have defaults, you'll need\n", #> "to use the special function ", list(list("pairlist2()")), #> ". If you need quoted\n", "defaults, use ", #> list(list("exprs()")), ".")), "\n", "\n", list( #> list("body"), list("A language object representing the code inside the\n", #> "function. Usually this will be most easily generated with\n", #> list(list("base::quote()")))), "\n", "\n", #> list(list("env"), list("The parent environment of the function, defaults to the\n", #> "calling environment of ", list("new_function()"))), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", "This constructs a new function given its three components:\n", #> "list of arguments, body code and parent environment.\n"), #> "\n", list("\n", "f <- function() letters\n", #> "g <- new_function(NULL, quote(letters))\n", #> "identical(f, g)\n", "\n", "# Pass a list or pairlist of named arguments to create a function\n", #> "# with parameters. The name becomes the parameter name and the\n", #> "# argument the default value for this parameter:\n", #> "new_function(list(x = 10), quote(x))\n", "new_function(pairlist2(x = 10), quote(x))\n", #> "\n", "# Use `exprs()` to create quoted defaults. Compare:\n", #> "new_function(pairlist2(x = 5 + 5), quote(x))\n", #> "new_function(exprs(x = 5 + 5), quote(x))\n", #> "\n", "# Pass empty arguments to omit defaults. `list()` doesn't allow\n", #> "# empty arguments but `pairlist2()` does:\n", #> "new_function(pairlist2(x = , y = 5 + 5), quote(x + y))\n", #> "new_function(exprs(x = , y = 5 + 5), quote(x + y))\n"), #> "\n"), new_node.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/node.R", #> "\n", list("new_node"), "\n", list("new_node"), #> "\n", list("node_car"), "\n", list("node_cdr"), #> "\n", list("node_caar"), "\n", list("node_cadr"), #> "\n", list("node_cdar"), "\n", list("node_cddr"), #> "\n", list("node_poke_car"), "\n", list("node_poke_cdr"), #> "\n", list("node_poke_caar"), "\n", list("node_poke_cadr"), #> "\n", list("node_poke_cdar"), "\n", list("node_poke_cddr"), #> "\n", list("node_tag"), "\n", list("node_poke_tag"), #> "\n", list("Helpers for pairlist and language nodes"), #> "\n", list("\n", "new_node(car, cdr = NULL)\n", #> "\n", "node_car(x)\n", "\n", "node_cdr(x)\n", #> "\n", "node_caar(x)\n", "\n", "node_cadr(x)\n", #> "\n", "node_cdar(x)\n", "\n", "node_cddr(x)\n", #> "\n", "node_poke_car(x, newcar)\n", "\n", "node_poke_cdr(x, newcdr)\n", #> "\n", "node_poke_caar(x, newcar)\n", "\n", #> "node_poke_cadr(x, newcar)\n", "\n", "node_poke_cdar(x, newcdr)\n", #> "\n", "node_poke_cddr(x, newcdr)\n", "\n", #> "node_tag(x)\n", "\n", "node_poke_tag(x, newtag)\n"), #> "\n", list("\n", list(list("car, newcar, cdr, newcdr"), #> list("The new CAR or CDR for the node. These\n", #> "can be any R objects.")), "\n", "\n", list( #> list("x"), list("A language or pairlist node. Note that these functions are\n", #> "barebones and do not perform any type checking.")), #> "\n", "\n", list(list("newtag"), list("The new tag for the node. This should be a symbol.")), #> "\n"), "\n", list("\n", "Setters like ", list( #> "node_poke_car()"), " invisibly return ", list( #> "x"), " modified\n", "in place. Getters return the requested node component.\n"), #> "\n", list("\n", list("Important"), ": These functions are for expert R programmers only.\n", #> "You should only use them if you feel comfortable manipulating low\n", #> "level R data structures at the C level. We export them at the R level\n", #> "in order to make it easy to prototype C code. They don't perform\n", #> "any type checking and can crash R very easily (try to take the CAR\n", #> "of an integer vector --- save any important objects beforehand!).\n"), #> "\n", list("\n", list(list("duplicate()")), " for creating copy-safe objects and\n", #> list(list("base::pairlist()")), " for an easier way of creating a linked list of\n", #> "nodes.\n"), "\n", list("internal"), "\n"), #> new_quosures.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/quo.R", #> "\n", list("new_quosures"), "\n", list("new_quosures"), #> "\n", list("as_quosures"), "\n", list("is_quosures"), #> "\n", list("Create a list of quosures"), "\n", #> list("\n", "new_quosures(x)\n", "\n", "as_quosures(x, env, named = FALSE)\n", #> "\n", "is_quosures(x)\n"), "\n", list("\n", #> list(list("x"), list("A list of quosures or objects to coerce to quosures.")), #> "\n", "\n", list(list("env"), list("The default environment for the new quosures.")), #> "\n", "\n", list(list("named"), list("Whether to name the list with ", #> list(list("quos_auto_name()")), ".")), "\n"), #> "\n", list("\n", "This small S3 class provides methods for ", #> list("["), " and ", list("c()"), " and ensures\n", #> "the following invariants:\n", list("\n", list(), #> " The list only contains quosures.\n", list(), #> " It is always named, possibly with a vector of empty strings.\n"), #> "\n", "\n", list("new_quosures()"), " takes a list of quosures and adds the ", #> list("quosures"), "\n", "class and a vector of empty names if needed. ", #> list("as_quosures()"), " calls\n", list(list( #> "as_quosure()")), " on all elements before creating the ", #> list("quosures"), "\n", "object.\n"), "\n"), #> new_weakref.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/weakref.R", #> "\n", list("new_weakref"), "\n", list("new_weakref"), #> "\n", list("Create a weak reference"), "\n", #> list("\n", "new_weakref(key, value = NULL, finalizer = NULL, on_quit = FALSE)\n"), #> "\n", list("\n", list(list("key"), list("The key for the weak reference. Must be a reference object -- that\n", #> "is, an environment or external pointer.")), #> "\n", "\n", list(list("value"), list("The value for the weak reference. This can be ", #> list("NULL"), ", if you\n", "want to use the weak reference like a weak pointer.")), #> "\n", "\n", list(list("finalizer"), list("A function that is run after the key becomes unreachable.")), #> "\n", "\n", list(list("on_quit"), list("Should the finalizer be run when R exits?")), #> "\n"), "\n", list("\n", "A weak reference is a special R object which makes it possible to keep a\n", #> "reference to an object without preventing garbage collection of that object.\n", #> "It can also be used to keep data about an object without preventing GC of the\n", #> "object, similar to WeakMaps in JavaScript.\n", #> "\n", "Objects in R are considered ", list( #> "reachable"), " if they can be accessed by following\n", #> "a chain of references, starting from a ", #> list("root node"), "; root nodes are\n", "specially-designated R objects, and include the global environment and base\n", #> "environment. As long as the key is reachable, the value will not be garbage\n", #> "collected. This is true even if the weak reference object becomes\n", #> "unreachable. The key effectively prevents the weak reference and its value\n", #> "from being collected, according to the following chain of ownership:\n", #> list("weakref <- key -> value"), ".\n", "\n", #> "When the key becomes unreachable, the key and value in the weak reference\n", #> "object are replaced by ", list("NULL"), ", and the finalizer is scheduled to execute.\n"), #> "\n", list("\n", "e <- env()\n", "\n", "# Create a weak reference to e\n", #> "w <- new_weakref(e, finalizer = function(e) message(\"finalized\"))\n", #> "\n", "# Get the key object from the weak reference\n", #> "identical(wref_key(w), e)\n", "\n", "# When the regular reference (the `e` binding) is removed and a GC occurs,\n", #> "# the weak reference will not keep the object alive.\n", #> "rm(e)\n", "gc()\n", "identical(wref_key(w), NULL)\n", #> "\n", "\n", "# A weak reference with a key and value. The value contains data about the\n", #> "# key.\n", "k <- env()\n", "v <- list(1, 2, 3)\n", #> "w <- new_weakref(k, v)\n", "\n", "identical(wref_key(w), k)\n", #> "identical(wref_value(w), v)\n", "\n", "# When v is removed, the weak ref keeps it alive because k is still reachable.\n", #> "rm(v)\n", "gc()\n", "identical(wref_value(w), list(1, 2, 3))\n", #> "\n", "# When k is removed, the weak ref does not keep k or v alive.\n", #> "rm(k)\n", "gc()\n", "identical(wref_key(w), NULL)\n", #> "identical(wref_value(w), NULL)\n"), "\n", #> list("\n", list(list("is_weakref()")), ", ", #> list(list("wref_key()")), " and ", list(list( #> "wref_value()")), ".\n"), "\n", list("experimental"), #> "\n"), ns_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("ns_env"), "\n", list("ns_env"), "\n", #> list("ns_imports_env"), "\n", list("ns_env_name"), #> "\n", list("Get the namespace of a package"), #> "\n", list("\n", "ns_env(x = caller_env())\n", #> "\n", "ns_imports_env(x = caller_env())\n", #> "\n", "ns_env_name(x = caller_env())\n"), "\n", #> list("\n", list(list("x"), list(list("\n", list(), #> " For ", list("ns_env()"), ", the name of a package or an environment as a\n", #> "string.\n", list("\n", list(), " An environment (the current environment by default).\n", #> list(), " A function.\n"), "\n", "\n", "In the latter two cases, the environment ancestry is searched for\n", #> "a namespace with ", list(list("base::topenv()")), #> ". If the environment doesn't\n", "inherit from a namespace, this is an error.\n"))), #> "\n", "\n", list(list("env"), list("A namespace environment.")), #> "\n"), "\n", list("\n", "Namespaces are the environment where all the functions of a package\n", #> "live. The parent environments of namespaces are the ", #> list("imports"), "\n", "environments, which contain all the functions imported from other\n", #> "packages.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "These functions are experimental and may not belong to the rlang\n", #> "package. Expect API changes.\n")), "\n", #> "\n", list("\n", list(list("pkg_env()")), "\n"), #> "\n", list("internal"), "\n"), `nse-defuse.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/nse-defuse.R", #> "\n", list("nse-defuse"), "\n", list("nse-defuse"), #> "\n", list("quotation"), "\n", list("expr"), #> "\n", list("enexpr"), "\n", list("exprs"), "\n", #> list("enexprs"), "\n", list("ensym"), "\n", list( #> "ensyms"), "\n", list("quo"), "\n", list("enquo"), #> "\n", list("quos"), "\n", list("enquos"), "\n", #> list("Defuse R expressions"), "\n", list("\n", #> "expr(expr)\n", "\n", "enexpr(arg)\n", "\n", #> "exprs(\n", " ...,\n", " .named = FALSE,\n", #> " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .unquote_names = TRUE\n", ")\n", "\n", "enexprs(\n", #> " ...,\n", " .named = FALSE,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .unquote_names = TRUE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n", "\n", "ensym(arg)\n", #> "\n", "ensyms(\n", " ...,\n", " .named = FALSE,\n", #> " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .unquote_names = TRUE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n", "\n", "quo(expr)\n", #> "\n", "enquo(arg)\n", "\n", "quos(\n", " ...,\n", #> " .named = FALSE,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .unquote_names = TRUE\n", ")\n", "\n", "enquos(\n", #> " ...,\n", " .named = FALSE,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .unquote_names = TRUE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n"), "\n", #> list("\n", list(list("expr"), list("An expression.")), #> "\n", "\n", list(list("arg"), list("A symbol representing an argument. The expression\n", #> "supplied to that argument will be captured instead of being\n", #> "evaluated.")), "\n", "\n", list(list("..."), #> list("For ", list("enexprs()"), ", ", list( #> "ensyms()"), " and ", list("enquos()"), #> ", names of\n", "arguments to capture without evaluation (including ", #> list("..."), "). For\n", list("exprs()"), #> " and ", list("quos()"), ", the expressions to capture unevaluated\n", #> "(including expressions contained in ", #> list("..."), ").")), "\n", "\n", list(list( #> ".named"), list("Whether to ensure all dots are named. Unnamed\n", #> "elements are processed with ", list(list( #> "as_label()")), " to build a default\n", #> "name.")), "\n", "\n", list(list(".ignore_empty"), #> list("Whether to ignore empty arguments. Can be one\n", #> "of ", list("\"trailing\""), ", ", list( #> "\"none\""), ", ", list("\"all\""), ". If ", #> list("\"trailing\""), ", only the\n", "last argument is ignored if it is empty. Note that ", #> list("\"trailing\""), "\n", "applies only to arguments passed in ", #> list("..."), ", not to named\n", "arguments. On the other hand, ", #> list("\"all\""), " also applies to named\n", #> "arguments.")), "\n", "\n", list(list(".unquote_names"), #> list("Whether to treat ", list(":="), " as ", #> list("="), ". Unlike ", list("="), ", the\n", #> list(":="), " syntax supports ", list("!!"), #> " unquoting on the LHS.")), "\n", "\n", #> list(list(".homonyms"), list("How to treat arguments with the same name. The\n", #> "default, ", list("\"keep\""), ", preserves these arguments. Set ", #> list(".homonyms"), " to\n", list("\"first\""), #> " to only keep the first occurrences, to ", #> list("\"last\""), " to keep\n", "the last occurrences, and to ", #> list("\"error\""), " to raise an informative\n", #> "error and indicate what arguments have duplicated names.")), #> "\n", "\n", list(list(".check_assign"), list( #> "Whether to check for ", list("<-"), " calls passed in\n", #> "dots. When ", list("TRUE"), " and a ", list( #> "<-"), " call is detected, a warning is\n", #> "issued to advise users to use ", list("="), #> " if they meant to match a\n", "function parameter, or wrap the ", #> list("<-"), " call in braces otherwise.\n", #> "This ensures assignments are explicit.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", "The defusing operators ", list( #> "expr()"), " and ", list("enquo()"), " prevent the\n", #> "evaluation of R code. Defusing is also known as ", #> list("quoting"), ", and is\n", "done in base R by ", #> list(list("quote()")), " and ", list(list("substitute()")), #> ". When a function\n", "argument is defused, R doesn't return its value like it normally\n", #> "would but it returns the R expression describing how to make the\n", #> "value. These defused expressions are like blueprints for computing\n", #> "values.\n", "\n", "There are two main ways to defuse expressions, to which correspond\n", #> "the two functions ", list("expr()"), " and ", #> list("enquo()"), ". Whereas ", list("expr()"), #> " defuses\n", "your own expression, ", list( #> "enquo()"), " defuses expressions supplied as\n", #> "argument by the user of a function. See section on function\n", #> "arguments for more on this distinction.\n", #> "\n", "The main purpose of defusing evaluation of an expression is to\n", #> "enable data-masking, where an expression is evaluated in the\n", #> "context of a data frame so that you can write ", #> list("var"), " instead of\n", list("data$var"), #> ". The expression is defused so it can be resumed later\n", #> "on, in a context where the data-variables have been defined.\n", #> "\n", "Defusing prevents the evaluation of R code, but you can still force\n", #> "evaluation inside a defused expression with the ", #> list("forcing operators"), " ", list("!!"), #> " and ", list("!!!"), ".\n"), "\n", list(list( #> "Types of defused expressions"), list("\n", #> "\n", list("\n", list(), " ", list("Calls"), #> ", like ", list("f(1, 2, 3)"), " or ", list( #> "1 + 1"), " represent the action of\n", #> "calling a function to compute a new value, such as a vector.\n", #> list(), " ", list("Symbols"), ", like ", #> list("x"), " or ", list("df"), ", represent named objects. When the\n", #> "object pointed to by the symbol was defined in a function or in\n", #> "the global environment, we call it an environment-variable. When\n", #> "the object is a column in a data frame, we call it a\n", #> "data-variable.\n"), "\n", "\n", "You can create new call or symbol objects by using the defusing\n", #> "function ", list("expr()"), ":", list("# Create a symbol representing objects called `foo`\n", #> "expr(foo)\n", "\n", "# Create a call representing the computation of the mean of `foo`\n", #> "expr(mean(foo, na.rm = TRUE))\n"), "\n", #> "\n", "Defusing is not the only way to create defused expressions. You can\n", #> "also assemble them from data:", list("# Assemble a symbol from a string\n", #> "var <- \"foo\"\n", "sym(var)\n", "\n", "# Assemble a call from strings, symbols, and other objects\n", #> "call(\"mean\", sym(var), na.rm = TRUE)\n"), #> "\n")), "\n", "\n", list(list("Defusing function arguments"), #> list("\n", "\n", "\n", "There are two points of view when it comes to defusing an\n", #> "expression:\n", list("\n", list(), " You can defuse expressions that ", #> list("you"), " supply with ", list("expr()"), #> ". This\n", "is one way of creating symbols and calls (see previous section).\n", #> list(), " You can defuse the expressions supplied by ", #> list("the user"), " of your\n", "function with the operators starting with ", #> list("en"), " like ", list("ensym()"), #> ",\n", list("enquo()"), " and their plural variants. They defuse function\n", #> "arguments .\n"), "\n")), "\n", "\n", list( #> list("Defused arguments and quosures"), list( #> "\n", "\n", "\n", "If you inspect the return values of ", #> list("expr()"), " and ", list("enquo()"), #> ", you'll\n", "notice that the latter doesn't return a raw expression like the\n", #> "former. Instead it returns a ", list("quosure"), #> ", a wrapper containing an\n", "expression and an environment. R needs information about the\n", #> "environment to properly evaluate the argument expression because it\n", #> "comes from a different context than the current function.\n", #> "\n", "See the ", list("quosure"), " help topic about tools to work with quosures.\n")), #> "\n", "\n", list(list("Comparison to base R"), #> list("\n", "\n", list("\n", list(), " The defusing operator ", #> list("expr()"), " is similar to ", list(list( #> "quote()")), ". Like\n", list(list("bquote()")), #> ", it allows ", list("forcing"), " evaluation of parts\n", #> "of an expression.\n", list(), " The plural variant ", #> list("exprs()"), " is similar to ", list( #> list("alist()")), ".\n", list(), " The argument-defusing operator ", #> list("enquo()"), " is similar to\n", list( #> list("substitute()")), ".\n"), "\n")), #> "\n", "\n", list("\n", "# expr() and exprs() capture expressions that you supply:\n", #> "expr(symbol)\n", "exprs(several, such, symbols)\n", #> "\n", "# enexpr() and enexprs() capture expressions that your user supplied:\n", #> "expr_inputs <- function(arg, ...) {\n", " user_exprs <- enexprs(arg, ...)\n", #> " user_exprs\n", "}\n", "expr_inputs(hello)\n", #> "expr_inputs(hello, bonjour, ciao)\n", "\n", #> "# ensym() and ensyms() provide additional type checking to ensure\n", #> "# the user calling your function has supplied bare object names:\n", #> "sym_inputs <- function(...) {\n", " user_symbols <- ensyms(...)\n", #> " user_symbols\n", "}\n", "sym_inputs(hello, \"bonjour\")\n", #> "## sym_inputs(say(hello)) # Error: Must supply symbols or strings\n", #> "expr_inputs(say(hello))\n", "\n", "\n", "# All these quoting functions have quasiquotation support. This\n", #> "# means that you can unquote (evaluate and inline) part of the\n", #> "# captured expression:\n", "what <- sym(\"bonjour\")\n", #> "expr(say(what))\n", "expr(say(!!what))\n", #> "\n", "# This also applies to expressions supplied by the user. This is\n", #> "# like an escape hatch that allows control over the captured\n", #> "# expression:\n", "expr_inputs(say(!!what), !!what)\n", #> "\n", "\n", "# Finally, you can capture expressions as quosures. A quosure is an\n", #> "# object that contains both the expression and its environment:\n", #> "quo <- quo(letters)\n", "quo\n", "\n", "get_expr(quo)\n", #> "get_env(quo)\n", "\n", "# Quosures can be evaluated with eval_tidy():\n", #> "eval_tidy(quo)\n", "\n", "# They have the nice property that you can pass them around from\n", #> "# context to context (that is, from function to function) and they\n", #> "# still evaluate in their original environment:\n", #> "multiply_expr_by_10 <- function(expr) {\n", #> " # We capture the user expression and its environment:\n", #> " expr <- enquo(expr)\n", "\n", " # Then create an object that only exists in this function:\n", #> " local_ten <- 10\n", "\n", " # Now let's create a multiplication expression that (a) inlines\n", #> " # the user expression as LHS (still wrapped in its quosure) and\n", #> " # (b) refers to the local object in the RHS:\n", #> " quo(!!expr * local_ten)\n", "}\n", "quo <- multiply_expr_by_10(2 + 3)\n", #> "\n", "# The local parts of the quosure are printed in colour if your\n", #> "# terminal is capable of displaying colours:\n", #> "quo\n", "\n", "# All the quosures in the expression evaluate in their original\n", #> "# context. The local objects are looked up properly and we get the\n", #> "# expected result:\n", "eval_tidy(quo)\n"), #> "\n", list("\n", list(list("enquo0()")), " and ", #> list(list("enquos0()")), " for variants that do not\n", #> "perform automatic injection/unquotation.\n"), #> "\n"), `nse-force.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/nse-force.R", #> "\n", list("nse-force"), "\n", list("nse-force"), #> "\n", list("quasiquotation"), "\n", list("UQ"), #> "\n", list("UQS"), "\n", list("{{}}"), "\n", #> list("{{"), "\n", list("!!"), "\n", list("!!!"), #> "\n", list(":="), "\n", list("qq_show"), "\n", #> list("Force parts of an expression"), "\n", list( #> "\n", "qq_show(expr)\n"), "\n", list("\n", #> list(list("expr"), list("An expression to be quasiquoted.")), #> "\n"), "\n", list("\n", "It is sometimes useful to force early evaluation of part of an\n", #> "expression before it gets fully evaluated. The tidy eval framework\n", #> "provides several forcing operators for different use cases.\n", #> list("\n", list(), " The bang-bang operator ", #> list("!!"), " forces a ", list("single"), #> " object. One\n", "common case for ", list( #> "!!"), " is to substitute an environment-variable\n", #> "(created with ", list("<-"), ") with a data-variable (inside a data frame).", #> list("library(dplyr)\n", "\n", "# The environment variable `var` refers to the data-variable\n", #> "# `height`\n", "var <- sym(\"height\")\n", #> "\n", "# We force `var`, which substitutes it with `height`\n", #> "starwars %>%\n", " summarise(avg = mean(!!var, na.rm = TRUE))\n"), #> "\n", list(), " The big-bang operator ", #> list("!!!"), " forces-splice a ", list("list"), #> " of objects.\n", "The elements of the list are spliced in place, meaning that they\n", #> "each become one single argument.", list( #> "vars <- syms(c(\"height\", \"mass\"))\n", #> "\n", "# Force-splicing is equivalent to supplying the elements separately\n", #> "starwars %>% select(!!!vars)\n", "starwars %>% select(height, mass)\n"), #> "\n", list(), " The curly-curly operator ", #> list("{{ }}"), " for function arguments is a bit\n", #> "special because it forces the function argument and immediately\n", #> "defuses it. The defused expression is substituted in place, ready\n", #> "to be evaluated in another context, such as the data frame.\n", #> "\n", "In practice, this is useful when you have a data-variable in an\n", #> "env-variable (such as a function argument).", #> list("# Force-defuse all function arguments that might contain\n", #> "# data-variables by embracing them with {{ }}\n", #> "mean_by <- function(data, by, var) {\n", #> " data %>%\n", " group_by({{ by }}) %>%\n", #> " summarise(avg = mean({{ var }}, na.rm = TRUE))\n", #> "}\n", "\n", "# The env-variables `by` and `var` are forced but defused.\n", #> "# The data-variables they contain are evaluated by dplyr later on\n", #> "# in data context.\n", "iris %>% mean_by(by = Species, var = Sepal.Width)\n"), #> "\n"), "\n", "\n", "Use ", list("qq_show()"), #> " to experiment with forcing operators. ", #> list("qq_show()"), "\n", "defuses its input, processes all forcing operators, and prints the\n", #> "result with ", list(list("expr_print()")), #> " to reveal objects inlined in the\n", "expression by the forcing operators.\n"), #> "\n", list(list("Forcing names"), list("\n", #> "\n", "\n", "When a function takes multiple named arguments\n", #> "(e.g. ", list("dplyr::mutate()"), "), it is difficult to supply a variable as\n", #> "name. Since the LHS of ", list("="), " is ", #> list("defused"), ", giving the name\n", "of a variable results in the argument having the name of the\n", #> "variable rather than the name stored in that variable. This problem\n", #> "of forcing evaluation of names is exactly what the ", #> list("!!"), " operator is\n", "for.\n", "\n", #> "Unfortunately R is very strict about the kind of expressions\n", #> "supported on the LHS of ", list("="), ". This is why rlang interprets the\n", #> "walrus operator ", list(":="), " as an alias of ", #> list("="), ". You can use it to supply\n", #> "names, e.g. ", list("a := b"), " is equivalent to ", #> list("a = b"), ". Since its syntax is\n", "more flexible you can also force names on its LHS:", #> list("name <- \"Jane\"\n", "\n", "list2(!!name := 1 + 2)\n", #> "exprs(!!name := 1 + 2)\n"), "\n", "\n", #> "Like ", list("="), ", the ", list(":="), " operator expects strings or symbols on its LHS.\n", #> "\n", "Since unquoting names is related to interpolating within a string\n", #> "with the glue package, we have made the glue syntax available on\n", #> "the LHS of ", list(":="), ":", list("list2(\"{name}\" := 1)\n", #> "tibble(\"{name}\" := 1)\n"), "\n", "\n", #> "You can also interpolate defused function arguments with double\n", #> "braces ", list("{{"), ", similar to the curly-curly syntax:", #> list("wrapper <- function(data, var) {\n", #> " data %>% mutate(\"{{ var }}_foo\" := {{ var }} * 2)\n", #> "}\n"), "\n", "\n", "Currently, forcing names with ", #> list(":="), " only works in top level\n", "expressions. These are all valid:", #> list("exprs(\"{name}\" := x)\n", "tibble(\"{name}\" := x)\n"), #> "\n", "\n", "But deep-forcing names isn't supported:", #> list("exprs(this(is(deep(\"{name}\" := x))))\n"), #> "\n")), "\n", "\n", list(list("Theory"), list( #> "\n", "\n", "\n", "Formally, ", list("quo()"), #> " and ", list("expr()"), " are quasiquotation functions, ", #> list("!!"), "\n", "is the unquote operator, and ", #> list("!!!"), " is the unquote-splice operator.\n", #> "These terms have a rich history in Lisp languages, and live on in\n", #> "modern languages like\n", list(list("https://docs.julialang.org/en/v1/manual/metaprogramming/"), #> list("Julia")), "\n", "and\n", list(list( #> "https://docs.racket-lang.org/reference/quasiquote.html"), #> list("Racket")), ".\n")), "\n", "\n", list( #> list("Life cycle"), list("\n", "\n", list("\n", #> list(), " Calling ", list("UQ()"), " and ", #> list("UQS()"), " with the rlang namespace qualifier is\n", #> "deprecated as of rlang 0.3.0. Just use the unqualified forms\n", #> "instead:", list("# Bad\n", "rlang::expr(mean(rlang::UQ(var) * 100))\n", #> "\n", "# Ok\n", "rlang::expr(mean(UQ(var) * 100))\n", #> "\n", "# Good\n", "rlang::expr(mean(!!var * 100))\n"), #> "\n", "\n", "Supporting namespace qualifiers complicates the implementation of\n", #> "unquotation and is misleading as to the nature of unquoting\n", #> "operators (which are syntactic operators that operate at\n", #> "quotation-time rather than function calls at evaluation-time).\n", #> list(), " ", list("UQ()"), " and ", list( #> "UQS()"), " were soft-deprecated in rlang 0.2.0 in order\n", #> "to make the syntax of quasiquotation more consistent. The prefix\n", #> "forms are now ", list("`!!`()"), " and ", #> list("`!!!`()"), " which is\n", "consistent with other R operators (e.g. ", #> list("`+`(a, b)"), " is the\n", "prefix form of ", #> list("a + b"), ").\n", "\n", "Note that the prefix forms are not as relevant as before because\n", #> list("!!"), " now has the right operator precedence, i.e. the same as\n", #> "unary ", list("-"), " or ", list("+"), ". It is thus safe to mingle it with other\n", #> "operators, e.g. ", list("!!a + !!b"), " does the right thing. In addition the\n", #> "parser now strips one level of parentheses around unquoted\n", #> "expressions. This way ", list("(!!\"foo\")(...)"), #> " expands to ", list("foo(...)"), ".\n", #> "These changes make the prefix forms less useful.\n", #> "\n", "Finally, the named functional forms ", #> list("UQ()"), " and ", list("UQS()"), " were\n", #> "misleading because they suggested that existing knowledge about\n", #> "functions is applicable to quasiquotation. This was reinforced by\n", #> "the visible definitions of these functions exported by rlang and\n", #> "by the tidy eval parser interpreting ", #> list("rlang::UQ()"), " as ", list("!!"), #> ". In\n", "reality unquoting is ", list("not"), #> " a function call, it is a syntactic\n", #> "operation. The operator form makes it clearer that unquoting is\n", #> "special.\n"), "\n")), "\n", "\n", list("\n", #> "# Interpolation with {{ }} is the easiest way to forward\n", #> "# arguments to tidy eval functions:\n", "if (is_attached(\"package:dplyr\")) {\n", #> "\n", "# Forward all arguments involving data frame columns by\n", #> "# interpolating them within other data masked arguments.\n", #> "# Here we interpolate `arg` in a `summarise()` call:\n", #> "my_function <- function(data, arg) {\n", " summarise(data, avg = mean({{ arg }}, na.rm = TRUE))\n", #> "}\n", "\n", "my_function(mtcars, cyl)\n", #> "my_function(mtcars, cyl * 10)\n", "\n", "# The operator is just a shortcut for `!!enquo()`:\n", #> "my_function <- function(data, arg) {\n", " summarise(data, avg = mean(!!enquo(arg), na.rm = TRUE))\n", #> "}\n", "\n", "my_function(mtcars, cyl)\n", #> "\n", "}\n", "\n", "# Quasiquotation functions quote expressions like base::quote()\n", #> "quote(how_many(this))\n", "expr(how_many(this))\n", #> "quo(how_many(this))\n", "\n", "# In addition, they support unquoting. Let's store symbols\n", #> "# (i.e. object names) in variables:\n", "this <- sym(\"apples\")\n", #> "that <- sym(\"oranges\")\n", "\n", "# With unquotation you can insert the contents of these variables\n", #> "# inside the quoted expression:\n", "expr(how_many(!!this))\n", #> "expr(how_many(!!that))\n", "\n", "# You can also insert values:\n", #> "expr(how_many(!!(1 + 2)))\n", "quo(how_many(!!(1 + 2)))\n", #> "\n", "\n", "# Note that when you unquote complex objects into an expression,\n", #> "# the base R printer may be a bit misleading. For instance compare\n", #> "# the output of `expr()` and `quo()` (which uses a custom printer)\n", #> "# when we unquote an integer vector:\n", "expr(how_many(!!(1:10)))\n", #> "quo(how_many(!!(1:10)))\n", "\n", "# This is why it's often useful to use qq_show() to examine the\n", #> "# result of unquotation operators. It uses the same printer as\n", #> "# quosures but does not return anything:\n", #> "qq_show(how_many(!!(1:10)))\n", "\n", "\n", #> "# Use `!!!` to add multiple arguments to a function. Its argument\n", #> "# should evaluate to a list or vector:\n", #> "args <- list(1:3, na.rm = TRUE)\n", "quo(mean(!!!args))\n", #> "\n", "# You can combine the two\n", "var <- quote(xyz)\n", #> "extra_args <- list(trim = 0.9, na.rm = TRUE)\n", #> "quo(mean(!!var , !!!extra_args))\n", "\n", #> "\n", "# The plural versions have support for the `:=` operator.\n", #> "# Like `=`, `:=` creates named arguments:\n", #> "quos(mouse1 := bernard, mouse2 = bianca)\n", #> "\n", "# The `:=` is mainly useful to unquote names. Unlike `=` it\n", #> "# supports `!!` on its LHS:\n", "var <- \"unquote me!\"\n", #> "quos(!!var := bernard, mouse2 = bianca)\n", #> "\n", "\n", "# All these features apply to dots captured by enquos():\n", #> "fn <- function(...) enquos(...)\n", "fn(!!!args, !!var := penny)\n", #> "\n", "\n", "# Unquoting is especially useful for building an expression by\n", #> "# expanding around a variable part (the unquoted part):\n", #> "quo1 <- quo(toupper(foo))\n", "quo1\n", "\n", #> "quo2 <- quo(paste(!!quo1, bar))\n", "quo2\n", #> "\n", "quo3 <- quo(list(!!quo2, !!!syms(letters[1:5])))\n", #> "quo3\n"), "\n"), `op-definition.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/operators.R", #> "\n", list("op-definition"), "\n", list("op-definition"), #> "\n", list("is_definition"), "\n", list("new_definition"), #> "\n", list("is_formulaish"), "\n", list("Definition operator"), #> "\n", list("\n", "is_definition(x)\n", "\n", #> "new_definition(lhs, rhs, env = caller_env())\n", #> "\n", "is_formulaish(x, scoped = NULL, lhs = NULL)\n"), #> "\n", list("\n", list(list("x"), list("An object to test.")), #> "\n", "\n", list(list("lhs, rhs"), list("Expressions for the LHS and RHS of the definition.")), #> "\n", "\n", list(list("env"), list("The evaluation environment bundled with the definition.")), #> "\n"), "\n", list("\n", "The definition operator is typically used in DSL packages like\n", #> list("ggvis"), " and ", list("data.table"), #> ". It is also used in the tidyverse as a way\n", #> "of unquoting names (see ", list("nse-force"), #> ").\n", list("\n", list(), " ", list("is_definition()"), #> " returns ", list("TRUE"), " for calls to ", #> list(":="), ".\n", list(), " ", list("is_formulaish()"), #> " returns ", list("TRUE"), " for both formulas and\n", #> "colon-equals operators.\n"), "\n"), "\n", #> list("\n", "The recommended way to use it is to capture arguments as\n", #> "expressions or quosures. You can then give a special function\n", #> "definition for the ", list(":="), " symbol in an overscope. Note that if you\n", #> "capture dots with ", list(list("exprs()")), #> " or ", list(list("quos()")), ", you need to disable\n", #> "interpretation of ", list(":="), " by setting ", #> list(".unquote_names"), " to ", list("FALSE"), #> ".\n", "\n", "From rlang and data.table perspectives, this operator is not meant\n", #> "to be evaluated directly at top-level which is why the exported\n", #> "definitions issue an error.\n"), "\n", list( #> list("Life cycle"), list("\n", "\n", "\n", #> "These functions are experimental.\n")), #> "\n", "\n", list("\n", "\n", "# A predicate is provided to distinguish formulas from the\n", #> "# colon-equals operator:\n", "is_definition(quote(a := b))\n", #> "is_definition(a ~ b)\n", "\n", "\n", "# is_formulaish() tests for both definitions and formulas:\n", #> "is_formulaish(a ~ b)\n", "is_formulaish(quote(a := b))\n"), #> "\n", list("internal"), "\n"), `op-get-attr.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/operators.R", #> "\n", list("op-get-attr"), "\n", list("op-get-attr"), #> "\n", list("%@%"), "\n", list("%@%<-"), "\n", #> list("Infix attribute accessor and setter"), #> "\n", list("\n", "x %@% name\n", "\n", "x %@% name <- value\n"), #> "\n", list("\n", list(list("x"), list("Object")), #> "\n", "\n", list(list("name"), list("Attribute name")), #> "\n", "\n", list(list("value"), list("New value for attribute ", #> list("name"), ".")), "\n"), "\n", list("\n", #> "This operator extracts or sets attributes for regular objects and\n", #> "S4 fields for S4 objects.\n"), "\n", list( #> "\n", "# Unlike `@`, this operator extracts attributes for any kind of\n", #> "# objects:\n", "factor(1:3) %@% \"levels\"\n", #> "mtcars %@% class\n", "\n", "mtcars %@% class <- NULL\n", #> "mtcars\n", "\n", "# It also works on S4 objects:\n", #> ".Person <- setClass(\"Person\", slots = c(name = \"character\", species = \"character\"))\n", #> "fievel <- .Person(name = \"Fievel\", species = \"mouse\")\n", #> "fievel %@% name\n"), "\n"), `op-na-default.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/operators.R", #> "\n", list("op-na-default"), "\n", list("op-na-default"), #> "\n", list("%|%"), "\n", list("Replace missing values"), #> "\n", list("\n", "x %|% y\n"), "\n", list("\n", #> list(list("x"), list("The original values.")), #> "\n", "\n", list(list("y"), list("The replacement values. Must be of length 1 or the same length as ", #> list("x"), ".")), "\n"), "\n", list("\n", #> "This infix function is similar to ", list( #> "%||%"), " but is vectorised\n", "and provides a default value for missing elements. It is faster\n", #> "than using ", list(list("base::ifelse()")), #> " and does not perform type conversions.\n"), #> "\n", list("\n", "c(\"a\", \"b\", NA, \"c\") %|% \"default\"\n", #> "c(1L, NA, 3L, NA, NA) %|% (6L:10L)\n"), "\n", #> list("\n", list("op-null-default"), "\n"), "\n"), #> `op-null-default.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/operators.R", #> "\n", list("op-null-default"), "\n", list("op-null-default"), #> "\n", list("%||%"), "\n", list("Default value for ", #> list("NULL")), "\n", list("\n", "x %||% y\n"), #> "\n", list("\n", list(list("x, y"), list("If ", #> list("x"), " is NULL, will return ", list("y"), #> "; otherwise returns ", list("x"), ".")), "\n"), #> "\n", list("\n", "This infix function makes it easy to replace ", #> list("NULL"), "s with a default\n", "value. It's inspired by the way that Ruby's or operation (", #> list("||"), ")\n", "works.\n"), "\n", list( #> "\n", "1 %||% 2\n", "NULL %||% 2\n"), "\n"), #> overscope_eval_next.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("overscope_eval_next"), "\n", list( #> "overscope_eval_next"), "\n", list("Evaluate next quosure in a data mask"), #> "\n", list("\n", "overscope_eval_next(overscope, quo, env = base_env())\n"), #> "\n", list("\n", list(list("overscope"), list( #> "A valid overscope containing bindings for ", #> list("~"), ",\n", list(".top_env"), " and ", #> list("_F"), " and whose parents contain overscoped bindings\n", #> "for tidy evaluation.")), "\n", "\n", list( #> list("quo"), list("A quosure.")), "\n", "\n", #> list(list("env"), list("The lexical enclosure in case ", #> list("quo"), " is not a validly\n", "scoped quosure. This is the ", #> list("base environment"), " by\n", "default.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", list("overscope_eval_next()"), #> " is deprecated as of rlang 0.2.0. Please use\n", #> list("eval_tidy()"), " to which you can now supply an overscope.\n"), #> "\n", list("internal"), "\n"), pairlist2.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("pairlist2"), "\n", list("pairlist2"), #> "\n", list("Create pairlists with splicing support"), #> "\n", list("\n", "pairlist2(...)\n"), "\n", list( #> "\n", list(list("..."), list("<", list("dynamic"), #> "> Arguments stored in the\n", "pairlist. Empty arguments are preserved.")), #> "\n"), "\n", list("\n", "This pairlist constructor uses ", #> list("dynamic dots"), ". Use\n", "it to manually create argument lists for calls or parameter lists\n", #> "for functions.\n"), "\n", list("\n", "# Unlike `exprs()`, `pairlist2()` evaluates its arguments.\n", #> "new_function(pairlist2(x = 1, y = 3 * 6), quote(x * y))\n", #> "new_function(exprs(x = 1, y = 3 * 6), quote(x * y))\n", #> "\n", "# It preserves missing arguments, which is useful for creating\n", #> "# parameters without defaults:\n", "new_function(pairlist2(x = , y = 3 * 6), quote(x * y))\n"), #> "\n"), parse_expr.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/parse.R", #> "\n", list("parse_expr"), "\n", list("parse_expr"), #> "\n", list("parse_exprs"), "\n", list("parse_quo"), #> "\n", list("parse_quos"), "\n", list("Parse R code"), #> "\n", list("\n", "parse_expr(x)\n", "\n", "parse_exprs(x)\n", #> "\n", "parse_quo(x, env = global_env())\n", #> "\n", "parse_quos(x, env = global_env())\n"), #> "\n", list("\n", list(list("x"), list("Text containing expressions to parse_expr for\n", #> list("parse_expr()"), " and ", list("parse_exprs()"), #> ". Can also be an R connection,\n", "for instance to a file. If the supplied connection is not open,\n", #> "it will be automatically closed and destroyed.")), #> "\n", "\n", list(list("env"), list("The environment for the quosures. The ", #> list("global environment"), " (the default) may be the right choice\n", #> "when you are parsing external user inputs. You might also want to\n", #> "evaluate the R code in an isolated context (perhaps a child of\n", #> "the global environment or of the ", list( #> "base environment"), ").")), "\n"), "\n", #> list("\n", list("parse_expr()"), " returns an ", #> list("expression"), ",\n", list("parse_exprs()"), #> " returns a list of expressions. Note that for the\n", #> "plural variants the length of the output may be greater than the\n", #> "length of the input. This would happen is one of the strings\n", #> "contain several expressions (such as ", list( #> "\"foo; bar\""), "). The names of\n", list( #> "x"), " are preserved (and recycled in case of multiple expressions).\n", #> "The ", list("_quo"), " suffixed variants return quosures.\n"), #> "\n", list("\n", "These functions parse and transform text into R expressions. This\n", #> "is the first step to interpret or evaluate a piece of R code\n", #> "written by a programmer.\n", list("\n", list(), #> " ", list("parse_expr()"), " returns one expression. If the text contains more\n", #> "than one expression (separated by semicolons or new lines), an\n", #> "error is issued. On the other hand ", list( #> "parse_exprs()"), " can handle\n", "multiple expressions. It always returns a list of expressions\n", #> "(compare to ", list(list("base::parse()")), #> " which returns a base::expression\n", "vector). All functions also support R connections.\n", #> list(), " ", list("parse_quo()"), " and ", #> list("parse_quos()"), " are variants that create a\n", #> list("quosure"), " that inherits from the global environment by\n", #> "default. This is appropriate when you're parsing external user\n", #> "input to be evaluated in user context (rather than the private\n", #> "contexts of your functions).\n", "\n", "Unlike quosures created with ", #> list(list("enquo()")), ", ", list(list("enquos()")), #> ", or ", list("{{"), ", a\n", "parsed quosure never contains injected quosures. It is thus safe\n", #> "to evaluate them with ", list("eval()"), #> " instead of ", list(list("eval_tidy()")), #> ", though\n", "the latter is more convenient as you don't need to extract ", #> list("expr"), "\n", "and ", list("env"), #> ".\n"), "\n"), "\n", list("\n", "# parse_expr() can parse any R expression:\n", #> "parse_expr(\"mtcars %>% dplyr::mutate(cyl_prime = cyl / sd(cyl))\")\n", #> "\n", "# A string can contain several expressions separated by ; or \\n\n", #> "parse_exprs(\"NULL; list()\\n foo(bar)\")\n", #> "\n", "# Use names to figure out which input produced an expression:\n", #> "parse_exprs(c(foo = \"1; 2\", bar = \"3\"))\n", #> "\n", "# You can also parse source files by passing a R connection. Let's\n", #> "# create a file containing R code:\n", "path <- tempfile(\"my-file.R\")\n", #> "cat(\"1; 2; mtcars\", file = path)\n", "\n", #> "# We can now parse it by supplying a connection:\n", #> "parse_exprs(file(path))\n"), "\n", list("\n", #> list(list("base::parse()")), "\n"), "\n"), #> parse_quosure.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("parse_quosure"), "\n", list("parse_quosure"), #> "\n", list("parse_quosures"), "\n", list("Parse text into a quosure"), #> "\n", list("\n", "parse_quosure(x, env = caller_env())\n", #> "\n", "parse_quosures(x, env = caller_env())\n"), #> "\n", list("\n", list(list("x"), list("Text containing expressions to parse_expr for\n", #> list("parse_expr()"), " and ", list("parse_exprs()"), #> ". Can also be an R connection,\n", "for instance to a file. If the supplied connection is not open,\n", #> "it will be automatically closed and destroyed.")), #> "\n", "\n", list(list("env"), list("The environment for the quosures. The ", #> list("global environment"), " (the default) may be the right choice\n", #> "when you are parsing external user inputs. You might also want to\n", #> "evaluate the R code in an isolated context (perhaps a child of\n", #> "the global environment or of the ", list( #> "base environment"), ").")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions were deprecated and renamed to ", #> list(list("parse_quo()")), "\n", "and ", list( #> list("parse_quos()")), " in rlang 0.2.0. This is for consistency with the\n", #> "convention that suffixes indicating return types are not\n", #> "abbreviated.\n"), "\n", list("internal"), #> "\n"), prepend.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("prepend"), "\n", list("prepend"), #> "\n", list("modify"), "\n", list("Prepend a vector"), #> "\n", list("\n", "prepend(x, values, before = 1)\n", #> "\n", "modify(.x, ...)\n"), "\n", list("\n", #> list(list("x"), list("the vector to be modified.")), #> "\n", "\n", list(list("values"), list("to be included in the modified vector.")), #> "\n", "\n", list(list("before"), list("a subscript, before which the values are to be appended.")), #> "\n", "\n", list(list(".x"), list("A vector to modify.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> List of elements to merge into\n", #> list(".x"), ". Named elements already existing in ", #> list(".x"), " are used as\n", "replacements. Elements that have new or no names are inserted at\n", #> "the end.")), "\n"), "\n", list("\n", list( #> "rlang:::lifecycle(\"deprecated\")"), "\n", #> "\n", "Vector functions are now out of scope for rlang. They might be\n", #> "revived in the vctrs or funs packages.\n"), #> "\n", list("internal"), "\n"), prim_name.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("prim_name"), "\n", list("prim_name"), #> "\n", list("Name of a primitive function"), "\n", #> list("\n", "prim_name(prim)\n"), "\n", list("\n", #> list(list("prim"), list("A primitive function such as ", #> list(list("base::c()")), ".")), "\n"), "\n", #> list("\n", "Name of a primitive function\n"), #> "\n", list("internal"), "\n"), quo_expr.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("quo_expr"), "\n", list("quo_expr"), #> "\n", list("Squash a quosure"), "\n", list("\n", #> "quo_expr(quo, warn = FALSE)\n"), "\n", list( #> "\n", list(list("quo"), list("A quosure or expression.")), #> "\n", "\n", list(list("warn"), list("Whether to warn if the quosure contains other quosures\n", #> "(those will be collapsed). This is useful when you use\n", #> list("quo_squash()"), " in order to make a non-tidyeval API compatible\n", #> "with quosures. In that case, getting rid of the nested quosures\n", #> "is likely to cause subtle bugs and it is good practice to warn\n", #> "the user about it.")), "\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "This function is deprecated, please use ", #> list(list("quo_squash()")), " instead.\n"), #> "\n", list("internal"), "\n"), quo_label.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/quo.R", #> "\n", list("quo_label"), "\n", list("quo_label"), #> "\n", list("quo_text"), "\n", list("quo_name"), #> "\n", list("Format quosures for printing or labelling"), #> "\n", list("\n", "quo_label(quo)\n", "\n", "quo_text(quo, width = 60L, nlines = Inf)\n", #> "\n", "quo_name(quo)\n"), "\n", list("\n", #> list(list("quo"), list("A quosure or expression.")), #> "\n", "\n", list(list("width"), list("Width of each line.")), #> "\n", "\n", list(list("nlines"), list("Maximum number of lines to extract.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", list("Note:"), " You should now use ", #> list(list("as_label()")), " or ", list(list( #> "as_name()")), " instead\n", "of ", list( #> "quo_name()"), ". See life cycle section below.\n", #> "\n", "These functions take an arbitrary R object, typically an\n", #> list("expression"), ", and represent it as a string.\n", #> list("\n", list(), " ", list("quo_name()"), #> " returns an abbreviated representation of the object\n", #> "as a single line string. It is suitable for default names.\n", #> list(), " ", list("quo_text()"), " returns a multiline string. For instance block\n", #> "expressions like ", list("{ foo; bar }"), #> " are represented on 4 lines (one\n", "for each symbol, and the curly braces on their own lines).\n"), #> "\n", "\n", "These deparsers are only suitable for creating default names or\n", #> "printing output at the console. The behaviour of your functions\n", #> "should not depend on deparsed objects. If you are looking for a way\n", #> "of transforming symbols to strings, use ", #> list(list("as_string()")), " instead of\n", #> list("quo_name()"), ". Unlike deparsing, the transformation between symbols\n", #> "and strings is non-lossy and well defined.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "These functions are in the questioning life cycle stage.\n", #> list("\n", list(), " ", list(list("as_label()")), #> " and ", list(list("as_name()")), " should be used instead of\n", #> list("quo_name()"), ". ", list("as_label()"), #> " transforms any R object to a string\n", #> "but should only be used to create a default name. Labelisation is\n", #> "not a well defined operation and no assumption should be made\n", #> "about the label. On the other hand, ", list( #> "as_name()"), " only works with\n", "(possibly quosured) symbols, but is a well defined and\n", #> "deterministic operation.\n", list(), " We don't have a good replacement for ", #> list("quo_text()"), " yet. See\n", list("https://github.com/r-lib/rlang/issues/636"), #> " to follow discussions\n", "about a new deparsing API.\n"), #> "\n")), "\n", "\n", list("\n", "# Quosures can contain nested quosures:\n", #> "quo <- quo(foo(!! quo(bar)))\n", "quo\n", #> "\n", "# quo_squash() unwraps all quosures and returns a raw expression:\n", #> "quo_squash(quo)\n", "\n", "# This is used by quo_text() and quo_label():\n", #> "quo_text(quo)\n", "\n", "# Compare to the unwrapped expression:\n", #> "expr_text(quo)\n", "\n", "# quo_name() is helpful when you need really short labels:\n", #> "quo_name(quo(sym))\n", "quo_name(quo(!! sym))\n"), #> "\n", list("\n", list(list("expr_label()")), #> ", ", list(list("f_label()")), "\n"), "\n"), #> quo_squash.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/quo.R", #> "\n", list("quo_squash"), "\n", list("quo_squash"), #> "\n", list("Squash a quosure"), "\n", list("\n", #> "quo_squash(quo, warn = FALSE)\n"), "\n", list( #> "\n", list(list("quo"), list("A quosure or expression.")), #> "\n", "\n", list(list("warn"), list("Whether to warn if the quosure contains other quosures\n", #> "(those will be collapsed). This is useful when you use\n", #> list("quo_squash()"), " in order to make a non-tidyeval API compatible\n", #> "with quosures. In that case, getting rid of the nested quosures\n", #> "is likely to cause subtle bugs and it is good practice to warn\n", #> "the user about it.")), "\n"), "\n", list( #> "\n", list("quo_squash()"), " flattens all nested quosures within an expression.\n", #> "For example it transforms ", list("^foo(^bar(), ^baz)"), #> " to the bare\n", "expression ", list("foo(bar(), baz)"), #> ".\n", "\n", "This operation is safe if the squashed quosure is used for\n", #> "labelling or printing (see ", list(list("quo_label()")), #> " or ", list(list("quo_name()")), "). However\n", #> "if the squashed quosure is evaluated, all expressions of the\n", #> "flattened quosures are resolved in a single environment. This is a\n", #> "source of bugs so it is good practice to set ", #> list("warn"), " to ", list("TRUE"), " to\n", #> "let the user know about the lossy squashing.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "This function replaces ", list("quo_expr()"), #> " which was deprecated in\n", "rlang 0.2.0. ", #> list("quo_expr()"), " was a misnomer because it implied that it\n", #> "was a mere expression acccessor for quosures whereas it was really\n", #> "a lossy operation that squashed all nested quosures.\n")), #> "\n", "\n", list("\n", "# Quosures can contain nested quosures:\n", #> "quo <- quo(wrapper(!!quo(wrappee)))\n", "quo\n", #> "\n", "# quo_squash() flattens all the quosures and returns a simple expression:\n", #> "quo_squash(quo)\n"), "\n"), quosure.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/quo.R", #> "\n", list("quosure"), "\n", list("quosure"), #> "\n", list("is_quosure"), "\n", list("quo_is_missing"), #> "\n", list("quo_is_symbol"), "\n", list("quo_is_call"), #> "\n", list("quo_is_symbolic"), "\n", list("quo_is_null"), #> "\n", list("quo_get_expr"), "\n", list("quo_get_env"), #> "\n", list("quo_set_expr"), "\n", list("quo_set_env"), #> "\n", list("Quosure getters, setters and testers"), #> "\n", list("\n", "is_quosure(x)\n", "\n", "quo_is_missing(quo)\n", #> "\n", "quo_is_symbol(quo, name = NULL)\n", #> "\n", "quo_is_call(quo, name = NULL, n = NULL, ns = NULL)\n", #> "\n", "quo_is_symbolic(quo)\n", "\n", "quo_is_null(quo)\n", #> "\n", "quo_get_expr(quo)\n", "\n", "quo_get_env(quo)\n", #> "\n", "quo_set_expr(quo, expr)\n", "\n", "quo_set_env(quo, env)\n"), #> "\n", list("\n", list(list("x"), list("An object to test.")), #> "\n", "\n", list(list("quo"), list("A quosure to test.")), #> "\n", "\n", list(list("name"), list("The name of the symbol or function call. If ", #> list("NULL"), " the\n", "name is not tested.")), #> "\n", "\n", list(list("n"), list("An optional number of arguments that the call should\n", #> "match.")), "\n", "\n", list(list("ns"), #> list("The namespace of the call. If ", list( #> "NULL"), ", the namespace\n", "doesn't participate in the pattern-matching. If an empty string\n", #> list("\"\""), " and ", list("x"), " is a namespaced call, ", #> list("is_call()"), " returns\n", list("FALSE"), #> ". If any other string, ", list("is_call()"), #> " checks that ", list("x"), " is\n", "namespaced within ", #> list("ns"), ".\n", "\n", "Can be a character vector of namespaces, in which case the call\n", #> "has to match at least one of them, otherwise ", #> list("is_call()"), " returns\n", list("FALSE"), #> ".")), "\n", "\n", list(list("expr"), list( #> "A new expression for the quosure.")), "\n", #> "\n", list(list("env"), list("A new environment for the quosure.")), #> "\n"), "\n", list("\n", "A quosure is a type of ", #> list("quoted expression"), " that includes\n", #> "a reference to the context where it was created. A quosure is thus\n", #> "guaranteed to evaluate in its original environment and can refer to\n", #> "local objects.\n", "\n", "You can access the quosure components (its expression and its\n", #> "environment) with:\n", list("\n", list(), #> " ", list(list("get_expr()")), " and ", list( #> list("get_env()")), ". These getters also support other\n", #> "kinds of objects such as formulas.\n", list(), #> " ", list("quo_get_expr()"), " and ", list( #> "quo_get_env()"), ". These getters only work\n", #> "with quosures and throw an error with other types of input.\n"), #> "\n", "\n", "Test if an object is a quosure with ", #> list("is_quosure()"), ". If you know an\n", #> "object is a quosure, use the ", list("quo_"), #> " prefixed predicates to check\n", "its contents, ", #> list("quo_is_missing()"), ", ", list("quo_is_symbol()"), #> ", etc.\n"), "\n", list(list("Quosured constants"), #> list("\n", "\n", "\n", "A quosure usually does not carry environments for ", #> list("constant objects"), " like strings or numbers. ", #> list(list("quo()")), " and\n", list(list( #> "enquo()")), " only capture an environment for ", #> list("symbolic expressions"), ". For instance, all of these return the\n", #> list("empty environment"), ":", list("quo_get_env(quo(\"constant\"))\n", #> "quo_get_env(quo(100))\n", "quo_get_env(quo(NA))\n"), #> "\n", "\n", "On the other hand, quosures capture the environment of symbolic\n", #> "expressions, i.e. expressions whose meaning depends on the\n", #> "environment in which they are evaluated and what objects are\n", #> "defined there:", list("quo_get_env(quo(some_object))\n", #> "quo_get_env(quo(some_function()))\n"), #> "\n")), "\n", "\n", list(list("Empty quosures"), #> list("\n", "\n", "\n", "When missing arguments are captured as quosures, either through\n", #> list(list("enquo()")), " or ", list(list( #> "quos()")), ", they are returned as an empty quosure. These\n", #> "quosures contain the ", list("missing argument"), #> " and typically\n", "have the ", list("empty environment"), #> " as enclosure.\n")), "\n", "\n", list(list( #> "Life cycle"), list("\n", "\n", list("\n", #> list(), " ", list("is_quosure()"), " is stable.\n", #> list(), " ", list("quo_get_expr()"), " and ", #> list("quo_get_env()"), " are stable.\n"), "\n")), #> "\n", "\n", list("\n", "quo <- quo(my_quosure)\n", #> "quo\n", "\n", "\n", "# Access and set the components of a quosure:\n", #> "quo_get_expr(quo)\n", "quo_get_env(quo)\n", #> "\n", "quo <- quo_set_expr(quo, quote(baz))\n", #> "quo <- quo_set_env(quo, empty_env())\n", "quo\n", #> "\n", "# Test wether an object is a quosure:\n", #> "is_quosure(quo)\n", "\n", "# If it is a quosure, you can use the specialised type predicates\n", #> "# to check what is inside it:\n", "quo_is_symbol(quo)\n", #> "quo_is_call(quo)\n", "quo_is_null(quo)\n", #> "\n", "# quo_is_missing() checks for a special kind of quosure, the one\n", #> "# that contains the missing argument:\n", #> "quo()\n", "quo_is_missing(quo())\n", "\n", #> "fn <- function(arg) enquo(arg)\n", "fn()\n", #> "quo_is_missing(fn())\n"), "\n", list("\n", #> list(list("quo()")), " for creating quosures by quotation; ", #> list(list("as_quosure()")), "\n", "and ", list( #> list("new_quosure()")), " for constructing quosures manually.\n"), #> "\n"), raw_deparse_str.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/raw.R", #> "\n", list("raw_deparse_str"), "\n", list("raw_deparse_str"), #> "\n", list("Serialize a raw vector to a string"), #> "\n", list("\n", "raw_deparse_str(x, prefix = NULL, suffix = NULL)\n"), #> "\n", list("\n", list(list("x"), list("A raw vector.")), #> "\n", "\n", list(list("prefix, suffix"), list( #> "Prefix and suffix strings, or `NULL.")), #> "\n"), "\n", list("\n", "A string.\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "This function converts a raw vector to a hexadecimal string,\n", #> "optionally adding a prefix and a suffix.\n", #> "It is roughly equivalent to\n", list("paste0(prefix, paste(format(x), collapse = \"\"), suffix)"), #> "\n", "and much faster.\n"), "\n", list("\n", #> "raw_deparse_str(raw())\n", "raw_deparse_str(charToRaw(\"string\"))\n", #> "raw_deparse_str(raw(10), prefix = \"'0x\", suffix = \"'\")\n"), #> "\n"), rep_along.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-new.R", #> "\n", list("rep_along"), "\n", list("rep_along"), #> "\n", list("rep_named"), "\n", list("Create vectors matching the length of a given vector"), #> "\n", list("\n", "rep_along(along, x)\n", "\n", #> "rep_named(names, x)\n"), "\n", list("\n", #> list(list("along"), list("Vector whose length determine how many times ", #> list("x"), "\n", "is repeated.")), "\n", #> "\n", list(list("x"), list("Values to repeat.")), #> "\n", "\n", list(list("names"), list("Names for the new vector. The length of ", #> list("names"), "\n", "determines how many times ", #> list("x"), " is repeated.")), "\n"), "\n", #> list("\n", "These functions take the idea of ", #> list(list("seq_along()")), " and apply it to\n", #> "repeating values.\n"), "\n", list("\n", "x <- 0:5\n", #> "rep_along(x, 1:2)\n", "rep_along(x, 1)\n", #> "\n", "# Create fresh vectors by repeating missing values:\n", #> "rep_along(x, na_int)\n", "rep_along(x, na_chr)\n", #> "\n", "# rep_named() repeats a value along a names vectors\n", #> "rep_named(c(\"foo\", \"bar\"), list(letters))\n"), #> "\n", list("\n", "new-vector\n"), "\n"), restarting.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-handlers.R", #> "\n", list("restarting"), "\n", list("restarting"), #> "\n", list("Create a restarting handler"), "\n", #> list("\n", "restarting(.restart, ..., .fields = NULL)\n"), #> "\n", list("\n", list(list(".restart"), list( #> "The name of a restart.")), "\n", "\n", list( #> list("..."), list("<", list("dynamic"), "> Additional arguments passed on\n", #> "the restart function. These arguments are evaluated only once\n", #> "and immediately, when creating the restarting handler.")), #> "\n", "\n", list(list(".fields"), list("A character vector specifying the fields of the\n", #> "condition that should be passed as arguments to the restart. If\n", #> "named, the names (except empty names ", #> list("\"\""), ") are used as\n", "argument names for calling the restart function. Otherwise the\n", #> "the fields themselves are used as argument names.")), #> "\n"), "\n", list("\n", "This constructor automates the common task of creating an\n", #> list(list("calling()")), " handler that invokes a restart.\n"), #> "\n", list("\n", "Jumping to a restart point from a calling handler has two\n", #> "effects. First, the control flow jumps to wherever the restart was\n", #> "established, and the restart function is called (with ", #> list("..."), ", or\n", list(".fields"), " as arguments). Execution resumes from the\n", #> list(list("with_restarts()")), " call. Secondly, the transfer of the control flow\n", #> "out of the function that signalled the condition means that the\n", #> "handler has dealt with the condition. Thus the condition will not\n", #> "be passed on to other potential handlers established on the stack.\n"), #> "\n", list("\n", "# This is a restart that takes a data frame and names as arguments\n", #> "rst_bar <- function(df, nms) {\n", " stats::setNames(df, nms)\n", #> "}\n", "\n", "# This restart is simpler and does not take arguments\n", #> "rst_baz <- function() \"baz\"\n", "\n", "# Signalling a condition parameterised with a data frame\n", #> "fn <- function() {\n", " with_restarts(signal(\"A foobar condition occurred\", \"foo\", foo_field = mtcars),\n", #> " rst_bar = rst_bar,\n", " rst_baz = rst_baz\n", #> " )\n", "}\n", "\n", "# Creating a restarting handler that passes arguments `nms` and\n", #> "# `df`, the latter taken from a data field of the condition object\n", #> "restart_bar <- restarting(\"rst_bar\",\n", #> " nms = LETTERS[1:11], .fields = c(df = \"foo_field\")\n", #> ")\n", "\n", "# The restarting handlers jumps to `rst_bar` when `foo` is signalled:\n", #> "with_handlers(fn(), foo = restart_bar)\n", #> "\n", "# The restarting() constructor is especially nice to use with\n", #> "# restarts that do not need arguments:\n", #> "with_handlers(fn(), foo = restarting(\"rst_baz\"))\n"), #> "\n", list("\n", list(list("calling()")), " and ", #> list(list("exiting()")), ".\n"), "\n", list( #> "internal"), "\n"), return_from.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/stack.R", #> "\n", list("return_from"), "\n", list("return_from"), #> "\n", list("return_to"), "\n", list("Jump to or from a frame"), #> "\n", list("\n", "return_from(frame, value = NULL)\n", #> "\n", "return_to(frame, value = NULL)\n"), #> "\n", list("\n", list(list("frame"), list("An environment, a frame object, or any object with an\n", #> list(list("get_env()")), " method. The environment should be an evaluation\n", #> "environment currently on the stack.")), "\n", #> "\n", list(list("value"), list("The return value.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "While ", list(list("base::return()")), #> " can only return from the current local\n", #> "frame, these two functions will return from any frame on the\n", #> "current evaluation stack, between the global and the currently\n", #> "active context. They provide a way of performing arbitrary\n", #> "non-local jumps out of the function currently under evaluation.\n"), #> "\n", list("\n", list("return_from()"), " will jump out of ", #> list("frame"), ". ", list("return_to()"), " is a bit\n", #> "trickier. It will jump out of the frame located just before ", #> list("frame"), "\n", "in the evaluation stack, so that control flow ends up in ", #> list("frame"), ",\n", "at the location where the previous frame was called from.\n", #> "\n", "These functions should only be used rarely. These sort of non-local\n", #> "gotos can be hard to reason about in casual code, though they can\n", #> "sometimes be useful. Also, consider to use the condition system to\n", #> "perform non-local jumps.\n"), "\n", list(list( #> "Life cycle"), list("\n", "\n", "\n", "The support for ", #> list("frame"), " object is soft-deprecated. Please pass\n", #> "simple environments to ", list("return_from()"), #> " and ", list("return_to()"), ".\n", "\n", #> "These functions are in the questioning lifecycle because we are\n", #> "considering simpler alternatives.\n")), "\n", #> "\n", list("\n", "# Passing fn() evaluation frame to g():\n", #> "fn <- function() {\n", " val <- g(current_env())\n", #> " cat(\"g returned:\", val, \"\\n\")\n", " \"normal return\"\n", #> "}\n", "g <- function(env) h(env)\n", "\n", #> "# Here we return from fn() with a new return value:\n", #> "h <- function(env) return_from(env, \"early return\")\n", #> "fn()\n", "\n", "# Here we return to fn(). The call stack unwinds until the last frame\n", #> "# called by fn(), which is g() in that case.\n", #> "h <- function(env) return_to(env, \"early return\")\n", #> "fn()\n"), "\n", list("internal"), "\n"), rlang_backtrace_on_error.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-abort.R", #> "\n", list("rlang_backtrace_on_error"), "\n", #> list("rlang_backtrace_on_error"), "\n", list( #> "add_backtrace"), "\n", list("Display backtrace on error"), #> "\n", list("\n", "Errors thrown with ", list( #> list("abort()")), " automatically save a backtrace that\n", #> "can be inspected by calling ", list(list("last_error()")), #> ". Optionally, you can\n", "also display the backtrace alongside the error message by setting\n", #> "the option ", list("rlang_backtrace_on_error"), #> " to one of the following\n", "values:\n", #> list("\n", list(), " ", list("\"reminder\""), #> ": Display a reminder that the backtrace can be\n", #> "inspected by calling ", list(list("last_error()")), #> ".\n", list(), " ", list("\"branch\""), ": Display a simplified backtrace.\n", #> list(), " ", list("\"collapse\""), ": Display a collapsed backtrace tree.\n", #> list(), " ", list("\"full\""), ": Display the full backtrace tree.\n"), #> "\n"), "\n", list(list("Promote base errors to rlang errors"), #> list("\n", "\n", "\n", "Call ", list("options(error = rlang::entrace)"), #> " to instrument base\n", "errors with rlang features. This handler does two things:\n", #> list("\n", list(), " It saves the base error as an rlang object. This allows you to\n", #> "call ", list(list("last_error()")), " to print the backtrace or inspect its data.\n", #> list(), " It prints the backtrace for the current error according to the\n", #> list("rlang_backtrace_on_error"), " option.\n"), #> "\n")), "\n", "\n", list("\n", "# Display a simplified backtrace on error for both base and rlang\n", #> "# errors:\n", "\n", "# options(\n", "# rlang_backtrace_on_error = \"branch\",\n", #> "# error = rlang::entrace\n", "# )\n", "# stop(\"foo\")\n"), #> "\n"), rst_abort.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-restarts.R", #> "\n", list("rst_abort"), "\n", list("rst_abort"), #> "\n", list("Jump to the abort restart"), "\n", #> list("\n", "rst_abort()\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "The abort restart is the only restart that is established at top\n", #> "level. It is used by R as a top-level target, most notably when an\n", #> "error is issued (see ", list(list("abort()")), #> ") that no handler is able\n", "to deal with (see ", #> list(list("with_handlers()")), ").\n"), "\n", #> list(list("Life cycle"), list("\n", "\n", "\n", #> "All the restart functions are in the questioning stage. It is not\n", #> "clear yet whether we want to recommend restarts as a style of\n", #> "programming in R.\n")), "\n", "\n", list("\n", #> "# The `abort` restart is a bit special in that it is always\n", #> "# registered in a R session. You will always find it on the restart\n", #> "# stack because it is established at top level:\n", #> "rst_list()\n", "\n", "# You can use the `above` restart to jump to top level without\n", #> "# signalling an error:\n", list("\n", "fn <- function() {\n", #> " cat(\"aborting...\\n\")\n", " rst_abort()\n", #> " cat(\"This is never called\\n\")\n", "}\n", #> "{\n", " fn()\n", " cat(\"This is never called\\n\")\n", #> "}\n"), "\n", "\n", "# The `above` restart is the target that R uses to jump to top\n", #> "# level when critical errors are signalled:\n", #> list("\n", "{\n", " abort(\"error\")\n", " cat(\"This is never called\\n\")\n", #> "}\n"), "\n", "\n", "# If another `abort` restart is specified, errors are signalled as\n", #> "# usual but then control flow resumes with from the new restart:\n", #> list("\n", "out <- NULL\n", "{\n", " out <- with_restarts(abort(\"error\"), abort = function() \"restart!\")\n", #> " cat(\"This is called\\n\")\n", "}\n", #> "cat(\"`out` has now become:\", out, \"\\n\")\n"), #> "\n"), "\n", list("\n", list(list("rst_jump()")), #> ", ", list(list("abort()")), "\n"), "\n", list( #> "internal"), "\n"), rst_list.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-restarts.R", #> "\n", list("rst_list"), "\n", list("rst_list"), #> "\n", list("rst_exists"), "\n", list("rst_jump"), #> "\n", list("rst_maybe_jump"), "\n", list("Restarts utilities"), #> "\n", list("\n", "rst_list()\n", "\n", "rst_exists(.restart)\n", #> "\n", "rst_jump(.restart, ...)\n", "\n", "rst_maybe_jump(.restart, ...)\n"), #> "\n", list("\n", list(list(".restart"), list( #> "The name of a restart.")), "\n", "\n", list( #> list("..."), list("<", list("dynamic"), "> Arguments passed on to the\n", #> "restart function.")), "\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "Restarts are named jumping points established by ", #> list(list("with_restarts()")), ".\n", list( #> "rst_list()"), " returns the names of all restarts currently\n", #> "established. ", list("rst_exists()"), " checks if a given restart is\n", #> "established. ", list("rst_jump()"), " stops execution of the current function\n", #> "and jumps to a restart point. If the restart does not exist, an\n", #> "error is thrown. ", list("rst_maybe_jump()"), #> " first checks that a restart\n", "exists before jumping.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "All the restart functions are in the questioning stage. It is not\n", #> "clear yet whether we want to recommend restarts as a style of\n", #> "programming in R.\n")), "\n", "\n", list("\n", #> list(list("with_restarts()")), "\n"), "\n", #> list("internal"), "\n"), `scalar-type-predicates.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("scalar-type-predicates"), "\n", list( #> "scalar-type-predicates"), "\n", list("is_scalar_list"), #> "\n", list("is_scalar_atomic"), "\n", list("is_scalar_vector"), #> "\n", list("is_scalar_integer"), "\n", list("is_scalar_double"), #> "\n", list("is_scalar_character"), "\n", list( #> "is_scalar_logical"), "\n", list("is_scalar_raw"), #> "\n", list("is_string"), "\n", list("is_scalar_bytes"), #> "\n", list("is_bool"), "\n", list("Scalar type predicates"), #> "\n", list("\n", "is_scalar_list(x)\n", "\n", #> "is_scalar_atomic(x)\n", "\n", "is_scalar_vector(x)\n", #> "\n", "is_scalar_integer(x)\n", "\n", "is_scalar_double(x)\n", #> "\n", "is_scalar_character(x)\n", "\n", "is_scalar_logical(x)\n", #> "\n", "is_scalar_raw(x)\n", "\n", "is_string(x, string = NULL)\n", #> "\n", "is_scalar_bytes(x)\n", "\n", "is_bool(x)\n"), #> "\n", list("\n", list(list("x"), list("object to be tested.")), #> "\n", "\n", list(list("string"), list("A string to compare to ", #> list("x"), ". If a character vector,\n", #> "returns ", list("TRUE"), " if at least one element is equal to ", #> list("x"), ".")), "\n"), "\n", list("\n", #> "These predicates check for a given type and whether the vector is\n", #> "\"scalar\", that is, of length 1.\n", "\n", #> "In addition to the length check, ", list("is_string()"), #> " and ", list("is_bool()"), "\n", "return ", #> list("FALSE"), " if their input is missing. This is useful for\n", #> "type-checking arguments, when your function expects a single string\n", #> "or a single ", list("TRUE"), " or ", list( #> "FALSE"), ".\n"), "\n", list("\n", list("type-predicates"), #> ", ", list("bare-type-predicates"), "\n"), #> "\n"), scoped_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("scoped_env"), "\n", list("scoped_env"), #> "\n", list("is_scoped"), "\n", list("scoped_envs"), #> "\n", list("scoped_names"), "\n", list("Retired ", #> list("scoped"), " functions"), "\n", list("\n", #> "scoped_env(nm)\n", "\n", "is_scoped(nm)\n", #> "\n", "scoped_envs()\n", "\n", "scoped_names()\n"), #> "\n", list("\n", list(list("nm"), list("The name of an environment attached to the search\n", #> "path. Call ", list(list("base::search()")), #> " to see what is currently on the path.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions are deprecated as of rlang 0.3.0. They are replaced\n", #> "by ", list(list("is_attached()")), ", ...\n"), #> "\n", list("internal"), "\n"), scoped_interactive.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("scoped_interactive"), "\n", list( #> "scoped_interactive"), "\n", list("scoped_options"), #> "\n", list("scoped_bindings"), "\n", list("Questioning ", #> list("scoped_"), " functions"), "\n", list( #> "\n", "scoped_interactive(value = TRUE, frame = caller_env())\n", #> "\n", "scoped_options(..., .frame = caller_env())\n", #> "\n", "scoped_bindings(..., .env = .frame, .frame = caller_env())\n"), #> "\n", list("\n", list(list("value"), list("A single ", #> list("TRUE"), " or ", list("FALSE"), ". This overrides the return\n", #> "value of ", list("is_interactive()"), ".")), #> "\n", "\n", list(list("frame"), list("The environment of a running function which defines\n", #> "the scope of the temporary options. When the function returns,\n", #> "the options are reset to their original values.")), #> "\n", "\n", list(list("..."), list("For ", #> list("local_options()"), " and ", list("push_options()"), #> ", named\n", "values defining new option values. For ", #> list("peek_options()"), ", strings\n", "or character vectors of option names.")), #> "\n", "\n", list(list(".frame"), list("The environment of a running function which defines\n", #> "the scope of the temporary options. When the function returns,\n", #> "the options are reset to their original values.")), #> "\n", "\n", list(list(".env"), list("An environment.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "These functions have been renamed to use the conventional ", #> list("local_"), "\n", "prefix. They will be deprecated in the next minor version of rlang.\n"), #> "\n"), search_envs.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("search_envs"), "\n", list("search_envs"), #> "\n", list("search_env"), "\n", list("pkg_env"), #> "\n", list("pkg_env_name"), "\n", list("is_attached"), #> "\n", list("base_env"), "\n", list("global_env"), #> "\n", list("Search path environments"), "\n", #> list("\n", "search_envs()\n", "\n", "search_env(name)\n", #> "\n", "pkg_env(pkg)\n", "\n", "pkg_env_name(pkg)\n", #> "\n", "is_attached(x)\n", "\n", "base_env()\n", #> "\n", "global_env()\n"), "\n", list("\n", list( #> list("name"), list("The name of an environment attached to the search\n", #> "path. Call ", list(list("base::search()")), #> " to get the names of environments\n", "currently attached to the search path. Note that the search name\n", #> "of a package environment is prefixed with ", #> list("\"package:\""), ".")), "\n", "\n", #> list(list("pkg"), list("The name of a package.")), #> "\n", "\n", list(list("x"), list("An environment or a search name.")), #> "\n"), "\n", list("\n", "The search path is a chain of environments containing exported\n", #> "functions of attached packages.\n", "\n", #> "The API includes:\n", list("\n", list(), " ", #> list(list("base::search()")), " to get the names of environments attached to the\n", #> "search path.\n", list(), " ", list("search_envs()"), #> " returns the environments on the search path as a\n", #> "list.\n", list(), " ", list("pkg_env_name()"), #> " takes a bare package name and prefixes it with\n", #> list("\"package:\""), ". Attached package environments have search names of\n", #> "the form ", list("package:name"), ".\n", #> list(), " ", list("pkg_env()"), " takes a bare package name and returns the scoped\n", #> "environment of packages if they are attached to the search path,\n", #> "and throws an error otherwise. It is a shortcut for\n", #> list("search_env(pkg_env_name(\"pkgname\"))"), #> ".\n", list(), " ", list("global_env()"), #> " and ", list("base_env()"), " (simple aliases for ", #> list(list("globalenv()")), "\n", "and ", #> list(list("baseenv()")), "). These are respectively the first and last\n", #> "environments of the search path.\n", list(), #> " ", list("is_attached()"), " returns ", #> list("TRUE"), " when its argument (a search name\n", #> "or a package environment) is attached to the search path.\n"), #> "\n"), "\n", list(list("The search path"), #> list("\n", "\n", "\n", "This chain of environments determines what objects are visible from\n", #> "the global workspace. It contains the following elements:\n", #> list("\n", list(), " The chain always starts with ", #> list("global_env()"), " and finishes with\n", #> list("base_env()"), " which inherits from the terminal environment\n", #> list("empty_env()"), ".\n", list(), " Each ", #> list(list("base::library()")), " call attaches a new package environment to\n", #> "the search path. Attached packages are associated with a ", #> list("search name"), ".\n", list(), " In addition, any list, data frame, or environment can be attached\n", #> "to the search path with ", list(list("base::attach()")), #> ".\n"), "\n")), "\n", "\n", list("\n", #> "# List the search names of environments attached to the search path:\n", #> "search()\n", "\n", "# Get the corresponding environments:\n", #> "search_envs()\n", "\n", "# The global environment and the base package are always first and\n", #> "# last in the chain, respectively:\n", "envs <- search_envs()\n", #> "envs[[1]]\n", "envs[[length(envs)]]\n", "\n", #> "# These two environments have their own shortcuts:\n", #> "global_env()\n", "base_env()\n", "\n", "# Packages appear in the search path with a special name. Use\n", #> "# pkg_env_name() to create that name:\n", #> "pkg_env_name(\"rlang\")\n", "search_env(pkg_env_name(\"rlang\"))\n", #> "\n", "# Alternatively, get the scoped environment of a package with\n", #> "# pkg_env():\n", "pkg_env(\"utils\")\n"), #> "\n", list("internal"), "\n"), seq2.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec.R", #> "\n", list("seq2"), "\n", list("seq2"), "\n", #> list("seq2_along"), "\n", list("Increasing sequence of integers in an interval"), #> "\n", list("\n", "seq2(from, to)\n", "\n", "seq2_along(from, x)\n"), #> "\n", list("\n", list(list("from"), list("The starting point of the sequence.")), #> "\n", "\n", list(list("to"), list("The end point.")), #> "\n", "\n", list(list("x"), list("A vector whose length is the end point.")), #> "\n"), "\n", list("\n", "An integer vector containing a strictly increasing\n", #> "sequence.\n"), "\n", list("\n", "These helpers take two endpoints and return the sequence of all\n", #> "integers within that interval. For ", list( #> "seq2_along()"), ", the upper\n", "endpoint is taken from the length of a vector. Unlike\n", #> list("base::seq()"), ", they return an empty vector if the starting point is\n", #> "a larger integer than the end point.\n"), #> "\n", list("\n", "seq2(2, 10)\n", "seq2(10, 2)\n", #> "seq(10, 2)\n", "\n", "seq2_along(10, letters)\n"), #> "\n"), set_attrs.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("set_attrs"), "\n", list("set_attrs"), #> "\n", list("mut_attrs"), "\n", list("Add attributes to an object"), #> "\n", list("\n", "set_attrs(.x, ...)\n", "\n", #> "mut_attrs(.x, ...)\n"), "\n", list("\n", list( #> list(".x"), list("An object to decorate with attributes.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> A list of named attributes. Pass\n", #> "a single unnamed ", list("NULL"), " argument to zap all attributes from ", #> list(".x"), ".")), "\n"), "\n", list("\n", #> list("set_attrs()"), " returns a modified ", #> list("shallow copy"), "\n", "of ", list(".x"), #> ". ", list("mut_attrs()"), " invisibly returns the original ", #> list(".x"), "\n", "modified in place.\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", list("set_attrs()"), " adds, changes, or zaps attributes of objects. Pass a\n", #> "single unnamed ", list("NULL"), " argument to zap all attributes. For\n", #> list("uncopyable"), " types, use ", list("mut_attrs()"), #> ".\n"), "\n", list("\n", "Unlike ", list(list( #> "structure()")), ", these setters have no special handling of\n", #> "internal attributes names like ", list(".Dim"), #> ", ", list(".Dimnames"), " or ", list(".Names"), #> ".\n"), "\n", list(list("Life cycle"), list( #> "\n", "\n", "\n", "These functions are deprecated since rlang 0.3.0.\n")), #> "\n", "\n", list("\n", "set_attrs(letters, names = 1:26, class = \"my_chr\")\n", #> "\n", "# Splice a list of attributes:\n", "attrs <- list(attr = \"attr\", names = 1:26, class = \"my_chr\")\n", #> "obj <- set_attrs(letters, splice(attrs))\n", #> "obj\n", "\n", "# Zap attributes by passing a single unnamed NULL argument:\n", #> "set_attrs(obj, NULL)\n", "set_attrs(obj, !!! list(NULL))\n", #> "\n", "# Note that set_attrs() never modifies objects in place:\n", #> "obj\n", "\n", "# For uncopyable types, mut_attrs() lets you modify in place:\n", #> "env <- env()\n", "mut_attrs(env, foo = \"bar\")\n", #> "env\n"), "\n", list("internal"), "\n"), set_expr.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/expr.R", #> "\n", list("set_expr"), "\n", list("set_expr"), #> "\n", list("get_expr"), "\n", list("Set and get an expression"), #> "\n", list("\n", "set_expr(x, value)\n", "\n", #> "get_expr(x, default = x)\n"), "\n", list("\n", #> list(list("x"), list("An expression, closure, or one-sided formula. In addition,\n", #> list("set_expr()"), " accept frames.")), #> "\n", "\n", list(list("value"), list("An updated expression.")), #> "\n", "\n", list(list("default"), list("A default expression to return when ", #> list("x"), " is not an\n", "expression wrapper. Defaults to ", #> list("x"), " itself.")), "\n"), "\n", list( #> "\n", "The updated original input for ", list( #> "set_expr()"), ". A raw\n", "expression for ", #> list("get_expr()"), ".\n"), "\n", list("\n", #> "These helpers are useful to make your function work generically\n", #> "with quosures and raw expressions. First call ", #> list("get_expr()"), " to\n", "extract an expression. Once you're done processing the expression,\n", #> "call ", list("set_expr()"), " on the original object to update the expression.\n", #> "You can return the result of ", list("set_expr()"), #> ", either a formula or an\n", "expression depending on the input type. Note that ", #> list("set_expr()"), " does\n", "not change its input, it creates a new object.\n"), #> "\n", list("\n", "f <- ~foo(bar)\n", "e <- quote(foo(bar))\n", #> "frame <- identity(identity(ctxt_frame()))\n", #> "\n", "get_expr(f)\n", "get_expr(e)\n", "get_expr(frame)\n", #> "\n", "set_expr(f, quote(baz))\n", "set_expr(e, quote(baz))\n"), #> "\n", list("\n", list(list("quo_get_expr()")), #> " and ", list(list("quo_set_expr()")), " for versions of\n", #> list(list("get_expr()")), " and ", list(list( #> "set_expr()")), " that only work on quosures.\n"), #> "\n"), set_names.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("set_names"), "\n", list("set_names"), #> "\n", list("Set names of a vector"), "\n", list( #> "\n", "set_names(x, nm = x, ...)\n"), "\n", #> list("\n", list(list("x"), list("Vector to name.")), #> "\n", "\n", list(list("nm, ..."), list("Vector of names, the same length as ", #> list("x"), ".\n", "\n", "You can specify names in the following ways:\n", #> list("\n", list(), " If you do nothing, ", #> list("x"), " will be named with itself.\n", #> list(), " If ", list("x"), " already has names, you can provide a function or formula\n", #> "to transform the existing names. In that case, ", #> list("..."), " is passed\n", "to the function.\n", #> list(), " If ", list("nm"), " is ", list( #> "NULL"), ", the names are removed (if present).\n", #> list(), " In all other cases, ", list("nm"), #> " and ", list("..."), " are coerced to character.\n"))), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", "This is equivalent to ", list( #> list("stats::setNames()")), ", with more features and\n", #> "stricter argument checking.\n"), "\n", list( #> list("Life cycle"), list("\n", "\n", "\n", #> list("set_names()"), " is stable and exported in purrr.\n")), #> "\n", "\n", list("\n", "set_names(1:4, c(\"a\", \"b\", \"c\", \"d\"))\n", #> "set_names(1:4, letters[1:4])\n", "set_names(1:4, \"a\", \"b\", \"c\", \"d\")\n", #> "\n", "# If the second argument is ommitted a vector is named with itself\n", #> "set_names(letters[1:5])\n", "\n", "# Alternatively you can supply a function\n", #> "set_names(1:10, ~ letters[seq_along(.)])\n", #> "set_names(head(mtcars), toupper)\n", "\n", #> "# If the input vector is unnamed, it is first named after itself\n", #> "# before the function is applied:\n", "set_names(letters, toupper)\n", #> "\n", "# `...` is passed to the function:\n", #> "set_names(head(mtcars), paste0, \"_foo\")\n"), #> "\n"), splice.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("splice"), "\n", list("splice"), "\n", #> list("is_spliced"), "\n", list("is_spliced_bare"), #> "\n", list("dots_splice"), "\n", list("Splice lists"), #> "\n", list("\n", "splice(x)\n", "\n", "is_spliced(x)\n", #> "\n", "is_spliced_bare(x)\n", "\n", "dots_splice(\n", #> " ...,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .preserve_empty = FALSE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n"), "\n", #> list("\n", list(list("x"), list("A list to splice.")), #> "\n", "\n", list(list("..."), list("Arguments to collect in a list. These dots are\n", #> list("dynamic"), ".")), "\n", "\n", list( #> list(".ignore_empty"), list("Whether to ignore empty arguments. Can be one\n", #> "of ", list("\"trailing\""), ", ", list( #> "\"none\""), ", ", list("\"all\""), ". If ", #> list("\"trailing\""), ", only the\n", "last argument is ignored if it is empty.")), #> "\n", "\n", list(list(".preserve_empty"), list( #> "Whether to preserve the empty arguments that\n", #> "were not ignored. If ", list("TRUE"), ", empty arguments are stored with\n", #> list(list("missing_arg()")), " values. If ", #> list("FALSE"), " (the default) an error is\n", #> "thrown when an empty argument is detected.")), #> "\n", "\n", list(list(".homonyms"), list("How to treat arguments with the same name. The\n", #> "default, ", list("\"keep\""), ", preserves these arguments. Set ", #> list(".homonyms"), " to\n", list("\"first\""), #> " to only keep the first occurrences, to ", #> list("\"last\""), " to keep\n", "the last occurrences, and to ", #> list("\"error\""), " to raise an informative\n", #> "error and indicate what arguments have duplicated names.")), #> "\n", "\n", list(list(".check_assign"), list( #> "Whether to check for ", list("<-"), " calls passed in\n", #> "dots. When ", list("TRUE"), " and a ", list( #> "<-"), " call is detected, a warning is\n", #> "issued to advise users to use ", list("="), #> " if they meant to match a\n", "function parameter, or wrap the ", #> list("<-"), " call in braces otherwise.\n", #> "This ensures assignments are explicit.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", list("\n", list(), " ", list("splice"), #> " marks an object to be spliced. It is equivalent to using\n", #> list("!!!"), " in a function taking ", list( #> "dynamic dots"), ".\n", list(), " ", list( #> "dots_splice()"), " is like ", list(list( #> "dots_list()")), " but automatically splices\n", #> "list inputs.\n"), "\n"), "\n", list(list( #> "Standard splicing versus quoting splicing"), #> list("\n", "\n", "\n", "The ", list("!!!"), #> " operator works differently in ", list("standard"), #> " functions taking\n", "dots with ", list( #> "dots_list()"), " than in ", list("quoting"), #> " functions taking dots\n", "with ", list( #> list("enexprs()")), " or ", list(list("enquos()")), #> ".\n", list("\n", list(), " In quoting functions ", #> list("!!!"), " disaggregates its argument (let's call\n", #> "it ", list("x"), ") into as many objects as there are elements in\n", #> list("x"), ". E.g. ", list("quo(foo(!!! c(1, 2)))"), #> " is completely equivalent to\n", list( #> "quo(foo(1, 2))"), ". The creation of those separate objects has an\n", #> "overhead but is typically not important when manipulating calls\n", #> "because function calls typically take a small number of\n", #> "arguments.\n", list(), " In standard functions, disaggregating the spliced collection\n", #> "would have a negative performance impact in cases where\n", #> list("dots_list()"), " is used to build up data structures from user\n", #> "inputs. To avoid this spliced inputs are marked with ", #> list(list("splice()")), "\n", "and the final list is built with (the equivalent of)\n", #> list("flatten_if(dots, is_spliced)"), ".\n"), #> "\n", "\n", "Most of the time you should not care about the difference. However\n", #> "if you use a standard function taking tidy dots within a quoting\n", #> "function, the ", list("!!!"), " operator will disaggregate its argument because\n", #> "the behaviour of the quasiquoting function has priority. You might\n", #> "then observe some performance cost in edge cases. Here is one\n", #> "example where this would happen:", list( #> "purrr::rerun(10, dplyr::bind_rows(!!! x))\n"), #> "\n", "\n", list("purrr::rerun()"), " is a quoting function and ", #> list("dplyr::bind_rows()"), " is\n", "a standard function. Because ", #> list("bind_rows()"), " is called ", list( #> "inside"), "\n", list("rerun()"), ", the list ", #> list("x"), " will be disaggregated into a pairlist of\n", #> "arguments. To avoid this you can use ", #> list("splice()"), " instead:", list("purrr::rerun(10, dplyr::bind_rows(splice(x)))\n"), #> "\n")), "\n", "\n", list(list("Life cycle"), #> list("\n", "\n", list("\n", list(), " ", list( #> "dots_splice()"), " is in the questioning stage. It is part of our\n", #> "experiments with dots semantics. Compared to ", #> list("dots_list()"), ",\n", list("dots_splice()"), #> " automatically splices lists. We now lean towards\n", #> "adopting a single type of dots semantics (those of ", #> list("dots_list()"), ")\n", "where splicing is explicit.\n", #> list(), " ", list("splice()"), " is in the questioning stage. It is not clear whether it is\n", #> "really needed as there are other ways to avoid the performance\n", #> "issue discussed above.\n"), "\n")), "\n", #> "\n", list("internal"), "\n"), stack.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("stack"), "\n", list("stack"), "\n", #> list("global_frame"), "\n", list("current_frame"), #> "\n", list("ctxt_frame"), "\n", list("call_frame"), #> "\n", list("ctxt_depth"), "\n", list("call_depth"), #> "\n", list("ctxt_stack"), "\n", list("call_stack"), #> "\n", list("Call stack information"), "\n", list( #> "\n", "global_frame()\n", "\n", "current_frame()\n", #> "\n", "ctxt_frame(n = 1)\n", "\n", "call_frame(n = 1, clean = TRUE)\n", #> "\n", "ctxt_depth()\n", "\n", "call_depth()\n", #> "\n", "ctxt_stack(n = NULL, trim = 0)\n", "\n", #> "call_stack(n = NULL, clean = TRUE)\n"), "\n", #> list("\n", list(list("n"), list("The number of frames to go back in the stack.")), #> "\n", "\n", list(list("clean"), list("Whether to post-process the call stack to clean\n", #> "non-standard frames. If ", list("TRUE"), #> ", suboptimal call-stack entries by\n", list( #> list("base::eval()")), " will be cleaned up: the duplicate frame created by\n", #> list("eval()"), " is eliminated.")), "\n", #> "\n", list(list("trim"), list("The number of layers of intervening frames to trim off\n", #> "the stack. See ", list(list("stack_trim()")), #> " and examples.")), "\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "The ", list("eval_"), " and ", #> list("call_"), " families of functions provide a replacement\n", #> "for the base R functions prefixed with ", #> list("sys."), " (which are all about\n", "the context stack), as well as for ", #> list(list("parent.frame()")), " (which is the\n", #> "only base R function for querying the call stack). The context\n", #> "stack includes all R-level evaluation contexts. It is linear in\n", #> "terms of execution history but due to lazy evaluation it is\n", #> "potentially nonlinear in terms of call history. The call stack\n", #> "history, on the other hand, is homogenous.\n"), #> "\n", list("\n", list("ctxt_frame()"), " and ", #> list("call_frame()"), " return a ", list("frame"), #> " object\n", "containing the following fields: ", #> list("expr"), " and ", list("env"), " (call expression\n", #> "and evaluation environment), ", list("pos"), #> " and ", list("caller_pos"), " (position of\n", #> "current frame in the context stack and position of the caller), and\n", #> list("fun"), " (function of the current frame). ", #> list("ctxt_stack()"), " and\n", list("call_stack()"), #> " return a list of all context or call frames on the\n", #> "stack. Finally, ", list("ctxt_depth()"), " and ", #> list("call_depth()"), " report the\n", "current context position or the number of calling frames on the\n", #> "stack.\n", "\n", "The base R functions take two sorts of arguments to indicate which\n", #> "frame to query: ", list("which"), " and ", #> list("n"), ". The ", list("n"), " argument is\n", #> "straightforward: it's the number of frames to go down the stack,\n", #> "with ", list("n = 1"), " referring to the current context. The ", #> list("which"), " argument\n", "is more complicated and changes meaning for values lower than 1.\n", #> "For the sake of consistency, the rlang functions all take the\n", #> "same kind of argument ", list("n"), ". This argument has a single meaning (the\n", #> "number of frames to go down the stack) and cannot be lower than 1.\n", #> "\n", "Note finally that ", list("parent.frame(1)"), #> " corresponds to\n", list("call_frame(2)$env"), #> ", as ", list("n = 1"), " always refers to the current\n", #> "frame. This makes the ", list("_frame()"), #> " and ", list("_stack()"), " functions\n", #> "consistent: ", list("ctxt_frame(2)"), " is the same as ", #> list("ctxt_stack()[[2]]"), ".\n", "Also, ", #> list("ctxt_depth()"), " returns one more frame than\n", #> list(list("base::sys.nframe()")), " because it counts the global frame. That is\n", #> "consistent with the ", list("_stack()"), " functions which return the global\n", #> "frame as well. This way, ", list("call_stack(call_depth())"), #> " is the same as\n", list("global_frame()"), #> ".\n"), "\n", list(list("Life cycle"), list( #> "\n", "\n", "\n", "These functions are soft-deprecated and replaced by ", #> list(list("trace_back()")), ".\n")), "\n", #> "\n", list("\n", "# Expressions within arguments count as contexts\n", #> "identity(identity(ctxt_depth())) # returns 2\n", #> "\n", "# But they are not part of the call stack because arguments are\n", #> "# evaluated within the calling function (or the global environment\n", #> "# if called at top level)\n", "identity(identity(call_depth())) # returns 0\n", #> "\n", "# The context stacks includes all intervening execution frames. The\n", #> "# call stack doesn't:\n", "f <- function(x) identity(x)\n", #> "f(f(ctxt_stack()))\n", "f(f(call_stack()))\n", #> "\n", "g <- function(cmd) cmd()\n", "f(g(ctxt_stack))\n", #> "f(g(call_stack))\n", "\n", "# The rlang _stack() functions return a list of frame\n", #> "# objects. Use purrr::transpose() or index a field with\n", #> "# purrr::map()'s to extract a particular field from a stack:\n", #> "\n", "# stack <- f(f(call_stack()))\n", "# purrr::map(stack, \"env\")\n", #> "# purrr::transpose(stack)$expr\n", "\n", "# current_frame() is an alias for ctxt_frame(1)\n", #> "fn <- function() list(current = current_frame(), first = ctxt_frame(1))\n", #> "fn()\n", "\n", "# While current_frame() is the top of the stack, global_frame() is\n", #> "# the bottom:\n", "fn <- function() {\n", #> " n <- ctxt_depth()\n", " ctxt_frame(n)\n", #> "}\n", "identical(fn(), global_frame())\n", #> "\n", "\n", "# ctxt_stack() returns a stack with all intervening frames. You can\n", #> "# trim layers of intervening frames with the trim argument:\n", #> "identity(identity(ctxt_stack()))\n", "identity(identity(ctxt_stack(trim = 1)))\n", #> "\n", "# ctxt_stack() is called within fn() with intervening frames:\n", #> "fn <- function(trim) identity(identity(ctxt_stack(trim = trim)))\n", #> "fn(0)\n", "\n", "# We can trim the first layer of those:\n", #> "fn(1)\n", "\n", "# The outside intervening frames (at the fn() call site) are still\n", #> "# returned, but can be trimmed as well:\n", #> "identity(identity(fn(1)))\n", "identity(identity(fn(2)))\n", #> "\n", "g <- function(trim) identity(identity(fn(trim)))\n", #> "g(2)\n", "g(3)\n"), "\n", list("internal"), #> "\n"), stack_trim.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("stack_trim"), "\n", list("stack_trim"), #> "\n", list("Trim top call layers from the evaluation stack"), #> "\n", list("\n", "stack_trim(stack, n = 1)\n"), #> "\n", list("\n", list(list("stack"), list("An evaluation stack.")), #> "\n", "\n", list(list("n"), list("The number of call frames (not eval frames) to trim off\n", #> "the top of the stack. In other words, the number of layers of\n", #> "intervening frames to trim.")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", list(list("ctxt_stack()")), " can be tricky to use in real code because all\n", #> "intervening frames are returned with the stack, including those at\n", #> list("ctxt_stack()"), " own call site. ", list( #> "stack_trim()"), " makes it easy to\n", "remove layers of intervening calls.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "These functions are deprecated and replaced by ", #> list(list("trace_back()")), ".\n")), "\n", #> "\n", list("\n", "# Intervening frames appear on the evaluation stack:\n", #> "identity(identity(ctxt_stack()))\n", "\n", #> "# stack_trim() will trim the first n layers of calls:\n", #> "stack_trim(identity(identity(ctxt_stack())))\n", #> "\n", "# Note that it also takes care of calls intervening at its own call\n", #> "# site:\n", "identity(identity(\n", " stack_trim(identity(identity(ctxt_stack())))\n", #> "))\n", "\n", "# It is especially useful when used within a function that needs to\n", #> "# inspect the evaluation stack but should nonetheless be callable\n", #> "# within nested calls without side effects:\n", #> "stack_util <- function() {\n", " # n = 2 means that two layers of intervening calls should be\n", #> " # removed: The layer at ctxt_stack()'s call site (including the\n", #> " # stack_trim() call), and the layer at stack_util()'s call.\n", #> " stack <- stack_trim(ctxt_stack(), n = 2)\n", #> " stack\n", "}\n", "user_fn <- function() {\n", #> " # A user calls your stack utility with intervening frames:\n", #> " identity(identity(stack_util()))\n", "}\n", #> "# These intervening frames won't appear in the evaluation stack\n", #> "identity(user_fn())\n"), "\n", list("internal"), #> "\n"), string.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/utils-encoding.R", #> "\n", list("string"), "\n", list("string"), "\n", #> list("Create a string"), "\n", list("\n", "string(x, encoding = NULL)\n"), #> "\n", list("\n", list(list("x"), list("A character vector or a vector or list of string-like\n", #> "objects.")), "\n", "\n", list(list("encoding"), #> list("If non-null, set an encoding mark. This is only\n", #> "declarative, no encoding conversion is performed.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "These base-type constructors allow more control over the creation\n", #> "of strings in R. They take character vectors or string-like objects\n", #> "(integerish or raw vectors), and optionally set the encoding. The\n", #> "string version checks that the input contains a scalar string.\n"), #> "\n", list("\n", "# As everywhere in R, you can specify a string with Unicode\n", #> "# escapes. The characters corresponding to Unicode codepoints will\n", #> "# be encoded in UTF-8, and the string will be marked as UTF-8\n", #> "# automatically:\n", "cafe <- string(\"caf\\uE9\")\n", #> "Encoding(cafe)\n", "as_bytes(cafe)\n", "\n", #> "# In addition, string() provides useful conversions to let\n", #> "# programmers control how the string is represented in memory. For\n", #> "# encodings other than UTF-8, you'll need to supply the bytes in\n", #> "# hexadecimal form. If it is a latin1 encoding, you can mark the\n", #> "# string explicitly:\n", "cafe_latin1 <- string(c(0x63, 0x61, 0x66, 0xE9), \"latin1\")\n", #> "Encoding(cafe_latin1)\n", "as_bytes(cafe_latin1)\n"), #> "\n", list("internal"), "\n"), switch_type.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("switch_type"), "\n", list("switch_type"), #> "\n", list("coerce_type"), "\n", list("switch_class"), #> "\n", list("coerce_class"), "\n", list("Dispatch on base types"), #> "\n", list("\n", "switch_type(.x, ...)\n", "\n", #> "coerce_type(.x, .to, ...)\n", "\n", "switch_class(.x, ...)\n", #> "\n", "coerce_class(.x, .to, ...)\n"), "\n", #> list("\n", list(list(".x"), list("An object from which to dispatch.")), #> "\n", "\n", list(list("..."), list("Named clauses. The names should be types as returned by\n", #> list(list("type_of()")), ".")), "\n", "\n", #> list(list(".to"), list("This is useful when you switchpatch within a coercing\n", #> "function. If supplied, this should be a string indicating the\n", #> "target type. A catch-all clause is then added to signal an error\n", #> "stating the conversion failure. This type is prettified unless\n", #> list(".to"), " inherits from the S3 class ", #> list("\"AsIs\""), " (see ", list(list("base::I()")), #> ").")), "\n"), "\n", list("\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", list("switch_type()"), " is equivalent to\n", #> list(list("switch"), "(", list("type_of"), #> "(x, ...))"), ", while\n", list("switch_class()"), #> " switchpatches based on ", list("class(x)"), #> ". The ", list("coerce_"), "\n", "versions are intended for type conversion and provide a standard\n", #> "error message when conversion fails.\n"), #> "\n", list("\n", "switch_type(3L,\n", " double = \"foo\",\n", #> " integer = \"bar\",\n", " \"default\"\n", #> ")\n", "\n", "# Use the coerce_ version to get standardised error handling when no\n", #> "# type matches:\n", "to_chr <- function(x) {\n", #> " coerce_type(x, \"a chr\",\n", " integer = as.character(x),\n", #> " double = as.character(x)\n", " )\n", #> "}\n", "to_chr(3L)\n", "\n", "# Strings have their own type:\n", #> "switch_type(\"str\",\n", " character = \"foo\",\n", #> " string = \"bar\",\n", " \"default\"\n", #> ")\n", "\n", "# Use a fallthrough clause if you need to dispatch on all character\n", #> "# vectors, including strings:\n", "switch_type(\"str\",\n", #> " string = ,\n", " character = \"foo\",\n", #> " \"default\"\n", ")\n", "\n", "# special and builtin functions are treated as primitive, since\n", #> "# there is usually no reason to treat them differently:\n", #> "switch_type(base::list,\n", " primitive = \"foo\",\n", #> " \"default\"\n", ")\n", "switch_type(base::`$`,\n", #> " primitive = \"foo\",\n", " \"default\"\n", #> ")\n", "\n", "# closures are not primitives:\n", #> "switch_type(rlang::switch_type,\n", " primitive = \"foo\",\n", #> " \"default\"\n", ")\n"), "\n", list("internal"), #> "\n"), sym.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/sym.R", #> "\n", list("sym"), "\n", list("sym"), "\n", list( #> "syms"), "\n", list("Create a symbol or list of symbols"), #> "\n", list("\n", "sym(x)\n", "\n", "syms(x)\n"), #> "\n", list("\n", list(list("x"), list("A string or list of strings.")), #> "\n"), "\n", list("\n", "A symbol for ", list( #> "sym()"), " and a list of symbols for ", list( #> "syms()"), ".\n"), "\n", list("\n", "These functions take strings as input and turn them into symbols.\n"), #> "\n", list("\n", "# The empty string returns the missing argument:\n", #> "sym(\"\")\n", "\n", "# This way sym() and as_string() are inverse of each other:\n", #> "as_string(missing_arg())\n", "sym(as_string(missing_arg()))\n"), #> "\n"), `tidyeval-data.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval-tidy.R", #> "\n", list("data"), "\n", list("tidyeval-data"), #> "\n", list("tidyeval-data"), "\n", list(".data"), #> "\n", list(".env"), "\n", list("Data pronouns for tidy evaluation"), #> "\n", list("\n", ".data\n", "\n", ".env\n"), #> "\n", list("\n", "These pronouns allow you to be explicit about where to find objects\n", #> "when programming with data masked functions.", #> list("m <- 10\n", "mtcars %>% mutate(disp = .data$disp * .env$m)\n"), #> "\n", list("\n", list(), " ", list(".data"), #> " retrieves data-variables from the data frame.\n", #> list(), " ", list(".env"), " retrieves env-variables from the environment.\n"), #> "\n", "\n", "Because the lookup is explicit, there is no ambiguity between both\n", #> "kinds of variables. Compare:", list("disp <- 10\n", #> "mtcars %>% mutate(disp = .data$disp * .env$disp)\n", #> "mtcars %>% mutate(disp = disp * disp)\n"), #> "\n", "\n", "The ", list(".data"), " object exported from rlang is also useful to import in\n", #> "your package namespace to avoid a ", list( #> "R CMD check"), " note when referring\n", #> "to objects from the data mask.\n", "\n", "Note that ", #> list(".data"), " is only a pronoun, it is not a real data\n", #> "frame. This means that you can't take its names or map a function\n", #> "over the contents of ", list(".data"), ". Similarly, ", #> list(".env"), " is not an actual R\n", "environment. For instance, it doesn't have a parent and the\n", #> "subsetting operators behave differently.\n"), #> "\n", list("datasets"), "\n"), trace_back.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/trace.R", #> "\n", list("trace_back"), "\n", list("trace_back"), #> "\n", list("trace_length"), "\n", list("Capture a backtrace"), #> "\n", list("\n", "trace_back(top = NULL, bottom = NULL)\n", #> "\n", "trace_length(trace)\n"), "\n", list( #> "\n", list(list("top"), list("The first frame environment to be included in the\n", #> "backtrace. This becomes the top of the backtrace tree and\n", #> "represents the oldest call in the backtrace.\n", #> "\n", "This is needed in particular when you call ", #> list("trace_back()"), "\n", "indirectly or from a larger context, for example in tests or\n", #> "inside an RMarkdown document where you don't want all of the\n", #> "knitr evaluation mechanisms to appear in the backtrace.")), #> "\n", "\n", list(list("bottom"), list("The last frame environment to be included in the\n", #> "backtrace. This becomes the rightmost leaf of the backtrace tree\n", #> "and represents the youngest call in the backtrace.\n", #> "\n", "Set this when you would like to capture a backtrace without the\n", #> "capture context.\n", "\n", "Can also be an integer that will be passed to ", #> list(list("caller_env()")), ".")), "\n", #> "\n", list(list("trace"), list("A backtrace created by ", #> list("trace_back()"), ".")), "\n"), "\n", #> list("\n", "A backtrace captures the sequence of calls that lead to the current\n", #> "function, sometimes called the call stack. Because of lazy\n", #> "evaluation, the call stack in R is actually a tree, which the\n", #> list("summary()"), " method of this object will reveal.\n"), #> "\n", list("\n", list("trace_length()"), " returns the number of frames in a backtrace.\n"), #> "\n", list("\n", "# Trim backtraces automatically (this improves the generated\n", #> "# documentation for the rlang website and the same trick can be\n", #> "# useful within knitr documents):\n", "options(rlang_trace_top_env = current_env())\n", #> "\n", "f <- function() g()\n", "g <- function() h()\n", #> "h <- function() trace_back()\n", "\n", "# When no lazy evaluation is involved the backtrace is linear\n", #> "# (i.e. every call has only one child)\n", #> "f()\n", "\n", "# Lazy evaluation introduces a tree like structure\n", #> "identity(identity(f()))\n", "identity(try(f()))\n", #> "try(identity(f()))\n", "\n", "# When printing, you can request to simplify this tree to only show\n", #> "# the direct sequence of calls that lead to `trace_back()`\n", #> "x <- try(identity(f()))\n", "x\n", "print(x, simplify = \"branch\")\n", #> "\n", "# With a little cunning you can also use it to capture the\n", #> "# tree from within a base NSE function\n", #> "x <- NULL\n", "with(mtcars, {x <<- f(); 10})\n", #> "x\n", "\n", "\n", "# Restore default top env for next example\n", #> "options(rlang_trace_top_env = NULL)\n", "\n", #> "# When code is executed indirectly, i.e. via source or within an\n", #> "# RMarkdown document, you'll tend to get a lot of guff at the beginning\n", #> "# related to the execution environment:\n", #> "conn <- textConnection(\"summary(f())\")\n", #> "source(conn, echo = TRUE, local = TRUE)\n", #> "close(conn)\n", "\n", "# To automatically strip this off, specify which frame should be\n", #> "# the top of the backtrace. This will automatically trim off calls\n", #> "# prior to that frame:\n", "top <- current_env()\n", #> "h <- function() trace_back(top)\n", "\n", #> "conn <- textConnection(\"summary(f())\")\n", #> "source(conn, echo = TRUE, local = TRUE)\n", #> "close(conn)\n"), "\n"), `type-predicates.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("type-predicates"), "\n", list("type-predicates"), #> "\n", list("is_list"), "\n", list("is_atomic"), #> "\n", list("is_vector"), "\n", list("is_integer"), #> "\n", list("is_double"), "\n", list("is_character"), #> "\n", list("is_logical"), "\n", list("is_raw"), #> "\n", list("is_bytes"), "\n", list("is_null"), #> "\n", list("Type predicates"), "\n", list("\n", #> "is_list(x, n = NULL)\n", "\n", "is_atomic(x, n = NULL)\n", #> "\n", "is_vector(x, n = NULL)\n", "\n", "is_integer(x, n = NULL)\n", #> "\n", "is_double(x, n = NULL, finite = NULL)\n", #> "\n", "is_character(x, n = NULL)\n", "\n", #> "is_logical(x, n = NULL)\n", "\n", "is_raw(x, n = NULL)\n", #> "\n", "is_bytes(x, n = NULL)\n", "\n", "is_null(x)\n"), #> "\n", list("\n", list(list("x"), list("Object to be tested.")), #> "\n", "\n", list(list("n"), list("Expected length of a vector.")), #> "\n", "\n", list(list("finite"), list("Whether all values of the vector are finite. The\n", #> "non-finite values are ", list("NA"), ", ", #> list("Inf"), ", ", list("-Inf"), " and ", #> list("NaN"), ". Setting this\n", "to something other than ", #> list("NULL"), " can be expensive because the whole\n", #> "vector needs to be traversed and checked.")), #> "\n"), "\n", list("\n", "These type predicates aim to make type testing in R more\n", #> "consistent. They are wrappers around ", list( #> list("base::typeof()")), ", so operate\n", #> "at a level beneath S3/S4 etc.\n"), "\n", list( #> "\n", "Compared to base R functions:\n", list( #> "\n", list(), " The predicates for vectors include the ", #> list("n"), " argument for\n", "pattern-matching on the vector length.\n", #> list(), " Unlike ", list("is.atomic()"), #> ", ", list("is_atomic()"), " does not return ", #> list("TRUE"), " for\n", list("NULL"), ".\n", #> list(), " Unlike ", list("is.vector()"), #> ", ", list("is_vector()"), " tests if an object is an\n", #> "atomic vector or a list. ", list("is.vector"), #> " checks for the presence of\n", "attributes (other than name).\n"), #> "\n"), "\n", list("\n", list("bare-type-predicates"), #> " ", list("scalar-type-predicates"), "\n"), #> "\n"), type_of.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("type_of"), "\n", list("type_of"), #> "\n", list("Base type of an object"), "\n", list( #> "\n", "type_of(x)\n"), "\n", list("\n", list( #> list("x"), list("An R object.")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "This is equivalent to ", list( #> list("base::typeof()")), " with a few differences that\n", #> "make dispatching easier:\n", list("\n", list(), #> " The type of one-sided formulas is \"quote\".\n", #> list(), " The type of character vectors of length 1 is \"string\".\n", #> list(), " The type of special and builtin functions is \"primitive\".\n"), #> "\n"), "\n", list(list("Life cycle"), list( #> "\n", "\n", "\n", list("type_of()"), " is an experimental function. Expect API changes.\n")), #> "\n", "\n", list("\n", "type_of(10L)\n", "\n", #> "# Quosures are treated as a new base type but not formulas:\n", #> "type_of(quo(10L))\n", "type_of(~10L)\n", "\n", #> "# Compare to base::typeof():\n", "typeof(quo(10L))\n", #> "\n", "# Strings are treated as a new base type:\n", #> "type_of(letters)\n", "type_of(letters[[1]])\n", #> "\n", "# This is a bit inconsistent with the core language tenet that data\n", #> "# types are vectors. However, treating strings as a different\n", #> "# scalar type is quite helpful for switching on function inputs\n", #> "# since so many arguments expect strings:\n", #> "switch_type(\"foo\", character = abort(\"vector!\"), string = \"result\")\n", #> "\n", "# Special and builtin primitives are both treated as primitives.\n", #> "# That's because it is often irrelevant which type of primitive an\n", #> "# input is:\n", "typeof(list)\n", "typeof(`$`)\n", #> "type_of(list)\n", "type_of(`$`)\n"), "\n", #> list("internal"), "\n"), vec_poke_n.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec.R", #> "\n", list("vec_poke_n"), "\n", list("vec_poke_n"), #> "\n", list("vec_poke_range"), "\n", list("Poke values into a vector"), #> "\n", list("\n", "vec_poke_n(x, start, y, from = 1L, n = length(y))\n", #> "\n", "vec_poke_range(x, start, y, from = 1L, to = length(y) - from + 1L)\n"), #> "\n", list("\n", list(list("x"), list("The destination vector.")), #> "\n", "\n", list(list("start"), list("The index indicating where to start modifying ", #> list("x"), ".")), "\n", "\n", list(list("y"), #> list("The source vector.")), "\n", "\n", #> list(list("from"), list("The index indicating where to start copying from ", #> list("y"), ".")), "\n", "\n", list(list("n"), #> list("How many elements should be copied from ", #> list("y"), " to ", list("x"), ".")), "\n", #> "\n", list(list("to"), list("The index indicating the end of the range to copy from ", #> list("y"), ".")), "\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "These tools are for R experts only. They copy elements from ", #> list("y"), "\n", "into ", list("x"), " by mutation. You should only do this if you own ", #> list("x"), ",\n", "i.e. if you have created it or if you are certain that it doesn't\n", #> "exist in any other context. Otherwise you might create unintended\n", #> "side effects that have undefined consequences.\n"), #> "\n", list("internal"), "\n"), `vector-coercion.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("vector-coercion"), "\n", list("vector-coercion"), #> "\n", list("as_logical"), "\n", list("as_integer"), #> "\n", list("as_double"), "\n", list("as_complex"), #> "\n", list("as_character"), "\n", list("as_list"), #> "\n", list("Coerce an object to a base type"), #> "\n", list("\n", "as_logical(x)\n", "\n", "as_integer(x)\n", #> "\n", "as_double(x)\n", "\n", "as_complex(x)\n", #> "\n", "as_character(x, encoding = NULL)\n", #> "\n", "as_list(x)\n"), "\n", list("\n", list( #> list("x"), list("An object to coerce to a base type.")), #> "\n", "\n", list(list("encoding"), list("If non-null, set an encoding mark. This is only\n", #> "declarative, no encoding conversion is performed.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", "\n", "These are equivalent to the base functions (e.g. ", #> list(list("as.logical()")), ",\n", list(list( #> "as.list()")), ", etc), but perform coercion rather than conversion.\n", #> "This means they are not generic and will not call S3 conversion\n", #> "methods. They only attempt to coerce the base type of their\n", #> "input. In addition, they have stricter implicit coercion rules and\n", #> "will never attempt any kind of parsing. E.g. they will not try to\n", #> "figure out if a character vector represents integers or booleans.\n", #> "Finally, they treat attributes consistently, unlike the base R\n", #> "functions: all attributes except names are removed.\n"), #> "\n", list(list("Lifecycle"), list("\n", "\n", #> "\n", "These functions are deprecated in favour of ", #> list("vctrs::vec_cast()"), ".\n")), "\n", "\n", #> list(list("Coercion to logical and numeric atomic vectors"), #> list("\n", "\n", list("\n", list(), " To logical vectors: Integer and integerish double vectors. See\n", #> list(list("is_integerish()")), ".\n", list(), #> " To integer vectors: Logical and integerish double vectors.\n", #> list(), " To double vectors: Logical and integer vectors.\n", #> list(), " To complex vectors: Logical, integer and double vectors.\n"), #> "\n")), "\n", "\n", list(list("Coercion to character vectors"), #> list("\n", "\n", "\n", list("as_character()"), #> " and ", list("as_string()"), " have an optional ", #> list("encoding"), "\n", "argument to specify the encoding. R uses this information for\n", #> "internal handling of strings and character vectors. Note that this\n", #> "is only declarative, no encoding conversion is attempted.\n", #> "\n", "Note that only ", list("as_string()"), #> " can coerce symbols to a scalar\n", "character vector. This makes the code more explicit and adds an\n", #> "extra type check.\n")), "\n", "\n", list( #> list("Coercion to lists"), list("\n", "\n", #> "\n", list("as_list()"), " only coerces vector and dictionary types (environments\n", #> "are an example of dictionary type). Unlike ", #> list(list("base::as.list()")), ",\n", list( #> "as_list()"), " removes all attributes except names.\n")), #> "\n", "\n", list(list("Effects of removing attributes"), #> list("\n", "\n", "\n", "A technical side-effect of removing the attributes of the input is\n", #> "that the underlying objects has to be copied. This has no\n", #> "performance implications in the case of lists because this is a\n", #> "shallow copy: only the list structure is copied, not the contents\n", #> "(see ", list(list("duplicate()")), "). However, be aware that atomic vectors\n", #> "containing large amounts of data will have to be copied.\n", #> "\n", "In general, any attribute modification creates a copy, which is why\n", #> "it is better to avoid using attributes with heavy atomic vectors.\n", #> "Uncopyable objects like environments and symbols are an exception\n", #> "to this rule: in this case, attributes modification happens in\n", #> "place and has side-effects.\n")), "\n", #> "\n", list("\n", "# Coercing atomic vectors removes attributes with both base R and rlang:\n", #> "x <- structure(TRUE, class = \"foo\", bar = \"baz\")\n", #> "as.logical(x)\n", "\n", "# But coercing lists preserves attributes in base R but not rlang:\n", #> "l <- structure(list(TRUE), class = \"foo\", bar = \"baz\")\n", #> "as.list(l)\n", "as_list(l)\n", "\n", "# Implicit conversions are performed in base R but not rlang:\n", #> "as.logical(l)\n", list("\n", "as_logical(l)\n"), #> "\n", "\n", "# Conversion methods are bypassed, making the result of the\n", #> "# coercion more predictable:\n", "as.list.foo <- function(x) \"wrong\"\n", #> "as.list(l)\n", "as_list(l)\n", "\n", "# The input is never parsed. E.g. character vectors of numbers are\n", #> "# not converted to numeric types:\n", "as.integer(\"33\")\n", #> list("\n", "as_integer(\"33\")\n"), "\n", "\n", #> "\n", "# With base R tools there is no way to convert an environment to a\n", #> "# list without either triggering method dispatch, or changing the\n", #> "# original environment. as_list() makes it easy:\n", #> "x <- structure(as_environment(mtcars[1:2]), class = \"foobar\")\n", #> "as.list.foobar <- function(x) abort(\"dont call me\")\n", #> "as_list(x)\n"), "\n", list("internal"), "\n"), #> `vector-construction.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-new.R", #> "\n", list("vector-construction"), "\n", list( #> "vector-construction"), "\n", list("lgl"), #> "\n", list("int"), "\n", list("dbl"), "\n", list( #> "cpl"), "\n", list("chr"), "\n", list("bytes"), #> "\n", list("Create vectors"), "\n", list("\n", #> "lgl(...)\n", "\n", "int(...)\n", "\n", "dbl(...)\n", #> "\n", "cpl(...)\n", "\n", "chr(...)\n", "\n", #> "bytes(...)\n"), "\n", list("\n", list(list( #> "..."), list("Components of the new vector. Bare lists and explicitly\n", #> "spliced lists are spliced.")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "The atomic vector constructors are equivalent to ", #> list(list("c()")), " but:\n", list("\n", list(), #> " They allow you to be more explicit about the output\n", #> "type. Implicit coercions (e.g. from integer to logical) follow\n", #> "the rules described in ", list("vector-coercion"), #> ".\n", list(), " They use ", list("dynamic dots"), #> ".\n"), "\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", list("\n", list(), " All the abbreviated constructors such as ", #> list("lgl()"), " will probably be\n", "moved to the vctrs package at some point. This is why they are\n", #> "marked as questioning.\n", list(), " Automatic splicing is soft-deprecated and will trigger a warning\n", #> "in a future version. Please splice explicitly with ", #> list("!!!"), ".\n"), "\n")), "\n", "\n", #> list("\n", "# These constructors are like a typed version of c():\n", #> "c(TRUE, FALSE)\n", "lgl(TRUE, FALSE)\n", "\n", #> "# They follow a restricted set of coercion rules:\n", #> "int(TRUE, FALSE, 20)\n", "\n", "# Lists can be spliced:\n", #> "dbl(10, !!! list(1, 2L), TRUE)\n", "\n", "\n", #> "# They splice names a bit differently than c(). The latter\n", #> "# automatically composes inner and outer names:\n", #> "c(a = c(A = 10), b = c(B = 20, C = 30))\n", #> "\n", "# On the other hand, rlang's ctors use the inner names and issue a\n", #> "# warning to inform the user that the outer names are ignored:\n", #> "dbl(a = c(A = 10), b = c(B = 20, C = 30))\n", #> "dbl(a = c(1, 2))\n", "\n", "# As an exception, it is allowed to provide an outer name when the\n", #> "# inner vector is an unnamed scalar atomic:\n", #> "dbl(a = 1)\n", "\n", "# Spliced lists behave the same way:\n", #> "dbl(!!! list(a = 1))\n", "dbl(!!! list(a = c(A = 1)))\n", #> "\n", "# bytes() accepts integerish inputs\n", #> "bytes(1:10)\n", "bytes(0x01, 0xff, c(0x03, 0x05), list(10, 20, 30L))\n"), #> "\n"), `vector-old-ctors.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("node"), "\n", list("node"), "\n", #> list("vector-old-ctors"), "\n", list("lgl_len"), #> "\n", list("int_len"), "\n", list("dbl_len"), #> "\n", list("chr_len"), "\n", list("cpl_len"), #> "\n", list("raw_len"), "\n", list("bytes_len"), #> "\n", list("list_len"), "\n", list("lgl_along"), #> "\n", list("int_along"), "\n", list("dbl_along"), #> "\n", list("chr_along"), "\n", list("cpl_along"), #> "\n", list("raw_along"), "\n", list("bytes_along"), #> "\n", list("list_along"), "\n", list("Retired vector construction by length"), #> "\n", list("\n", "node(car, cdr = NULL)\n", "\n", #> "lgl_len(.n)\n", "\n", "int_len(.n)\n", "\n", #> "dbl_len(.n)\n", "\n", "chr_len(.n)\n", "\n", #> "cpl_len(.n)\n", "\n", "raw_len(.n)\n", "\n", #> "bytes_len(.n)\n", "\n", "list_len(.n)\n", #> "\n", "lgl_along(.x)\n", "\n", "int_along(.x)\n", #> "\n", "dbl_along(.x)\n", "\n", "chr_along(.x)\n", #> "\n", "cpl_along(.x)\n", "\n", "raw_along(.x)\n", #> "\n", "bytes_along(.x)\n", "\n", "list_along(.x)\n"), #> "\n", list("\n", list(list(".n"), list("The vector length.")), #> "\n", "\n", list(list(".x"), list("A vector.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions were deprecated and renamed with ", #> list("new_"), " prefix in\n", "rlang 0.2.0. This is for consistency with other non-variadic object\n", #> "constructors.\n"), "\n", list("internal"), #> "\n"), with_abort.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-entrace.R", #> "\n", list("with_abort"), "\n", list("with_abort"), #> "\n", list("Promote all errors to rlang errors"), #> "\n", list("\n", "with_abort(expr, classes = \"error\")\n"), #> "\n", list("\n", list(list("expr"), list("An expression run in a context where errors are\n", #> "promoted to rlang errors.")), "\n", "\n", #> list(list("classes"), list("Character vector of condition classes that should be\n", #> "promoted to rlang errors.")), "\n"), "\n", #> list("\n", list("with_abort()"), " promotes conditions as if they were thrown with\n", #> list(list("abort()")), ". These errors embed a ", #> list("backtrace"), ". They are\n", "particularly suitable to be set as ", #> list("parent errors"), " (see ", list("parent"), #> "\n", "argument of ", list(list("abort()")), #> ").\n"), "\n", list("\n", list("with_abort()"), #> " installs a ", list("calling handler"), " for errors and\n", #> "rethrows non-rlang errors with ", list(list( #> "abort()")), ". However, error handlers\n", #> "installed ", list("within"), " ", list("with_abort()"), #> " have priority. For this reason,\n", "you should use ", #> list(list("tryCatch()")), " and ", list("exiting"), #> " handlers outside\n", list("with_abort()"), #> " rather than inside.\n"), "\n", list("\n", #> "# with_abort() automatically casts simple errors thrown by stop()\n", #> "# to rlang errors. It is is handy for rethrowing low level\n", #> "# errors. The backtraces are then segmented between the low level\n", #> "# and high level contexts.\n", "f <- function() g()\n", #> "g <- function() stop(\"Low level error\")\n", #> "\n", "high_level <- function() {\n", " with_handlers(\n", #> " with_abort(f()),\n", " error = ~ abort(\"High level error\", parent = .)\n", #> " )\n", "}\n"), "\n"), with_env.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval.R", #> "\n", list("with_env"), "\n", list("with_env"), #> "\n", list("locally"), "\n", list("Evaluate an expression within a given environment"), #> "\n", list("\n", "with_env(env, expr)\n", "\n", #> "locally(expr)\n"), "\n", list("\n", list(list( #> "env"), list("An environment within which to evaluate ", #> list("expr"), ". Can be\n", "an object with a ", #> list(list("get_env()")), " method.")), "\n", #> "\n", list(list("expr"), list("An expression to evaluate.")), #> "\n"), "\n", list("\n", "These functions evaluate ", #> list("expr"), " within a given environment (", #> list("env"), "\n", "for ", list("with_env()"), #> ", or the child of the current environment for\n", #> list("locally"), "). They rely on ", list(list( #> "eval_bare()")), " which features a lighter\n", #> "evaluation mechanism than base R ", list(list( #> "base::eval()")), ", and which also has\n", #> "some subtle implications when evaluting stack sensitive functions\n", #> "(see help for ", list(list("eval_bare()")), #> ").\n"), "\n", list("\n", list("locally()"), #> " is equivalent to the base function\n", list( #> list("base::local()")), " but it produces a much cleaner\n", #> "evaluation stack, and has stack-consistent semantics. It is thus\n", #> "more suited for experimenting with the R language.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "These functions are experimental. Expect API changes.\n")), #> "\n", "\n", list("\n", "# with_env() is handy to create formulas with a given environment:\n", #> "env <- child_env(\"rlang\")\n", "f <- with_env(env, ~new_formula())\n", #> "identical(f_env(f), env)\n", "\n", "# Or functions with a given enclosure:\n", #> "fn <- with_env(env, function() NULL)\n", "identical(get_env(fn), env)\n", #> "\n", "\n", "# Unlike eval() it doesn't create duplicates on the evaluation\n", #> "# stack. You can thus use it e.g. to create non-local returns:\n", #> "fn <- function() {\n", " g(current_env())\n", #> " \"normal return\"\n", "}\n", "g <- function(env) {\n", #> " with_env(env, return(\"early return\"))\n", #> "}\n", "fn()\n", "\n", "\n", "# Since env is passed to as_environment(), it can be any object with an\n", #> "# as_environment() method. For strings, the pkg_env() is returned:\n", #> "with_env(\"base\", ~mtcars)\n", "\n", "# This can be handy to put dictionaries in scope:\n", #> "with_env(mtcars, cyl)\n"), "\n", list("internal"), #> "\n"), with_handlers.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-handlers.R", #> "\n", list("with_handlers"), "\n", list("with_handlers"), #> "\n", list("calling"), "\n", list("Establish handlers on the stack"), #> "\n", list("\n", "with_handlers(.expr, ...)\n", #> "\n", "calling(handler)\n"), "\n", list("\n", #> list(list(".expr"), list("An expression to execute in a context where new\n", #> "handlers are established. The underscored version takes a quoted\n", #> "expression or a quoted formula.")), "\n", #> "\n", list(list("..."), list("<", list("dynamic"), #> "> Named handlers. These should be\n", "functions of one argument, or ", #> list("formula functions"), ".\n", "The handlers are considered exiting by default, use ", #> list(list("calling()")), "\n", "to specify a calling handler.")), #> "\n", "\n", list(list("handler"), list("A handler function that takes a condition as\n", #> "argument. This is passed to ", list(list( #> "as_function()")), " and can thus be a\n", #> "formula describing a lambda function.")), #> "\n"), "\n", list("\n", "Condition handlers are functions established on the evaluation\n", #> "stack (see ", list(list("ctxt_stack()")), #> ") that are called by R when a condition is\n", #> "signalled (see ", list(list("cnd_signal()")), #> " and ", list(list("abort()")), " for two common signal\n", #> "functions). They come in two types:\n", list( #> "\n", list(), " Exiting handlers aborts all code currently run between\n", #> list("with_handlers()"), " and the point where the condition has been\n", #> "raised. ", list("with_handlers()"), " passes the return value of the handler\n", #> "to its caller.\n", list(), " Calling handlers, which are executed from inside the signalling\n", #> "functions. Their return values are ignored, only their side\n", #> "effects matters. Valid side effects are writing a log message, or\n", #> "jumping out of the signalling context by ", #> list("invoking a restart"), " or using ", #> list(list("return_from()")), ". If the raised\n", #> "condition was an error, this interrupts the aborting process.\n", #> "\n", "If a calling handler returns normally, it effectively declines to\n", #> "handle the condition and other handlers on the stack (calling or\n", #> "exiting) are given a chance to handle the condition.\n"), #> "\n", "\n", "Handlers are exiting by default, use ", #> list(list("calling()")), " to create a\n", #> "calling handler.\n"), "\n", list(list("Life cycle"), #> list("\n", " ", list("exiting()"), " is soft-deprecated as of rlang\n", #> "0.4.0 because ", list(list("with_handlers()")), #> " now treats handlers as exiting by\n", "default.\n")), #> "\n", "\n", list("\n", "# Signal a condition with signal():\n", #> "fn <- function() {\n", " g()\n", " cat(\"called?\\n\")\n", #> " \"fn() return value\"\n", "}\n", "g <- function() {\n", #> " h()\n", " cat(\"called?\\n\")\n", "}\n", #> "h <- function() {\n", " signal(\"A foobar condition occurred\", \"foo\")\n", #> " cat(\"called?\\n\")\n", "}\n", "\n", "# Exiting handlers jump to with_handlers() before being\n", #> "# executed. Their return value is handed over:\n", #> "handler <- function(c) \"handler return value\"\n", #> "with_handlers(fn(), foo = handler)\n", "\n", #> "# Calling handlers are called in turn and their return value is\n", #> "# ignored. Returning just means they are declining to take charge of\n", #> "# the condition. However, they can produce side-effects such as\n", #> "# displaying a message:\n", "some_handler <- function(c) cat(\"some handler!\\n\")\n", #> "other_handler <- function(c) cat(\"other handler!\\n\")\n", #> "with_handlers(fn(), foo = calling(some_handler), foo = calling(other_handler))\n", #> "\n", "# If a calling handler jumps to an earlier context, it takes\n", #> "# charge of the condition and no other handler gets a chance to\n", #> "# deal with it. The canonical way of transferring control is by\n", #> "# jumping to a restart. See with_restarts() and restarting()\n", #> "# documentation for more on this:\n", "exiting_handler <- function(c) rst_jump(\"rst_foo\")\n", #> "fn2 <- function() {\n", " with_restarts(g(), rst_foo = function() \"restart value\")\n", #> "}\n", "with_handlers(fn2(), foo = calling(exiting_handler), foo = calling(other_handler))\n"), #> "\n"), with_restarts.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-restarts.R", #> "\n", list("with_restarts"), "\n", list("with_restarts"), #> "\n", list("Establish a restart point on the stack"), #> "\n", list("\n", "with_restarts(.expr, ...)\n"), #> "\n", list("\n", list(list(".expr"), list("An expression to execute with new restarts established\n", #> "on the stack. This argument is passed by expression and supports\n", #> list("unquoting"), ". It is evaluated in a context where\n", #> "restarts are established.")), "\n", "\n", #> list(list("..."), list("<", list("dynamic"), #> "> Named restart functions. The\n", "name is taken as the restart name and the function is executed\n", #> "after the jump.")), "\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "Restart points are named functions that are established with\n", #> list("with_restarts()"), ". Once established, you can interrupt the normal\n", #> "execution of R code, jump to the restart, and resume execution from\n", #> "there. Each restart is established along with a restart function\n", #> "that is executed after the jump and that provides a return value\n", #> "from the establishing point (i.e., a return value for\n", #> list("with_restarts()"), ").\n"), "\n", list( #> "\n", "Restarts are not the only way of jumping to a previous call frame\n", #> "(see ", list(list("return_from()")), " or ", #> list(list("return_to()")), "). However, they have the\n", #> "advantage of being callable by name once established.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "All the restart functions are in the questioning stage. It is not\n", #> "clear yet whether we want to recommend restarts as a style of\n", #> "programming in R.\n")), "\n", "\n", list("\n", #> "# Restarts are not the only way to jump to a previous frame, but\n", #> "# they have the advantage of being callable by name:\n", #> "fn <- function() with_restarts(g(), my_restart = function() \"returned\")\n", #> "g <- function() h()\n", "h <- function() { rst_jump(\"my_restart\"); \"not returned\" }\n", #> "fn()\n", "\n", "# Whereas a non-local return requires to manually pass the calling\n", #> "# frame to the return function:\n", "fn <- function() g(current_env())\n", #> "g <- function(env) h(env)\n", "h <- function(env) { return_from(env, \"returned\"); \"not returned\" }\n", #> "fn()\n", "\n", "\n", "# rst_maybe_jump() checks that a restart exists before trying to jump:\n", #> "fn <- function() {\n", " g()\n", " cat(\"will this be called?\\n\")\n", #> "}\n", "g <- function() {\n", " rst_maybe_jump(\"my_restart\")\n", #> " cat(\"will this be called?\\n\")\n", "}\n", #> "\n", "# Here no restart are on the stack:\n", #> "fn()\n", "\n", "# If a restart point called `my_restart` was established on the\n", #> "# stack before calling fn(), the control flow will jump there:\n", #> "rst <- function() {\n", " cat(\"restarting...\\n\")\n", #> " \"return value\"\n", "}\n", "with_restarts(fn(), my_restart = rst)\n", #> "\n", "\n", "# Restarts are particularly useful to provide alternative default\n", #> "# values when the normal output cannot be computed:\n", #> "\n", "fn <- function(valid_input) {\n", " if (valid_input) {\n", #> " return(\"normal value\")\n", " }\n", #> "\n", " # We decide to return the empty string \"\" as default value. An\n", #> " # altenative strategy would be to signal an error. In any case,\n", #> " # we want to provide a way for the caller to get a different\n", #> " # output. For this purpose, we provide two restart functions that\n", #> " # returns alternative defaults:\n", " restarts <- list(\n", #> " rst_empty_chr = function() character(0),\n", #> " rst_null = function() NULL\n", " )\n", #> "\n", " with_restarts(splice(restarts), .expr = {\n", #> "\n", " # Signal a typed condition to let the caller know that we are\n", #> " # about to return an empty string as default value:\n", #> " cnd_signal(\"default_empty_string\")\n", #> "\n", " # If no jump to with_restarts, return default value:\n", #> " \"\"\n", " })\n", "}\n", "\n", "# Normal value for valid input:\n", #> "fn(TRUE)\n", "\n", "# Default value for bad input:\n", #> "fn(FALSE)\n", "\n", "# Change the default value if you need an empty character vector by\n", #> "# defining a calling handler that jumps to the restart. It has to\n", #> "# be calling because exiting handlers jump to the place where they\n", #> "# are established before being executed, and the restart is not\n", #> "# defined anymore at that point:\n", "rst_handler <- calling(function(c) rst_jump(\"rst_empty_chr\"))\n", #> "with_handlers(fn(FALSE), default_empty_string = rst_handler)\n", #> "\n", "# You can use restarting() to create restarting handlers easily:\n", #> "with_handlers(fn(FALSE), default_empty_string = restarting(\"rst_null\"))\n"), #> "\n", list("\n", list(list("return_from()")), #> " and ", list(list("return_to()")), " for a more flexible way\n", #> "of performing a non-local jump to an arbitrary call frame.\n"), #> "\n", list("internal"), "\n"), wref_key.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/weakref.R", #> "\n", list("wref_key"), "\n", list("wref_key"), #> "\n", list("wref_value"), "\n", list("Get key/value from a weak reference object"), #> "\n", list("\n", "wref_key(x)\n", "\n", "wref_value(x)\n"), #> "\n", list("\n", list(list("x"), list("A weak reference object.")), #> "\n"), "\n", list("\n", "Get key/value from a weak reference object\n"), #> "\n", list("\n", list(list("is_weakref()")), #> " and ", list(list("new_weakref()")), ".\n"), #> "\n"), zap.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/s3.R", #> "\n", list("zap"), "\n", list("zap"), "\n", list( #> "is_zap"), "\n", list("Create zap objects"), #> "\n", list("\n", "zap()\n", "\n", "is_zap(x)\n"), #> "\n", list("\n", list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", list("zap()"), " creates a sentinel object that indicates that an object\n", #> "should be removed. For instance, named zaps instruct ", #> list(list("env_bind()")), "\n", "and ", list( #> list("call_modify()")), " to remove those objects from the environment or\n", #> "the call.\n", "\n", "The advantage of zap objects is that they unambiguously signal the\n", #> "intent of removing an object. Sentinels like ", #> list("NULL"), " or\n", list(list("missing_arg()")), #> " are ambiguous because they represent valid R\n", #> "objects.\n"), "\n", list("\n", "# Create one zap object:\n", #> "zap()\n", "\n", "# Create a list of zaps:\n", #> "rep(list(zap()), 3)\n", "rep_named(c(\"foo\", \"bar\"), list(zap()))\n"), #> "\n"), zap_srcref.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("zap_srcref"), "\n", list("zap_srcref"), #> "\n", list("Zap source references"), "\n", list( #> "\n", "zap_srcref(x)\n"), "\n", list("\n", #> list(list("x"), list("An R object. Functions and calls are walked recursively.")), #> "\n"), "\n", list("\n", "There are a number of situations where R creates source references:\n", #> list("\n", list(), " Reading R code from a file with ", #> list("source()"), " and ", list("parse()"), #> " might save\n", "source references inside calls to ", #> list("function"), " and ", list("{"), ".\n", #> list(), " ", list(list("sys.call()")), " includes a source reference if possible.\n", #> list(), " Creating a closure stores the source reference from the call to\n", #> list("function"), ", if any.\n"), "\n", "\n", #> "These source references take up space and might cause a number of\n", #> "issues. ", list("zap_srcref()"), " recursively walks through expressions and\n", #> "functions to remove all source references.\n"), #> "\n")), source = list(abort.Rd = c("R/cnd-abort.R", #> "R/cnd-signal.R"), are_na.Rd = "R/vec-na.R", arg_match.Rd = "R/arg.R", #> as_box.Rd = "R/s3.R", as_bytes.Rd = "R/utils-encoding.R", #> as_data_mask.Rd = "R/eval-tidy.R", as_env.Rd = "R/lifecycle-retired.R", #> as_environment.Rd = "R/env.R", as_function.Rd = "R/fn.R", #> as_label.Rd = "R/deparse.R", as_name.Rd = "R/deparse.R", #> as_overscope.Rd = "R/lifecycle-retired.R", as_pairlist.Rd = "R/node.R", #> as_quosure.Rd = "R/quo.R", as_string.Rd = "R/sym.R", #> as_utf8_character.Rd = "R/utils-encoding.R", `bare-type-predicates.Rd` = "R/types.R", #> box.Rd = "R/s3.R", call2.Rd = "R/call.R", call_args.Rd = "R/call.R", #> call_fn.Rd = "R/call.R", call_inspect.Rd = "R/stack.R", #> call_modify.Rd = "R/call.R", call_name.Rd = "R/call.R", #> call_parse_type.Rd = "R/call.R", call_standardise.Rd = "R/call.R", #> caller_env.Rd = "R/env-special.R", caller_fn.Rd = "R/stack.R", #> caller_frame.Rd = "R/lifecycle-retired.R", catch_cnd.Rd = "R/cnd-handlers.R", #> chr_unserialise_unicode.Rd = "R/utils-encoding.R", #> cnd.Rd = c("R/cnd-error.R", "R/cnd.R"), cnd_message.Rd = "R/cnd-message.R", #> cnd_muffle.Rd = "R/cnd-handlers.R", cnd_signal.Rd = "R/cnd-signal.R", #> cnd_type.Rd = "R/cnd.R", done.Rd = "R/s3.R", dots_definitions.Rd = "R/dots.R", #> dots_n.Rd = "R/dots.R", dots_values.Rd = "R/dots.R", #> duplicate.Rd = "R/sexp.R", `dyn-dots.Rd` = "R/dots.R", #> empty_env.Rd = "R/env-special.R", enquo0.Rd = "R/nse-defuse.R", #> entrace.Rd = "R/cnd-entrace.R", env.Rd = "R/env.R", #> env_bind.Rd = "R/env-binding.R", env_bind_exprs.Rd = "R/lifecycle-retired.R", #> env_binding_are_active.Rd = "R/env-binding.R", env_binding_lock.Rd = "R/env-binding.R", #> env_browse.Rd = "R/env.R", env_bury.Rd = "R/lifecycle-retired.R", #> env_clone.Rd = "R/env.R", env_depth.Rd = "R/env.R", #> env_get.Rd = "R/env-binding.R", env_has.Rd = "R/env-binding.R", #> env_inherits.Rd = "R/env.R", env_lock.Rd = "R/env.R", #> env_name.Rd = "R/env-special.R", env_names.Rd = "R/env-binding.R", #> env_parent.Rd = "R/env.R", env_poke.Rd = "R/env-binding.R", #> env_print.Rd = "R/env.R", env_unbind.Rd = "R/env-binding.R", #> env_unlock.Rd = "R/env.R", eval_bare.Rd = "R/eval.R", #> eval_tidy.Rd = "R/eval-tidy.R", exec.Rd = "R/eval.R", #> exiting.Rd = "R/lifecycle-retired.R", expr_interp.Rd = "R/nse-force.R", #> expr_label.Rd = "R/expr.R", expr_print.Rd = "R/expr.R", #> exprs_auto_name.Rd = "R/nse-defuse.R", f_rhs.Rd = "R/formula.R", #> f_text.Rd = "R/formula.R", `faq-options.Rd` = "R/faq.R", #> flatten.Rd = "R/vec-squash.R", fn_body.Rd = "R/fn.R", #> fn_env.Rd = "R/fn.R", fn_fmls.Rd = "R/fn.R", format_error_bullets.Rd = "R/cnd-message.R", #> frame_position.Rd = "R/lifecycle-retired.R", friendly_type.Rd = "R/types.R", #> get_env.Rd = "R/env.R", has_length.Rd = "R/attr.R", #> has_name.Rd = "R/attr.R", hash.Rd = "R/hash.R", inherits_any.Rd = "R/s3.R", #> inject.Rd = "R/eval.R", invoke.Rd = "R/eval.R", is_call.Rd = "R/call.R", #> is_callable.Rd = "R/call.R", is_condition.Rd = "R/cnd.R", #> is_copyable.Rd = "R/types.R", is_empty.Rd = "R/types.R", #> is_env.Rd = "R/lifecycle-retired.R", is_environment.Rd = "R/types.R", #> is_expr.Rd = "R/lifecycle-retired.R", is_expression.Rd = "R/expr.R", #> is_formula.Rd = "R/formula.R", is_frame.Rd = "R/lifecycle-retired.R", #> is_function.Rd = "R/fn.R", is_installed.Rd = "R/env-special.R", #> is_integerish.Rd = "R/types.R", is_interactive.Rd = "R/state.R", #> is_lang.Rd = "R/lifecycle-retired.R", is_named.Rd = "R/attr.R", #> is_namespace.Rd = "R/env-special.R", is_pairlist.Rd = "R/node.R", #> is_reference.Rd = "R/types.R", is_stack.Rd = "R/lifecycle-retired.R", #> is_symbol.Rd = "R/sym.R", is_true.Rd = "R/types.R", #> is_weakref.Rd = "R/weakref.R", lang.Rd = "R/lifecycle-retired.R", #> lang_head.Rd = "R/lifecycle-retired.R", lang_modify.Rd = "R/lifecycle-retired.R", #> last_error.Rd = "R/cnd-abort.R", lifecycle.Rd = "R/lifecycle.R", #> list2.Rd = "R/dots.R", local_bindings.Rd = "R/env-binding.R", #> local_options.Rd = "R/state.R", missing.Rd = "R/vec-na.R", #> missing_arg.Rd = "R/arg.R", mut_node_car.Rd = "R/lifecycle-retired.R", #> names2.Rd = "R/attr.R", `new-vector-along-retired.Rd` = "R/lifecycle-retired.R", #> `new-vector.Rd` = "R/vec-new.R", new_call.Rd = "R/node.R", #> new_formula.Rd = "R/formula.R", new_function.Rd = "R/fn.R", #> new_node.Rd = "R/node.R", new_quosures.Rd = "R/quo.R", #> new_weakref.Rd = "R/weakref.R", ns_env.Rd = "R/env-special.R", #> `nse-defuse.Rd` = "R/nse-defuse.R", `nse-force.Rd` = "R/nse-force.R", #> `op-definition.Rd` = "R/operators.R", `op-get-attr.Rd` = "R/operators.R", #> `op-na-default.Rd` = "R/operators.R", `op-null-default.Rd` = "R/operators.R", #> overscope_eval_next.Rd = "R/lifecycle-retired.R", #> pairlist2.Rd = "R/call.R", parse_expr.Rd = "R/parse.R", #> parse_quosure.Rd = "R/lifecycle-retired.R", prepend.Rd = "R/lifecycle-retired.R", #> prim_name.Rd = "R/fn.R", quo_expr.Rd = "R/lifecycle-retired.R", #> quo_label.Rd = "R/quo.R", quo_squash.Rd = "R/quo.R", #> quosure.Rd = "R/quo.R", raw_deparse_str.Rd = "R/raw.R", #> rep_along.Rd = "R/vec-new.R", restarting.Rd = "R/cnd-handlers.R", #> return_from.Rd = "R/stack.R", rlang_backtrace_on_error.Rd = "R/cnd-abort.R", #> rst_abort.Rd = "R/cnd-restarts.R", rst_list.Rd = "R/cnd-restarts.R", #> `scalar-type-predicates.Rd` = "R/types.R", scoped_env.Rd = "R/lifecycle-retired.R", #> scoped_interactive.Rd = "R/lifecycle-retired.R", #> search_envs.Rd = "R/env-special.R", seq2.Rd = "R/vec.R", #> set_attrs.Rd = "R/lifecycle-retired.R", set_expr.Rd = "R/expr.R", #> set_names.Rd = "R/attr.R", splice.Rd = "R/dots.R", #> stack.Rd = "R/lifecycle-retired.R", stack_trim.Rd = "R/lifecycle-retired.R", #> string.Rd = "R/utils-encoding.R", switch_type.Rd = "R/lifecycle-retired.R", #> sym.Rd = "R/sym.R", `tidyeval-data.Rd` = "R/eval-tidy.R", #> trace_back.Rd = "R/trace.R", `type-predicates.Rd` = "R/types.R", #> type_of.Rd = "R/lifecycle-retired.R", vec_poke_n.Rd = "R/vec.R", #> `vector-coercion.Rd` = "R/lifecycle-retired.R", `vector-construction.Rd` = "R/vec-new.R", #> `vector-old-ctors.Rd` = "R/lifecycle-retired.R", #> with_abort.Rd = "R/cnd-entrace.R", with_env.Rd = "R/eval.R", #> with_handlers.Rd = "R/cnd-handlers.R", with_restarts.Rd = "R/cnd-restarts.R", #> wref_key.Rd = "R/weakref.R", zap.Rd = "R/s3.R", zap_srcref.Rd = "R/attr.R"), #> keywords = list(character(0), "internal", character(0), #> character(0), "internal", character(0), "internal", #> character(0), character(0), character(0), character(0), #> "internal", "internal", character(0), character(0), #> "internal", character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), "internal", character(0), character(0), #> "internal", "internal", character(0), "internal", #> "internal", character(0), "internal", character(0), #> "internal", character(0), "internal", "internal", #> "internal", "internal", character(0), character(0), #> character(0), character(0), character(0), character(0), #> "internal", "internal", "internal", character(0), #> "internal", character(0), character(0), character(0), #> character(0), character(0), "internal", character(0), #> character(0), character(0), character(0), character(0), #> character(0), "internal", character(0), character(0), #> character(0), "internal", character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), "internal", character(0), character(0), #> character(0), character(0), "internal", "internal", #> character(0), "internal", character(0), character(0), #> character(0), character(0), "internal", character(0), #> "internal", "internal", "internal", character(0), #> "internal", character(0), "internal", character(0), #> character(0), "internal", character(0), character(0), #> character(0), character(0), "internal", character(0), #> character(0), "internal", "internal", "internal", #> character(0), character(0), character(0), "internal", #> "internal", "internal", character(0), "internal", #> character(0), character(0), "experimental", c("datasets", #> "internal"), character(0), "internal", character(0), #> "internal", "internal", "internal", character(0), #> character(0), "internal", character(0), "experimental", #> "internal", character(0), character(0), "internal", #> character(0), character(0), character(0), "internal", #> character(0), character(0), "internal", "internal", #> "internal", "internal", character(0), character(0), #> character(0), character(0), character(0), "internal", #> "internal", character(0), "internal", "internal", #> character(0), "internal", character(0), "internal", #> character(0), "internal", character(0), character(0), #> "internal", "internal", "internal", "internal", "internal", #> character(0), "datasets", character(0), character(0), #> "internal", "internal", "internal", character(0), #> "internal", character(0), "internal", character(0), #> "internal", character(0), character(0), character(0)), #> concepts = list(character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0)), #> internal = c(FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, #> TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, #> FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, #> FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, #> TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, #> TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, #> TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, #> FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, #> TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, #> FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, #> FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, #> FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, #> TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, #> TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, #> TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, #> FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, #> FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, #> FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, #> FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, #> TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, #> TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, #> TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, #> FALSE, FALSE, FALSE)), tutorials = list(name = character(0), #> file_out = character(0), title = character(0), pagetitle = character(0), #> url = character(0)), vignettes = list(name = character(0), #> file_in = character(0), file_out = character(0), title = character(0), #> description = character(0))), examples = TRUE, run_dont_run = FALSE, #> seed = 1014, lazy = FALSE, override = list(), install = FALSE, #> preview = FALSE, new_process = FALSE, devel = FALSE, crayon_enabled = TRUE, #> crayon_colors = 256L, pkgdown_internet = TRUE)), envir = base::quote(<environment>), #> quote = base::quote(TRUE)) #> #> [[12]] #> (function (..., crayon_enabled, crayon_colors, pkgdown_internet) #> { #> options(crayon.enabled = crayon_enabled, crayon.colors = crayon_colors, #> pkgdown.internet = pkgdown_internet) #> pkgdown::build_site(...) #> })(pkg = base::quote(list(package = "rlang", version = "0.4.12", #> src_path = "/tmp/RtmpVTMEEO/rlang-0.4.12", dst_path = "/tmp/RtmpVTMEEO/rlang-0.4.12/docs", #> install_metadata = FALSE, desc = <environment>, meta = list( #> url = "mpn.metworx.com/packages/rlang/0.4.12", home = list( #> links = list(list(text = "Programming with dplyr", #> href = "https://dplyr.tidyverse.org/articles/programming.html"), #> list(text = "Using ggplot2 in packages", href = "https://ggplot2.tidyverse.org/articles/ggplot2-in-packages.html"))), #> navbar = list(structure = list(left = c("home", "reference", #> "lifecycle", "news"), right = "github"), components = list( #> lifecycle = list(text = "Life cycle", href = "reference/lifecycle.html"), #> news = list(text = "News", menu = list(list(text = "Release notes"), #> list(text = "Version 0.4.3", href = "https://www.tidyverse.org/blog/2020/02/glue-strings-and-tidy-eval/"), #> list(text = "Version 0.4.0", href = "https://www.tidyverse.org/articles/2019/06/rlang-0-4-0/"), #> list(text = "Version 0.3.1", href = "https://www.tidyverse.org/articles/2019/01/rlang-0-3-1/"), #> list(text = "Version 0.3.0", href = "https://www.tidyverse.org/articles/2018/10/rlang-0-3-0/"), #> list(text = "Version 0.2.0", href = "https://www.tidyverse.org/articles/2018/03/rlang-0.2.0/"), #> list(text = "------------------"), list(text = "Change log", #> href = "news/index.html"))))), reference = list( #> list(title = "Tidy evaluation", desc = "Quote arguments and expressions with unquoting support. The quosure variants wrap an environment with the expression.\n", #> contents = c("quo", "quos", "enquo", "enquos", #> "expr", "exprs", "enexpr", "enexprs", "nse-force", #> "nse-defuse", "as_label", "as_name")), list(title = "Tidy dots", #> desc = "Collect arguments contained in `...` with `!!!` and name-unquoting support.\n", #> contents = c("dyn-dots", "list2", "dots_list", #> "pairlist2")), list(title = "Errors, conditions, and backtraces", #> contents = c("abort", "warn", "inform", "signal", #> "cnd_message", "format_error_bullets", "trace_back", #> "with_abort", "entrace", "cnd_signal", "last_error", #> "rlang_backtrace_on_error", "catch_cnd")), list( #> title = "Evaluate expressions", contents = c("eval_tidy", #> "eval_bare", "exec")), list(title = "Symbols", #> contents = c("sym", "syms", "is_symbol", "as_string" #> )), list(title = "Calls", contents = c("starts_with(\"call_\")", #> "call2", "is_call")), list(title = "Expressions", #> contents = c("starts_with(\"expr_\")", "starts_with(\"exprs_\")", #> "starts_with(\"parse_\")", "is_expression", "is_symbolic", #> "expr_text", "expr_label", "expr_name", "set_expr", #> "get_expr")), list(title = "Quosures", contents = c("starts_with(\"quo_\")", #> "new_quosure", "is_quosure", "as_quosure", "is_quosures", #> "quos_auto_name")), list(title = "Formulas", contents = c("starts_with(\"f_\")", #> "new_formula", "is_formula", "is_bare_formula")), #> list(title = "Functions", contents = c("starts_with(\"fn_\")", #> "new_function", "is_function", "is_closure", "is_primitive", #> "as_function", "as_closure")), list(title = "Environments", #> contents = c("env", "new_environment", "env_print", #> "env_parent", "env_tail", "env_parents", "env_depth", #> "get_env", "set_env", "env_clone", "env_inherits", #> "is_environment", "is_bare_environment", "as_environment", #> "caller_env")), list(title = "Environment bindings", #> contents = c("env_bind", "env_bind_lazy", "env_bind_active", #> "env_unbind", "env_poke", "with_bindings", "scoped_bindings", #> "env_has", "env_get", "env_get_list", "env_names", #> "env_length", "env_poke")), list(title = "Search path and namespaces", #> contents = c("search_envs", "search_env", "base_env", #> "global_env", "empty_env", "is_installed", "is_namespace", #> "ns_env", "pkg_env", "env_name", "env_label")), #> list(title = "S3", contents = c("inherits_any", "inherits_all", #> "inherits_only", "new_box", "is_box", "as_box", "as_box_if", #> "unbox", "zap", "is_zap", "done")), list(title = "Create vectors", #> desc = "Atomic vector constructors have implicit splicing (i.e. splice lists automatically), while the list constructor has explicit splicing.\n", #> contents = c("lgl", "int", "dbl", "cpl", "chr", #> "list2", "rep_along", "rep_named", "seq2", "seq2_along" #> )), list(title = "Attributes", contents = c("set_names", #> "names2", "has_name", "is_named")), list(title = "Type predicates", #> contents = c("is_list", "is_atomic", "is_vector", #> "is_integer", "is_double", "is_character", "is_logical", #> "is_raw", "is_bytes", "is_scalar_list", "is_scalar_atomic", #> "is_scalar_vector", "is_scalar_integer", "is_scalar_double", #> "is_scalar_character", "is_scalar_logical", "is_scalar_raw", #> "is_scalar_bytes", "is_bare_list", "is_bare_atomic", #> "is_bare_vector", "is_bare_double", "is_bare_integer", #> "is_bare_numeric", "is_bare_character", "is_bare_logical", #> "is_bare_raw", "is_bare_bytes", "is_empty", "is_integerish", #> "is_bare_integerish", "is_scalar_integerish", #> "is_null", "is_true", "is_false", "is_string", #> "is_bool", "is_bare_string")), list(title = "Operators", #> contents = c("`%||%`", "`%|%`", "`%@%`")), list( #> title = "Function arguments", contents = c("arg_match", #> "missing_arg", "is_missing", "maybe_missing")), #> list(title = "Create tidy evaluation APIs", desc = "Create data masking APIs à-la dplyr or tidyr. These functions are meant for developers rather than users.\n", #> contents = c("`tidyeval-data`", "eval_tidy", #> "as_data_mask", "new_data_mask", "as_data_pronoun" #> )), list(title = "Condition handlers", contents = c("with_handlers", #> "calling")), list(title = "Session state", contents = c("matches(\"interactive\")", #> "matches(\"option\")")), list(title = "Weak references", #> contents = c("matches(\"weakref\")", "matches(\"wref\")" #> )), list(title = "FAQ", contents = "matches(\"faq\")"))), #> figures = list(dev = "ragg::agg_png", dpi = 96L, dev.args = list(), #> fig.ext = "png", fig.width = 7.29166666666667, fig.height = NULL, #> fig.retina = 2L, fig.asp = 0.618046971569839, bg = NULL), #> repo = list(url = list(home = "https://github.com/r-lib/rlang/", #> source = "https://github.com/r-lib/rlang/blob/master/", #> issue = "https://github.com/r-lib/rlang/issues/", user = "https://github.com/")), #> development = list(destination = "dev", mode = "release", #> version_label = "default", version_tooltip = "Released version", #> in_dev = FALSE), topics = list(name = c(abort.Rd = "abort", #> are_na.Rd = "are_na", arg_match.Rd = "arg_match", as_box.Rd = "as_box", #> as_bytes.Rd = "as_bytes", as_data_mask.Rd = "as_data_mask", #> as_env.Rd = "as_env", as_environment.Rd = "as_environment", #> as_function.Rd = "as_function", as_label.Rd = "as_label", #> as_name.Rd = "as_name", as_overscope.Rd = "as_overscope", #> as_pairlist.Rd = "as_pairlist", as_quosure.Rd = "as_quosure", #> as_string.Rd = "as_string", as_utf8_character.Rd = "as_utf8_character", #> `bare-type-predicates.Rd` = "bare-type-predicates", box.Rd = "box", #> call2.Rd = "call2", call_args.Rd = "call_args", call_fn.Rd = "call_fn", #> call_inspect.Rd = "call_inspect", call_modify.Rd = "call_modify", #> call_name.Rd = "call_name", call_parse_type.Rd = "call_parse_type", #> call_standardise.Rd = "call_standardise", caller_env.Rd = "caller_env", #> caller_fn.Rd = "caller_fn", caller_frame.Rd = "caller_frame", #> catch_cnd.Rd = "catch_cnd", chr_unserialise_unicode.Rd = "chr_unserialise_unicode", #> cnd.Rd = "error_cnd", cnd_message.Rd = "cnd_message", cnd_muffle.Rd = "cnd_muffle", #> cnd_signal.Rd = "cnd_signal", cnd_type.Rd = "cnd_type", done.Rd = "done", #> dots_definitions.Rd = "dots_definitions", dots_n.Rd = "dots_n", #> dots_values.Rd = "dots_values", duplicate.Rd = "duplicate", #> `dyn-dots.Rd` = "dyn-dots", empty_env.Rd = "empty_env", enquo0.Rd = "enquo0", #> entrace.Rd = "entrace", env.Rd = "env", env_bind.Rd = "env_bind", #> env_bind_exprs.Rd = "env_bind_exprs", env_binding_are_active.Rd = "env_binding_are_active", #> env_binding_lock.Rd = "env_binding_lock", env_browse.Rd = "env_browse", #> env_bury.Rd = "env_bury", env_clone.Rd = "env_clone", env_depth.Rd = "env_depth", #> env_get.Rd = "env_get", env_has.Rd = "env_has", env_inherits.Rd = "env_inherits", #> env_lock.Rd = "env_lock", env_name.Rd = "env_name", env_names.Rd = "env_names", #> env_parent.Rd = "env_parent", env_poke.Rd = "env_poke", env_print.Rd = "env_print", #> env_unbind.Rd = "env_unbind", env_unlock.Rd = "env_unlock", #> eval_bare.Rd = "eval_bare", eval_tidy.Rd = "eval_tidy", exec.Rd = "exec", #> exiting.Rd = "exiting", expr_interp.Rd = "expr_interp", expr_label.Rd = "expr_label", #> expr_print.Rd = "expr_print", exprs_auto_name.Rd = "exprs_auto_name", #> f_rhs.Rd = "f_rhs", f_text.Rd = "f_text", `faq-options.Rd` = "faq-options", #> flatten.Rd = "flatten", fn_body.Rd = "fn_body", fn_env.Rd = "fn_env", #> fn_fmls.Rd = "fn_fmls", format_error_bullets.Rd = "format_error_bullets", #> frame_position.Rd = "frame_position", friendly_type.Rd = "friendly_type", #> get_env.Rd = "get_env", has_length.Rd = "has_length", has_name.Rd = "has_name", #> hash.Rd = "hash", inherits_any.Rd = "inherits_any", inject.Rd = "inject", #> invoke.Rd = "invoke", is_call.Rd = "is_call", is_callable.Rd = "is_callable", #> is_condition.Rd = "is_condition", is_copyable.Rd = "is_copyable", #> is_empty.Rd = "is_empty", is_env.Rd = "is_env", is_environment.Rd = "is_environment", #> is_expr.Rd = "is_expr", is_expression.Rd = "is_expression", #> is_formula.Rd = "is_formula", is_frame.Rd = "is_frame", is_function.Rd = "is_function", #> is_installed.Rd = "is_installed", is_integerish.Rd = "is_integerish", #> is_interactive.Rd = "is_interactive", is_lang.Rd = "is_lang", #> is_named.Rd = "is_named", is_namespace.Rd = "is_namespace", #> is_pairlist.Rd = "is_pairlist", is_reference.Rd = "is_reference", #> is_stack.Rd = "is_stack", is_symbol.Rd = "is_symbol", is_true.Rd = "is_true", #> is_weakref.Rd = "is_weakref", lang.Rd = "lang", lang_head.Rd = "lang_head", #> lang_modify.Rd = "lang_modify", last_error.Rd = "last_error", #> lifecycle.Rd = "lifecycle", list2.Rd = "list2", local_bindings.Rd = "local_bindings", #> local_options.Rd = "local_options", missing.Rd = "missing", #> missing_arg.Rd = "missing_arg", mut_node_car.Rd = "mut_node_car", #> names2.Rd = "names2", `new-vector-along-retired.Rd` = "new-vector-along-retired", #> `new-vector.Rd` = "new-vector", new_call.Rd = "new_call", #> new_formula.Rd = "new_formula", new_function.Rd = "new_function", #> new_node.Rd = "new_node", new_quosures.Rd = "new_quosures", #> new_weakref.Rd = "new_weakref", ns_env.Rd = "ns_env", `nse-defuse.Rd` = "nse-defuse", #> `nse-force.Rd` = "nse-force", `op-definition.Rd` = "op-definition", #> `op-get-attr.Rd` = "op-get-attr", `op-na-default.Rd` = "op-na-default", #> `op-null-default.Rd` = "op-null-default", overscope_eval_next.Rd = "overscope_eval_next", #> pairlist2.Rd = "pairlist2", parse_expr.Rd = "parse_expr", #> parse_quosure.Rd = "parse_quosure", prepend.Rd = "prepend", #> prim_name.Rd = "prim_name", quo_expr.Rd = "quo_expr", quo_label.Rd = "quo_label", #> quo_squash.Rd = "quo_squash", quosure.Rd = "quosure", raw_deparse_str.Rd = "raw_deparse_str", #> rep_along.Rd = "rep_along", restarting.Rd = "restarting", #> return_from.Rd = "return_from", rlang_backtrace_on_error.Rd = "rlang_backtrace_on_error", #> rst_abort.Rd = "rst_abort", rst_list.Rd = "rst_list", `scalar-type-predicates.Rd` = "scalar-type-predicates", #> scoped_env.Rd = "scoped_env", scoped_interactive.Rd = "scoped_interactive", #> search_envs.Rd = "search_envs", seq2.Rd = "seq2", set_attrs.Rd = "set_attrs", #> set_expr.Rd = "set_expr", set_names.Rd = "set_names", splice.Rd = "splice", #> stack.Rd = "stack", stack_trim.Rd = "stack_trim", string.Rd = "string", #> switch_type.Rd = "switch_type", sym.Rd = "sym", `tidyeval-data.Rd` = "tidyeval-data", #> trace_back.Rd = "trace_back", `type-predicates.Rd` = "type-predicates", #> type_of.Rd = "type_of", vec_poke_n.Rd = "vec_poke_n", `vector-coercion.Rd` = "vector-coercion", #> `vector-construction.Rd` = "vector-construction", `vector-old-ctors.Rd` = "node", #> with_abort.Rd = "with_abort", with_env.Rd = "with_env", with_handlers.Rd = "with_handlers", #> with_restarts.Rd = "with_restarts", wref_key.Rd = "wref_key", #> zap.Rd = "zap", zap_srcref.Rd = "zap_srcref"), file_in = c("abort.Rd", #> "are_na.Rd", "arg_match.Rd", "as_box.Rd", "as_bytes.Rd", #> "as_data_mask.Rd", "as_env.Rd", "as_environment.Rd", "as_function.Rd", #> "as_label.Rd", "as_name.Rd", "as_overscope.Rd", "as_pairlist.Rd", #> "as_quosure.Rd", "as_string.Rd", "as_utf8_character.Rd", #> "bare-type-predicates.Rd", "box.Rd", "call2.Rd", "call_args.Rd", #> "call_fn.Rd", "call_inspect.Rd", "call_modify.Rd", "call_name.Rd", #> "call_parse_type.Rd", "call_standardise.Rd", "caller_env.Rd", #> "caller_fn.Rd", "caller_frame.Rd", "catch_cnd.Rd", "chr_unserialise_unicode.Rd", #> "cnd.Rd", "cnd_message.Rd", "cnd_muffle.Rd", "cnd_signal.Rd", #> "cnd_type.Rd", "done.Rd", "dots_definitions.Rd", "dots_n.Rd", #> "dots_values.Rd", "duplicate.Rd", "dyn-dots.Rd", "empty_env.Rd", #> "enquo0.Rd", "entrace.Rd", "env.Rd", "env_bind.Rd", "env_bind_exprs.Rd", #> "env_binding_are_active.Rd", "env_binding_lock.Rd", "env_browse.Rd", #> "env_bury.Rd", "env_clone.Rd", "env_depth.Rd", "env_get.Rd", #> "env_has.Rd", "env_inherits.Rd", "env_lock.Rd", "env_name.Rd", #> "env_names.Rd", "env_parent.Rd", "env_poke.Rd", "env_print.Rd", #> "env_unbind.Rd", "env_unlock.Rd", "eval_bare.Rd", "eval_tidy.Rd", #> "exec.Rd", "exiting.Rd", "expr_interp.Rd", "expr_label.Rd", #> "expr_print.Rd", "exprs_auto_name.Rd", "f_rhs.Rd", "f_text.Rd", #> "faq-options.Rd", "flatten.Rd", "fn_body.Rd", "fn_env.Rd", #> "fn_fmls.Rd", "format_error_bullets.Rd", "frame_position.Rd", #> "friendly_type.Rd", "get_env.Rd", "has_length.Rd", "has_name.Rd", #> "hash.Rd", "inherits_any.Rd", "inject.Rd", "invoke.Rd", "is_call.Rd", #> "is_callable.Rd", "is_condition.Rd", "is_copyable.Rd", "is_empty.Rd", #> "is_env.Rd", "is_environment.Rd", "is_expr.Rd", "is_expression.Rd", #> "is_formula.Rd", "is_frame.Rd", "is_function.Rd", "is_installed.Rd", #> "is_integerish.Rd", "is_interactive.Rd", "is_lang.Rd", "is_named.Rd", #> "is_namespace.Rd", "is_pairlist.Rd", "is_reference.Rd", "is_stack.Rd", #> "is_symbol.Rd", "is_true.Rd", "is_weakref.Rd", "lang.Rd", #> "lang_head.Rd", "lang_modify.Rd", "last_error.Rd", "lifecycle.Rd", #> "list2.Rd", "local_bindings.Rd", "local_options.Rd", "missing.Rd", #> "missing_arg.Rd", "mut_node_car.Rd", "names2.Rd", "new-vector-along-retired.Rd", #> "new-vector.Rd", "new_call.Rd", "new_formula.Rd", "new_function.Rd", #> "new_node.Rd", "new_quosures.Rd", "new_weakref.Rd", "ns_env.Rd", #> "nse-defuse.Rd", "nse-force.Rd", "op-definition.Rd", "op-get-attr.Rd", #> "op-na-default.Rd", "op-null-default.Rd", "overscope_eval_next.Rd", #> "pairlist2.Rd", "parse_expr.Rd", "parse_quosure.Rd", "prepend.Rd", #> "prim_name.Rd", "quo_expr.Rd", "quo_label.Rd", "quo_squash.Rd", #> "quosure.Rd", "raw_deparse_str.Rd", "rep_along.Rd", "restarting.Rd", #> "return_from.Rd", "rlang_backtrace_on_error.Rd", "rst_abort.Rd", #> "rst_list.Rd", "scalar-type-predicates.Rd", "scoped_env.Rd", #> "scoped_interactive.Rd", "search_envs.Rd", "seq2.Rd", "set_attrs.Rd", #> "set_expr.Rd", "set_names.Rd", "splice.Rd", "stack.Rd", "stack_trim.Rd", #> "string.Rd", "switch_type.Rd", "sym.Rd", "tidyeval-data.Rd", #> "trace_back.Rd", "type-predicates.Rd", "type_of.Rd", "vec_poke_n.Rd", #> "vector-coercion.Rd", "vector-construction.Rd", "vector-old-ctors.Rd", #> "with_abort.Rd", "with_env.Rd", "with_handlers.Rd", "with_restarts.Rd", #> "wref_key.Rd", "zap.Rd", "zap_srcref.Rd"), file_out = c("abort.html", #> "are_na.html", "arg_match.html", "as_box.html", "as_bytes.html", #> "as_data_mask.html", "as_env.html", "as_environment.html", #> "as_function.html", "as_label.html", "as_name.html", "as_overscope.html", #> "as_pairlist.html", "as_quosure.html", "as_string.html", #> "as_utf8_character.html", "bare-type-predicates.html", "box.html", #> "call2.html", "call_args.html", "call_fn.html", "call_inspect.html", #> "call_modify.html", "call_name.html", "call_parse_type.html", #> "call_standardise.html", "caller_env.html", "caller_fn.html", #> "caller_frame.html", "catch_cnd.html", "chr_unserialise_unicode.html", #> "cnd.html", "cnd_message.html", "cnd_muffle.html", "cnd_signal.html", #> "cnd_type.html", "done.html", "dots_definitions.html", "dots_n.html", #> "dots_values.html", "duplicate.html", "dyn-dots.html", "empty_env.html", #> "enquo0.html", "entrace.html", "env.html", "env_bind.html", #> "env_bind_exprs.html", "env_binding_are_active.html", "env_binding_lock.html", #> "env_browse.html", "env_bury.html", "env_clone.html", "env_depth.html", #> "env_get.html", "env_has.html", "env_inherits.html", "env_lock.html", #> "env_name.html", "env_names.html", "env_parent.html", "env_poke.html", #> "env_print.html", "env_unbind.html", "env_unlock.html", "eval_bare.html", #> "eval_tidy.html", "exec.html", "exiting.html", "expr_interp.html", #> "expr_label.html", "expr_print.html", "exprs_auto_name.html", #> "f_rhs.html", "f_text.html", "faq-options.html", "flatten.html", #> "fn_body.html", "fn_env.html", "fn_fmls.html", "format_error_bullets.html", #> "frame_position.html", "friendly_type.html", "get_env.html", #> "has_length.html", "has_name.html", "hash.html", "inherits_any.html", #> "inject.html", "invoke.html", "is_call.html", "is_callable.html", #> "is_condition.html", "is_copyable.html", "is_empty.html", #> "is_env.html", "is_environment.html", "is_expr.html", "is_expression.html", #> "is_formula.html", "is_frame.html", "is_function.html", "is_installed.html", #> "is_integerish.html", "is_interactive.html", "is_lang.html", #> "is_named.html", "is_namespace.html", "is_pairlist.html", #> "is_reference.html", "is_stack.html", "is_symbol.html", "is_true.html", #> "is_weakref.html", "lang.html", "lang_head.html", "lang_modify.html", #> "last_error.html", "lifecycle.html", "list2.html", "local_bindings.html", #> "local_options.html", "missing.html", "missing_arg.html", #> "mut_node_car.html", "names2.html", "new-vector-along-retired.html", #> "new-vector.html", "new_call.html", "new_formula.html", "new_function.html", #> "new_node.html", "new_quosures.html", "new_weakref.html", #> "ns_env.html", "nse-defuse.html", "nse-force.html", "op-definition.html", #> "op-get-attr.html", "op-na-default.html", "op-null-default.html", #> "overscope_eval_next.html", "pairlist2.html", "parse_expr.html", #> "parse_quosure.html", "prepend.html", "prim_name.html", "quo_expr.html", #> "quo_label.html", "quo_squash.html", "quosure.html", "raw_deparse_str.html", #> "rep_along.html", "restarting.html", "return_from.html", #> "rlang_backtrace_on_error.html", "rst_abort.html", "rst_list.html", #> "scalar-type-predicates.html", "scoped_env.html", "scoped_interactive.html", #> "search_envs.html", "seq2.html", "set_attrs.html", "set_expr.html", #> "set_names.html", "splice.html", "stack.html", "stack_trim.html", #> "string.html", "switch_type.html", "sym.html", "tidyeval-data.html", #> "trace_back.html", "type-predicates.html", "type_of.html", #> "vec_poke_n.html", "vector-coercion.html", "vector-construction.html", #> "vector-old-ctors.html", "with_abort.html", "with_env.html", #> "with_handlers.html", "with_restarts.html", "wref_key.html", #> "zap.html", "zap_srcref.html"), alias = list(abort.Rd = c("abort", #> "warn", "inform", "signal", "interrupt"), are_na.Rd = c("are_na", #> "is_na", "is_lgl_na", "is_int_na", "is_dbl_na", "is_chr_na", #> "is_cpl_na"), arg_match.Rd = c("arg_match", "arg_match0"), #> as_box.Rd = c("as_box", "as_box_if"), as_bytes.Rd = "as_bytes", #> as_data_mask.Rd = c("as_data_mask", "as_data_pronoun", #> "new_data_mask"), as_env.Rd = "as_env", as_environment.Rd = "as_environment", #> as_function.Rd = c("as_function", "is_lambda", "as_closure" #> ), as_label.Rd = "as_label", as_name.Rd = "as_name", #> as_overscope.Rd = c("as_overscope", "new_overscope", #> "overscope_clean"), as_pairlist.Rd = "as_pairlist", as_quosure.Rd = c("as_quosure", #> "new_quosure"), as_string.Rd = "as_string", as_utf8_character.Rd = "as_utf8_character", #> `bare-type-predicates.Rd` = c("bare-type-predicates", #> "is_bare_list", "is_bare_atomic", "is_bare_vector", "is_bare_double", #> "is_bare_integer", "is_bare_numeric", "is_bare_character", #> "is_bare_logical", "is_bare_raw", "is_bare_string", "is_bare_bytes" #> ), box.Rd = c("box", "new_box", "is_box", "unbox"), call2.Rd = "call2", #> call_args.Rd = c("call_args", "call_args_names"), call_fn.Rd = "call_fn", #> call_inspect.Rd = "call_inspect", call_modify.Rd = "call_modify", #> call_name.Rd = c("call_name", "call_ns"), call_parse_type.Rd = "call_parse_type", #> call_standardise.Rd = "call_standardise", caller_env.Rd = c("caller_env", #> "current_env"), caller_fn.Rd = c("caller_fn", "current_fn" #> ), caller_frame.Rd = "caller_frame", catch_cnd.Rd = "catch_cnd", #> chr_unserialise_unicode.Rd = "chr_unserialise_unicode", #> cnd.Rd = c("error_cnd", "cnd", "warning_cnd", "message_cnd" #> ), cnd_message.Rd = c("cnd_message", "cnd_header", "cnd_body", #> "cnd_footer"), cnd_muffle.Rd = "cnd_muffle", cnd_signal.Rd = "cnd_signal", #> cnd_type.Rd = "cnd_type", done.Rd = c("done", "is_done_box" #> ), dots_definitions.Rd = "dots_definitions", dots_n.Rd = "dots_n", #> dots_values.Rd = "dots_values", duplicate.Rd = "duplicate", #> `dyn-dots.Rd` = c("dyn-dots", "tidy-dots"), empty_env.Rd = "empty_env", #> enquo0.Rd = c("enquo0", "enquos0"), entrace.Rd = c("entrace", #> "cnd_entrace"), env.Rd = c("env", "child_env", "new_environment" #> ), env_bind.Rd = c("env_bind", "env_bind_lazy", "env_bind_active", #> "%<~%"), env_bind_exprs.Rd = c("env_bind_exprs", "env_bind_fns" #> ), env_binding_are_active.Rd = c("env_binding_are_active", #> "env_binding_are_lazy"), env_binding_lock.Rd = c("env_binding_lock", #> "env_binding_unlock", "env_binding_are_locked"), env_browse.Rd = c("env_browse", #> "env_is_browsed"), env_bury.Rd = "env_bury", env_clone.Rd = "env_clone", #> env_depth.Rd = "env_depth", env_get.Rd = c("env_get", #> "env_get_list"), env_has.Rd = "env_has", env_inherits.Rd = "env_inherits", #> env_lock.Rd = c("env_lock", "env_is_locked"), env_name.Rd = c("env_name", #> "env_label"), env_names.Rd = c("env_names", "env_length" #> ), env_parent.Rd = c("env_parent", "env_tail", "env_parents" #> ), env_poke.Rd = "env_poke", env_print.Rd = "env_print", #> env_unbind.Rd = "env_unbind", env_unlock.Rd = "env_unlock", #> eval_bare.Rd = "eval_bare", eval_tidy.Rd = "eval_tidy", #> exec.Rd = "exec", exiting.Rd = "exiting", expr_interp.Rd = "expr_interp", #> expr_label.Rd = c("expr_label", "expr_name", "expr_text" #> ), expr_print.Rd = c("expr_print", "expr_deparse"), exprs_auto_name.Rd = c("exprs_auto_name", #> "quos_auto_name"), f_rhs.Rd = c("f_rhs", "f_rhs<-", "f_lhs", #> "f_lhs<-", "f_env", "f_env<-"), f_text.Rd = c("f_text", #> "f_name", "f_label"), `faq-options.Rd` = "faq-options", #> flatten.Rd = c("flatten", "flatten_lgl", "flatten_int", #> "flatten_dbl", "flatten_cpl", "flatten_chr", "flatten_raw", #> "squash", "squash_lgl", "squash_int", "squash_dbl", "squash_cpl", #> "squash_chr", "squash_raw", "flatten_if", "squash_if" #> ), fn_body.Rd = c("fn_body", "fn_body<-"), fn_env.Rd = c("fn_env", #> "fn_env<-"), fn_fmls.Rd = c("fn_fmls", "fn_fmls_names", #> "fn_fmls_syms", "fn_fmls<-", "fn_fmls_names<-"), format_error_bullets.Rd = "format_error_bullets", #> frame_position.Rd = "frame_position", friendly_type.Rd = "friendly_type", #> get_env.Rd = c("get_env", "set_env", "env_poke_parent" #> ), has_length.Rd = "has_length", has_name.Rd = "has_name", #> hash.Rd = "hash", inherits_any.Rd = c("inherits_any", #> "inherits_all", "inherits_only"), inject.Rd = "inject", #> invoke.Rd = "invoke", is_call.Rd = "is_call", is_callable.Rd = "is_callable", #> is_condition.Rd = "is_condition", is_copyable.Rd = "is_copyable", #> is_empty.Rd = "is_empty", is_env.Rd = c("is_env", "is_bare_env" #> ), is_environment.Rd = c("is_environment", "is_bare_environment" #> ), is_expr.Rd = "is_expr", is_expression.Rd = c("is_expression", #> "is_syntactic_literal", "is_symbolic"), is_formula.Rd = c("is_formula", #> "is_bare_formula"), is_frame.Rd = "is_frame", is_function.Rd = c("is_function", #> "is_closure", "is_primitive", "is_primitive_eager", "is_primitive_lazy" #> ), is_installed.Rd = c("is_installed", "check_installed" #> ), is_integerish.Rd = c("is_integerish", "is_bare_integerish", #> "is_scalar_integerish"), is_interactive.Rd = c("is_interactive", #> "local_interactive", "with_interactive"), is_lang.Rd = c("is_lang", #> "is_unary_lang", "is_binary_lang", "quo_is_lang"), is_named.Rd = c("is_named", #> "is_dictionaryish", "have_name"), is_namespace.Rd = "is_namespace", #> is_pairlist.Rd = c("is_pairlist", "is_node", "is_node_list" #> ), is_reference.Rd = "is_reference", is_stack.Rd = c("is_stack", #> "is_eval_stack", "is_call_stack"), is_symbol.Rd = "is_symbol", #> is_true.Rd = c("is_true", "is_false"), is_weakref.Rd = "is_weakref", #> lang.Rd = c("lang", "new_language"), lang_head.Rd = c("lang_head", #> "lang_tail"), lang_modify.Rd = c("lang_modify", "lang_standardise", #> "lang_fn", "lang_name", "lang_args", "lang_args_names" #> ), last_error.Rd = c("last_error", "last_trace"), lifecycle.Rd = "lifecycle", #> list2.Rd = c("list2", "ll", "dots_list"), local_bindings.Rd = c("local_bindings", #> "with_bindings"), local_options.Rd = c("local_options", #> "with_options", "push_options", "peek_options", "peek_option" #> ), missing.Rd = c("missing", "na_lgl", "na_int", "na_dbl", #> "na_chr", "na_cpl"), missing_arg.Rd = c("missing_arg", #> "is_missing", "maybe_missing"), mut_node_car.Rd = c("mut_node_car", #> "mut_node_cdr", "mut_node_caar", "mut_node_cadr", "mut_node_cdar", #> "mut_node_cddr", "mut_node_tag"), names2.Rd = "names2", #> `new-vector-along-retired.Rd` = c("new-vector-along-retired", #> "new_logical_along", "new_integer_along", "new_double_along", #> "new_character_along", "new_complex_along", "new_raw_along", #> "new_list_along"), `new-vector.Rd` = c("new-vector", #> "new_logical", "new_integer", "new_double", "new_character", #> "new_complex", "new_raw", "new_list"), new_call.Rd = "new_call", #> new_formula.Rd = "new_formula", new_function.Rd = "new_function", #> new_node.Rd = c("new_node", "node_car", "node_cdr", "node_caar", #> "node_cadr", "node_cdar", "node_cddr", "node_poke_car", #> "node_poke_cdr", "node_poke_caar", "node_poke_cadr", #> "node_poke_cdar", "node_poke_cddr", "node_tag", "node_poke_tag" #> ), new_quosures.Rd = c("new_quosures", "as_quosures", #> "is_quosures"), new_weakref.Rd = "new_weakref", ns_env.Rd = c("ns_env", #> "ns_imports_env", "ns_env_name"), `nse-defuse.Rd` = c("nse-defuse", #> "quotation", "expr", "enexpr", "exprs", "enexprs", "ensym", #> "ensyms", "quo", "enquo", "quos", "enquos"), `nse-force.Rd` = c("nse-force", #> "quasiquotation", "UQ", "UQS", "{{}}", "{{", "!!", "!!!", #> ":=", "qq_show"), `op-definition.Rd` = c("op-definition", #> "is_definition", "new_definition", "is_formulaish"), #> `op-get-attr.Rd` = c("op-get-attr", "%@%", "%@%<-"), #> `op-na-default.Rd` = c("op-na-default", "%|%"), `op-null-default.Rd` = c("op-null-default", #> "%||%"), overscope_eval_next.Rd = "overscope_eval_next", #> pairlist2.Rd = "pairlist2", parse_expr.Rd = c("parse_expr", #> "parse_exprs", "parse_quo", "parse_quos"), parse_quosure.Rd = c("parse_quosure", #> "parse_quosures"), prepend.Rd = c("prepend", "modify" #> ), prim_name.Rd = "prim_name", quo_expr.Rd = "quo_expr", #> quo_label.Rd = c("quo_label", "quo_text", "quo_name"), #> quo_squash.Rd = "quo_squash", quosure.Rd = c("quosure", #> "is_quosure", "quo_is_missing", "quo_is_symbol", "quo_is_call", #> "quo_is_symbolic", "quo_is_null", "quo_get_expr", "quo_get_env", #> "quo_set_expr", "quo_set_env"), raw_deparse_str.Rd = "raw_deparse_str", #> rep_along.Rd = c("rep_along", "rep_named"), restarting.Rd = "restarting", #> return_from.Rd = c("return_from", "return_to"), rlang_backtrace_on_error.Rd = c("rlang_backtrace_on_error", #> "add_backtrace"), rst_abort.Rd = "rst_abort", rst_list.Rd = c("rst_list", #> "rst_exists", "rst_jump", "rst_maybe_jump"), `scalar-type-predicates.Rd` = c("scalar-type-predicates", #> "is_scalar_list", "is_scalar_atomic", "is_scalar_vector", #> "is_scalar_integer", "is_scalar_double", "is_scalar_character", #> "is_scalar_logical", "is_scalar_raw", "is_string", "is_scalar_bytes", #> "is_bool"), scoped_env.Rd = c("scoped_env", "is_scoped", #> "scoped_envs", "scoped_names"), scoped_interactive.Rd = c("scoped_interactive", #> "scoped_options", "scoped_bindings"), search_envs.Rd = c("search_envs", #> "search_env", "pkg_env", "pkg_env_name", "is_attached", #> "base_env", "global_env"), seq2.Rd = c("seq2", "seq2_along" #> ), set_attrs.Rd = c("set_attrs", "mut_attrs"), set_expr.Rd = c("set_expr", #> "get_expr"), set_names.Rd = "set_names", splice.Rd = c("splice", #> "is_spliced", "is_spliced_bare", "dots_splice"), stack.Rd = c("stack", #> "global_frame", "current_frame", "ctxt_frame", "call_frame", #> "ctxt_depth", "call_depth", "ctxt_stack", "call_stack" #> ), stack_trim.Rd = "stack_trim", string.Rd = "string", #> switch_type.Rd = c("switch_type", "coerce_type", "switch_class", #> "coerce_class"), sym.Rd = c("sym", "syms"), `tidyeval-data.Rd` = c("tidyeval-data", #> ".data", ".env"), trace_back.Rd = c("trace_back", "trace_length" #> ), `type-predicates.Rd` = c("type-predicates", "is_list", #> "is_atomic", "is_vector", "is_integer", "is_double", #> "is_character", "is_logical", "is_raw", "is_bytes", "is_null" #> ), type_of.Rd = "type_of", vec_poke_n.Rd = c("vec_poke_n", #> "vec_poke_range"), `vector-coercion.Rd` = c("vector-coercion", #> "as_logical", "as_integer", "as_double", "as_complex", #> "as_character", "as_list"), `vector-construction.Rd` = c("vector-construction", #> "lgl", "int", "dbl", "cpl", "chr", "bytes"), `vector-old-ctors.Rd` = c("node", #> "vector-old-ctors", "lgl_len", "int_len", "dbl_len", #> "chr_len", "cpl_len", "raw_len", "bytes_len", "list_len", #> "lgl_along", "int_along", "dbl_along", "chr_along", "cpl_along", #> "raw_along", "bytes_along", "list_along"), with_abort.Rd = "with_abort", #> with_env.Rd = c("with_env", "locally"), with_handlers.Rd = c("with_handlers", #> "calling"), with_restarts.Rd = "with_restarts", wref_key.Rd = c("wref_key", #> "wref_value"), zap.Rd = c("zap", "is_zap"), zap_srcref.Rd = "zap_srcref"), #> funs = list(abort.Rd = c("abort()", "warn()", "inform()", #> "signal()", "interrupt()"), are_na.Rd = c("are_na()", #> "is_na()", "is_lgl_na()", "is_int_na()", "is_dbl_na()", #> "is_chr_na()", "is_cpl_na()"), arg_match.Rd = c("arg_match()", #> "arg_match0()"), as_box.Rd = c("as_box()", "as_box_if()" #> ), as_bytes.Rd = "as_bytes()", as_data_mask.Rd = c("as_data_mask()", #> "as_data_pronoun()", "new_data_mask()"), as_env.Rd = "as_env()", #> as_environment.Rd = "as_environment()", as_function.Rd = c("as_function()", #> "is_lambda()", "as_closure()"), as_label.Rd = "as_label()", #> as_name.Rd = "as_name()", as_overscope.Rd = c("as_overscope()", #> "new_overscope()", "overscope_clean()"), as_pairlist.Rd = "as_pairlist()", #> as_quosure.Rd = c("as_quosure()", "new_quosure()" #> ), as_string.Rd = "as_string()", as_utf8_character.Rd = "as_utf8_character()", #> `bare-type-predicates.Rd` = c("is_bare_list()", "is_bare_atomic()", #> "is_bare_vector()", "is_bare_double()", "is_bare_integer()", #> "is_bare_numeric()", "is_bare_character()", "is_bare_logical()", #> "is_bare_raw()", "is_bare_string()", "is_bare_bytes()" #> ), box.Rd = c("new_box()", "is_box()", "unbox()"), #> call2.Rd = "call2()", call_args.Rd = c("call_args()", #> "call_args_names()"), call_fn.Rd = "call_fn()", call_inspect.Rd = "call_inspect()", #> call_modify.Rd = "call_modify()", call_name.Rd = c("call_name()", #> "call_ns()"), call_parse_type.Rd = "call_parse_type()", #> call_standardise.Rd = "call_standardise()", caller_env.Rd = c("caller_env()", #> "current_env()"), caller_fn.Rd = c("caller_fn()", #> "current_fn()"), caller_frame.Rd = "caller_frame()", #> catch_cnd.Rd = "catch_cnd()", chr_unserialise_unicode.Rd = "chr_unserialise_unicode()", #> cnd.Rd = c("error_cnd()", "cnd()", "warning_cnd()", #> "message_cnd()"), cnd_message.Rd = c("cnd_message()", #> "cnd_header()", "cnd_body()", "cnd_footer()"), cnd_muffle.Rd = "cnd_muffle()", #> cnd_signal.Rd = "cnd_signal()", cnd_type.Rd = "cnd_type()", #> done.Rd = c("done()", "is_done_box()"), dots_definitions.Rd = "dots_definitions()", #> dots_n.Rd = "dots_n()", dots_values.Rd = "dots_values()", #> duplicate.Rd = "duplicate()", `dyn-dots.Rd` = character(0), #> empty_env.Rd = "empty_env()", enquo0.Rd = c("enquo0()", #> "enquos0()"), entrace.Rd = c("entrace()", "cnd_entrace()" #> ), env.Rd = c("env()", "child_env()", "new_environment()" #> ), env_bind.Rd = c("env_bind()", "env_bind_lazy()", #> "env_bind_active()", "`%<~%`"), env_bind_exprs.Rd = c("env_bind_exprs()", #> "env_bind_fns()"), env_binding_are_active.Rd = c("env_binding_are_active()", #> "env_binding_are_lazy()"), env_binding_lock.Rd = c("env_binding_lock()", #> "env_binding_unlock()", "env_binding_are_locked()" #> ), env_browse.Rd = c("env_browse()", "env_is_browsed()" #> ), env_bury.Rd = "env_bury()", env_clone.Rd = "env_clone()", #> env_depth.Rd = "env_depth()", env_get.Rd = c("env_get()", #> "env_get_list()"), env_has.Rd = "env_has()", env_inherits.Rd = "env_inherits()", #> env_lock.Rd = c("env_lock()", "env_is_locked()"), #> env_name.Rd = c("env_name()", "env_label()"), env_names.Rd = c("env_names()", #> "env_length()"), env_parent.Rd = c("env_parent()", #> "env_tail()", "env_parents()"), env_poke.Rd = "env_poke()", #> env_print.Rd = "env_print()", env_unbind.Rd = "env_unbind()", #> env_unlock.Rd = "env_unlock()", eval_bare.Rd = "eval_bare()", #> eval_tidy.Rd = "eval_tidy()", exec.Rd = "exec()", #> exiting.Rd = "exiting()", expr_interp.Rd = "expr_interp()", #> expr_label.Rd = c("expr_label()", "expr_name()", #> "expr_text()"), expr_print.Rd = c("expr_print()", #> "expr_deparse()"), exprs_auto_name.Rd = c("exprs_auto_name()", #> "quos_auto_name()"), f_rhs.Rd = c("f_rhs()", "`f_rhs<-`()", #> "f_lhs()", "`f_lhs<-`()", "f_env()", "`f_env<-`()" #> ), f_text.Rd = c("f_text()", "f_name()", "f_label()" #> ), `faq-options.Rd` = character(0), flatten.Rd = c("flatten()", #> "flatten_lgl()", "flatten_int()", "flatten_dbl()", #> "flatten_cpl()", "flatten_chr()", "flatten_raw()", #> "squash()", "squash_lgl()", "squash_int()", "squash_dbl()", #> "squash_cpl()", "squash_chr()", "squash_raw()", "flatten_if()", #> "squash_if()"), fn_body.Rd = c("fn_body()", "`fn_body<-`()" #> ), fn_env.Rd = c("fn_env()", "`fn_env<-`()"), #> fn_fmls.Rd = c("fn_fmls()", "fn_fmls_names()", "fn_fmls_syms()", #> "`fn_fmls<-`()", "`fn_fmls_names<-`()"), format_error_bullets.Rd = "format_error_bullets()", #> frame_position.Rd = "frame_position()", friendly_type.Rd = "friendly_type()", #> get_env.Rd = c("get_env()", "set_env()", "env_poke_parent()" #> ), has_length.Rd = "has_length()", has_name.Rd = "has_name()", #> hash.Rd = "hash()", inherits_any.Rd = c("inherits_any()", #> "inherits_all()", "inherits_only()"), inject.Rd = "inject()", #> invoke.Rd = "invoke()", is_call.Rd = "is_call()", #> is_callable.Rd = "is_callable()", is_condition.Rd = "is_condition()", #> is_copyable.Rd = "is_copyable()", is_empty.Rd = "is_empty()", #> is_env.Rd = c("is_env()", "is_bare_env()"), is_environment.Rd = c("is_environment()", #> "is_bare_environment()"), is_expr.Rd = "is_expr()", #> is_expression.Rd = c("is_expression()", "is_syntactic_literal()", #> "is_symbolic()"), is_formula.Rd = c("is_formula()", #> "is_bare_formula()"), is_frame.Rd = "is_frame()", #> is_function.Rd = c("is_function()", "is_closure()", #> "is_primitive()", "is_primitive_eager()", "is_primitive_lazy()" #> ), is_installed.Rd = c("is_installed()", "check_installed()" #> ), is_integerish.Rd = c("is_integerish()", "is_bare_integerish()", #> "is_scalar_integerish()"), is_interactive.Rd = c("is_interactive()", #> "local_interactive()", "with_interactive()"), is_lang.Rd = c("is_lang()", #> "is_unary_lang()", "is_binary_lang()", "quo_is_lang()" #> ), is_named.Rd = c("is_named()", "is_dictionaryish()", #> "have_name()"), is_namespace.Rd = "is_namespace()", #> is_pairlist.Rd = c("is_pairlist()", "is_node()", #> "is_node_list()"), is_reference.Rd = "is_reference()", #> is_stack.Rd = c("is_stack()", "is_eval_stack()", #> "is_call_stack()"), is_symbol.Rd = "is_symbol()", #> is_true.Rd = c("is_true()", "is_false()"), is_weakref.Rd = "is_weakref()", #> lang.Rd = c("lang()", "new_language()"), lang_head.Rd = c("lang_head()", #> "lang_tail()"), lang_modify.Rd = c("lang_modify()", #> "lang_standardise()", "lang_fn()", "lang_name()", #> "lang_args()", "lang_args_names()"), last_error.Rd = c("last_error()", #> "last_trace()"), lifecycle.Rd = character(0), list2.Rd = c("list2()", #> "dots_list()"), local_bindings.Rd = c("local_bindings()", #> "with_bindings()"), local_options.Rd = c("local_options()", #> "with_options()", "push_options()", "peek_options()", #> "peek_option()"), missing.Rd = c("na_lgl", "na_int", #> "na_dbl", "na_chr", "na_cpl"), missing_arg.Rd = c("missing_arg()", #> "is_missing()", "maybe_missing()"), mut_node_car.Rd = c("mut_node_car()", #> "mut_node_cdr()", "mut_node_caar()", "mut_node_cadr()", #> "mut_node_cdar()", "mut_node_cddr()", "mut_node_tag()" #> ), names2.Rd = "names2()", `new-vector-along-retired.Rd` = c("new_logical_along()", #> "new_integer_along()", "new_double_along()", "new_character_along()", #> "new_complex_along()", "new_raw_along()", "new_list_along()" #> ), `new-vector.Rd` = c("new_logical()", "new_integer()", #> "new_double()", "new_character()", "new_complex()", #> "new_raw()", "new_list()"), new_call.Rd = "new_call()", #> new_formula.Rd = "new_formula()", new_function.Rd = "new_function()", #> new_node.Rd = c("new_node()", "node_car()", "node_cdr()", #> "node_caar()", "node_cadr()", "node_cdar()", "node_cddr()", #> "node_poke_car()", "node_poke_cdr()", "node_poke_caar()", #> "node_poke_cadr()", "node_poke_cdar()", "node_poke_cddr()", #> "node_tag()", "node_poke_tag()"), new_quosures.Rd = c("new_quosures()", #> "as_quosures()", "is_quosures()"), new_weakref.Rd = "new_weakref()", #> ns_env.Rd = c("ns_env()", "ns_imports_env()", "ns_env_name()" #> ), `nse-defuse.Rd` = c("expr()", "enexpr()", "exprs()", #> "enexprs()", "ensym()", "ensyms()", "quo()", "enquo()", #> "quos()", "enquos()"), `nse-force.Rd` = "qq_show()", #> `op-definition.Rd` = c("is_definition()", "new_definition()", #> "is_formulaish()"), `op-get-attr.Rd` = c("`%@%`", #> "`%@%<-`()"), `op-na-default.Rd` = "`%|%`", `op-null-default.Rd` = "`%||%`", #> overscope_eval_next.Rd = "overscope_eval_next()", #> pairlist2.Rd = "pairlist2()", parse_expr.Rd = c("parse_expr()", #> "parse_exprs()", "parse_quo()", "parse_quos()"), #> parse_quosure.Rd = c("parse_quosure()", "parse_quosures()" #> ), prepend.Rd = c("prepend()", "modify()"), prim_name.Rd = "prim_name()", #> quo_expr.Rd = "quo_expr()", quo_label.Rd = c("quo_label()", #> "quo_text()", "quo_name()"), quo_squash.Rd = "quo_squash()", #> quosure.Rd = c("is_quosure()", "quo_is_missing()", #> "quo_is_symbol()", "quo_is_call()", "quo_is_symbolic()", #> "quo_is_null()", "quo_get_expr()", "quo_get_env()", #> "quo_set_expr()", "quo_set_env()"), raw_deparse_str.Rd = "raw_deparse_str()", #> rep_along.Rd = c("rep_along()", "rep_named()"), restarting.Rd = "restarting()", #> return_from.Rd = c("return_from()", "return_to()" #> ), rlang_backtrace_on_error.Rd = character(0), rst_abort.Rd = "rst_abort()", #> rst_list.Rd = c("rst_list()", "rst_exists()", "rst_jump()", #> "rst_maybe_jump()"), `scalar-type-predicates.Rd` = c("is_scalar_list()", #> "is_scalar_atomic()", "is_scalar_vector()", "is_scalar_integer()", #> "is_scalar_double()", "is_scalar_character()", "is_scalar_logical()", #> "is_scalar_raw()", "is_string()", "is_scalar_bytes()", #> "is_bool()"), scoped_env.Rd = c("scoped_env()", "is_scoped()", #> "scoped_envs()", "scoped_names()"), scoped_interactive.Rd = c("scoped_interactive()", #> "scoped_options()", "scoped_bindings()"), search_envs.Rd = c("search_envs()", #> "search_env()", "pkg_env()", "pkg_env_name()", "is_attached()", #> "base_env()", "global_env()"), seq2.Rd = c("seq2()", #> "seq2_along()"), set_attrs.Rd = c("set_attrs()", #> "mut_attrs()"), set_expr.Rd = c("set_expr()", "get_expr()" #> ), set_names.Rd = "set_names()", splice.Rd = c("splice()", #> "is_spliced()", "is_spliced_bare()", "dots_splice()" #> ), stack.Rd = c("global_frame()", "current_frame()", #> "ctxt_frame()", "call_frame()", "ctxt_depth()", "call_depth()", #> "ctxt_stack()", "call_stack()"), stack_trim.Rd = "stack_trim()", #> string.Rd = "string()", switch_type.Rd = c("switch_type()", #> "coerce_type()", "switch_class()", "coerce_class()" #> ), sym.Rd = c("sym()", "syms()"), `tidyeval-data.Rd` = c(".data", #> ".env"), trace_back.Rd = c("trace_back()", "trace_length()" #> ), `type-predicates.Rd` = c("is_list()", "is_atomic()", #> "is_vector()", "is_integer()", "is_double()", "is_character()", #> "is_logical()", "is_raw()", "is_bytes()", "is_null()" #> ), type_of.Rd = "type_of()", vec_poke_n.Rd = c("vec_poke_n()", #> "vec_poke_range()"), `vector-coercion.Rd` = c("as_logical()", #> "as_integer()", "as_double()", "as_complex()", "as_character()", #> "as_list()"), `vector-construction.Rd` = c("lgl()", #> "int()", "dbl()", "cpl()", "chr()", "bytes()"), `vector-old-ctors.Rd` = c("node()", #> "lgl_len()", "int_len()", "dbl_len()", "chr_len()", #> "cpl_len()", "raw_len()", "bytes_len()", "list_len()", #> "lgl_along()", "int_along()", "dbl_along()", "chr_along()", #> "cpl_along()", "raw_along()", "bytes_along()", "list_along()" #> ), with_abort.Rd = "with_abort()", with_env.Rd = c("with_env()", #> "locally()"), with_handlers.Rd = c("with_handlers()", #> "calling()"), with_restarts.Rd = "with_restarts()", #> wref_key.Rd = c("wref_key()", "wref_value()"), zap.Rd = c("zap()", #> "is_zap()"), zap_srcref.Rd = "zap_srcref()"), title = c(abort.Rd = "Signal an error, warning, or message", #> are_na.Rd = "Test for missing values", arg_match.Rd = "Match an argument to a character vector", #> as_box.Rd = "Convert object to a box", as_bytes.Rd = "Coerce to a raw vector", #> as_data_mask.Rd = "Create a data mask", as_env.Rd = "Coerce to an environment", #> as_environment.Rd = "Coerce to an environment", as_function.Rd = "Convert to function or closure", #> as_label.Rd = "Create a default name for an R object", #> as_name.Rd = "Extract names from symbols", as_overscope.Rd = "Create an overscope", #> as_pairlist.Rd = "Coerce to pairlist", as_quosure.Rd = "Coerce object to quosure", #> as_string.Rd = "Cast symbol to string", as_utf8_character.Rd = "Coerce to a character vector and attempt encoding conversion", #> `bare-type-predicates.Rd` = "Bare type predicates", box.Rd = "Box a value", #> call2.Rd = "Create a call", call_args.Rd = "Extract arguments from a call", #> call_fn.Rd = "Extract function from a call", call_inspect.Rd = "Inspect a call", #> call_modify.Rd = "Modify the arguments of a call", call_name.Rd = "Extract function name or namespace of a call", #> call_parse_type.Rd = "What is the parser type of a call?", #> call_standardise.Rd = "Standardise a call", caller_env.Rd = "Get the current or caller environment", #> caller_fn.Rd = "Get properties of the current or caller frame", #> caller_frame.Rd = "Get caller frame", catch_cnd.Rd = "Catch a condition", #> chr_unserialise_unicode.Rd = "Translate unicode points to UTF-8", #> cnd.Rd = "Create a condition object", cnd_message.Rd = "Build an error message from parts", #> cnd_muffle.Rd = "Muffle a condition", cnd_signal.Rd = "Signal a condition object", #> cnd_type.Rd = "What type is a condition?", done.Rd = "Box a final value for early termination", #> dots_definitions.Rd = "Capture definition objects", dots_n.Rd = "How many arguments are currently forwarded in dots?", #> dots_values.Rd = "Evaluate dots with preliminary splicing", #> duplicate.Rd = "Duplicate an R object", `dyn-dots.Rd` = "Dynamic dots", #> empty_env.Rd = "Get the empty environment", enquo0.Rd = "Defuse arguments without automatic injection", #> entrace.Rd = "Add backtrace from error handler", env.Rd = "Create a new environment", #> env_bind.Rd = "Bind symbols to objects in an environment", #> env_bind_exprs.Rd = "Bind a promise or active binding", #> env_binding_are_active.Rd = "What kind of environment binding?", #> env_binding_lock.Rd = "Lock or unlock environment bindings", #> env_browse.Rd = "Browse environments", env_bury.Rd = "Mask bindings by defining symbols deeper in a scope", #> env_clone.Rd = "Clone an environment", env_depth.Rd = "Depth of an environment chain", #> env_get.Rd = "Get an object in an environment", env_has.Rd = "Does an environment have or see bindings?", #> env_inherits.Rd = "Does environment inherit from another environment?", #> env_lock.Rd = "Lock an environment", env_name.Rd = "Label of an environment", #> env_names.Rd = "Names and numbers of symbols bound in an environment", #> env_parent.Rd = "Get parent environments", env_poke.Rd = "Poke an object in an environment", #> env_print.Rd = "Pretty-print an environment", env_unbind.Rd = "Remove bindings from an environment", #> env_unlock.Rd = "Unlock an environment", eval_bare.Rd = "Evaluate an expression in an environment", #> eval_tidy.Rd = "Evaluate an expression with quosures and pronoun support", #> exec.Rd = "Execute a function", exiting.Rd = "Exiting handler", #> expr_interp.Rd = "Process unquote operators in a captured expression", #> expr_label.Rd = "Turn an expression to a label", expr_print.Rd = "Print an expression", #> exprs_auto_name.Rd = "Ensure that all elements of a list of expressions are named", #> f_rhs.Rd = "Get or set formula components", f_text.Rd = "Turn RHS of formula into a string or label", #> `faq-options.Rd` = "Global options for rlang", flatten.Rd = "Flatten or squash a list of lists into a simpler vector", #> fn_body.Rd = "Get or set function body", fn_env.Rd = "Return the closure environment of a function", #> fn_fmls.Rd = "Extract arguments from a function", format_error_bullets.Rd = "Format bullets for error messages", #> frame_position.Rd = "Find the position or distance of a frame on the evaluation stack", #> friendly_type.Rd = "Format a type for error messages", #> get_env.Rd = "Get or set the environment of an object", #> has_length.Rd = "How long is an object?", has_name.Rd = "Does an object have an element with this name?", #> hash.Rd = "Hash an object", inherits_any.Rd = "Does an object inherit from a set of classes?", #> inject.Rd = "Inject objects in an R expression", invoke.Rd = "Invoke a function with a list of arguments", #> is_call.Rd = "Is object a call?", is_callable.Rd = "Is an object callable?", #> is_condition.Rd = "Is object a condition?", is_copyable.Rd = "Is an object copyable?", #> is_empty.Rd = "Is object an empty vector or NULL?", is_env.Rd = "Is an object an environment?", #> is_environment.Rd = "Is object an environment?", is_expr.Rd = "Is an object an expression?", #> is_expression.Rd = "Is an object an expression?", is_formula.Rd = "Is object a formula?", #> is_frame.Rd = "Is object a frame?", is_function.Rd = "Is object a function?", #> is_installed.Rd = "Are packages installed in any of the libraries?", #> is_integerish.Rd = "Is a vector integer-like?", is_interactive.Rd = "Is R running interactively?", #> is_lang.Rd = "Is object a call?", is_named.Rd = "Is object named?", #> is_namespace.Rd = "Is an object a namespace environment?", #> is_pairlist.Rd = "Is object a node or pairlist?", is_reference.Rd = "Is an object referencing another?", #> is_stack.Rd = "Is object a stack?", is_symbol.Rd = "Is object a symbol?", #> is_true.Rd = "Is object identical to TRUE or FALSE?", #> is_weakref.Rd = "Is object a weak reference?", lang.Rd = "Create a call", #> lang_head.Rd = "Return the head or tail of a call", lang_modify.Rd = "Manipulate or access a call", #> last_error.Rd = "Last <code>abort()</code> error", lifecycle.Rd = "Life cycle of the rlang package", #> list2.Rd = "Collect dots in a list", local_bindings.Rd = "Temporarily change bindings of an environment", #> local_options.Rd = "Change global options", missing.Rd = "Missing values", #> missing_arg.Rd = "Generate or handle a missing argument", #> mut_node_car.Rd = "Mutate node components", names2.Rd = "Get names of a vector", #> `new-vector-along-retired.Rd` = "Create vectors matching the length of a given vector", #> `new-vector.Rd` = "Create vectors matching a given length", #> new_call.Rd = "Create a new call from components", new_formula.Rd = "Create a formula", #> new_function.Rd = "Create a function", new_node.Rd = "Helpers for pairlist and language nodes", #> new_quosures.Rd = "Create a list of quosures", new_weakref.Rd = "Create a weak reference", #> ns_env.Rd = "Get the namespace of a package", `nse-defuse.Rd` = "Defuse R expressions", #> `nse-force.Rd` = "Force parts of an expression", `op-definition.Rd` = "Definition operator", #> `op-get-attr.Rd` = "Infix attribute accessor and setter", #> `op-na-default.Rd` = "Replace missing values", `op-null-default.Rd` = "Default value for <code>NULL</code>", #> overscope_eval_next.Rd = "Evaluate next quosure in a data mask", #> pairlist2.Rd = "Create pairlists with splicing support", #> parse_expr.Rd = "Parse R code", parse_quosure.Rd = "Parse text into a quosure", #> prepend.Rd = "Prepend a vector", prim_name.Rd = "Name of a primitive function", #> quo_expr.Rd = "Squash a quosure", quo_label.Rd = "Format quosures for printing or labelling", #> quo_squash.Rd = "Squash a quosure", quosure.Rd = "Quosure getters, setters and testers", #> raw_deparse_str.Rd = "Serialize a raw vector to a string", #> rep_along.Rd = "Create vectors matching the length of a given vector", #> restarting.Rd = "Create a restarting handler", return_from.Rd = "Jump to or from a frame", #> rlang_backtrace_on_error.Rd = "Display backtrace on error", #> rst_abort.Rd = "Jump to the abort restart", rst_list.Rd = "Restarts utilities", #> `scalar-type-predicates.Rd` = "Scalar type predicates", #> scoped_env.Rd = "Retired <code>scoped</code> functions", #> scoped_interactive.Rd = "Questioning <code>scoped_</code> functions", #> search_envs.Rd = "Search path environments", seq2.Rd = "Increasing sequence of integers in an interval", #> set_attrs.Rd = "Add attributes to an object", set_expr.Rd = "Set and get an expression", #> set_names.Rd = "Set names of a vector", splice.Rd = "Splice lists", #> stack.Rd = "Call stack information", stack_trim.Rd = "Trim top call layers from the evaluation stack", #> string.Rd = "Create a string", switch_type.Rd = "Dispatch on base types", #> sym.Rd = "Create a symbol or list of symbols", `tidyeval-data.Rd` = "Data pronouns for tidy evaluation", #> trace_back.Rd = "Capture a backtrace", `type-predicates.Rd` = "Type predicates", #> type_of.Rd = "Base type of an object", vec_poke_n.Rd = "Poke values into a vector", #> `vector-coercion.Rd` = "Coerce an object to a base type", #> `vector-construction.Rd` = "Create vectors", `vector-old-ctors.Rd` = "Retired vector construction by length", #> with_abort.Rd = "Promote all errors to rlang errors", #> with_env.Rd = "Evaluate an expression within a given environment", #> with_handlers.Rd = "Establish handlers on the stack", #> with_restarts.Rd = "Establish a restart point on the stack", #> wref_key.Rd = "Get key/value from a weak reference object", #> zap.Rd = "Create zap objects", zap_srcref.Rd = "Zap source references" #> ), rd = list(abort.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-abort.R, R/cnd-signal.R", #> "\n", list("abort"), "\n", list("abort"), "\n", list( #> "warn"), "\n", list("inform"), "\n", list("signal"), #> "\n", list("interrupt"), "\n", list("Signal an error, warning, or message"), #> "\n", list("\n", "abort(\n", " message = NULL,\n", #> " class = NULL,\n", " ...,\n", " trace = NULL,\n", #> " parent = NULL,\n", " .subclass = deprecated()\n", #> ")\n", "\n", "warn(\n", " message = NULL,\n", #> " class = NULL,\n", " ...,\n", " .frequency = c(\"always\", \"regularly\", \"once\"),\n", #> " .frequency_id = NULL,\n", " .subclass = deprecated()\n", #> ")\n", "\n", "inform(\n", " message = NULL,\n", #> " class = NULL,\n", " ...,\n", " .file = NULL,\n", #> " .frequency = c(\"always\", \"regularly\", \"once\"),\n", #> " .frequency_id = NULL,\n", " .subclass = deprecated()\n", #> ")\n", "\n", "signal(message, class, ..., .subclass = deprecated())\n", #> "\n", "interrupt()\n"), "\n", list("\n", list( #> list("message"), list("The message to display. Character vectors are\n", #> "formatted with ", list(list("format_error_bullets()")), #> ". The first element\n", "defines a message header and the rest of the vector defines\n", #> "bullets. Bullets named ", list("i"), " and ", #> list("x"), " define info and error bullets\n", #> "respectively, with special Unicode and colour formatting applied\n", #> "if possible.\n", "\n", "If a message is not supplied, it is expected that the message is\n", #> "generated lazily through ", list("conditionMessage()"), #> ". In\n", "that case, ", list("class"), " must be supplied. Only ", #> list("inform()"), " allows empty\n", "messages as it is occasionally useful to build user output\n", #> "incrementally.")), "\n", "\n", list(list("class"), #> list("Subclass of the condition. This allows your users\n", #> "to selectively handle the conditions signalled by your functions.")), #> "\n", "\n", list(list("..."), list("Additional data to be stored in the condition object.")), #> "\n", "\n", list(list("trace"), list("A ", list( #> "trace"), " object created by ", list(list( #> "trace_back()")), ".")), "\n", "\n", list(list( #> "parent"), list("A parent condition object created by ", #> list(list("abort()")), ".")), "\n", "\n", list( #> list(".subclass"), list("This argument was renamed to ", #> list("class"), " in rlang\n", "0.4.2. It will be deprecated in the next major version. This is\n", #> "for consistency with our conventions for class constructors\n", #> "documented in ", list("https://adv-r.hadley.nz/s3.html#s3-subclassing"), #> ".")), "\n", "\n", list(list(".frequency"), #> list("How frequently should the warning or message be\n", #> "displayed? By default (", list("\"always\""), #> ") it is displayed at each\n", "time. If ", #> list("\"regularly\""), ", it is displayed once every 8 hours. If\n", #> list("\"once\""), ", it is displayed once per session.")), #> "\n", "\n", list(list(".frequency_id"), list( #> "A unique identifier for the warning or\n", #> "message. This is used when ", list(".frequency"), #> " is supplied to recognise\n", "recurring conditions. This argument must be supplied if\n", #> list(".frequency"), " is not set to ", list( #> "\"always\""), ".")), "\n", "\n", list(list( #> ".file"), list("Where the message is printed. This should be a\n", #> "connection or character string which will be passed to ", #> list(list("cat()")), ".\n", "\n", "By default, ", #> list("inform()"), " prints to standard output in interactive\n", #> "sessions and standard error otherwise. This way IDEs can treat\n", #> "messages distinctly from warnings and errors, and R scripts can\n", #> "still filter out the messages easily by redirecting ", #> list("stderr"), ". If\n", "a sink is active, either on output or on messages, messages are\n", #> "printed to ", list("stderr"), ". This ensures consistency of behaviour in\n", #> "interactive and non-interactive sessions.")), #> "\n"), "\n", list("\n", "These functions are equivalent to base functions ", #> list(list("base::stop()")), ",\n", list(list( #> "base::warning()")), ", and ", list(list("base::message()")), #> ", but make it easy to supply\n", "condition metadata:\n", #> list("\n", list(), " Supply ", list("class"), #> " to create a classed condition. Typed\n", #> "conditions can be captured or handled selectively, allowing for\n", #> "finer-grained error handling.\n", list(), #> " Supply metadata with named ", list("..."), #> " arguments. This data will be\n", "stored in the condition object and can be examined by handlers.\n"), #> "\n", "\n", list("interrupt()"), " allows R code to simulate a user interrupt of the\n", #> "kind that is signalled with ", list("Ctrl-C"), #> ". It is currently not possible\n", "to create custom interrupt condition objects.\n"), #> "\n", list(list("Backtrace"), list("\n", "\n", "\n", #> "Unlike ", list("stop()"), " and ", list("warning()"), #> ", these functions don't include call\n", "information by default. This saves you from typing ", #> list("call. = FALSE"), "\n", "and produces cleaner error messages.\n", #> "\n", "A backtrace is always saved into error objects. You can print a\n", #> "simplified backtrace of the last error by calling ", #> list(list("last_error()")), "\n", "and a full backtrace with ", #> list("summary(last_error())"), ".\n", "\n", "You can also display a backtrace with the error message by setting\n", #> "the option ", list(list("rlang_backtrace_on_error")), #> ". It supports the following\n", "values:\n", #> list("\n", list(), " ", list("\"reminder\""), #> ": Invite users to call ", list("rlang::last_error()"), #> " to see a\n", "backtrace.\n", list(), " ", #> list("\"branch\""), ": Display a simplified backtrace.\n", #> list(), " ", list("\"collapse\""), ": Display a collapsed backtrace tree.\n", #> list(), " ", list("\"full\""), ": Display a full backtrace tree.\n", #> list(), " ", list("\"none\""), ": Display nothing.\n"), #> "\n")), "\n", "\n", list(list("Mufflable conditions"), #> list("\n", "\n", "\n", "Signalling a condition with ", #> list("inform()"), " or ", list("warn()"), " causes a message\n", #> "to be displayed in the console. These messages can be muffled with\n", #> list(list("base::suppressMessages()")), " or ", #> list(list("base::suppressWarnings()")), ".\n", #> "\n", "On recent R versions (>= R 3.5.0), interrupts are typically\n", #> "signalled with a ", list("\"resume\""), " restart. This is however not\n", #> "guaranteed.\n")), "\n", "\n", list("\n", "# These examples are guarded to avoid throwing errors\n", #> "if (FALSE) {\n", "\n", "# Signal an error with a message just like stop():\n", #> "abort(\"Something bad happened\")\n", "\n", #> "# Give a class to the error:\n", "abort(\"Something bad happened\", \"somepkg_bad_error\")\n", #> "\n", "# This will allow your users to handle the error selectively\n", #> "tryCatch(\n", " somepkg_function(),\n", " somepkg_bad_error = function(err) {\n", #> " warn(conditionMessage(err)) # Demote the error to a warning\n", #> " NA # Return an alternative value\n", #> " }\n", ")\n", "\n", "# You can also specify metadata that will be stored in the condition:\n", #> "abort(\"Something bad happened\", \"somepkg_bad_error\", data = 1:10)\n", #> "\n", "# This data can then be consulted by user handlers:\n", #> "tryCatch(\n", " somepkg_function(),\n", " somepkg_bad_error = function(err) {\n", #> " # Compute an alternative return value with the data:\n", #> " recover_error(err$data)\n", " }\n", ")\n", #> "\n", "# If you call low-level APIs it is good practice to handle\n", #> "# technical errors and rethrow them with a more meaningful\n", #> "# message. Always prefer doing this from `withCallinghandlers()`\n", #> "# rather than `tryCatch()` because the former preserves the stack\n", #> "# on error and makes it possible for users to use `recover()`.\n", #> "file <- \"http://foo.bar/baz\"\n", "try(withCallinghandlers(\n", #> " download(file),\n", " error = function(err) {\n", #> " msg <- sprintf(\"Can't download `%s`\", file)\n", #> " abort(msg, parent = err)\n", "}))\n", "# Note how we supplied the parent error to `abort()` as `parent` to\n", #> "# get a decomposition of error messages across error contexts.\n", #> "\n", "# Unhandled errors are saved automatically by `abort()` and can be\n", #> "# retrieved with `last_error()`. The error prints with a simplified\n", #> "# backtrace:\n", "abort(\"Saved error?\")\n", #> "last_error()\n", "\n", "# Use `summary()` to print the full backtrace and the condition fields:\n", #> "summary(last_error())\n", "\n", "}\n"), "\n", #> list("\n", list(list("with_abort()")), " to convert all errors to rlang errors.\n"), #> "\n"), are_na.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-na.R", #> "\n", list("are_na"), "\n", list("are_na"), "\n", #> list("is_na"), "\n", list("is_lgl_na"), "\n", list( #> "is_int_na"), "\n", list("is_dbl_na"), "\n", #> list("is_chr_na"), "\n", list("is_cpl_na"), "\n", #> list("Test for missing values"), "\n", list("\n", #> "are_na(x)\n", "\n", "is_na(x)\n", "\n", "is_lgl_na(x)\n", #> "\n", "is_int_na(x)\n", "\n", "is_dbl_na(x)\n", #> "\n", "is_chr_na(x)\n", "\n", "is_cpl_na(x)\n"), #> "\n", list("\n", list(list("x"), list("An object to test")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", list("are_na()"), " checks for missing values in a vector and is equivalent\n", #> "to ", list(list("base::is.na()")), ". It is a vectorised predicate, meaning that its\n", #> "output is always the same length as its input. On the other hand,\n", #> list("is_na()"), " is a scalar predicate and always returns a scalar\n", #> "boolean, ", list("TRUE"), " or ", list("FALSE"), #> ". If its input is not scalar, it returns\n", #> list("FALSE"), ". Finally, there are typed versions that check for\n", #> "particular ", list("missing types"), ".\n"), #> "\n", list("\n", "The scalar predicates accept non-vector inputs. They are equivalent\n", #> "to ", list(list("is_null()")), " in that respect. In contrast the vectorised\n", #> "predicate ", list("are_na()"), " requires a vector input since it is defined\n", #> "over vector values.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "These functions might be moved to the vctrs package at some\n", #> "point. This is why they are marked as questioning.\n")), #> "\n", "\n", list("\n", "# are_na() is vectorised and works regardless of the type\n", #> "are_na(c(1, 2, NA))\n", "are_na(c(1L, NA, 3L))\n", #> "\n", "# is_na() checks for scalar input and works for all types\n", #> "is_na(NA)\n", "is_na(na_dbl)\n", "is_na(character(0))\n", #> "\n", "# There are typed versions as well:\n", #> "is_lgl_na(NA)\n", "is_lgl_na(na_dbl)\n"), "\n", #> list("internal"), "\n"), arg_match.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/arg.R", "\n", #> list("arg_match"), "\n", list("arg_match"), "\n", #> list("arg_match0"), "\n", list("Match an argument to a character vector"), #> "\n", list("\n", "arg_match(arg, values = NULL)\n", #> "\n", "arg_match0(arg, values, arg_nm = as_label(substitute(arg)))\n"), #> "\n", list("\n", list(list("arg"), list("A symbol referring to an argument accepting strings.")), #> "\n", "\n", list(list("values"), list("The possible values that ", #> list("arg"), " can take.")), "\n", "\n", list( #> list("arg_nm"), list("The label to be used for ", #> list("arg"), " in error messages.")), "\n"), #> "\n", list("\n", "The string supplied to ", list( #> "arg"), ".\n"), "\n", list("\n", "This is equivalent to ", #> list(list("base::match.arg()")), " with a few differences:\n", #> list("\n", list(), " Partial matches trigger an error.\n", #> list(), " Error messages are a bit more informative and obey the tidyverse\n", #> "standards.\n"), "\n", "\n", list("arg_match()"), #> " derives the possible values from the\n", list( #> "caller frame"), ".\n", "\n", list("arg_match0()"), #> " is a bare-bones version if performance is at a premium.\n", #> "It requires a string as ", list("arg"), " and explicit ", #> list("values"), ".\n", "For convenience, ", list( #> "arg"), " may also be a character vector containing\n", #> "every element of ", list("values"), ", possibly permuted.\n", #> "In this case, the first element of ", list("arg"), #> " is used.\n"), "\n", list("\n", "fn <- function(x = c(\"foo\", \"bar\")) arg_match(x)\n", #> "fn(\"bar\")\n", "\n", "# Throws an informative error for mismatches:\n", #> "try(fn(\"b\"))\n", "try(fn(\"baz\"))\n", "\n", #> "# Use the bare-bones version with explicit values for speed:\n", #> "arg_match0(\"bar\", c(\"foo\", \"bar\", \"baz\"))\n", #> "\n", "# For convenience:\n", "fn1 <- function(x = c(\"bar\", \"baz\", \"foo\")) fn3(x)\n", #> "fn2 <- function(x = c(\"baz\", \"bar\", \"foo\")) fn3(x)\n", #> "fn3 <- function(x) arg_match0(x, c(\"foo\", \"bar\", \"baz\"))\n", #> "fn1()\n", "fn2(\"bar\")\n", "try(fn3(\"zoo\"))\n"), #> "\n"), as_box.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/s3.R", "\n", #> list("as_box"), "\n", list("as_box"), "\n", list( #> "as_box_if"), "\n", list("Convert object to a box"), #> "\n", list("\n", "as_box(x, class = NULL)\n", "\n", #> "as_box_if(.x, .p, .class = NULL, ...)\n"), "\n", #> list("\n", list(list("x"), list("An R object.")), #> "\n", "\n", list(list("class, .class"), list( #> "A box class. If the input is already a box of\n", #> "that class, it is returned as is. If the input needs to be boxed,\n", #> list("class"), " is passed to ", list(list( #> "new_box()")), ".")), "\n", "\n", list(list( #> ".x"), list("An R object.")), "\n", "\n", list( #> list(".p"), list("A predicate function.")), #> "\n", "\n", list(list("..."), list("Arguments passed to ", #> list(".p"), ".")), "\n"), "\n", list("\n", #> list("\n", list(), " ", list("as_box()"), " boxes its input only if it is not already a box. The\n", #> "class is also checked if supplied.\n", list(), #> " ", list("as_box_if()"), " boxes its input only if it not already a box, or if\n", #> "the predicate ", list(".p"), " returns ", #> list("TRUE"), ".\n"), "\n"), "\n"), as_bytes.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/utils-encoding.R", #> "\n", list("as_bytes"), "\n", list("as_bytes"), "\n", #> list("Coerce to a raw vector"), "\n", list("\n", #> "as_bytes(x)\n"), "\n", list("\n", list(list( #> "x"), list("A string.")), "\n"), "\n", list("\n", #> "A raw vector of bytes.\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "This currently only works with strings, and returns its hexadecimal\n", #> "representation.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "Raw vector functions are experimental.\n")), #> "\n", "\n", list("internal"), "\n"), as_data_mask.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/eval-tidy.R", "\n", #> list("as_data_mask"), "\n", list("as_data_mask"), #> "\n", list("as_data_pronoun"), "\n", list("new_data_mask"), #> "\n", list("Create a data mask"), "\n", list("\n", #> "as_data_mask(data)\n", "\n", "as_data_pronoun(data)\n", #> "\n", "new_data_mask(bottom, top = bottom)\n"), #> "\n", list("\n", list(list("data"), list("A data frame or named vector of masking data.")), #> "\n", "\n", list(list("bottom"), list("The environment containing masking objects if the\n", #> "data mask is one environment deep. The bottom environment if the\n", #> "data mask comprises multiple environment.\n", #> "\n", "If you haven't supplied ", list("top"), #> ", this ", list("must"), " be an environment\n", #> "that you own, i.e. that you have created yourself.")), #> "\n", "\n", list(list("top"), list("The last environment of the data mask. If the data mask\n", #> "is only one environment deep, ", list("top"), #> " should be the same as\n", list("bottom"), #> ".\n", "\n", "This ", list("must"), " be an environment that you own, i.e. that you have\n", #> "created yourself. The parent of ", list("top"), #> " will be changed by the tidy\n", "eval engine and should be considered undetermined. Never make\n", #> "assumption about the parent of ", list("top"), #> ".")), "\n"), "\n", list("\n", "A data mask that you can supply to ", #> list(list("eval_tidy()")), ".\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", "A data mask is an environment (or possibly multiple environments\n", #> "forming an ancestry) containing user-supplied objects. Objects in\n", #> "the mask have precedence over objects in the environment (i.e. they\n", #> "mask those objects). Many R functions evaluate quoted expressions\n", #> "in a data mask so these expressions can refer to objects within the\n", #> "user data.\n", "\n", "These functions let you construct a tidy eval data mask manually.\n", #> "They are meant for developers of tidy eval interfaces rather than\n", #> "for end users.\n"), "\n", list(list("Why build a data mask?"), #> list("\n", "\n", "\n", "Most of the time you can just call ", #> list(list("eval_tidy()")), " with a list or a\n", #> "data frame and the data mask will be constructed automatically.\n", #> "There are three main use cases for manual creation of data masks:\n", #> list("\n", list(), " When ", list(list("eval_tidy()")), #> " is called with the same data in a tight loop.\n", #> "Because there is some overhead to creating tidy eval data masks,\n", #> "constructing the mask once and reusing it for subsequent\n", #> "evaluations may improve performance.\n", #> list(), " When several expressions should be evaluated in the exact same\n", #> "environment because a quoted expression might create new objects\n", #> "that can be referred in other quoted expressions evaluated at a\n", #> "later time. One example of this is ", list( #> "tibble::lst()"), " where new\n", "columns can refer to previous ones.\n", #> list(), " When your data mask requires special features. For instance the\n", #> "data frame columns in dplyr data masks are implemented with\n", #> list("active bindings"), ".\n"), "\n")), #> "\n", "\n", list(list("Building your own data mask"), #> list("\n", "\n", "\n", "Unlike ", list(list("base::eval()")), #> " which takes any kind of environments as data\n", #> "mask, ", list(list("eval_tidy()")), " has specific requirements in order to support\n", #> list("quosures"), ". For this reason you can't supply bare\n", #> "environments.\n", "\n", "There are two ways of constructing an rlang data mask manually:\n", #> list("\n", list(), " ", list("as_data_mask()"), #> " transforms a list or data frame to a data mask.\n", #> "It automatically installs the data pronoun ", #> list(list(".data")), ".\n", list(), " ", #> list("new_data_mask()"), " is a bare bones data mask constructor for\n", #> "environments. You can supply a bottom and a top environment in\n", #> "case your data mask comprises multiple environments (see section\n", #> "below).\n", "\n", "Unlike ", list("as_data_mask()"), #> " it does not install the ", list(".data"), #> " pronoun\n", "so you need to provide one yourself. You can provide a pronoun\n", #> "constructed with ", list("as_data_pronoun()"), #> " or your own pronoun class.\n", "\n", list( #> "as_data_pronoun()"), " will create a pronoun from a list, an\n", #> "environment, or an rlang data mask. In the latter case, the whole\n", #> "ancestry is looked up from the bottom to the top of the mask.\n", #> "Functions stored in the mask are bypassed by the pronoun.\n"), #> "\n", "\n", "Once you have built a data mask, simply pass it to ", #> list(list("eval_tidy()")), " as\n", "the ", #> list("data"), " argument. You can repeat this as many times as\n", #> "needed. Note that any objects created there (perhaps because of a\n", #> "call to ", list("<-"), ") will persist in subsequent evaluations.\n")), #> "\n", "\n", list(list("Top and bottom of data mask"), #> list("\n", "\n", "\n", "In some cases you'll need several levels in your data mask. One\n", #> "good reason is when you include functions in the mask. It's a good\n", #> "idea to keep data objects one level lower than function objects, so\n", #> "that the former cannot override the definitions of the latter (see\n", #> "examples).\n", "\n", "In that case, set up all your environments and keep track of the\n", #> "bottom child and the top parent. You'll need to pass both to\n", #> list("new_data_mask()"), ".\n", "\n", "Note that the parent of the top environment is completely\n", #> "undetermined, you shouldn't expect it to remain the same at all\n", #> "times. This parent is replaced during evaluation by ", #> list(list("eval_tidy()")), "\n", "to one of the following environments:\n", #> list("\n", list(), " The default environment passed as the ", #> list("env"), " argument of ", list("eval_tidy()"), #> ".\n", list(), " The environment of the current quosure being evaluated, if applicable.\n"), #> "\n", "\n", "Consequently, all masking data should be contained between the\n", #> "bottom and top environment of the data mask.\n")), #> "\n", "\n", list("\n", "# Evaluating in a tidy evaluation environment enables all tidy\n", #> "# features:\n", "mask <- as_data_mask(mtcars)\n", #> "eval_tidy(quo(letters), mask)\n", "\n", "# You can install new pronouns in the mask:\n", #> "mask$.pronoun <- as_data_pronoun(list(foo = \"bar\", baz = \"bam\"))\n", #> "eval_tidy(quo(.pronoun$foo), mask)\n", "\n", #> "# In some cases the data mask can leak to the user, for example if\n", #> "# a function or formula is created in the data mask environment:\n", #> "cyl <- \"user variable from the context\"\n", #> "fn <- eval_tidy(quote(function() cyl), mask)\n", #> "fn()\n", "\n", "# If new objects are created in the mask, they persist in the\n", #> "# subsequent calls:\n", "eval_tidy(quote(new <- cyl + am), mask)\n", #> "eval_tidy(quote(new * 2), mask)\n", "\n", "\n", #> "# In some cases your data mask is a whole chain of environments\n", #> "# rather than a single environment. You'll have to use\n", #> "# `new_data_mask()` and let it know about the bottom of the mask\n", #> "# (the last child of the environment chain) and the topmost parent.\n", #> "\n", "# A common situation where you'll want a multiple-environment mask\n", #> "# is when you include functions in your mask. In that case you'll\n", #> "# put functions in the top environment and data in the bottom. This\n", #> "# will prevent the data from overwriting the functions.\n", #> "top <- new_environment(list(`+` = base::paste, c = base::paste))\n", #> "\n", "# Let's add a middle environment just for sport:\n", #> "middle <- env(top)\n", "\n", "# And finally the bottom environment containing data:\n", #> "bottom <- env(middle, a = \"a\", b = \"b\", c = \"c\")\n", #> "\n", "# We can now create a mask by supplying the top and bottom\n", #> "# environments:\n", "mask <- new_data_mask(bottom, top = top)\n", #> "\n", "# This data mask can be passed to eval_tidy() instead of a list or\n", #> "# data frame:\n", "eval_tidy(quote(a + b + c), data = mask)\n", #> "\n", "# Note how the function `c()` and the object `c` are looked up\n", #> "# properly because of the multi-level structure:\n", #> "eval_tidy(quote(c(a, b, c)), data = mask)\n", #> "\n", "# new_data_mask() does not create data pronouns, but\n", #> "# data pronouns can be added manually:\n", "mask$.fns <- as_data_pronoun(top)\n", #> "\n", "# The `.data` pronoun should generally be created from the\n", #> "# mask. This will ensure data is looked up throughout the whole\n", #> "# ancestry. Only non-function objects are looked up from this\n", #> "# pronoun:\n", "mask$.data <- as_data_pronoun(mask)\n", #> "mask$.data$c\n", "\n", "# Now we can reference the values with the pronouns:\n", #> "eval_tidy(quote(c(.data$a, .data$b, .data$c)), data = mask)\n"), #> "\n"), as_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("as_env"), "\n", list("as_env"), "\n", #> list("Coerce to an environment"), "\n", list("\n", #> "as_env(x, parent = NULL)\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"deprecated\")"), "\n", #> "\n", "This function is deprecated as it was renamed to ", #> list(list("as_environment()")), "\n", "in rlang 0.2.0.\n"), #> "\n", list("internal"), "\n"), as_environment.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/env.R", "\n", list( #> "as_environment"), "\n", list("as_environment"), #> "\n", list("Coerce to an environment"), "\n", list( #> "\n", "as_environment(x, parent = NULL)\n"), #> "\n", list("\n", list(list("x"), list("An object to coerce.")), #> "\n", "\n", list(list("parent"), list("A parent environment, ", #> list(list("empty_env()")), " by default. This\n", #> "argument is only used when ", list("x"), " is data actually coerced to an\n", #> "environment (as opposed to data representing an environment, like\n", #> list("NULL"), " representing the empty environment).")), #> "\n"), "\n", list("\n", list("as_environment()"), #> " coerces named vectors (including lists) to an\n", #> "environment. The names must be unique. If supplied an unnamed\n", #> "string, it returns the corresponding package environment (see\n", #> list(list("pkg_env()")), ").\n"), "\n", list( #> "\n", "If ", list("x"), " is an environment and ", #> list("parent"), " is not ", list("NULL"), ", the\n", #> "environment is duplicated before being set a new parent. The return\n", #> "value is therefore a different environment than ", #> list("x"), ".\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", list("as_env()"), " was soft-deprecated and renamed to ", #> list("as_environment()"), " in\n", "rlang 0.2.0. This is for consistency as type predicates should not\n", #> "be abbreviated.\n")), "\n", "\n", list("\n", #> "# Coerce a named vector to an environment:\n", #> "env <- as_environment(mtcars)\n", "\n", "# By default it gets the empty environment as parent:\n", #> "identical(env_parent(env), empty_env())\n", #> "\n", "\n", "# With strings it is a handy shortcut for pkg_env():\n", #> "as_environment(\"base\")\n", "as_environment(\"rlang\")\n", #> "\n", "# With NULL it returns the empty environment:\n", #> "as_environment(NULL)\n"), "\n"), as_function.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/fn.R", "\n", list( #> "as_function"), "\n", list("as_function"), "\n", #> list("is_lambda"), "\n", list("as_closure"), "\n", #> list("Convert to function or closure"), "\n", list( #> "\n", "as_function(x, env = caller_env())\n", #> "\n", "is_lambda(x)\n", "\n", "as_closure(x, env = caller_env())\n"), #> "\n", list("\n", list(list("x"), list("A function or formula.\n", #> "\n", "If a ", list("function"), ", it is used as is.\n", #> "\n", "If a ", list("formula"), ", e.g. ", list( #> "~ .x + 2"), ", it is converted to a function\n", #> "with up to two arguments: ", list(".x"), " (single argument) or ", #> list(".x"), " and ", list(".y"), "\n", "(two arguments). The ", #> list("."), " placeholder can be used instead of ", #> list(".x"), ".\n", "This allows you to create very compact anonymous functions (lambdas) with up\n", #> "to two inputs. Functions created from formulas have a special\n", #> "class. Use ", list("is_lambda()"), " to test for it.\n", #> "\n", "Lambdas currently do not support ", list( #> "nse-force"), ",\n", "due to the way the arguments are handled internally.")), #> "\n", "\n", list(list("env"), list("Environment in which to fetch the function in case ", #> list("x"), "\n", "is a string.")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", list("\n", list(), " ", list("as_function()"), #> " transforms a one-sided formula into a function.\n", #> "This powers the lambda syntax in packages like purrr.\n", #> list(), " ", list("as_closure()"), " first passes its argument to ", #> list("as_function()"), ". If\n", "the result is a primitive function, it regularises it to a proper\n", #> list("closure"), " (see ", list(list("is_function()")), #> " about primitive functions). Some\n", "special control flow primitives like ", #> list("if"), ", ", list("for"), ", or ", list( #> "break"), "\n", "can't be coerced to a closure.\n"), #> "\n"), "\n", list("\n", "f <- as_function(~ .x + 1)\n", #> "f(10)\n", "\n", "g <- as_function(~ -1 * .)\n", #> "g(4)\n", "\n", "h <- as_function(~ .x - .y)\n", #> "h(6, 3)\n", "\n", "# Functions created from a formula have a special class:\n", #> "is_lambda(f)\n", "is_lambda(as_function(function() \"foo\"))\n", #> "\n", "# Primitive functions are regularised as closures\n", #> "as_closure(list)\n", "as_closure(\"list\")\n", #> "\n", "# Operators have `.x` and `.y` as arguments, just like lambda\n", #> "# functions created with the formula syntax:\n", #> "as_closure(`+`)\n", "as_closure(`~`)\n", "\n", #> "# Use a regular function for tidy evaluation, also when calling functions\n", #> "# that use tidy evaluation:\n", "## Bad:\n", #> "e <- as_function(~ as_label(ensym(.x)))\n", #> "## Good:\n", "e <- as_function(function(x) as_label(ensym(x)))\n", #> "\n", "e(y)\n"), "\n"), as_label.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/deparse.R", #> "\n", list("as_label"), "\n", list("as_label"), "\n", #> list("Create a default name for an R object"), "\n", #> list("\n", "as_label(x)\n"), "\n", list("\n", list( #> list("x"), list("An object.")), "\n"), "\n", #> list("\n", list("as_label()"), " transforms R objects into a short, human-readable\n", #> "description. You can use labels to:\n", list( #> "\n", list(), " Display an object in a concise way, for example to labellise axes\n", #> "in a graphical plot.\n", list(), " Give default names to columns in a data frame. In this case,\n", #> "labelling is the first step before name repair.\n"), #> "\n", "\n", "See also ", list(list("as_name()")), #> " for transforming symbols back to a\n", "string. Unlike ", #> list("as_label()"), ", ", list("as_string()"), #> " is a well defined\n", "operation that guarantees the roundtrip symbol -> string ->\n", #> "symbol.\n", "\n", "In general, if you don't know for sure what kind of object you're\n", #> "dealing with (a call, a symbol, an unquoted constant), use\n", #> list("as_label()"), " and make no assumption about the resulting string. If\n", #> "you know you have a symbol and need the name of the object it\n", #> "refers to, use ", list(list("as_string()")), #> ". For instance, use ", list("as_label()"), " with\n", #> "objects captured with ", list("enquo()"), " and ", #> list("as_string()"), " with symbols\n", "captured with ", #> list("ensym()"), ".\n"), "\n", list(list("Transformation to string"), #> list("\n", "\n", list("\n", list(), " Quosures are ", #> list("squashed"), " before being labelled.\n", #> list(), " Symbols are transformed to string with ", #> list("as_string()"), ".\n", list(), " Calls are abbreviated.\n", #> list(), " Numbers are represented as such.\n", #> list(), " Other constants are represented by their type, such as ", #> list("<dbl>"), "\n", "or ", list("<data.frame>"), #> ".\n"), "\n", "\n", "Note that simple symbols should generally be transformed to strings\n", #> "with ", list(list("as_name()")), ". Labelling is not a well defined operation and\n", #> "no assumption should be made about how the label is created. On the\n", #> "other hand, ", list("as_name()"), " only works with symbols and is a well\n", #> "defined, deterministic operation.\n")), "\n", #> "\n", list("\n", "# as_label() is useful with quoted expressions:\n", #> "as_label(expr(foo(bar)))\n", "as_label(expr(foobar))\n", #> "\n", "# It works with any R object. This is also useful for quoted\n", #> "# arguments because the user might unquote constant objects:\n", #> "as_label(1:3)\n", "as_label(base::list)\n"), #> "\n", list("\n", list(list("as_name()")), " for transforming symbols back to a string\n", #> "deterministically.\n"), "\n"), as_name.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/deparse.R", "\n", #> list("as_name"), "\n", list("as_name"), "\n", list( #> "Extract names from symbols"), "\n", list("\n", #> "as_name(x)\n"), "\n", list("\n", list(list("x"), #> list("A string or symbol, possibly wrapped in a ", #> list("quosure"), ".\n", "If a string, the attributes are removed, if any.")), #> "\n"), "\n", list("\n", "A character vector of length 1.\n"), #> "\n", list("\n", list("as_name()"), " converts ", #> list("symbols"), " to character strings. The\n", #> "conversion is deterministic. That is, the roundtrip symbol -> name\n", #> "-> symbol always gets the same result.\n", list( #> "\n", list(), " Use ", list("as_name()"), " when you need to transform a symbol to a string\n", #> "to ", list("refer"), " to an object by its name.\n", #> list(), " Use ", list(list("as_label()")), #> " when you need to transform any kind of object to\n", #> "a string to ", list("represent"), " that object with a short description.\n"), #> "\n", "\n", "Expect ", list("as_name()"), " to gain\n", #> list(list("https://principles.tidyverse.org/names-attribute.html#minimal-unique-universal"), #> list("name-repairing")), "\n", "features in the future.\n", #> "\n", "Note that ", list("rlang::as_name()"), #> " is the ", list("opposite"), " of\n", list(list( #> "base::as.name()")), ". If you're writing base R code, we recommend\n", #> "using ", list(list("base::as.symbol()")), " which is an alias of ", #> list("as.name()"), " that\n", "follows a more modern terminology (R types instead of S modes).\n"), #> "\n", list("\n", "# Let's create some symbols:\n", #> "foo <- quote(foo)\n", "bar <- sym(\"bar\")\n", #> "\n", "# as_name() converts symbols to strings:\n", #> "foo\n", "as_name(foo)\n", "\n", "typeof(bar)\n", #> "typeof(as_name(bar))\n", "\n", "# as_name() unwraps quosured symbols automatically:\n", #> "as_name(quo(foo))\n"), "\n", list("\n", list( #> list("as_label()")), " for converting any object to a single string\n", #> "suitable as a label. ", list(list("as_string()")), #> " for a lower-level version that\n", "doesn't unwrap quosures.\n"), #> "\n"), as_overscope.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("as_overscope"), "\n", list("as_overscope"), #> "\n", list("new_overscope"), "\n", list("overscope_clean"), #> "\n", list("Create an overscope"), "\n", list("\n", #> "as_overscope(quo, data = NULL)\n", "\n", "new_overscope(bottom, top = NULL, enclosure = NULL)\n", #> "\n", "overscope_clean(overscope)\n"), "\n", #> list("\n", list(list("quo"), list("A ", list("quosure"), #> ".")), "\n", "\n", list(list("data"), list("A data frame or named vector of masking data.")), #> "\n", "\n", list(list("bottom"), list("The environment containing masking objects if the\n", #> "data mask is one environment deep. The bottom environment if the\n", #> "data mask comprises multiple environment.\n", #> "\n", "If you haven't supplied ", list("top"), #> ", this ", list("must"), " be an environment\n", #> "that you own, i.e. that you have created yourself.")), #> "\n", "\n", list(list("top"), list("The last environment of the data mask. If the data mask\n", #> "is only one environment deep, ", list("top"), #> " should be the same as\n", list("bottom"), #> ".\n", "\n", "This ", list("must"), " be an environment that you own, i.e. that you have\n", #> "created yourself. The parent of ", list("top"), #> " will be changed by the tidy\n", "eval engine and should be considered undetermined. Never make\n", #> "assumption about the parent of ", list("top"), #> ".")), "\n", "\n", list(list("enclosure"), #> list("The ", list("parent"), " argument of ", #> list(list("new_data_mask()")), ".")), "\n", #> "\n", list(list("overscope"), list("A data mask.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions have been deprecated in rlang 0.2.0. Please use\n", #> list(list("as_data_mask()")), " and ", list(list( #> "new_data_mask()")), " instead. We no longer\n", #> "require the mask to be cleaned up so ", list( #> "overscope_clean()"), " does not\n", "have a replacement.\n"), #> "\n", list("internal"), "\n"), as_pairlist.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/node.R", "\n", #> list("as_pairlist"), "\n", list("as_pairlist"), "\n", #> list("Coerce to pairlist"), "\n", list("\n", "as_pairlist(x)\n"), #> "\n", list("\n", list(list("x"), list("An object to coerce.")), #> "\n"), "\n", list("\n", "This transforms vector objects to a linked pairlist of nodes. See\n", #> "the ", list("pairlist"), " type help page.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", "\n", #> list("as_pairlist()"), " is experimental because we are still figuring out\n", #> "the naming scheme for pairlists and node-like objects.\n")), #> "\n", "\n", list("internal"), "\n"), as_quosure.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/quo.R", "\n", list( #> "as_quosure"), "\n", list("as_quosure"), "\n", #> list("new_quosure"), "\n", list("Coerce object to quosure"), #> "\n", list("\n", "as_quosure(x, env = NULL)\n", "\n", #> "new_quosure(expr, env = caller_env())\n"), "\n", #> list("\n", list(list("x"), list("An object to convert. Either an ", #> list("expression"), " or a\n", "formula.")), #> "\n", "\n", list(list("env"), list("The environment in which the expression should be\n", #> "evaluated. Only used for symbols and calls. This should typically\n", #> "be the environment in which the expression was created.")), #> "\n", "\n", list(list("expr"), list("The expression wrapped by the quosure.")), #> "\n"), "\n", list("\n", "While ", list("new_quosure()"), #> " wraps any R object (including expressions,\n", #> "formulas, or other quosures) into a quosure, ", #> list("as_quosure()"), "\n", "converts formulas and quosures and does not double-wrap.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", list( #> "\n", list(), " ", list("as_quosure()"), " now requires an explicit default environment for\n", #> "creating quosures from symbols and calls.\n", #> list(), " ", list("as_quosureish()"), " is deprecated as of rlang 0.2.0. This function\n", #> "assumes that quosures are formulas which is currently true but\n", #> "might not be in the future.\n"), "\n")), "\n", #> "\n", list("\n", "# as_quosure() converts expressions or any R object to a validly\n", #> "# scoped quosure:\n", "env <- env(var = \"thing\")\n", #> "as_quosure(quote(var), env)\n", "\n", "\n", #> "# The environment is ignored for formulas:\n", #> "as_quosure(~foo, env)\n", "as_quosure(~foo)\n", #> "\n", "# However you must supply it for symbols and calls:\n", #> "try(as_quosure(quote(var)))\n"), "\n", list( #> "\n", list(list("quo()")), ", ", list(list("is_quosure()")), #> "\n"), "\n"), as_string.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/sym.R", "\n", #> list("as_string"), "\n", list("as_string"), "\n", #> list("Cast symbol to string"), "\n", list("\n", "as_string(x)\n"), #> "\n", list("\n", list(list("x"), list("A string or symbol. If a string, the attributes are\n", #> "removed, if any.")), "\n"), "\n", list("\n", #> "A character vector of length 1.\n"), "\n", list( #> "\n", list("as_string()"), " converts ", list( #> "symbols"), " to character strings.\n"), "\n", #> list(list("Unicode tags"), list("\n", "\n", "\n", #> "Unlike ", list(list("base::as.symbol()")), " and ", #> list(list("base::as.name()")), ", ", list("as_string()"), #> "\n", "automatically transforms unicode tags such as ", #> list("\"<U+5E78>\""), " to the\n", "proper UTF-8 character. This is important on Windows because:\n", #> list("\n", list(), " R on Windows has no UTF-8 support, and uses native encoding instead.\n", #> list(), " The native encodings do not cover all Unicode characters. For\n", #> "example, Western encodings do not support CKJ characters.\n", #> list(), " When a lossy UTF-8 -> native transformation occurs, uncovered\n", #> "characters are transformed to an ASCII unicode tag like ", #> list("\"<U+5E78>\""), ".\n", list(), " Symbols are always encoded in native. This means that\n", #> "transforming the column names of a data frame to symbols might be\n", #> "a lossy operation.\n", list(), " This operation is very common in the tidyverse because of data\n", #> "masking APIs like dplyr where data frames are transformed to\n", #> "environments. While the names of a data frame are stored as a\n", #> "character vector, the bindings of environments are stored as\n", #> "symbols.\n"), "\n", "\n", "Because it reencodes the ASCII unicode tags to their UTF-8\n", #> "representation, the string -> symbol -> string roundtrip is\n", #> "more stable with ", list("as_string()"), ".\n")), #> "\n", "\n", list("\n", "# Let's create some symbols:\n", #> "foo <- quote(foo)\n", "bar <- sym(\"bar\")\n", #> "\n", "# as_string() converts symbols to strings:\n", #> "foo\n", "as_string(foo)\n", "\n", "typeof(bar)\n", #> "typeof(as_string(bar))\n"), "\n", list("\n", #> list(list("as_name()")), " for a higher-level variant of ", #> list("as_string()"), "\n", "that automatically unwraps quosures.\n"), #> "\n"), as_utf8_character.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/utils-encoding.R", #> "\n", list("as_utf8_character"), "\n", list("as_utf8_character"), #> "\n", list("Coerce to a character vector and attempt encoding conversion"), #> "\n", list("\n", "as_utf8_character(x)\n"), "\n", #> list("\n", list(list("x"), list("An object to coerce.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "Unlike specifying the ", list("encoding"), #> " argument in ", list("as_string()"), " and\n", #> list("as_character()"), ", which is only declarative, these functions\n", #> "actually attempt to convert the encoding of their input. There are\n", #> "two possible cases:\n", list("\n", list(), " The string is tagged as UTF-8 or latin1, the only two encodings\n", #> "for which R has specific support. In this case, converting to the\n", #> "same encoding is a no-op, and converting to native always works\n", #> "as expected, as long as the native encoding, the one specified by\n", #> "the ", list("LC_CTYPE"), " locale has support for all characters occurring in\n", #> "the strings. Unrepresentable characters are serialised as unicode\n", #> "points: \"<U+xxxx>\".\n", list(), " The string is not tagged. R assumes that it is encoded in the\n", #> "native encoding. Conversion to native is a no-op, and conversion\n", #> "to UTF-8 should work as long as the string is actually encoded in\n", #> "the locale codeset.\n"), "\n", "\n", "When translating to UTF-8, the strings are parsed for serialised\n", #> "unicode points (e.g. strings looking like \"U+xxxx\") with\n", #> list(list("chr_unserialise_unicode()")), ". This helps to alleviate the effects of\n", #> "character-to-symbol-to-character roundtrips on systems with\n", #> "non-UTF-8 native encoding.\n"), "\n", list("\n", #> "# Let's create a string marked as UTF-8 (which is guaranteed by the\n", #> "# Unicode escaping in the string):\n", "utf8 <- \"caf\\uE9\"\n", #> "Encoding(utf8)\n", "as_bytes(utf8)\n"), "\n", #> list("internal"), "\n"), `bare-type-predicates.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/types.R", "\n", #> list("bare-type-predicates"), "\n", list("bare-type-predicates"), #> "\n", list("is_bare_list"), "\n", list("is_bare_atomic"), #> "\n", list("is_bare_vector"), "\n", list("is_bare_double"), #> "\n", list("is_bare_integer"), "\n", list("is_bare_numeric"), #> "\n", list("is_bare_character"), "\n", list("is_bare_logical"), #> "\n", list("is_bare_raw"), "\n", list("is_bare_string"), #> "\n", list("is_bare_bytes"), "\n", list("Bare type predicates"), #> "\n", list("\n", "is_bare_list(x, n = NULL)\n", "\n", #> "is_bare_atomic(x, n = NULL)\n", "\n", "is_bare_vector(x, n = NULL)\n", #> "\n", "is_bare_double(x, n = NULL)\n", "\n", #> "is_bare_integer(x, n = NULL)\n", "\n", "is_bare_numeric(x, n = NULL)\n", #> "\n", "is_bare_character(x, n = NULL)\n", "\n", #> "is_bare_logical(x, n = NULL)\n", "\n", "is_bare_raw(x, n = NULL)\n", #> "\n", "is_bare_string(x, n = NULL)\n", "\n", #> "is_bare_bytes(x, n = NULL)\n"), "\n", list("\n", #> list(list("x"), list("Object to be tested.")), #> "\n", "\n", list(list("n"), list("Expected length of a vector.")), #> "\n"), "\n", list("\n", "These predicates check for a given type but only return ", #> list("TRUE"), " for\n", "bare R objects. Bare objects have no class attributes. For example,\n", #> "a data frame is a list, but not a bare list.\n"), #> "\n", list("\n", list("\n", list(), " The predicates for vectors include the ", #> list("n"), " argument for\n", "pattern-matching on the vector length.\n", #> list(), " Like ", list(list("is_atomic()")), #> " and unlike base R ", list("is.atomic()"), ",\n", #> list("is_bare_atomic()"), " does not return ", #> list("TRUE"), " for ", list("NULL"), ".\n", list(), #> " Unlike base R ", list("is.numeric()"), ", ", #> list("is_bare_double()"), " only returns\n", #> list("TRUE"), " for floating point numbers.\n"), #> "\n"), "\n", list("\n", list("type-predicates"), #> ", ", list("scalar-type-predicates"), "\n"), #> "\n"), box.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/s3.R", "\n", #> list("box"), "\n", list("box"), "\n", list("new_box"), #> "\n", list("is_box"), "\n", list("unbox"), "\n", #> list("Box a value"), "\n", list("\n", "new_box(.x, class = NULL, ...)\n", #> "\n", "is_box(x, class = NULL)\n", "\n", "unbox(box)\n"), #> "\n", list("\n", list(list("class"), list("For ", #> list("new_box()"), ", an additional class for the\n", #> "boxed value (in addition to ", list("rlang_box"), #> "). For ", list("is_box()"), ", a class\n", "or vector of classes passed to ", #> list(list("inherits_all()")), ".")), "\n", "\n", #> list(list("..."), list("Additional attributes passed to ", #> list(list("base::structure()")), ".")), "\n", #> "\n", list(list("x, .x"), list("An R object.")), #> "\n", "\n", list(list("box"), list("A boxed value to unbox.")), #> "\n"), "\n", list("\n", list("new_box()"), " is similar to ", #> list(list("base::I()")), " but it protects a value by\n", #> "wrapping it in a scalar list rather than by adding an attribute.\n", #> list("unbox()"), " retrieves the boxed value. ", #> list("is_box()"), " tests whether an\n", "object is boxed with optional class. ", #> list("as_box()"), " ensures that a\n", "value is wrapped in a box. ", #> list("as_box_if()"), " does the same but only if\n", #> "the value matches a predicate.\n"), "\n", list( #> "\n", "boxed <- new_box(letters, \"mybox\")\n", #> "is_box(boxed)\n", "is_box(boxed, \"mybox\")\n", #> "is_box(boxed, \"otherbox\")\n", "\n", "unbox(boxed)\n", #> "\n", "# as_box() avoids double-boxing:\n", "boxed2 <- as_box(boxed, \"mybox\")\n", #> "boxed2\n", "unbox(boxed2)\n", "\n", "# Compare to:\n", #> "boxed_boxed <- new_box(boxed, \"mybox\")\n", #> "boxed_boxed\n", "unbox(unbox(boxed_boxed))\n", #> "\n", "# Use `as_box_if()` with a predicate if you need to ensure a box\n", #> "# only for a subset of values:\n", "as_box_if(NULL, is_null, \"null_box\")\n", #> "as_box_if(\"foo\", is_null, \"null_box\")\n"), #> "\n"), call2.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call2"), "\n", list("call2"), "\n", list( #> "Create a call"), "\n", list("\n", "call2(.fn, ..., .ns = NULL)\n"), #> "\n", list("\n", list(list(".fn"), list("Function to call. Must be a callable object: a string,\n", #> "symbol, call, or a function.")), "\n", "\n", #> list(list("..."), list("<", list("dynamic"), #> "> Arguments for the function\n", "call. Empty arguments are preserved.")), #> "\n", "\n", list(list(".ns"), list("Namespace with which to prefix ", #> list(".fn"), ". Must be a string\n", "or symbol.")), #> "\n"), "\n", list("\n", "Quoted function calls are one of the two types of\n", #> list("symbolic"), " objects in R. They represent the action of\n", #> "calling a function, possibly with arguments. There are two ways of\n", #> "creating a quoted call:\n", list("\n", list(), #> " By ", list("quoting"), " it. Quoting prevents functions from being\n", #> "called. Instead, you get the description of the function call as\n", #> "an R object. That is, a quoted function call.\n", #> list(), " By constructing it with ", list(list( #> "base::call()")), ", ", list(list("base::as.call()")), #> ", or\n", list("call2()"), ". In this case, you pass the call elements (the function\n", #> "to call and the arguments to call it with) separately.\n"), #> "\n", "\n", "See section below for the difference between ", #> list("call2()"), " and the base\n", "constructors.\n"), #> "\n", list(list("Difference with base constructors"), #> list("\n", "\n", "\n", list("call2()"), " is more flexible and convenient than ", #> list("base::call()"), ":\n", list("\n", list(), #> " The function to call can be a string or a ", #> list("callable"), "\n", "object: a symbol, another call (e.g. a ", #> list("$"), " or ", list("[["), " call), or a\n", #> "function to inline. ", list("base::call()"), #> " only supports strings and you\n", "need to use ", #> list("base::as.call()"), " to construct a call with a callable\n", #> "object.", list("call2(list, 1, 2)\n", "\n", #> "as.call(list(list, 1, 2))\n"), "\n", list(), #> " The ", list(".ns"), " argument is convenient for creating namespaced calls.", #> list("call2(\"list\", 1, 2, .ns = \"base\")\n", #> "\n", "ns_call <- as.call(list(as.name(\"::\"), as.name(\"list\"), as.name(\"base\")))\n", #> "as.call(list(ns_call, 1, 2))\n"), "\n", #> list(), " ", list("call2()"), " has ", list( #> "tidy dots"), " support and you can splice lists\n", #> "of arguments with ", list("!!!"), ". With base R, you need to use ", #> list("as.call()"), "\n", "instead of ", list( #> "call()"), " if the arguments are in a list.", #> list("args <- list(na.rm = TRUE, trim = 0)\n", #> "\n", "call2(\"mean\", 1:10, !!!args)\n", #> "\n", "as.call(c(list(as.name(\"mean\"), 1:10), args))\n"), #> "\n"), "\n")), "\n", "\n", list(list("Caveats of inlining objects in calls"), #> list("\n", "\n", "\n", list("call2()"), " makes it possible to inline objects in calls, both in\n", #> "function and argument positions. Inlining an object or a function\n", #> "has the advantage that the correct object is used in all\n", #> "environments. If all components of the code are inlined, you can\n", #> "even evaluate in the ", list("empty environment"), #> ".\n", "\n", "However inlining also has drawbacks. It can cause issues with NSE\n", #> "functions that expect symbolic arguments. The objects may also leak\n", #> "in representations of the call stack, such as ", #> list(list("traceback()")), ".\n")), "\n", "\n", #> list("\n", "# fn can either be a string, a symbol or a call\n", #> "call2(\"f\", a = 1)\n", "call2(quote(f), a = 1)\n", #> "call2(quote(f()), a = 1)\n", "\n", "#' Can supply arguments individually or in a list\n", #> "call2(quote(f), a = 1, b = 2)\n", "call2(quote(f), !!!list(a = 1, b = 2))\n", #> "\n", "# Creating namespaced calls is easy:\n", #> "call2(\"fun\", arg = quote(baz), .ns = \"mypkg\")\n", #> "\n", "# Empty arguments are preserved:\n", "call2(\"[\", quote(x), , drop = )\n"), #> "\n", list("\n", "call_modify\n"), "\n"), call_args.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/call.R", "\n", #> list("call_args"), "\n", list("call_args"), "\n", #> list("call_args_names"), "\n", list("Extract arguments from a call"), #> "\n", list("\n", "call_args(call)\n", "\n", "call_args_names(call)\n"), #> "\n", list("\n", list(list("call"), list("Can be a call or a quosure that wraps a call.")), #> "\n"), "\n", list("\n", "A named list of arguments.\n"), #> "\n", list("\n", "Extract arguments from a call\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", "\n", #> "In rlang 0.2.0, ", list("lang_args()"), " and ", #> list("lang_args_names()"), " were\n", "deprecated and renamed to ", #> list("call_args()"), " and ", list("call_args_names()"), #> ".\n", "See lifecycle section in ", list(list( #> "call2()")), " for more about this change.\n")), #> "\n", "\n", list("\n", "call <- quote(f(a, b))\n", #> "\n", "# Subsetting a call returns the arguments converted to a language\n", #> "# object:\n", "call[-1]\n", "\n", "# On the other hand, call_args() returns a regular list that is\n", #> "# often easier to work with:\n", "str(call_args(call))\n", #> "\n", "# When the arguments are unnamed, a vector of empty strings is\n", #> "# supplied (rather than NULL):\n", "call_args_names(call)\n"), #> "\n", list("\n", list(list("fn_fmls()")), " and ", #> list(list("fn_fmls_names()")), "\n"), "\n"), #> call_fn.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call_fn"), "\n", list("call_fn"), #> "\n", list("Extract function from a call"), "\n", #> list("\n", "call_fn(call, env = caller_env())\n"), #> "\n", list("\n", list(list("call"), list("Can be a call or a quosure that wraps a call.")), #> "\n", "\n", list(list("env"), list("The environment where to find the definition of the\n", #> "function quoted in ", list("call"), " in case ", #> list("call"), " is not wrapped in a\n", "quosure.")), #> "\n"), "\n", list("\n", "If a frame or formula, the function will be retrieved from the\n", #> "associated environment. Otherwise, it is looked up in the calling\n", #> "frame.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "In rlang 0.2.0, ", #> list("lang_fn()"), " was deprecated and renamed to\n", #> list("call_fn()"), ". See lifecycle section in ", #> list(list("call2()")), " for more about this\n", #> "change.\n")), "\n", "\n", list("\n", "# Extract from a quoted call:\n", #> "call_fn(quote(matrix()))\n", "call_fn(quo(matrix()))\n", #> "\n", "# Extract the calling function\n", "test <- function() call_fn(call_frame())\n", #> "test()\n"), "\n", list("\n", list(list("call_name()")), #> "\n"), "\n"), call_inspect.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/stack.R", #> "\n", list("call_inspect"), "\n", list("call_inspect"), #> "\n", list("Inspect a call"), "\n", list("\n", #> "call_inspect(...)\n"), "\n", list("\n", list( #> list("..."), list("Arguments to display in the returned call.")), #> "\n"), "\n", list("\n", "This function is useful for quick testing and debugging when you\n", #> "manipulate expressions and calls. It lets you check that a function\n", #> "is called with the right arguments. This can be useful in unit\n", #> "tests for instance. Note that this is just a simple wrapper around\n", #> list(list("base::match.call()")), ".\n"), "\n", #> list("\n", "call_inspect(foo(bar), \"\" %>% identity())\n"), #> "\n"), call_modify.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call_modify"), "\n", list("call_modify"), #> "\n", list("Modify the arguments of a call"), #> "\n", list("\n", "call_modify(\n", " .call,\n", #> " ...,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .standardise = NULL,\n", " .env = caller_env()\n", #> ")\n"), "\n", list("\n", list(list(".call"), #> list("Can be a call, a formula quoting a call in the\n", #> "right-hand side, or a frame object from which to extract the call\n", #> "expression.")), "\n", "\n", list(list("..."), #> list("<", list("dynamic"), "> Named or unnamed expressions\n", #> "(constants, names or calls) used to modify the call. Use ", #> list(list("zap()")), "\n", "to remove arguments. Empty arguments are preserved.")), #> "\n", "\n", list(list(".homonyms"), list("How to treat arguments with the same name. The\n", #> "default, ", list("\"keep\""), ", preserves these arguments. Set ", #> list(".homonyms"), " to\n", list("\"first\""), #> " to only keep the first occurrences, to ", #> list("\"last\""), " to keep\n", "the last occurrences, and to ", #> list("\"error\""), " to raise an informative\n", #> "error and indicate what arguments have duplicated names.")), #> "\n", "\n", list(list(".standardise, .env"), #> list("Soft-deprecated as of rlang 0.3.0. Please\n", #> "call ", list(list("call_standardise()")), #> " manually.")), "\n"), "\n", list("\n", #> "A quosure if ", list(".call"), " is a quosure, a call otherwise.\n"), #> "\n", list("\n", "If you are working with a user-supplied call, make sure the\n", #> "arguments are standardised with ", list(list( #> "call_standardise()")), " before\n", "modifying the call.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> list("\n", list(), " The ", list(".standardise"), #> " argument is deprecated as of rlang 0.3.0.\n", #> list(), " In rlang 0.2.0, ", list("lang_modify()"), #> " was deprecated and renamed to\n", list( #> "call_modify()"), ". See lifecycle section in ", #> list(list("call2()")), " for more about\n", #> "this change.\n"), "\n")), "\n", "\n", list( #> "\n", "call <- quote(mean(x, na.rm = TRUE))\n", #> "\n", "# Modify an existing argument\n", "call_modify(call, na.rm = FALSE)\n", #> "call_modify(call, x = quote(y))\n", "\n", #> "# Remove an argument\n", "call_modify(call, na.rm = zap())\n", #> "\n", "# Add a new argument\n", "call_modify(call, trim = 0.1)\n", #> "\n", "# Add an explicit missing argument:\n", #> "call_modify(call, na.rm = )\n", "\n", "# Supply a list of new arguments with `!!!`\n", #> "newargs <- list(na.rm = NULL, trim = 0.1)\n", #> "call <- call_modify(call, !!!newargs)\n", #> "call\n", "\n", "# Remove multiple arguments by splicing zaps:\n", #> "newargs <- rep_named(c(\"na.rm\", \"trim\"), list(zap()))\n", #> "call <- call_modify(call, !!!newargs)\n", #> "call\n", "\n", "\n", "# Modify the `...` arguments as if it were a named argument:\n", #> "call <- call_modify(call, ... = )\n", "call\n", #> "\n", "call <- call_modify(call, ... = zap())\n", #> "call\n", "\n", "\n", "# When you're working with a user-supplied call, standardise it\n", #> "# beforehand because it might contain unmatched arguments:\n", #> "user_call <- quote(matrix(x, nc = 3))\n", #> "call_modify(user_call, ncol = 1)\n", "\n", #> "# Standardising applies the usual argument matching rules:\n", #> "user_call <- call_standardise(user_call)\n", #> "user_call\n", "call_modify(user_call, ncol = 1)\n", #> "\n", "\n", "# You can also modify quosures inplace:\n", #> "f <- quo(matrix(bar))\n", "call_modify(f, quote(foo))\n", #> "\n", "\n", "# By default, arguments with the same name are kept. This has\n", #> "# subtle implications, for instance you can move an argument to\n", #> "# last position by removing it and remapping it:\n", #> "call <- quote(foo(bar = , baz))\n", "call_modify(call, bar = NULL, bar = missing_arg())\n", #> "\n", "# You can also choose to keep only the first or last homonym\n", #> "# arguments:\n", "args <- list(bar = NULL, bar = missing_arg())\n", #> "call_modify(call, !!!args, .homonyms = \"first\")\n", #> "call_modify(call, !!!args, .homonyms = \"last\")\n"), #> "\n"), call_name.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call_name"), "\n", list("call_name"), #> "\n", list("call_ns"), "\n", list("Extract function name or namespace of a call"), #> "\n", list("\n", "call_name(call)\n", "\n", "call_ns(call)\n"), #> "\n", list("\n", list(list("call"), list("Can be a call or a quosure that wraps a call.")), #> "\n"), "\n", list("\n", "A string with the function name, or ", #> list("NULL"), " if the function\n", "is anonymous.\n"), #> "\n", list("\n", "Extract function name or namespace of a call\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "In rlang 0.2.0, ", list("lang_name()"), #> " was deprecated and renamed to\n", list("call_name()"), #> ". See lifecycle section in ", list(list("call2()")), #> " for more about\n", "this change.\n")), "\n", #> "\n", list("\n", "# Extract the function name from quoted calls:\n", #> "call_name(quote(foo(bar)))\n", "call_name(quo(foo(bar)))\n", #> "\n", "# Namespaced calls are correctly handled:\n", #> "call_name(~base::matrix(baz))\n", "\n", "# Anonymous and subsetted functions return NULL:\n", #> "call_name(quote(foo$bar()))\n", "call_name(quote(foo[[bar]]()))\n", #> "call_name(quote(foo()()))\n", "\n", "# Extract namespace of a call with call_ns():\n", #> "call_ns(quote(base::bar()))\n", "\n", "# If not namespaced, call_ns() returns NULL:\n", #> "call_ns(quote(bar()))\n"), "\n", list("\n", #> list(list("call_fn()")), "\n"), "\n"), call_parse_type.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call_parse_type"), "\n", list("call_parse_type"), #> "\n", list("What is the parser type of a call?"), #> "\n", list("\n", "call_parse_type(call)\n"), #> "\n", list("\n", "What is the parser type of a call?\n"), #> "\n", list("internal"), "\n"), call_standardise.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call_standardise"), "\n", list("call_standardise"), #> "\n", list("Standardise a call"), "\n", list( #> "\n", "call_standardise(call, env = caller_env())\n"), #> "\n", list("\n", list(list("call"), list("Can be a call or a quosure that wraps a call.")), #> "\n", "\n", list(list("env"), list("The environment where to find the definition of the\n", #> "function quoted in ", list("call"), " in case ", #> list("call"), " is not wrapped in a\n", "quosure.")), #> "\n"), "\n", list("\n", "A quosure if ", list( #> "call"), " is a quosure, a raw call otherwise.\n"), #> "\n", list("\n", "This is essentially equivalent to ", #> list(list("base::match.call()")), ", but with\n", #> "experimental handling of primitive functions.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "In rlang 0.2.0, ", list("lang_standardise()"), #> " was deprecated and renamed to\n", list("call_standardise()"), #> ". See lifecycle section in ", list(list("call2()")), #> " for more\n", "about this change.\n")), "\n", #> "\n"), caller_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("caller_env"), "\n", list("caller_env"), #> "\n", list("current_env"), "\n", list("Get the current or caller environment"), #> "\n", list("\n", "caller_env(n = 1)\n", "\n", #> "current_env()\n"), "\n", list("\n", list(list( #> "n"), list("Number of frames to go back.")), #> "\n"), "\n", list("\n", list("\n", list(), #> " The current environment is the execution environment of the\n", #> "current function (the one currently being evaluated).\n", #> list(), " The caller environment is the execution environment of the\n", #> "function that called the current function.\n"), #> "\n"), "\n", list("\n", "if (FALSE) {\n", "\n", #> "# Let's create a function that returns its current environment and\n", #> "# its caller environment:\n", "fn <- function() list(current = current_env(), caller = caller_env())\n", #> "\n", "# The current environment is an unique execution environment\n", #> "# created when `fn()` was called. The caller environment is the\n", #> "# global env because that's where we called `fn()`.\n", #> "fn()\n", "\n", "# Let's call `fn()` again but this time within a function:\n", #> "g <- function() fn()\n", "\n", "# Now the caller environment is also a unique execution environment.\n", #> "# This is the exec env created by R for our call to g():\n", #> "g()\n", "\n", "}\n"), "\n", list("\n", list( #> list("caller_frame()")), " and ", list(list( #> "current_frame()")), "\n"), "\n"), caller_fn.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/stack.R", #> "\n", list("caller_fn"), "\n", list("caller_fn"), #> "\n", list("current_fn"), "\n", list("Get properties of the current or caller frame"), #> "\n", list("\n", "caller_fn(n = 1)\n", "\n", #> "current_fn()\n"), "\n", list("\n", list(list( #> "n"), list("The number of generations to go back.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", list("\n", list(), " The current frame is the execution context of the function that\n", #> "is currently being evaluated.\n", list(), #> " The caller frame is the execution context of the function that\n", #> "called the function currently being evaluated.\n"), #> "\n", "\n", "See the ", list("call stack"), #> " topic for more information.\n"), "\n", list( #> list("Life cycle"), list("\n", "\n", "\n", #> "These functions are experimental.\n")), #> "\n", "\n", list("\n", list(list("caller_env()")), #> " and ", list(list("current_env()")), "\n"), #> "\n", list("internal"), "\n"), caller_frame.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("caller_frame"), "\n", list("caller_frame"), #> "\n", list("Get caller frame"), "\n", list("\n", #> "caller_frame(n = 1)\n"), "\n", list("\n", #> list(list("n"), list("Number of frames to go back.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n"), "\n", list("internal"), "\n"), catch_cnd.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-handlers.R", #> "\n", list("catch_cnd"), "\n", list("catch_cnd"), #> "\n", list("Catch a condition"), "\n", list("\n", #> "catch_cnd(expr, classes = \"condition\")\n"), #> "\n", list("\n", list(list("expr"), list("Expression to be evaluated with a catching condition\n", #> "handler.")), "\n", "\n", list(list("classes"), #> list("A character vector of condition classes to catch. By\n", #> "default, catches all conditions.")), "\n"), #> "\n", list("\n", "A condition if any was signalled, ", #> list("NULL"), " otherwise.\n"), "\n", list( #> "\n", "This is a small wrapper around ", list( #> "tryCatch()"), " that captures any\n", "condition signalled while evaluating its argument. It is useful for\n", #> "situations where you expect a specific condition to be signalled,\n", #> "for debugging, and for unit testing.\n"), #> "\n", list("\n", "catch_cnd(10)\n", "catch_cnd(abort(\"an error\"))\n", #> "catch_cnd(signal(\"my_condition\", message = \"a condition\"))\n"), #> "\n"), chr_unserialise_unicode.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/utils-encoding.R", #> "\n", list("chr_unserialise_unicode"), "\n", #> list("chr_unserialise_unicode"), "\n", list("Translate unicode points to UTF-8"), #> "\n", list("\n", "chr_unserialise_unicode(chr)\n"), #> "\n", list("\n", list(list("chr"), list("A character vector.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "For historical reasons, R translates strings to the native encoding\n", #> "when they are converted to symbols. This string-to-symbol\n", #> "conversion is not a rare occurrence and happens for instance to the\n", #> "names of a list of arguments converted to a call by ", #> list("do.call()"), ".\n", "\n", "If the string contains unicode characters that cannot be\n", #> "represented in the native encoding, R serialises those as an ASCII\n", #> "sequence representing the unicode point. This is why Windows users\n", #> "with western locales often see strings looking like ", #> list("<U+xxxx>"), ". To\n", "alleviate some of the pain, rlang parses strings and looks for\n", #> "serialised unicode points to translate them back to the proper\n", #> "UTF-8 representation. This transformation occurs automatically in\n", #> "functions like ", list(list("env_names()")), #> " and can be manually triggered with\n", list( #> "as_utf8_character()"), " and ", list("chr_unserialise_unicode()"), #> ".\n"), "\n", list(list("Life cycle"), list( #> "\n", "\n", "\n", "This function is experimental.\n")), #> "\n", "\n", list("\n", "ascii <- \"<U+5E78>\"\n", #> "chr_unserialise_unicode(ascii)\n", "\n", "identical(chr_unserialise_unicode(ascii), \"\\u5e78\")\n"), #> "\n", list("internal"), "\n"), cnd.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-error.R, R/cnd.R", #> "\n", list("error_cnd"), "\n", list("error_cnd"), #> "\n", list("cnd"), "\n", list("warning_cnd"), #> "\n", list("message_cnd"), "\n", list("Create a condition object"), #> "\n", list("\n", "error_cnd(class = NULL, ..., message = \"\", trace = NULL, parent = NULL)\n", #> "\n", "cnd(class, ..., message = \"\")\n", #> "\n", "warning_cnd(class = NULL, ..., message = \"\")\n", #> "\n", "message_cnd(class = NULL, ..., message = \"\")\n"), #> "\n", list("\n", list(list("class"), list("The condition subclass.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> Named data fields stored inside\n", #> "the condition object.")), "\n", "\n", list( #> list("message"), list("A default message to inform the user about the\n", #> "condition when it is signalled.")), "\n", #> "\n", list(list("trace"), list("A ", list("trace"), #> " object created by ", list(list("trace_back()")), #> ".")), "\n", "\n", list(list("parent"), list( #> "A parent condition object created by ", #> list(list("abort()")), ".")), "\n"), "\n", #> list("\n", "These constructors make it easy to create subclassed conditions.\n", #> "Conditions are objects that power the error system in R. They can\n", #> "also be used for passing messages to pre-established handlers.\n"), #> "\n", list("\n", list("cnd()"), " creates objects inheriting from ", #> list("condition"), ". Conditions\n", "created with ", #> list("error_cnd()"), ", ", list("warning_cnd()"), #> " and ", list("message_cnd()"), "\n", "inherit from ", #> list("error"), ", ", list("warning"), " or ", #> list("message"), ".\n"), "\n", list("\n", "# Create a condition inheriting from the s3 type \"foo\":\n", #> "cnd <- cnd(\"foo\")\n", "\n", "# Signal the condition to potential handlers. Since this is a bare\n", #> "# condition the signal has no effect if no handlers are set up:\n", #> "cnd_signal(cnd)\n", "\n", "# When a relevant handler is set up, the signal causes the handler\n", #> "# to be called:\n", "with_handlers(cnd_signal(cnd), foo = exiting(function(c) \"caught!\"))\n", #> "\n", "# Handlers can be thrown or executed inplace. See with_handlers()\n", #> "# documentation for more on this.\n", "\n", #> "# Signalling an error condition aborts the current computation:\n", #> "err <- error_cnd(\"foo\", message = \"I am an error\")\n", #> "try(cnd_signal(err))\n"), "\n", list("\n", #> list(list("cnd_signal()")), ", ", list(list( #> "with_handlers()")), ".\n"), "\n", list("internal"), #> "\n"), cnd_message.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-message.R", #> "\n", list("cnd_message"), "\n", list("cnd_message"), #> "\n", list("cnd_header"), "\n", list("cnd_body"), #> "\n", list("cnd_footer"), "\n", list("Build an error message from parts"), #> "\n", list("\n", "cnd_message(cnd)\n", "\n", #> "cnd_header(cnd, ...)\n", "\n", "cnd_body(cnd, ...)\n", #> "\n", "cnd_footer(cnd, ...)\n"), "\n", list( #> "\n", list(list("cnd"), list("A condition object.")), #> "\n", "\n", list(list("..."), list("Arguments passed to methods.")), #> "\n"), "\n", list("\n", list("cnd_message()"), #> " assembles an error message from three generics:\n", #> list("\n", list(), " ", list("cnd_header()"), #> "\n", list(), " ", list("cnd_body()"), "\n", #> list(), " ", list("cnd_footer()"), "\n"), #> "\n", "\n", "The default method for the error header returns the ", #> list("message"), " field\n", "of the condition object. The default methods for the body and\n", #> "footer return empty character vectors. In general, methods for\n", #> "these generics should return a character vector. The elements are\n", #> "combined into a single string with a newline separator.\n", #> "\n", list("cnd_message()"), " is automatically called by the ", #> list("conditionMessage()"), "\n", "for rlang errors. Error classes created with ", #> list(list("abort()")), " only need to\n", "implement header, body or footer methods. This provides a lot of\n", #> "flexibility for hierarchies of error classes, for instance you\n", #> "could inherit the body of an error message from a parent class\n", #> "while overriding the header and footer.\n"), #> "\n", list(list("Overriding ", list("cnd_body()")), #> list("\n", "\n", "\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "Sometimes the contents of an error message depends on the state of\n", #> "your checking routine. In that case, it can be tricky to lazily\n", #> "generate error messages with ", list("cnd_body()"), #> ": you have the choice\n", "between overspecifying your error class hierarchies with one class\n", #> "per state, or replicating the type-checking control flow within the\n", #> list("cnd_body()"), " method. None of these options are ideal.\n", #> "\n", "A better option is to define a ", #> list("body"), " field in your error object\n", #> "containing a static string, a ", list("lambda-formula"), #> ", or a\n", "function with the same signature as ", #> list("cnd_body()"), ". This field\n", "overrides the ", #> list("cnd_body()"), " generic and makes it easy to generate an\n", #> "error message tailored to the state in which the error was\n", #> "constructed.\n")), "\n", "\n"), cnd_muffle.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-handlers.R", #> "\n", list("cnd_muffle"), "\n", list("cnd_muffle"), #> "\n", list("Muffle a condition"), "\n", list( #> "\n", "cnd_muffle(cnd)\n"), "\n", list("\n", #> list(list("cnd"), list("A condition to muffle.")), #> "\n"), "\n", list("\n", "If ", list("cnd"), #> " is mufflable, ", list("cnd_muffle()"), " jumps to the muffle\n", #> "restart and doesn't return. Otherwise, it returns ", #> list("FALSE"), ".\n"), "\n", list("\n", "Unlike ", #> list(list("exiting()")), " handlers, ", list( #> list("calling()")), " handlers must be explicit\n", #> "that they have handled a condition to stop it from propagating to\n", #> "other handlers. Use ", list("cnd_muffle()"), #> " within a calling handler (or as\n", "a calling handler, see examples) to prevent any other handlers from\n", #> "being called for that condition.\n"), "\n", #> list(list("Mufflable conditions"), list("\n", #> "\n", "\n", "Most conditions signalled by base R are muffable, although the name\n", #> "of the restart varies. cnd_muffle() will automatically call the\n", #> "correct restart for you. It is compatible with the following\n", #> "conditions:\n", list("\n", list(), " ", list( #> "warning"), " and ", list("message"), " conditions. In this case ", #> list("cnd_muffle()"), "\n", "is equivalent to ", #> list(list("base::suppressMessages()")), " and\n", #> list(list("base::suppressWarnings()")), ".\n", #> list(), " Bare conditions signalled with ", #> list("signal()"), " or ", list(list("cnd_signal()")), #> ". Note\n", "that conditions signalled with ", #> list(list("base::signalCondition()")), " are not\n", #> "mufflable.\n", list(), " Interrupts are sometimes signalled with a ", #> list("resume"), " restart on\n", "recent R versions. When this is the case, you can muffle the\n", #> "interrupt with ", list("cnd_muffle()"), #> ". Check if a restart is available\n", "with ", #> list("base::findRestart(\"resume\")"), ".\n"), #> "\n", "\n", "If you call ", list("cnd_muffle()"), #> " with a condition that is not mufflable\n", #> "you will cause a new error to be signalled.\n", #> list("\n", list(), " Errors are not mufflable since they are signalled in critical\n", #> "situations where execution cannot continue safely.\n", #> list(), " Conditions captured with ", list( #> list("base::tryCatch()")), ", ", list(list( #> "with_handlers()")), " or\n", list(list( #> "catch_cnd()")), " are no longer mufflable. Muffling restarts ", #> list("must"), "\n", "be called from a ", #> list("calling"), " handler.\n"), "\n")), #> "\n", "\n", list("\n", "fn <- function() {\n", #> " inform(\"Beware!\", \"my_particular_msg\")\n", #> " inform(\"On your guard!\")\n", " \"foobar\"\n", #> "}\n", "\n", "# Let's install a muffling handler for the condition thrown by `fn()`.\n", #> "# This will suppress all `my_particular_wng` warnings but let other\n", #> "# types of warnings go through:\n", "with_handlers(fn(),\n", #> " my_particular_msg = calling(function(cnd) {\n", #> " inform(\"Dealt with this particular message\")\n", #> " cnd_muffle(cnd)\n", " })\n", ")\n", "\n", #> "# Note how execution of `fn()` continued normally after dealing\n", #> "# with that particular message.\n", "\n", #> "# cnd_muffle() can also be passed to with_handlers() as a calling\n", #> "# handler:\n", "with_handlers(fn(),\n", " my_particular_msg = calling(cnd_muffle)\n", #> ")\n"), "\n", list("internal"), "\n"), cnd_signal.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-signal.R", #> "\n", list("cnd_signal"), "\n", list("cnd_signal"), #> "\n", list("Signal a condition object"), "\n", #> list("\n", "cnd_signal(cnd, ...)\n"), "\n", list( #> "\n", list(list("cnd"), list("A condition object (see ", #> list(list("cnd()")), "). If ", list("NULL"), #> ",\n", list("cnd_signal()"), " returns without signalling a condition.")), #> "\n", "\n", list(list("..."), list("These dots are for extensions and must be empty.")), #> "\n"), "\n", list("\n", "The type of signal depends on the class of the condition:\n", #> list("\n", list(), " A message is signalled if the condition inherits from\n", #> list("\"message\""), ". This is equivalent to signalling with ", #> list(list("inform()")), " or\n", list(list( #> "base::message()")), ".\n", list(), " A warning is signalled if the condition inherits from\n", #> list("\"warning\""), ". This is equivalent to signalling with ", #> list(list("warn()")), " or\n", list(list( #> "base::warning()")), ".\n", list(), " An error is signalled if the condition inherits from\n", #> list("\"error\""), ". This is equivalent to signalling with ", #> list(list("abort()")), " or\n", list(list( #> "base::stop()")), ".\n", list(), " An interrupt is signalled if the condition inherits from\n", #> list("\"interrupt\""), ". This is equivalent to signalling with\n", #> list(list("interrupt()")), ".\n"), "\n", #> "\n", "Use ", list(list("cnd_type()")), " to determine the type of a condition.\n"), #> "\n", list("\n", "# The type of signal depends on the class. If the condition\n", #> "# inherits from \"warning\", a warning is issued:\n", #> "cnd <- warning_cnd(\"my_warning_class\", message = \"This is a warning\")\n", #> "cnd_signal(cnd)\n", "\n", "# If it inherits from \"error\", an error is raised:\n", #> "cnd <- error_cnd(\"my_error_class\", message = \"This is an error\")\n", #> "try(cnd_signal(cnd))\n"), "\n", list("\n", #> list(list("abort()")), ", ", list(list("warn()")), #> " and ", list(list("inform()")), " for creating and\n", #> "signalling structured R conditions. See ", #> list(list("with_handlers()")), " for\n", "establishing condition handlers.\n"), #> "\n"), cnd_type.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd.R", #> "\n", list("cnd_type"), "\n", list("cnd_type"), #> "\n", list("What type is a condition?"), "\n", #> list("\n", "cnd_type(cnd)\n"), "\n", list("\n", #> list(list("cnd"), list("A condition object.")), #> "\n"), "\n", list("\n", "A string, either ", #> list("\"condition\""), ", ", list("\"message\""), #> ", ", list("\"warning\""), ",\n", list("\"error\""), #> " or ", list("\"interrupt\""), ".\n"), "\n", #> list("\n", "Use ", list("cnd_type()"), " to check what type a condition is.\n"), #> "\n", list("\n", "cnd_type(catch_cnd(abort(\"Abort!\")))\n", #> "cnd_type(catch_cnd(interrupt()))\n"), "\n", #> list("internal"), "\n"), done.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/s3.R", #> "\n", list("done"), "\n", list("done"), "\n", #> list("is_done_box"), "\n", list("Box a final value for early termination"), #> "\n", list("\n", "done(x)\n", "\n", "is_done_box(x, empty = NULL)\n"), #> "\n", list("\n", list(list("x"), list("For ", #> list("done()"), ", a value to box. For ", list( #> "is_done_box()"), ", a\n", "value to test.")), #> "\n", "\n", list(list("empty"), list("Whether the box is empty. If ", #> list("NULL"), ", ", list("is_done_box()"), #> "\n", "returns ", list("TRUE"), " for all done boxes. If ", #> list("TRUE"), ", it returns ", list("TRUE"), #> "\n", "only for empty boxes. Otherwise it returns ", #> list("TRUE"), " only for\n", "non-empty boxes.")), #> "\n"), "\n", list("\n", "A ", list("boxed"), #> " value.\n"), "\n", list("\n", "A value boxed with ", #> list("done()"), " signals to its caller that it\n", #> "should stop iterating. Use it to shortcircuit a loop.\n"), #> "\n", list("\n", "done(3)\n", "\n", "x <- done(3)\n", #> "is_done_box(x)\n"), "\n"), dots_definitions.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("dots_definitions"), "\n", list("dots_definitions"), #> "\n", list("Capture definition objects"), "\n", #> list("\n", "dots_definitions(\n", " ...,\n", #> " .named = FALSE,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\")\n", #> ")\n"), "\n", list("\n", list(list("..."), #> list("For ", list("enexprs()"), ", ", list( #> "ensyms()"), " and ", list("enquos()"), ", names of\n", #> "arguments to capture without evaluation (including ", #> list("..."), "). For\n", list("exprs()"), #> " and ", list("quos()"), ", the expressions to capture unevaluated\n", #> "(including expressions contained in ", list( #> "..."), ").")), "\n", "\n", list(list(".named"), #> list("Whether to ensure all dots are named. Unnamed\n", #> "elements are processed with ", list(list( #> "as_label()")), " to build a default\n", #> "name.")), "\n", "\n", list(list(".ignore_empty"), #> list("Whether to ignore empty arguments. Can be one\n", #> "of ", list("\"trailing\""), ", ", list("\"none\""), #> ", ", list("\"all\""), ". If ", list("\"trailing\""), #> ", only the\n", "last argument is ignored if it is empty. Note that ", #> list("\"trailing\""), "\n", "applies only to arguments passed in ", #> list("..."), ", not to named\n", "arguments. On the other hand, ", #> list("\"all\""), " also applies to named\n", #> "arguments.")), "\n"), "\n", list("\n", "Capture definition objects\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", list("dots_definitions()"), " is experimental. Expect API changes.\n")), #> "\n", "\n", list("internal"), "\n"), dots_n.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("dots_n"), "\n", list("dots_n"), "\n", #> list("How many arguments are currently forwarded in dots?"), #> "\n", list("\n", "dots_n(...)\n"), "\n", list( #> "\n", list(list("..."), list("Forwarded arguments.")), #> "\n"), "\n", list("\n", "This returns the number of arguments currently forwarded in ", #> list("..."), "\n", "as an integer.\n"), "\n", #> list("\n", "fn <- function(...) dots_n(..., baz)\n", #> "fn(foo, bar)\n"), "\n", list("internal"), #> "\n"), dots_values.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("dots_values"), "\n", list("dots_values"), #> "\n", list("Evaluate dots with preliminary splicing"), #> "\n", list("\n", "dots_values(\n", " ...,\n", #> " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .preserve_empty = FALSE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n"), "\n", #> list("\n", list(list("..."), list("Arguments to evaluate and process splicing operators.")), #> "\n", "\n", list(list(".ignore_empty"), list( #> "Whether to ignore empty arguments. Can be one\n", #> "of ", list("\"trailing\""), ", ", list("\"none\""), #> ", ", list("\"all\""), ". If ", list("\"trailing\""), #> ", only the\n", "last argument is ignored if it is empty.")), #> "\n", "\n", list(list(".preserve_empty"), list( #> "Whether to preserve the empty arguments that\n", #> "were not ignored. If ", list("TRUE"), ", empty arguments are stored with\n", #> list(list("missing_arg()")), " values. If ", #> list("FALSE"), " (the default) an error is\n", #> "thrown when an empty argument is detected.")), #> "\n", "\n", list(list(".homonyms"), list("How to treat arguments with the same name. The\n", #> "default, ", list("\"keep\""), ", preserves these arguments. Set ", #> list(".homonyms"), " to\n", list("\"first\""), #> " to only keep the first occurrences, to ", #> list("\"last\""), " to keep\n", "the last occurrences, and to ", #> list("\"error\""), " to raise an informative\n", #> "error and indicate what arguments have duplicated names.")), #> "\n", "\n", list(list(".check_assign"), list( #> "Whether to check for ", list("<-"), " calls passed in\n", #> "dots. When ", list("TRUE"), " and a ", list( #> "<-"), " call is detected, a warning is\n", #> "issued to advise users to use ", list("="), #> " if they meant to match a\n", "function parameter, or wrap the ", #> list("<-"), " call in braces otherwise.\n", #> "This ensures assignments are explicit.")), #> "\n"), "\n", list("\n", "This is a tool for advanced users. It captures dots, processes\n", #> "unquoting and splicing operators, and evaluates them. Unlike\n", #> list(list("dots_list()")), ", it does not flatten spliced objects, instead they\n", #> "are attributed a ", list("spliced"), " class (see ", #> list(list("splice()")), "). You can process\n", #> "spliced objects manually, perhaps with a custom predicate (see\n", #> list(list("flatten_if()")), ").\n"), "\n", #> list("\n", "dots <- dots_values(!!! list(1, 2), 3)\n", #> "dots\n", "\n", "# Flatten the objects marked as spliced:\n", #> "flatten_if(dots, is_spliced)\n"), "\n", list( #> "internal"), "\n"), duplicate.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/sexp.R", #> "\n", list("duplicate"), "\n", list("duplicate"), #> "\n", list("Duplicate an R object"), "\n", list( #> "\n", "duplicate(x, shallow = FALSE)\n"), "\n", #> list("\n", list(list("x"), list("Any R object. However, uncopyable types like symbols and\n", #> "environments are returned as is (just like with ", #> list("<-"), ").")), "\n", "\n", list(list("shallow"), #> list("This is relevant for recursive data structures like\n", #> "lists, calls and pairlists. A shallow copy only duplicates the\n", #> "top-level data structure. The objects contained in the list are\n", #> "still the same.")), "\n"), "\n", list("\n", #> "In R semantics, objects are copied by value. This means that\n", #> "modifying the copy leaves the original object intact. Since\n", #> "copying data in memory is an expensive operation, copies in R are\n", #> "as lazy as possible. They only happen when the new object is\n", #> "actually modified. However, some operations (like ", #> list(list("node_poke_car()")), "\n", "or ", #> list(list("node_poke_cdr()")), ") do not support copy-on-write. In those cases,\n", #> "it is necessary to duplicate the object manually in order to\n", #> "preserve copy-by-value semantics.\n"), "\n", #> list("\n", "Some objects are not duplicable, like symbols and environments.\n", #> list("duplicate()"), " returns its input for these unique objects.\n"), #> "\n", list("\n", "pairlist\n"), "\n", list("internal"), #> "\n"), `dyn-dots.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("dyn-dots"), "\n", list("dyn-dots"), #> "\n", list("tidy-dots"), "\n", list("Dynamic dots"), #> "\n", list("\n", "The ", list("..."), " syntax of base R allows you to:\n", #> list("\n", list(), " ", list("Forward"), " arguments from function to function, matching them\n", #> "along the way to function parameters.\n", #> list(), " ", list("Collect"), " arguments inside data structures, e.g. with ", #> list(list("c()")), " or\n", list(list("list()")), #> ".\n"), "\n", "\n", "Dynamic dots offer a few additional features:\n", #> list("\n", list(), " You can ", list("splice"), #> " arguments saved in a list with the ", list( #> "big bang"), " operator ", list("!!!"), #> ".\n", list(), " You can ", list("unquote"), #> " names by using the ", list("glue"), " syntax\n", #> "or the ", list("bang bang"), " operator ", #> list("!!"), " on the\n", "left-hand side of ", #> list(":="), ".\n", list(), " Trailing commas are ignored, making it easier to copy and paste\n", #> "lines of arguments.\n"), "\n"), "\n", list( #> list("Add dynamic dots support in your functions"), #> list("\n", "\n", "\n", "If your function takes dots, adding support for dynamic features is\n", #> "as easy as collecting the dots with ", list( #> list("list2()")), " instead of ", list( #> list("list()")), ".\n", "\n", "Other dynamic dots collectors are ", #> list(list("dots_list()")), ", which is more\n", #> "configurable than ", list(list("list2()")), #> ", ", list("vars()"), " which doesn't force its\n", #> "arguments, and ", list(list("call2()")), #> " for creating calls.\n", "\n", "Document dynamic docs using this standard tag:", #> list(" @param ... <[`dynamic-dots`][rlang::dyn-dots]> What these dots do.\n"), #> "\n")), "\n", "\n", list("\n", "f <- function(...) {\n", #> " out <- list2(...)\n", " rev(out)\n", "}\n", #> "\n", "# Splice\n", "x <- list(alpha = \"first\", omega = \"last\")\n", #> "f(!!!x)\n", "\n", "# Unquote a name, showing both the `!!` bang bang and `{}` glue style\n", #> "nm <- \"key\"\n", "f(!!nm := \"value\")\n", #> "f(\"{nm}\" := \"value\")\n", "f(\"prefix_{nm}\" := \"value\")\n", #> "\n", "# Tolerate a trailing comma\n", "f(this = \"that\", )\n"), #> "\n"), empty_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("empty_env"), "\n", list("empty_env"), #> "\n", list("Get the empty environment"), "\n", #> list("\n", "empty_env()\n"), "\n", list("\n", #> "The empty environment is the only one that does not have a parent.\n", #> "It is always used as the tail of an environment chain such as the\n", #> "search path (see ", list(list("search_envs()")), #> ").\n"), "\n", list("\n", "# Create environments with nothing in scope:\n", #> "child_env(empty_env())\n"), "\n"), enquo0.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/nse-defuse.R", #> "\n", list("enquo0"), "\n", list("enquo0"), "\n", #> list("enquos0"), "\n", list("Defuse arguments without automatic injection"), #> "\n", list("\n", "enquo0(arg)\n", "\n", "enquos0(...)\n"), #> "\n", list("\n", list(list("arg"), list("A symbol for a function argument to defuse.")), #> "\n", "\n", list(list("..."), list("Dots to defuse.")), #> "\n"), "\n", list("\n", "The 0-suffixed variants of ", #> list(list("enquo()")), " and ", list(list("enquos()")), #> " defuse function\n", "arguments without automatic injection (unquotation). They are\n", #> "useful when defusing expressions that potentially include ", #> list("!!"), ",\n", list("!!!"), ", or ", list( #> "{{"), " operations, for instance tidyverse code. In that\n", #> "case, ", list("enquo()"), " would process these operators too early, creating a\n", #> "confusing experience for users. Callers can still inject objects\n", #> "or expressions using manual injection with ", #> list(list("inject()")), ".\n"), "\n", list( #> "\n", "None of the features of ", list("dynamic dots"), #> " are available when\n", "defusing with ", #> list("enquos0()"), ". For instance, trailing empty arguments\n", #> "are not automatically trimmed.\n"), "\n", #> list("\n", "automatic_injection <- function(x) enquo(x)\n", #> "no_injection <- function(x) enquo0(x)\n", #> "\n", "automatic_injection(foo(!!!1:3))\n", #> "no_injection(foo(!!!1:3))\n"), "\n", list( #> "\n", list(list("enquo()")), " and ", list( #> list("enquos()")), "\n"), "\n"), entrace.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-entrace.R", #> "\n", list("entrace"), "\n", list("entrace"), #> "\n", list("cnd_entrace"), "\n", list("Add backtrace from error handler"), #> "\n", list("\n", "entrace(cnd, ..., top = NULL, bottom = NULL)\n", #> "\n", "cnd_entrace(cnd, ..., top = NULL, bottom = NULL)\n"), #> "\n", list("\n", list(list("cnd"), list("When ", #> list("entrace()"), " is used as a calling handler, ", #> list("cnd"), " is\n", "the condition to handle.")), #> "\n", "\n", list(list("..."), list("Unused. These dots are for future extensions.")), #> "\n", "\n", list(list("top"), list("The first frame environment to be included in the\n", #> "backtrace. This becomes the top of the backtrace tree and\n", #> "represents the oldest call in the backtrace.\n", #> "\n", "This is needed in particular when you call ", #> list("trace_back()"), "\n", "indirectly or from a larger context, for example in tests or\n", #> "inside an RMarkdown document where you don't want all of the\n", #> "knitr evaluation mechanisms to appear in the backtrace.")), #> "\n", "\n", list(list("bottom"), list("The last frame environment to be included in the\n", #> "backtrace. This becomes the rightmost leaf of the backtrace tree\n", #> "and represents the youngest call in the backtrace.\n", #> "\n", "Set this when you would like to capture a backtrace without the\n", #> "capture context.\n", "\n", "Can also be an integer that will be passed to ", #> list(list("caller_env()")), ".")), "\n"), #> "\n", list("\n", list("entrace()"), " interrupts an error throw to add an ", #> list("rlang backtrace"), " to the error. The error throw is\n", #> "immediately resumed. ", list("cnd_entrace()"), #> " adds a backtrace to a\n", "condition object, without any other effect. Both functions should\n", #> "be called directly from an error handler.\n", #> "\n", "Set the ", list("error"), " global option to ", #> list("rlang::entrace"), " to\n", "transform base errors to rlang errors. These enriched errors\n", #> "include a backtrace. The RProfile is a good place to set the\n", #> "handler. See ", list(list("rlang_backtrace_on_error")), #> " for details.\n", "\n", list("entrace()"), #> " also works as a ", list("calling"), " handler, though it\n", #> "is often more practical to use the higher-level function\n", #> list(list("with_abort()")), ".\n"), "\n", list( #> "\n", "if (FALSE) { # Not run\n", "\n", "# Set the error handler in your RProfile like this:\n", #> "if (requireNamespace(\"rlang\", quietly = TRUE)) {\n", #> " options(error = rlang::entrace)\n", "}\n", #> "\n", "}\n"), "\n", list("\n", list(list("with_abort()")), #> " to promote conditions to rlang errors.\n", #> list(list("cnd_entrace()")), " to manually add a backtrace to a condition.\n"), #> "\n"), env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env"), "\n", list("env"), "\n", list( #> "child_env"), "\n", list("new_environment"), #> "\n", list("Create a new environment"), "\n", #> list("\n", "env(...)\n", "\n", "child_env(.parent, ...)\n", #> "\n", "new_environment(data = list(), parent = empty_env())\n"), #> "\n", list("\n", list(list("..., data"), list( #> "<", list("dynamic"), "> Named values. You can\n", #> "supply one unnamed to specify a custom parent, otherwise it\n", #> "defaults to the current environment.")), "\n", #> "\n", list(list(".parent, parent"), list("A parent environment. Can be an object\n", #> "supported by ", list(list("as_environment()")), #> ".")), "\n"), "\n", list("\n", "These functions create new environments.\n", #> list("\n", list(), " ", list("env()"), " creates a child of the current environment by default\n", #> "and takes a variable number of named objects to populate it.\n", #> list(), " ", list("new_environment()"), " creates a child of the empty environment by\n", #> "default and takes a named list of objects to populate it.\n"), #> "\n"), "\n", list(list("Environments as objects"), #> list("\n", "\n", "\n", "Environments are containers of uniquely named objects. Their most\n", #> "common use is to provide a scope for the evaluation of R\n", #> "expressions. Not all languages have first class environments,\n", #> "i.e. can manipulate scope as regular objects. Reification of scope\n", #> "is one of the most powerful features of R as it allows you to change\n", #> "what objects a function or expression sees when it is evaluated.\n", #> "\n", "Environments also constitute a data structure in their own\n", #> "right. They are a collection of uniquely named objects, subsettable\n", #> "by name and modifiable by reference. This latter property (see\n", #> "section on reference semantics) is especially useful for creating\n", #> "mutable OO systems (cf the ", list(list( #> "https://github.com/r-lib/R6"), list("R6 package")), #> "\n", "and the ", list(list("https://ggplot2.tidyverse.org/articles/extending-ggplot2.html"), #> list("ggproto system")), "\n", "for extending ggplot2).\n")), #> "\n", "\n", list(list("Inheritance"), list("\n", #> "\n", "\n", "All R environments (except the ", #> list("empty environment"), ") are\n", "defined with a parent environment. An environment and its\n", #> "grandparents thus form a linear hierarchy that is the basis for\n", #> list(list("https://en.wikipedia.org/wiki/Scope_(computer_science)"), #> list("lexical scoping")), " in\n", "R. When R evaluates an expression, it looks up symbols in a given\n", #> "environment. If it cannot find these symbols there, it keeps\n", #> "looking them up in parent environments. This way, objects defined\n", #> "in child environments have precedence over objects defined in\n", #> "parent environments.\n", "\n", "The ability of overriding specific definitions is used in the\n", #> "tidyeval framework to create powerful domain-specific grammars. A\n", #> "common use of masking is to put data frame columns in scope. See\n", #> "for example ", list(list("as_data_mask()")), #> ".\n")), "\n", "\n", list(list("Reference semantics"), #> list("\n", "\n", "\n", "Unlike regular objects such as vectors, environments are an\n", #> list("uncopyable"), " object type. This means that if you\n", #> "have multiple references to a given environment (by assigning the\n", #> "environment to another symbol with ", list( #> "<-"), " or passing the environment\n", #> "as argument to a function), modifying the bindings of one of those\n", #> "references changes all other references as well.\n")), #> "\n", "\n", list(list("Life cycle"), list("\n", #> "\n", list("\n", list(), " ", list("child_env()"), #> " is in the questioning stage. It is redundant now\n", #> "that ", list("env()"), " accepts parent environments.\n"), #> "\n")), "\n", "\n", list("\n", "# env() creates a new environment which has the current environment\n", #> "# as parent\n", "env <- env(a = 1, b = \"foo\")\n", #> "env$b\n", "identical(env_parent(env), current_env())\n", #> "\n", "# Supply one unnamed argument to override the default:\n", #> "env <- env(base_env(), a = 1, b = \"foo\")\n", #> "identical(env_parent(env), base_env())\n", #> "\n", "\n", "# child_env() lets you specify a parent:\n", #> "child <- child_env(env, c = \"bar\")\n", "identical(env_parent(child), env)\n", #> "\n", "# This child environment owns `c` but inherits `a` and `b` from `env`:\n", #> "env_has(child, c(\"a\", \"b\", \"c\", \"d\"))\n", #> "env_has(child, c(\"a\", \"b\", \"c\", \"d\"), inherit = TRUE)\n", #> "\n", "# `parent` is passed to as_environment() to provide handy\n", #> "# shortcuts. Pass a string to create a child of a package\n", #> "# environment:\n", "child_env(\"rlang\")\n", #> "env_parent(child_env(\"rlang\"))\n", "\n", #> "# Or `NULL` to create a child of the empty environment:\n", #> "child_env(NULL)\n", "env_parent(child_env(NULL))\n", #> "\n", "# The base package environment is often a good default choice for a\n", #> "# parent environment because it contains all standard base\n", #> "# functions. Also note that it will never inherit from other loaded\n", #> "# package environments since R keeps the base package at the tail\n", #> "# of the search path:\n", "base_child <- child_env(\"base\")\n", #> "env_has(base_child, c(\"lapply\", \"(\"), inherit = TRUE)\n", #> "\n", "# On the other hand, a child of the empty environment doesn't even\n", #> "# see a definition for `(`\n", "empty_child <- child_env(NULL)\n", #> "env_has(empty_child, c(\"lapply\", \"(\"), inherit = TRUE)\n", #> "\n", "# Note that all other package environments inherit from base_env()\n", #> "# as well:\n", "rlang_child <- child_env(\"rlang\")\n", #> "env_has(rlang_child, \"env\", inherit = TRUE) # rlang function\n", #> "env_has(rlang_child, \"lapply\", inherit = TRUE) # base function\n", #> "\n", "\n", "# Both env() and child_env() support tidy dots features:\n", #> "objs <- list(b = \"foo\", c = \"bar\")\n", #> "env <- env(a = 1, !!! objs)\n", "env$c\n", #> "\n", "# You can also unquote names with the definition operator `:=`\n", #> "var <- \"a\"\n", "env <- env(!!var := \"A\")\n", #> "env$a\n", "\n", "\n", "# Use new_environment() to create containers with the empty\n", #> "# environment as parent:\n", "env <- new_environment()\n", #> "env_parent(env)\n", "\n", "# Like other new_ constructors, it takes an object rather than dots:\n", #> "new_environment(list(a = \"foo\", b = \"bar\"))\n"), #> "\n", list("\n", list(list("env_has()")), ", ", #> list(list("env_bind()")), ".\n"), "\n"), env_bind.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_bind"), "\n", list("env_bind"), #> "\n", list("env_bind_lazy"), "\n", list("env_bind_active"), #> "\n", list("%<~%"), "\n", list("Bind symbols to objects in an environment"), #> "\n", list("\n", "env_bind(.env, ...)\n", "\n", #> "env_bind_lazy(.env, ..., .eval_env = caller_env())\n", #> "\n", "env_bind_active(.env, ...)\n", "\n", #> "lhs %<~% rhs\n"), "\n", list("\n", list(list( #> ".env"), list("An environment.")), "\n", "\n", #> list(list("..."), list("<", list("dynamic"), #> "> Named objects (", list("env_bind()"), #> "),\n", "expressions ", list("env_bind_lazy()"), #> ", or functions (", list("env_bind_active()"), #> ").\n", "Use ", list(list("zap()")), " to remove bindings.")), #> "\n", "\n", list(list(".eval_env"), list("The environment where the expressions will be\n", #> "evaluated when the symbols are forced.")), #> "\n", "\n", list(list("lhs"), list("The variable name to which ", #> list("rhs"), " will be lazily assigned.")), #> "\n", "\n", list(list("rhs"), list("An expression lazily evaluated and assigned to ", #> list("lhs"), ".")), "\n"), "\n", list("\n", #> "The input object ", list(".env"), ", with its associated environment\n", #> "modified in place, invisibly.\n"), "\n", list( #> "\n", "These functions create bindings in an environment. The bindings are\n", #> "supplied through ", list("..."), " as pairs of names and values or expressions.\n", #> list("env_bind()"), " is equivalent to evaluating a ", #> list("<-"), " expression within\n", "the given environment. This function should take care of the\n", #> "majority of use cases but the other variants can be useful for\n", #> "specific problems.\n", list("\n", list(), #> " ", list("env_bind()"), " takes named ", #> list("values"), " which are bound in ", list( #> ".env"), ".\n", list("env_bind()"), " is equivalent to ", #> list(list("base::assign()")), ".\n", list(), #> " ", list("env_bind_active()"), " takes named ", #> list("functions"), " and creates active\n", #> "bindings in ", list(".env"), ". This is equivalent to\n", #> list(list("base::makeActiveBinding()")), #> ". An active binding executes a\n", "function each time it is evaluated. The arguments are passed to\n", #> list(list("as_function()")), " so you can supply formulas instead of functions.\n", #> "\n", "Remember that functions are scoped in their own environment.\n", #> "These functions can thus refer to symbols from this enclosure\n", #> "that are not actually in scope in the dynamic environment where\n", #> "the active bindings are invoked. This allows creative solutions\n", #> "to difficult problems (see the implementations of ", #> list("dplyr::do()"), "\n", "methods for an example).\n", #> list(), " ", list("env_bind_lazy()"), " takes named ", #> list("expressions"), ". This is equivalent\n", #> "to ", list(list("base::delayedAssign()")), #> ". The arguments are captured with\n", list( #> list("exprs()")), " (and thus support call-splicing and unquoting) and\n", #> "assigned to symbols in ", list(".env"), #> ". These expressions are not\n", "evaluated immediately but lazily. Once a symbol is evaluated, the\n", #> "corresponding expression is evaluated in turn and its value is\n", #> "bound to the symbol (the expressions are thus evaluated only\n", #> "once, if at all).\n", list(), " ", list( #> "%<~%"), " is a shortcut for ", list("env_bind_lazy()"), #> ". It works like ", list("<-"), "\n", "but the RHS is evaluated lazily.\n"), #> "\n"), "\n", list(list("Side effects"), list( #> "\n", "\n", "\n", "Since environments have reference semantics (see relevant section\n", #> "in ", list(list("env()")), " documentation), modifying the bindings of an environment\n", #> "produces effects in all other references to that environment. In\n", #> "other words, ", list("env_bind()"), " and its variants have side effects.\n", #> "\n", "Like other side-effecty functions like ", #> list("par()"), " and ", list("options()"), #> ",\n", list("env_bind()"), " and variants return the old values invisibly.\n")), #> "\n", "\n", list(list("Life cycle"), list("\n", #> "\n", "\n", "Passing an environment wrapper like a formula or a function instead\n", #> "of an environment is soft-deprecated as of rlang 0.3.0. This\n", #> "internal genericity was causing confusion (see issue #427). You\n", #> "should now extract the environment separately before calling these\n", #> "functions.\n")), "\n", "\n", list("\n", "# env_bind() is a programmatic way of assigning values to symbols\n", #> "# with `<-`. We can add bindings in the current environment:\n", #> "env_bind(current_env(), foo = \"bar\")\n", #> "foo\n", "\n", "# Or modify those bindings:\n", #> "bar <- \"bar\"\n", "env_bind(current_env(), bar = \"BAR\")\n", #> "bar\n", "\n", "# You can remove bindings by supplying zap sentinels:\n", #> "env_bind(current_env(), foo = zap())\n", "try(foo)\n", #> "\n", "# Unquote-splice a named list of zaps\n", #> "zaps <- rep_named(c(\"foo\", \"bar\"), list(zap()))\n", #> "env_bind(current_env(), !!!zaps)\n", "try(bar)\n", #> "\n", "# It is most useful to change other environments:\n", #> "my_env <- env()\n", "env_bind(my_env, foo = \"foo\")\n", #> "my_env$foo\n", "\n", "# A useful feature is to splice lists of named values:\n", #> "vals <- list(a = 10, b = 20)\n", "env_bind(my_env, !!!vals, c = 30)\n", #> "my_env$b\n", "my_env$c\n", "\n", "# You can also unquote a variable referring to a symbol or a string\n", #> "# as binding name:\n", "var <- \"baz\"\n", #> "env_bind(my_env, !!var := \"BAZ\")\n", "my_env$baz\n", #> "\n", "\n", "# The old values of the bindings are returned invisibly:\n", #> "old <- env_bind(my_env, a = 1, b = 2, baz = \"baz\")\n", #> "old\n", "\n", "# You can restore the original environment state by supplying the\n", #> "# old values back:\n", "env_bind(my_env, !!!old)\n", #> "\n", "# env_bind_lazy() assigns expressions lazily:\n", #> "env <- env()\n", "env_bind_lazy(env, name = { cat(\"forced!\\n\"); \"value\" })\n", #> "\n", "# Referring to the binding will cause evaluation:\n", #> "env$name\n", "\n", "# But only once, subsequent references yield the final value:\n", #> "env$name\n", "\n", "# You can unquote expressions:\n", #> "expr <- quote(message(\"forced!\"))\n", "env_bind_lazy(env, name = !!expr)\n", #> "env$name\n", "\n", "\n", "# By default the expressions are evaluated in the current\n", #> "# environment. For instance we can create a local binding and refer\n", #> "# to it, even though the variable is bound in a different\n", #> "# environment:\n", "who <- \"mickey\"\n", #> "env_bind_lazy(env, name = paste(who, \"mouse\"))\n", #> "env$name\n", "\n", "# You can specify another evaluation environment with `.eval_env`:\n", #> "eval_env <- env(who = \"minnie\")\n", "env_bind_lazy(env, name = paste(who, \"mouse\"), .eval_env = eval_env)\n", #> "env$name\n", "\n", "# Or by unquoting a quosure:\n", #> "quo <- local({\n", " who <- \"fievel\"\n", #> " quo(paste(who, \"mouse\"))\n", "})\n", "env_bind_lazy(env, name = !!quo)\n", #> "env$name\n", "\n", "# You can create active bindings with env_bind_active(). Active\n", #> "# bindings execute a function each time they are evaluated:\n", #> "fn <- function() {\n", " cat(\"I have been called\\n\")\n", #> " rnorm(1)\n", "}\n", "\n", "env <- env()\n", #> "env_bind_active(env, symbol = fn)\n", "\n", #> "# `fn` is executed each time `symbol` is evaluated or retrieved:\n", #> "env$symbol\n", "env$symbol\n", "eval_bare(quote(symbol), env)\n", #> "eval_bare(quote(symbol), env)\n", "\n", "# All arguments are passed to as_function() so you can use the\n", #> "# formula shortcut:\n", "env_bind_active(env, foo = ~ runif(1))\n", #> "env$foo\n", "env$foo\n"), "\n", list("\n", #> list(list("env_poke()")), " for binding a single element.\n"), #> "\n"), env_bind_exprs.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("env_bind_exprs"), "\n", list("env_bind_exprs"), #> "\n", list("env_bind_fns"), "\n", list("Bind a promise or active binding"), #> "\n", list("\n", "env_bind_exprs(.env, ..., .eval_env = caller_env())\n", #> "\n", "env_bind_fns(.env, ...)\n"), "\n", list( #> "\n", list(list(".env"), list("An environment.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> Named objects (", list("env_bind()"), #> "),\n", "expressions ", list("env_bind_lazy()"), #> ", or functions (", list("env_bind_active()"), #> ").\n", "Use ", list(list("zap()")), " to remove bindings.")), #> "\n", "\n", list(list(".eval_env"), list("The environment where the expressions will be\n", #> "evaluated when the symbols are forced.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "As of rlang 0.3.0, ", list("env_bind_exprs()"), #> " and ", list("env_bind_fns()"), " have\n", #> "been renamed to ", list(list("env_bind_lazy()")), #> " and ", list(list("env_bind_active()")), " for\n", #> "consistency.\n"), "\n", list("internal"), #> "\n"), env_binding_are_active.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_binding_are_active"), "\n", list( #> "env_binding_are_active"), "\n", list("env_binding_are_lazy"), #> "\n", list("What kind of environment binding?"), #> "\n", list("\n", "env_binding_are_active(env, nms = NULL)\n", #> "\n", "env_binding_are_lazy(env, nms = NULL)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nms"), list("Names of bindings. Defaults to all bindings in ", #> list("env"), ".")), "\n"), "\n", list("\n", #> "A logical vector as long as ", list("nms"), #> " and named after it.\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"experimental\")"), #> "\n"), "\n", list("internal"), "\n"), env_binding_lock.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_binding_lock"), "\n", list("env_binding_lock"), #> "\n", list("env_binding_unlock"), "\n", list( #> "env_binding_are_locked"), "\n", list("Lock or unlock environment bindings"), #> "\n", list("\n", "env_binding_lock(env, nms = NULL)\n", #> "\n", "env_binding_unlock(env, nms = NULL)\n", #> "\n", "env_binding_are_locked(env, nms = NULL)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nms"), list("Names of bindings. Defaults to all bindings in ", #> list("env"), ".")), "\n"), "\n", list("\n", #> list("env_binding_are_unlocked()"), " returns a logical vector as\n", #> "long as ", list("nms"), " and named after it. ", #> list("env_binding_lock()"), " and\n", list( #> "env_binding_unlock()"), " return the old value of\n", #> list("env_binding_are_unlocked()"), " invisibly.\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "Locked environment bindings trigger an error when an attempt is\n", #> "made to redefine the binding.\n"), "\n", list( #> "\n", "# Bindings are unlocked by default:\n", #> "env <- env(a = \"A\", b = \"B\")\n", "env_binding_are_locked(env)\n", #> "\n", "# But can optionally be locked:\n", #> "env_binding_lock(env, \"a\")\n", "env_binding_are_locked(env)\n", #> "\n", "# If run, the following would now return an error because `a` is locked:\n", #> "# env_bind(env, a = \"foo\")\n", "# with_env(env, a <- \"bar\")\n", #> "\n", "# Let's unlock it. Note that the return value indicate which\n", #> "# bindings were locked:\n", "were_locked <- env_binding_unlock(env)\n", #> "were_locked\n", "\n", "# Now that it is unlocked we can modify it again:\n", #> "env_bind(env, a = \"foo\")\n", "with_env(env, a <- \"bar\")\n", #> "env$a\n"), "\n", list("\n", list(list("env_lock()")), #> " for locking an environment.\n"), "\n", list( #> "internal"), "\n"), env_browse.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_browse"), "\n", list("env_browse"), #> "\n", list("env_is_browsed"), "\n", list("Browse environments"), #> "\n", list("\n", "env_browse(env, value = TRUE)\n", #> "\n", "env_is_browsed(env)\n"), "\n", list( #> "\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("value"), list("Whether to browse ", #> list("env"), ".")), "\n"), "\n", list("\n", #> list("env_browse()"), " returns the previous value of\n", #> list("env_is_browsed()"), " (a logical), invisibly.\n"), #> "\n", list("\n", list("\n", list(), " ", list( #> "env_browse(env)"), " is equivalent to evaluating ", #> list("browser()"), " in\n", list("env"), ". It persistently sets the environment for step-debugging.\n", #> "Supply ", list("value = FALSE"), " to disable browsing.\n", #> list(), " ", list("env_is_browsed()"), " is a predicate that inspects whether an\n", #> "environment is being browsed.\n"), "\n"), #> "\n"), env_bury.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("env_bury"), "\n", list("env_bury"), #> "\n", list("Mask bindings by defining symbols deeper in a scope"), #> "\n", list("\n", "env_bury(.env, ...)\n"), "\n", #> list("\n", list(list(".env"), list("An environment.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> Named objects (", list("env_bind()"), #> "),\n", "expressions ", list("env_bind_lazy()"), #> ", or functions (", list("env_bind_active()"), #> ").\n", "Use ", list(list("zap()")), " to remove bindings.")), #> "\n"), "\n", list("\n", "A copy of ", list( #> ".env"), " enclosing the new environment containing\n", #> "bindings to ", list("..."), " arguments.\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"superseded\")"), #> "\n", "\n", "This function is superseded. Please use ", #> list(list("env()")), " (and possibly\n", list( #> list("set_env()")), " if you're masking the bindings for another object like\n", #> "a closure or a formula) instead.\n", "\n", #> list("env_bury()"), " is like ", list(list( #> "env_bind()")), " but it creates the bindings in a\n", #> "new child environment. This makes sure the new bindings have\n", #> "precedence over old ones, without altering existing environments.\n", #> "Unlike ", list("env_bind()"), ", this function does not have side effects and\n", #> "returns a new environment (or object wrapping that environment).\n"), #> "\n", list("\n", "orig_env <- env(a = 10)\n", #> "fn <- set_env(function() a, orig_env)\n", #> "\n", "# fn() currently sees `a` as the value `10`:\n", #> "fn()\n", "\n", "# env_bury() will bury the current scope of fn() behind a new\n", #> "# environment:\n", "fn <- env_bury(fn, a = 1000)\n", #> "fn()\n", "\n", "# Even though the symbol `a` is still defined deeper in the scope:\n", #> "orig_env$a\n"), "\n", list("\n", list(list( #> "env_bind()")), ", ", list(list("env_unbind()")), #> "\n"), "\n", list("internal"), "\n"), env_clone.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_clone"), "\n", list("env_clone"), #> "\n", list("Clone an environment"), "\n", list( #> "\n", "env_clone(env, parent = env_parent(env))\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("parent"), list("The parent of the cloned environment.")), #> "\n"), "\n", list("\n", "This creates a new environment containing exactly the same objects,\n", #> "optionally with a new parent.\n"), "\n", list( #> "\n", "env <- env(!!! mtcars)\n", "clone <- env_clone(env)\n", #> "identical(env, clone)\n", "identical(env$cyl, clone$cyl)\n"), #> "\n"), env_depth.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_depth"), "\n", list("env_depth"), #> "\n", list("Depth of an environment chain"), #> "\n", list("\n", "env_depth(env)\n"), "\n", list( #> "\n", list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "An integer.\n"), "\n", #> list("\n", "This function returns the number of environments between ", #> list("env"), " and\n", "the ", list("empty environment"), #> ", including ", list("env"), ". The depth of\n", #> list("env"), " is also the number of parents of ", #> list("env"), " (since the empty\n", "environment counts as a parent).\n"), #> "\n", list("\n", "env_depth(empty_env())\n", #> "env_depth(pkg_env(\"rlang\"))\n"), "\n", list( #> "\n", "The section on inheritance in ", list( #> list("env()")), " documentation.\n"), "\n"), #> env_get.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_get"), "\n", list("env_get"), #> "\n", list("env_get_list"), "\n", list("Get an object in an environment"), #> "\n", list("\n", "env_get(env = caller_env(), nm, default, inherit = FALSE)\n", #> "\n", "env_get_list(env = caller_env(), nms, default, inherit = FALSE)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nm, nms"), list("Names of bindings. ", #> list("nm"), " must be a single string.")), #> "\n", "\n", list(list("default"), list("A default value in case there is no binding for ", #> list("nm"), "\n", "in ", list("env"), ".")), #> "\n", "\n", list(list("inherit"), list("Whether to look for bindings in the parent\n", #> "environments.")), "\n"), "\n", list("\n", #> "An object if it exists. Otherwise, throws an error.\n"), #> "\n", list("\n", list("env_get()"), " extracts an object from an enviroment ", #> list("env"), ". By\n", "default, it does not look in the parent environments.\n", #> list("env_get_list()"), " extracts multiple objects from an environment into\n", #> "a named list.\n"), "\n", list("\n", "parent <- child_env(NULL, foo = \"foo\")\n", #> "env <- child_env(parent, bar = \"bar\")\n", #> "\n", "# This throws an error because `foo` is not directly defined in env:\n", #> "# env_get(env, \"foo\")\n", "\n", "# However `foo` can be fetched in the parent environment:\n", #> "env_get(env, \"foo\", inherit = TRUE)\n", #> "\n", "# You can also avoid an error by supplying a default value:\n", #> "env_get(env, \"foo\", default = \"FOO\")\n"), #> "\n"), env_has.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_has"), "\n", list("env_has"), #> "\n", list("Does an environment have or see bindings?"), #> "\n", list("\n", "env_has(env = caller_env(), nms, inherit = FALSE)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nms"), list("A character vector of binding names for which to check\n", #> "existence.")), "\n", "\n", list(list("inherit"), #> list("Whether to look for bindings in the parent\n", #> "environments.")), "\n"), "\n", list("\n", #> "A named logical vector as long as ", list( #> "nms"), ".\n"), "\n", list("\n", list("env_has()"), #> " is a vectorised predicate that queries whether an\n", #> "environment owns bindings personally (with ", #> list("inherit"), " set to\n", list("FALSE"), #> ", the default), or sees them in its own environment or in\n", #> "any of its parents (with ", list("inherit = TRUE"), #> ").\n"), "\n", list("\n", "parent <- child_env(NULL, foo = \"foo\")\n", #> "env <- child_env(parent, bar = \"bar\")\n", #> "\n", "# env does not own `foo` but sees it in its parent environment:\n", #> "env_has(env, \"foo\")\n", "env_has(env, \"foo\", inherit = TRUE)\n"), #> "\n"), env_inherits.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_inherits"), "\n", list("env_inherits"), #> "\n", list("Does environment inherit from another environment?"), #> "\n", list("\n", "env_inherits(env, ancestor)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("ancestor"), list("Another environment from which ", #> list("x"), " might inherit.")), "\n"), "\n", #> list("\n", "This returns ", list("TRUE"), " if ", #> list("x"), " has ", list("ancestor"), " among its parents.\n"), #> "\n"), env_lock.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_lock"), "\n", list("env_lock"), #> "\n", list("env_is_locked"), "\n", list("Lock an environment"), #> "\n", list("\n", "env_lock(env)\n", "\n", "env_is_locked(env)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "The old value of ", #> list("env_is_locked()"), " invisibly.\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "Locked environments cannot be modified. An important example is\n", #> "namespace environments which are locked by R when loaded in a\n", #> "session. Once an environment is locked it normally cannot be\n", #> "unlocked.\n", "\n", "Note that only the environment as a container is locked, not the\n", #> "individual bindings. You can't remove or add a binding but you can\n", #> "still modify the values of existing bindings. See\n", #> list(list("env_binding_lock()")), " for locking individual bindings.\n"), #> "\n", list("\n", "# New environments are unlocked by default:\n", #> "env <- env(a = 1)\n", "env_is_locked(env)\n", #> "\n", "# Use env_lock() to lock them:\n", "env_lock(env)\n", #> "env_is_locked(env)\n", "\n", "# Now that `env` is locked, it is no longer possible to remove or\n", #> "# add bindings. If run, the following would fail:\n", #> "# env_unbind(env, \"a\")\n", "# env_bind(env, b = 2)\n", #> "\n", "# Note that even though the environment as a container is locked,\n", #> "# the individual bindings are still unlocked and can be modified:\n", #> "env$a <- 10\n"), "\n", list("\n", list(list( #> "env_binding_lock()")), "\n"), "\n", list("internal"), #> "\n"), env_name.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("env_name"), "\n", list("env_name"), #> "\n", list("env_label"), "\n", list("Label of an environment"), #> "\n", list("\n", "env_name(env)\n", "\n", "env_label(env)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "Special environments like the global environment have their own\n", #> "names. ", list("env_name()"), " returns:\n", #> list("\n", list(), " \"global\" for the global environment.\n", #> list(), " \"empty\" for the empty environment.\n", #> list(), " \"base\" for the base package environment (the last environment on\n", #> "the search path).\n", list(), " \"namespace:pkg\" if ", #> list("env"), " is the namespace of the package \"pkg\".\n", #> list(), " The ", list("name"), " attribute of ", #> list("env"), " if it exists. This is how the\n", #> list("package environments"), " and the ", #> list("imports environments"), " store their names. The name of package\n", #> "environments is typically \"package:pkg\".\n", #> list(), " The empty string ", list("\"\""), #> " otherwise.\n"), "\n", "\n", list("env_label()"), #> " is exactly like ", list("env_name()"), " but returns the memory\n", #> "address of anonymous environments as fallback.\n"), #> "\n", list("\n", "# Some environments have specific names:\n", #> "env_name(global_env())\n", "env_name(ns_env(\"rlang\"))\n", #> "\n", "# Anonymous environments don't have names but are labelled by their\n", #> "# address in memory:\n", "env_name(env())\n", #> "env_label(env())\n"), "\n"), env_names.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_names"), "\n", list("env_names"), #> "\n", list("env_length"), "\n", list("Names and numbers of symbols bound in an environment"), #> "\n", list("\n", "env_names(env)\n", "\n", "env_length(env)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "A character vector of object names.\n"), #> "\n", list("\n", list("env_names()"), " returns object names from an enviroment ", #> list("env"), " as a\n", "character vector. All names are returned, even those starting with\n", #> "a dot. ", list("env_length()"), " returns the number of bindings.\n"), #> "\n", list(list("Names of symbols and objects"), #> list("\n", "\n", "\n", "Technically, objects are bound to symbols rather than strings,\n", #> "since the R interpreter evaluates symbols (see ", #> list(list("is_expression()")), " for a\n", #> "discussion of symbolic objects versus literal objects). However it\n", #> "is often more convenient to work with strings. In rlang\n", #> "terminology, the string corresponding to a symbol is called the\n", #> list("name"), " of the symbol (or by extension the name of an object bound\n", #> "to a symbol).\n")), "\n", "\n", list(list( #> "Encoding"), list("\n", "\n", "\n", "There are deep encoding issues when you convert a string to symbol\n", #> "and vice versa. Symbols are ", list("always"), #> " in the native encoding. If\n", "that encoding (let's say latin1) cannot support some characters,\n", #> "these characters are serialised to ASCII. That's why you sometimes\n", #> "see strings looking like ", list("<U+1234>"), #> ", especially if you're running\n", "Windows (as R doesn't support UTF-8 as native encoding on that\n", #> "platform).\n", "\n", "To alleviate some of the encoding pain, ", #> list("env_names()"), " always\n", "returns a UTF-8 character vector (which is fine even on Windows)\n", #> "with ASCII unicode points translated back to UTF-8.\n")), #> "\n", "\n", list("\n", "env <- env(a = 1, b = 2)\n", #> "env_names(env)\n"), "\n"), env_parent.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_parent"), "\n", list("env_parent"), #> "\n", list("env_tail"), "\n", list("env_parents"), #> "\n", list("Get parent environments"), "\n", #> list("\n", "env_parent(env = caller_env(), n = 1)\n", #> "\n", "env_tail(env = caller_env(), last = global_env())\n", #> "\n", "env_parents(env = caller_env(), last = global_env())\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("n"), list("The number of generations to go up.")), #> "\n", "\n", list(list("last"), list("The environment at which to stop. Defaults to the\n", #> "global environment. The empty environment is always a stopping\n", #> "condition so it is safe to leave the default even when taking the\n", #> "tail or the parents of an environment on the search path.\n", #> "\n", list("env_tail()"), " returns the environment which has ", #> list("last"), " as parent\n", "and ", list( #> "env_parents()"), " returns the list of environments up to ", #> list("last"), ".")), "\n"), "\n", list("\n", #> "An environment for ", list("env_parent()"), #> " and ", list("env_tail()"), ", a list\n", #> "of environments for ", list("env_parents()"), #> ".\n"), "\n", list("\n", list("\n", list(), #> " ", list("env_parent()"), " returns the parent environment of ", #> list("env"), " if called\n", "with ", list( #> "n = 1"), ", the grandparent with ", list( #> "n = 2"), ", etc.\n", list(), " ", list("env_tail()"), #> " searches through the parents and returns the one\n", #> "which has ", list(list("empty_env()")), " as parent.\n", #> list(), " ", list("env_parents()"), " returns the list of all parents, including the\n", #> "empty environment. This list is named using ", #> list(list("env_name()")), ".\n"), "\n", "\n", #> "See the section on ", list("inheritance"), #> " in ", list(list("env()")), "'s documentation.\n"), #> "\n", list("\n", "# Get the parent environment with env_parent():\n", #> "env_parent(global_env())\n", "\n", "# Or the tail environment with env_tail():\n", #> "env_tail(global_env())\n", "\n", "# By default, env_parent() returns the parent environment of the\n", #> "# current evaluation frame. If called at top-level (the global\n", #> "# frame), the following two expressions are equivalent:\n", #> "env_parent()\n", "env_parent(base_env())\n", #> "\n", "# This default is more handy when called within a function. In this\n", #> "# case, the enclosure environment of the function is returned\n", #> "# (since it is the parent of the evaluation frame):\n", #> "enclos_env <- env()\n", "fn <- set_env(function() env_parent(), enclos_env)\n", #> "identical(enclos_env, fn())\n"), "\n"), env_poke.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_poke"), "\n", list("env_poke"), #> "\n", list("Poke an object in an environment"), #> "\n", list("\n", "env_poke(env = caller_env(), nm, value, inherit = FALSE, create = !inherit)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nm"), list("Names of bindings. ", #> list("nm"), " must be a single string.")), #> "\n", "\n", list(list("value"), list("The value for a new binding.")), #> "\n", "\n", list(list("inherit"), list("Whether to look for bindings in the parent\n", #> "environments.")), "\n", "\n", list(list( #> "create"), list("Whether to create a binding if it does not already\n", #> "exist in the environment.")), "\n"), "\n", #> list("\n", "The old value of ", list("nm"), " or a ", #> list("zap sentinel"), " if the\n", "binding did not exist yet.\n"), #> "\n", list("\n", list("env_poke()"), " will assign or reassign a binding in ", #> list("env"), " if ", list("create"), "\n", #> "is ", list("TRUE"), ". If ", list("create"), #> " is ", list("FALSE"), " and a binding does not already\n", #> "exists, an error is issued.\n"), "\n", list( #> "\n", "If ", list("inherit"), " is ", list( #> "TRUE"), ", the parents environments are checked for\n", #> "an existing binding to reassign. If not found and ", #> list("create"), " is\n", list("TRUE"), ", a new binding is created in ", #> list("env"), ". The default value for\n", list( #> "create"), " is a function of ", list("inherit"), #> ": ", list("FALSE"), " when inheriting,\n", #> list("TRUE"), " otherwise.\n", "\n", "This default makes sense because the inheriting case is mostly\n", #> "for overriding an existing binding. If not found, something\n", #> "probably went wrong and it is safer to issue an error. Note that\n", #> "this is different to the base R operator ", #> list("<<-"), " which will create\n", "a binding in the global environment instead of the current\n", #> "environment when no existing binding is found in the parents.\n"), #> "\n", list("\n", list(list("env_bind()")), " for binding multiple elements.\n"), #> "\n"), env_print.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_print"), "\n", list("env_print"), #> "\n", list("Pretty-print an environment"), "\n", #> list("\n", "env_print(env = caller_env())\n"), #> "\n", list("\n", list(list("env"), list("An environment, or object that can be converted to an\n", #> "environment by ", list(list("get_env()")), #> ".")), "\n"), "\n", list("\n", "This prints:\n", #> list("\n", list(), " The ", list("label"), #> " and the parent label.\n", list(), " Whether the environment is ", #> list("locked"), ".\n", list(), " The bindings in the environment (up to 20 bindings). They are\n", #> "printed succintly using ", list("pillar::type_sum()"), #> " (if available,\n", "otherwise uses an internal version of that generic). In addition\n", #> list("fancy bindings"), " (actives and promises) are\n", #> "indicated as such.\n", list(), " Locked bindings get a ", #> list("[L]"), " tag\n"), "\n", "\n", "Note that printing a package namespace (see ", #> list(list("ns_env()")), ") with\n", list("env_print()"), #> " will typically tag function bindings as ", #> list("<lazy>"), "\n", "until they are evaluated the first time. This is because package\n", #> "functions are lazily-loaded from disk to improve performance when\n", #> "loading a package.\n"), "\n"), env_unbind.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_unbind"), "\n", list("env_unbind"), #> "\n", list("Remove bindings from an environment"), #> "\n", list("\n", "env_unbind(env = caller_env(), nms, inherit = FALSE)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nms"), list("A character vector of binding names to remove.")), #> "\n", "\n", list(list("inherit"), list("Whether to look for bindings in the parent\n", #> "environments.")), "\n"), "\n", list("\n", #> "The input object ", list("env"), " with its associated environment\n", #> "modified in place, invisibly.\n"), "\n", list( #> "\n", list("env_unbind()"), " is the complement of ", #> list(list("env_bind()")), ". Like ", list("env_has()"), #> ",\n", "it ignores the parent environments of ", #> list("env"), " by default. Set\n", list("inherit"), #> " to ", list("TRUE"), " to track down bindings in parent environments.\n"), #> "\n", list("\n", "env <- env(foo = 1, bar = 2)\n", #> "env_has(env, c(\"foo\", \"bar\"))\n", "\n", #> "# Remove bindings with `env_unbind()`\n", #> "env_unbind(env, c(\"foo\", \"bar\"))\n", "env_has(env, c(\"foo\", \"bar\"))\n", #> "\n", "# With inherit = TRUE, it removes bindings in parent environments\n", #> "# as well:\n", "parent <- env(empty_env(), foo = 1, bar = 2)\n", #> "env <- env(parent, foo = \"b\")\n", "\n", #> "env_unbind(env, \"foo\", inherit = TRUE)\n", #> "env_has(env, c(\"foo\", \"bar\"))\n", "env_has(env, c(\"foo\", \"bar\"), inherit = TRUE)\n"), #> "\n"), env_unlock.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_unlock"), "\n", list("env_unlock"), #> "\n", list("Unlock an environment"), "\n", list( #> "\n", "env_unlock(env)\n"), "\n", list("\n", #> list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "Whether the environment has been unlocked.\n"), #> "\n", list("\n", "This function should only be used in development tools or\n", #> "interactively.\n"), "\n", list("internal"), #> "\n"), eval_bare.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval.R", #> "\n", list("eval_bare"), "\n", list("eval_bare"), #> "\n", list("Evaluate an expression in an environment"), #> "\n", list("\n", "eval_bare(expr, env = parent.frame())\n"), #> "\n", list("\n", list(list("expr"), list("An expression to evaluate.")), #> "\n", "\n", list(list("env"), list("The environment in which to evaluate the expression.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", list("eval_bare()"), " is a lower-level version of function ", #> list(list("base::eval()")), ".\n", "Technically, it is a simple wrapper around the C function\n", #> list("Rf_eval()"), ". You generally don't need to use ", #> list("eval_bare()"), " instead\n", "of ", list( #> "eval()"), ". Its main advantage is that it handles stack-sensitive\n", #> "(calls such as ", list("return()"), ", ", #> list("on.exit()"), " or ", list("parent.frame()"), #> ") more\n", "consistently when you pass an enviroment of a frame on the call\n", #> "stack.\n"), "\n", list("\n", "These semantics are possible because ", #> list("eval_bare()"), " creates only one\n", #> "frame on the call stack whereas ", list("eval()"), #> " creates two frames, the\n", "second of which has the user-supplied environment as frame\n", #> "environment. When you supply an existing frame environment to\n", #> list("base::eval()"), " there will be two frames on the stack with the same\n", #> "frame environment. Stack-sensitive functions only detect the\n", #> "topmost of these frames. We call these evaluation semantics\n", #> "\"stack inconsistent\".\n", "\n", "Evaluating expressions in the actual frame environment has useful\n", #> "practical implications for ", list("eval_bare()"), #> ":\n", list("\n", list(), " ", list("return()"), #> " calls are evaluated in frame environments that might\n", #> "be burried deep in the call stack. This causes a long return that\n", #> "unwinds multiple frames (triggering the ", #> list("on.exit()"), " event for\n", "each frame). By contrast ", #> list("eval()"), " only returns from the ", #> list("eval()"), "\n", "call, one level up.\n", #> list(), " ", list("on.exit()"), ", ", list( #> "parent.frame()"), ", ", list("sys.call()"), #> ", and generally all\n", "the stack inspection functions ", #> list("sys.xxx()"), " are evaluated in the\n", #> "correct frame environment. This is similar to how this type of\n", #> "calls can be evaluated deep in the call stack because of lazy\n", #> "evaluation, when you force an argument that has been passed\n", #> "around several times.\n"), "\n", "\n", "The flip side of the semantics of ", #> list("eval_bare()"), " is that it can't\n", #> "evaluate ", list("break"), " or ", list("next"), #> " expressions even if called within a\n", "loop.\n"), #> "\n", list("\n", "# eval_bare() works just like base::eval() but you have to create\n", #> "# the evaluation environment yourself:\n", #> "eval_bare(quote(foo), env(foo = \"bar\"))\n", #> "\n", "# eval() has different evaluation semantics than eval_bare(). It\n", #> "# can return from the supplied environment even if its an\n", #> "# environment that is not on the call stack (i.e. because you've\n", #> "# created it yourself). The following would trigger an error with\n", #> "# eval_bare():\n", "ret <- quote(return(\"foo\"))\n", #> "eval(ret, env())\n", "# eval_bare(ret, env()) # \"no function to return from\" error\n", #> "\n", "# Another feature of eval() is that you can control surround loops:\n", #> "bail <- quote(break)\n", "while (TRUE) {\n", #> " eval(bail)\n", " # eval_bare(bail) # \"no loop for break/next\" error\n", #> "}\n", "\n", "# To explore the consequences of stack inconsistent semantics, let's\n", #> "# create a function that evaluates `parent.frame()` deep in the call\n", #> "# stack, in an environment corresponding to a frame in the middle of\n", #> "# the stack. For consistency with R's lazy evaluation semantics, we'd\n", #> "# expect to get the caller of that frame as result:\n", #> "fn <- function(eval_fn) {\n", " list(\n", #> " returned_env = middle(eval_fn),\n", " actual_env = current_env()\n", #> " )\n", "}\n", "middle <- function(eval_fn) {\n", #> " deep(eval_fn, current_env())\n", "}\n", #> "deep <- function(eval_fn, eval_env) {\n", #> " expr <- quote(parent.frame())\n", " eval_fn(expr, eval_env)\n", #> "}\n", "\n", "# With eval_bare(), we do get the expected environment:\n", #> "fn(rlang::eval_bare)\n", "\n", "# But that's not the case with base::eval():\n", #> "fn(base::eval)\n"), "\n", list("\n", list( #> list("eval_tidy()")), " for evaluation with data mask and quosure\n", #> "support.\n"), "\n"), eval_tidy.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval-tidy.R", #> "\n", list("eval_tidy"), "\n", list("eval_tidy"), #> "\n", list("Evaluate an expression with quosures and pronoun support"), #> "\n", list("\n", "eval_tidy(expr, data = NULL, env = caller_env())\n"), #> "\n", list("\n", list(list("expr"), list("An expression or quosure to evaluate.")), #> "\n", "\n", list(list("data"), list("A data frame, or named list or vector. Alternatively, a\n", #> "data mask created with ", list(list("as_data_mask()")), #> " or\n", list(list("new_data_mask()")), ". Objects in ", #> list("data"), " have priority over those in\n", #> list("env"), ". See the section about data masking.")), #> "\n", "\n", list(list("env"), list("The environment in which to evaluate ", #> list("expr"), ". This\n", "environment is not applicable for quosures because they have\n", #> "their own environments.")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", list("eval_tidy()"), " is a variant of ", #> list(list("base::eval()")), " that powers the tidy\n", #> "evaluation framework. Like ", list("eval()"), #> " it accepts user data as\n", "argument. Whereas ", #> list("eval()"), " simply transforms the data to an\n", #> "environment, ", list("eval_tidy()"), " transforms it to a ", #> list("data mask"), " with\n", list(list("as_data_mask()")), #> ". Evaluating in a data mask enables the following\n", #> "features:\n", list("\n", list(), " ", list( #> "Quosures"), ". Quosures are expressions bundled with an\n", #> "environment. If ", list("data"), " is supplied, objects in the data mask\n", #> "always have precedence over the quosure environment, i.e. the\n", #> "data masks the environment.\n", list(), #> " ", list("Pronouns"), ". If ", list("data"), #> " is supplied, the ", list(".env"), " and ", #> list(".data"), "\n", "pronouns are installed in the data mask. ", #> list(".env"), " is a reference to\n", "the calling environment and ", #> list(".data"), " refers to the ", list("data"), #> " argument.\n", "These pronouns lets you be explicit about where to find\n", #> "values and throw errors if you try to access non-existent values.\n"), #> "\n"), "\n", list(list("Data masking"), list( #> "\n", "\n", "\n", "Data masking refers to how columns or objects inside ", #> list("data"), " have\n", "priority over objects defined in ", #> list("env"), " (or in the quosure\n", "environment, if applicable). If there is a column ", #> list("var"), " in ", list("data"), "\n", "and an object ", #> list("var"), " in ", list("env"), ", and ", #> list("expr"), " refers to ", list("var"), ", the\n", #> "column has priority:", list("var <- \"this one?\"\n", #> "data <- data.frame(var = rep(\"Or that one?\", 3))\n", #> "\n", "within <- function(data, expr) {\n", #> " eval_tidy(enquo(expr), data)\n", "}\n", #> "\n", "within(data, toupper(var))\n", "#> [1] \"OR THAT ONE?\" \"OR THAT ONE?\" \"OR THAT ONE?\"\n"), #> "\n", "\n", "Because the columns or objects in ", #> list("data"), " are always found first,\n", #> "before objects from ", list("env"), ", we say that the data \"masks\" the\n", #> "environment.\n")), "\n", "\n", list(list("When should eval_tidy() be used instead of eval()?"), #> list("\n", "\n", "\n", list("base::eval()"), #> " is sufficient for simple evaluation. Use\n", #> list("eval_tidy()"), " when you'd like to support expressions referring to\n", #> "the ", list(".data"), " pronoun, or when you need to support quosures.\n", #> "\n", "If you're evaluating an expression captured with quasiquotation\n", #> "support, it is recommended to use ", list( #> "eval_tidy()"), " because users will\n", #> "likely unquote quosures.\n", "\n", "Note that unwrapping a quosure with ", #> list(list("quo_get_expr()")), " does not\n", #> "guarantee that there is no quosures inside the expression. Quosures\n", #> "might be unquoted anywhere. For instance, the following does not\n", #> "work reliably in the presence of nested quosures:", #> list("my_quoting_fn <- function(x) {\n", #> " x <- enquo(x)\n", " expr <- quo_get_expr(x)\n", #> " env <- quo_get_env(x)\n", " eval(expr, env)\n", #> "}\n", "\n", "# Works:\n", "my_quoting_fn(toupper(letters))\n", #> "\n", "# Fails because of a nested quosure:\n", #> "my_quoting_fn(toupper(!!quo(letters)))\n"), #> "\n")), "\n", "\n", list(list("Stack semantics of ", #> list("eval_tidy()")), list("\n", "\n", "\n", #> list("eval_tidy()"), " always evaluates in a data mask, even when ", #> list("data"), " is\n", list("NULL"), ". Because of this, it has different stack semantics than\n", #> list(list("base::eval()")), ":\n", list("\n", #> list(), " Lexical side effects, such as assignment with ", #> list("<-"), ", occur in the\n", "mask rather than ", #> list("env"), ".\n", list(), " Functions that require the evaluation environment to correspond\n", #> "to a frame on the call stack do not work. This is why ", #> list("return()"), "\n", "called from a quosure does not work.\n", #> list(), " The mask environment creates a new branch in the tree\n", #> "representation of backtraces (which you can visualise in a\n", #> list(list("browser()")), " session with ", #> list("lobstr::cst()"), ").\n"), "\n", "\n", #> "See also ", list(list("eval_bare()")), " for more information about these differences.\n")), #> "\n", "\n", list(list("Life cycle"), list("\n", #> "\n", "\n", list("rlang 0.3.0"), "\n", "\n", #> "Passing an environment to ", list("data"), #> " is deprecated. Please construct an\n", "rlang data mask with ", #> list(list("new_data_mask()")), ".\n")), "\n", #> "\n", list("\n", "\n", "# With simple quoted expressions eval_tidy() works the same way as\n", #> "# eval():\n", "apple <- \"apple\"\n", "kiwi <- \"kiwi\"\n", #> "expr <- quote(paste(apple, kiwi))\n", "expr\n", #> "\n", "eval(expr)\n", "eval_tidy(expr)\n", #> "\n", "# Both accept a data mask as argument:\n", #> "data <- list(apple = \"CARROT\", kiwi = \"TOMATO\")\n", #> "eval(expr, data)\n", "eval_tidy(expr, data)\n", #> "\n", "\n", "# In addition eval_tidy() has support for quosures:\n", #> "with_data <- function(data, expr) {\n", " quo <- enquo(expr)\n", #> " eval_tidy(quo, data)\n", "}\n", "with_data(NULL, apple)\n", #> "with_data(data, apple)\n", "with_data(data, list(apple, kiwi))\n", #> "\n", "# Secondly eval_tidy() installs handy pronouns that allow users to\n", #> "# be explicit about where to find symbols:\n", #> "with_data(data, .data$apple)\n", "with_data(data, .env$apple)\n", #> "\n", "\n", "# Note that instead of using `.env` it is often equivalent and may\n", #> "# be preferred to unquote a value. There are two differences. First\n", #> "# unquoting happens earlier, when the quosure is created. Secondly,\n", #> "# subsetting `.env` with the `$` operator may be brittle because\n", #> "# `$` does not look through the parents of the environment.\n", #> "#\n", "# For instance using `.env$name` in a magrittr pipeline is an\n", #> "# instance where this poses problem, because the magrittr pipe\n", #> "# currently (as of v1.5.0) evaluates its operands in a *child* of\n", #> "# the current environment (this child environment is where it\n", #> "# defines the pronoun `.`).\n", list("\n", #> " data %>% with_data(!!kiwi) # \"kiwi\"\n", #> " data %>% with_data(.env$kiwi) # NULL\n"), #> "\n"), "\n", list("\n", list("nse-force"), #> " for the second leg of the tidy evaluation\n", #> "framework.\n"), "\n"), exec.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval.R", #> "\n", list("exec"), "\n", list("exec"), "\n", #> list("Execute a function"), "\n", list("\n", #> "exec(.fn, ..., .env = caller_env())\n"), "\n", #> list("\n", list(list(".fn"), list("A function, or function name as a string.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> Arguments for ", list(".fn"), #> ".")), "\n", "\n", list(list(".env"), list( #> "Environment in which to evaluate the call. This will be\n", #> "most useful if ", list("f"), " is a string, or the function has side-effects.")), #> "\n"), "\n", list("\n", "This function constructs and evaluates a call to ", #> list(".fn"), ".\n", "It has two primary uses:\n", #> list("\n", list(), " To call a function with arguments stored in a list (if the\n", #> "function doesn't support ", list("dynamic dots"), #> "). Splice the\n", "list of arguments with ", #> list("!!!"), ".\n", list(), " To call every function stored in a list (in conjunction with ", #> list("map()"), "/\n", list(list("lapply()")), #> ")\n"), "\n"), "\n", list("\n", "args <- list(x = c(1:10, 100, NA), na.rm = TRUE)\n", #> "exec(\"mean\", !!!args)\n", "exec(\"mean\", !!!args, trim = 0.2)\n", #> "\n", "fs <- list(a = function() \"a\", b = function() \"b\")\n", #> "lapply(fs, exec)\n", "\n", "# Compare to do.call it will not automatically inline expressions\n", #> "# into the evaluated call.\n", "x <- 10\n", #> "args <- exprs(x1 = x + 1, x2 = x * 2)\n", #> "exec(list, !!!args)\n", "do.call(list, args)\n", #> "\n", "# exec() is not designed to generate pretty function calls. This is\n", #> "# most easily seen if you call a function that captures the call:\n", #> "f <- disp ~ cyl\n", "exec(\"lm\", f, data = mtcars)\n", #> "\n", "# If you need finer control over the generated call, you'll need to\n", #> "# construct it yourself. This may require creating a new environment\n", #> "# with carefully constructed bindings\n", #> "data_env <- env(data = mtcars)\n", "eval(expr(lm(!!f, data)), data_env)\n"), #> "\n"), exiting.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("exiting"), "\n", list("exiting"), #> "\n", list("Exiting handler"), "\n", list("\n", #> "exiting(handler)\n"), "\n", list("\n", list( #> "rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", "\n", list("exiting()"), " is no longer necessary as handlers are exiting by default.\n"), #> "\n", list("internal"), "\n"), expr_interp.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/nse-force.R", #> "\n", list("expr_interp"), "\n", list("expr_interp"), #> "\n", list("Process unquote operators in a captured expression"), #> "\n", list("\n", "expr_interp(x, env = NULL)\n"), #> "\n", list("\n", list(list("x"), list("A function, raw expression, or formula to interpolate.")), #> "\n", "\n", list(list("env"), list("The environment in which unquoted expressions should be\n", #> "evaluated. By default, the formula or closure environment if a\n", #> "formula or a function, or the current environment otherwise.")), #> "\n"), "\n", list("\n", "While all capturing functions in the tidy evaluation framework\n", #> "perform unquote on capture (most notably ", #> list(list("quo()")), "),\n", list("expr_interp()"), #> " manually processes unquoting operators in\n", #> "expressions that are already captured. ", #> list("expr_interp()"), " should be\n", "called in all user-facing functions expecting a formula as argument\n", #> "to provide the same quasiquotation functionality as NSE functions.\n"), #> "\n", list("\n", "# All tidy NSE functions like quo() unquote on capture:\n", #> "quo(list(!!(1 + 2)))\n", "\n", "# expr_interp() is meant to provide the same functionality when you\n", #> "# have a formula or expression that might contain unquoting\n", #> "# operators:\n", "f <- ~list(!!(1 + 2))\n", #> "expr_interp(f)\n", "\n", "# Note that only the outer formula is unquoted (which is a reason\n", #> "# to use expr_interp() as early as possible in all user-facing\n", #> "# functions):\n", "f <- ~list(~!!(1 + 2), !!(1 + 2))\n", #> "expr_interp(f)\n", "\n", "\n", "# Another purpose for expr_interp() is to interpolate a closure's\n", #> "# body. This is useful to inline a function within another. The\n", #> "# important limitation is that all formal arguments of the inlined\n", #> "# function should be defined in the receiving function:\n", #> "other_fn <- function(x) toupper(x)\n", "\n", #> "fn <- expr_interp(function(x) {\n", " x <- paste0(x, \"_suffix\")\n", #> " !!! body(other_fn)\n", "})\n", "fn\n", "fn(\"foo\")\n"), #> "\n"), expr_label.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/expr.R", #> "\n", list("expr_label"), "\n", list("expr_label"), #> "\n", list("expr_name"), "\n", list("expr_text"), #> "\n", list("Turn an expression to a label"), #> "\n", list("\n", "expr_label(expr)\n", "\n", #> "expr_name(expr)\n", "\n", "expr_text(expr, width = 60L, nlines = Inf)\n"), #> "\n", list("\n", list(list("expr"), list("An expression to labellise.")), #> "\n", "\n", list(list("width"), list("Width of each line.")), #> "\n", "\n", list(list("nlines"), list("Maximum number of lines to extract.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", list("expr_text()"), " turns the expression into a single string, which\n", #> "might be multi-line. ", list("expr_name()"), #> " is suitable for formatting\n", "names. It works best with symbols and scalar types, but also\n", #> "accepts calls. ", list("expr_label()"), " formats the expression nicely for use\n", #> "in messages.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "These functions are in the questioning stage because they are\n", #> "redundant with the ", list("quo_"), " variants and do not handle quosures.\n")), #> "\n", "\n", list("\n", "# To labellise a function argument, first capture it with\n", #> "# substitute():\n", "fn <- function(x) expr_label(substitute(x))\n", #> "fn(x:y)\n", "\n", "# Strings are encoded\n", #> "expr_label(\"a\\nb\")\n", "\n", "# Names and expressions are quoted with ``\n", #> "expr_label(quote(x))\n", "expr_label(quote(a + b + c))\n", #> "\n", "# Long expressions are collapsed\n", #> "expr_label(quote(foo({\n", " 1 + 2\n", " print(x)\n", #> "})))\n"), "\n"), expr_print.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/expr.R", #> "\n", list("expr_print"), "\n", list("expr_print"), #> "\n", list("expr_deparse"), "\n", list("Print an expression"), #> "\n", list("\n", "expr_print(x, width = peek_option(\"width\"))\n", #> "\n", "expr_deparse(x, width = peek_option(\"width\"))\n"), #> "\n", list("\n", list(list("x"), list("An object or expression to print.")), #> "\n", "\n", list(list("width"), list("The width of the deparsed or printed expression.\n", #> "Defaults to the global option ", list("width"), #> ".")), "\n"), "\n", list("\n", list("expr_print()"), #> ", powered by ", list("expr_deparse()"), ", is an alternative\n", #> "printer for R expressions with a few improvements over the base R\n", #> "printer.\n", list("\n", list(), " It colourises ", #> list("quosures"), " according to their environment.\n", #> "Quosures from the global environment are printed normally while\n", #> "quosures from local environments are printed in unique colour (or\n", #> "in italic when all colours are taken).\n", #> list(), " It wraps inlined objects in angular brackets. For instance, an\n", #> "integer vector unquoted in a function call (e.g.\n", #> list("expr(foo(!!(1:3)))"), ") is printed like this: ", #> list("foo(<int: 1L, 2L, 3L>)"), " while by default R prints the code to create that vector:\n", #> list("foo(1:3)"), " which is ambiguous.\n", #> list(), " It respects the width boundary (from the global option ", #> list("width"), ")\n", "in more cases.\n"), #> "\n"), "\n", list("\n", "# It supports any object. Non-symbolic objects are always printed\n", #> "# within angular brackets:\n", "expr_print(1:3)\n", #> "expr_print(function() NULL)\n", "\n", "# Contrast this to how the code to create these objects is printed:\n", #> "expr_print(quote(1:3))\n", "expr_print(quote(function() NULL))\n", #> "\n", "# The main cause of non-symbolic objects in expressions is\n", #> "# quasiquotation:\n", "expr_print(expr(foo(!!(1:3))))\n", #> "\n", "\n", "# Quosures from the global environment are printed normally:\n", #> "expr_print(quo(foo))\n", "expr_print(quo(foo(!!quo(bar))))\n", #> "\n", "# Quosures from local environments are colourised according to\n", #> "# their environments (if you have crayon installed):\n", #> "local_quo <- local(quo(foo))\n", "expr_print(local_quo)\n", #> "\n", "wrapper_quo <- local(quo(bar(!!local_quo, baz)))\n", #> "expr_print(wrapper_quo)\n"), "\n"), exprs_auto_name.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/nse-defuse.R", #> "\n", list("exprs_auto_name"), "\n", list("exprs_auto_name"), #> "\n", list("quos_auto_name"), "\n", list("Ensure that all elements of a list of expressions are named"), #> "\n", list("\n", "exprs_auto_name(exprs, width = NULL, printer = NULL)\n", #> "\n", "quos_auto_name(quos, width = NULL)\n"), #> "\n", list("\n", list(list("exprs"), list("A list of expressions.")), #> "\n", "\n", list(list("width"), list("Deprecated. Maximum width of names.")), #> "\n", "\n", list(list("printer"), list("Deprecated. A function that takes an expression\n", #> "and converts it to a string. This function must take an\n", #> "expression as the first argument and ", #> list("width"), " as the second\n", "argument.")), #> "\n", "\n", list(list("quos"), list("A list of quosures.")), #> "\n"), "\n", list("\n", "This gives default names to unnamed elements of a list of\n", #> "expressions (or expression wrappers such as formulas or\n", #> "quosures). ", list("exprs_auto_name()"), " deparses the expressions with\n", #> list(list("expr_name()")), " by default. ", #> list("quos_auto_name()"), " deparses with\n", #> list(list("quo_name()")), ".\n"), "\n"), f_rhs.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/formula.R", #> "\n", list("f_rhs"), "\n", list("f_rhs"), "\n", #> list("f_rhs<-"), "\n", list("f_lhs"), "\n", list( #> "f_lhs<-"), "\n", list("f_env"), "\n", list( #> "f_env<-"), "\n", list("Get or set formula components"), #> "\n", list("\n", "f_rhs(f)\n", "\n", "f_rhs(x) <- value\n", #> "\n", "f_lhs(f)\n", "\n", "f_lhs(x) <- value\n", #> "\n", "f_env(f)\n", "\n", "f_env(x) <- value\n"), #> "\n", list("\n", list(list("f, x"), list("A formula")), #> "\n", "\n", list(list("value"), list("The value to replace with.")), #> "\n"), "\n", list("\n", list("f_rhs"), " and ", #> list("f_lhs"), " return language objects (i.e. atomic\n", #> "vectors of length 1, a name, or a call). ", #> list("f_env"), " returns an\n", "environment.\n"), #> "\n", list("\n", list("f_rhs"), " extracts the righthand side, ", #> list("f_lhs"), " extracts the lefthand\n", #> "side, and ", list("f_env"), " extracts the environment. All functions throw an\n", #> "error if ", list("f"), " is not a formula.\n"), #> "\n", list("\n", "f_rhs(~ 1 + 2 + 3)\n", "f_rhs(~ x)\n", #> "f_rhs(~ \"A\")\n", "f_rhs(1 ~ 2)\n", "\n", #> "f_lhs(~ y)\n", "f_lhs(x ~ y)\n", "\n", "f_env(~ x)\n"), #> "\n"), f_text.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/formula.R", #> "\n", list("f_text"), "\n", list("f_text"), "\n", #> list("f_name"), "\n", list("f_label"), "\n", #> list("Turn RHS of formula into a string or label"), #> "\n", list("\n", "f_text(x, width = 60L, nlines = Inf)\n", #> "\n", "f_name(x)\n", "\n", "f_label(x)\n"), #> "\n", list("\n", list(list("x"), list("A formula.")), #> "\n", "\n", list(list("width"), list("Width of each line.")), #> "\n", "\n", list(list("nlines"), list("Maximum number of lines to extract.")), #> "\n"), "\n", list("\n", "Equivalent of ", list( #> list("expr_text()")), " and ", list(list("expr_label()")), #> " for formulas.\n"), "\n", list("\n", "f <- ~ a + b + bc\n", #> "f_text(f)\n", "f_label(f)\n", "\n", "# Names a quoted with ``\n", #> "f_label(~ x)\n", "# Strings are encoded\n", #> "f_label(~ \"a\\nb\")\n", "# Long expressions are collapsed\n", #> "f_label(~ foo({\n", " 1 + 2\n", " print(x)\n", #> "}))\n"), "\n"), `faq-options.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/faq.R", #> "\n", list("faq-options"), "\n", list("faq-options"), #> "\n", list("Global options for rlang"), "\n", #> list("\n", "rlang has several options which may be set globally to control\n", #> "behavior. A brief description of each is given here. If any functions\n", #> "are referenced, refer to their documentation for additional details.\n", #> list("\n", list(), " ", list("rlang_interactive"), #> ": A logical value used by ", list(list("is_interactive()")), #> ". This\n", "can be set to ", list("TRUE"), #> " to test interactive behavior in unit tests,\n", #> "for example.\n", list(), " ", list("rlang_backtrace_on_error"), #> ": A character string which controls whether\n", #> "backtraces are displayed with error messages, and the level of\n", #> "detail they print. See ", list("rlang_backtrace_on_error"), #> " for the possible option values.\n", list(), #> " ", list("rlang_trace_format_srcrefs"), #> ": A logical value used to control whether\n", #> "srcrefs are printed as part of the backtrace.\n", #> list(), " ", list("rlang_trace_top_env"), #> ": An environment which will be treated as the\n", #> "top-level environment when printing traces. See ", #> list(list("trace_back()")), "\n", "for examples.\n"), #> "\n"), "\n"), flatten.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-squash.R", #> "\n", list("flatten"), "\n", list("flatten"), #> "\n", list("flatten_lgl"), "\n", list("flatten_int"), #> "\n", list("flatten_dbl"), "\n", list("flatten_cpl"), #> "\n", list("flatten_chr"), "\n", list("flatten_raw"), #> "\n", list("squash"), "\n", list("squash_lgl"), #> "\n", list("squash_int"), "\n", list("squash_dbl"), #> "\n", list("squash_cpl"), "\n", list("squash_chr"), #> "\n", list("squash_raw"), "\n", list("flatten_if"), #> "\n", list("squash_if"), "\n", list("Flatten or squash a list of lists into a simpler vector"), #> "\n", list("\n", "flatten(x)\n", "\n", "flatten_lgl(x)\n", #> "\n", "flatten_int(x)\n", "\n", "flatten_dbl(x)\n", #> "\n", "flatten_cpl(x)\n", "\n", "flatten_chr(x)\n", #> "\n", "flatten_raw(x)\n", "\n", "squash(x)\n", #> "\n", "squash_lgl(x)\n", "\n", "squash_int(x)\n", #> "\n", "squash_dbl(x)\n", "\n", "squash_cpl(x)\n", #> "\n", "squash_chr(x)\n", "\n", "squash_raw(x)\n", #> "\n", "flatten_if(x, predicate = is_spliced)\n", #> "\n", "squash_if(x, predicate = is_spliced)\n"), #> "\n", list("\n", list(list("x"), list("A list to flatten or squash. The contents of the list can\n", #> "be anything for unsuffixed functions ", list( #> "flatten()"), " and ", list("squash()"), #> "\n", "(as a list is returned), but the contents must match the type for\n", #> "the other functions.")), "\n", "\n", list( #> list("predicate"), list("A function of one argument returning whether it\n", #> "should be spliced.")), "\n"), "\n", list( #> "\n", list("flatten()"), " returns a list, ", #> list("flatten_lgl()"), " a logical\n", "vector, ", #> list("flatten_int()"), " an integer vector, ", #> list("flatten_dbl()"), " a\n", "double vector, and ", #> list("flatten_chr()"), " a character vector. Similarly\n", #> "for ", list("squash()"), " and the typed variants (", #> list("squash_lgl()"), " etc).\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", list("flatten()"), " removes one level hierarchy from a list, while\n", #> list("squash()"), " removes all levels. These functions are similar to\n", #> list(list("unlist()")), " but they are type-stable so you always know what the\n", #> "type of the output is.\n"), "\n", list(list( #> "Life cycle"), list("\n", "\n", "\n", "These functions are in the questioning stage. They have slightly\n", #> "different semantics than the flattening functions in purrr and we\n", #> "are currently rethinking our approach to flattening with the new\n", #> "typing facilities of the vctrs package.\n")), #> "\n", "\n", list("\n", "x <- replicate(2, sample(4), simplify = FALSE)\n", #> "x\n", "\n", "flatten(x)\n", "flatten_int(x)\n", #> "\n", "# With flatten(), only one level gets removed at a time:\n", #> "deep <- list(1, list(2, list(3)))\n", "flatten(deep)\n", #> "flatten(flatten(deep))\n", "\n", "# But squash() removes all levels:\n", #> "squash(deep)\n", "squash_dbl(deep)\n", "\n", #> "# The typed flatten functions remove one level and coerce to an atomic\n", #> "# vector at the same time:\n", "flatten_dbl(list(1, list(2)))\n", #> "\n", "# Only bare lists are flattened, but you can splice S3 lists\n", #> "# explicitly:\n", "foo <- set_attrs(list(\"bar\"), class = \"foo\")\n", #> "str(flatten(list(1, foo, list(100))))\n", #> "str(flatten(list(1, splice(foo), list(100))))\n", #> "\n", "# Instead of splicing manually, flatten_if() and squash_if() let\n", #> "# you specify a predicate function:\n", "is_foo <- function(x) inherits(x, \"foo\") || is_bare_list(x)\n", #> "str(flatten_if(list(1, foo, list(100)), is_foo))\n", #> "\n", "# squash_if() does the same with deep lists:\n", #> "deep_foo <- list(1, list(foo, list(foo, 100)))\n", #> "str(deep_foo)\n", "\n", "str(squash(deep_foo))\n", #> "str(squash_if(deep_foo, is_foo))\n"), "\n", #> list("internal"), "\n"), fn_body.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("fn_body"), "\n", list("fn_body"), #> "\n", list("fn_body<-"), "\n", list("Get or set function body"), #> "\n", list("\n", "fn_body(fn = caller_fn())\n", #> "\n", "fn_body(fn) <- value\n"), "\n", list( #> "\n", list(list("fn"), list("A function. It is lookep up in the calling frame if not\n", #> "supplied.")), "\n", "\n", list(list("value"), #> list("New formals or formals names for ", #> list("fn"), ".")), "\n"), "\n", list("\n", #> list("fn_body()"), " is a simple wrapper around ", #> list(list("base::body()")), ". It always\n", #> "returns a ", list("\\{"), " expression and throws an error when the input is a\n", #> "primitive function (whereas ", list("body()"), #> " returns ", list("NULL"), "). The setter\n", #> "version preserves attributes, unlike ", list( #> "body<-"), ".\n"), "\n", list("\n", "# fn_body() is like body() but always returns a block:\n", #> "fn <- function() do()\n", "body(fn)\n", "fn_body(fn)\n", #> "\n", "# It also throws an error when used on a primitive function:\n", #> "try(fn_body(base::list))\n"), "\n"), fn_env.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("fn_env"), "\n", list("fn_env"), "\n", #> list("fn_env<-"), "\n", list("Return the closure environment of a function"), #> "\n", list("\n", "fn_env(fn)\n", "\n", "fn_env(x) <- value\n"), #> "\n", list("\n", list(list("fn, x"), list("A function.")), #> "\n", "\n", list(list("value"), list("A new closure environment for the function.")), #> "\n"), "\n", list("\n", "Closure environments define the scope of functions (see ", #> list(list("env()")), ").\n", "When a function call is evaluated, R creates an evaluation frame\n", #> "(see ", list(list("ctxt_stack()")), ") that inherits from the closure environment.\n", #> "This makes all objects defined in the closure environment and all\n", #> "its parents available to code executed within the function.\n"), #> "\n", list("\n", list("fn_env()"), " returns the closure environment of ", #> list("fn"), ". There is also\n", "an assignment method to set a new closure environment.\n"), #> "\n", list("\n", "env <- child_env(\"base\")\n", #> "fn <- with_env(env, function() NULL)\n", "identical(fn_env(fn), env)\n", #> "\n", "other_env <- child_env(\"base\")\n", #> "fn_env(fn) <- other_env\n", "identical(fn_env(fn), other_env)\n"), #> "\n"), fn_fmls.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("fn_fmls"), "\n", list("fn_fmls"), #> "\n", list("fn_fmls_names"), "\n", list("fn_fmls_syms"), #> "\n", list("fn_fmls<-"), "\n", list("fn_fmls_names<-"), #> "\n", list("Extract arguments from a function"), #> "\n", list("\n", "fn_fmls(fn = caller_fn())\n", #> "\n", "fn_fmls_names(fn = caller_fn())\n", #> "\n", "fn_fmls_syms(fn = caller_fn())\n", "\n", #> "fn_fmls(fn) <- value\n", "\n", "fn_fmls_names(fn) <- value\n"), #> "\n", list("\n", list(list("fn"), list("A function. It is lookep up in the calling frame if not\n", #> "supplied.")), "\n", "\n", list(list("value"), #> list("New formals or formals names for ", list( #> "fn"), ".")), "\n"), "\n", list("\n", list( #> "fn_fmls()"), " returns a named list of formal arguments.\n", #> list("fn_fmls_names()"), " returns the names of the arguments.\n", #> list("fn_fmls_syms()"), " returns formals as a named list of symbols. This\n", #> "is especially useful for forwarding arguments in ", #> list("constructed calls"), ".\n"), "\n", list( #> "\n", "Unlike ", list("formals()"), ", these helpers throw an error with primitive\n", #> "functions instead of returning ", list("NULL"), #> ".\n"), "\n", list("\n", "# Extract from current call:\n", #> "fn <- function(a = 1, b = 2) fn_fmls()\n", #> "fn()\n", "\n", "# fn_fmls_syms() makes it easy to forward arguments:\n", #> "call2(\"apply\", !!! fn_fmls_syms(lapply))\n", #> "\n", "# You can also change the formals:\n", #> "fn_fmls(fn) <- list(A = 10, B = 20)\n", "fn()\n", #> "\n", "fn_fmls_names(fn) <- c(\"foo\", \"bar\")\n", #> "fn()\n"), "\n", list("\n", list(list("call_args()")), #> " and ", list(list("call_args_names()")), "\n"), #> "\n"), format_error_bullets.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-message.R", #> "\n", list("format_error_bullets"), "\n", list( #> "format_error_bullets"), "\n", list("Format bullets for error messages"), #> "\n", list("\n", "format_error_bullets(x)\n"), #> "\n", list("\n", list(list("x"), list("A named character vector of messages. Elements named as\n", #> list("x"), " or ", list("i"), " are prefixed with the corresponding bullet.")), #> "\n"), "\n", list("\n", list("format_error_bullets()"), #> " takes a character vector and returns a single\n", #> "string (or an empty vector if the input is empty). The elements of\n", #> "the input vector are assembled as a list of bullets, depending on\n", #> "their names:\n", list("\n", list(), " Elements named ", #> list("\"i\""), " are bulleted with a blue \"info\" symbol.\n", #> list(), " Elements named ", list("\"x\""), #> " are bulleted with a red \"cross\" symbol.\n", #> list(), " Unnamed elements are bulleted with a \"*\" symbol.\n"), #> "\n", "\n", "This experimental infrastructure is based on the idea that\n", #> "sentences in error messages are best kept short and simple. From\n", #> "this point of view, the best way to present the information is in\n", #> "the ", list(list("cnd_body()")), " method of an error conditon, as a bullet list of\n", #> "simple sentences containing a single clause. The info and cross\n", #> "symbols of the bullets provide hints on how to interpret the bullet\n", #> "relative to the general error issue, which should be supplied as\n", #> list(list("cnd_header()")), ".\n"), "\n"), #> frame_position.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("frame_position"), "\n", list("frame_position"), #> "\n", list("Find the position or distance of a frame on the evaluation stack"), #> "\n", list("\n", "frame_position(frame, from = c(\"global\", \"current\"))\n"), #> "\n", list("\n", list(list("frame"), list("The environment of a frame. Can be any object with a\n", #> list(list("get_env()")), " method. Note that for frame objects, the position from\n", #> "the global frame is simply ", list("frame$pos"), #> ". Alternatively, ", list("frame"), "\n", "can be an integer that represents the position on the stack (and\n", #> "is thus returned as is if ", list("from"), #> " is \"global\".")), "\n", "\n", list(list( #> "from"), list("Whether to compute distance from the global frame (the\n", #> "bottom of the evaluation stack), or from the current frame (the\n", #> "top of the evaluation stack).")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "The frame position on the stack can be computed by counting frames\n", #> "from the global frame (the bottom of the stack, the default) or\n", #> "from the current frame (the top of the stack).\n"), #> "\n", list("\n", "While this function returns the position of the frame on the\n", #> "evaluation stack, it can safely be called with intervening frames\n", #> "as those will be discarded.\n"), "\n", list( #> list("Life cycle"), list("\n", "\n", "\n", #> "These functions are deprecated and replaced by ", #> list(list("trace_back()")), ".\n")), "\n", #> "\n", list("\n", "fn <- function() g(environment())\n", #> "g <- function(env) frame_position(env)\n", #> "\n", "# frame_position() returns the position of the frame on the evaluation stack:\n", #> "fn()\n", "identity(identity(fn()))\n", "\n", #> "# Note that it trims off intervening calls before counting so you\n", #> "# can safely nest it within other calls:\n", #> "g <- function(env) identity(identity(frame_position(env)))\n", #> "fn()\n", "\n", "# You can also ask for the position from the current frame rather\n", #> "# than the global frame:\n", "fn <- function() g(environment())\n", #> "g <- function(env) h(env)\n", "h <- function(env) frame_position(env, from = \"current\")\n", #> "fn()\n"), "\n", list("internal"), "\n"), friendly_type.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("friendly_type"), "\n", list("friendly_type"), #> "\n", list("Format a type for error messages"), #> "\n", list("\n", "friendly_type(type)\n"), "\n", #> list("\n", list(list("type"), list("A type as returned by ", #> list(list("typeof()")), ".")), "\n"), "\n", #> list("\n", "A string of the prettified type, qualified with an\n", #> "indefinite article.\n"), "\n", list("\n", #> "Format a type for error messages\n"), "\n", #> list(list("Life cycle"), list("\n", "\n", list( #> "\n", list(), " ", list("friendly_type()"), #> " is experimental.\n"), "\n")), "\n", "\n", #> list("\n", "friendly_type(\"logical\")\n", "friendly_type(\"integer\")\n", #> "friendly_type(\"string\")\n"), "\n", list( #> "internal"), "\n"), get_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("get_env"), "\n", list("get_env"), #> "\n", list("set_env"), "\n", list("env_poke_parent"), #> "\n", list("Get or set the environment of an object"), #> "\n", list("\n", "get_env(env, default = NULL)\n", #> "\n", "set_env(env, new_env = caller_env())\n", #> "\n", "env_poke_parent(env, new_env)\n"), "\n", #> list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("default"), list("The default environment in case ", #> list("env"), " does not wrap\n", "an environment. If ", #> list("NULL"), " and no environment could be extracted,\n", #> "an error is issued.")), "\n", "\n", list( #> list("new_env"), list("An environment to replace ", #> list("env"), " with.")), "\n"), "\n", list( #> "\n", "These functions dispatch internally with methods for functions,\n", #> "formulas and frames. If called with a missing argument, the\n", #> "environment of the current evaluation frame (see ", #> list(list("ctxt_stack()")), ") is\n", "returned. If you call ", #> list("get_env()"), " with an environment, it acts as\n", #> "the identity function and the environment is simply returned (this\n", #> "helps simplifying code when writing generic functions for\n", #> "environments).\n"), "\n", list("\n", "While ", #> list("set_env()"), " returns a modified copy and does not have side\n", #> "effects, ", list("env_poke_parent()"), " operates changes the environment by\n", #> "side effect. This is because environments are\n", #> list("uncopyable"), ". Be careful not to change environments\n", #> "that you don't own, e.g. a parent environment of a function from a\n", #> "package.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", list("\n", list(), " Using ", #> list("get_env()"), " without supplying ", #> list("env"), " is deprecated as\n", "of rlang 0.3.0. Please use ", #> list(list("current_env()")), " to retrieve the\n", #> "current environment.\n", list(), " Passing environment wrappers like formulas or functions instead\n", #> "of bare environments is deprecated as of rlang 0.3.0. This\n", #> "internal genericity was causing confusion (see issue #427). You\n", #> "should now extract the environment separately before calling\n", #> "these functions.\n"), "\n")), "\n", "\n", #> list("\n", "# Environment of closure functions:\n", #> "fn <- function() \"foo\"\n", "get_env(fn)\n", #> "\n", "# Or of quosures or formulas:\n", "get_env(~foo)\n", #> "get_env(quo(foo))\n", "\n", "\n", "# Provide a default in case the object doesn't bundle an environment.\n", #> "# Let's create an unevaluated formula:\n", #> "f <- quote(~foo)\n", "\n", "# The following line would fail if run because unevaluated formulas\n", #> "# don't bundle an environment (they didn't have the chance to\n", #> "# record one yet):\n", "# get_env(f)\n", "\n", #> "# It is often useful to provide a default when you're writing\n", #> "# functions accepting formulas as input:\n", #> "default <- env()\n", "identical(get_env(f, default), default)\n", #> "\n", "# set_env() can be used to set the enclosure of functions and\n", #> "# formulas. Let's create a function with a particular environment:\n", #> "env <- child_env(\"base\")\n", "fn <- set_env(function() NULL, env)\n", #> "\n", "# That function now has `env` as enclosure:\n", #> "identical(get_env(fn), env)\n", "identical(get_env(fn), current_env())\n", #> "\n", "# set_env() does not work by side effect. Setting a new environment\n", #> "# for fn has no effect on the original function:\n", #> "other_env <- child_env(NULL)\n", "set_env(fn, other_env)\n", #> "identical(get_env(fn), other_env)\n", "\n", #> "# Since set_env() returns a new function with a different\n", #> "# environment, you'll need to reassign the result:\n", #> "fn <- set_env(fn, other_env)\n", "identical(get_env(fn), other_env)\n"), #> "\n", list("\n", list(list("quo_get_env()")), #> " and ", list(list("quo_set_env()")), " for versions of\n", #> list(list("get_env()")), " and ", list(list( #> "set_env()")), " that only work on quosures.\n"), #> "\n"), has_length.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("has_length"), "\n", list("has_length"), #> "\n", list("How long is an object?"), "\n", list( #> "\n", "has_length(x, n = NULL)\n"), "\n", list( #> "\n", list(list("x"), list("A R object.")), #> "\n", "\n", list(list("n"), list("A specific length to test ", #> list("x"), " with. If ", list("NULL"), ",\n", #> list("has_length()"), " returns ", list("TRUE"), #> " if ", list("x"), " has length greater than\n", #> "zero, and ", list("FALSE"), " otherwise.")), #> "\n"), "\n", list("\n", "This is a function for the common task of testing the length of an\n", #> "object. It checks the length of an object in a non-generic way:\n", #> list(list("base::length()")), " methods are ignored.\n"), #> "\n", list("\n", "has_length(list())\n", "has_length(list(), 0)\n", #> "\n", "has_length(letters)\n", "has_length(letters, 20)\n", #> "has_length(letters, 26)\n"), "\n", list("internal"), #> "\n"), has_name.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("has_name"), "\n", list("has_name"), #> "\n", list("Does an object have an element with this name?"), #> "\n", list("\n", "has_name(x, name)\n"), "\n", #> list("\n", list(list("x"), list("A data frame or another named object")), #> "\n", "\n", list(list("name"), list("Element name(s) to check")), #> "\n"), "\n", list("\n", "A logical vector of the same length as ", #> list("name"), "\n"), "\n", list("\n", "This function returns a logical value that indicates if a data\n", #> "frame or another named object contains an element with a specific\n", #> "name. Note that ", list("has_name()"), " only works with vectors. For instance,\n", #> "environments need the specialised function ", #> list(list("env_has()")), ".\n"), "\n", list( #> "\n", "Unnamed objects are treated as if all names are empty strings. ", #> list("NA"), "\n", "input gives ", list("FALSE"), #> " as output.\n"), "\n", list("\n", "has_name(iris, \"Species\")\n", #> "has_name(mtcars, \"gears\")\n"), "\n"), hash.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/hash.R", #> "\n", list("hash"), "\n", list("hash"), "\n", #> list("Hash an object"), "\n", list("\n", "hash(x)\n"), #> "\n", list("\n", list(list("x"), list("An object.")), #> "\n"), "\n", list("\n", list("hash()"), " hashes an arbitrary R object.\n", #> "\n", "The generated hash is guaranteed to be reproducible across platforms, but\n", #> "not across R versions.\n"), "\n", list("\n", #> list("hash()"), " uses the XXH128 hash algorithm of the xxHash library, which\n", #> "generates a 128-bit hash. It is implemented as a streaming hash, which\n", #> "generates the hash with minimal extra memory usage.\n", #> "\n", "Objects are converted to binary using R's native serialization tools.\n", #> "On R >= 3.5.0, serialization version 3 is used, otherwise version 2 is used.\n", #> "See ", list(list("serialize()")), " for more information about the serialization version.\n"), #> "\n", list("\n", "hash(c(1, 2, 3))\n", "hash(mtcars)\n"), #> "\n"), inherits_any.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/s3.R", #> "\n", list("inherits_any"), "\n", list("inherits_any"), #> "\n", list("inherits_all"), "\n", list("inherits_only"), #> "\n", list("Does an object inherit from a set of classes?"), #> "\n", list("\n", "inherits_any(x, class)\n", #> "\n", "inherits_all(x, class)\n", "\n", "inherits_only(x, class)\n"), #> "\n", list("\n", list(list("x"), list("An object to test for inheritance.")), #> "\n", "\n", list(list("class"), list("A character vector of classes.")), #> "\n"), "\n", list("\n", list("\n", list(), #> " ", list("inherits_any()"), " is like ", list( #> list("base::inherits()")), " but is more explicit\n", #> "about its behaviour with multiple classes. If ", #> list("classes"), " contains\n", "several elements and the object inherits from at least one of\n", #> "them, ", list("inherits_any()"), " returns ", #> list("TRUE"), ".\n", list(), " ", list("inherits_all()"), #> " tests that an object inherits from all of the\n", #> "classes in the supplied order. This is usually the best way to\n", #> "test for inheritance of multiple classes.\n", #> list(), " ", list("inherits_only()"), " tests that the class vectors are identical. It\n", #> "is a shortcut for ", list("identical(class(x), class)"), #> ".\n"), "\n"), "\n", list("\n", "obj <- structure(list(), class = c(\"foo\", \"bar\", \"baz\"))\n", #> "\n", "# With the _any variant only one class must match:\n", #> "inherits_any(obj, c(\"foobar\", \"bazbaz\"))\n", #> "inherits_any(obj, c(\"foo\", \"bazbaz\"))\n", #> "\n", "# With the _all variant all classes must match:\n", #> "inherits_all(obj, c(\"foo\", \"bazbaz\"))\n", #> "inherits_all(obj, c(\"foo\", \"baz\"))\n", #> "\n", "# The order of classes must match as well:\n", #> "inherits_all(obj, c(\"baz\", \"foo\"))\n", #> "\n", "# inherits_only() checks that the class vectors are identical:\n", #> "inherits_only(obj, c(\"foo\", \"baz\"))\n", #> "inherits_only(obj, c(\"foo\", \"bar\", \"baz\"))\n"), #> "\n"), inject.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval.R", #> "\n", list("inject"), "\n", list("inject"), "\n", #> list("Inject objects in an R expression"), "\n", #> list("\n", "inject(expr, env = caller_env())\n"), #> "\n", list("\n", list(list("expr"), list("An argument to evaluate. This argument is immediately\n", #> "evaluated in ", list("env"), " (the current environment by default) with\n", #> "injected objects and expressions.")), "\n", #> "\n", list(list("env"), list("The environment in which to evaluate ", #> list("expr"), ". Defaults to\n", "the current environment. For expert use only.")), #> "\n"), "\n", list("\n", list("inject()"), " evaluates an expression with ", #> list("injection"), "\n", "(unquotation) support. There are three main usages:\n"), #> "\n", list("\n", list("\n", list(), " ", list( #> "Splicing"), " lists of arguments in a function call.\n", #> list(), " Inline objects or other expressions in an expression with ", #> list("!!"), "\n", "and ", list("!!!"), ". For instance to create functions or formulas\n", #> "programmatically.\n", list(), " Pass arguments to NSE functions that ", #> list("defuse"), " their\n", "arguments without injection support (see for instance\n", #> list(list("enquo0()")), "). You can use ", #> list("{{ arg }}"), " with functions documented\n", #> "to support quosures. Otherwise, use ", list( #> "!!enexpr(arg)"), ".\n"), "\n"), "\n", list( #> "\n", "# inject() simply evaluates its argument with injection\n", #> "# support. These expressions are equivalent:\n", #> "2 * 3\n", "inject(2 * 3)\n", "inject(!!2 * !!3)\n", #> "\n", "# Injection with `!!` can be useful to insert objects or\n", #> "# expressions within other expressions, like formulas:\n", #> "lhs <- sym(\"foo\")\n", "rhs <- sym(\"bar\")\n", #> "inject(!!lhs ~ !!rhs + 10)\n", "\n", "# Injection with `!!!` splices lists of arguments in function\n", #> "# calls:\n", "args <- list(na.rm = TRUE, finite = 0.2)\n", #> "inject(mean(1:10, !!!args))\n"), "\n"), invoke.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval.R", #> "\n", list("invoke"), "\n", list("invoke"), "\n", #> list("Invoke a function with a list of arguments"), #> "\n", list("\n", "invoke(.fn, .args = list(), ..., .env = caller_env(), .bury = c(\".fn\", \"\"))\n"), #> "\n", list("\n", list(list(".fn"), list("A function to invoke. Can be a function object or the\n", #> "name of a function in scope of ", list(".env"), #> ".")), "\n", "\n", list(list(".args, ..."), #> list("List of arguments (possibly named) to be passed to\n", #> list(".fn"), ".")), "\n", "\n", list(list( #> ".env"), list("The environment in which to call ", #> list(".fn"), ".")), "\n", "\n", list(list(".bury"), #> list("A character vector of length 2. The first string\n", #> "specifies which name should the function have in the call\n", #> "recorded in the evaluation stack. The second string specifies a\n", #> "prefix for the argument names. Set ", list( #> ".bury"), " to ", list("NULL"), " if you\n", #> "prefer to inline the function and its arguments in the call.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", "\n", "Normally, you invoke a R function by typing arguments manually. A\n", #> "powerful alternative is to call a function with a list of arguments\n", #> "assembled programmatically. This is the purpose of ", #> list("invoke()"), ".\n"), "\n", list("\n", #> "Technically, ", list("invoke()"), " is basically a version of ", #> list(list("base::do.call()")), "\n", "that creates cleaner call traces because it does not inline the\n", #> "function and the arguments in the call (see examples). To achieve\n", #> "this, ", list("invoke()"), " creates a child environment of ", #> list(".env"), " with ", list(".fn"), "\n", #> "and all arguments bound to new symbols (see ", #> list(list("env_bury()")), "). It then\n", "uses the same strategy as ", #> list(list("eval_bare()")), " to evaluate with minimal\n", #> "noise.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", list("invoke()"), " is soft-deprecated in favour of ", #> list(list("exec()")), ". Now that we\n", #> "understand better the interaction between unquoting and dots\n", #> "capture, we can take a simpler approach in ", #> list("exec()"), ".\n", "\n", "If you need finer control over the generated call, you should construct\n", #> "an environment and call yourself, manually burying large objects\n", #> "or complex expressions.\n")), "\n", "\n", #> list("\n", "# invoke() has the same purpose as do.call():\n", #> "invoke(paste, letters)\n", "\n", "# But it creates much cleaner calls:\n", #> "invoke(call_inspect, mtcars)\n", "\n", "# and stacktraces:\n", #> "fn <- function(...) sys.calls()\n", "invoke(fn, list(mtcars))\n", #> "\n", "# Compare to do.call():\n", "do.call(call_inspect, mtcars)\n", #> "do.call(fn, list(mtcars))\n", "\n", "\n", #> "# Specify the function name either by supplying a string\n", #> "# identifying the function (it should be visible in .env):\n", #> "invoke(\"call_inspect\", letters)\n", "\n", #> "# Or by changing the .bury argument, with which you can also change\n", #> "# the argument prefix:\n", "invoke(call_inspect, mtcars, .bury = c(\"inspect!\", \"col\"))\n"), #> "\n", list("internal"), "\n"), is_call.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("is_call"), "\n", list("is_call"), #> "\n", list("Is object a call?"), "\n", list("\n", #> "is_call(x, name = NULL, n = NULL, ns = NULL)\n"), #> "\n", list("\n", list(list("x"), list("An object to test. If a formula, the right-hand side is\n", #> "extracted.")), "\n", "\n", list(list("name"), #> list("An optional name that the call should match. It is\n", #> "passed to ", list(list("sym()")), " before matching. This argument is vectorised\n", #> "and you can supply a vector of names to match. In this case,\n", #> list("is_call()"), " returns ", list("TRUE"), #> " if at least one name matches.")), "\n", #> "\n", list(list("n"), list("An optional number of arguments that the call should\n", #> "match.")), "\n", "\n", list(list("ns"), #> list("The namespace of the call. If ", list( #> "NULL"), ", the namespace\n", "doesn't participate in the pattern-matching. If an empty string\n", #> list("\"\""), " and ", list("x"), " is a namespaced call, ", #> list("is_call()"), " returns\n", list("FALSE"), #> ". If any other string, ", list("is_call()"), #> " checks that ", list("x"), " is\n", "namespaced within ", #> list("ns"), ".\n", "\n", "Can be a character vector of namespaces, in which case the call\n", #> "has to match at least one of them, otherwise ", #> list("is_call()"), " returns\n", list("FALSE"), #> ".")), "\n"), "\n", list("\n", "This function tests if ", #> list("x"), " is a ", list("call"), ". This is a\n", #> "pattern-matching predicate that returns ", #> list("FALSE"), " if ", list("name"), " and ", #> list("n"), "\n", "are supplied and the call does not match these properties.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", list("is_lang()"), " has been soft-deprecated and renamed to ", #> list("is_call()"), " in\n", "rlang 0.2.0 and similarly for ", #> list("is_unary_lang()"), " and\n", list("is_binary_lang()"), #> ". This renaming follows the general switch from\n", #> "\"language\" to \"call\" in the rlang type nomenclature. See lifecycle\n", #> "section in ", list(list("call2()")), ".\n")), #> "\n", "\n", list("\n", "is_call(quote(foo(bar)))\n", #> "\n", "# You can pattern-match the call with additional arguments:\n", #> "is_call(quote(foo(bar)), \"foo\")\n", "is_call(quote(foo(bar)), \"bar\")\n", #> "is_call(quote(foo(bar)), quote(foo))\n", "\n", #> "# Match the number of arguments with is_call():\n", #> "is_call(quote(foo(bar)), \"foo\", 1)\n", "is_call(quote(foo(bar)), \"foo\", 2)\n", #> "\n", "\n", "# By default, namespaced calls are tested unqualified:\n", #> "ns_expr <- quote(base::list())\n", "is_call(ns_expr, \"list\")\n", #> "\n", "# You can also specify whether the call shouldn't be namespaced by\n", #> "# supplying an empty string:\n", "is_call(ns_expr, \"list\", ns = \"\")\n", #> "\n", "# Or if it should have a namespace:\n", #> "is_call(ns_expr, \"list\", ns = \"utils\")\n", #> "is_call(ns_expr, \"list\", ns = \"base\")\n", #> "\n", "# You can supply multiple namespaces:\n", #> "is_call(ns_expr, \"list\", ns = c(\"utils\", \"base\"))\n", #> "is_call(ns_expr, \"list\", ns = c(\"utils\", \"stats\"))\n", #> "\n", "# If one of them is \"\", unnamespaced calls will match as well:\n", #> "is_call(quote(list()), \"list\", ns = \"base\")\n", #> "is_call(quote(list()), \"list\", ns = c(\"base\", \"\"))\n", #> "is_call(quote(base::list()), \"list\", ns = c(\"base\", \"\"))\n", #> "\n", "\n", "# The name argument is vectorised so you can supply a list of names\n", #> "# to match with:\n", "is_call(quote(foo(bar)), c(\"bar\", \"baz\"))\n", #> "is_call(quote(foo(bar)), c(\"bar\", \"foo\"))\n", #> "is_call(quote(base::list), c(\"::\", \":::\", \"$\", \"@\"))\n"), #> "\n", list("\n", list(list("is_expression()")), #> "\n"), "\n"), is_callable.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("is_callable"), "\n", list("is_callable"), #> "\n", list("Is an object callable?"), "\n", list( #> "\n", "is_callable(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", "A callable object is an object that can appear in the function\n", #> "position of a call (as opposed to argument position). This includes\n", #> list("symbolic objects"), " that evaluate to a function or\n", #> "literal functions embedded in the call.\n"), #> "\n", list("\n", "Note that strings may look like callable objects because\n", #> "expressions of the form ", list("\"list\"()"), #> " are valid R code. However,\n", "that's only because the R parser transforms strings to symbols. It\n", #> "is not legal to manually set language heads to strings.\n"), #> "\n", list("\n", "# Symbolic objects and functions are callable:\n", #> "is_callable(quote(foo))\n", "is_callable(base::identity)\n", #> "\n", "# node_poke_car() lets you modify calls without any checking:\n", #> "lang <- quote(foo(10))\n", "node_poke_car(lang, current_env())\n", #> "\n", "# Use is_callable() to check an input object is safe to put as CAR:\n", #> "obj <- base::identity\n", "\n", "if (is_callable(obj)) {\n", #> " lang <- node_poke_car(lang, obj)\n", "} else {\n", #> " abort(\"`obj` must be callable\")\n", "}\n", #> "\n", "eval_bare(lang)\n"), "\n", list("internal"), #> "\n"), is_condition.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd.R", #> "\n", list("is_condition"), "\n", list("is_condition"), #> "\n", list("Is object a condition?"), "\n", list( #> "\n", "is_condition(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", "Is object a condition?\n"), #> "\n", list("internal"), "\n"), is_copyable.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_copyable"), "\n", list("is_copyable"), #> "\n", list("Is an object copyable?"), "\n", list( #> "\n", "is_copyable(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", "When an object is modified, R generally copies it (sometimes\n", #> "lazily) to enforce ", list(list("https://en.wikipedia.org/wiki/Value_semantics"), #> list("value semantics")), ".\n", "However, some internal types are uncopyable. If you try to copy\n", #> "them, either with ", list("<-"), " or by argument passing, you actually create\n", #> "references to the original object rather than actual\n", #> "copies. Modifying these references can thus have far reaching side\n", #> "effects.\n"), "\n", list("\n", "# Let's add attributes with structure() to uncopyable types. Since\n", #> "# they are not copied, the attributes are changed in place:\n", #> "env <- env()\n", "structure(env, foo = \"bar\")\n", #> "env\n", "\n", "# These objects that can only be changed with side effect are not\n", #> "# copyable:\n", "is_copyable(env)\n", "\n", #> "structure(base::list, foo = \"bar\")\n", "str(base::list)\n"), #> "\n", list("internal"), "\n"), is_empty.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_empty"), "\n", list("is_empty"), #> "\n", list("Is object an empty vector or NULL?"), #> "\n", list("\n", "is_empty(x)\n"), "\n", list( #> "\n", list(list("x"), list("object to test")), #> "\n"), "\n", list("\n", "Is object an empty vector or NULL?\n"), #> "\n", list("\n", "is_empty(NULL)\n", "is_empty(list())\n", #> "is_empty(list(NULL))\n"), "\n"), is_env.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("is_env"), "\n", list("is_env"), "\n", #> list("is_bare_env"), "\n", list("Is an object an environment?"), #> "\n", list("\n", "is_env(x)\n", "\n", "is_bare_env(x)\n"), #> "\n", list("\n", list(list("x"), list("object to test")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions were deprecated and renamed to ", #> list(list("is_environment()")), "\n", "and ", #> list(list("is_bare_environment()")), " in rlang 0.2.0. This is for consistency\n", #> "with other type predicates which are not abbreviated.\n"), #> "\n", list("internal"), "\n"), is_environment.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_environment"), "\n", list("is_environment"), #> "\n", list("is_bare_environment"), "\n", list( #> "Is object an environment?"), "\n", list("\n", #> "is_environment(x)\n", "\n", "is_bare_environment(x)\n"), #> "\n", list("\n", list(list("x"), list("object to test")), #> "\n"), "\n", list("\n", list("is_bare_environment()"), #> " tests whether ", list("x"), " is an environment without a s3 or\n", #> "s4 class.\n"), "\n"), is_expr.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("is_expr"), "\n", list("is_expr"), #> "\n", list("Is an object an expression?"), "\n", #> list("\n", "is_expr(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "This function was deprecated and renamed to ", #> list(list("is_expression()")), " in\n", "rlang 0.2.0. This is for consistency with other type predicates\n", #> "which are not abbreviated.\n"), "\n", list( #> "internal"), "\n"), is_expression.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/expr.R", #> "\n", list("is_expression"), "\n", list("is_expression"), #> "\n", list("is_syntactic_literal"), "\n", list( #> "is_symbolic"), "\n", list("Is an object an expression?"), #> "\n", list("\n", "is_expression(x)\n", "\n", #> "is_syntactic_literal(x)\n", "\n", "is_symbolic(x)\n"), #> "\n", list("\n", list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", list("is_expression()"), #> " tests for expressions, the set of objects that can be\n", #> "obtained from parsing R code. An expression can be one of two\n", #> "things: either a symbolic object (for which ", #> list("is_symbolic()"), " returns\n", list("TRUE"), #> "), or a syntactic literal (testable with\n", #> list("is_syntactic_literal()"), "). Technically, calls can contain any R\n", #> "object, not necessarily symbolic objects or syntactic\n", #> "literals. However, this only happens in artificial\n", #> "situations. Expressions as we define them only contain numbers,\n", #> "strings, ", list("NULL"), ", symbols, and calls: this is the complete set of R\n", #> "objects that can be created when R parses source code (e.g. from\n", #> "using ", list(list("parse_expr()")), ").\n", #> "\n", "Note that we are using the term expression in its colloquial sense\n", #> "and not to refer to ", list(list("expression()")), #> " vectors, a data type that wraps\n", "expressions in a vector and which isn't used much in modern R code.\n"), #> "\n", list("\n", list("is_symbolic()"), " returns ", #> list("TRUE"), " for symbols and calls (objects with\n", #> "type ", list("language"), "). Symbolic objects are replaced by their value\n", #> "during evaluation. Literals are the complement of symbolic\n", #> "objects. They are their own value and return themselves during\n", #> "evaluation.\n", "\n", list("is_syntactic_literal()"), #> " is a predicate that returns ", list("TRUE"), #> " for the\n", "subset of literals that are created by R when parsing text (see\n", #> list(list("parse_expr()")), "): numbers, strings and ", #> list("NULL"), ". Along with symbols,\n", "these literals are the terminating nodes in an AST.\n", #> "\n", "Note that in the most general sense, a literal is any R object that\n", #> "evaluates to itself and that can be evaluated in the empty\n", #> "environment. For instance, ", list("quote(c(1, 2))"), #> " is not a literal, it is\n", "a call. However, the result of evaluating it in ", #> list(list("base_env()")), " is a\n", "literal(in this case an atomic vector).\n", #> "\n", "Pairlists are also a kind of language objects. However, since they\n", #> "are mostly an internal data structure, ", #> list("is_expression()"), " returns ", list( #> "FALSE"), "\n", "for pairlists. You can use ", #> list("is_pairlist()"), " to explicitly check for\n", #> "them. Pairlists are the data structure for function arguments. They\n", #> "usually do not arise from R code because subsetting a call is a\n", #> "type-preserving operation. However, you can obtain the pairlist of\n", #> "arguments by taking the CDR of the call object from C code. The\n", #> "rlang function ", list(list("node_cdr()")), #> " will do it from R. Another way in\n", "which pairlist of arguments arise is by extracting the argument\n", #> "list of a closure with ", list(list("base::formals()")), #> " or ", list(list("fn_fmls()")), ".\n"), "\n", #> list("\n", "q1 <- quote(1)\n", "is_expression(q1)\n", #> "is_syntactic_literal(q1)\n", "\n", "q2 <- quote(x)\n", #> "is_expression(q2)\n", "is_symbol(q2)\n", "\n", #> "q3 <- quote(x + 1)\n", "is_expression(q3)\n", #> "is_call(q3)\n", "\n", "\n", "# Atomic expressions are the terminating nodes of a call tree:\n", #> "# NULL or a scalar atomic vector:\n", "is_syntactic_literal(\"string\")\n", #> "is_syntactic_literal(NULL)\n", "\n", "is_syntactic_literal(letters)\n", #> "is_syntactic_literal(quote(call()))\n", "\n", #> "# Parsable literals have the property of being self-quoting:\n", #> "identical(\"foo\", quote(\"foo\"))\n", "identical(1L, quote(1L))\n", #> "identical(NULL, quote(NULL))\n", "\n", "# Like any literals, they can be evaluated within the empty\n", #> "# environment:\n", "eval_bare(quote(1L), empty_env())\n", #> "\n", "# Whereas it would fail for symbolic expressions:\n", #> "# eval_bare(quote(c(1L, 2L)), empty_env())\n", #> "\n", "\n", "# Pairlists are also language objects representing argument lists.\n", #> "# You will usually encounter them with extracted formals:\n", #> "fmls <- formals(is_expression)\n", "typeof(fmls)\n", #> "\n", "# Since they are mostly an internal data structure, is_expression()\n", #> "# returns FALSE for pairlists, so you will have to check explicitly\n", #> "# for them:\n", "is_expression(fmls)\n", "is_pairlist(fmls)\n"), #> "\n", list("\n", list(list("is_call()")), " for a call predicate.\n"), #> "\n"), is_formula.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/formula.R", #> "\n", list("is_formula"), "\n", list("is_formula"), #> "\n", list("is_bare_formula"), "\n", list("Is object a formula?"), #> "\n", list("\n", "is_formula(x, scoped = NULL, lhs = NULL)\n", #> "\n", "is_bare_formula(x, scoped = NULL, lhs = NULL)\n"), #> "\n", list("\n", list(list("x"), list("An object to test.")), #> "\n", "\n", list(list("scoped"), list("A boolean indicating whether the quosure is scoped,\n", #> "that is, has a valid environment attribute. If ", #> list("NULL"), ", the scope\n", "is not inspected.")), #> "\n", "\n", list(list("lhs"), list("A boolean indicating whether the ", #> list("formula"), "\n", "or ", list("definition"), #> " has a left-hand side. If ", list("NULL"), #> ",\n", "the LHS is not inspected.")), "\n"), #> "\n", list("\n", list("is_formula()"), " tests if ", #> list("x"), " is a call to ", list("~"), ". ", #> list("is_bare_formula()"), "\n", "tests in addition that ", #> list("x"), " does not inherit from anything else than\n", #> list("\"formula\""), ".\n"), "\n", list("\n", #> "The ", list("scoped"), " argument patterns-match on whether the scoped bundled\n", #> "with the quosure is valid or not. Invalid scopes may happen in\n", #> "nested quotations like ", list("~~expr"), #> ", where the outer quosure is validly\n", "scoped but not the inner one. This is because ", #> list("~"), " saves the\n", "environment when it is evaluated, and quoted formulas are by\n", #> "definition not evaluated.\n"), "\n", list( #> "\n", "x <- disp ~ am\n", "is_formula(x)\n", #> "\n", "is_formula(~10)\n", "is_formula(10)\n", #> "\n", "is_formula(quo(foo))\n", "is_bare_formula(quo(foo))\n", #> "\n", "# Note that unevaluated formulas are treated as bare formulas even\n", #> "# though they don't inherit from \"formula\":\n", #> "f <- quote(~foo)\n", "is_bare_formula(f)\n", #> "\n", "# However you can specify `scoped` if you need the predicate to\n", #> "# return FALSE for these unevaluated formulas:\n", #> "is_bare_formula(f, scoped = TRUE)\n", "is_bare_formula(eval(f), scoped = TRUE)\n"), #> "\n"), is_frame.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("is_frame"), "\n", list("is_frame"), #> "\n", list("Is object a frame?"), "\n", list( #> "\n", "is_frame(x)\n"), "\n", list("\n", list( #> list("x"), list("Object to test")), "\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n"), "\n", list("internal"), "\n"), is_function.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("is_function"), "\n", list("is_function"), #> "\n", list("is_closure"), "\n", list("is_primitive"), #> "\n", list("is_primitive_eager"), "\n", list( #> "is_primitive_lazy"), "\n", list("Is object a function?"), #> "\n", list("\n", "is_function(x)\n", "\n", "is_closure(x)\n", #> "\n", "is_primitive(x)\n", "\n", "is_primitive_eager(x)\n", #> "\n", "is_primitive_lazy(x)\n"), "\n", list( #> "\n", list(list("x"), list("Object to be tested.")), #> "\n"), "\n", list("\n", "The R language defines two different types of functions: primitive\n", #> "functions, which are low-level, and closures, which are the regular\n", #> "kind of functions.\n"), "\n", list("\n", "Closures are functions written in R, named after the way their\n", #> "arguments are scoped within nested environments (see\n", #> list("https://en.wikipedia.org/wiki/Closure_(computer_programming)"), #> "). The\n", "root environment of the closure is called the closure\n", #> "environment. When closures are evaluated, a new environment called\n", #> "the evaluation frame is created with the closure environment as\n", #> "parent. This is where the body of the closure is evaluated. These\n", #> "closure frames appear on the evaluation stack (see ", #> list(list("ctxt_stack()")), "),\n", "as opposed to primitive functions which do not necessarily have\n", #> "their own evaluation frame and never appear on the stack.\n", #> "\n", "Primitive functions are more efficient than closures for two\n", #> "reasons. First, they are written entirely in fast low-level\n", #> "code. Second, the mechanism by which they are passed arguments is\n", #> "more efficient because they often do not need the full procedure of\n", #> "argument matching (dealing with positional versus named arguments,\n", #> "partial matching, etc). One practical consequence of the special\n", #> "way in which primitives are passed arguments is that they\n", #> "technically do not have formal arguments, and ", #> list(list("formals()")), " will\n", "return ", #> list("NULL"), " if called on a primitive function. Finally, primitive\n", #> "functions can either take arguments lazily, like R closures do,\n", #> "or evaluate them eagerly before being passed on to the C code.\n", #> "The former kind of primitives are called \"special\" in R terminology,\n", #> "while the latter is referred to as \"builtin\". ", #> list("is_primitive_eager()"), "\n", "and ", #> list("is_primitive_lazy()"), " allow you to check whether a primitive\n", #> "function evaluates arguments eagerly or lazily.\n", #> "\n", "You will also encounter the distinction between primitive and\n", #> "internal functions in technical documentation. Like primitive\n", #> "functions, internal functions are defined at a low level and\n", #> "written in C. However, internal functions have no representation in\n", #> "the R language. Instead, they are called via a call to\n", #> list(list("base::.Internal()")), " within a regular closure. This ensures that\n", #> "they appear as normal R function objects: they obey all the usual\n", #> "rules of argument passing, and they appear on the evaluation stack\n", #> "as any other closures. As a result, ", list( #> list("fn_fmls()")), " does not need to\n", #> "look in the ", list(".ArgsEnv"), " environment to obtain a representation of\n", #> "their arguments, and there is no way of querying from R whether\n", #> "they are lazy ('special' in R terminology) or eager ('builtin').\n", #> "\n", "You can call primitive functions with ", #> list(list(".Primitive()")), " and internal\n", #> "functions with ", list(list(".Internal()")), #> ". However, calling internal functions\n", #> "in a package is forbidden by CRAN's policy because they are\n", #> "considered part of the private API. They often assume that they\n", #> "have been called with correctly formed arguments, and may cause R\n", #> "to crash if you call them with unexpected objects.\n"), #> "\n", list("\n", "# Primitive functions are not closures:\n", #> "is_closure(base::c)\n", "is_primitive(base::c)\n", #> "\n", "# On the other hand, internal functions are wrapped in a closure\n", #> "# and appear as such from the R side:\n", #> "is_closure(base::eval)\n", "\n", "# Both closures and primitives are functions:\n", #> "is_function(base::c)\n", "is_function(base::eval)\n", #> "\n", "# Primitive functions never appear in evaluation stacks:\n", #> "is_primitive(base::`[[`)\n", "is_primitive(base::list)\n", #> "list(ctxt_stack())[[1]]\n", "\n", "# While closures do:\n", #> "identity(identity(ctxt_stack()))\n", "\n", #> "# Many primitive functions evaluate arguments eagerly:\n", #> "is_primitive_eager(base::c)\n", "is_primitive_eager(base::list)\n", #> "is_primitive_eager(base::`+`)\n", "\n", "# However, primitives that operate on expressions, like quote() or\n", #> "# substitute(), are lazy:\n", "is_primitive_lazy(base::quote)\n", #> "is_primitive_lazy(base::substitute)\n"), "\n"), #> is_installed.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("is_installed"), "\n", list("is_installed"), #> "\n", list("check_installed"), "\n", list("Are packages installed in any of the libraries?"), #> "\n", list("\n", "is_installed(pkg)\n", "\n", #> "check_installed(pkg, reason = NULL)\n"), "\n", #> list("\n", list(list("pkg"), list("The package names.")), #> "\n", "\n", list(list("reason"), list("Optional string indicating why is ", #> list("pkg"), " needed.\n", "Appears in error messages (if non-interactive) and user prompts\n", #> "(if interactive).")), "\n"), "\n", list( #> "\n", list("is_installed()"), " returns ", #> list("TRUE"), " if ", list("all"), " package names\n", #> "provided in ", list("pkg"), " are installed, ", #> list("FALSE"), "\n", "otherwise. ", list("check_installed()"), #> " either doesn't return or returns\n", list( #> "NULL"), ".\n"), "\n", list("\n", "These functions check that packages are installed with minimal side\n", #> "effects. If installed, the packages will be loaded but not\n", #> "attached.\n", list("\n", list(), " ", list( #> "is_installed()"), " doesn't interact with the user. It simply\n", #> "returns ", list("TRUE"), " or ", list("FALSE"), #> " depending on whether the packages are\n", #> "installed.\n", list(), " In interactive sessions, ", #> list("check_installed()"), " asks the user\n", #> "whether to install missing packages. If the user accepts, the\n", #> "packages are installed with ", list("pak::pkg_install()"), #> " if available, or\n", list(list("utils::install.packages()")), #> " otherwise. If the session is non\n", "interactive or if the user chooses not to install the packages,\n", #> "the current evaluation is aborted.\n"), #> "\n"), "\n", list("\n", "is_installed(\"utils\")\n", #> "is_installed(c(\"base\", \"ggplot5\"))\n"), #> "\n"), is_integerish.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_integerish"), "\n", list("is_integerish"), #> "\n", list("is_bare_integerish"), "\n", list( #> "is_scalar_integerish"), "\n", list("Is a vector integer-like?"), #> "\n", list("\n", "is_integerish(x, n = NULL, finite = NULL)\n", #> "\n", "is_bare_integerish(x, n = NULL, finite = NULL)\n", #> "\n", "is_scalar_integerish(x, finite = NULL)\n"), #> "\n", list("\n", list(list("x"), list("Object to be tested.")), #> "\n", "\n", list(list("n"), list("Expected length of a vector.")), #> "\n", "\n", list(list("finite"), list("Whether all values of the vector are finite. The\n", #> "non-finite values are ", list("NA"), ", ", #> list("Inf"), ", ", list("-Inf"), " and ", #> list("NaN"), ". Setting this\n", "to something other than ", #> list("NULL"), " can be expensive because the whole\n", #> "vector needs to be traversed and checked.")), #> "\n"), "\n", list("\n", "These predicates check whether R considers a number vector to be\n", #> "integer-like, according to its own tolerance check (which is in\n", #> "fact delegated to the C library). This function is not adapted to\n", #> "data analysis, see the help for ", list(list( #> "base::is.integer()")), " for examples\n", #> "of how to check for whole numbers.\n", "\n", #> "Things to consider when checking for integer-like doubles:\n", #> list("\n", list(), " This check can be expensive because the whole double vector has\n", #> "to be traversed and checked.\n", list(), #> " Large double values may be integerish but may still not be\n", #> "coercible to integer. This is because integers in R only support\n", #> "values up to ", list("2^31 - 1"), " while numbers stored as double can be\n", #> "much larger.\n"), "\n"), "\n", list("\n", #> "is_integerish(10L)\n", "is_integerish(10.0)\n", #> "is_integerish(10.0, n = 2)\n", "is_integerish(10.000001)\n", #> "is_integerish(TRUE)\n"), "\n", list("\n", #> list(list("is_bare_numeric()")), " for testing whether an object is a\n", #> "base numeric type (a bare double or integer vector).\n"), #> "\n"), is_interactive.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/state.R", #> "\n", list("is_interactive"), "\n", list("is_interactive"), #> "\n", list("local_interactive"), "\n", list("with_interactive"), #> "\n", list("Is R running interactively?"), "\n", #> list("\n", "is_interactive()\n", "\n", "local_interactive(value = TRUE, frame = caller_env())\n", #> "\n", "with_interactive(expr, value = TRUE)\n"), #> "\n", list("\n", list(list("value"), list("A single ", #> list("TRUE"), " or ", list("FALSE"), ". This overrides the return\n", #> "value of ", list("is_interactive()"), ".")), #> "\n", "\n", list(list("frame"), list("The environment of a running function which defines\n", #> "the scope of the temporary options. When the function returns,\n", #> "the options are reset to their original values.")), #> "\n", "\n", list(list("expr"), list("An expression to evaluate with interactivity set to\n", #> list("value"), ".")), "\n"), "\n", list("\n", #> "Like ", list(list("base::interactive()")), #> ", ", list("is_interactive()"), " returns ", #> list("TRUE"), " when\n", "the function runs interactively and ", #> list("FALSE"), " when it runs in batch\n", #> "mode. It also checks, in this order:\n", list( #> "\n", list(), " The ", list("rlang_interactive"), #> " global option. If set to a single ", list( #> "TRUE"), "\n", "or ", list("FALSE"), ", ", #> list("is_interactive()"), " returns that value immediately. This\n", #> "escape hatch is useful in unit tests or to manually turn on\n", #> "interactive features in RMarkdown outputs.\n", #> list(), " Whether knitr or testthat is in progress, in which case\n", #> list("is_interactive()"), " returns ", list( #> "FALSE"), ".\n"), "\n", "\n", list("with_interactive()"), #> " and ", list("local_interactive()"), " set the global\n", #> "option conveniently.\n"), "\n"), is_lang.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("is_lang"), "\n", list("is_lang"), #> "\n", list("is_unary_lang"), "\n", list("is_binary_lang"), #> "\n", list("quo_is_lang"), "\n", list("Is object a call?"), #> "\n", list("\n", "is_lang(x, name = NULL, n = NULL, ns = NULL)\n", #> "\n", "is_unary_lang(x, name = NULL, ns = NULL)\n", #> "\n", "is_binary_lang(x, name = NULL, ns = NULL)\n", #> "\n", "quo_is_lang(quo)\n"), "\n", list("\n", #> list(list("x"), list("An object to test. If a formula, the right-hand side is\n", #> "extracted.")), "\n", "\n", list(list("name"), #> list("An optional name that the call should match. It is\n", #> "passed to ", list(list("sym()")), " before matching. This argument is vectorised\n", #> "and you can supply a vector of names to match. In this case,\n", #> list("is_call()"), " returns ", list("TRUE"), #> " if at least one name matches.")), "\n", #> "\n", list(list("n"), list("An optional number of arguments that the call should\n", #> "match.")), "\n", "\n", list(list("ns"), #> list("The namespace of the call. If ", list( #> "NULL"), ", the namespace\n", "doesn't participate in the pattern-matching. If an empty string\n", #> list("\"\""), " and ", list("x"), " is a namespaced call, ", #> list("is_call()"), " returns\n", list("FALSE"), #> ". If any other string, ", list("is_call()"), #> " checks that ", list("x"), " is\n", "namespaced within ", #> list("ns"), ".\n", "\n", "Can be a character vector of namespaces, in which case the call\n", #> "has to match at least one of them, otherwise ", #> list("is_call()"), " returns\n", list("FALSE"), #> ".")), "\n", "\n", list(list("quo"), list( #> "A quosure to test.")), "\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions are deprecated, please use ", #> list(list("is_call()")), " and its ", list( #> "n"), "\n", "argument instead.\n"), "\n", #> list("internal"), "\n"), is_named.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("is_named"), "\n", list("is_named"), #> "\n", list("is_dictionaryish"), "\n", list("have_name"), #> "\n", list("Is object named?"), "\n", list("\n", #> "is_named(x)\n", "\n", "is_dictionaryish(x)\n", #> "\n", "have_name(x)\n"), "\n", list("\n", list( #> list("x"), list("An object to test.")), "\n"), #> "\n", list("\n", list("is_named()"), " and ", #> list("is_dictionaryish()"), " are scalar predicates\n", #> "and return ", list("TRUE"), " or ", list("FALSE"), #> ". ", list("have_name()"), " is vectorised and\n", #> "returns a logical vector as long as the input.\n"), #> "\n", list("\n", list("is_named()"), " checks that ", #> list("x"), " has names attributes, and that none of\n", #> "the names are missing or empty (", list("NA"), #> " or ", list("\"\""), "). ", list("is_dictionaryish()"), #> "\n", "checks that an object is a dictionary: that it has actual names and\n", #> "in addition that there are no duplicated names. ", #> list("have_name()"), "\n", "is a vectorised version of ", #> list("is_named()"), ".\n"), "\n", list("\n", #> "# A data frame usually has valid, unique names\n", #> "is_named(mtcars)\n", "have_name(mtcars)\n", #> "is_dictionaryish(mtcars)\n", "\n", "# But data frames can also have duplicated columns:\n", #> "dups <- cbind(mtcars, cyl = seq_len(nrow(mtcars)))\n", #> "is_dictionaryish(dups)\n", "\n", "# The names are still valid:\n", #> "is_named(dups)\n", "have_name(dups)\n", "\n", #> "\n", "# For empty objects the semantics are slightly different.\n", #> "# is_dictionaryish() returns TRUE for empty objects:\n", #> "is_dictionaryish(list())\n", "\n", "# But is_named() will only return TRUE if there is a names\n", #> "# attribute (a zero-length character vector in this case):\n", #> "x <- set_names(list(), character(0))\n", "is_named(x)\n", #> "\n", "\n", "# Empty and missing names are invalid:\n", #> "invalid <- dups\n", "names(invalid)[2] <- \"\"\n", #> "names(invalid)[5] <- NA\n", "\n", "# is_named() performs a global check while have_name() can show you\n", #> "# where the problem is:\n", "is_named(invalid)\n", #> "have_name(invalid)\n", "\n", "# have_name() will work even with vectors that don't have a names\n", #> "# attribute:\n", "have_name(letters)\n"), #> "\n"), is_namespace.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("is_namespace"), "\n", list("is_namespace"), #> "\n", list("Is an object a namespace environment?"), #> "\n", list("\n", "is_namespace(x)\n"), "\n", #> list("\n", list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", "Is an object a namespace environment?\n"), #> "\n"), is_pairlist.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/node.R", #> "\n", list("is_pairlist"), "\n", list("is_pairlist"), #> "\n", list("is_node"), "\n", list("is_node_list"), #> "\n", list("Is object a node or pairlist?"), #> "\n", list("\n", "is_pairlist(x)\n", "\n", "is_node(x)\n", #> "\n", "is_node_list(x)\n"), "\n", list("\n", #> list(list("x"), list("Object to test.")), "\n"), #> "\n", list("\n", list("\n", list(), " ", list( #> "is_pairlist()"), " checks that ", list("x"), #> " has type ", list("pairlist"), ".\n", list(), #> " ", list("is_node()"), " checks that ", list( #> "x"), " has type ", list("pairlist"), " or ", #> list("language"), ".\n", "It tests whether ", #> list("x"), " is a node that has a CAR and a CDR,\n", #> "including callable nodes (language objects).\n", #> list(), " ", list("is_node_list()"), " checks that ", #> list("x"), " has type ", list("pairlist"), #> " or ", list("NULL"), ".\n", list("NULL"), #> " is the empty node list.\n"), "\n"), "\n", #> list(list("Life cycle"), list("\n", "\n", "\n", #> "These functions are experimental. We are still figuring out a good\n", #> "naming convention to refer to the different lisp-like lists in R.\n")), #> "\n", "\n", list("\n", list(list("is_call()")), #> " tests for language nodes.\n"), "\n", list( #> "internal"), "\n"), is_reference.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_reference"), "\n", list("is_reference"), #> "\n", list("Is an object referencing another?"), #> "\n", list("\n", "is_reference(x, y)\n"), "\n", #> list("\n", list(list("x, y"), list("R objects.")), #> "\n"), "\n", list("\n", "There are typically two situations where two symbols may refer to\n", #> "the same object.\n", list("\n", list(), " R objects usually have copy-on-write semantics. This is an\n", #> "optimisation that ensures that objects are only copied if\n", #> "needed. When you copy a vector, no memory is actually copied\n", #> "until you modify either the original object or the copy is\n", #> "modified.\n", "\n", "Note that the copy-on-write optimisation is an implementation\n", #> "detail that is not guaranteed by the specification of the R\n", #> "language.\n", list(), " Assigning an ", #> list("uncopyable"), " object (like an\n", #> "environment) creates a reference. These objects are never copied\n", #> "even if you modify one of the references.\n"), #> "\n"), "\n", list("\n", "# Reassigning an uncopyable object such as an environment creates a\n", #> "# reference:\n", "env <- env()\n", "ref <- env\n", #> "is_reference(ref, env)\n", "\n", "# Due to copy-on-write optimisation, a copied vector can\n", #> "# temporarily reference the original vector:\n", #> "vec <- 1:10\n", "copy <- vec\n", "is_reference(copy, vec)\n", #> "\n", "# Once you modify on of them, the copy is triggered in the\n", #> "# background and the objects cease to reference each other:\n", #> "vec[[1]] <- 100\n", "is_reference(copy, vec)\n"), #> "\n", list("internal"), "\n"), is_stack.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("is_stack"), "\n", list("is_stack"), #> "\n", list("is_eval_stack"), "\n", list("is_call_stack"), #> "\n", list("Is object a stack?"), "\n", list( #> "\n", "is_stack(x)\n", "\n", "is_eval_stack(x)\n", #> "\n", "is_call_stack(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n"), "\n", list("internal"), "\n"), is_symbol.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/sym.R", #> "\n", list("is_symbol"), "\n", list("is_symbol"), #> "\n", list("Is object a symbol?"), "\n", list( #> "\n", "is_symbol(x, name = NULL)\n"), "\n", #> list("\n", list(list("x"), list("An object to test.")), #> "\n", "\n", list(list("name"), list("An optional name or vector of names that the symbol\n", #> "should match.")), "\n"), "\n", list("\n", #> "Is object a symbol?\n"), "\n"), is_true.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_true"), "\n", list("is_true"), #> "\n", list("is_false"), "\n", list("Is object identical to TRUE or FALSE?"), #> "\n", list("\n", "is_true(x)\n", "\n", "is_false(x)\n"), #> "\n", list("\n", list(list("x"), list("object to test")), #> "\n"), "\n", list("\n", "These functions bypass R's automatic conversion rules and check\n", #> "that ", list("x"), " is literally ", list( #> "TRUE"), " or ", list("FALSE"), ".\n"), "\n", #> list("\n", "is_true(TRUE)\n", "is_true(1)\n", #> "\n", "is_false(FALSE)\n", "is_false(0)\n"), #> "\n"), is_weakref.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/weakref.R", #> "\n", list("is_weakref"), "\n", list("is_weakref"), #> "\n", list("Is object a weak reference?"), "\n", #> list("\n", "is_weakref(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", "Is object a weak reference?\n"), #> "\n"), lang.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("lang"), "\n", list("lang"), "\n", #> list("new_language"), "\n", list("Create a call"), #> "\n", list("\n", "lang(.fn, ..., .ns = NULL)\n", #> "\n", "new_language(head, tail = NULL)\n"), #> "\n", list("\n", list(list(".fn"), list("Function to call. Must be a callable object: a string,\n", #> "symbol, call, or a function.")), "\n", "\n", #> list(list("..."), list("<", list("dynamic"), #> "> Arguments for the function\n", "call. Empty arguments are preserved.")), #> "\n", "\n", list(list(".ns"), list("Namespace with which to prefix ", #> list(".fn"), ". Must be a string\n", "or symbol.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions are deprecated, please use ", #> list(list("call2()")), " and\n", list(list( #> "new_call()")), " instead.\n"), "\n", list( #> "internal"), "\n"), lang_head.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("lang_head"), "\n", list("lang_head"), #> "\n", list("lang_tail"), "\n", list("Return the head or tail of a call"), #> "\n", list("\n", "lang_head(lang)\n", "\n", "lang_tail(lang)\n"), #> "\n", list("\n", list(list("lang"), list("A call.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "As of rlang 0.2.0 these functions are retired (deprecated for now)\n", #> "because they are low level accessors that are rarely needed for end\n", #> "users.\n"), "\n", list("internal"), "\n"), #> lang_modify.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("lang_modify"), "\n", list("lang_modify"), #> "\n", list("lang_standardise"), "\n", list("lang_fn"), #> "\n", list("lang_name"), "\n", list("lang_args"), #> "\n", list("lang_args_names"), "\n", list("Manipulate or access a call"), #> "\n", list("\n", "lang_modify(.lang, ..., .standardise = FALSE)\n", #> "\n", "lang_standardise(lang)\n", "\n", "lang_fn(lang)\n", #> "\n", "lang_name(lang)\n", "\n", "lang_args(lang)\n", #> "\n", "lang_args_names(lang)\n"), "\n", list( #> "\n", list(list("..."), list("<", list("dynamic"), #> "> Named or unnamed expressions\n", "(constants, names or calls) used to modify the call. Use ", #> list(list("zap()")), "\n", "to remove arguments. Empty arguments are preserved.")), #> "\n", "\n", list(list(".standardise"), list( #> "Soft-deprecated as of rlang 0.3.0. Please\n", #> "call ", list(list("call_standardise()")), #> " manually.")), "\n", "\n", list(list("lang, .lang"), #> list("The ", list("call"), " or ", list(".call"), #> " argument of the renamed\n", "functions.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions are deprecated, please use ", #> list(list("call_modify()")), ",\n", list(list( #> "call_standardise()")), ", or ", list(list( #> "call_fn()")), " instead.\n"), "\n", list( #> "internal"), "\n"), last_error.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-abort.R", #> "\n", list("last_error"), "\n", list("last_error"), #> "\n", list("last_trace"), "\n", list("Last ", #> list("abort()"), " error"), "\n", list("\n", #> "last_error()\n", "\n", "last_trace()\n"), #> "\n", list("\n", list("\n", list(), " ", list( #> "last_error()"), " returns the last error thrown with ", #> list(list("abort()")), ". The\n", "error is printed with a backtrace in simplified form.\n", #> list(), " ", list("last_trace()"), " is a shortcut to return the backtrace stored in\n", #> "the last error. This backtrace is printed in full form.\n"), #> "\n"), "\n"), lifecycle.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle.R", #> "\n", list("lifecycle"), "\n", list("lifecycle"), #> "\n", list("Life cycle of the rlang package"), #> "\n", list("\n", list("rlang:::lifecycle(\"maturing\")"), #> "\n", "\n", "The rlang package is currently maturing. Unless otherwise stated,\n", #> "this applies to all its exported functions. Maturing functions are\n", #> "susceptible to API changes. Only use these in packages if you're\n", #> "prepared to make changes as the package evolves. See sections below\n", #> "for a list of functions marked as stable.\n", #> "\n", "The documentation pages of retired functions contain life cycle\n", #> "sections that explain the reasons for their retirements.\n"), #> "\n", list(list("Stable functions"), list("\n", #> "\n", "\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", list("\n", list(), " ", list(list("eval_tidy()")), #> "\n", list(), " ", list("!!"), ", ", list( #> "!!!"), "\n", list(), " ", list(list("enquo()")), #> ", ", list(list("quo()")), ", ", list(list( #> "quos()")), "\n", list(), " ", list(list( #> "enexpr()")), ", ", list(list("expr()")), #> ", ", list(list("exprs()")), "\n", list(), #> " ", list(list("sym()")), ", ", list(list( #> "syms()")), "\n", list(), " ", list(list( #> "new_quosure()")), ", ", list(list("is_quosure()")), #> "\n", list(), " ", list(list("missing_arg()")), #> ", ", list(list("is_missing()")), "\n", list(), #> " ", list(list("quo_get_expr()")), ", ", #> list(list("quo_set_expr()")), "\n", list(), #> " ", list(list("quo_get_env()")), ", ", list( #> list("quo_set_env()")), "\n", list(), " ", #> list(list("eval_bare()")), "\n", list(), #> " ", list(list("set_names()")), ", ", list( #> list("names2()")), "\n", list(), " ", list( #> list("as_function()")), ", ", list(list( #> "new_function()")), "\n"), "\n")), "\n", #> "\n", list(list("Experimental functions"), list( #> "\n", "\n", "\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "These functions are not yet part of the rlang API. Expect breaking\n", #> "changes.\n", list("\n", list(), " ", list( #> list("with_env()")), ", ", list(list("locally()")), #> ", ", list(list("env_poke()")), "\n", list(), #> " ", list(list("pkg_env()")), ", ", list( #> list("pkg_env_name()")), ", ", list(list( #> "ns_env()")), ", ", list(list("ns_imports_env()")), #> ", ", list(list("ns_env_name()")), "\n", #> list(), " ", list(list("is_pairlist()")), #> ", ", list(list("as_pairlist()")), ", ", #> list(list("is_node()")), ", ", list(list( #> "is_node_list()")), "\n", list(), " ", #> list(list("is_definition()")), ", ", list( #> list("new_definition()")), ", ", list(list( #> "is_formulaish()")), ",\n", list(list("dots_definitions()")), #> "\n", list(), " ", list(list("local_options()")), #> ", ", list(list("with_options()")), ", ", #> list(list("push_options()")), ",\n", list( #> list("peek_options()")), ", ", list(list( #> "peek_option()")), "\n", list(), " ", list( #> list("as_bytes()")), ", ", list(list("chr_unserialise_unicode()")), #> "\n", list(), " ", list(list("caller_fn()")), #> ", ", list(list("current_fn()")), "\n"), #> "\n")), "\n", "\n", list(list("Questioning stage"), #> list("\n", "\n", "\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", list("In the questioning stage as of rlang 0.4.0"), #> "\n", "\n", "These functions are likely to be moved to the vctrs package:\n", #> list("\n", list(), " ", list(list("lgl()")), #> ", ", list(list("int()")), ", etc.\n", #> list(), " ", list(list("new_logical()")), #> ", ", list(list("new_integer()")), ", etc.\n", #> list(), " ", list("na_lgl"), ", ", list( #> "na_int"), ", ", list(list("is_lgl_na()")), #> ", ", list(list("is_int_na()")), ", etc.\n"), #> "\n", "\n", list("In the questioning stage as of rlang 0.3.0"), #> "\n", list("\n", list(), " ", list(list("child_env()")), #> "\n", list(), " ", list(list("flatten()")), #> ", ", list(list("squash()")), ", and their atomic vector variants\n", #> list(), " ", list(list("modify()")), " and ", #> list(list("prepend()")), "\n", list(), #> " ", list(list("with_restarts()")), ", ", #> list(list("rst_list()")), ", ", list(list( #> "rst_exists()")), ", ", list(list("rst_jump()")), #> ",\n", list(list("rst_maybe_jump()")), #> ", ", list(list("rst_abort()")), ". It is not clear yet whether we\n", #> "want to recommend restarts as a style of programming in R.\n", #> list(), " ", list(list("return_from()")), #> " and ", list(list("return_to()")), ".\n", #> list(), " ", list(list("expr_label()")), #> ", ", list(list("expr_name()")), ", and ", #> list(list("expr_text()")), ".\n"), "\n", #> "\n", list("In the questioning stage as of rlang 0.2.0"), #> "\n", list("\n", list(), " ", list(list("UQ()")), #> ", ", list(list("UQS()")), "\n", list(), #> " ", list(list("dots_splice()")), ", ", #> list(list("splice()")), "\n"), "\n")), #> "\n", "\n", list(list("Soft-deprecated functions and arguments"), #> list("\n", "\n", "\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", "\n", list("Soft-deprecated in rlang 0.4.0"), #> "\n", list("\n", list(), " ", list(list("exiting()")), #> ": Handlers are now treated as exiting by default.\n", #> list(), " ", list(list("invoke()")), ": Use the simpler ", #> list(list("exec()")), " instead.\n", list(), #> " ", list(list("as_logical()")), ", ", #> list(list("as_integer()")), ", etc. => ", #> list("vctrs::vec_cast()"), ".\n", list(), #> " ", list(list("type_of()")), ", ", list( #> list("switch_type()")), ", ", list(list( #> "coerce_type()")), ", ", list(list("switch_class()")), #> ",\n", list(list("coerce_class()")), "\n"), #> "\n")), "\n", "\n", list(list("Deprecated functions and arguments"), #> list("\n", "\n", "\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", list("Bumped to deprecated in rlang 0.4.0"), #> "\n", list("\n", list(), " ", list(list("modify()")), #> " and ", list(list("prepend()")), ".\n", #> list(), " ", list("new_logical_along()"), #> ", ", list("new_integer_along()"), ",\n", #> list("new_double_along()"), ", ", list( #> "new_complex_along()"), ",\n", list("new_character_along()"), #> ", ", list("new_raw_along()"), ", ", list( #> "new_list_along()"), ".\n", list(), " ", #> list(list("lang_modify()")), " => ", list( #> list("call_modify()")), "\n", list(), #> " ", list(list("lang_standardise()")), #> " => ", list(list("call_standardise()")), #> "\n", list(), " ", list(list("lang_fn()")), #> " => ", list(list("call_fn()")), "\n", #> list(), " ", list(list("lang_name()")), #> " => ", list(list("call_name()")), "\n", #> list(), " ", list(list("lang_args()")), #> " => ", list(list("call_args()")), "\n", #> list(), " ", list(list("lang_args_names()")), #> " => ", list(list("call_args_names()")), #> "\n", list(), " ", list(list("lang_head()")), #> ", ", list(list("lang_tail()")), "\n", #> list(), " ", list(list("lang()")), " => ", #> list(list("call2()")), "\n", list(), " ", #> list(list("new_language()")), " => ", list( #> list("new_call()")), "\n", list(), " ", #> list(list("is_lang()")), " => ", list(list( #> "is_call()")), "\n", list(), " ", list( #> list("is_unary_lang()")), " => Use the ", #> list("n"), " argument of ", list(list("is_call()")), #> "\n", list(), " ", list(list("is_binary_lang()")), #> " => Use the ", list("n"), " argument of ", #> list(list("is_call()")), "\n", list(), #> " ", list(list("quo_is_lang()")), " => ", #> list(list("quo_is_call()")), "\n", list(), #> " ", list(list("call_modify()")), ": ", #> list(".standardise"), " and ", list(".env"), #> " arguments.\n", list(), " ", list(list( #> "is_expr()")), " => ", list(list("is_expression()")), #> "\n", list(), " ", list("quo_expr()"), #> " => ", list(list("quo_squash()")), "\n", #> list(), " ", list(list("parse_quosure()")), #> " => ", list(list("parse_quo()")), "\n", #> list(), " ", list(list("parse_quosures()")), #> " => ", list(list("parse_quos()")), "\n", #> list(), " Assigning non-quosure objects to quosure lists.\n", #> list(), " ", list("as.character()"), " on quosures.\n", #> list(), " ", list(list("cnd_signal()")), #> ": ", list(".cnd"), " => ", list("cnd"), #> "\n", list(), " ", list(list("cnd_signal()")), #> ": The ", list(".mufflable"), " argument no longer has any effect\n", #> list(), " ", list("scoped_names()"), " => ", #> list(list("base::search()")), "\n", list(), #> " ", list("is_scoped()"), " => ", list( #> list("is_attached()")), "\n", list(), #> " ", list("scoped_env()"), " => ", list( #> list("search_env()")), "\n", list(), #> " ", list("scoped_envs()"), " => ", list( #> list("search_envs()")), "\n", list(), #> " ", list("env_bind_exprs()"), " => ", #> list(list("env_bind_lazy()")), "\n", list(), #> " ", list("env_bind_fns()"), " => ", list( #> list("env_bind_active()")), "\n", list(), #> " Passing a function or formula to ", list( #> "env_depth()"), ",\n", list("env_poke_parent()"), #> ", ", list("env_parent<-"), ", ", list( #> "env_tail()"), ", ", list("set_env()"), #> ",\n", list("env_clone()"), ", ", list( #> "env_inherits()"), ", ", list("env_bind()"), #> ",\n", list("local_bindings()"), ", ", #> list("with_bindings()"), ", ", list("env_poke()"), #> ",\n", list("env_has()"), ", ", list("env_get()"), #> ", ", list("env_names()"), ", ", list("env_bind_exprs()"), #> " and\n", list("env_bind_fns()"), ". This internal genericity was causing confusion\n", #> "(see issue #427). You should now extract the environment\n", #> "separately before calling these functions.\n", #> list(), " ", list(list("get_env()")), ": The ", #> list("env"), " argument no longer has a default and must be supplied\n", #> list(), " ", list(list("is_frame()")), #> ", ", list(list("global_frame()")), ", ", #> list(list("current_frame()")), ",\n", list( #> list("ctxt_frame()")), ", ", list(list( #> "call_frame()")), ", ", list(list("frame_position()")), #> ",\n", list(list("caller_frame()")), "\n", #> list(), " ", list(list("ctxt_depth()")), #> ", ", list(list("call_depth()")), ", ", #> list(list("ctxt_stack()")), ", ", list( #> list("call_stack()")), ",\n", list(list( #> "stack_trim()")), "\n", list(), " ", #> list(list("set_attrs()")), ", ", list(list( #> "mut_attrs()")), "\n", list(), " The ", #> list("width"), " and ", list("printer"), #> " arguments of ", list(list("exprs_auto_name()")), #> " and\n", list(list("quos_auto_name()")), #> " no longer have any effect. For the same\n", #> "reason, passing a width as ", list(".named"), #> " argument of dots collectors\n", "like ", #> list("quos()"), " is deprecated.\n", list(), #> " ", list("as_overscope()"), " => ", list( #> list("as_data_mask()")), "\n", list(), #> " ", list("new_overscope()"), " => ", list( #> list("new_data_mask()")), "\n", list(), #> " ", list("overscope_eval_next()"), " => ", #> list(list("eval_tidy()")), "\n", list(), #> " ", list("overscope_clean()"), "\n"), #> "\n")), "\n", "\n", list(list("Defunct functions and arguments"), #> list("\n", "\n", "\n", list("rlang:::lifecycle(\"defunct\")"), #> "\n", "\n", list("Defunct as of rlang 0.4.0"), #> "\n", list("\n", list(), " ", list("length()"), #> " and ", list("names()"), " on tidy eval ", #> list(".data"), " pronouns.\n", list(), #> " Supplying a named ", list("!!!"), " call.\n"), #> "\n")), "\n", "\n", list("internal"), "\n"), #> list2.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("list2"), "\n", list("list2"), "\n", #> list("ll"), "\n", list("dots_list"), "\n", list( #> "Collect dots in a list"), "\n", list("\n", #> "list2(...)\n", "\n", "dots_list(\n", " ...,\n", #> " .named = FALSE,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .preserve_empty = FALSE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n"), "\n", #> list("\n", list(list("..."), list("Arguments to collect in a list. These dots are\n", #> list("dynamic"), ".")), "\n", "\n", list(list( #> ".named"), list("Whether to ensure all dots are named. Unnamed\n", #> "elements are processed with ", list(list("as_label()")), #> " to build a default\n", "name.")), "\n", "\n", #> list(list(".ignore_empty"), list("Whether to ignore empty arguments. Can be one\n", #> "of ", list("\"trailing\""), ", ", list("\"none\""), #> ", ", list("\"all\""), ". If ", list("\"trailing\""), #> ", only the\n", "last argument is ignored if it is empty.")), #> "\n", "\n", list(list(".preserve_empty"), list( #> "Whether to preserve the empty arguments that\n", #> "were not ignored. If ", list("TRUE"), ", empty arguments are stored with\n", #> list(list("missing_arg()")), " values. If ", #> list("FALSE"), " (the default) an error is\n", #> "thrown when an empty argument is detected.")), #> "\n", "\n", list(list(".homonyms"), list("How to treat arguments with the same name. The\n", #> "default, ", list("\"keep\""), ", preserves these arguments. Set ", #> list(".homonyms"), " to\n", list("\"first\""), #> " to only keep the first occurrences, to ", #> list("\"last\""), " to keep\n", "the last occurrences, and to ", #> list("\"error\""), " to raise an informative\n", #> "error and indicate what arguments have duplicated names.")), #> "\n", "\n", list(list(".check_assign"), list( #> "Whether to check for ", list("<-"), " calls passed in\n", #> "dots. When ", list("TRUE"), " and a ", list( #> "<-"), " call is detected, a warning is\n", #> "issued to advise users to use ", list("="), #> " if they meant to match a\n", "function parameter, or wrap the ", #> list("<-"), " call in braces otherwise.\n", #> "This ensures assignments are explicit.")), #> "\n"), "\n", list("\n", "A list containing the ", #> list("..."), " inputs.\n"), "\n", list("\n", #> list("list2(...)"), " is equivalent to ", list( #> "list(...)"), " with a few additional\n", #> "features, collectively called ", list("dynamic dots"), #> ". While\n", list("list2()"), " hard-code these features, ", #> list("dots_list()"), " is a lower-level\n", #> "version that offers more control.\n"), "\n", #> list("\n", "# Let's create a function that takes a variable number of arguments:\n", #> "numeric <- function(...) {\n", " dots <- list2(...)\n", #> " num <- as.numeric(dots)\n", " set_names(num, names(dots))\n", #> "}\n", "numeric(1, 2, 3)\n", "\n", "# The main difference with list(...) is that list2(...) enables\n", #> "# the `!!!` syntax to splice lists:\n", "x <- list(2, 3)\n", #> "numeric(1, !!! x, 4)\n", "\n", "# As well as unquoting of names:\n", #> "nm <- \"yup!\"\n", "numeric(!!nm := 1)\n", #> "\n", "\n", "# One useful application of splicing is to work around exact and\n", #> "# partial matching of arguments. Let's create a function taking\n", #> "# named arguments and dots:\n", "fn <- function(data, ...) {\n", #> " list2(...)\n", "}\n", "\n", "# You normally cannot pass an argument named `data` through the dots\n", #> "# as it will match `fn`'s `data` argument. The splicing syntax\n", #> "# provides a workaround:\n", "fn(\"wrong!\", data = letters) # exact matching of `data`\n", #> "fn(\"wrong!\", dat = letters) # partial matching of `data`\n", #> "fn(some_data, !!!list(data = letters)) # no matching\n", #> "\n", "\n", "# Empty arguments trigger an error by default:\n", #> "try(fn(, ))\n", "\n", "# You can choose to preserve empty arguments instead:\n", #> "list3 <- function(...) dots_list(..., .preserve_empty = TRUE)\n", #> "\n", "# Note how the last empty argument is still ignored because\n", #> "# `.ignore_empty` defaults to \"trailing\":\n", #> "list3(, )\n", "\n", "# The list with preserved empty arguments is equivalent to:\n", #> "list(missing_arg())\n", "\n", "\n", "# Arguments with duplicated names are kept by default:\n", #> "list2(a = 1, a = 2, b = 3, b = 4, 5, 6)\n", #> "\n", "# Use the `.homonyms` argument to keep only the first of these:\n", #> "dots_list(a = 1, a = 2, b = 3, b = 4, 5, 6, .homonyms = \"first\")\n", #> "\n", "# Or the last:\n", "dots_list(a = 1, a = 2, b = 3, b = 4, 5, 6, .homonyms = \"last\")\n", #> "\n", "# Or raise an informative error:\n", #> "try(dots_list(a = 1, a = 2, b = 3, b = 4, 5, 6, .homonyms = \"error\"))\n", #> "\n", "\n", "# dots_list() can be configured to warn when a `<-` call is\n", #> "# detected:\n", "my_list <- function(...) dots_list(..., .check_assign = TRUE)\n", #> "my_list(a <- 1)\n", "\n", "# There is no warning if the assignment is wrapped in braces.\n", #> "# This requires users to be explicit about their intent:\n", #> "my_list({ a <- 1 })\n"), "\n"), local_bindings.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("local_bindings"), "\n", list("local_bindings"), #> "\n", list("with_bindings"), "\n", list("Temporarily change bindings of an environment"), #> "\n", list("\n", "local_bindings(..., .env = .frame, .frame = caller_env())\n", #> "\n", "with_bindings(.expr, ..., .env = caller_env())\n"), #> "\n", list("\n", list(list("..."), list("Pairs of names and values. These dots support splicing\n", #> "(with value semantics) and name unquoting.")), #> "\n", "\n", list(list(".env"), list("An environment.")), #> "\n", "\n", list(list(".frame"), list("The frame environment that determines the scope of\n", #> "the temporary bindings. When that frame is popped from the call\n", #> "stack, bindings are switched back to their original values.")), #> "\n", "\n", list(list(".expr"), list("An expression to evaluate with temporary bindings.")), #> "\n"), "\n", list("\n", list("local_bindings()"), #> " returns the values of old bindings\n", "invisibly; ", #> list("with_bindings()"), " returns the value of ", #> list("expr"), ".\n"), "\n", list("\n", list( #> "\n", list(), " ", list("local_bindings()"), #> " temporarily changes bindings in ", list(".env"), #> " (which\n", "is by default the caller environment). The bindings are reset to\n", #> "their original values when the current frame (or an arbitrary one\n", #> "if you specify ", list(".frame"), ") goes out of scope.\n", #> list(), " ", list("with_bindings()"), " evaluates ", #> list("expr"), " with temporary bindings. When\n", #> list("with_bindings()"), " returns, bindings are reset to their original\n", #> "values. It is a simple wrapper around ", list( #> "local_bindings()"), ".\n"), "\n"), "\n", #> list("\n", "foo <- \"foo\"\n", "bar <- \"bar\"\n", #> "\n", "# `foo` will be temporarily rebinded while executing `expr`\n", #> "with_bindings(paste(foo, bar), foo = \"rebinded\")\n", #> "paste(foo, bar)\n"), "\n"), local_options.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/state.R", #> "\n", list("local_options"), "\n", list("local_options"), #> "\n", list("with_options"), "\n", list("push_options"), #> "\n", list("peek_options"), "\n", list("peek_option"), #> "\n", list("Change global options"), "\n", list( #> "\n", "local_options(..., .frame = caller_env())\n", #> "\n", "with_options(.expr, ...)\n", "\n", "push_options(...)\n", #> "\n", "peek_options(...)\n", "\n", "peek_option(name)\n"), #> "\n", list("\n", list(list("..."), list("For ", #> list("local_options()"), " and ", list("push_options()"), #> ", named\n", "values defining new option values. For ", #> list("peek_options()"), ", strings\n", "or character vectors of option names.")), #> "\n", "\n", list(list(".frame"), list("The environment of a stack frame which defines the\n", #> "scope of the temporary options. When the frame returns, the\n", #> "options are set back to their original values.")), #> "\n", "\n", list(list(".expr"), list("An expression to evaluate with temporary options.")), #> "\n", "\n", list(list("name"), list("An option name as string.")), #> "\n"), "\n", list("\n", "For ", list("local_options()"), #> " and ", list("push_options()"), ", the old option\n", #> "values. ", list("peek_option()"), " returns the current value of an option\n", #> "while the plural ", list("peek_options()"), #> " returns a list of current\n", "option values.\n"), #> "\n", list("\n", list("\n", list(), " ", list( #> "local_options()"), " changes options for the duration of a stack\n", #> "frame (by default the current one). Options are set back to their\n", #> "old values when the frame returns.\n", list(), #> " ", list("with_options()"), " changes options while an expression is\n", #> "evaluated. Options are restored when the expression returns.\n", #> list(), " ", list("push_options()"), " adds or changes options permanently.\n", #> list(), " ", list("peek_option()"), " and ", #> list("peek_options()"), " return option values. The\n", #> "former returns the option directly while the latter returns a\n", #> "list.\n"), "\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "These functions are experimental.\n")), #> "\n", "\n", list("\n", "# Store and retrieve a global option:\n", #> "push_options(my_option = 10)\n", "peek_option(\"my_option\")\n", #> "\n", "# Change the option temporarily:\n", #> "with_options(my_option = 100, peek_option(\"my_option\"))\n", #> "peek_option(\"my_option\")\n", "\n", "# The scoped variant is useful within functions:\n", #> "fn <- function() {\n", " local_options(my_option = 100)\n", #> " peek_option(\"my_option\")\n", "}\n", "fn()\n", #> "peek_option(\"my_option\")\n", "\n", "# The plural peek returns a named list:\n", #> "peek_options(\"my_option\")\n", "peek_options(\"my_option\", \"digits\")\n"), #> "\n", list("experimental"), "\n"), missing.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-na.R", #> "\n", list("data"), "\n", list("missing"), "\n", #> list("missing"), "\n", list("na_lgl"), "\n", #> list("na_int"), "\n", list("na_dbl"), "\n", list( #> "na_chr"), "\n", list("na_cpl"), "\n", list( #> "Missing values"), "\n", list("\n", "An object of class ", #> list("logical"), " of length 1.\n", "\n", "An object of class ", #> list("integer"), " of length 1.\n", "\n", "An object of class ", #> list("numeric"), " of length 1.\n", "\n", "An object of class ", #> list("character"), " of length 1.\n", "\n", #> "An object of class ", list("complex"), " of length 1.\n"), #> "\n", list("\n", "na_lgl\n", "\n", "na_int\n", #> "\n", "na_dbl\n", "\n", "na_chr\n", "\n", "na_cpl\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "Missing values are represented in R with the general symbol\n", #> list("NA"), ". They can be inserted in almost all data containers: all\n", #> "atomic vectors except raw vectors can contain missing values. To\n", #> "achieve this, R automatically converts the general ", #> list("NA"), " symbol to a\n", "typed missing value appropriate for the target vector. The objects\n", #> "provided here are aliases for those typed ", #> list("NA"), " objects.\n"), "\n", list("\n", #> "Typed missing values are necessary because R needs sentinel values\n", #> "of the same type (i.e. the same machine representation of the data)\n", #> "as the containers into which they are inserted. The official typed\n", #> "missing values are ", list("NA_integer_"), #> ", ", list("NA_real_"), ", ", list("NA_character_"), #> " and\n", list("NA_complex_"), ". The missing value for logical vectors is simply the\n", #> "default ", list("NA"), ". The aliases provided in rlang are consistently named\n", #> "and thus simpler to remember. Also, ", list( #> "na_lgl"), " is provided as an\n", "alias to ", #> list("NA"), " that makes intent clearer.\n", #> "\n", "Since ", list("na_lgl"), " is the default ", #> list("NA"), ", expressions such as ", list( #> "c(NA, NA)"), "\n", "yield logical vectors as no data is available to give a clue of the\n", #> "target type. In the same way, since lists and environments can\n", #> "contain any types, expressions like ", list( #> "list(NA)"), " store a logical\n", list("NA"), #> ".\n"), "\n", list(list("Life cycle"), list( #> "\n", "\n", "\n", "These shortcuts might be moved to the vctrs package at some\n", #> "point. This is why they are marked as questioning.\n")), #> "\n", "\n", list("\n", "typeof(NA)\n", "typeof(na_lgl)\n", #> "typeof(na_int)\n", "\n", "# Note that while the base R missing symbols cannot be overwritten,\n", #> "# that's not the case for rlang's aliases:\n", #> "na_dbl <- NA\n", "typeof(na_dbl)\n"), "\n", #> list("datasets"), "\n", list("internal"), "\n"), #> missing_arg.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/arg.R", #> "\n", list("missing_arg"), "\n", list("missing_arg"), #> "\n", list("is_missing"), "\n", list("maybe_missing"), #> "\n", list("Generate or handle a missing argument"), #> "\n", list("\n", "missing_arg()\n", "\n", "is_missing(x)\n", #> "\n", "maybe_missing(x, default = missing_arg())\n"), #> "\n", list("\n", list(list("x"), list("An object that might be the missing argument.")), #> "\n", "\n", list(list("default"), list("The object to return if the input is missing,\n", #> "defaults to ", list("missing_arg()"), ".")), #> "\n"), "\n", list("\n", "These functions help using the missing argument as a regular R\n", #> "object.\n", list("\n", list(), " ", list("missing_arg()"), #> " generates a missing argument.\n", list(), #> " ", list("is_missing()"), " is like ", list( #> list("base::missing()")), " but also supports\n", #> "testing for missing arguments contained in other objects like\n", #> "lists.\n", list(), " ", list("maybe_missing()"), #> " is useful to pass down an input that might be\n", #> "missing to another function, potentially substituting by a\n", #> "default value. It avoids triggering an \"argument is missing\" error.\n"), #> "\n"), "\n", list(list("Other ways to reify the missing argument"), #> list("\n", "\n", list("\n", list(), " ", list( #> "base::quote(expr = )"), " is the canonical way to create a missing\n", #> "argument object.\n", list(), " ", list("expr()"), #> " called without argument creates a missing argument.\n", #> list(), " ", list("quo()"), " called without argument creates an empty quosure, i.e. a\n", #> "quosure containing the missing argument object.\n"), #> "\n")), "\n", "\n", list(list("Fragility of the missing argument object"), #> list("\n", "\n", "\n", "The missing argument is an object that triggers an error if and\n", #> "only if it is the result of evaluating a symbol. No error is\n", #> "produced when a function call evaluates to the missing argument\n", #> "object. This means that expressions like ", #> list("x[[1]] <- missing_arg()"), "\n", "are perfectly safe. Likewise, ", #> list("x[[1]]"), " is safe even if the result\n", #> "is the missing object.\n", "\n", "However, as soon as the missing argument is passed down between\n", #> "functions through an argument, you're at risk of triggering a\n", #> "missing error. This is because arguments are passed through\n", #> "symbols. To work around this, ", list("is_missing()"), #> " and ", list("maybe_missing(x)"), "\n", #> "use a bit of magic to determine if the input is the missing\n", #> "argument without triggering a missing error.\n", #> "\n", list("maybe_missing()"), " is particularly useful for prototyping\n", #> "meta-programming algorithms in R. The missing argument is a likely\n", #> "input when computing on the language because it is a standard\n", #> "object in formals lists. While C functions are always allowed to\n", #> "return the missing argument and pass it to other C functions, this\n", #> "is not the case on the R side. If you're implementing your\n", #> "meta-programming algorithm in R, use ", #> list("maybe_missing()"), " when an\n", "input might be the missing argument object.\n")), #> "\n", "\n", list(list("Life cycle"), list("\n", #> "\n", list("\n", list(), " ", list("missing_arg()"), #> " and ", list("is_missing()"), " are stable.\n", #> list(), " Like the rest of rlang, ", list( #> "maybe_missing()"), " is maturing.\n"), #> "\n")), "\n", "\n", list("\n", "# The missing argument usually arises inside a function when the\n", #> "# user omits an argument that does not have a default:\n", #> "fn <- function(x) is_missing(x)\n", "fn()\n", #> "\n", "# Creating a missing argument can also be useful to generate calls\n", #> "args <- list(1, missing_arg(), 3, missing_arg())\n", #> "quo(fn(!!! args))\n", "\n", "# Other ways to create that object include:\n", #> "quote(expr = )\n", "expr()\n", "\n", "# It is perfectly valid to generate and assign the missing\n", #> "# argument in a list.\n", "x <- missing_arg()\n", #> "l <- list(missing_arg())\n", "\n", "# Just don't evaluate a symbol that contains the empty argument.\n", #> "# Evaluating the object `x` that we created above would trigger an\n", #> "# error.\n", "# x # Not run\n", "\n", "# On the other hand accessing a missing argument contained in a\n", #> "# list does not trigger an error because subsetting is a function\n", #> "# call:\n", "l[[1]]\n", "is.null(l[[1]])\n", #> "\n", "# In case you really need to access a symbol that might contain the\n", #> "# empty argument object, use maybe_missing():\n", #> "maybe_missing(x)\n", "is.null(maybe_missing(x))\n", #> "is_missing(maybe_missing(x))\n", "\n", "\n", #> "# Note that base::missing() only works on symbols and does not\n", #> "# support complex expressions. For this reason the following lines\n", #> "# would throw an error:\n", "\n", "#> missing(missing_arg())\n", #> "#> missing(l[[1]])\n", "\n", "# while is_missing() will work as expected:\n", #> "is_missing(missing_arg())\n", "is_missing(l[[1]])\n"), #> "\n"), mut_node_car.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("mut_node_car"), "\n", list("mut_node_car"), #> "\n", list("mut_node_cdr"), "\n", list("mut_node_caar"), #> "\n", list("mut_node_cadr"), "\n", list("mut_node_cdar"), #> "\n", list("mut_node_cddr"), "\n", list("mut_node_tag"), #> "\n", list("Mutate node components"), "\n", list( #> "\n", "mut_node_car(x, newcar)\n", "\n", "mut_node_cdr(x, newcdr)\n", #> "\n", "mut_node_caar(x, newcar)\n", "\n", "mut_node_cadr(x, newcar)\n", #> "\n", "mut_node_cdar(x, newcdr)\n", "\n", "mut_node_cddr(x, newcdr)\n", #> "\n", "mut_node_tag(x, newtag)\n"), "\n", list( #> "\n", list(list("x"), list("A language or pairlist node. Note that these functions are\n", #> "barebones and do not perform any type checking.")), #> "\n", "\n", list(list("newcar"), list("The new CAR or CDR for the node. These\n", #> "can be any R objects.")), "\n", "\n", list( #> list("newcdr"), list("The new CAR or CDR for the node. These\n", #> "can be any R objects.")), "\n", "\n", #> list(list("newtag"), list("The new tag for the node. This should be a symbol.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions were deprecated and renamed with ", #> list("node_poke_"), "\n", "prefix in rlang 0.2.0. This change follows a new naming convention\n", #> "where mutation is referred to as \"poking\".\n"), #> "\n", list("internal"), "\n"), names2.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("names2"), "\n", list("names2"), "\n", #> list("Get names of a vector"), "\n", list("\n", #> "names2(x)\n"), "\n", list("\n", list(list( #> "x"), list("A vector.")), "\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", "This names getter always returns a character vector, even when an\n", #> "object does not have a ", list("names"), " attribute. In this case, it returns\n", #> "a vector of empty names ", list("\"\""), ". It also standardises missing names to\n", #> list("\"\""), ".\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", list("names2()"), " is stable.\n")), #> "\n", "\n", list("\n", "names2(letters)\n", "\n", #> "# It also takes care of standardising missing names:\n", #> "x <- set_names(1:3, c(\"a\", NA, \"b\"))\n", #> "names2(x)\n"), "\n"), `new-vector-along-retired.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("new-vector-along-retired"), "\n", #> list("new-vector-along-retired"), "\n", list( #> "new_logical_along"), "\n", list("new_integer_along"), #> "\n", list("new_double_along"), "\n", list("new_character_along"), #> "\n", list("new_complex_along"), "\n", list("new_raw_along"), #> "\n", list("new_list_along"), "\n", list("Create vectors matching the length of a given vector"), #> "\n", list("\n", "new_logical_along(x, names = base::names(x))\n", #> "\n", "new_integer_along(x, names = base::names(x))\n", #> "\n", "new_double_along(x, names = base::names(x))\n", #> "\n", "new_character_along(x, names = base::names(x))\n", #> "\n", "new_complex_along(x, names = base::names(x))\n", #> "\n", "new_raw_along(x, names = base::names(x))\n", #> "\n", "new_list_along(x, names = base::names(x))\n"), #> "\n", list("\n", list(list("x"), list("A vector.")), #> "\n", "\n", list(list("names"), list("Names for the new vector.")), #> "\n"), "\n", list("\n", "These functions are deprecated as of rlang 0.3.0 because they\n", #> "are longer to type than the equivalent ", #> list(list("rep_along()")), " or\n", list(list( #> "rep_named()")), " calls without added clarity.\n"), #> "\n", list("internal"), "\n"), `new-vector.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-new.R", #> "\n", list("new-vector"), "\n", list("new-vector"), #> "\n", list("new_logical"), "\n", list("new_integer"), #> "\n", list("new_double"), "\n", list("new_character"), #> "\n", list("new_complex"), "\n", list("new_raw"), #> "\n", list("new_list"), "\n", list("Create vectors matching a given length"), #> "\n", list("\n", "new_logical(n, names = NULL)\n", #> "\n", "new_integer(n, names = NULL)\n", "\n", #> "new_double(n, names = NULL)\n", "\n", "new_character(n, names = NULL)\n", #> "\n", "new_complex(n, names = NULL)\n", "\n", #> "new_raw(n, names = NULL)\n", "\n", "new_list(n, names = NULL)\n"), #> "\n", list("\n", list(list("n"), list("The vector length.")), #> "\n", "\n", list(list("names"), list("Names for the new vector.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "These functions construct vectors of a given length, with attributes\n", #> "specified via dots. Except for ", list("new_list()"), #> " and ", list("new_raw()"), ", the\n", "empty vectors are filled with typed ", #> list("missing"), " values. This is in\n", "contrast to the base function ", #> list(list("base::vector()")), " which creates\n", #> "zero-filled vectors.\n"), "\n", list(list( #> "Lifecycle"), list("\n", "\n", "\n", "These functions are likely to be replaced by a vctrs equivalent in\n", #> "the future. They are in the questioning lifecycle stage.\n")), #> "\n", "\n", list("\n", "new_list(10)\n", "new_logical(10)\n"), #> "\n", list("\n", "rep_along\n"), "\n", list("internal"), #> "\n"), new_call.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/node.R", #> "\n", list("new_call"), "\n", list("new_call"), #> "\n", list("Create a new call from components"), #> "\n", list("\n", "new_call(car, cdr = NULL)\n"), #> "\n", list("\n", list(list("car"), list("The head of the call. It should be a\n", #> list("callable"), " object: a symbol, call, or literal\n", #> "function.")), "\n", "\n", list(list("cdr"), #> list("The tail of the call, i.e. a ", list( #> "node list"), " of\n", "arguments.")), "\n"), #> "\n", list("\n", "Create a new call from components\n"), #> "\n", list("internal"), "\n"), new_formula.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/formula.R", #> "\n", list("new_formula"), "\n", list("new_formula"), #> "\n", list("Create a formula"), "\n", list("\n", #> "new_formula(lhs, rhs, env = caller_env())\n"), #> "\n", list("\n", list(list("lhs, rhs"), list( #> "A call, name, or atomic vector.")), "\n", #> "\n", list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "A formula object.\n"), #> "\n", list("\n", "Create a formula\n"), "\n", #> list("\n", "new_formula(quote(a), quote(b))\n", #> "new_formula(NULL, quote(b))\n"), "\n", list( #> "\n", list(list("new_quosure()")), "\n"), "\n"), #> new_function.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("new_function"), "\n", list("new_function"), #> "\n", list("Create a function"), "\n", list("\n", #> "new_function(args, body, env = caller_env())\n"), #> "\n", list("\n", list(list("args"), list("A named list or pairlist of default arguments. Note\n", #> "that if you want arguments that don't have defaults, you'll need\n", #> "to use the special function ", list(list("pairlist2()")), #> ". If you need quoted\n", "defaults, use ", #> list(list("exprs()")), ".")), "\n", "\n", list( #> list("body"), list("A language object representing the code inside the\n", #> "function. Usually this will be most easily generated with\n", #> list(list("base::quote()")))), "\n", "\n", #> list(list("env"), list("The parent environment of the function, defaults to the\n", #> "calling environment of ", list("new_function()"))), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", "This constructs a new function given its three components:\n", #> "list of arguments, body code and parent environment.\n"), #> "\n", list("\n", "f <- function() letters\n", #> "g <- new_function(NULL, quote(letters))\n", #> "identical(f, g)\n", "\n", "# Pass a list or pairlist of named arguments to create a function\n", #> "# with parameters. The name becomes the parameter name and the\n", #> "# argument the default value for this parameter:\n", #> "new_function(list(x = 10), quote(x))\n", "new_function(pairlist2(x = 10), quote(x))\n", #> "\n", "# Use `exprs()` to create quoted defaults. Compare:\n", #> "new_function(pairlist2(x = 5 + 5), quote(x))\n", #> "new_function(exprs(x = 5 + 5), quote(x))\n", #> "\n", "# Pass empty arguments to omit defaults. `list()` doesn't allow\n", #> "# empty arguments but `pairlist2()` does:\n", #> "new_function(pairlist2(x = , y = 5 + 5), quote(x + y))\n", #> "new_function(exprs(x = , y = 5 + 5), quote(x + y))\n"), #> "\n"), new_node.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/node.R", #> "\n", list("new_node"), "\n", list("new_node"), #> "\n", list("node_car"), "\n", list("node_cdr"), #> "\n", list("node_caar"), "\n", list("node_cadr"), #> "\n", list("node_cdar"), "\n", list("node_cddr"), #> "\n", list("node_poke_car"), "\n", list("node_poke_cdr"), #> "\n", list("node_poke_caar"), "\n", list("node_poke_cadr"), #> "\n", list("node_poke_cdar"), "\n", list("node_poke_cddr"), #> "\n", list("node_tag"), "\n", list("node_poke_tag"), #> "\n", list("Helpers for pairlist and language nodes"), #> "\n", list("\n", "new_node(car, cdr = NULL)\n", #> "\n", "node_car(x)\n", "\n", "node_cdr(x)\n", #> "\n", "node_caar(x)\n", "\n", "node_cadr(x)\n", #> "\n", "node_cdar(x)\n", "\n", "node_cddr(x)\n", #> "\n", "node_poke_car(x, newcar)\n", "\n", "node_poke_cdr(x, newcdr)\n", #> "\n", "node_poke_caar(x, newcar)\n", "\n", #> "node_poke_cadr(x, newcar)\n", "\n", "node_poke_cdar(x, newcdr)\n", #> "\n", "node_poke_cddr(x, newcdr)\n", "\n", #> "node_tag(x)\n", "\n", "node_poke_tag(x, newtag)\n"), #> "\n", list("\n", list(list("car, newcar, cdr, newcdr"), #> list("The new CAR or CDR for the node. These\n", #> "can be any R objects.")), "\n", "\n", list( #> list("x"), list("A language or pairlist node. Note that these functions are\n", #> "barebones and do not perform any type checking.")), #> "\n", "\n", list(list("newtag"), list("The new tag for the node. This should be a symbol.")), #> "\n"), "\n", list("\n", "Setters like ", list( #> "node_poke_car()"), " invisibly return ", list( #> "x"), " modified\n", "in place. Getters return the requested node component.\n"), #> "\n", list("\n", list("Important"), ": These functions are for expert R programmers only.\n", #> "You should only use them if you feel comfortable manipulating low\n", #> "level R data structures at the C level. We export them at the R level\n", #> "in order to make it easy to prototype C code. They don't perform\n", #> "any type checking and can crash R very easily (try to take the CAR\n", #> "of an integer vector --- save any important objects beforehand!).\n"), #> "\n", list("\n", list(list("duplicate()")), " for creating copy-safe objects and\n", #> list(list("base::pairlist()")), " for an easier way of creating a linked list of\n", #> "nodes.\n"), "\n", list("internal"), "\n"), #> new_quosures.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/quo.R", #> "\n", list("new_quosures"), "\n", list("new_quosures"), #> "\n", list("as_quosures"), "\n", list("is_quosures"), #> "\n", list("Create a list of quosures"), "\n", #> list("\n", "new_quosures(x)\n", "\n", "as_quosures(x, env, named = FALSE)\n", #> "\n", "is_quosures(x)\n"), "\n", list("\n", #> list(list("x"), list("A list of quosures or objects to coerce to quosures.")), #> "\n", "\n", list(list("env"), list("The default environment for the new quosures.")), #> "\n", "\n", list(list("named"), list("Whether to name the list with ", #> list(list("quos_auto_name()")), ".")), "\n"), #> "\n", list("\n", "This small S3 class provides methods for ", #> list("["), " and ", list("c()"), " and ensures\n", #> "the following invariants:\n", list("\n", list(), #> " The list only contains quosures.\n", list(), #> " It is always named, possibly with a vector of empty strings.\n"), #> "\n", "\n", list("new_quosures()"), " takes a list of quosures and adds the ", #> list("quosures"), "\n", "class and a vector of empty names if needed. ", #> list("as_quosures()"), " calls\n", list(list( #> "as_quosure()")), " on all elements before creating the ", #> list("quosures"), "\n", "object.\n"), "\n"), #> new_weakref.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/weakref.R", #> "\n", list("new_weakref"), "\n", list("new_weakref"), #> "\n", list("Create a weak reference"), "\n", #> list("\n", "new_weakref(key, value = NULL, finalizer = NULL, on_quit = FALSE)\n"), #> "\n", list("\n", list(list("key"), list("The key for the weak reference. Must be a reference object -- that\n", #> "is, an environment or external pointer.")), #> "\n", "\n", list(list("value"), list("The value for the weak reference. This can be ", #> list("NULL"), ", if you\n", "want to use the weak reference like a weak pointer.")), #> "\n", "\n", list(list("finalizer"), list("A function that is run after the key becomes unreachable.")), #> "\n", "\n", list(list("on_quit"), list("Should the finalizer be run when R exits?")), #> "\n"), "\n", list("\n", "A weak reference is a special R object which makes it possible to keep a\n", #> "reference to an object without preventing garbage collection of that object.\n", #> "It can also be used to keep data about an object without preventing GC of the\n", #> "object, similar to WeakMaps in JavaScript.\n", #> "\n", "Objects in R are considered ", list( #> "reachable"), " if they can be accessed by following\n", #> "a chain of references, starting from a ", #> list("root node"), "; root nodes are\n", "specially-designated R objects, and include the global environment and base\n", #> "environment. As long as the key is reachable, the value will not be garbage\n", #> "collected. This is true even if the weak reference object becomes\n", #> "unreachable. The key effectively prevents the weak reference and its value\n", #> "from being collected, according to the following chain of ownership:\n", #> list("weakref <- key -> value"), ".\n", "\n", #> "When the key becomes unreachable, the key and value in the weak reference\n", #> "object are replaced by ", list("NULL"), ", and the finalizer is scheduled to execute.\n"), #> "\n", list("\n", "e <- env()\n", "\n", "# Create a weak reference to e\n", #> "w <- new_weakref(e, finalizer = function(e) message(\"finalized\"))\n", #> "\n", "# Get the key object from the weak reference\n", #> "identical(wref_key(w), e)\n", "\n", "# When the regular reference (the `e` binding) is removed and a GC occurs,\n", #> "# the weak reference will not keep the object alive.\n", #> "rm(e)\n", "gc()\n", "identical(wref_key(w), NULL)\n", #> "\n", "\n", "# A weak reference with a key and value. The value contains data about the\n", #> "# key.\n", "k <- env()\n", "v <- list(1, 2, 3)\n", #> "w <- new_weakref(k, v)\n", "\n", "identical(wref_key(w), k)\n", #> "identical(wref_value(w), v)\n", "\n", "# When v is removed, the weak ref keeps it alive because k is still reachable.\n", #> "rm(v)\n", "gc()\n", "identical(wref_value(w), list(1, 2, 3))\n", #> "\n", "# When k is removed, the weak ref does not keep k or v alive.\n", #> "rm(k)\n", "gc()\n", "identical(wref_key(w), NULL)\n", #> "identical(wref_value(w), NULL)\n"), "\n", #> list("\n", list(list("is_weakref()")), ", ", #> list(list("wref_key()")), " and ", list(list( #> "wref_value()")), ".\n"), "\n", list("experimental"), #> "\n"), ns_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("ns_env"), "\n", list("ns_env"), "\n", #> list("ns_imports_env"), "\n", list("ns_env_name"), #> "\n", list("Get the namespace of a package"), #> "\n", list("\n", "ns_env(x = caller_env())\n", #> "\n", "ns_imports_env(x = caller_env())\n", #> "\n", "ns_env_name(x = caller_env())\n"), "\n", #> list("\n", list(list("x"), list(list("\n", list(), #> " For ", list("ns_env()"), ", the name of a package or an environment as a\n", #> "string.\n", list("\n", list(), " An environment (the current environment by default).\n", #> list(), " A function.\n"), "\n", "\n", "In the latter two cases, the environment ancestry is searched for\n", #> "a namespace with ", list(list("base::topenv()")), #> ". If the environment doesn't\n", "inherit from a namespace, this is an error.\n"))), #> "\n", "\n", list(list("env"), list("A namespace environment.")), #> "\n"), "\n", list("\n", "Namespaces are the environment where all the functions of a package\n", #> "live. The parent environments of namespaces are the ", #> list("imports"), "\n", "environments, which contain all the functions imported from other\n", #> "packages.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "These functions are experimental and may not belong to the rlang\n", #> "package. Expect API changes.\n")), "\n", #> "\n", list("\n", list(list("pkg_env()")), "\n"), #> "\n", list("internal"), "\n"), `nse-defuse.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/nse-defuse.R", #> "\n", list("nse-defuse"), "\n", list("nse-defuse"), #> "\n", list("quotation"), "\n", list("expr"), #> "\n", list("enexpr"), "\n", list("exprs"), "\n", #> list("enexprs"), "\n", list("ensym"), "\n", list( #> "ensyms"), "\n", list("quo"), "\n", list("enquo"), #> "\n", list("quos"), "\n", list("enquos"), "\n", #> list("Defuse R expressions"), "\n", list("\n", #> "expr(expr)\n", "\n", "enexpr(arg)\n", "\n", #> "exprs(\n", " ...,\n", " .named = FALSE,\n", #> " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .unquote_names = TRUE\n", ")\n", "\n", "enexprs(\n", #> " ...,\n", " .named = FALSE,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .unquote_names = TRUE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n", "\n", "ensym(arg)\n", #> "\n", "ensyms(\n", " ...,\n", " .named = FALSE,\n", #> " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .unquote_names = TRUE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n", "\n", "quo(expr)\n", #> "\n", "enquo(arg)\n", "\n", "quos(\n", " ...,\n", #> " .named = FALSE,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .unquote_names = TRUE\n", ")\n", "\n", "enquos(\n", #> " ...,\n", " .named = FALSE,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .unquote_names = TRUE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n"), "\n", #> list("\n", list(list("expr"), list("An expression.")), #> "\n", "\n", list(list("arg"), list("A symbol representing an argument. The expression\n", #> "supplied to that argument will be captured instead of being\n", #> "evaluated.")), "\n", "\n", list(list("..."), #> list("For ", list("enexprs()"), ", ", list( #> "ensyms()"), " and ", list("enquos()"), #> ", names of\n", "arguments to capture without evaluation (including ", #> list("..."), "). For\n", list("exprs()"), #> " and ", list("quos()"), ", the expressions to capture unevaluated\n", #> "(including expressions contained in ", #> list("..."), ").")), "\n", "\n", list(list( #> ".named"), list("Whether to ensure all dots are named. Unnamed\n", #> "elements are processed with ", list(list( #> "as_label()")), " to build a default\n", #> "name.")), "\n", "\n", list(list(".ignore_empty"), #> list("Whether to ignore empty arguments. Can be one\n", #> "of ", list("\"trailing\""), ", ", list( #> "\"none\""), ", ", list("\"all\""), ". If ", #> list("\"trailing\""), ", only the\n", "last argument is ignored if it is empty. Note that ", #> list("\"trailing\""), "\n", "applies only to arguments passed in ", #> list("..."), ", not to named\n", "arguments. On the other hand, ", #> list("\"all\""), " also applies to named\n", #> "arguments.")), "\n", "\n", list(list(".unquote_names"), #> list("Whether to treat ", list(":="), " as ", #> list("="), ". Unlike ", list("="), ", the\n", #> list(":="), " syntax supports ", list("!!"), #> " unquoting on the LHS.")), "\n", "\n", #> list(list(".homonyms"), list("How to treat arguments with the same name. The\n", #> "default, ", list("\"keep\""), ", preserves these arguments. Set ", #> list(".homonyms"), " to\n", list("\"first\""), #> " to only keep the first occurrences, to ", #> list("\"last\""), " to keep\n", "the last occurrences, and to ", #> list("\"error\""), " to raise an informative\n", #> "error and indicate what arguments have duplicated names.")), #> "\n", "\n", list(list(".check_assign"), list( #> "Whether to check for ", list("<-"), " calls passed in\n", #> "dots. When ", list("TRUE"), " and a ", list( #> "<-"), " call is detected, a warning is\n", #> "issued to advise users to use ", list("="), #> " if they meant to match a\n", "function parameter, or wrap the ", #> list("<-"), " call in braces otherwise.\n", #> "This ensures assignments are explicit.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", "The defusing operators ", list( #> "expr()"), " and ", list("enquo()"), " prevent the\n", #> "evaluation of R code. Defusing is also known as ", #> list("quoting"), ", and is\n", "done in base R by ", #> list(list("quote()")), " and ", list(list("substitute()")), #> ". When a function\n", "argument is defused, R doesn't return its value like it normally\n", #> "would but it returns the R expression describing how to make the\n", #> "value. These defused expressions are like blueprints for computing\n", #> "values.\n", "\n", "There are two main ways to defuse expressions, to which correspond\n", #> "the two functions ", list("expr()"), " and ", #> list("enquo()"), ". Whereas ", list("expr()"), #> " defuses\n", "your own expression, ", list( #> "enquo()"), " defuses expressions supplied as\n", #> "argument by the user of a function. See section on function\n", #> "arguments for more on this distinction.\n", #> "\n", "The main purpose of defusing evaluation of an expression is to\n", #> "enable data-masking, where an expression is evaluated in the\n", #> "context of a data frame so that you can write ", #> list("var"), " instead of\n", list("data$var"), #> ". The expression is defused so it can be resumed later\n", #> "on, in a context where the data-variables have been defined.\n", #> "\n", "Defusing prevents the evaluation of R code, but you can still force\n", #> "evaluation inside a defused expression with the ", #> list("forcing operators"), " ", list("!!"), #> " and ", list("!!!"), ".\n"), "\n", list(list( #> "Types of defused expressions"), list("\n", #> "\n", list("\n", list(), " ", list("Calls"), #> ", like ", list("f(1, 2, 3)"), " or ", list( #> "1 + 1"), " represent the action of\n", #> "calling a function to compute a new value, such as a vector.\n", #> list(), " ", list("Symbols"), ", like ", #> list("x"), " or ", list("df"), ", represent named objects. When the\n", #> "object pointed to by the symbol was defined in a function or in\n", #> "the global environment, we call it an environment-variable. When\n", #> "the object is a column in a data frame, we call it a\n", #> "data-variable.\n"), "\n", "\n", "You can create new call or symbol objects by using the defusing\n", #> "function ", list("expr()"), ":", list("# Create a symbol representing objects called `foo`\n", #> "expr(foo)\n", "\n", "# Create a call representing the computation of the mean of `foo`\n", #> "expr(mean(foo, na.rm = TRUE))\n"), "\n", #> "\n", "Defusing is not the only way to create defused expressions. You can\n", #> "also assemble them from data:", list("# Assemble a symbol from a string\n", #> "var <- \"foo\"\n", "sym(var)\n", "\n", "# Assemble a call from strings, symbols, and other objects\n", #> "call(\"mean\", sym(var), na.rm = TRUE)\n"), #> "\n")), "\n", "\n", list(list("Defusing function arguments"), #> list("\n", "\n", "\n", "There are two points of view when it comes to defusing an\n", #> "expression:\n", list("\n", list(), " You can defuse expressions that ", #> list("you"), " supply with ", list("expr()"), #> ". This\n", "is one way of creating symbols and calls (see previous section).\n", #> list(), " You can defuse the expressions supplied by ", #> list("the user"), " of your\n", "function with the operators starting with ", #> list("en"), " like ", list("ensym()"), #> ",\n", list("enquo()"), " and their plural variants. They defuse function\n", #> "arguments .\n"), "\n")), "\n", "\n", list( #> list("Defused arguments and quosures"), list( #> "\n", "\n", "\n", "If you inspect the return values of ", #> list("expr()"), " and ", list("enquo()"), #> ", you'll\n", "notice that the latter doesn't return a raw expression like the\n", #> "former. Instead it returns a ", list("quosure"), #> ", a wrapper containing an\n", "expression and an environment. R needs information about the\n", #> "environment to properly evaluate the argument expression because it\n", #> "comes from a different context than the current function.\n", #> "\n", "See the ", list("quosure"), " help topic about tools to work with quosures.\n")), #> "\n", "\n", list(list("Comparison to base R"), #> list("\n", "\n", list("\n", list(), " The defusing operator ", #> list("expr()"), " is similar to ", list(list( #> "quote()")), ". Like\n", list(list("bquote()")), #> ", it allows ", list("forcing"), " evaluation of parts\n", #> "of an expression.\n", list(), " The plural variant ", #> list("exprs()"), " is similar to ", list( #> list("alist()")), ".\n", list(), " The argument-defusing operator ", #> list("enquo()"), " is similar to\n", list( #> list("substitute()")), ".\n"), "\n")), #> "\n", "\n", list("\n", "# expr() and exprs() capture expressions that you supply:\n", #> "expr(symbol)\n", "exprs(several, such, symbols)\n", #> "\n", "# enexpr() and enexprs() capture expressions that your user supplied:\n", #> "expr_inputs <- function(arg, ...) {\n", " user_exprs <- enexprs(arg, ...)\n", #> " user_exprs\n", "}\n", "expr_inputs(hello)\n", #> "expr_inputs(hello, bonjour, ciao)\n", "\n", #> "# ensym() and ensyms() provide additional type checking to ensure\n", #> "# the user calling your function has supplied bare object names:\n", #> "sym_inputs <- function(...) {\n", " user_symbols <- ensyms(...)\n", #> " user_symbols\n", "}\n", "sym_inputs(hello, \"bonjour\")\n", #> "## sym_inputs(say(hello)) # Error: Must supply symbols or strings\n", #> "expr_inputs(say(hello))\n", "\n", "\n", "# All these quoting functions have quasiquotation support. This\n", #> "# means that you can unquote (evaluate and inline) part of the\n", #> "# captured expression:\n", "what <- sym(\"bonjour\")\n", #> "expr(say(what))\n", "expr(say(!!what))\n", #> "\n", "# This also applies to expressions supplied by the user. This is\n", #> "# like an escape hatch that allows control over the captured\n", #> "# expression:\n", "expr_inputs(say(!!what), !!what)\n", #> "\n", "\n", "# Finally, you can capture expressions as quosures. A quosure is an\n", #> "# object that contains both the expression and its environment:\n", #> "quo <- quo(letters)\n", "quo\n", "\n", "get_expr(quo)\n", #> "get_env(quo)\n", "\n", "# Quosures can be evaluated with eval_tidy():\n", #> "eval_tidy(quo)\n", "\n", "# They have the nice property that you can pass them around from\n", #> "# context to context (that is, from function to function) and they\n", #> "# still evaluate in their original environment:\n", #> "multiply_expr_by_10 <- function(expr) {\n", #> " # We capture the user expression and its environment:\n", #> " expr <- enquo(expr)\n", "\n", " # Then create an object that only exists in this function:\n", #> " local_ten <- 10\n", "\n", " # Now let's create a multiplication expression that (a) inlines\n", #> " # the user expression as LHS (still wrapped in its quosure) and\n", #> " # (b) refers to the local object in the RHS:\n", #> " quo(!!expr * local_ten)\n", "}\n", "quo <- multiply_expr_by_10(2 + 3)\n", #> "\n", "# The local parts of the quosure are printed in colour if your\n", #> "# terminal is capable of displaying colours:\n", #> "quo\n", "\n", "# All the quosures in the expression evaluate in their original\n", #> "# context. The local objects are looked up properly and we get the\n", #> "# expected result:\n", "eval_tidy(quo)\n"), #> "\n", list("\n", list(list("enquo0()")), " and ", #> list(list("enquos0()")), " for variants that do not\n", #> "perform automatic injection/unquotation.\n"), #> "\n"), `nse-force.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/nse-force.R", #> "\n", list("nse-force"), "\n", list("nse-force"), #> "\n", list("quasiquotation"), "\n", list("UQ"), #> "\n", list("UQS"), "\n", list("{{}}"), "\n", #> list("{{"), "\n", list("!!"), "\n", list("!!!"), #> "\n", list(":="), "\n", list("qq_show"), "\n", #> list("Force parts of an expression"), "\n", list( #> "\n", "qq_show(expr)\n"), "\n", list("\n", #> list(list("expr"), list("An expression to be quasiquoted.")), #> "\n"), "\n", list("\n", "It is sometimes useful to force early evaluation of part of an\n", #> "expression before it gets fully evaluated. The tidy eval framework\n", #> "provides several forcing operators for different use cases.\n", #> list("\n", list(), " The bang-bang operator ", #> list("!!"), " forces a ", list("single"), #> " object. One\n", "common case for ", list( #> "!!"), " is to substitute an environment-variable\n", #> "(created with ", list("<-"), ") with a data-variable (inside a data frame).", #> list("library(dplyr)\n", "\n", "# The environment variable `var` refers to the data-variable\n", #> "# `height`\n", "var <- sym(\"height\")\n", #> "\n", "# We force `var`, which substitutes it with `height`\n", #> "starwars %>%\n", " summarise(avg = mean(!!var, na.rm = TRUE))\n"), #> "\n", list(), " The big-bang operator ", #> list("!!!"), " forces-splice a ", list("list"), #> " of objects.\n", "The elements of the list are spliced in place, meaning that they\n", #> "each become one single argument.", list( #> "vars <- syms(c(\"height\", \"mass\"))\n", #> "\n", "# Force-splicing is equivalent to supplying the elements separately\n", #> "starwars %>% select(!!!vars)\n", "starwars %>% select(height, mass)\n"), #> "\n", list(), " The curly-curly operator ", #> list("{{ }}"), " for function arguments is a bit\n", #> "special because it forces the function argument and immediately\n", #> "defuses it. The defused expression is substituted in place, ready\n", #> "to be evaluated in another context, such as the data frame.\n", #> "\n", "In practice, this is useful when you have a data-variable in an\n", #> "env-variable (such as a function argument).", #> list("# Force-defuse all function arguments that might contain\n", #> "# data-variables by embracing them with {{ }}\n", #> "mean_by <- function(data, by, var) {\n", #> " data %>%\n", " group_by({{ by }}) %>%\n", #> " summarise(avg = mean({{ var }}, na.rm = TRUE))\n", #> "}\n", "\n", "# The env-variables `by` and `var` are forced but defused.\n", #> "# The data-variables they contain are evaluated by dplyr later on\n", #> "# in data context.\n", "iris %>% mean_by(by = Species, var = Sepal.Width)\n"), #> "\n"), "\n", "\n", "Use ", list("qq_show()"), #> " to experiment with forcing operators. ", #> list("qq_show()"), "\n", "defuses its input, processes all forcing operators, and prints the\n", #> "result with ", list(list("expr_print()")), #> " to reveal objects inlined in the\n", "expression by the forcing operators.\n"), #> "\n", list(list("Forcing names"), list("\n", #> "\n", "\n", "When a function takes multiple named arguments\n", #> "(e.g. ", list("dplyr::mutate()"), "), it is difficult to supply a variable as\n", #> "name. Since the LHS of ", list("="), " is ", #> list("defused"), ", giving the name\n", "of a variable results in the argument having the name of the\n", #> "variable rather than the name stored in that variable. This problem\n", #> "of forcing evaluation of names is exactly what the ", #> list("!!"), " operator is\n", "for.\n", "\n", #> "Unfortunately R is very strict about the kind of expressions\n", #> "supported on the LHS of ", list("="), ". This is why rlang interprets the\n", #> "walrus operator ", list(":="), " as an alias of ", #> list("="), ". You can use it to supply\n", #> "names, e.g. ", list("a := b"), " is equivalent to ", #> list("a = b"), ". Since its syntax is\n", "more flexible you can also force names on its LHS:", #> list("name <- \"Jane\"\n", "\n", "list2(!!name := 1 + 2)\n", #> "exprs(!!name := 1 + 2)\n"), "\n", "\n", #> "Like ", list("="), ", the ", list(":="), " operator expects strings or symbols on its LHS.\n", #> "\n", "Since unquoting names is related to interpolating within a string\n", #> "with the glue package, we have made the glue syntax available on\n", #> "the LHS of ", list(":="), ":", list("list2(\"{name}\" := 1)\n", #> "tibble(\"{name}\" := 1)\n"), "\n", "\n", #> "You can also interpolate defused function arguments with double\n", #> "braces ", list("{{"), ", similar to the curly-curly syntax:", #> list("wrapper <- function(data, var) {\n", #> " data %>% mutate(\"{{ var }}_foo\" := {{ var }} * 2)\n", #> "}\n"), "\n", "\n", "Currently, forcing names with ", #> list(":="), " only works in top level\n", "expressions. These are all valid:", #> list("exprs(\"{name}\" := x)\n", "tibble(\"{name}\" := x)\n"), #> "\n", "\n", "But deep-forcing names isn't supported:", #> list("exprs(this(is(deep(\"{name}\" := x))))\n"), #> "\n")), "\n", "\n", list(list("Theory"), list( #> "\n", "\n", "\n", "Formally, ", list("quo()"), #> " and ", list("expr()"), " are quasiquotation functions, ", #> list("!!"), "\n", "is the unquote operator, and ", #> list("!!!"), " is the unquote-splice operator.\n", #> "These terms have a rich history in Lisp languages, and live on in\n", #> "modern languages like\n", list(list("https://docs.julialang.org/en/v1/manual/metaprogramming/"), #> list("Julia")), "\n", "and\n", list(list( #> "https://docs.racket-lang.org/reference/quasiquote.html"), #> list("Racket")), ".\n")), "\n", "\n", list( #> list("Life cycle"), list("\n", "\n", list("\n", #> list(), " Calling ", list("UQ()"), " and ", #> list("UQS()"), " with the rlang namespace qualifier is\n", #> "deprecated as of rlang 0.3.0. Just use the unqualified forms\n", #> "instead:", list("# Bad\n", "rlang::expr(mean(rlang::UQ(var) * 100))\n", #> "\n", "# Ok\n", "rlang::expr(mean(UQ(var) * 100))\n", #> "\n", "# Good\n", "rlang::expr(mean(!!var * 100))\n"), #> "\n", "\n", "Supporting namespace qualifiers complicates the implementation of\n", #> "unquotation and is misleading as to the nature of unquoting\n", #> "operators (which are syntactic operators that operate at\n", #> "quotation-time rather than function calls at evaluation-time).\n", #> list(), " ", list("UQ()"), " and ", list( #> "UQS()"), " were soft-deprecated in rlang 0.2.0 in order\n", #> "to make the syntax of quasiquotation more consistent. The prefix\n", #> "forms are now ", list("`!!`()"), " and ", #> list("`!!!`()"), " which is\n", "consistent with other R operators (e.g. ", #> list("`+`(a, b)"), " is the\n", "prefix form of ", #> list("a + b"), ").\n", "\n", "Note that the prefix forms are not as relevant as before because\n", #> list("!!"), " now has the right operator precedence, i.e. the same as\n", #> "unary ", list("-"), " or ", list("+"), ". It is thus safe to mingle it with other\n", #> "operators, e.g. ", list("!!a + !!b"), " does the right thing. In addition the\n", #> "parser now strips one level of parentheses around unquoted\n", #> "expressions. This way ", list("(!!\"foo\")(...)"), #> " expands to ", list("foo(...)"), ".\n", #> "These changes make the prefix forms less useful.\n", #> "\n", "Finally, the named functional forms ", #> list("UQ()"), " and ", list("UQS()"), " were\n", #> "misleading because they suggested that existing knowledge about\n", #> "functions is applicable to quasiquotation. This was reinforced by\n", #> "the visible definitions of these functions exported by rlang and\n", #> "by the tidy eval parser interpreting ", #> list("rlang::UQ()"), " as ", list("!!"), #> ". In\n", "reality unquoting is ", list("not"), #> " a function call, it is a syntactic\n", #> "operation. The operator form makes it clearer that unquoting is\n", #> "special.\n"), "\n")), "\n", "\n", list("\n", #> "# Interpolation with {{ }} is the easiest way to forward\n", #> "# arguments to tidy eval functions:\n", "if (is_attached(\"package:dplyr\")) {\n", #> "\n", "# Forward all arguments involving data frame columns by\n", #> "# interpolating them within other data masked arguments.\n", #> "# Here we interpolate `arg` in a `summarise()` call:\n", #> "my_function <- function(data, arg) {\n", " summarise(data, avg = mean({{ arg }}, na.rm = TRUE))\n", #> "}\n", "\n", "my_function(mtcars, cyl)\n", #> "my_function(mtcars, cyl * 10)\n", "\n", "# The operator is just a shortcut for `!!enquo()`:\n", #> "my_function <- function(data, arg) {\n", " summarise(data, avg = mean(!!enquo(arg), na.rm = TRUE))\n", #> "}\n", "\n", "my_function(mtcars, cyl)\n", #> "\n", "}\n", "\n", "# Quasiquotation functions quote expressions like base::quote()\n", #> "quote(how_many(this))\n", "expr(how_many(this))\n", #> "quo(how_many(this))\n", "\n", "# In addition, they support unquoting. Let's store symbols\n", #> "# (i.e. object names) in variables:\n", "this <- sym(\"apples\")\n", #> "that <- sym(\"oranges\")\n", "\n", "# With unquotation you can insert the contents of these variables\n", #> "# inside the quoted expression:\n", "expr(how_many(!!this))\n", #> "expr(how_many(!!that))\n", "\n", "# You can also insert values:\n", #> "expr(how_many(!!(1 + 2)))\n", "quo(how_many(!!(1 + 2)))\n", #> "\n", "\n", "# Note that when you unquote complex objects into an expression,\n", #> "# the base R printer may be a bit misleading. For instance compare\n", #> "# the output of `expr()` and `quo()` (which uses a custom printer)\n", #> "# when we unquote an integer vector:\n", "expr(how_many(!!(1:10)))\n", #> "quo(how_many(!!(1:10)))\n", "\n", "# This is why it's often useful to use qq_show() to examine the\n", #> "# result of unquotation operators. It uses the same printer as\n", #> "# quosures but does not return anything:\n", #> "qq_show(how_many(!!(1:10)))\n", "\n", "\n", #> "# Use `!!!` to add multiple arguments to a function. Its argument\n", #> "# should evaluate to a list or vector:\n", #> "args <- list(1:3, na.rm = TRUE)\n", "quo(mean(!!!args))\n", #> "\n", "# You can combine the two\n", "var <- quote(xyz)\n", #> "extra_args <- list(trim = 0.9, na.rm = TRUE)\n", #> "quo(mean(!!var , !!!extra_args))\n", "\n", #> "\n", "# The plural versions have support for the `:=` operator.\n", #> "# Like `=`, `:=` creates named arguments:\n", #> "quos(mouse1 := bernard, mouse2 = bianca)\n", #> "\n", "# The `:=` is mainly useful to unquote names. Unlike `=` it\n", #> "# supports `!!` on its LHS:\n", "var <- \"unquote me!\"\n", #> "quos(!!var := bernard, mouse2 = bianca)\n", #> "\n", "\n", "# All these features apply to dots captured by enquos():\n", #> "fn <- function(...) enquos(...)\n", "fn(!!!args, !!var := penny)\n", #> "\n", "\n", "# Unquoting is especially useful for building an expression by\n", #> "# expanding around a variable part (the unquoted part):\n", #> "quo1 <- quo(toupper(foo))\n", "quo1\n", "\n", #> "quo2 <- quo(paste(!!quo1, bar))\n", "quo2\n", #> "\n", "quo3 <- quo(list(!!quo2, !!!syms(letters[1:5])))\n", #> "quo3\n"), "\n"), `op-definition.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/operators.R", #> "\n", list("op-definition"), "\n", list("op-definition"), #> "\n", list("is_definition"), "\n", list("new_definition"), #> "\n", list("is_formulaish"), "\n", list("Definition operator"), #> "\n", list("\n", "is_definition(x)\n", "\n", #> "new_definition(lhs, rhs, env = caller_env())\n", #> "\n", "is_formulaish(x, scoped = NULL, lhs = NULL)\n"), #> "\n", list("\n", list(list("x"), list("An object to test.")), #> "\n", "\n", list(list("lhs, rhs"), list("Expressions for the LHS and RHS of the definition.")), #> "\n", "\n", list(list("env"), list("The evaluation environment bundled with the definition.")), #> "\n"), "\n", list("\n", "The definition operator is typically used in DSL packages like\n", #> list("ggvis"), " and ", list("data.table"), #> ". It is also used in the tidyverse as a way\n", #> "of unquoting names (see ", list("nse-force"), #> ").\n", list("\n", list(), " ", list("is_definition()"), #> " returns ", list("TRUE"), " for calls to ", #> list(":="), ".\n", list(), " ", list("is_formulaish()"), #> " returns ", list("TRUE"), " for both formulas and\n", #> "colon-equals operators.\n"), "\n"), "\n", #> list("\n", "The recommended way to use it is to capture arguments as\n", #> "expressions or quosures. You can then give a special function\n", #> "definition for the ", list(":="), " symbol in an overscope. Note that if you\n", #> "capture dots with ", list(list("exprs()")), #> " or ", list(list("quos()")), ", you need to disable\n", #> "interpretation of ", list(":="), " by setting ", #> list(".unquote_names"), " to ", list("FALSE"), #> ".\n", "\n", "From rlang and data.table perspectives, this operator is not meant\n", #> "to be evaluated directly at top-level which is why the exported\n", #> "definitions issue an error.\n"), "\n", list( #> list("Life cycle"), list("\n", "\n", "\n", #> "These functions are experimental.\n")), #> "\n", "\n", list("\n", "\n", "# A predicate is provided to distinguish formulas from the\n", #> "# colon-equals operator:\n", "is_definition(quote(a := b))\n", #> "is_definition(a ~ b)\n", "\n", "\n", "# is_formulaish() tests for both definitions and formulas:\n", #> "is_formulaish(a ~ b)\n", "is_formulaish(quote(a := b))\n"), #> "\n", list("internal"), "\n"), `op-get-attr.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/operators.R", #> "\n", list("op-get-attr"), "\n", list("op-get-attr"), #> "\n", list("%@%"), "\n", list("%@%<-"), "\n", #> list("Infix attribute accessor and setter"), #> "\n", list("\n", "x %@% name\n", "\n", "x %@% name <- value\n"), #> "\n", list("\n", list(list("x"), list("Object")), #> "\n", "\n", list(list("name"), list("Attribute name")), #> "\n", "\n", list(list("value"), list("New value for attribute ", #> list("name"), ".")), "\n"), "\n", list("\n", #> "This operator extracts or sets attributes for regular objects and\n", #> "S4 fields for S4 objects.\n"), "\n", list( #> "\n", "# Unlike `@`, this operator extracts attributes for any kind of\n", #> "# objects:\n", "factor(1:3) %@% \"levels\"\n", #> "mtcars %@% class\n", "\n", "mtcars %@% class <- NULL\n", #> "mtcars\n", "\n", "# It also works on S4 objects:\n", #> ".Person <- setClass(\"Person\", slots = c(name = \"character\", species = \"character\"))\n", #> "fievel <- .Person(name = \"Fievel\", species = \"mouse\")\n", #> "fievel %@% name\n"), "\n"), `op-na-default.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/operators.R", #> "\n", list("op-na-default"), "\n", list("op-na-default"), #> "\n", list("%|%"), "\n", list("Replace missing values"), #> "\n", list("\n", "x %|% y\n"), "\n", list("\n", #> list(list("x"), list("The original values.")), #> "\n", "\n", list(list("y"), list("The replacement values. Must be of length 1 or the same length as ", #> list("x"), ".")), "\n"), "\n", list("\n", #> "This infix function is similar to ", list( #> "%||%"), " but is vectorised\n", "and provides a default value for missing elements. It is faster\n", #> "than using ", list(list("base::ifelse()")), #> " and does not perform type conversions.\n"), #> "\n", list("\n", "c(\"a\", \"b\", NA, \"c\") %|% \"default\"\n", #> "c(1L, NA, 3L, NA, NA) %|% (6L:10L)\n"), "\n", #> list("\n", list("op-null-default"), "\n"), "\n"), #> `op-null-default.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/operators.R", #> "\n", list("op-null-default"), "\n", list("op-null-default"), #> "\n", list("%||%"), "\n", list("Default value for ", #> list("NULL")), "\n", list("\n", "x %||% y\n"), #> "\n", list("\n", list(list("x, y"), list("If ", #> list("x"), " is NULL, will return ", list("y"), #> "; otherwise returns ", list("x"), ".")), "\n"), #> "\n", list("\n", "This infix function makes it easy to replace ", #> list("NULL"), "s with a default\n", "value. It's inspired by the way that Ruby's or operation (", #> list("||"), ")\n", "works.\n"), "\n", list( #> "\n", "1 %||% 2\n", "NULL %||% 2\n"), "\n"), #> overscope_eval_next.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("overscope_eval_next"), "\n", list( #> "overscope_eval_next"), "\n", list("Evaluate next quosure in a data mask"), #> "\n", list("\n", "overscope_eval_next(overscope, quo, env = base_env())\n"), #> "\n", list("\n", list(list("overscope"), list( #> "A valid overscope containing bindings for ", #> list("~"), ",\n", list(".top_env"), " and ", #> list("_F"), " and whose parents contain overscoped bindings\n", #> "for tidy evaluation.")), "\n", "\n", list( #> list("quo"), list("A quosure.")), "\n", "\n", #> list(list("env"), list("The lexical enclosure in case ", #> list("quo"), " is not a validly\n", "scoped quosure. This is the ", #> list("base environment"), " by\n", "default.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", list("overscope_eval_next()"), #> " is deprecated as of rlang 0.2.0. Please use\n", #> list("eval_tidy()"), " to which you can now supply an overscope.\n"), #> "\n", list("internal"), "\n"), pairlist2.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("pairlist2"), "\n", list("pairlist2"), #> "\n", list("Create pairlists with splicing support"), #> "\n", list("\n", "pairlist2(...)\n"), "\n", list( #> "\n", list(list("..."), list("<", list("dynamic"), #> "> Arguments stored in the\n", "pairlist. Empty arguments are preserved.")), #> "\n"), "\n", list("\n", "This pairlist constructor uses ", #> list("dynamic dots"), ". Use\n", "it to manually create argument lists for calls or parameter lists\n", #> "for functions.\n"), "\n", list("\n", "# Unlike `exprs()`, `pairlist2()` evaluates its arguments.\n", #> "new_function(pairlist2(x = 1, y = 3 * 6), quote(x * y))\n", #> "new_function(exprs(x = 1, y = 3 * 6), quote(x * y))\n", #> "\n", "# It preserves missing arguments, which is useful for creating\n", #> "# parameters without defaults:\n", "new_function(pairlist2(x = , y = 3 * 6), quote(x * y))\n"), #> "\n"), parse_expr.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/parse.R", #> "\n", list("parse_expr"), "\n", list("parse_expr"), #> "\n", list("parse_exprs"), "\n", list("parse_quo"), #> "\n", list("parse_quos"), "\n", list("Parse R code"), #> "\n", list("\n", "parse_expr(x)\n", "\n", "parse_exprs(x)\n", #> "\n", "parse_quo(x, env = global_env())\n", #> "\n", "parse_quos(x, env = global_env())\n"), #> "\n", list("\n", list(list("x"), list("Text containing expressions to parse_expr for\n", #> list("parse_expr()"), " and ", list("parse_exprs()"), #> ". Can also be an R connection,\n", "for instance to a file. If the supplied connection is not open,\n", #> "it will be automatically closed and destroyed.")), #> "\n", "\n", list(list("env"), list("The environment for the quosures. The ", #> list("global environment"), " (the default) may be the right choice\n", #> "when you are parsing external user inputs. You might also want to\n", #> "evaluate the R code in an isolated context (perhaps a child of\n", #> "the global environment or of the ", list( #> "base environment"), ").")), "\n"), "\n", #> list("\n", list("parse_expr()"), " returns an ", #> list("expression"), ",\n", list("parse_exprs()"), #> " returns a list of expressions. Note that for the\n", #> "plural variants the length of the output may be greater than the\n", #> "length of the input. This would happen is one of the strings\n", #> "contain several expressions (such as ", list( #> "\"foo; bar\""), "). The names of\n", list( #> "x"), " are preserved (and recycled in case of multiple expressions).\n", #> "The ", list("_quo"), " suffixed variants return quosures.\n"), #> "\n", list("\n", "These functions parse and transform text into R expressions. This\n", #> "is the first step to interpret or evaluate a piece of R code\n", #> "written by a programmer.\n", list("\n", list(), #> " ", list("parse_expr()"), " returns one expression. If the text contains more\n", #> "than one expression (separated by semicolons or new lines), an\n", #> "error is issued. On the other hand ", list( #> "parse_exprs()"), " can handle\n", "multiple expressions. It always returns a list of expressions\n", #> "(compare to ", list(list("base::parse()")), #> " which returns a base::expression\n", "vector). All functions also support R connections.\n", #> list(), " ", list("parse_quo()"), " and ", #> list("parse_quos()"), " are variants that create a\n", #> list("quosure"), " that inherits from the global environment by\n", #> "default. This is appropriate when you're parsing external user\n", #> "input to be evaluated in user context (rather than the private\n", #> "contexts of your functions).\n", "\n", "Unlike quosures created with ", #> list(list("enquo()")), ", ", list(list("enquos()")), #> ", or ", list("{{"), ", a\n", "parsed quosure never contains injected quosures. It is thus safe\n", #> "to evaluate them with ", list("eval()"), #> " instead of ", list(list("eval_tidy()")), #> ", though\n", "the latter is more convenient as you don't need to extract ", #> list("expr"), "\n", "and ", list("env"), #> ".\n"), "\n"), "\n", list("\n", "# parse_expr() can parse any R expression:\n", #> "parse_expr(\"mtcars %>% dplyr::mutate(cyl_prime = cyl / sd(cyl))\")\n", #> "\n", "# A string can contain several expressions separated by ; or \\n\n", #> "parse_exprs(\"NULL; list()\\n foo(bar)\")\n", #> "\n", "# Use names to figure out which input produced an expression:\n", #> "parse_exprs(c(foo = \"1; 2\", bar = \"3\"))\n", #> "\n", "# You can also parse source files by passing a R connection. Let's\n", #> "# create a file containing R code:\n", "path <- tempfile(\"my-file.R\")\n", #> "cat(\"1; 2; mtcars\", file = path)\n", "\n", #> "# We can now parse it by supplying a connection:\n", #> "parse_exprs(file(path))\n"), "\n", list("\n", #> list(list("base::parse()")), "\n"), "\n"), #> parse_quosure.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("parse_quosure"), "\n", list("parse_quosure"), #> "\n", list("parse_quosures"), "\n", list("Parse text into a quosure"), #> "\n", list("\n", "parse_quosure(x, env = caller_env())\n", #> "\n", "parse_quosures(x, env = caller_env())\n"), #> "\n", list("\n", list(list("x"), list("Text containing expressions to parse_expr for\n", #> list("parse_expr()"), " and ", list("parse_exprs()"), #> ". Can also be an R connection,\n", "for instance to a file. If the supplied connection is not open,\n", #> "it will be automatically closed and destroyed.")), #> "\n", "\n", list(list("env"), list("The environment for the quosures. The ", #> list("global environment"), " (the default) may be the right choice\n", #> "when you are parsing external user inputs. You might also want to\n", #> "evaluate the R code in an isolated context (perhaps a child of\n", #> "the global environment or of the ", list( #> "base environment"), ").")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions were deprecated and renamed to ", #> list(list("parse_quo()")), "\n", "and ", list( #> list("parse_quos()")), " in rlang 0.2.0. This is for consistency with the\n", #> "convention that suffixes indicating return types are not\n", #> "abbreviated.\n"), "\n", list("internal"), #> "\n"), prepend.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("prepend"), "\n", list("prepend"), #> "\n", list("modify"), "\n", list("Prepend a vector"), #> "\n", list("\n", "prepend(x, values, before = 1)\n", #> "\n", "modify(.x, ...)\n"), "\n", list("\n", #> list(list("x"), list("the vector to be modified.")), #> "\n", "\n", list(list("values"), list("to be included in the modified vector.")), #> "\n", "\n", list(list("before"), list("a subscript, before which the values are to be appended.")), #> "\n", "\n", list(list(".x"), list("A vector to modify.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> List of elements to merge into\n", #> list(".x"), ". Named elements already existing in ", #> list(".x"), " are used as\n", "replacements. Elements that have new or no names are inserted at\n", #> "the end.")), "\n"), "\n", list("\n", list( #> "rlang:::lifecycle(\"deprecated\")"), "\n", #> "\n", "Vector functions are now out of scope for rlang. They might be\n", #> "revived in the vctrs or funs packages.\n"), #> "\n", list("internal"), "\n"), prim_name.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("prim_name"), "\n", list("prim_name"), #> "\n", list("Name of a primitive function"), "\n", #> list("\n", "prim_name(prim)\n"), "\n", list("\n", #> list(list("prim"), list("A primitive function such as ", #> list(list("base::c()")), ".")), "\n"), "\n", #> list("\n", "Name of a primitive function\n"), #> "\n", list("internal"), "\n"), quo_expr.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("quo_expr"), "\n", list("quo_expr"), #> "\n", list("Squash a quosure"), "\n", list("\n", #> "quo_expr(quo, warn = FALSE)\n"), "\n", list( #> "\n", list(list("quo"), list("A quosure or expression.")), #> "\n", "\n", list(list("warn"), list("Whether to warn if the quosure contains other quosures\n", #> "(those will be collapsed). This is useful when you use\n", #> list("quo_squash()"), " in order to make a non-tidyeval API compatible\n", #> "with quosures. In that case, getting rid of the nested quosures\n", #> "is likely to cause subtle bugs and it is good practice to warn\n", #> "the user about it.")), "\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "This function is deprecated, please use ", #> list(list("quo_squash()")), " instead.\n"), #> "\n", list("internal"), "\n"), quo_label.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/quo.R", #> "\n", list("quo_label"), "\n", list("quo_label"), #> "\n", list("quo_text"), "\n", list("quo_name"), #> "\n", list("Format quosures for printing or labelling"), #> "\n", list("\n", "quo_label(quo)\n", "\n", "quo_text(quo, width = 60L, nlines = Inf)\n", #> "\n", "quo_name(quo)\n"), "\n", list("\n", #> list(list("quo"), list("A quosure or expression.")), #> "\n", "\n", list(list("width"), list("Width of each line.")), #> "\n", "\n", list(list("nlines"), list("Maximum number of lines to extract.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", list("Note:"), " You should now use ", #> list(list("as_label()")), " or ", list(list( #> "as_name()")), " instead\n", "of ", list( #> "quo_name()"), ". See life cycle section below.\n", #> "\n", "These functions take an arbitrary R object, typically an\n", #> list("expression"), ", and represent it as a string.\n", #> list("\n", list(), " ", list("quo_name()"), #> " returns an abbreviated representation of the object\n", #> "as a single line string. It is suitable for default names.\n", #> list(), " ", list("quo_text()"), " returns a multiline string. For instance block\n", #> "expressions like ", list("{ foo; bar }"), #> " are represented on 4 lines (one\n", "for each symbol, and the curly braces on their own lines).\n"), #> "\n", "\n", "These deparsers are only suitable for creating default names or\n", #> "printing output at the console. The behaviour of your functions\n", #> "should not depend on deparsed objects. If you are looking for a way\n", #> "of transforming symbols to strings, use ", #> list(list("as_string()")), " instead of\n", #> list("quo_name()"), ". Unlike deparsing, the transformation between symbols\n", #> "and strings is non-lossy and well defined.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "These functions are in the questioning life cycle stage.\n", #> list("\n", list(), " ", list(list("as_label()")), #> " and ", list(list("as_name()")), " should be used instead of\n", #> list("quo_name()"), ". ", list("as_label()"), #> " transforms any R object to a string\n", #> "but should only be used to create a default name. Labelisation is\n", #> "not a well defined operation and no assumption should be made\n", #> "about the label. On the other hand, ", list( #> "as_name()"), " only works with\n", "(possibly quosured) symbols, but is a well defined and\n", #> "deterministic operation.\n", list(), " We don't have a good replacement for ", #> list("quo_text()"), " yet. See\n", list("https://github.com/r-lib/rlang/issues/636"), #> " to follow discussions\n", "about a new deparsing API.\n"), #> "\n")), "\n", "\n", list("\n", "# Quosures can contain nested quosures:\n", #> "quo <- quo(foo(!! quo(bar)))\n", "quo\n", #> "\n", "# quo_squash() unwraps all quosures and returns a raw expression:\n", #> "quo_squash(quo)\n", "\n", "# This is used by quo_text() and quo_label():\n", #> "quo_text(quo)\n", "\n", "# Compare to the unwrapped expression:\n", #> "expr_text(quo)\n", "\n", "# quo_name() is helpful when you need really short labels:\n", #> "quo_name(quo(sym))\n", "quo_name(quo(!! sym))\n"), #> "\n", list("\n", list(list("expr_label()")), #> ", ", list(list("f_label()")), "\n"), "\n"), #> quo_squash.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/quo.R", #> "\n", list("quo_squash"), "\n", list("quo_squash"), #> "\n", list("Squash a quosure"), "\n", list("\n", #> "quo_squash(quo, warn = FALSE)\n"), "\n", list( #> "\n", list(list("quo"), list("A quosure or expression.")), #> "\n", "\n", list(list("warn"), list("Whether to warn if the quosure contains other quosures\n", #> "(those will be collapsed). This is useful when you use\n", #> list("quo_squash()"), " in order to make a non-tidyeval API compatible\n", #> "with quosures. In that case, getting rid of the nested quosures\n", #> "is likely to cause subtle bugs and it is good practice to warn\n", #> "the user about it.")), "\n"), "\n", list( #> "\n", list("quo_squash()"), " flattens all nested quosures within an expression.\n", #> "For example it transforms ", list("^foo(^bar(), ^baz)"), #> " to the bare\n", "expression ", list("foo(bar(), baz)"), #> ".\n", "\n", "This operation is safe if the squashed quosure is used for\n", #> "labelling or printing (see ", list(list("quo_label()")), #> " or ", list(list("quo_name()")), "). However\n", #> "if the squashed quosure is evaluated, all expressions of the\n", #> "flattened quosures are resolved in a single environment. This is a\n", #> "source of bugs so it is good practice to set ", #> list("warn"), " to ", list("TRUE"), " to\n", #> "let the user know about the lossy squashing.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "This function replaces ", list("quo_expr()"), #> " which was deprecated in\n", "rlang 0.2.0. ", #> list("quo_expr()"), " was a misnomer because it implied that it\n", #> "was a mere expression acccessor for quosures whereas it was really\n", #> "a lossy operation that squashed all nested quosures.\n")), #> "\n", "\n", list("\n", "# Quosures can contain nested quosures:\n", #> "quo <- quo(wrapper(!!quo(wrappee)))\n", "quo\n", #> "\n", "# quo_squash() flattens all the quosures and returns a simple expression:\n", #> "quo_squash(quo)\n"), "\n"), quosure.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/quo.R", #> "\n", list("quosure"), "\n", list("quosure"), #> "\n", list("is_quosure"), "\n", list("quo_is_missing"), #> "\n", list("quo_is_symbol"), "\n", list("quo_is_call"), #> "\n", list("quo_is_symbolic"), "\n", list("quo_is_null"), #> "\n", list("quo_get_expr"), "\n", list("quo_get_env"), #> "\n", list("quo_set_expr"), "\n", list("quo_set_env"), #> "\n", list("Quosure getters, setters and testers"), #> "\n", list("\n", "is_quosure(x)\n", "\n", "quo_is_missing(quo)\n", #> "\n", "quo_is_symbol(quo, name = NULL)\n", #> "\n", "quo_is_call(quo, name = NULL, n = NULL, ns = NULL)\n", #> "\n", "quo_is_symbolic(quo)\n", "\n", "quo_is_null(quo)\n", #> "\n", "quo_get_expr(quo)\n", "\n", "quo_get_env(quo)\n", #> "\n", "quo_set_expr(quo, expr)\n", "\n", "quo_set_env(quo, env)\n"), #> "\n", list("\n", list(list("x"), list("An object to test.")), #> "\n", "\n", list(list("quo"), list("A quosure to test.")), #> "\n", "\n", list(list("name"), list("The name of the symbol or function call. If ", #> list("NULL"), " the\n", "name is not tested.")), #> "\n", "\n", list(list("n"), list("An optional number of arguments that the call should\n", #> "match.")), "\n", "\n", list(list("ns"), #> list("The namespace of the call. If ", list( #> "NULL"), ", the namespace\n", "doesn't participate in the pattern-matching. If an empty string\n", #> list("\"\""), " and ", list("x"), " is a namespaced call, ", #> list("is_call()"), " returns\n", list("FALSE"), #> ". If any other string, ", list("is_call()"), #> " checks that ", list("x"), " is\n", "namespaced within ", #> list("ns"), ".\n", "\n", "Can be a character vector of namespaces, in which case the call\n", #> "has to match at least one of them, otherwise ", #> list("is_call()"), " returns\n", list("FALSE"), #> ".")), "\n", "\n", list(list("expr"), list( #> "A new expression for the quosure.")), "\n", #> "\n", list(list("env"), list("A new environment for the quosure.")), #> "\n"), "\n", list("\n", "A quosure is a type of ", #> list("quoted expression"), " that includes\n", #> "a reference to the context where it was created. A quosure is thus\n", #> "guaranteed to evaluate in its original environment and can refer to\n", #> "local objects.\n", "\n", "You can access the quosure components (its expression and its\n", #> "environment) with:\n", list("\n", list(), #> " ", list(list("get_expr()")), " and ", list( #> list("get_env()")), ". These getters also support other\n", #> "kinds of objects such as formulas.\n", list(), #> " ", list("quo_get_expr()"), " and ", list( #> "quo_get_env()"), ". These getters only work\n", #> "with quosures and throw an error with other types of input.\n"), #> "\n", "\n", "Test if an object is a quosure with ", #> list("is_quosure()"), ". If you know an\n", #> "object is a quosure, use the ", list("quo_"), #> " prefixed predicates to check\n", "its contents, ", #> list("quo_is_missing()"), ", ", list("quo_is_symbol()"), #> ", etc.\n"), "\n", list(list("Quosured constants"), #> list("\n", "\n", "\n", "A quosure usually does not carry environments for ", #> list("constant objects"), " like strings or numbers. ", #> list(list("quo()")), " and\n", list(list( #> "enquo()")), " only capture an environment for ", #> list("symbolic expressions"), ". For instance, all of these return the\n", #> list("empty environment"), ":", list("quo_get_env(quo(\"constant\"))\n", #> "quo_get_env(quo(100))\n", "quo_get_env(quo(NA))\n"), #> "\n", "\n", "On the other hand, quosures capture the environment of symbolic\n", #> "expressions, i.e. expressions whose meaning depends on the\n", #> "environment in which they are evaluated and what objects are\n", #> "defined there:", list("quo_get_env(quo(some_object))\n", #> "quo_get_env(quo(some_function()))\n"), #> "\n")), "\n", "\n", list(list("Empty quosures"), #> list("\n", "\n", "\n", "When missing arguments are captured as quosures, either through\n", #> list(list("enquo()")), " or ", list(list( #> "quos()")), ", they are returned as an empty quosure. These\n", #> "quosures contain the ", list("missing argument"), #> " and typically\n", "have the ", list("empty environment"), #> " as enclosure.\n")), "\n", "\n", list(list( #> "Life cycle"), list("\n", "\n", list("\n", #> list(), " ", list("is_quosure()"), " is stable.\n", #> list(), " ", list("quo_get_expr()"), " and ", #> list("quo_get_env()"), " are stable.\n"), "\n")), #> "\n", "\n", list("\n", "quo <- quo(my_quosure)\n", #> "quo\n", "\n", "\n", "# Access and set the components of a quosure:\n", #> "quo_get_expr(quo)\n", "quo_get_env(quo)\n", #> "\n", "quo <- quo_set_expr(quo, quote(baz))\n", #> "quo <- quo_set_env(quo, empty_env())\n", "quo\n", #> "\n", "# Test wether an object is a quosure:\n", #> "is_quosure(quo)\n", "\n", "# If it is a quosure, you can use the specialised type predicates\n", #> "# to check what is inside it:\n", "quo_is_symbol(quo)\n", #> "quo_is_call(quo)\n", "quo_is_null(quo)\n", #> "\n", "# quo_is_missing() checks for a special kind of quosure, the one\n", #> "# that contains the missing argument:\n", #> "quo()\n", "quo_is_missing(quo())\n", "\n", #> "fn <- function(arg) enquo(arg)\n", "fn()\n", #> "quo_is_missing(fn())\n"), "\n", list("\n", #> list(list("quo()")), " for creating quosures by quotation; ", #> list(list("as_quosure()")), "\n", "and ", list( #> list("new_quosure()")), " for constructing quosures manually.\n"), #> "\n"), raw_deparse_str.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/raw.R", #> "\n", list("raw_deparse_str"), "\n", list("raw_deparse_str"), #> "\n", list("Serialize a raw vector to a string"), #> "\n", list("\n", "raw_deparse_str(x, prefix = NULL, suffix = NULL)\n"), #> "\n", list("\n", list(list("x"), list("A raw vector.")), #> "\n", "\n", list(list("prefix, suffix"), list( #> "Prefix and suffix strings, or `NULL.")), #> "\n"), "\n", list("\n", "A string.\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "This function converts a raw vector to a hexadecimal string,\n", #> "optionally adding a prefix and a suffix.\n", #> "It is roughly equivalent to\n", list("paste0(prefix, paste(format(x), collapse = \"\"), suffix)"), #> "\n", "and much faster.\n"), "\n", list("\n", #> "raw_deparse_str(raw())\n", "raw_deparse_str(charToRaw(\"string\"))\n", #> "raw_deparse_str(raw(10), prefix = \"'0x\", suffix = \"'\")\n"), #> "\n"), rep_along.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-new.R", #> "\n", list("rep_along"), "\n", list("rep_along"), #> "\n", list("rep_named"), "\n", list("Create vectors matching the length of a given vector"), #> "\n", list("\n", "rep_along(along, x)\n", "\n", #> "rep_named(names, x)\n"), "\n", list("\n", #> list(list("along"), list("Vector whose length determine how many times ", #> list("x"), "\n", "is repeated.")), "\n", #> "\n", list(list("x"), list("Values to repeat.")), #> "\n", "\n", list(list("names"), list("Names for the new vector. The length of ", #> list("names"), "\n", "determines how many times ", #> list("x"), " is repeated.")), "\n"), "\n", #> list("\n", "These functions take the idea of ", #> list(list("seq_along()")), " and apply it to\n", #> "repeating values.\n"), "\n", list("\n", "x <- 0:5\n", #> "rep_along(x, 1:2)\n", "rep_along(x, 1)\n", #> "\n", "# Create fresh vectors by repeating missing values:\n", #> "rep_along(x, na_int)\n", "rep_along(x, na_chr)\n", #> "\n", "# rep_named() repeats a value along a names vectors\n", #> "rep_named(c(\"foo\", \"bar\"), list(letters))\n"), #> "\n", list("\n", "new-vector\n"), "\n"), restarting.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-handlers.R", #> "\n", list("restarting"), "\n", list("restarting"), #> "\n", list("Create a restarting handler"), "\n", #> list("\n", "restarting(.restart, ..., .fields = NULL)\n"), #> "\n", list("\n", list(list(".restart"), list( #> "The name of a restart.")), "\n", "\n", list( #> list("..."), list("<", list("dynamic"), "> Additional arguments passed on\n", #> "the restart function. These arguments are evaluated only once\n", #> "and immediately, when creating the restarting handler.")), #> "\n", "\n", list(list(".fields"), list("A character vector specifying the fields of the\n", #> "condition that should be passed as arguments to the restart. If\n", #> "named, the names (except empty names ", #> list("\"\""), ") are used as\n", "argument names for calling the restart function. Otherwise the\n", #> "the fields themselves are used as argument names.")), #> "\n"), "\n", list("\n", "This constructor automates the common task of creating an\n", #> list(list("calling()")), " handler that invokes a restart.\n"), #> "\n", list("\n", "Jumping to a restart point from a calling handler has two\n", #> "effects. First, the control flow jumps to wherever the restart was\n", #> "established, and the restart function is called (with ", #> list("..."), ", or\n", list(".fields"), " as arguments). Execution resumes from the\n", #> list(list("with_restarts()")), " call. Secondly, the transfer of the control flow\n", #> "out of the function that signalled the condition means that the\n", #> "handler has dealt with the condition. Thus the condition will not\n", #> "be passed on to other potential handlers established on the stack.\n"), #> "\n", list("\n", "# This is a restart that takes a data frame and names as arguments\n", #> "rst_bar <- function(df, nms) {\n", " stats::setNames(df, nms)\n", #> "}\n", "\n", "# This restart is simpler and does not take arguments\n", #> "rst_baz <- function() \"baz\"\n", "\n", "# Signalling a condition parameterised with a data frame\n", #> "fn <- function() {\n", " with_restarts(signal(\"A foobar condition occurred\", \"foo\", foo_field = mtcars),\n", #> " rst_bar = rst_bar,\n", " rst_baz = rst_baz\n", #> " )\n", "}\n", "\n", "# Creating a restarting handler that passes arguments `nms` and\n", #> "# `df`, the latter taken from a data field of the condition object\n", #> "restart_bar <- restarting(\"rst_bar\",\n", #> " nms = LETTERS[1:11], .fields = c(df = \"foo_field\")\n", #> ")\n", "\n", "# The restarting handlers jumps to `rst_bar` when `foo` is signalled:\n", #> "with_handlers(fn(), foo = restart_bar)\n", #> "\n", "# The restarting() constructor is especially nice to use with\n", #> "# restarts that do not need arguments:\n", #> "with_handlers(fn(), foo = restarting(\"rst_baz\"))\n"), #> "\n", list("\n", list(list("calling()")), " and ", #> list(list("exiting()")), ".\n"), "\n", list( #> "internal"), "\n"), return_from.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/stack.R", #> "\n", list("return_from"), "\n", list("return_from"), #> "\n", list("return_to"), "\n", list("Jump to or from a frame"), #> "\n", list("\n", "return_from(frame, value = NULL)\n", #> "\n", "return_to(frame, value = NULL)\n"), #> "\n", list("\n", list(list("frame"), list("An environment, a frame object, or any object with an\n", #> list(list("get_env()")), " method. The environment should be an evaluation\n", #> "environment currently on the stack.")), "\n", #> "\n", list(list("value"), list("The return value.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "While ", list(list("base::return()")), #> " can only return from the current local\n", #> "frame, these two functions will return from any frame on the\n", #> "current evaluation stack, between the global and the currently\n", #> "active context. They provide a way of performing arbitrary\n", #> "non-local jumps out of the function currently under evaluation.\n"), #> "\n", list("\n", list("return_from()"), " will jump out of ", #> list("frame"), ". ", list("return_to()"), " is a bit\n", #> "trickier. It will jump out of the frame located just before ", #> list("frame"), "\n", "in the evaluation stack, so that control flow ends up in ", #> list("frame"), ",\n", "at the location where the previous frame was called from.\n", #> "\n", "These functions should only be used rarely. These sort of non-local\n", #> "gotos can be hard to reason about in casual code, though they can\n", #> "sometimes be useful. Also, consider to use the condition system to\n", #> "perform non-local jumps.\n"), "\n", list(list( #> "Life cycle"), list("\n", "\n", "\n", "The support for ", #> list("frame"), " object is soft-deprecated. Please pass\n", #> "simple environments to ", list("return_from()"), #> " and ", list("return_to()"), ".\n", "\n", #> "These functions are in the questioning lifecycle because we are\n", #> "considering simpler alternatives.\n")), "\n", #> "\n", list("\n", "# Passing fn() evaluation frame to g():\n", #> "fn <- function() {\n", " val <- g(current_env())\n", #> " cat(\"g returned:\", val, \"\\n\")\n", " \"normal return\"\n", #> "}\n", "g <- function(env) h(env)\n", "\n", #> "# Here we return from fn() with a new return value:\n", #> "h <- function(env) return_from(env, \"early return\")\n", #> "fn()\n", "\n", "# Here we return to fn(). The call stack unwinds until the last frame\n", #> "# called by fn(), which is g() in that case.\n", #> "h <- function(env) return_to(env, \"early return\")\n", #> "fn()\n"), "\n", list("internal"), "\n"), rlang_backtrace_on_error.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-abort.R", #> "\n", list("rlang_backtrace_on_error"), "\n", #> list("rlang_backtrace_on_error"), "\n", list( #> "add_backtrace"), "\n", list("Display backtrace on error"), #> "\n", list("\n", "Errors thrown with ", list( #> list("abort()")), " automatically save a backtrace that\n", #> "can be inspected by calling ", list(list("last_error()")), #> ". Optionally, you can\n", "also display the backtrace alongside the error message by setting\n", #> "the option ", list("rlang_backtrace_on_error"), #> " to one of the following\n", "values:\n", #> list("\n", list(), " ", list("\"reminder\""), #> ": Display a reminder that the backtrace can be\n", #> "inspected by calling ", list(list("last_error()")), #> ".\n", list(), " ", list("\"branch\""), ": Display a simplified backtrace.\n", #> list(), " ", list("\"collapse\""), ": Display a collapsed backtrace tree.\n", #> list(), " ", list("\"full\""), ": Display the full backtrace tree.\n"), #> "\n"), "\n", list(list("Promote base errors to rlang errors"), #> list("\n", "\n", "\n", "Call ", list("options(error = rlang::entrace)"), #> " to instrument base\n", "errors with rlang features. This handler does two things:\n", #> list("\n", list(), " It saves the base error as an rlang object. This allows you to\n", #> "call ", list(list("last_error()")), " to print the backtrace or inspect its data.\n", #> list(), " It prints the backtrace for the current error according to the\n", #> list("rlang_backtrace_on_error"), " option.\n"), #> "\n")), "\n", "\n", list("\n", "# Display a simplified backtrace on error for both base and rlang\n", #> "# errors:\n", "\n", "# options(\n", "# rlang_backtrace_on_error = \"branch\",\n", #> "# error = rlang::entrace\n", "# )\n", "# stop(\"foo\")\n"), #> "\n"), rst_abort.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-restarts.R", #> "\n", list("rst_abort"), "\n", list("rst_abort"), #> "\n", list("Jump to the abort restart"), "\n", #> list("\n", "rst_abort()\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "The abort restart is the only restart that is established at top\n", #> "level. It is used by R as a top-level target, most notably when an\n", #> "error is issued (see ", list(list("abort()")), #> ") that no handler is able\n", "to deal with (see ", #> list(list("with_handlers()")), ").\n"), "\n", #> list(list("Life cycle"), list("\n", "\n", "\n", #> "All the restart functions are in the questioning stage. It is not\n", #> "clear yet whether we want to recommend restarts as a style of\n", #> "programming in R.\n")), "\n", "\n", list("\n", #> "# The `abort` restart is a bit special in that it is always\n", #> "# registered in a R session. You will always find it on the restart\n", #> "# stack because it is established at top level:\n", #> "rst_list()\n", "\n", "# You can use the `above` restart to jump to top level without\n", #> "# signalling an error:\n", list("\n", "fn <- function() {\n", #> " cat(\"aborting...\\n\")\n", " rst_abort()\n", #> " cat(\"This is never called\\n\")\n", "}\n", #> "{\n", " fn()\n", " cat(\"This is never called\\n\")\n", #> "}\n"), "\n", "\n", "# The `above` restart is the target that R uses to jump to top\n", #> "# level when critical errors are signalled:\n", #> list("\n", "{\n", " abort(\"error\")\n", " cat(\"This is never called\\n\")\n", #> "}\n"), "\n", "\n", "# If another `abort` restart is specified, errors are signalled as\n", #> "# usual but then control flow resumes with from the new restart:\n", #> list("\n", "out <- NULL\n", "{\n", " out <- with_restarts(abort(\"error\"), abort = function() \"restart!\")\n", #> " cat(\"This is called\\n\")\n", "}\n", #> "cat(\"`out` has now become:\", out, \"\\n\")\n"), #> "\n"), "\n", list("\n", list(list("rst_jump()")), #> ", ", list(list("abort()")), "\n"), "\n", list( #> "internal"), "\n"), rst_list.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-restarts.R", #> "\n", list("rst_list"), "\n", list("rst_list"), #> "\n", list("rst_exists"), "\n", list("rst_jump"), #> "\n", list("rst_maybe_jump"), "\n", list("Restarts utilities"), #> "\n", list("\n", "rst_list()\n", "\n", "rst_exists(.restart)\n", #> "\n", "rst_jump(.restart, ...)\n", "\n", "rst_maybe_jump(.restart, ...)\n"), #> "\n", list("\n", list(list(".restart"), list( #> "The name of a restart.")), "\n", "\n", list( #> list("..."), list("<", list("dynamic"), "> Arguments passed on to the\n", #> "restart function.")), "\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "Restarts are named jumping points established by ", #> list(list("with_restarts()")), ".\n", list( #> "rst_list()"), " returns the names of all restarts currently\n", #> "established. ", list("rst_exists()"), " checks if a given restart is\n", #> "established. ", list("rst_jump()"), " stops execution of the current function\n", #> "and jumps to a restart point. If the restart does not exist, an\n", #> "error is thrown. ", list("rst_maybe_jump()"), #> " first checks that a restart\n", "exists before jumping.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "All the restart functions are in the questioning stage. It is not\n", #> "clear yet whether we want to recommend restarts as a style of\n", #> "programming in R.\n")), "\n", "\n", list("\n", #> list(list("with_restarts()")), "\n"), "\n", #> list("internal"), "\n"), `scalar-type-predicates.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("scalar-type-predicates"), "\n", list( #> "scalar-type-predicates"), "\n", list("is_scalar_list"), #> "\n", list("is_scalar_atomic"), "\n", list("is_scalar_vector"), #> "\n", list("is_scalar_integer"), "\n", list("is_scalar_double"), #> "\n", list("is_scalar_character"), "\n", list( #> "is_scalar_logical"), "\n", list("is_scalar_raw"), #> "\n", list("is_string"), "\n", list("is_scalar_bytes"), #> "\n", list("is_bool"), "\n", list("Scalar type predicates"), #> "\n", list("\n", "is_scalar_list(x)\n", "\n", #> "is_scalar_atomic(x)\n", "\n", "is_scalar_vector(x)\n", #> "\n", "is_scalar_integer(x)\n", "\n", "is_scalar_double(x)\n", #> "\n", "is_scalar_character(x)\n", "\n", "is_scalar_logical(x)\n", #> "\n", "is_scalar_raw(x)\n", "\n", "is_string(x, string = NULL)\n", #> "\n", "is_scalar_bytes(x)\n", "\n", "is_bool(x)\n"), #> "\n", list("\n", list(list("x"), list("object to be tested.")), #> "\n", "\n", list(list("string"), list("A string to compare to ", #> list("x"), ". If a character vector,\n", #> "returns ", list("TRUE"), " if at least one element is equal to ", #> list("x"), ".")), "\n"), "\n", list("\n", #> "These predicates check for a given type and whether the vector is\n", #> "\"scalar\", that is, of length 1.\n", "\n", #> "In addition to the length check, ", list("is_string()"), #> " and ", list("is_bool()"), "\n", "return ", #> list("FALSE"), " if their input is missing. This is useful for\n", #> "type-checking arguments, when your function expects a single string\n", #> "or a single ", list("TRUE"), " or ", list( #> "FALSE"), ".\n"), "\n", list("\n", list("type-predicates"), #> ", ", list("bare-type-predicates"), "\n"), #> "\n"), scoped_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("scoped_env"), "\n", list("scoped_env"), #> "\n", list("is_scoped"), "\n", list("scoped_envs"), #> "\n", list("scoped_names"), "\n", list("Retired ", #> list("scoped"), " functions"), "\n", list("\n", #> "scoped_env(nm)\n", "\n", "is_scoped(nm)\n", #> "\n", "scoped_envs()\n", "\n", "scoped_names()\n"), #> "\n", list("\n", list(list("nm"), list("The name of an environment attached to the search\n", #> "path. Call ", list(list("base::search()")), #> " to see what is currently on the path.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions are deprecated as of rlang 0.3.0. They are replaced\n", #> "by ", list(list("is_attached()")), ", ...\n"), #> "\n", list("internal"), "\n"), scoped_interactive.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("scoped_interactive"), "\n", list( #> "scoped_interactive"), "\n", list("scoped_options"), #> "\n", list("scoped_bindings"), "\n", list("Questioning ", #> list("scoped_"), " functions"), "\n", list( #> "\n", "scoped_interactive(value = TRUE, frame = caller_env())\n", #> "\n", "scoped_options(..., .frame = caller_env())\n", #> "\n", "scoped_bindings(..., .env = .frame, .frame = caller_env())\n"), #> "\n", list("\n", list(list("value"), list("A single ", #> list("TRUE"), " or ", list("FALSE"), ". This overrides the return\n", #> "value of ", list("is_interactive()"), ".")), #> "\n", "\n", list(list("frame"), list("The environment of a running function which defines\n", #> "the scope of the temporary options. When the function returns,\n", #> "the options are reset to their original values.")), #> "\n", "\n", list(list("..."), list("For ", #> list("local_options()"), " and ", list("push_options()"), #> ", named\n", "values defining new option values. For ", #> list("peek_options()"), ", strings\n", "or character vectors of option names.")), #> "\n", "\n", list(list(".frame"), list("The environment of a running function which defines\n", #> "the scope of the temporary options. When the function returns,\n", #> "the options are reset to their original values.")), #> "\n", "\n", list(list(".env"), list("An environment.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "These functions have been renamed to use the conventional ", #> list("local_"), "\n", "prefix. They will be deprecated in the next minor version of rlang.\n"), #> "\n"), search_envs.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("search_envs"), "\n", list("search_envs"), #> "\n", list("search_env"), "\n", list("pkg_env"), #> "\n", list("pkg_env_name"), "\n", list("is_attached"), #> "\n", list("base_env"), "\n", list("global_env"), #> "\n", list("Search path environments"), "\n", #> list("\n", "search_envs()\n", "\n", "search_env(name)\n", #> "\n", "pkg_env(pkg)\n", "\n", "pkg_env_name(pkg)\n", #> "\n", "is_attached(x)\n", "\n", "base_env()\n", #> "\n", "global_env()\n"), "\n", list("\n", list( #> list("name"), list("The name of an environment attached to the search\n", #> "path. Call ", list(list("base::search()")), #> " to get the names of environments\n", "currently attached to the search path. Note that the search name\n", #> "of a package environment is prefixed with ", #> list("\"package:\""), ".")), "\n", "\n", #> list(list("pkg"), list("The name of a package.")), #> "\n", "\n", list(list("x"), list("An environment or a search name.")), #> "\n"), "\n", list("\n", "The search path is a chain of environments containing exported\n", #> "functions of attached packages.\n", "\n", #> "The API includes:\n", list("\n", list(), " ", #> list(list("base::search()")), " to get the names of environments attached to the\n", #> "search path.\n", list(), " ", list("search_envs()"), #> " returns the environments on the search path as a\n", #> "list.\n", list(), " ", list("pkg_env_name()"), #> " takes a bare package name and prefixes it with\n", #> list("\"package:\""), ". Attached package environments have search names of\n", #> "the form ", list("package:name"), ".\n", #> list(), " ", list("pkg_env()"), " takes a bare package name and returns the scoped\n", #> "environment of packages if they are attached to the search path,\n", #> "and throws an error otherwise. It is a shortcut for\n", #> list("search_env(pkg_env_name(\"pkgname\"))"), #> ".\n", list(), " ", list("global_env()"), #> " and ", list("base_env()"), " (simple aliases for ", #> list(list("globalenv()")), "\n", "and ", #> list(list("baseenv()")), "). These are respectively the first and last\n", #> "environments of the search path.\n", list(), #> " ", list("is_attached()"), " returns ", #> list("TRUE"), " when its argument (a search name\n", #> "or a package environment) is attached to the search path.\n"), #> "\n"), "\n", list(list("The search path"), #> list("\n", "\n", "\n", "This chain of environments determines what objects are visible from\n", #> "the global workspace. It contains the following elements:\n", #> list("\n", list(), " The chain always starts with ", #> list("global_env()"), " and finishes with\n", #> list("base_env()"), " which inherits from the terminal environment\n", #> list("empty_env()"), ".\n", list(), " Each ", #> list(list("base::library()")), " call attaches a new package environment to\n", #> "the search path. Attached packages are associated with a ", #> list("search name"), ".\n", list(), " In addition, any list, data frame, or environment can be attached\n", #> "to the search path with ", list(list("base::attach()")), #> ".\n"), "\n")), "\n", "\n", list("\n", #> "# List the search names of environments attached to the search path:\n", #> "search()\n", "\n", "# Get the corresponding environments:\n", #> "search_envs()\n", "\n", "# The global environment and the base package are always first and\n", #> "# last in the chain, respectively:\n", "envs <- search_envs()\n", #> "envs[[1]]\n", "envs[[length(envs)]]\n", "\n", #> "# These two environments have their own shortcuts:\n", #> "global_env()\n", "base_env()\n", "\n", "# Packages appear in the search path with a special name. Use\n", #> "# pkg_env_name() to create that name:\n", #> "pkg_env_name(\"rlang\")\n", "search_env(pkg_env_name(\"rlang\"))\n", #> "\n", "# Alternatively, get the scoped environment of a package with\n", #> "# pkg_env():\n", "pkg_env(\"utils\")\n"), #> "\n", list("internal"), "\n"), seq2.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec.R", #> "\n", list("seq2"), "\n", list("seq2"), "\n", #> list("seq2_along"), "\n", list("Increasing sequence of integers in an interval"), #> "\n", list("\n", "seq2(from, to)\n", "\n", "seq2_along(from, x)\n"), #> "\n", list("\n", list(list("from"), list("The starting point of the sequence.")), #> "\n", "\n", list(list("to"), list("The end point.")), #> "\n", "\n", list(list("x"), list("A vector whose length is the end point.")), #> "\n"), "\n", list("\n", "An integer vector containing a strictly increasing\n", #> "sequence.\n"), "\n", list("\n", "These helpers take two endpoints and return the sequence of all\n", #> "integers within that interval. For ", list( #> "seq2_along()"), ", the upper\n", "endpoint is taken from the length of a vector. Unlike\n", #> list("base::seq()"), ", they return an empty vector if the starting point is\n", #> "a larger integer than the end point.\n"), #> "\n", list("\n", "seq2(2, 10)\n", "seq2(10, 2)\n", #> "seq(10, 2)\n", "\n", "seq2_along(10, letters)\n"), #> "\n"), set_attrs.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("set_attrs"), "\n", list("set_attrs"), #> "\n", list("mut_attrs"), "\n", list("Add attributes to an object"), #> "\n", list("\n", "set_attrs(.x, ...)\n", "\n", #> "mut_attrs(.x, ...)\n"), "\n", list("\n", list( #> list(".x"), list("An object to decorate with attributes.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> A list of named attributes. Pass\n", #> "a single unnamed ", list("NULL"), " argument to zap all attributes from ", #> list(".x"), ".")), "\n"), "\n", list("\n", #> list("set_attrs()"), " returns a modified ", #> list("shallow copy"), "\n", "of ", list(".x"), #> ". ", list("mut_attrs()"), " invisibly returns the original ", #> list(".x"), "\n", "modified in place.\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", list("set_attrs()"), " adds, changes, or zaps attributes of objects. Pass a\n", #> "single unnamed ", list("NULL"), " argument to zap all attributes. For\n", #> list("uncopyable"), " types, use ", list("mut_attrs()"), #> ".\n"), "\n", list("\n", "Unlike ", list(list( #> "structure()")), ", these setters have no special handling of\n", #> "internal attributes names like ", list(".Dim"), #> ", ", list(".Dimnames"), " or ", list(".Names"), #> ".\n"), "\n", list(list("Life cycle"), list( #> "\n", "\n", "\n", "These functions are deprecated since rlang 0.3.0.\n")), #> "\n", "\n", list("\n", "set_attrs(letters, names = 1:26, class = \"my_chr\")\n", #> "\n", "# Splice a list of attributes:\n", "attrs <- list(attr = \"attr\", names = 1:26, class = \"my_chr\")\n", #> "obj <- set_attrs(letters, splice(attrs))\n", #> "obj\n", "\n", "# Zap attributes by passing a single unnamed NULL argument:\n", #> "set_attrs(obj, NULL)\n", "set_attrs(obj, !!! list(NULL))\n", #> "\n", "# Note that set_attrs() never modifies objects in place:\n", #> "obj\n", "\n", "# For uncopyable types, mut_attrs() lets you modify in place:\n", #> "env <- env()\n", "mut_attrs(env, foo = \"bar\")\n", #> "env\n"), "\n", list("internal"), "\n"), set_expr.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/expr.R", #> "\n", list("set_expr"), "\n", list("set_expr"), #> "\n", list("get_expr"), "\n", list("Set and get an expression"), #> "\n", list("\n", "set_expr(x, value)\n", "\n", #> "get_expr(x, default = x)\n"), "\n", list("\n", #> list(list("x"), list("An expression, closure, or one-sided formula. In addition,\n", #> list("set_expr()"), " accept frames.")), #> "\n", "\n", list(list("value"), list("An updated expression.")), #> "\n", "\n", list(list("default"), list("A default expression to return when ", #> list("x"), " is not an\n", "expression wrapper. Defaults to ", #> list("x"), " itself.")), "\n"), "\n", list( #> "\n", "The updated original input for ", list( #> "set_expr()"), ". A raw\n", "expression for ", #> list("get_expr()"), ".\n"), "\n", list("\n", #> "These helpers are useful to make your function work generically\n", #> "with quosures and raw expressions. First call ", #> list("get_expr()"), " to\n", "extract an expression. Once you're done processing the expression,\n", #> "call ", list("set_expr()"), " on the original object to update the expression.\n", #> "You can return the result of ", list("set_expr()"), #> ", either a formula or an\n", "expression depending on the input type. Note that ", #> list("set_expr()"), " does\n", "not change its input, it creates a new object.\n"), #> "\n", list("\n", "f <- ~foo(bar)\n", "e <- quote(foo(bar))\n", #> "frame <- identity(identity(ctxt_frame()))\n", #> "\n", "get_expr(f)\n", "get_expr(e)\n", "get_expr(frame)\n", #> "\n", "set_expr(f, quote(baz))\n", "set_expr(e, quote(baz))\n"), #> "\n", list("\n", list(list("quo_get_expr()")), #> " and ", list(list("quo_set_expr()")), " for versions of\n", #> list(list("get_expr()")), " and ", list(list( #> "set_expr()")), " that only work on quosures.\n"), #> "\n"), set_names.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("set_names"), "\n", list("set_names"), #> "\n", list("Set names of a vector"), "\n", list( #> "\n", "set_names(x, nm = x, ...)\n"), "\n", #> list("\n", list(list("x"), list("Vector to name.")), #> "\n", "\n", list(list("nm, ..."), list("Vector of names, the same length as ", #> list("x"), ".\n", "\n", "You can specify names in the following ways:\n", #> list("\n", list(), " If you do nothing, ", #> list("x"), " will be named with itself.\n", #> list(), " If ", list("x"), " already has names, you can provide a function or formula\n", #> "to transform the existing names. In that case, ", #> list("..."), " is passed\n", "to the function.\n", #> list(), " If ", list("nm"), " is ", list( #> "NULL"), ", the names are removed (if present).\n", #> list(), " In all other cases, ", list("nm"), #> " and ", list("..."), " are coerced to character.\n"))), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", "This is equivalent to ", list( #> list("stats::setNames()")), ", with more features and\n", #> "stricter argument checking.\n"), "\n", list( #> list("Life cycle"), list("\n", "\n", "\n", #> list("set_names()"), " is stable and exported in purrr.\n")), #> "\n", "\n", list("\n", "set_names(1:4, c(\"a\", \"b\", \"c\", \"d\"))\n", #> "set_names(1:4, letters[1:4])\n", "set_names(1:4, \"a\", \"b\", \"c\", \"d\")\n", #> "\n", "# If the second argument is ommitted a vector is named with itself\n", #> "set_names(letters[1:5])\n", "\n", "# Alternatively you can supply a function\n", #> "set_names(1:10, ~ letters[seq_along(.)])\n", #> "set_names(head(mtcars), toupper)\n", "\n", #> "# If the input vector is unnamed, it is first named after itself\n", #> "# before the function is applied:\n", "set_names(letters, toupper)\n", #> "\n", "# `...` is passed to the function:\n", #> "set_names(head(mtcars), paste0, \"_foo\")\n"), #> "\n"), splice.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("splice"), "\n", list("splice"), "\n", #> list("is_spliced"), "\n", list("is_spliced_bare"), #> "\n", list("dots_splice"), "\n", list("Splice lists"), #> "\n", list("\n", "splice(x)\n", "\n", "is_spliced(x)\n", #> "\n", "is_spliced_bare(x)\n", "\n", "dots_splice(\n", #> " ...,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .preserve_empty = FALSE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n"), "\n", #> list("\n", list(list("x"), list("A list to splice.")), #> "\n", "\n", list(list("..."), list("Arguments to collect in a list. These dots are\n", #> list("dynamic"), ".")), "\n", "\n", list( #> list(".ignore_empty"), list("Whether to ignore empty arguments. Can be one\n", #> "of ", list("\"trailing\""), ", ", list( #> "\"none\""), ", ", list("\"all\""), ". If ", #> list("\"trailing\""), ", only the\n", "last argument is ignored if it is empty.")), #> "\n", "\n", list(list(".preserve_empty"), list( #> "Whether to preserve the empty arguments that\n", #> "were not ignored. If ", list("TRUE"), ", empty arguments are stored with\n", #> list(list("missing_arg()")), " values. If ", #> list("FALSE"), " (the default) an error is\n", #> "thrown when an empty argument is detected.")), #> "\n", "\n", list(list(".homonyms"), list("How to treat arguments with the same name. The\n", #> "default, ", list("\"keep\""), ", preserves these arguments. Set ", #> list(".homonyms"), " to\n", list("\"first\""), #> " to only keep the first occurrences, to ", #> list("\"last\""), " to keep\n", "the last occurrences, and to ", #> list("\"error\""), " to raise an informative\n", #> "error and indicate what arguments have duplicated names.")), #> "\n", "\n", list(list(".check_assign"), list( #> "Whether to check for ", list("<-"), " calls passed in\n", #> "dots. When ", list("TRUE"), " and a ", list( #> "<-"), " call is detected, a warning is\n", #> "issued to advise users to use ", list("="), #> " if they meant to match a\n", "function parameter, or wrap the ", #> list("<-"), " call in braces otherwise.\n", #> "This ensures assignments are explicit.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", list("\n", list(), " ", list("splice"), #> " marks an object to be spliced. It is equivalent to using\n", #> list("!!!"), " in a function taking ", list( #> "dynamic dots"), ".\n", list(), " ", list( #> "dots_splice()"), " is like ", list(list( #> "dots_list()")), " but automatically splices\n", #> "list inputs.\n"), "\n"), "\n", list(list( #> "Standard splicing versus quoting splicing"), #> list("\n", "\n", "\n", "The ", list("!!!"), #> " operator works differently in ", list("standard"), #> " functions taking\n", "dots with ", list( #> "dots_list()"), " than in ", list("quoting"), #> " functions taking dots\n", "with ", list( #> list("enexprs()")), " or ", list(list("enquos()")), #> ".\n", list("\n", list(), " In quoting functions ", #> list("!!!"), " disaggregates its argument (let's call\n", #> "it ", list("x"), ") into as many objects as there are elements in\n", #> list("x"), ". E.g. ", list("quo(foo(!!! c(1, 2)))"), #> " is completely equivalent to\n", list( #> "quo(foo(1, 2))"), ". The creation of those separate objects has an\n", #> "overhead but is typically not important when manipulating calls\n", #> "because function calls typically take a small number of\n", #> "arguments.\n", list(), " In standard functions, disaggregating the spliced collection\n", #> "would have a negative performance impact in cases where\n", #> list("dots_list()"), " is used to build up data structures from user\n", #> "inputs. To avoid this spliced inputs are marked with ", #> list(list("splice()")), "\n", "and the final list is built with (the equivalent of)\n", #> list("flatten_if(dots, is_spliced)"), ".\n"), #> "\n", "\n", "Most of the time you should not care about the difference. However\n", #> "if you use a standard function taking tidy dots within a quoting\n", #> "function, the ", list("!!!"), " operator will disaggregate its argument because\n", #> "the behaviour of the quasiquoting function has priority. You might\n", #> "then observe some performance cost in edge cases. Here is one\n", #> "example where this would happen:", list( #> "purrr::rerun(10, dplyr::bind_rows(!!! x))\n"), #> "\n", "\n", list("purrr::rerun()"), " is a quoting function and ", #> list("dplyr::bind_rows()"), " is\n", "a standard function. Because ", #> list("bind_rows()"), " is called ", list( #> "inside"), "\n", list("rerun()"), ", the list ", #> list("x"), " will be disaggregated into a pairlist of\n", #> "arguments. To avoid this you can use ", #> list("splice()"), " instead:", list("purrr::rerun(10, dplyr::bind_rows(splice(x)))\n"), #> "\n")), "\n", "\n", list(list("Life cycle"), #> list("\n", "\n", list("\n", list(), " ", list( #> "dots_splice()"), " is in the questioning stage. It is part of our\n", #> "experiments with dots semantics. Compared to ", #> list("dots_list()"), ",\n", list("dots_splice()"), #> " automatically splices lists. We now lean towards\n", #> "adopting a single type of dots semantics (those of ", #> list("dots_list()"), ")\n", "where splicing is explicit.\n", #> list(), " ", list("splice()"), " is in the questioning stage. It is not clear whether it is\n", #> "really needed as there are other ways to avoid the performance\n", #> "issue discussed above.\n"), "\n")), "\n", #> "\n", list("internal"), "\n"), stack.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("stack"), "\n", list("stack"), "\n", #> list("global_frame"), "\n", list("current_frame"), #> "\n", list("ctxt_frame"), "\n", list("call_frame"), #> "\n", list("ctxt_depth"), "\n", list("call_depth"), #> "\n", list("ctxt_stack"), "\n", list("call_stack"), #> "\n", list("Call stack information"), "\n", list( #> "\n", "global_frame()\n", "\n", "current_frame()\n", #> "\n", "ctxt_frame(n = 1)\n", "\n", "call_frame(n = 1, clean = TRUE)\n", #> "\n", "ctxt_depth()\n", "\n", "call_depth()\n", #> "\n", "ctxt_stack(n = NULL, trim = 0)\n", "\n", #> "call_stack(n = NULL, clean = TRUE)\n"), "\n", #> list("\n", list(list("n"), list("The number of frames to go back in the stack.")), #> "\n", "\n", list(list("clean"), list("Whether to post-process the call stack to clean\n", #> "non-standard frames. If ", list("TRUE"), #> ", suboptimal call-stack entries by\n", list( #> list("base::eval()")), " will be cleaned up: the duplicate frame created by\n", #> list("eval()"), " is eliminated.")), "\n", #> "\n", list(list("trim"), list("The number of layers of intervening frames to trim off\n", #> "the stack. See ", list(list("stack_trim()")), #> " and examples.")), "\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "The ", list("eval_"), " and ", #> list("call_"), " families of functions provide a replacement\n", #> "for the base R functions prefixed with ", #> list("sys."), " (which are all about\n", "the context stack), as well as for ", #> list(list("parent.frame()")), " (which is the\n", #> "only base R function for querying the call stack). The context\n", #> "stack includes all R-level evaluation contexts. It is linear in\n", #> "terms of execution history but due to lazy evaluation it is\n", #> "potentially nonlinear in terms of call history. The call stack\n", #> "history, on the other hand, is homogenous.\n"), #> "\n", list("\n", list("ctxt_frame()"), " and ", #> list("call_frame()"), " return a ", list("frame"), #> " object\n", "containing the following fields: ", #> list("expr"), " and ", list("env"), " (call expression\n", #> "and evaluation environment), ", list("pos"), #> " and ", list("caller_pos"), " (position of\n", #> "current frame in the context stack and position of the caller), and\n", #> list("fun"), " (function of the current frame). ", #> list("ctxt_stack()"), " and\n", list("call_stack()"), #> " return a list of all context or call frames on the\n", #> "stack. Finally, ", list("ctxt_depth()"), " and ", #> list("call_depth()"), " report the\n", "current context position or the number of calling frames on the\n", #> "stack.\n", "\n", "The base R functions take two sorts of arguments to indicate which\n", #> "frame to query: ", list("which"), " and ", #> list("n"), ". The ", list("n"), " argument is\n", #> "straightforward: it's the number of frames to go down the stack,\n", #> "with ", list("n = 1"), " referring to the current context. The ", #> list("which"), " argument\n", "is more complicated and changes meaning for values lower than 1.\n", #> "For the sake of consistency, the rlang functions all take the\n", #> "same kind of argument ", list("n"), ". This argument has a single meaning (the\n", #> "number of frames to go down the stack) and cannot be lower than 1.\n", #> "\n", "Note finally that ", list("parent.frame(1)"), #> " corresponds to\n", list("call_frame(2)$env"), #> ", as ", list("n = 1"), " always refers to the current\n", #> "frame. This makes the ", list("_frame()"), #> " and ", list("_stack()"), " functions\n", #> "consistent: ", list("ctxt_frame(2)"), " is the same as ", #> list("ctxt_stack()[[2]]"), ".\n", "Also, ", #> list("ctxt_depth()"), " returns one more frame than\n", #> list(list("base::sys.nframe()")), " because it counts the global frame. That is\n", #> "consistent with the ", list("_stack()"), " functions which return the global\n", #> "frame as well. This way, ", list("call_stack(call_depth())"), #> " is the same as\n", list("global_frame()"), #> ".\n"), "\n", list(list("Life cycle"), list( #> "\n", "\n", "\n", "These functions are soft-deprecated and replaced by ", #> list(list("trace_back()")), ".\n")), "\n", #> "\n", list("\n", "# Expressions within arguments count as contexts\n", #> "identity(identity(ctxt_depth())) # returns 2\n", #> "\n", "# But they are not part of the call stack because arguments are\n", #> "# evaluated within the calling function (or the global environment\n", #> "# if called at top level)\n", "identity(identity(call_depth())) # returns 0\n", #> "\n", "# The context stacks includes all intervening execution frames. The\n", #> "# call stack doesn't:\n", "f <- function(x) identity(x)\n", #> "f(f(ctxt_stack()))\n", "f(f(call_stack()))\n", #> "\n", "g <- function(cmd) cmd()\n", "f(g(ctxt_stack))\n", #> "f(g(call_stack))\n", "\n", "# The rlang _stack() functions return a list of frame\n", #> "# objects. Use purrr::transpose() or index a field with\n", #> "# purrr::map()'s to extract a particular field from a stack:\n", #> "\n", "# stack <- f(f(call_stack()))\n", "# purrr::map(stack, \"env\")\n", #> "# purrr::transpose(stack)$expr\n", "\n", "# current_frame() is an alias for ctxt_frame(1)\n", #> "fn <- function() list(current = current_frame(), first = ctxt_frame(1))\n", #> "fn()\n", "\n", "# While current_frame() is the top of the stack, global_frame() is\n", #> "# the bottom:\n", "fn <- function() {\n", #> " n <- ctxt_depth()\n", " ctxt_frame(n)\n", #> "}\n", "identical(fn(), global_frame())\n", #> "\n", "\n", "# ctxt_stack() returns a stack with all intervening frames. You can\n", #> "# trim layers of intervening frames with the trim argument:\n", #> "identity(identity(ctxt_stack()))\n", "identity(identity(ctxt_stack(trim = 1)))\n", #> "\n", "# ctxt_stack() is called within fn() with intervening frames:\n", #> "fn <- function(trim) identity(identity(ctxt_stack(trim = trim)))\n", #> "fn(0)\n", "\n", "# We can trim the first layer of those:\n", #> "fn(1)\n", "\n", "# The outside intervening frames (at the fn() call site) are still\n", #> "# returned, but can be trimmed as well:\n", #> "identity(identity(fn(1)))\n", "identity(identity(fn(2)))\n", #> "\n", "g <- function(trim) identity(identity(fn(trim)))\n", #> "g(2)\n", "g(3)\n"), "\n", list("internal"), #> "\n"), stack_trim.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("stack_trim"), "\n", list("stack_trim"), #> "\n", list("Trim top call layers from the evaluation stack"), #> "\n", list("\n", "stack_trim(stack, n = 1)\n"), #> "\n", list("\n", list(list("stack"), list("An evaluation stack.")), #> "\n", "\n", list(list("n"), list("The number of call frames (not eval frames) to trim off\n", #> "the top of the stack. In other words, the number of layers of\n", #> "intervening frames to trim.")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", list(list("ctxt_stack()")), " can be tricky to use in real code because all\n", #> "intervening frames are returned with the stack, including those at\n", #> list("ctxt_stack()"), " own call site. ", list( #> "stack_trim()"), " makes it easy to\n", "remove layers of intervening calls.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "These functions are deprecated and replaced by ", #> list(list("trace_back()")), ".\n")), "\n", #> "\n", list("\n", "# Intervening frames appear on the evaluation stack:\n", #> "identity(identity(ctxt_stack()))\n", "\n", #> "# stack_trim() will trim the first n layers of calls:\n", #> "stack_trim(identity(identity(ctxt_stack())))\n", #> "\n", "# Note that it also takes care of calls intervening at its own call\n", #> "# site:\n", "identity(identity(\n", " stack_trim(identity(identity(ctxt_stack())))\n", #> "))\n", "\n", "# It is especially useful when used within a function that needs to\n", #> "# inspect the evaluation stack but should nonetheless be callable\n", #> "# within nested calls without side effects:\n", #> "stack_util <- function() {\n", " # n = 2 means that two layers of intervening calls should be\n", #> " # removed: The layer at ctxt_stack()'s call site (including the\n", #> " # stack_trim() call), and the layer at stack_util()'s call.\n", #> " stack <- stack_trim(ctxt_stack(), n = 2)\n", #> " stack\n", "}\n", "user_fn <- function() {\n", #> " # A user calls your stack utility with intervening frames:\n", #> " identity(identity(stack_util()))\n", "}\n", #> "# These intervening frames won't appear in the evaluation stack\n", #> "identity(user_fn())\n"), "\n", list("internal"), #> "\n"), string.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/utils-encoding.R", #> "\n", list("string"), "\n", list("string"), "\n", #> list("Create a string"), "\n", list("\n", "string(x, encoding = NULL)\n"), #> "\n", list("\n", list(list("x"), list("A character vector or a vector or list of string-like\n", #> "objects.")), "\n", "\n", list(list("encoding"), #> list("If non-null, set an encoding mark. This is only\n", #> "declarative, no encoding conversion is performed.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "These base-type constructors allow more control over the creation\n", #> "of strings in R. They take character vectors or string-like objects\n", #> "(integerish or raw vectors), and optionally set the encoding. The\n", #> "string version checks that the input contains a scalar string.\n"), #> "\n", list("\n", "# As everywhere in R, you can specify a string with Unicode\n", #> "# escapes. The characters corresponding to Unicode codepoints will\n", #> "# be encoded in UTF-8, and the string will be marked as UTF-8\n", #> "# automatically:\n", "cafe <- string(\"caf\\uE9\")\n", #> "Encoding(cafe)\n", "as_bytes(cafe)\n", "\n", #> "# In addition, string() provides useful conversions to let\n", #> "# programmers control how the string is represented in memory. For\n", #> "# encodings other than UTF-8, you'll need to supply the bytes in\n", #> "# hexadecimal form. If it is a latin1 encoding, you can mark the\n", #> "# string explicitly:\n", "cafe_latin1 <- string(c(0x63, 0x61, 0x66, 0xE9), \"latin1\")\n", #> "Encoding(cafe_latin1)\n", "as_bytes(cafe_latin1)\n"), #> "\n", list("internal"), "\n"), switch_type.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("switch_type"), "\n", list("switch_type"), #> "\n", list("coerce_type"), "\n", list("switch_class"), #> "\n", list("coerce_class"), "\n", list("Dispatch on base types"), #> "\n", list("\n", "switch_type(.x, ...)\n", "\n", #> "coerce_type(.x, .to, ...)\n", "\n", "switch_class(.x, ...)\n", #> "\n", "coerce_class(.x, .to, ...)\n"), "\n", #> list("\n", list(list(".x"), list("An object from which to dispatch.")), #> "\n", "\n", list(list("..."), list("Named clauses. The names should be types as returned by\n", #> list(list("type_of()")), ".")), "\n", "\n", #> list(list(".to"), list("This is useful when you switchpatch within a coercing\n", #> "function. If supplied, this should be a string indicating the\n", #> "target type. A catch-all clause is then added to signal an error\n", #> "stating the conversion failure. This type is prettified unless\n", #> list(".to"), " inherits from the S3 class ", #> list("\"AsIs\""), " (see ", list(list("base::I()")), #> ").")), "\n"), "\n", list("\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", list("switch_type()"), " is equivalent to\n", #> list(list("switch"), "(", list("type_of"), #> "(x, ...))"), ", while\n", list("switch_class()"), #> " switchpatches based on ", list("class(x)"), #> ". The ", list("coerce_"), "\n", "versions are intended for type conversion and provide a standard\n", #> "error message when conversion fails.\n"), #> "\n", list("\n", "switch_type(3L,\n", " double = \"foo\",\n", #> " integer = \"bar\",\n", " \"default\"\n", #> ")\n", "\n", "# Use the coerce_ version to get standardised error handling when no\n", #> "# type matches:\n", "to_chr <- function(x) {\n", #> " coerce_type(x, \"a chr\",\n", " integer = as.character(x),\n", #> " double = as.character(x)\n", " )\n", #> "}\n", "to_chr(3L)\n", "\n", "# Strings have their own type:\n", #> "switch_type(\"str\",\n", " character = \"foo\",\n", #> " string = \"bar\",\n", " \"default\"\n", #> ")\n", "\n", "# Use a fallthrough clause if you need to dispatch on all character\n", #> "# vectors, including strings:\n", "switch_type(\"str\",\n", #> " string = ,\n", " character = \"foo\",\n", #> " \"default\"\n", ")\n", "\n", "# special and builtin functions are treated as primitive, since\n", #> "# there is usually no reason to treat them differently:\n", #> "switch_type(base::list,\n", " primitive = \"foo\",\n", #> " \"default\"\n", ")\n", "switch_type(base::`$`,\n", #> " primitive = \"foo\",\n", " \"default\"\n", #> ")\n", "\n", "# closures are not primitives:\n", #> "switch_type(rlang::switch_type,\n", " primitive = \"foo\",\n", #> " \"default\"\n", ")\n"), "\n", list("internal"), #> "\n"), sym.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/sym.R", #> "\n", list("sym"), "\n", list("sym"), "\n", list( #> "syms"), "\n", list("Create a symbol or list of symbols"), #> "\n", list("\n", "sym(x)\n", "\n", "syms(x)\n"), #> "\n", list("\n", list(list("x"), list("A string or list of strings.")), #> "\n"), "\n", list("\n", "A symbol for ", list( #> "sym()"), " and a list of symbols for ", list( #> "syms()"), ".\n"), "\n", list("\n", "These functions take strings as input and turn them into symbols.\n"), #> "\n", list("\n", "# The empty string returns the missing argument:\n", #> "sym(\"\")\n", "\n", "# This way sym() and as_string() are inverse of each other:\n", #> "as_string(missing_arg())\n", "sym(as_string(missing_arg()))\n"), #> "\n"), `tidyeval-data.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval-tidy.R", #> "\n", list("data"), "\n", list("tidyeval-data"), #> "\n", list("tidyeval-data"), "\n", list(".data"), #> "\n", list(".env"), "\n", list("Data pronouns for tidy evaluation"), #> "\n", list("\n", ".data\n", "\n", ".env\n"), #> "\n", list("\n", "These pronouns allow you to be explicit about where to find objects\n", #> "when programming with data masked functions.", #> list("m <- 10\n", "mtcars %>% mutate(disp = .data$disp * .env$m)\n"), #> "\n", list("\n", list(), " ", list(".data"), #> " retrieves data-variables from the data frame.\n", #> list(), " ", list(".env"), " retrieves env-variables from the environment.\n"), #> "\n", "\n", "Because the lookup is explicit, there is no ambiguity between both\n", #> "kinds of variables. Compare:", list("disp <- 10\n", #> "mtcars %>% mutate(disp = .data$disp * .env$disp)\n", #> "mtcars %>% mutate(disp = disp * disp)\n"), #> "\n", "\n", "The ", list(".data"), " object exported from rlang is also useful to import in\n", #> "your package namespace to avoid a ", list( #> "R CMD check"), " note when referring\n", #> "to objects from the data mask.\n", "\n", "Note that ", #> list(".data"), " is only a pronoun, it is not a real data\n", #> "frame. This means that you can't take its names or map a function\n", #> "over the contents of ", list(".data"), ". Similarly, ", #> list(".env"), " is not an actual R\n", "environment. For instance, it doesn't have a parent and the\n", #> "subsetting operators behave differently.\n"), #> "\n", list("datasets"), "\n"), trace_back.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/trace.R", #> "\n", list("trace_back"), "\n", list("trace_back"), #> "\n", list("trace_length"), "\n", list("Capture a backtrace"), #> "\n", list("\n", "trace_back(top = NULL, bottom = NULL)\n", #> "\n", "trace_length(trace)\n"), "\n", list( #> "\n", list(list("top"), list("The first frame environment to be included in the\n", #> "backtrace. This becomes the top of the backtrace tree and\n", #> "represents the oldest call in the backtrace.\n", #> "\n", "This is needed in particular when you call ", #> list("trace_back()"), "\n", "indirectly or from a larger context, for example in tests or\n", #> "inside an RMarkdown document where you don't want all of the\n", #> "knitr evaluation mechanisms to appear in the backtrace.")), #> "\n", "\n", list(list("bottom"), list("The last frame environment to be included in the\n", #> "backtrace. This becomes the rightmost leaf of the backtrace tree\n", #> "and represents the youngest call in the backtrace.\n", #> "\n", "Set this when you would like to capture a backtrace without the\n", #> "capture context.\n", "\n", "Can also be an integer that will be passed to ", #> list(list("caller_env()")), ".")), "\n", #> "\n", list(list("trace"), list("A backtrace created by ", #> list("trace_back()"), ".")), "\n"), "\n", #> list("\n", "A backtrace captures the sequence of calls that lead to the current\n", #> "function, sometimes called the call stack. Because of lazy\n", #> "evaluation, the call stack in R is actually a tree, which the\n", #> list("summary()"), " method of this object will reveal.\n"), #> "\n", list("\n", list("trace_length()"), " returns the number of frames in a backtrace.\n"), #> "\n", list("\n", "# Trim backtraces automatically (this improves the generated\n", #> "# documentation for the rlang website and the same trick can be\n", #> "# useful within knitr documents):\n", "options(rlang_trace_top_env = current_env())\n", #> "\n", "f <- function() g()\n", "g <- function() h()\n", #> "h <- function() trace_back()\n", "\n", "# When no lazy evaluation is involved the backtrace is linear\n", #> "# (i.e. every call has only one child)\n", #> "f()\n", "\n", "# Lazy evaluation introduces a tree like structure\n", #> "identity(identity(f()))\n", "identity(try(f()))\n", #> "try(identity(f()))\n", "\n", "# When printing, you can request to simplify this tree to only show\n", #> "# the direct sequence of calls that lead to `trace_back()`\n", #> "x <- try(identity(f()))\n", "x\n", "print(x, simplify = \"branch\")\n", #> "\n", "# With a little cunning you can also use it to capture the\n", #> "# tree from within a base NSE function\n", #> "x <- NULL\n", "with(mtcars, {x <<- f(); 10})\n", #> "x\n", "\n", "\n", "# Restore default top env for next example\n", #> "options(rlang_trace_top_env = NULL)\n", "\n", #> "# When code is executed indirectly, i.e. via source or within an\n", #> "# RMarkdown document, you'll tend to get a lot of guff at the beginning\n", #> "# related to the execution environment:\n", #> "conn <- textConnection(\"summary(f())\")\n", #> "source(conn, echo = TRUE, local = TRUE)\n", #> "close(conn)\n", "\n", "# To automatically strip this off, specify which frame should be\n", #> "# the top of the backtrace. This will automatically trim off calls\n", #> "# prior to that frame:\n", "top <- current_env()\n", #> "h <- function() trace_back(top)\n", "\n", #> "conn <- textConnection(\"summary(f())\")\n", #> "source(conn, echo = TRUE, local = TRUE)\n", #> "close(conn)\n"), "\n"), `type-predicates.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("type-predicates"), "\n", list("type-predicates"), #> "\n", list("is_list"), "\n", list("is_atomic"), #> "\n", list("is_vector"), "\n", list("is_integer"), #> "\n", list("is_double"), "\n", list("is_character"), #> "\n", list("is_logical"), "\n", list("is_raw"), #> "\n", list("is_bytes"), "\n", list("is_null"), #> "\n", list("Type predicates"), "\n", list("\n", #> "is_list(x, n = NULL)\n", "\n", "is_atomic(x, n = NULL)\n", #> "\n", "is_vector(x, n = NULL)\n", "\n", "is_integer(x, n = NULL)\n", #> "\n", "is_double(x, n = NULL, finite = NULL)\n", #> "\n", "is_character(x, n = NULL)\n", "\n", #> "is_logical(x, n = NULL)\n", "\n", "is_raw(x, n = NULL)\n", #> "\n", "is_bytes(x, n = NULL)\n", "\n", "is_null(x)\n"), #> "\n", list("\n", list(list("x"), list("Object to be tested.")), #> "\n", "\n", list(list("n"), list("Expected length of a vector.")), #> "\n", "\n", list(list("finite"), list("Whether all values of the vector are finite. The\n", #> "non-finite values are ", list("NA"), ", ", #> list("Inf"), ", ", list("-Inf"), " and ", #> list("NaN"), ". Setting this\n", "to something other than ", #> list("NULL"), " can be expensive because the whole\n", #> "vector needs to be traversed and checked.")), #> "\n"), "\n", list("\n", "These type predicates aim to make type testing in R more\n", #> "consistent. They are wrappers around ", list( #> list("base::typeof()")), ", so operate\n", #> "at a level beneath S3/S4 etc.\n"), "\n", list( #> "\n", "Compared to base R functions:\n", list( #> "\n", list(), " The predicates for vectors include the ", #> list("n"), " argument for\n", "pattern-matching on the vector length.\n", #> list(), " Unlike ", list("is.atomic()"), #> ", ", list("is_atomic()"), " does not return ", #> list("TRUE"), " for\n", list("NULL"), ".\n", #> list(), " Unlike ", list("is.vector()"), #> ", ", list("is_vector()"), " tests if an object is an\n", #> "atomic vector or a list. ", list("is.vector"), #> " checks for the presence of\n", "attributes (other than name).\n"), #> "\n"), "\n", list("\n", list("bare-type-predicates"), #> " ", list("scalar-type-predicates"), "\n"), #> "\n"), type_of.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("type_of"), "\n", list("type_of"), #> "\n", list("Base type of an object"), "\n", list( #> "\n", "type_of(x)\n"), "\n", list("\n", list( #> list("x"), list("An R object.")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "This is equivalent to ", list( #> list("base::typeof()")), " with a few differences that\n", #> "make dispatching easier:\n", list("\n", list(), #> " The type of one-sided formulas is \"quote\".\n", #> list(), " The type of character vectors of length 1 is \"string\".\n", #> list(), " The type of special and builtin functions is \"primitive\".\n"), #> "\n"), "\n", list(list("Life cycle"), list( #> "\n", "\n", "\n", list("type_of()"), " is an experimental function. Expect API changes.\n")), #> "\n", "\n", list("\n", "type_of(10L)\n", "\n", #> "# Quosures are treated as a new base type but not formulas:\n", #> "type_of(quo(10L))\n", "type_of(~10L)\n", "\n", #> "# Compare to base::typeof():\n", "typeof(quo(10L))\n", #> "\n", "# Strings are treated as a new base type:\n", #> "type_of(letters)\n", "type_of(letters[[1]])\n", #> "\n", "# This is a bit inconsistent with the core language tenet that data\n", #> "# types are vectors. However, treating strings as a different\n", #> "# scalar type is quite helpful for switching on function inputs\n", #> "# since so many arguments expect strings:\n", #> "switch_type(\"foo\", character = abort(\"vector!\"), string = \"result\")\n", #> "\n", "# Special and builtin primitives are both treated as primitives.\n", #> "# That's because it is often irrelevant which type of primitive an\n", #> "# input is:\n", "typeof(list)\n", "typeof(`$`)\n", #> "type_of(list)\n", "type_of(`$`)\n"), "\n", #> list("internal"), "\n"), vec_poke_n.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec.R", #> "\n", list("vec_poke_n"), "\n", list("vec_poke_n"), #> "\n", list("vec_poke_range"), "\n", list("Poke values into a vector"), #> "\n", list("\n", "vec_poke_n(x, start, y, from = 1L, n = length(y))\n", #> "\n", "vec_poke_range(x, start, y, from = 1L, to = length(y) - from + 1L)\n"), #> "\n", list("\n", list(list("x"), list("The destination vector.")), #> "\n", "\n", list(list("start"), list("The index indicating where to start modifying ", #> list("x"), ".")), "\n", "\n", list(list("y"), #> list("The source vector.")), "\n", "\n", #> list(list("from"), list("The index indicating where to start copying from ", #> list("y"), ".")), "\n", "\n", list(list("n"), #> list("How many elements should be copied from ", #> list("y"), " to ", list("x"), ".")), "\n", #> "\n", list(list("to"), list("The index indicating the end of the range to copy from ", #> list("y"), ".")), "\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "These tools are for R experts only. They copy elements from ", #> list("y"), "\n", "into ", list("x"), " by mutation. You should only do this if you own ", #> list("x"), ",\n", "i.e. if you have created it or if you are certain that it doesn't\n", #> "exist in any other context. Otherwise you might create unintended\n", #> "side effects that have undefined consequences.\n"), #> "\n", list("internal"), "\n"), `vector-coercion.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("vector-coercion"), "\n", list("vector-coercion"), #> "\n", list("as_logical"), "\n", list("as_integer"), #> "\n", list("as_double"), "\n", list("as_complex"), #> "\n", list("as_character"), "\n", list("as_list"), #> "\n", list("Coerce an object to a base type"), #> "\n", list("\n", "as_logical(x)\n", "\n", "as_integer(x)\n", #> "\n", "as_double(x)\n", "\n", "as_complex(x)\n", #> "\n", "as_character(x, encoding = NULL)\n", #> "\n", "as_list(x)\n"), "\n", list("\n", list( #> list("x"), list("An object to coerce to a base type.")), #> "\n", "\n", list(list("encoding"), list("If non-null, set an encoding mark. This is only\n", #> "declarative, no encoding conversion is performed.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", "\n", "These are equivalent to the base functions (e.g. ", #> list(list("as.logical()")), ",\n", list(list( #> "as.list()")), ", etc), but perform coercion rather than conversion.\n", #> "This means they are not generic and will not call S3 conversion\n", #> "methods. They only attempt to coerce the base type of their\n", #> "input. In addition, they have stricter implicit coercion rules and\n", #> "will never attempt any kind of parsing. E.g. they will not try to\n", #> "figure out if a character vector represents integers or booleans.\n", #> "Finally, they treat attributes consistently, unlike the base R\n", #> "functions: all attributes except names are removed.\n"), #> "\n", list(list("Lifecycle"), list("\n", "\n", #> "\n", "These functions are deprecated in favour of ", #> list("vctrs::vec_cast()"), ".\n")), "\n", "\n", #> list(list("Coercion to logical and numeric atomic vectors"), #> list("\n", "\n", list("\n", list(), " To logical vectors: Integer and integerish double vectors. See\n", #> list(list("is_integerish()")), ".\n", list(), #> " To integer vectors: Logical and integerish double vectors.\n", #> list(), " To double vectors: Logical and integer vectors.\n", #> list(), " To complex vectors: Logical, integer and double vectors.\n"), #> "\n")), "\n", "\n", list(list("Coercion to character vectors"), #> list("\n", "\n", "\n", list("as_character()"), #> " and ", list("as_string()"), " have an optional ", #> list("encoding"), "\n", "argument to specify the encoding. R uses this information for\n", #> "internal handling of strings and character vectors. Note that this\n", #> "is only declarative, no encoding conversion is attempted.\n", #> "\n", "Note that only ", list("as_string()"), #> " can coerce symbols to a scalar\n", "character vector. This makes the code more explicit and adds an\n", #> "extra type check.\n")), "\n", "\n", list( #> list("Coercion to lists"), list("\n", "\n", #> "\n", list("as_list()"), " only coerces vector and dictionary types (environments\n", #> "are an example of dictionary type). Unlike ", #> list(list("base::as.list()")), ",\n", list( #> "as_list()"), " removes all attributes except names.\n")), #> "\n", "\n", list(list("Effects of removing attributes"), #> list("\n", "\n", "\n", "A technical side-effect of removing the attributes of the input is\n", #> "that the underlying objects has to be copied. This has no\n", #> "performance implications in the case of lists because this is a\n", #> "shallow copy: only the list structure is copied, not the contents\n", #> "(see ", list(list("duplicate()")), "). However, be aware that atomic vectors\n", #> "containing large amounts of data will have to be copied.\n", #> "\n", "In general, any attribute modification creates a copy, which is why\n", #> "it is better to avoid using attributes with heavy atomic vectors.\n", #> "Uncopyable objects like environments and symbols are an exception\n", #> "to this rule: in this case, attributes modification happens in\n", #> "place and has side-effects.\n")), "\n", #> "\n", list("\n", "# Coercing atomic vectors removes attributes with both base R and rlang:\n", #> "x <- structure(TRUE, class = \"foo\", bar = \"baz\")\n", #> "as.logical(x)\n", "\n", "# But coercing lists preserves attributes in base R but not rlang:\n", #> "l <- structure(list(TRUE), class = \"foo\", bar = \"baz\")\n", #> "as.list(l)\n", "as_list(l)\n", "\n", "# Implicit conversions are performed in base R but not rlang:\n", #> "as.logical(l)\n", list("\n", "as_logical(l)\n"), #> "\n", "\n", "# Conversion methods are bypassed, making the result of the\n", #> "# coercion more predictable:\n", "as.list.foo <- function(x) \"wrong\"\n", #> "as.list(l)\n", "as_list(l)\n", "\n", "# The input is never parsed. E.g. character vectors of numbers are\n", #> "# not converted to numeric types:\n", "as.integer(\"33\")\n", #> list("\n", "as_integer(\"33\")\n"), "\n", "\n", #> "\n", "# With base R tools there is no way to convert an environment to a\n", #> "# list without either triggering method dispatch, or changing the\n", #> "# original environment. as_list() makes it easy:\n", #> "x <- structure(as_environment(mtcars[1:2]), class = \"foobar\")\n", #> "as.list.foobar <- function(x) abort(\"dont call me\")\n", #> "as_list(x)\n"), "\n", list("internal"), "\n"), #> `vector-construction.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-new.R", #> "\n", list("vector-construction"), "\n", list( #> "vector-construction"), "\n", list("lgl"), #> "\n", list("int"), "\n", list("dbl"), "\n", list( #> "cpl"), "\n", list("chr"), "\n", list("bytes"), #> "\n", list("Create vectors"), "\n", list("\n", #> "lgl(...)\n", "\n", "int(...)\n", "\n", "dbl(...)\n", #> "\n", "cpl(...)\n", "\n", "chr(...)\n", "\n", #> "bytes(...)\n"), "\n", list("\n", list(list( #> "..."), list("Components of the new vector. Bare lists and explicitly\n", #> "spliced lists are spliced.")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "The atomic vector constructors are equivalent to ", #> list(list("c()")), " but:\n", list("\n", list(), #> " They allow you to be more explicit about the output\n", #> "type. Implicit coercions (e.g. from integer to logical) follow\n", #> "the rules described in ", list("vector-coercion"), #> ".\n", list(), " They use ", list("dynamic dots"), #> ".\n"), "\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", list("\n", list(), " All the abbreviated constructors such as ", #> list("lgl()"), " will probably be\n", "moved to the vctrs package at some point. This is why they are\n", #> "marked as questioning.\n", list(), " Automatic splicing is soft-deprecated and will trigger a warning\n", #> "in a future version. Please splice explicitly with ", #> list("!!!"), ".\n"), "\n")), "\n", "\n", #> list("\n", "# These constructors are like a typed version of c():\n", #> "c(TRUE, FALSE)\n", "lgl(TRUE, FALSE)\n", "\n", #> "# They follow a restricted set of coercion rules:\n", #> "int(TRUE, FALSE, 20)\n", "\n", "# Lists can be spliced:\n", #> "dbl(10, !!! list(1, 2L), TRUE)\n", "\n", "\n", #> "# They splice names a bit differently than c(). The latter\n", #> "# automatically composes inner and outer names:\n", #> "c(a = c(A = 10), b = c(B = 20, C = 30))\n", #> "\n", "# On the other hand, rlang's ctors use the inner names and issue a\n", #> "# warning to inform the user that the outer names are ignored:\n", #> "dbl(a = c(A = 10), b = c(B = 20, C = 30))\n", #> "dbl(a = c(1, 2))\n", "\n", "# As an exception, it is allowed to provide an outer name when the\n", #> "# inner vector is an unnamed scalar atomic:\n", #> "dbl(a = 1)\n", "\n", "# Spliced lists behave the same way:\n", #> "dbl(!!! list(a = 1))\n", "dbl(!!! list(a = c(A = 1)))\n", #> "\n", "# bytes() accepts integerish inputs\n", #> "bytes(1:10)\n", "bytes(0x01, 0xff, c(0x03, 0x05), list(10, 20, 30L))\n"), #> "\n"), `vector-old-ctors.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("node"), "\n", list("node"), "\n", #> list("vector-old-ctors"), "\n", list("lgl_len"), #> "\n", list("int_len"), "\n", list("dbl_len"), #> "\n", list("chr_len"), "\n", list("cpl_len"), #> "\n", list("raw_len"), "\n", list("bytes_len"), #> "\n", list("list_len"), "\n", list("lgl_along"), #> "\n", list("int_along"), "\n", list("dbl_along"), #> "\n", list("chr_along"), "\n", list("cpl_along"), #> "\n", list("raw_along"), "\n", list("bytes_along"), #> "\n", list("list_along"), "\n", list("Retired vector construction by length"), #> "\n", list("\n", "node(car, cdr = NULL)\n", "\n", #> "lgl_len(.n)\n", "\n", "int_len(.n)\n", "\n", #> "dbl_len(.n)\n", "\n", "chr_len(.n)\n", "\n", #> "cpl_len(.n)\n", "\n", "raw_len(.n)\n", "\n", #> "bytes_len(.n)\n", "\n", "list_len(.n)\n", #> "\n", "lgl_along(.x)\n", "\n", "int_along(.x)\n", #> "\n", "dbl_along(.x)\n", "\n", "chr_along(.x)\n", #> "\n", "cpl_along(.x)\n", "\n", "raw_along(.x)\n", #> "\n", "bytes_along(.x)\n", "\n", "list_along(.x)\n"), #> "\n", list("\n", list(list(".n"), list("The vector length.")), #> "\n", "\n", list(list(".x"), list("A vector.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions were deprecated and renamed with ", #> list("new_"), " prefix in\n", "rlang 0.2.0. This is for consistency with other non-variadic object\n", #> "constructors.\n"), "\n", list("internal"), #> "\n"), with_abort.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-entrace.R", #> "\n", list("with_abort"), "\n", list("with_abort"), #> "\n", list("Promote all errors to rlang errors"), #> "\n", list("\n", "with_abort(expr, classes = \"error\")\n"), #> "\n", list("\n", list(list("expr"), list("An expression run in a context where errors are\n", #> "promoted to rlang errors.")), "\n", "\n", #> list(list("classes"), list("Character vector of condition classes that should be\n", #> "promoted to rlang errors.")), "\n"), "\n", #> list("\n", list("with_abort()"), " promotes conditions as if they were thrown with\n", #> list(list("abort()")), ". These errors embed a ", #> list("backtrace"), ". They are\n", "particularly suitable to be set as ", #> list("parent errors"), " (see ", list("parent"), #> "\n", "argument of ", list(list("abort()")), #> ").\n"), "\n", list("\n", list("with_abort()"), #> " installs a ", list("calling handler"), " for errors and\n", #> "rethrows non-rlang errors with ", list(list( #> "abort()")), ". However, error handlers\n", #> "installed ", list("within"), " ", list("with_abort()"), #> " have priority. For this reason,\n", "you should use ", #> list(list("tryCatch()")), " and ", list("exiting"), #> " handlers outside\n", list("with_abort()"), #> " rather than inside.\n"), "\n", list("\n", #> "# with_abort() automatically casts simple errors thrown by stop()\n", #> "# to rlang errors. It is is handy for rethrowing low level\n", #> "# errors. The backtraces are then segmented between the low level\n", #> "# and high level contexts.\n", "f <- function() g()\n", #> "g <- function() stop(\"Low level error\")\n", #> "\n", "high_level <- function() {\n", " with_handlers(\n", #> " with_abort(f()),\n", " error = ~ abort(\"High level error\", parent = .)\n", #> " )\n", "}\n"), "\n"), with_env.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval.R", #> "\n", list("with_env"), "\n", list("with_env"), #> "\n", list("locally"), "\n", list("Evaluate an expression within a given environment"), #> "\n", list("\n", "with_env(env, expr)\n", "\n", #> "locally(expr)\n"), "\n", list("\n", list(list( #> "env"), list("An environment within which to evaluate ", #> list("expr"), ". Can be\n", "an object with a ", #> list(list("get_env()")), " method.")), "\n", #> "\n", list(list("expr"), list("An expression to evaluate.")), #> "\n"), "\n", list("\n", "These functions evaluate ", #> list("expr"), " within a given environment (", #> list("env"), "\n", "for ", list("with_env()"), #> ", or the child of the current environment for\n", #> list("locally"), "). They rely on ", list(list( #> "eval_bare()")), " which features a lighter\n", #> "evaluation mechanism than base R ", list(list( #> "base::eval()")), ", and which also has\n", #> "some subtle implications when evaluting stack sensitive functions\n", #> "(see help for ", list(list("eval_bare()")), #> ").\n"), "\n", list("\n", list("locally()"), #> " is equivalent to the base function\n", list( #> list("base::local()")), " but it produces a much cleaner\n", #> "evaluation stack, and has stack-consistent semantics. It is thus\n", #> "more suited for experimenting with the R language.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "These functions are experimental. Expect API changes.\n")), #> "\n", "\n", list("\n", "# with_env() is handy to create formulas with a given environment:\n", #> "env <- child_env(\"rlang\")\n", "f <- with_env(env, ~new_formula())\n", #> "identical(f_env(f), env)\n", "\n", "# Or functions with a given enclosure:\n", #> "fn <- with_env(env, function() NULL)\n", "identical(get_env(fn), env)\n", #> "\n", "\n", "# Unlike eval() it doesn't create duplicates on the evaluation\n", #> "# stack. You can thus use it e.g. to create non-local returns:\n", #> "fn <- function() {\n", " g(current_env())\n", #> " \"normal return\"\n", "}\n", "g <- function(env) {\n", #> " with_env(env, return(\"early return\"))\n", #> "}\n", "fn()\n", "\n", "\n", "# Since env is passed to as_environment(), it can be any object with an\n", #> "# as_environment() method. For strings, the pkg_env() is returned:\n", #> "with_env(\"base\", ~mtcars)\n", "\n", "# This can be handy to put dictionaries in scope:\n", #> "with_env(mtcars, cyl)\n"), "\n", list("internal"), #> "\n"), with_handlers.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-handlers.R", #> "\n", list("with_handlers"), "\n", list("with_handlers"), #> "\n", list("calling"), "\n", list("Establish handlers on the stack"), #> "\n", list("\n", "with_handlers(.expr, ...)\n", #> "\n", "calling(handler)\n"), "\n", list("\n", #> list(list(".expr"), list("An expression to execute in a context where new\n", #> "handlers are established. The underscored version takes a quoted\n", #> "expression or a quoted formula.")), "\n", #> "\n", list(list("..."), list("<", list("dynamic"), #> "> Named handlers. These should be\n", "functions of one argument, or ", #> list("formula functions"), ".\n", "The handlers are considered exiting by default, use ", #> list(list("calling()")), "\n", "to specify a calling handler.")), #> "\n", "\n", list(list("handler"), list("A handler function that takes a condition as\n", #> "argument. This is passed to ", list(list( #> "as_function()")), " and can thus be a\n", #> "formula describing a lambda function.")), #> "\n"), "\n", list("\n", "Condition handlers are functions established on the evaluation\n", #> "stack (see ", list(list("ctxt_stack()")), #> ") that are called by R when a condition is\n", #> "signalled (see ", list(list("cnd_signal()")), #> " and ", list(list("abort()")), " for two common signal\n", #> "functions). They come in two types:\n", list( #> "\n", list(), " Exiting handlers aborts all code currently run between\n", #> list("with_handlers()"), " and the point where the condition has been\n", #> "raised. ", list("with_handlers()"), " passes the return value of the handler\n", #> "to its caller.\n", list(), " Calling handlers, which are executed from inside the signalling\n", #> "functions. Their return values are ignored, only their side\n", #> "effects matters. Valid side effects are writing a log message, or\n", #> "jumping out of the signalling context by ", #> list("invoking a restart"), " or using ", #> list(list("return_from()")), ". If the raised\n", #> "condition was an error, this interrupts the aborting process.\n", #> "\n", "If a calling handler returns normally, it effectively declines to\n", #> "handle the condition and other handlers on the stack (calling or\n", #> "exiting) are given a chance to handle the condition.\n"), #> "\n", "\n", "Handlers are exiting by default, use ", #> list(list("calling()")), " to create a\n", #> "calling handler.\n"), "\n", list(list("Life cycle"), #> list("\n", " ", list("exiting()"), " is soft-deprecated as of rlang\n", #> "0.4.0 because ", list(list("with_handlers()")), #> " now treats handlers as exiting by\n", "default.\n")), #> "\n", "\n", list("\n", "# Signal a condition with signal():\n", #> "fn <- function() {\n", " g()\n", " cat(\"called?\\n\")\n", #> " \"fn() return value\"\n", "}\n", "g <- function() {\n", #> " h()\n", " cat(\"called?\\n\")\n", "}\n", #> "h <- function() {\n", " signal(\"A foobar condition occurred\", \"foo\")\n", #> " cat(\"called?\\n\")\n", "}\n", "\n", "# Exiting handlers jump to with_handlers() before being\n", #> "# executed. Their return value is handed over:\n", #> "handler <- function(c) \"handler return value\"\n", #> "with_handlers(fn(), foo = handler)\n", "\n", #> "# Calling handlers are called in turn and their return value is\n", #> "# ignored. Returning just means they are declining to take charge of\n", #> "# the condition. However, they can produce side-effects such as\n", #> "# displaying a message:\n", "some_handler <- function(c) cat(\"some handler!\\n\")\n", #> "other_handler <- function(c) cat(\"other handler!\\n\")\n", #> "with_handlers(fn(), foo = calling(some_handler), foo = calling(other_handler))\n", #> "\n", "# If a calling handler jumps to an earlier context, it takes\n", #> "# charge of the condition and no other handler gets a chance to\n", #> "# deal with it. The canonical way of transferring control is by\n", #> "# jumping to a restart. See with_restarts() and restarting()\n", #> "# documentation for more on this:\n", "exiting_handler <- function(c) rst_jump(\"rst_foo\")\n", #> "fn2 <- function() {\n", " with_restarts(g(), rst_foo = function() \"restart value\")\n", #> "}\n", "with_handlers(fn2(), foo = calling(exiting_handler), foo = calling(other_handler))\n"), #> "\n"), with_restarts.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-restarts.R", #> "\n", list("with_restarts"), "\n", list("with_restarts"), #> "\n", list("Establish a restart point on the stack"), #> "\n", list("\n", "with_restarts(.expr, ...)\n"), #> "\n", list("\n", list(list(".expr"), list("An expression to execute with new restarts established\n", #> "on the stack. This argument is passed by expression and supports\n", #> list("unquoting"), ". It is evaluated in a context where\n", #> "restarts are established.")), "\n", "\n", #> list(list("..."), list("<", list("dynamic"), #> "> Named restart functions. The\n", "name is taken as the restart name and the function is executed\n", #> "after the jump.")), "\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "Restart points are named functions that are established with\n", #> list("with_restarts()"), ". Once established, you can interrupt the normal\n", #> "execution of R code, jump to the restart, and resume execution from\n", #> "there. Each restart is established along with a restart function\n", #> "that is executed after the jump and that provides a return value\n", #> "from the establishing point (i.e., a return value for\n", #> list("with_restarts()"), ").\n"), "\n", list( #> "\n", "Restarts are not the only way of jumping to a previous call frame\n", #> "(see ", list(list("return_from()")), " or ", #> list(list("return_to()")), "). However, they have the\n", #> "advantage of being callable by name once established.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "All the restart functions are in the questioning stage. It is not\n", #> "clear yet whether we want to recommend restarts as a style of\n", #> "programming in R.\n")), "\n", "\n", list("\n", #> "# Restarts are not the only way to jump to a previous frame, but\n", #> "# they have the advantage of being callable by name:\n", #> "fn <- function() with_restarts(g(), my_restart = function() \"returned\")\n", #> "g <- function() h()\n", "h <- function() { rst_jump(\"my_restart\"); \"not returned\" }\n", #> "fn()\n", "\n", "# Whereas a non-local return requires to manually pass the calling\n", #> "# frame to the return function:\n", "fn <- function() g(current_env())\n", #> "g <- function(env) h(env)\n", "h <- function(env) { return_from(env, \"returned\"); \"not returned\" }\n", #> "fn()\n", "\n", "\n", "# rst_maybe_jump() checks that a restart exists before trying to jump:\n", #> "fn <- function() {\n", " g()\n", " cat(\"will this be called?\\n\")\n", #> "}\n", "g <- function() {\n", " rst_maybe_jump(\"my_restart\")\n", #> " cat(\"will this be called?\\n\")\n", "}\n", #> "\n", "# Here no restart are on the stack:\n", #> "fn()\n", "\n", "# If a restart point called `my_restart` was established on the\n", #> "# stack before calling fn(), the control flow will jump there:\n", #> "rst <- function() {\n", " cat(\"restarting...\\n\")\n", #> " \"return value\"\n", "}\n", "with_restarts(fn(), my_restart = rst)\n", #> "\n", "\n", "# Restarts are particularly useful to provide alternative default\n", #> "# values when the normal output cannot be computed:\n", #> "\n", "fn <- function(valid_input) {\n", " if (valid_input) {\n", #> " return(\"normal value\")\n", " }\n", #> "\n", " # We decide to return the empty string \"\" as default value. An\n", #> " # altenative strategy would be to signal an error. In any case,\n", #> " # we want to provide a way for the caller to get a different\n", #> " # output. For this purpose, we provide two restart functions that\n", #> " # returns alternative defaults:\n", " restarts <- list(\n", #> " rst_empty_chr = function() character(0),\n", #> " rst_null = function() NULL\n", " )\n", #> "\n", " with_restarts(splice(restarts), .expr = {\n", #> "\n", " # Signal a typed condition to let the caller know that we are\n", #> " # about to return an empty string as default value:\n", #> " cnd_signal(\"default_empty_string\")\n", #> "\n", " # If no jump to with_restarts, return default value:\n", #> " \"\"\n", " })\n", "}\n", "\n", "# Normal value for valid input:\n", #> "fn(TRUE)\n", "\n", "# Default value for bad input:\n", #> "fn(FALSE)\n", "\n", "# Change the default value if you need an empty character vector by\n", #> "# defining a calling handler that jumps to the restart. It has to\n", #> "# be calling because exiting handlers jump to the place where they\n", #> "# are established before being executed, and the restart is not\n", #> "# defined anymore at that point:\n", "rst_handler <- calling(function(c) rst_jump(\"rst_empty_chr\"))\n", #> "with_handlers(fn(FALSE), default_empty_string = rst_handler)\n", #> "\n", "# You can use restarting() to create restarting handlers easily:\n", #> "with_handlers(fn(FALSE), default_empty_string = restarting(\"rst_null\"))\n"), #> "\n", list("\n", list(list("return_from()")), #> " and ", list(list("return_to()")), " for a more flexible way\n", #> "of performing a non-local jump to an arbitrary call frame.\n"), #> "\n", list("internal"), "\n"), wref_key.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/weakref.R", #> "\n", list("wref_key"), "\n", list("wref_key"), #> "\n", list("wref_value"), "\n", list("Get key/value from a weak reference object"), #> "\n", list("\n", "wref_key(x)\n", "\n", "wref_value(x)\n"), #> "\n", list("\n", list(list("x"), list("A weak reference object.")), #> "\n"), "\n", list("\n", "Get key/value from a weak reference object\n"), #> "\n", list("\n", list(list("is_weakref()")), #> " and ", list(list("new_weakref()")), ".\n"), #> "\n"), zap.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/s3.R", #> "\n", list("zap"), "\n", list("zap"), "\n", list( #> "is_zap"), "\n", list("Create zap objects"), #> "\n", list("\n", "zap()\n", "\n", "is_zap(x)\n"), #> "\n", list("\n", list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", list("zap()"), " creates a sentinel object that indicates that an object\n", #> "should be removed. For instance, named zaps instruct ", #> list(list("env_bind()")), "\n", "and ", list( #> list("call_modify()")), " to remove those objects from the environment or\n", #> "the call.\n", "\n", "The advantage of zap objects is that they unambiguously signal the\n", #> "intent of removing an object. Sentinels like ", #> list("NULL"), " or\n", list(list("missing_arg()")), #> " are ambiguous because they represent valid R\n", #> "objects.\n"), "\n", list("\n", "# Create one zap object:\n", #> "zap()\n", "\n", "# Create a list of zaps:\n", #> "rep(list(zap()), 3)\n", "rep_named(c(\"foo\", \"bar\"), list(zap()))\n"), #> "\n"), zap_srcref.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("zap_srcref"), "\n", list("zap_srcref"), #> "\n", list("Zap source references"), "\n", list( #> "\n", "zap_srcref(x)\n"), "\n", list("\n", #> list(list("x"), list("An R object. Functions and calls are walked recursively.")), #> "\n"), "\n", list("\n", "There are a number of situations where R creates source references:\n", #> list("\n", list(), " Reading R code from a file with ", #> list("source()"), " and ", list("parse()"), #> " might save\n", "source references inside calls to ", #> list("function"), " and ", list("{"), ".\n", #> list(), " ", list(list("sys.call()")), " includes a source reference if possible.\n", #> list(), " Creating a closure stores the source reference from the call to\n", #> list("function"), ", if any.\n"), "\n", "\n", #> "These source references take up space and might cause a number of\n", #> "issues. ", list("zap_srcref()"), " recursively walks through expressions and\n", #> "functions to remove all source references.\n"), #> "\n")), source = list(abort.Rd = c("R/cnd-abort.R", #> "R/cnd-signal.R"), are_na.Rd = "R/vec-na.R", arg_match.Rd = "R/arg.R", #> as_box.Rd = "R/s3.R", as_bytes.Rd = "R/utils-encoding.R", #> as_data_mask.Rd = "R/eval-tidy.R", as_env.Rd = "R/lifecycle-retired.R", #> as_environment.Rd = "R/env.R", as_function.Rd = "R/fn.R", #> as_label.Rd = "R/deparse.R", as_name.Rd = "R/deparse.R", #> as_overscope.Rd = "R/lifecycle-retired.R", as_pairlist.Rd = "R/node.R", #> as_quosure.Rd = "R/quo.R", as_string.Rd = "R/sym.R", #> as_utf8_character.Rd = "R/utils-encoding.R", `bare-type-predicates.Rd` = "R/types.R", #> box.Rd = "R/s3.R", call2.Rd = "R/call.R", call_args.Rd = "R/call.R", #> call_fn.Rd = "R/call.R", call_inspect.Rd = "R/stack.R", #> call_modify.Rd = "R/call.R", call_name.Rd = "R/call.R", #> call_parse_type.Rd = "R/call.R", call_standardise.Rd = "R/call.R", #> caller_env.Rd = "R/env-special.R", caller_fn.Rd = "R/stack.R", #> caller_frame.Rd = "R/lifecycle-retired.R", catch_cnd.Rd = "R/cnd-handlers.R", #> chr_unserialise_unicode.Rd = "R/utils-encoding.R", #> cnd.Rd = c("R/cnd-error.R", "R/cnd.R"), cnd_message.Rd = "R/cnd-message.R", #> cnd_muffle.Rd = "R/cnd-handlers.R", cnd_signal.Rd = "R/cnd-signal.R", #> cnd_type.Rd = "R/cnd.R", done.Rd = "R/s3.R", dots_definitions.Rd = "R/dots.R", #> dots_n.Rd = "R/dots.R", dots_values.Rd = "R/dots.R", #> duplicate.Rd = "R/sexp.R", `dyn-dots.Rd` = "R/dots.R", #> empty_env.Rd = "R/env-special.R", enquo0.Rd = "R/nse-defuse.R", #> entrace.Rd = "R/cnd-entrace.R", env.Rd = "R/env.R", #> env_bind.Rd = "R/env-binding.R", env_bind_exprs.Rd = "R/lifecycle-retired.R", #> env_binding_are_active.Rd = "R/env-binding.R", env_binding_lock.Rd = "R/env-binding.R", #> env_browse.Rd = "R/env.R", env_bury.Rd = "R/lifecycle-retired.R", #> env_clone.Rd = "R/env.R", env_depth.Rd = "R/env.R", #> env_get.Rd = "R/env-binding.R", env_has.Rd = "R/env-binding.R", #> env_inherits.Rd = "R/env.R", env_lock.Rd = "R/env.R", #> env_name.Rd = "R/env-special.R", env_names.Rd = "R/env-binding.R", #> env_parent.Rd = "R/env.R", env_poke.Rd = "R/env-binding.R", #> env_print.Rd = "R/env.R", env_unbind.Rd = "R/env-binding.R", #> env_unlock.Rd = "R/env.R", eval_bare.Rd = "R/eval.R", #> eval_tidy.Rd = "R/eval-tidy.R", exec.Rd = "R/eval.R", #> exiting.Rd = "R/lifecycle-retired.R", expr_interp.Rd = "R/nse-force.R", #> expr_label.Rd = "R/expr.R", expr_print.Rd = "R/expr.R", #> exprs_auto_name.Rd = "R/nse-defuse.R", f_rhs.Rd = "R/formula.R", #> f_text.Rd = "R/formula.R", `faq-options.Rd` = "R/faq.R", #> flatten.Rd = "R/vec-squash.R", fn_body.Rd = "R/fn.R", #> fn_env.Rd = "R/fn.R", fn_fmls.Rd = "R/fn.R", format_error_bullets.Rd = "R/cnd-message.R", #> frame_position.Rd = "R/lifecycle-retired.R", friendly_type.Rd = "R/types.R", #> get_env.Rd = "R/env.R", has_length.Rd = "R/attr.R", #> has_name.Rd = "R/attr.R", hash.Rd = "R/hash.R", inherits_any.Rd = "R/s3.R", #> inject.Rd = "R/eval.R", invoke.Rd = "R/eval.R", is_call.Rd = "R/call.R", #> is_callable.Rd = "R/call.R", is_condition.Rd = "R/cnd.R", #> is_copyable.Rd = "R/types.R", is_empty.Rd = "R/types.R", #> is_env.Rd = "R/lifecycle-retired.R", is_environment.Rd = "R/types.R", #> is_expr.Rd = "R/lifecycle-retired.R", is_expression.Rd = "R/expr.R", #> is_formula.Rd = "R/formula.R", is_frame.Rd = "R/lifecycle-retired.R", #> is_function.Rd = "R/fn.R", is_installed.Rd = "R/env-special.R", #> is_integerish.Rd = "R/types.R", is_interactive.Rd = "R/state.R", #> is_lang.Rd = "R/lifecycle-retired.R", is_named.Rd = "R/attr.R", #> is_namespace.Rd = "R/env-special.R", is_pairlist.Rd = "R/node.R", #> is_reference.Rd = "R/types.R", is_stack.Rd = "R/lifecycle-retired.R", #> is_symbol.Rd = "R/sym.R", is_true.Rd = "R/types.R", #> is_weakref.Rd = "R/weakref.R", lang.Rd = "R/lifecycle-retired.R", #> lang_head.Rd = "R/lifecycle-retired.R", lang_modify.Rd = "R/lifecycle-retired.R", #> last_error.Rd = "R/cnd-abort.R", lifecycle.Rd = "R/lifecycle.R", #> list2.Rd = "R/dots.R", local_bindings.Rd = "R/env-binding.R", #> local_options.Rd = "R/state.R", missing.Rd = "R/vec-na.R", #> missing_arg.Rd = "R/arg.R", mut_node_car.Rd = "R/lifecycle-retired.R", #> names2.Rd = "R/attr.R", `new-vector-along-retired.Rd` = "R/lifecycle-retired.R", #> `new-vector.Rd` = "R/vec-new.R", new_call.Rd = "R/node.R", #> new_formula.Rd = "R/formula.R", new_function.Rd = "R/fn.R", #> new_node.Rd = "R/node.R", new_quosures.Rd = "R/quo.R", #> new_weakref.Rd = "R/weakref.R", ns_env.Rd = "R/env-special.R", #> `nse-defuse.Rd` = "R/nse-defuse.R", `nse-force.Rd` = "R/nse-force.R", #> `op-definition.Rd` = "R/operators.R", `op-get-attr.Rd` = "R/operators.R", #> `op-na-default.Rd` = "R/operators.R", `op-null-default.Rd` = "R/operators.R", #> overscope_eval_next.Rd = "R/lifecycle-retired.R", #> pairlist2.Rd = "R/call.R", parse_expr.Rd = "R/parse.R", #> parse_quosure.Rd = "R/lifecycle-retired.R", prepend.Rd = "R/lifecycle-retired.R", #> prim_name.Rd = "R/fn.R", quo_expr.Rd = "R/lifecycle-retired.R", #> quo_label.Rd = "R/quo.R", quo_squash.Rd = "R/quo.R", #> quosure.Rd = "R/quo.R", raw_deparse_str.Rd = "R/raw.R", #> rep_along.Rd = "R/vec-new.R", restarting.Rd = "R/cnd-handlers.R", #> return_from.Rd = "R/stack.R", rlang_backtrace_on_error.Rd = "R/cnd-abort.R", #> rst_abort.Rd = "R/cnd-restarts.R", rst_list.Rd = "R/cnd-restarts.R", #> `scalar-type-predicates.Rd` = "R/types.R", scoped_env.Rd = "R/lifecycle-retired.R", #> scoped_interactive.Rd = "R/lifecycle-retired.R", #> search_envs.Rd = "R/env-special.R", seq2.Rd = "R/vec.R", #> set_attrs.Rd = "R/lifecycle-retired.R", set_expr.Rd = "R/expr.R", #> set_names.Rd = "R/attr.R", splice.Rd = "R/dots.R", #> stack.Rd = "R/lifecycle-retired.R", stack_trim.Rd = "R/lifecycle-retired.R", #> string.Rd = "R/utils-encoding.R", switch_type.Rd = "R/lifecycle-retired.R", #> sym.Rd = "R/sym.R", `tidyeval-data.Rd` = "R/eval-tidy.R", #> trace_back.Rd = "R/trace.R", `type-predicates.Rd` = "R/types.R", #> type_of.Rd = "R/lifecycle-retired.R", vec_poke_n.Rd = "R/vec.R", #> `vector-coercion.Rd` = "R/lifecycle-retired.R", `vector-construction.Rd` = "R/vec-new.R", #> `vector-old-ctors.Rd` = "R/lifecycle-retired.R", #> with_abort.Rd = "R/cnd-entrace.R", with_env.Rd = "R/eval.R", #> with_handlers.Rd = "R/cnd-handlers.R", with_restarts.Rd = "R/cnd-restarts.R", #> wref_key.Rd = "R/weakref.R", zap.Rd = "R/s3.R", zap_srcref.Rd = "R/attr.R"), #> keywords = list(character(0), "internal", character(0), #> character(0), "internal", character(0), "internal", #> character(0), character(0), character(0), character(0), #> "internal", "internal", character(0), character(0), #> "internal", character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), "internal", character(0), character(0), #> "internal", "internal", character(0), "internal", #> "internal", character(0), "internal", character(0), #> "internal", character(0), "internal", "internal", #> "internal", "internal", character(0), character(0), #> character(0), character(0), character(0), character(0), #> "internal", "internal", "internal", character(0), #> "internal", character(0), character(0), character(0), #> character(0), character(0), "internal", character(0), #> character(0), character(0), character(0), character(0), #> character(0), "internal", character(0), character(0), #> character(0), "internal", character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), "internal", character(0), character(0), #> character(0), character(0), "internal", "internal", #> character(0), "internal", character(0), character(0), #> character(0), character(0), "internal", character(0), #> "internal", "internal", "internal", character(0), #> "internal", character(0), "internal", character(0), #> character(0), "internal", character(0), character(0), #> character(0), character(0), "internal", character(0), #> character(0), "internal", "internal", "internal", #> character(0), character(0), character(0), "internal", #> "internal", "internal", character(0), "internal", #> character(0), character(0), "experimental", c("datasets", #> "internal"), character(0), "internal", character(0), #> "internal", "internal", "internal", character(0), #> character(0), "internal", character(0), "experimental", #> "internal", character(0), character(0), "internal", #> character(0), character(0), character(0), "internal", #> character(0), character(0), "internal", "internal", #> "internal", "internal", character(0), character(0), #> character(0), character(0), character(0), "internal", #> "internal", character(0), "internal", "internal", #> character(0), "internal", character(0), "internal", #> character(0), "internal", character(0), character(0), #> "internal", "internal", "internal", "internal", "internal", #> character(0), "datasets", character(0), character(0), #> "internal", "internal", "internal", character(0), #> "internal", character(0), "internal", character(0), #> "internal", character(0), character(0), character(0)), #> concepts = list(character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0)), #> internal = c(FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, #> TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, #> FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, #> FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, #> TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, #> TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, #> TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, #> FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, #> TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, #> FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, #> FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, #> FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, #> TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, #> TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, #> TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, #> FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, #> FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, #> FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, #> FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, #> TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, #> TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, #> TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, #> FALSE, FALSE, FALSE)), tutorials = list(name = character(0), #> file_out = character(0), title = character(0), pagetitle = character(0), #> url = character(0)), vignettes = list(name = character(0), #> file_in = character(0), file_out = character(0), title = character(0), #> description = character(0)))), examples = base::quote(TRUE), #> run_dont_run = base::quote(FALSE), seed = base::quote(1014), #> lazy = base::quote(FALSE), override = base::quote(list()), #> install = base::quote(FALSE), preview = base::quote(FALSE), #> new_process = base::quote(FALSE), devel = base::quote(FALSE), #> crayon_enabled = base::quote(TRUE), crayon_colors = base::quote(256L), #> pkgdown_internet = base::quote(TRUE)) #> #> [[13]] #> pkgdown::build_site(...) #> #> [[14]] #> build_site_local( #> pkg = pkg, #> examples = examples, #> run_dont_run = run_dont_run, #> seed = seed, #> lazy = lazy, #> override = override, #> preview = preview, #> devel = devel #> ) #> #> [[15]] #> build_reference(pkg, #> lazy = lazy, #> examples = examples, #> run_dont_run = run_dont_run, #> seed = seed, #> override = override, #> preview = FALSE, #> devel = devel #> ) #> #> [[16]] #> purrr::map(topics, #> build_reference_topic, #> pkg = pkg, #> lazy = lazy, #> examples = examples, #> run_dont_run = run_dont_run #> ) #> #> [[17]] #> .Call(map_impl, environment(), ".x", ".f", "list") #> #> [[18]] #> data <- withCallingHandlers( #> data_reference_topic( #> topic, #> pkg, #> examples = examples, #> run_dont_run = run_dont_run #> ), #> error = function(err) { #> msg <- c( #> paste0("Failed to parse Rd in ", topic$file_in), #> i = err$message #> ) #> abort(msg, parent = err) #> } #> ) #> #> [[19]] #> data <- withCallingHandlers( #> data_reference_topic( #> topic, #> pkg, #> examples = examples, #> run_dont_run = run_dont_run #> ), #> error = function(err) { #> msg <- c( #> paste0("Failed to parse Rd in ", topic$file_in), #> i = err$message #> ) #> abort(msg, parent = err) #> } #> ) #> #> [[20]] #> out$examples <- run_examples( #> tags$tag_examples[[1]], #> env = new.env(parent = globalenv()), #> topic = tools::file_path_sans_ext(topic$file_in), #> run_examples = examples, #> run_dont_run = run_dont_run #> ) #> #> [[21]] #> highlight_examples(code, topic, env = env) #> #> [[22]] #> downlit::evaluate_and_highlight( #> code, #> fig_save = fig_save_topic, #> env = child_env(env) #> ) #> #> [[23]] #> expr <- evaluate::evaluate(code, child_env(env), new_device = TRUE, #> output_handler = output_handler) #> #> [[24]] #> out[[i]] <- evaluate_call( #> expr, parsed$src[[i]], #> envir = envir, enclos = enclos, debug = debug, last = i == length(out), #> use_try = stop_on_error != 2L, #> keep_warning = keep_warning, keep_message = keep_message, #> output_handler = output_handler, #> include_timing = include_timing) #> #> [[25]] #> time <- timing_fn(handle(ev <- withCallingHandlers( #> withVisible(eval(expr, envir, enclos)), #> warning = wHandler, error = eHandler, message = mHandler))) #> #> [[26]] #> time <- timing_fn(handle(ev <- withCallingHandlers( #> withVisible(eval(expr, envir, enclos)), #> warning = wHandler, error = eHandler, message = mHandler))) #> #> [[27]] #> handle <- function(f) try(f, silent = TRUE) #> #> [[28]] #> tryCatch(expr, error = function(e) { #> call <- conditionCall(e) #> if (!is.null(call)) { #> if (identical(call[[1L]], quote(doTryCatch))) #> call <- sys.call(-4L) #> dcall <- deparse(call)[1L] #> prefix <- paste("Error in", dcall, ": ") #> LONG <- 75L #> sm <- strsplit(conditionMessage(e), "\n")[[1L]] #> w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") #> if (is.na(w)) #> w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], #> type = "b") #> if (w > LONG) #> prefix <- paste0(prefix, "\n ") #> } #> else prefix <- "Error : " #> msg <- paste0(prefix, conditionMessage(e), "\n") #> .Internal(seterrmessage(msg[1L])) #> if (!silent && isTRUE(getOption("show.error.messages"))) { #> cat(msg, file = outFile) #> .Internal(printDeferredWarnings()) #> } #> invisible(structure(msg, class = "try-error", condition = e)) #> }) #> #> [[29]] #> tryCatchList(expr, classes, parentenv, handlers) #> #> [[30]] #> tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> #> [[31]] #> doTryCatch(return(expr), name, parentenv, handler) #> #> [[32]] #> time <- timing_fn(handle(ev <- withCallingHandlers( #> withVisible(eval(expr, envir, enclos)), #> warning = wHandler, error = eHandler, message = mHandler))) #> #> [[33]] #> time <- timing_fn(handle(ev <- withCallingHandlers( #> withVisible(eval(expr, envir, enclos)), #> warning = wHandler, error = eHandler, message = mHandler))) #> #> [[34]] #> time <- timing_fn(handle(ev <- withCallingHandlers( #> withVisible(eval(expr, envir, enclos)), #> warning = wHandler, error = eHandler, message = mHandler))) #> #> [[35]] #> eval(expr, envir, enclos) #> #> [[36]] #> invoke(fn, list(mtcars)) #> #> [[37]] #> .External2(rlang_ext2_eval, call, .env) #> # Compare to do.call(): do.call(call_inspect, mtcars) #> (function(...) match.call())(mpg = c(21, 21, 22.8, 21.4, 18.7, #> 18.1, 14.3, 24.4, 22.8, 19.2, 17.8, 16.4, 17.3, 15.2, 10.4, 10.4, #> 14.7, 32.4, 30.4, 33.9, 21.5, 15.5, 15.2, 13.3, 19.2, 27.3, 26, #> 30.4, 15.8, 19.7, 15, 21.4), cyl = c(6, 6, 4, 6, 8, 6, 8, 4, #> 4, 6, 6, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 8, 8, 8, 8, 4, 4, 4, 8, #> 6, 8, 4), disp = c(160, 160, 108, 258, 360, 225, 360, 146.7, #> 140.8, 167.6, 167.6, 275.8, 275.8, 275.8, 472, 460, 440, 78.7, #> 75.7, 71.1, 120.1, 318, 304, 350, 400, 79, 120.3, 95.1, 351, #> 145, 301, 121), hp = c(110, 110, 93, 110, 175, 105, 245, 62, #> 95, 123, 123, 180, 180, 180, 205, 215, 230, 66, 52, 65, 97, 150, #> 150, 245, 175, 66, 91, 113, 264, 175, 335, 109), drat = c(3.9, #> 3.9, 3.85, 3.08, 3.15, 2.76, 3.21, 3.69, 3.92, 3.92, 3.92, 3.07, #> 3.07, 3.07, 2.93, 3, 3.23, 4.08, 4.93, 4.22, 3.7, 2.76, 3.15, #> 3.73, 3.08, 4.08, 4.43, 3.77, 4.22, 3.62, 3.54, 4.11), wt = c(2.62, #> 2.875, 2.32, 3.215, 3.44, 3.46, 3.57, 3.19, 3.15, 3.44, 3.44, #> 4.07, 3.73, 3.78, 5.25, 5.424, 5.345, 2.2, 1.615, 1.835, 2.465, #> 3.52, 3.435, 3.84, 3.845, 1.935, 2.14, 1.513, 3.17, 2.77, 3.57, #> 2.78), qsec = c(16.46, 17.02, 18.61, 19.44, 17.02, 20.22, 15.84, #> 20, 22.9, 18.3, 18.9, 17.4, 17.6, 18, 17.98, 17.82, 17.42, 19.47, #> 18.52, 19.9, 20.01, 16.87, 17.3, 15.41, 17.05, 18.9, 16.7, 16.9, #> 14.5, 15.5, 14.6, 18.6), vs = c(0, 0, 1, 1, 0, 1, 0, 1, 1, 1, #> 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, #> 1), am = c(1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, #> 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1), gear = c(4, 4, #> 4, 3, 3, 3, 3, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 4, 4, 4, 3, 3, 3, #> 3, 3, 4, 5, 5, 5, 5, 5, 4), carb = c(4, 4, 1, 1, 2, 1, 4, 2, #> 2, 4, 4, 3, 3, 3, 4, 4, 4, 1, 2, 1, 1, 2, 2, 4, 2, 1, 2, 2, 4, #> 6, 8, 2)) do.call(fn, list(mtcars)) #> [[1]] #> tryCatch(withCallingHandlers({ #> NULL #> saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpVTMEEO/callr-fun-e127c12e3e3"), #> list(envir = .GlobalEnv, quote = TRUE)), envir = .GlobalEnv, #> quote = TRUE), file = "/tmp/RtmpVTMEEO/callr-res-e12216abce") #> flush(stdout()) #> flush(stderr()) #> NULL #> invisible() #> }, error = function(e) { #> { #> callr_data <- as.environment("tools:callr")$`__callr_data__` #> err <- callr_data$err #> assign(".Traceback", .traceback(4), envir = callr_data) #> dump.frames("__callr_dump__") #> assign(".Last.dump", .GlobalEnv$`__callr_dump__`, envir = callr_data) #> rm("__callr_dump__", envir = .GlobalEnv) #> e$call <- deparse(conditionCall(e), nlines = 6) #> e2 <- err$new_error(conditionMessage(e), call. = conditionCall(e)) #> class(e2) <- c("callr_remote_error", class(e2)) #> e2$error <- e #> calls <- sys.calls() #> dcframe <- which(vapply(calls, function(x) length(x) >= #> 1 && identical(x[[1]], quote(do.call)), logical(1)))[1] #> if (!is.na(dcframe)) #> e2$`_ignore` <- list(c(1, dcframe + 1L)) #> e2$`_pid` <- Sys.getpid() #> e2$`_timestamp` <- Sys.time() #> if (inherits(e, "rlib_error_2_0")) #> e2$parent <- e$parent #> e2 <- err$add_trace_back(e2, embed = FALSE) #> saveRDS(list("error", e2), file = paste0("/tmp/RtmpVTMEEO/callr-res-e12216abce", #> ".error")) #> } #> }, interrupt = function(e) { #> { #> callr_data <- as.environment("tools:callr")$`__callr_data__` #> err <- callr_data$err #> assign(".Traceback", .traceback(4), envir = callr_data) #> dump.frames("__callr_dump__") #> assign(".Last.dump", .GlobalEnv$`__callr_dump__`, envir = callr_data) #> rm("__callr_dump__", envir = .GlobalEnv) #> e$call <- deparse(conditionCall(e), nlines = 6) #> e2 <- err$new_error(conditionMessage(e), call. = conditionCall(e)) #> class(e2) <- c("callr_remote_error", class(e2)) #> e2$error <- e #> calls <- sys.calls() #> dcframe <- which(vapply(calls, function(x) length(x) >= #> 1 && identical(x[[1]], quote(do.call)), logical(1)))[1] #> if (!is.na(dcframe)) #> e2$`_ignore` <- list(c(1, dcframe + 1L)) #> e2$`_pid` <- Sys.getpid() #> e2$`_timestamp` <- Sys.time() #> if (inherits(e, "rlib_error_2_0")) #> e2$parent <- e$parent #> e2 <- err$add_trace_back(e2, embed = FALSE) #> saveRDS(list("error", e2), file = paste0("/tmp/RtmpVTMEEO/callr-res-e12216abce", #> ".error")) #> } #> }, callr_message = function(e) { #> try(signalCondition(e)) #> }), error = function(e) { #> NULL #> try(stop(e)) #> }, interrupt = function(e) { #> NULL #> e #> }) #> #> [[2]] #> tryCatchList(expr, classes, parentenv, handlers) #> #> [[3]] #> tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), #> names[nh], parentenv, handlers[[nh]]) #> #> [[4]] #> doTryCatch(return(expr), name, parentenv, handler) #> #> [[5]] #> tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) #> #> [[6]] #> tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> #> [[7]] #> doTryCatch(return(expr), name, parentenv, handler) #> #> [[8]] #> withCallingHandlers({ #> NULL #> saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpVTMEEO/callr-fun-e127c12e3e3"), #> list(envir = .GlobalEnv, quote = TRUE)), envir = .GlobalEnv, #> quote = TRUE), file = "/tmp/RtmpVTMEEO/callr-res-e12216abce") #> flush(stdout()) #> flush(stderr()) #> NULL #> invisible() #> }, error = function(e) { #> { #> callr_data <- as.environment("tools:callr")$`__callr_data__` #> err <- callr_data$err #> assign(".Traceback", .traceback(4), envir = callr_data) #> dump.frames("__callr_dump__") #> assign(".Last.dump", .GlobalEnv$`__callr_dump__`, envir = callr_data) #> rm("__callr_dump__", envir = .GlobalEnv) #> e$call <- deparse(conditionCall(e), nlines = 6) #> e2 <- err$new_error(conditionMessage(e), call. = conditionCall(e)) #> class(e2) <- c("callr_remote_error", class(e2)) #> e2$error <- e #> calls <- sys.calls() #> dcframe <- which(vapply(calls, function(x) length(x) >= #> 1 && identical(x[[1]], quote(do.call)), logical(1)))[1] #> if (!is.na(dcframe)) #> e2$`_ignore` <- list(c(1, dcframe + 1L)) #> e2$`_pid` <- Sys.getpid() #> e2$`_timestamp` <- Sys.time() #> if (inherits(e, "rlib_error_2_0")) #> e2$parent <- e$parent #> e2 <- err$add_trace_back(e2, embed = FALSE) #> saveRDS(list("error", e2), file = paste0("/tmp/RtmpVTMEEO/callr-res-e12216abce", #> ".error")) #> } #> }, interrupt = function(e) { #> { #> callr_data <- as.environment("tools:callr")$`__callr_data__` #> err <- callr_data$err #> assign(".Traceback", .traceback(4), envir = callr_data) #> dump.frames("__callr_dump__") #> assign(".Last.dump", .GlobalEnv$`__callr_dump__`, envir = callr_data) #> rm("__callr_dump__", envir = .GlobalEnv) #> e$call <- deparse(conditionCall(e), nlines = 6) #> e2 <- err$new_error(conditionMessage(e), call. = conditionCall(e)) #> class(e2) <- c("callr_remote_error", class(e2)) #> e2$error <- e #> calls <- sys.calls() #> dcframe <- which(vapply(calls, function(x) length(x) >= #> 1 && identical(x[[1]], quote(do.call)), logical(1)))[1] #> if (!is.na(dcframe)) #> e2$`_ignore` <- list(c(1, dcframe + 1L)) #> e2$`_pid` <- Sys.getpid() #> e2$`_timestamp` <- Sys.time() #> if (inherits(e, "rlib_error_2_0")) #> e2$parent <- e$parent #> e2 <- err$add_trace_back(e2, embed = FALSE) #> saveRDS(list("error", e2), file = paste0("/tmp/RtmpVTMEEO/callr-res-e12216abce", #> ".error")) #> } #> }, callr_message = function(e) { #> try(signalCondition(e)) #> }) #> #> [[9]] #> saveRDS(do.call(do.call, c(readRDS("/tmp/RtmpVTMEEO/callr-fun-e127c12e3e3"), #> list(envir = .GlobalEnv, quote = TRUE)), envir = .GlobalEnv, #> quote = TRUE), file = "/tmp/RtmpVTMEEO/callr-res-e12216abce") #> #> [[10]] #> do.call(do.call, c(readRDS("/tmp/RtmpVTMEEO/callr-fun-e127c12e3e3"), #> list(envir = .GlobalEnv, quote = TRUE)), envir = .GlobalEnv, #> quote = TRUE) #> #> [[11]] #> (function (what, args, quote = FALSE, envir = parent.frame()) #> { #> if (!is.list(args)) #> stop("second argument must be a list") #> if (quote) #> args <- lapply(args, enquote) #> .Internal(do.call(what, args, envir)) #> })(base::quote(function (..., crayon_enabled, crayon_colors, #> pkgdown_internet) #> { #> options(crayon.enabled = crayon_enabled, crayon.colors = crayon_colors, #> pkgdown.internet = pkgdown_internet) #> pkgdown::build_site(...) #> }), base::quote(list(pkg = list(package = "rlang", version = "0.4.12", #> src_path = "/tmp/RtmpVTMEEO/rlang-0.4.12", dst_path = "/tmp/RtmpVTMEEO/rlang-0.4.12/docs", #> install_metadata = FALSE, desc = <environment>, meta = list( #> url = "mpn.metworx.com/packages/rlang/0.4.12", home = list( #> links = list(list(text = "Programming with dplyr", #> href = "https://dplyr.tidyverse.org/articles/programming.html"), #> list(text = "Using ggplot2 in packages", href = "https://ggplot2.tidyverse.org/articles/ggplot2-in-packages.html"))), #> navbar = list(structure = list(left = c("home", "reference", #> "lifecycle", "news"), right = "github"), components = list( #> lifecycle = list(text = "Life cycle", href = "reference/lifecycle.html"), #> news = list(text = "News", menu = list(list(text = "Release notes"), #> list(text = "Version 0.4.3", href = "https://www.tidyverse.org/blog/2020/02/glue-strings-and-tidy-eval/"), #> list(text = "Version 0.4.0", href = "https://www.tidyverse.org/articles/2019/06/rlang-0-4-0/"), #> list(text = "Version 0.3.1", href = "https://www.tidyverse.org/articles/2019/01/rlang-0-3-1/"), #> list(text = "Version 0.3.0", href = "https://www.tidyverse.org/articles/2018/10/rlang-0-3-0/"), #> list(text = "Version 0.2.0", href = "https://www.tidyverse.org/articles/2018/03/rlang-0.2.0/"), #> list(text = "------------------"), list(text = "Change log", #> href = "news/index.html"))))), reference = list( #> list(title = "Tidy evaluation", desc = "Quote arguments and expressions with unquoting support. The quosure variants wrap an environment with the expression.\n", #> contents = c("quo", "quos", "enquo", "enquos", #> "expr", "exprs", "enexpr", "enexprs", "nse-force", #> "nse-defuse", "as_label", "as_name")), list(title = "Tidy dots", #> desc = "Collect arguments contained in `...` with `!!!` and name-unquoting support.\n", #> contents = c("dyn-dots", "list2", "dots_list", #> "pairlist2")), list(title = "Errors, conditions, and backtraces", #> contents = c("abort", "warn", "inform", "signal", #> "cnd_message", "format_error_bullets", "trace_back", #> "with_abort", "entrace", "cnd_signal", "last_error", #> "rlang_backtrace_on_error", "catch_cnd")), list( #> title = "Evaluate expressions", contents = c("eval_tidy", #> "eval_bare", "exec")), list(title = "Symbols", #> contents = c("sym", "syms", "is_symbol", "as_string" #> )), list(title = "Calls", contents = c("starts_with(\"call_\")", #> "call2", "is_call")), list(title = "Expressions", #> contents = c("starts_with(\"expr_\")", "starts_with(\"exprs_\")", #> "starts_with(\"parse_\")", "is_expression", "is_symbolic", #> "expr_text", "expr_label", "expr_name", "set_expr", #> "get_expr")), list(title = "Quosures", contents = c("starts_with(\"quo_\")", #> "new_quosure", "is_quosure", "as_quosure", "is_quosures", #> "quos_auto_name")), list(title = "Formulas", contents = c("starts_with(\"f_\")", #> "new_formula", "is_formula", "is_bare_formula")), #> list(title = "Functions", contents = c("starts_with(\"fn_\")", #> "new_function", "is_function", "is_closure", "is_primitive", #> "as_function", "as_closure")), list(title = "Environments", #> contents = c("env", "new_environment", "env_print", #> "env_parent", "env_tail", "env_parents", "env_depth", #> "get_env", "set_env", "env_clone", "env_inherits", #> "is_environment", "is_bare_environment", "as_environment", #> "caller_env")), list(title = "Environment bindings", #> contents = c("env_bind", "env_bind_lazy", "env_bind_active", #> "env_unbind", "env_poke", "with_bindings", "scoped_bindings", #> "env_has", "env_get", "env_get_list", "env_names", #> "env_length", "env_poke")), list(title = "Search path and namespaces", #> contents = c("search_envs", "search_env", "base_env", #> "global_env", "empty_env", "is_installed", "is_namespace", #> "ns_env", "pkg_env", "env_name", "env_label")), #> list(title = "S3", contents = c("inherits_any", "inherits_all", #> "inherits_only", "new_box", "is_box", "as_box", "as_box_if", #> "unbox", "zap", "is_zap", "done")), list(title = "Create vectors", #> desc = "Atomic vector constructors have implicit splicing (i.e. splice lists automatically), while the list constructor has explicit splicing.\n", #> contents = c("lgl", "int", "dbl", "cpl", "chr", #> "list2", "rep_along", "rep_named", "seq2", "seq2_along" #> )), list(title = "Attributes", contents = c("set_names", #> "names2", "has_name", "is_named")), list(title = "Type predicates", #> contents = c("is_list", "is_atomic", "is_vector", #> "is_integer", "is_double", "is_character", "is_logical", #> "is_raw", "is_bytes", "is_scalar_list", "is_scalar_atomic", #> "is_scalar_vector", "is_scalar_integer", "is_scalar_double", #> "is_scalar_character", "is_scalar_logical", "is_scalar_raw", #> "is_scalar_bytes", "is_bare_list", "is_bare_atomic", #> "is_bare_vector", "is_bare_double", "is_bare_integer", #> "is_bare_numeric", "is_bare_character", "is_bare_logical", #> "is_bare_raw", "is_bare_bytes", "is_empty", "is_integerish", #> "is_bare_integerish", "is_scalar_integerish", #> "is_null", "is_true", "is_false", "is_string", #> "is_bool", "is_bare_string")), list(title = "Operators", #> contents = c("`%||%`", "`%|%`", "`%@%`")), list( #> title = "Function arguments", contents = c("arg_match", #> "missing_arg", "is_missing", "maybe_missing")), #> list(title = "Create tidy evaluation APIs", desc = "Create data masking APIs à-la dplyr or tidyr. These functions are meant for developers rather than users.\n", #> contents = c("`tidyeval-data`", "eval_tidy", #> "as_data_mask", "new_data_mask", "as_data_pronoun" #> )), list(title = "Condition handlers", contents = c("with_handlers", #> "calling")), list(title = "Session state", contents = c("matches(\"interactive\")", #> "matches(\"option\")")), list(title = "Weak references", #> contents = c("matches(\"weakref\")", "matches(\"wref\")" #> )), list(title = "FAQ", contents = "matches(\"faq\")"))), #> figures = list(dev = "ragg::agg_png", dpi = 96L, dev.args = list(), #> fig.ext = "png", fig.width = 7.29166666666667, fig.height = NULL, #> fig.retina = 2L, fig.asp = 0.618046971569839, bg = NULL), #> repo = list(url = list(home = "https://github.com/r-lib/rlang/", #> source = "https://github.com/r-lib/rlang/blob/master/", #> issue = "https://github.com/r-lib/rlang/issues/", user = "https://github.com/")), #> development = list(destination = "dev", mode = "release", #> version_label = "default", version_tooltip = "Released version", #> in_dev = FALSE), topics = list(name = c(abort.Rd = "abort", #> are_na.Rd = "are_na", arg_match.Rd = "arg_match", as_box.Rd = "as_box", #> as_bytes.Rd = "as_bytes", as_data_mask.Rd = "as_data_mask", #> as_env.Rd = "as_env", as_environment.Rd = "as_environment", #> as_function.Rd = "as_function", as_label.Rd = "as_label", #> as_name.Rd = "as_name", as_overscope.Rd = "as_overscope", #> as_pairlist.Rd = "as_pairlist", as_quosure.Rd = "as_quosure", #> as_string.Rd = "as_string", as_utf8_character.Rd = "as_utf8_character", #> `bare-type-predicates.Rd` = "bare-type-predicates", box.Rd = "box", #> call2.Rd = "call2", call_args.Rd = "call_args", call_fn.Rd = "call_fn", #> call_inspect.Rd = "call_inspect", call_modify.Rd = "call_modify", #> call_name.Rd = "call_name", call_parse_type.Rd = "call_parse_type", #> call_standardise.Rd = "call_standardise", caller_env.Rd = "caller_env", #> caller_fn.Rd = "caller_fn", caller_frame.Rd = "caller_frame", #> catch_cnd.Rd = "catch_cnd", chr_unserialise_unicode.Rd = "chr_unserialise_unicode", #> cnd.Rd = "error_cnd", cnd_message.Rd = "cnd_message", cnd_muffle.Rd = "cnd_muffle", #> cnd_signal.Rd = "cnd_signal", cnd_type.Rd = "cnd_type", done.Rd = "done", #> dots_definitions.Rd = "dots_definitions", dots_n.Rd = "dots_n", #> dots_values.Rd = "dots_values", duplicate.Rd = "duplicate", #> `dyn-dots.Rd` = "dyn-dots", empty_env.Rd = "empty_env", enquo0.Rd = "enquo0", #> entrace.Rd = "entrace", env.Rd = "env", env_bind.Rd = "env_bind", #> env_bind_exprs.Rd = "env_bind_exprs", env_binding_are_active.Rd = "env_binding_are_active", #> env_binding_lock.Rd = "env_binding_lock", env_browse.Rd = "env_browse", #> env_bury.Rd = "env_bury", env_clone.Rd = "env_clone", env_depth.Rd = "env_depth", #> env_get.Rd = "env_get", env_has.Rd = "env_has", env_inherits.Rd = "env_inherits", #> env_lock.Rd = "env_lock", env_name.Rd = "env_name", env_names.Rd = "env_names", #> env_parent.Rd = "env_parent", env_poke.Rd = "env_poke", env_print.Rd = "env_print", #> env_unbind.Rd = "env_unbind", env_unlock.Rd = "env_unlock", #> eval_bare.Rd = "eval_bare", eval_tidy.Rd = "eval_tidy", exec.Rd = "exec", #> exiting.Rd = "exiting", expr_interp.Rd = "expr_interp", expr_label.Rd = "expr_label", #> expr_print.Rd = "expr_print", exprs_auto_name.Rd = "exprs_auto_name", #> f_rhs.Rd = "f_rhs", f_text.Rd = "f_text", `faq-options.Rd` = "faq-options", #> flatten.Rd = "flatten", fn_body.Rd = "fn_body", fn_env.Rd = "fn_env", #> fn_fmls.Rd = "fn_fmls", format_error_bullets.Rd = "format_error_bullets", #> frame_position.Rd = "frame_position", friendly_type.Rd = "friendly_type", #> get_env.Rd = "get_env", has_length.Rd = "has_length", has_name.Rd = "has_name", #> hash.Rd = "hash", inherits_any.Rd = "inherits_any", inject.Rd = "inject", #> invoke.Rd = "invoke", is_call.Rd = "is_call", is_callable.Rd = "is_callable", #> is_condition.Rd = "is_condition", is_copyable.Rd = "is_copyable", #> is_empty.Rd = "is_empty", is_env.Rd = "is_env", is_environment.Rd = "is_environment", #> is_expr.Rd = "is_expr", is_expression.Rd = "is_expression", #> is_formula.Rd = "is_formula", is_frame.Rd = "is_frame", is_function.Rd = "is_function", #> is_installed.Rd = "is_installed", is_integerish.Rd = "is_integerish", #> is_interactive.Rd = "is_interactive", is_lang.Rd = "is_lang", #> is_named.Rd = "is_named", is_namespace.Rd = "is_namespace", #> is_pairlist.Rd = "is_pairlist", is_reference.Rd = "is_reference", #> is_stack.Rd = "is_stack", is_symbol.Rd = "is_symbol", is_true.Rd = "is_true", #> is_weakref.Rd = "is_weakref", lang.Rd = "lang", lang_head.Rd = "lang_head", #> lang_modify.Rd = "lang_modify", last_error.Rd = "last_error", #> lifecycle.Rd = "lifecycle", list2.Rd = "list2", local_bindings.Rd = "local_bindings", #> local_options.Rd = "local_options", missing.Rd = "missing", #> missing_arg.Rd = "missing_arg", mut_node_car.Rd = "mut_node_car", #> names2.Rd = "names2", `new-vector-along-retired.Rd` = "new-vector-along-retired", #> `new-vector.Rd` = "new-vector", new_call.Rd = "new_call", #> new_formula.Rd = "new_formula", new_function.Rd = "new_function", #> new_node.Rd = "new_node", new_quosures.Rd = "new_quosures", #> new_weakref.Rd = "new_weakref", ns_env.Rd = "ns_env", `nse-defuse.Rd` = "nse-defuse", #> `nse-force.Rd` = "nse-force", `op-definition.Rd` = "op-definition", #> `op-get-attr.Rd` = "op-get-attr", `op-na-default.Rd` = "op-na-default", #> `op-null-default.Rd` = "op-null-default", overscope_eval_next.Rd = "overscope_eval_next", #> pairlist2.Rd = "pairlist2", parse_expr.Rd = "parse_expr", #> parse_quosure.Rd = "parse_quosure", prepend.Rd = "prepend", #> prim_name.Rd = "prim_name", quo_expr.Rd = "quo_expr", quo_label.Rd = "quo_label", #> quo_squash.Rd = "quo_squash", quosure.Rd = "quosure", raw_deparse_str.Rd = "raw_deparse_str", #> rep_along.Rd = "rep_along", restarting.Rd = "restarting", #> return_from.Rd = "return_from", rlang_backtrace_on_error.Rd = "rlang_backtrace_on_error", #> rst_abort.Rd = "rst_abort", rst_list.Rd = "rst_list", `scalar-type-predicates.Rd` = "scalar-type-predicates", #> scoped_env.Rd = "scoped_env", scoped_interactive.Rd = "scoped_interactive", #> search_envs.Rd = "search_envs", seq2.Rd = "seq2", set_attrs.Rd = "set_attrs", #> set_expr.Rd = "set_expr", set_names.Rd = "set_names", splice.Rd = "splice", #> stack.Rd = "stack", stack_trim.Rd = "stack_trim", string.Rd = "string", #> switch_type.Rd = "switch_type", sym.Rd = "sym", `tidyeval-data.Rd` = "tidyeval-data", #> trace_back.Rd = "trace_back", `type-predicates.Rd` = "type-predicates", #> type_of.Rd = "type_of", vec_poke_n.Rd = "vec_poke_n", `vector-coercion.Rd` = "vector-coercion", #> `vector-construction.Rd` = "vector-construction", `vector-old-ctors.Rd` = "node", #> with_abort.Rd = "with_abort", with_env.Rd = "with_env", with_handlers.Rd = "with_handlers", #> with_restarts.Rd = "with_restarts", wref_key.Rd = "wref_key", #> zap.Rd = "zap", zap_srcref.Rd = "zap_srcref"), file_in = c("abort.Rd", #> "are_na.Rd", "arg_match.Rd", "as_box.Rd", "as_bytes.Rd", #> "as_data_mask.Rd", "as_env.Rd", "as_environment.Rd", "as_function.Rd", #> "as_label.Rd", "as_name.Rd", "as_overscope.Rd", "as_pairlist.Rd", #> "as_quosure.Rd", "as_string.Rd", "as_utf8_character.Rd", #> "bare-type-predicates.Rd", "box.Rd", "call2.Rd", "call_args.Rd", #> "call_fn.Rd", "call_inspect.Rd", "call_modify.Rd", "call_name.Rd", #> "call_parse_type.Rd", "call_standardise.Rd", "caller_env.Rd", #> "caller_fn.Rd", "caller_frame.Rd", "catch_cnd.Rd", "chr_unserialise_unicode.Rd", #> "cnd.Rd", "cnd_message.Rd", "cnd_muffle.Rd", "cnd_signal.Rd", #> "cnd_type.Rd", "done.Rd", "dots_definitions.Rd", "dots_n.Rd", #> "dots_values.Rd", "duplicate.Rd", "dyn-dots.Rd", "empty_env.Rd", #> "enquo0.Rd", "entrace.Rd", "env.Rd", "env_bind.Rd", "env_bind_exprs.Rd", #> "env_binding_are_active.Rd", "env_binding_lock.Rd", "env_browse.Rd", #> "env_bury.Rd", "env_clone.Rd", "env_depth.Rd", "env_get.Rd", #> "env_has.Rd", "env_inherits.Rd", "env_lock.Rd", "env_name.Rd", #> "env_names.Rd", "env_parent.Rd", "env_poke.Rd", "env_print.Rd", #> "env_unbind.Rd", "env_unlock.Rd", "eval_bare.Rd", "eval_tidy.Rd", #> "exec.Rd", "exiting.Rd", "expr_interp.Rd", "expr_label.Rd", #> "expr_print.Rd", "exprs_auto_name.Rd", "f_rhs.Rd", "f_text.Rd", #> "faq-options.Rd", "flatten.Rd", "fn_body.Rd", "fn_env.Rd", #> "fn_fmls.Rd", "format_error_bullets.Rd", "frame_position.Rd", #> "friendly_type.Rd", "get_env.Rd", "has_length.Rd", "has_name.Rd", #> "hash.Rd", "inherits_any.Rd", "inject.Rd", "invoke.Rd", "is_call.Rd", #> "is_callable.Rd", "is_condition.Rd", "is_copyable.Rd", "is_empty.Rd", #> "is_env.Rd", "is_environment.Rd", "is_expr.Rd", "is_expression.Rd", #> "is_formula.Rd", "is_frame.Rd", "is_function.Rd", "is_installed.Rd", #> "is_integerish.Rd", "is_interactive.Rd", "is_lang.Rd", "is_named.Rd", #> "is_namespace.Rd", "is_pairlist.Rd", "is_reference.Rd", "is_stack.Rd", #> "is_symbol.Rd", "is_true.Rd", "is_weakref.Rd", "lang.Rd", #> "lang_head.Rd", "lang_modify.Rd", "last_error.Rd", "lifecycle.Rd", #> "list2.Rd", "local_bindings.Rd", "local_options.Rd", "missing.Rd", #> "missing_arg.Rd", "mut_node_car.Rd", "names2.Rd", "new-vector-along-retired.Rd", #> "new-vector.Rd", "new_call.Rd", "new_formula.Rd", "new_function.Rd", #> "new_node.Rd", "new_quosures.Rd", "new_weakref.Rd", "ns_env.Rd", #> "nse-defuse.Rd", "nse-force.Rd", "op-definition.Rd", "op-get-attr.Rd", #> "op-na-default.Rd", "op-null-default.Rd", "overscope_eval_next.Rd", #> "pairlist2.Rd", "parse_expr.Rd", "parse_quosure.Rd", "prepend.Rd", #> "prim_name.Rd", "quo_expr.Rd", "quo_label.Rd", "quo_squash.Rd", #> "quosure.Rd", "raw_deparse_str.Rd", "rep_along.Rd", "restarting.Rd", #> "return_from.Rd", "rlang_backtrace_on_error.Rd", "rst_abort.Rd", #> "rst_list.Rd", "scalar-type-predicates.Rd", "scoped_env.Rd", #> "scoped_interactive.Rd", "search_envs.Rd", "seq2.Rd", "set_attrs.Rd", #> "set_expr.Rd", "set_names.Rd", "splice.Rd", "stack.Rd", "stack_trim.Rd", #> "string.Rd", "switch_type.Rd", "sym.Rd", "tidyeval-data.Rd", #> "trace_back.Rd", "type-predicates.Rd", "type_of.Rd", "vec_poke_n.Rd", #> "vector-coercion.Rd", "vector-construction.Rd", "vector-old-ctors.Rd", #> "with_abort.Rd", "with_env.Rd", "with_handlers.Rd", "with_restarts.Rd", #> "wref_key.Rd", "zap.Rd", "zap_srcref.Rd"), file_out = c("abort.html", #> "are_na.html", "arg_match.html", "as_box.html", "as_bytes.html", #> "as_data_mask.html", "as_env.html", "as_environment.html", #> "as_function.html", "as_label.html", "as_name.html", "as_overscope.html", #> "as_pairlist.html", "as_quosure.html", "as_string.html", #> "as_utf8_character.html", "bare-type-predicates.html", "box.html", #> "call2.html", "call_args.html", "call_fn.html", "call_inspect.html", #> "call_modify.html", "call_name.html", "call_parse_type.html", #> "call_standardise.html", "caller_env.html", "caller_fn.html", #> "caller_frame.html", "catch_cnd.html", "chr_unserialise_unicode.html", #> "cnd.html", "cnd_message.html", "cnd_muffle.html", "cnd_signal.html", #> "cnd_type.html", "done.html", "dots_definitions.html", "dots_n.html", #> "dots_values.html", "duplicate.html", "dyn-dots.html", "empty_env.html", #> "enquo0.html", "entrace.html", "env.html", "env_bind.html", #> "env_bind_exprs.html", "env_binding_are_active.html", "env_binding_lock.html", #> "env_browse.html", "env_bury.html", "env_clone.html", "env_depth.html", #> "env_get.html", "env_has.html", "env_inherits.html", "env_lock.html", #> "env_name.html", "env_names.html", "env_parent.html", "env_poke.html", #> "env_print.html", "env_unbind.html", "env_unlock.html", "eval_bare.html", #> "eval_tidy.html", "exec.html", "exiting.html", "expr_interp.html", #> "expr_label.html", "expr_print.html", "exprs_auto_name.html", #> "f_rhs.html", "f_text.html", "faq-options.html", "flatten.html", #> "fn_body.html", "fn_env.html", "fn_fmls.html", "format_error_bullets.html", #> "frame_position.html", "friendly_type.html", "get_env.html", #> "has_length.html", "has_name.html", "hash.html", "inherits_any.html", #> "inject.html", "invoke.html", "is_call.html", "is_callable.html", #> "is_condition.html", "is_copyable.html", "is_empty.html", #> "is_env.html", "is_environment.html", "is_expr.html", "is_expression.html", #> "is_formula.html", "is_frame.html", "is_function.html", "is_installed.html", #> "is_integerish.html", "is_interactive.html", "is_lang.html", #> "is_named.html", "is_namespace.html", "is_pairlist.html", #> "is_reference.html", "is_stack.html", "is_symbol.html", "is_true.html", #> "is_weakref.html", "lang.html", "lang_head.html", "lang_modify.html", #> "last_error.html", "lifecycle.html", "list2.html", "local_bindings.html", #> "local_options.html", "missing.html", "missing_arg.html", #> "mut_node_car.html", "names2.html", "new-vector-along-retired.html", #> "new-vector.html", "new_call.html", "new_formula.html", "new_function.html", #> "new_node.html", "new_quosures.html", "new_weakref.html", #> "ns_env.html", "nse-defuse.html", "nse-force.html", "op-definition.html", #> "op-get-attr.html", "op-na-default.html", "op-null-default.html", #> "overscope_eval_next.html", "pairlist2.html", "parse_expr.html", #> "parse_quosure.html", "prepend.html", "prim_name.html", "quo_expr.html", #> "quo_label.html", "quo_squash.html", "quosure.html", "raw_deparse_str.html", #> "rep_along.html", "restarting.html", "return_from.html", #> "rlang_backtrace_on_error.html", "rst_abort.html", "rst_list.html", #> "scalar-type-predicates.html", "scoped_env.html", "scoped_interactive.html", #> "search_envs.html", "seq2.html", "set_attrs.html", "set_expr.html", #> "set_names.html", "splice.html", "stack.html", "stack_trim.html", #> "string.html", "switch_type.html", "sym.html", "tidyeval-data.html", #> "trace_back.html", "type-predicates.html", "type_of.html", #> "vec_poke_n.html", "vector-coercion.html", "vector-construction.html", #> "vector-old-ctors.html", "with_abort.html", "with_env.html", #> "with_handlers.html", "with_restarts.html", "wref_key.html", #> "zap.html", "zap_srcref.html"), alias = list(abort.Rd = c("abort", #> "warn", "inform", "signal", "interrupt"), are_na.Rd = c("are_na", #> "is_na", "is_lgl_na", "is_int_na", "is_dbl_na", "is_chr_na", #> "is_cpl_na"), arg_match.Rd = c("arg_match", "arg_match0"), #> as_box.Rd = c("as_box", "as_box_if"), as_bytes.Rd = "as_bytes", #> as_data_mask.Rd = c("as_data_mask", "as_data_pronoun", #> "new_data_mask"), as_env.Rd = "as_env", as_environment.Rd = "as_environment", #> as_function.Rd = c("as_function", "is_lambda", "as_closure" #> ), as_label.Rd = "as_label", as_name.Rd = "as_name", #> as_overscope.Rd = c("as_overscope", "new_overscope", #> "overscope_clean"), as_pairlist.Rd = "as_pairlist", as_quosure.Rd = c("as_quosure", #> "new_quosure"), as_string.Rd = "as_string", as_utf8_character.Rd = "as_utf8_character", #> `bare-type-predicates.Rd` = c("bare-type-predicates", #> "is_bare_list", "is_bare_atomic", "is_bare_vector", "is_bare_double", #> "is_bare_integer", "is_bare_numeric", "is_bare_character", #> "is_bare_logical", "is_bare_raw", "is_bare_string", "is_bare_bytes" #> ), box.Rd = c("box", "new_box", "is_box", "unbox"), call2.Rd = "call2", #> call_args.Rd = c("call_args", "call_args_names"), call_fn.Rd = "call_fn", #> call_inspect.Rd = "call_inspect", call_modify.Rd = "call_modify", #> call_name.Rd = c("call_name", "call_ns"), call_parse_type.Rd = "call_parse_type", #> call_standardise.Rd = "call_standardise", caller_env.Rd = c("caller_env", #> "current_env"), caller_fn.Rd = c("caller_fn", "current_fn" #> ), caller_frame.Rd = "caller_frame", catch_cnd.Rd = "catch_cnd", #> chr_unserialise_unicode.Rd = "chr_unserialise_unicode", #> cnd.Rd = c("error_cnd", "cnd", "warning_cnd", "message_cnd" #> ), cnd_message.Rd = c("cnd_message", "cnd_header", "cnd_body", #> "cnd_footer"), cnd_muffle.Rd = "cnd_muffle", cnd_signal.Rd = "cnd_signal", #> cnd_type.Rd = "cnd_type", done.Rd = c("done", "is_done_box" #> ), dots_definitions.Rd = "dots_definitions", dots_n.Rd = "dots_n", #> dots_values.Rd = "dots_values", duplicate.Rd = "duplicate", #> `dyn-dots.Rd` = c("dyn-dots", "tidy-dots"), empty_env.Rd = "empty_env", #> enquo0.Rd = c("enquo0", "enquos0"), entrace.Rd = c("entrace", #> "cnd_entrace"), env.Rd = c("env", "child_env", "new_environment" #> ), env_bind.Rd = c("env_bind", "env_bind_lazy", "env_bind_active", #> "%<~%"), env_bind_exprs.Rd = c("env_bind_exprs", "env_bind_fns" #> ), env_binding_are_active.Rd = c("env_binding_are_active", #> "env_binding_are_lazy"), env_binding_lock.Rd = c("env_binding_lock", #> "env_binding_unlock", "env_binding_are_locked"), env_browse.Rd = c("env_browse", #> "env_is_browsed"), env_bury.Rd = "env_bury", env_clone.Rd = "env_clone", #> env_depth.Rd = "env_depth", env_get.Rd = c("env_get", #> "env_get_list"), env_has.Rd = "env_has", env_inherits.Rd = "env_inherits", #> env_lock.Rd = c("env_lock", "env_is_locked"), env_name.Rd = c("env_name", #> "env_label"), env_names.Rd = c("env_names", "env_length" #> ), env_parent.Rd = c("env_parent", "env_tail", "env_parents" #> ), env_poke.Rd = "env_poke", env_print.Rd = "env_print", #> env_unbind.Rd = "env_unbind", env_unlock.Rd = "env_unlock", #> eval_bare.Rd = "eval_bare", eval_tidy.Rd = "eval_tidy", #> exec.Rd = "exec", exiting.Rd = "exiting", expr_interp.Rd = "expr_interp", #> expr_label.Rd = c("expr_label", "expr_name", "expr_text" #> ), expr_print.Rd = c("expr_print", "expr_deparse"), exprs_auto_name.Rd = c("exprs_auto_name", #> "quos_auto_name"), f_rhs.Rd = c("f_rhs", "f_rhs<-", "f_lhs", #> "f_lhs<-", "f_env", "f_env<-"), f_text.Rd = c("f_text", #> "f_name", "f_label"), `faq-options.Rd` = "faq-options", #> flatten.Rd = c("flatten", "flatten_lgl", "flatten_int", #> "flatten_dbl", "flatten_cpl", "flatten_chr", "flatten_raw", #> "squash", "squash_lgl", "squash_int", "squash_dbl", "squash_cpl", #> "squash_chr", "squash_raw", "flatten_if", "squash_if" #> ), fn_body.Rd = c("fn_body", "fn_body<-"), fn_env.Rd = c("fn_env", #> "fn_env<-"), fn_fmls.Rd = c("fn_fmls", "fn_fmls_names", #> "fn_fmls_syms", "fn_fmls<-", "fn_fmls_names<-"), format_error_bullets.Rd = "format_error_bullets", #> frame_position.Rd = "frame_position", friendly_type.Rd = "friendly_type", #> get_env.Rd = c("get_env", "set_env", "env_poke_parent" #> ), has_length.Rd = "has_length", has_name.Rd = "has_name", #> hash.Rd = "hash", inherits_any.Rd = c("inherits_any", #> "inherits_all", "inherits_only"), inject.Rd = "inject", #> invoke.Rd = "invoke", is_call.Rd = "is_call", is_callable.Rd = "is_callable", #> is_condition.Rd = "is_condition", is_copyable.Rd = "is_copyable", #> is_empty.Rd = "is_empty", is_env.Rd = c("is_env", "is_bare_env" #> ), is_environment.Rd = c("is_environment", "is_bare_environment" #> ), is_expr.Rd = "is_expr", is_expression.Rd = c("is_expression", #> "is_syntactic_literal", "is_symbolic"), is_formula.Rd = c("is_formula", #> "is_bare_formula"), is_frame.Rd = "is_frame", is_function.Rd = c("is_function", #> "is_closure", "is_primitive", "is_primitive_eager", "is_primitive_lazy" #> ), is_installed.Rd = c("is_installed", "check_installed" #> ), is_integerish.Rd = c("is_integerish", "is_bare_integerish", #> "is_scalar_integerish"), is_interactive.Rd = c("is_interactive", #> "local_interactive", "with_interactive"), is_lang.Rd = c("is_lang", #> "is_unary_lang", "is_binary_lang", "quo_is_lang"), is_named.Rd = c("is_named", #> "is_dictionaryish", "have_name"), is_namespace.Rd = "is_namespace", #> is_pairlist.Rd = c("is_pairlist", "is_node", "is_node_list" #> ), is_reference.Rd = "is_reference", is_stack.Rd = c("is_stack", #> "is_eval_stack", "is_call_stack"), is_symbol.Rd = "is_symbol", #> is_true.Rd = c("is_true", "is_false"), is_weakref.Rd = "is_weakref", #> lang.Rd = c("lang", "new_language"), lang_head.Rd = c("lang_head", #> "lang_tail"), lang_modify.Rd = c("lang_modify", "lang_standardise", #> "lang_fn", "lang_name", "lang_args", "lang_args_names" #> ), last_error.Rd = c("last_error", "last_trace"), lifecycle.Rd = "lifecycle", #> list2.Rd = c("list2", "ll", "dots_list"), local_bindings.Rd = c("local_bindings", #> "with_bindings"), local_options.Rd = c("local_options", #> "with_options", "push_options", "peek_options", "peek_option" #> ), missing.Rd = c("missing", "na_lgl", "na_int", "na_dbl", #> "na_chr", "na_cpl"), missing_arg.Rd = c("missing_arg", #> "is_missing", "maybe_missing"), mut_node_car.Rd = c("mut_node_car", #> "mut_node_cdr", "mut_node_caar", "mut_node_cadr", "mut_node_cdar", #> "mut_node_cddr", "mut_node_tag"), names2.Rd = "names2", #> `new-vector-along-retired.Rd` = c("new-vector-along-retired", #> "new_logical_along", "new_integer_along", "new_double_along", #> "new_character_along", "new_complex_along", "new_raw_along", #> "new_list_along"), `new-vector.Rd` = c("new-vector", #> "new_logical", "new_integer", "new_double", "new_character", #> "new_complex", "new_raw", "new_list"), new_call.Rd = "new_call", #> new_formula.Rd = "new_formula", new_function.Rd = "new_function", #> new_node.Rd = c("new_node", "node_car", "node_cdr", "node_caar", #> "node_cadr", "node_cdar", "node_cddr", "node_poke_car", #> "node_poke_cdr", "node_poke_caar", "node_poke_cadr", #> "node_poke_cdar", "node_poke_cddr", "node_tag", "node_poke_tag" #> ), new_quosures.Rd = c("new_quosures", "as_quosures", #> "is_quosures"), new_weakref.Rd = "new_weakref", ns_env.Rd = c("ns_env", #> "ns_imports_env", "ns_env_name"), `nse-defuse.Rd` = c("nse-defuse", #> "quotation", "expr", "enexpr", "exprs", "enexprs", "ensym", #> "ensyms", "quo", "enquo", "quos", "enquos"), `nse-force.Rd` = c("nse-force", #> "quasiquotation", "UQ", "UQS", "{{}}", "{{", "!!", "!!!", #> ":=", "qq_show"), `op-definition.Rd` = c("op-definition", #> "is_definition", "new_definition", "is_formulaish"), #> `op-get-attr.Rd` = c("op-get-attr", "%@%", "%@%<-"), #> `op-na-default.Rd` = c("op-na-default", "%|%"), `op-null-default.Rd` = c("op-null-default", #> "%||%"), overscope_eval_next.Rd = "overscope_eval_next", #> pairlist2.Rd = "pairlist2", parse_expr.Rd = c("parse_expr", #> "parse_exprs", "parse_quo", "parse_quos"), parse_quosure.Rd = c("parse_quosure", #> "parse_quosures"), prepend.Rd = c("prepend", "modify" #> ), prim_name.Rd = "prim_name", quo_expr.Rd = "quo_expr", #> quo_label.Rd = c("quo_label", "quo_text", "quo_name"), #> quo_squash.Rd = "quo_squash", quosure.Rd = c("quosure", #> "is_quosure", "quo_is_missing", "quo_is_symbol", "quo_is_call", #> "quo_is_symbolic", "quo_is_null", "quo_get_expr", "quo_get_env", #> "quo_set_expr", "quo_set_env"), raw_deparse_str.Rd = "raw_deparse_str", #> rep_along.Rd = c("rep_along", "rep_named"), restarting.Rd = "restarting", #> return_from.Rd = c("return_from", "return_to"), rlang_backtrace_on_error.Rd = c("rlang_backtrace_on_error", #> "add_backtrace"), rst_abort.Rd = "rst_abort", rst_list.Rd = c("rst_list", #> "rst_exists", "rst_jump", "rst_maybe_jump"), `scalar-type-predicates.Rd` = c("scalar-type-predicates", #> "is_scalar_list", "is_scalar_atomic", "is_scalar_vector", #> "is_scalar_integer", "is_scalar_double", "is_scalar_character", #> "is_scalar_logical", "is_scalar_raw", "is_string", "is_scalar_bytes", #> "is_bool"), scoped_env.Rd = c("scoped_env", "is_scoped", #> "scoped_envs", "scoped_names"), scoped_interactive.Rd = c("scoped_interactive", #> "scoped_options", "scoped_bindings"), search_envs.Rd = c("search_envs", #> "search_env", "pkg_env", "pkg_env_name", "is_attached", #> "base_env", "global_env"), seq2.Rd = c("seq2", "seq2_along" #> ), set_attrs.Rd = c("set_attrs", "mut_attrs"), set_expr.Rd = c("set_expr", #> "get_expr"), set_names.Rd = "set_names", splice.Rd = c("splice", #> "is_spliced", "is_spliced_bare", "dots_splice"), stack.Rd = c("stack", #> "global_frame", "current_frame", "ctxt_frame", "call_frame", #> "ctxt_depth", "call_depth", "ctxt_stack", "call_stack" #> ), stack_trim.Rd = "stack_trim", string.Rd = "string", #> switch_type.Rd = c("switch_type", "coerce_type", "switch_class", #> "coerce_class"), sym.Rd = c("sym", "syms"), `tidyeval-data.Rd` = c("tidyeval-data", #> ".data", ".env"), trace_back.Rd = c("trace_back", "trace_length" #> ), `type-predicates.Rd` = c("type-predicates", "is_list", #> "is_atomic", "is_vector", "is_integer", "is_double", #> "is_character", "is_logical", "is_raw", "is_bytes", "is_null" #> ), type_of.Rd = "type_of", vec_poke_n.Rd = c("vec_poke_n", #> "vec_poke_range"), `vector-coercion.Rd` = c("vector-coercion", #> "as_logical", "as_integer", "as_double", "as_complex", #> "as_character", "as_list"), `vector-construction.Rd` = c("vector-construction", #> "lgl", "int", "dbl", "cpl", "chr", "bytes"), `vector-old-ctors.Rd` = c("node", #> "vector-old-ctors", "lgl_len", "int_len", "dbl_len", #> "chr_len", "cpl_len", "raw_len", "bytes_len", "list_len", #> "lgl_along", "int_along", "dbl_along", "chr_along", "cpl_along", #> "raw_along", "bytes_along", "list_along"), with_abort.Rd = "with_abort", #> with_env.Rd = c("with_env", "locally"), with_handlers.Rd = c("with_handlers", #> "calling"), with_restarts.Rd = "with_restarts", wref_key.Rd = c("wref_key", #> "wref_value"), zap.Rd = c("zap", "is_zap"), zap_srcref.Rd = "zap_srcref"), #> funs = list(abort.Rd = c("abort()", "warn()", "inform()", #> "signal()", "interrupt()"), are_na.Rd = c("are_na()", #> "is_na()", "is_lgl_na()", "is_int_na()", "is_dbl_na()", #> "is_chr_na()", "is_cpl_na()"), arg_match.Rd = c("arg_match()", #> "arg_match0()"), as_box.Rd = c("as_box()", "as_box_if()" #> ), as_bytes.Rd = "as_bytes()", as_data_mask.Rd = c("as_data_mask()", #> "as_data_pronoun()", "new_data_mask()"), as_env.Rd = "as_env()", #> as_environment.Rd = "as_environment()", as_function.Rd = c("as_function()", #> "is_lambda()", "as_closure()"), as_label.Rd = "as_label()", #> as_name.Rd = "as_name()", as_overscope.Rd = c("as_overscope()", #> "new_overscope()", "overscope_clean()"), as_pairlist.Rd = "as_pairlist()", #> as_quosure.Rd = c("as_quosure()", "new_quosure()" #> ), as_string.Rd = "as_string()", as_utf8_character.Rd = "as_utf8_character()", #> `bare-type-predicates.Rd` = c("is_bare_list()", "is_bare_atomic()", #> "is_bare_vector()", "is_bare_double()", "is_bare_integer()", #> "is_bare_numeric()", "is_bare_character()", "is_bare_logical()", #> "is_bare_raw()", "is_bare_string()", "is_bare_bytes()" #> ), box.Rd = c("new_box()", "is_box()", "unbox()"), #> call2.Rd = "call2()", call_args.Rd = c("call_args()", #> "call_args_names()"), call_fn.Rd = "call_fn()", call_inspect.Rd = "call_inspect()", #> call_modify.Rd = "call_modify()", call_name.Rd = c("call_name()", #> "call_ns()"), call_parse_type.Rd = "call_parse_type()", #> call_standardise.Rd = "call_standardise()", caller_env.Rd = c("caller_env()", #> "current_env()"), caller_fn.Rd = c("caller_fn()", #> "current_fn()"), caller_frame.Rd = "caller_frame()", #> catch_cnd.Rd = "catch_cnd()", chr_unserialise_unicode.Rd = "chr_unserialise_unicode()", #> cnd.Rd = c("error_cnd()", "cnd()", "warning_cnd()", #> "message_cnd()"), cnd_message.Rd = c("cnd_message()", #> "cnd_header()", "cnd_body()", "cnd_footer()"), cnd_muffle.Rd = "cnd_muffle()", #> cnd_signal.Rd = "cnd_signal()", cnd_type.Rd = "cnd_type()", #> done.Rd = c("done()", "is_done_box()"), dots_definitions.Rd = "dots_definitions()", #> dots_n.Rd = "dots_n()", dots_values.Rd = "dots_values()", #> duplicate.Rd = "duplicate()", `dyn-dots.Rd` = character(0), #> empty_env.Rd = "empty_env()", enquo0.Rd = c("enquo0()", #> "enquos0()"), entrace.Rd = c("entrace()", "cnd_entrace()" #> ), env.Rd = c("env()", "child_env()", "new_environment()" #> ), env_bind.Rd = c("env_bind()", "env_bind_lazy()", #> "env_bind_active()", "`%<~%`"), env_bind_exprs.Rd = c("env_bind_exprs()", #> "env_bind_fns()"), env_binding_are_active.Rd = c("env_binding_are_active()", #> "env_binding_are_lazy()"), env_binding_lock.Rd = c("env_binding_lock()", #> "env_binding_unlock()", "env_binding_are_locked()" #> ), env_browse.Rd = c("env_browse()", "env_is_browsed()" #> ), env_bury.Rd = "env_bury()", env_clone.Rd = "env_clone()", #> env_depth.Rd = "env_depth()", env_get.Rd = c("env_get()", #> "env_get_list()"), env_has.Rd = "env_has()", env_inherits.Rd = "env_inherits()", #> env_lock.Rd = c("env_lock()", "env_is_locked()"), #> env_name.Rd = c("env_name()", "env_label()"), env_names.Rd = c("env_names()", #> "env_length()"), env_parent.Rd = c("env_parent()", #> "env_tail()", "env_parents()"), env_poke.Rd = "env_poke()", #> env_print.Rd = "env_print()", env_unbind.Rd = "env_unbind()", #> env_unlock.Rd = "env_unlock()", eval_bare.Rd = "eval_bare()", #> eval_tidy.Rd = "eval_tidy()", exec.Rd = "exec()", #> exiting.Rd = "exiting()", expr_interp.Rd = "expr_interp()", #> expr_label.Rd = c("expr_label()", "expr_name()", #> "expr_text()"), expr_print.Rd = c("expr_print()", #> "expr_deparse()"), exprs_auto_name.Rd = c("exprs_auto_name()", #> "quos_auto_name()"), f_rhs.Rd = c("f_rhs()", "`f_rhs<-`()", #> "f_lhs()", "`f_lhs<-`()", "f_env()", "`f_env<-`()" #> ), f_text.Rd = c("f_text()", "f_name()", "f_label()" #> ), `faq-options.Rd` = character(0), flatten.Rd = c("flatten()", #> "flatten_lgl()", "flatten_int()", "flatten_dbl()", #> "flatten_cpl()", "flatten_chr()", "flatten_raw()", #> "squash()", "squash_lgl()", "squash_int()", "squash_dbl()", #> "squash_cpl()", "squash_chr()", "squash_raw()", "flatten_if()", #> "squash_if()"), fn_body.Rd = c("fn_body()", "`fn_body<-`()" #> ), fn_env.Rd = c("fn_env()", "`fn_env<-`()"), #> fn_fmls.Rd = c("fn_fmls()", "fn_fmls_names()", "fn_fmls_syms()", #> "`fn_fmls<-`()", "`fn_fmls_names<-`()"), format_error_bullets.Rd = "format_error_bullets()", #> frame_position.Rd = "frame_position()", friendly_type.Rd = "friendly_type()", #> get_env.Rd = c("get_env()", "set_env()", "env_poke_parent()" #> ), has_length.Rd = "has_length()", has_name.Rd = "has_name()", #> hash.Rd = "hash()", inherits_any.Rd = c("inherits_any()", #> "inherits_all()", "inherits_only()"), inject.Rd = "inject()", #> invoke.Rd = "invoke()", is_call.Rd = "is_call()", #> is_callable.Rd = "is_callable()", is_condition.Rd = "is_condition()", #> is_copyable.Rd = "is_copyable()", is_empty.Rd = "is_empty()", #> is_env.Rd = c("is_env()", "is_bare_env()"), is_environment.Rd = c("is_environment()", #> "is_bare_environment()"), is_expr.Rd = "is_expr()", #> is_expression.Rd = c("is_expression()", "is_syntactic_literal()", #> "is_symbolic()"), is_formula.Rd = c("is_formula()", #> "is_bare_formula()"), is_frame.Rd = "is_frame()", #> is_function.Rd = c("is_function()", "is_closure()", #> "is_primitive()", "is_primitive_eager()", "is_primitive_lazy()" #> ), is_installed.Rd = c("is_installed()", "check_installed()" #> ), is_integerish.Rd = c("is_integerish()", "is_bare_integerish()", #> "is_scalar_integerish()"), is_interactive.Rd = c("is_interactive()", #> "local_interactive()", "with_interactive()"), is_lang.Rd = c("is_lang()", #> "is_unary_lang()", "is_binary_lang()", "quo_is_lang()" #> ), is_named.Rd = c("is_named()", "is_dictionaryish()", #> "have_name()"), is_namespace.Rd = "is_namespace()", #> is_pairlist.Rd = c("is_pairlist()", "is_node()", #> "is_node_list()"), is_reference.Rd = "is_reference()", #> is_stack.Rd = c("is_stack()", "is_eval_stack()", #> "is_call_stack()"), is_symbol.Rd = "is_symbol()", #> is_true.Rd = c("is_true()", "is_false()"), is_weakref.Rd = "is_weakref()", #> lang.Rd = c("lang()", "new_language()"), lang_head.Rd = c("lang_head()", #> "lang_tail()"), lang_modify.Rd = c("lang_modify()", #> "lang_standardise()", "lang_fn()", "lang_name()", #> "lang_args()", "lang_args_names()"), last_error.Rd = c("last_error()", #> "last_trace()"), lifecycle.Rd = character(0), list2.Rd = c("list2()", #> "dots_list()"), local_bindings.Rd = c("local_bindings()", #> "with_bindings()"), local_options.Rd = c("local_options()", #> "with_options()", "push_options()", "peek_options()", #> "peek_option()"), missing.Rd = c("na_lgl", "na_int", #> "na_dbl", "na_chr", "na_cpl"), missing_arg.Rd = c("missing_arg()", #> "is_missing()", "maybe_missing()"), mut_node_car.Rd = c("mut_node_car()", #> "mut_node_cdr()", "mut_node_caar()", "mut_node_cadr()", #> "mut_node_cdar()", "mut_node_cddr()", "mut_node_tag()" #> ), names2.Rd = "names2()", `new-vector-along-retired.Rd` = c("new_logical_along()", #> "new_integer_along()", "new_double_along()", "new_character_along()", #> "new_complex_along()", "new_raw_along()", "new_list_along()" #> ), `new-vector.Rd` = c("new_logical()", "new_integer()", #> "new_double()", "new_character()", "new_complex()", #> "new_raw()", "new_list()"), new_call.Rd = "new_call()", #> new_formula.Rd = "new_formula()", new_function.Rd = "new_function()", #> new_node.Rd = c("new_node()", "node_car()", "node_cdr()", #> "node_caar()", "node_cadr()", "node_cdar()", "node_cddr()", #> "node_poke_car()", "node_poke_cdr()", "node_poke_caar()", #> "node_poke_cadr()", "node_poke_cdar()", "node_poke_cddr()", #> "node_tag()", "node_poke_tag()"), new_quosures.Rd = c("new_quosures()", #> "as_quosures()", "is_quosures()"), new_weakref.Rd = "new_weakref()", #> ns_env.Rd = c("ns_env()", "ns_imports_env()", "ns_env_name()" #> ), `nse-defuse.Rd` = c("expr()", "enexpr()", "exprs()", #> "enexprs()", "ensym()", "ensyms()", "quo()", "enquo()", #> "quos()", "enquos()"), `nse-force.Rd` = "qq_show()", #> `op-definition.Rd` = c("is_definition()", "new_definition()", #> "is_formulaish()"), `op-get-attr.Rd` = c("`%@%`", #> "`%@%<-`()"), `op-na-default.Rd` = "`%|%`", `op-null-default.Rd` = "`%||%`", #> overscope_eval_next.Rd = "overscope_eval_next()", #> pairlist2.Rd = "pairlist2()", parse_expr.Rd = c("parse_expr()", #> "parse_exprs()", "parse_quo()", "parse_quos()"), #> parse_quosure.Rd = c("parse_quosure()", "parse_quosures()" #> ), prepend.Rd = c("prepend()", "modify()"), prim_name.Rd = "prim_name()", #> quo_expr.Rd = "quo_expr()", quo_label.Rd = c("quo_label()", #> "quo_text()", "quo_name()"), quo_squash.Rd = "quo_squash()", #> quosure.Rd = c("is_quosure()", "quo_is_missing()", #> "quo_is_symbol()", "quo_is_call()", "quo_is_symbolic()", #> "quo_is_null()", "quo_get_expr()", "quo_get_env()", #> "quo_set_expr()", "quo_set_env()"), raw_deparse_str.Rd = "raw_deparse_str()", #> rep_along.Rd = c("rep_along()", "rep_named()"), restarting.Rd = "restarting()", #> return_from.Rd = c("return_from()", "return_to()" #> ), rlang_backtrace_on_error.Rd = character(0), rst_abort.Rd = "rst_abort()", #> rst_list.Rd = c("rst_list()", "rst_exists()", "rst_jump()", #> "rst_maybe_jump()"), `scalar-type-predicates.Rd` = c("is_scalar_list()", #> "is_scalar_atomic()", "is_scalar_vector()", "is_scalar_integer()", #> "is_scalar_double()", "is_scalar_character()", "is_scalar_logical()", #> "is_scalar_raw()", "is_string()", "is_scalar_bytes()", #> "is_bool()"), scoped_env.Rd = c("scoped_env()", "is_scoped()", #> "scoped_envs()", "scoped_names()"), scoped_interactive.Rd = c("scoped_interactive()", #> "scoped_options()", "scoped_bindings()"), search_envs.Rd = c("search_envs()", #> "search_env()", "pkg_env()", "pkg_env_name()", "is_attached()", #> "base_env()", "global_env()"), seq2.Rd = c("seq2()", #> "seq2_along()"), set_attrs.Rd = c("set_attrs()", #> "mut_attrs()"), set_expr.Rd = c("set_expr()", "get_expr()" #> ), set_names.Rd = "set_names()", splice.Rd = c("splice()", #> "is_spliced()", "is_spliced_bare()", "dots_splice()" #> ), stack.Rd = c("global_frame()", "current_frame()", #> "ctxt_frame()", "call_frame()", "ctxt_depth()", "call_depth()", #> "ctxt_stack()", "call_stack()"), stack_trim.Rd = "stack_trim()", #> string.Rd = "string()", switch_type.Rd = c("switch_type()", #> "coerce_type()", "switch_class()", "coerce_class()" #> ), sym.Rd = c("sym()", "syms()"), `tidyeval-data.Rd` = c(".data", #> ".env"), trace_back.Rd = c("trace_back()", "trace_length()" #> ), `type-predicates.Rd` = c("is_list()", "is_atomic()", #> "is_vector()", "is_integer()", "is_double()", "is_character()", #> "is_logical()", "is_raw()", "is_bytes()", "is_null()" #> ), type_of.Rd = "type_of()", vec_poke_n.Rd = c("vec_poke_n()", #> "vec_poke_range()"), `vector-coercion.Rd` = c("as_logical()", #> "as_integer()", "as_double()", "as_complex()", "as_character()", #> "as_list()"), `vector-construction.Rd` = c("lgl()", #> "int()", "dbl()", "cpl()", "chr()", "bytes()"), `vector-old-ctors.Rd` = c("node()", #> "lgl_len()", "int_len()", "dbl_len()", "chr_len()", #> "cpl_len()", "raw_len()", "bytes_len()", "list_len()", #> "lgl_along()", "int_along()", "dbl_along()", "chr_along()", #> "cpl_along()", "raw_along()", "bytes_along()", "list_along()" #> ), with_abort.Rd = "with_abort()", with_env.Rd = c("with_env()", #> "locally()"), with_handlers.Rd = c("with_handlers()", #> "calling()"), with_restarts.Rd = "with_restarts()", #> wref_key.Rd = c("wref_key()", "wref_value()"), zap.Rd = c("zap()", #> "is_zap()"), zap_srcref.Rd = "zap_srcref()"), title = c(abort.Rd = "Signal an error, warning, or message", #> are_na.Rd = "Test for missing values", arg_match.Rd = "Match an argument to a character vector", #> as_box.Rd = "Convert object to a box", as_bytes.Rd = "Coerce to a raw vector", #> as_data_mask.Rd = "Create a data mask", as_env.Rd = "Coerce to an environment", #> as_environment.Rd = "Coerce to an environment", as_function.Rd = "Convert to function or closure", #> as_label.Rd = "Create a default name for an R object", #> as_name.Rd = "Extract names from symbols", as_overscope.Rd = "Create an overscope", #> as_pairlist.Rd = "Coerce to pairlist", as_quosure.Rd = "Coerce object to quosure", #> as_string.Rd = "Cast symbol to string", as_utf8_character.Rd = "Coerce to a character vector and attempt encoding conversion", #> `bare-type-predicates.Rd` = "Bare type predicates", box.Rd = "Box a value", #> call2.Rd = "Create a call", call_args.Rd = "Extract arguments from a call", #> call_fn.Rd = "Extract function from a call", call_inspect.Rd = "Inspect a call", #> call_modify.Rd = "Modify the arguments of a call", call_name.Rd = "Extract function name or namespace of a call", #> call_parse_type.Rd = "What is the parser type of a call?", #> call_standardise.Rd = "Standardise a call", caller_env.Rd = "Get the current or caller environment", #> caller_fn.Rd = "Get properties of the current or caller frame", #> caller_frame.Rd = "Get caller frame", catch_cnd.Rd = "Catch a condition", #> chr_unserialise_unicode.Rd = "Translate unicode points to UTF-8", #> cnd.Rd = "Create a condition object", cnd_message.Rd = "Build an error message from parts", #> cnd_muffle.Rd = "Muffle a condition", cnd_signal.Rd = "Signal a condition object", #> cnd_type.Rd = "What type is a condition?", done.Rd = "Box a final value for early termination", #> dots_definitions.Rd = "Capture definition objects", dots_n.Rd = "How many arguments are currently forwarded in dots?", #> dots_values.Rd = "Evaluate dots with preliminary splicing", #> duplicate.Rd = "Duplicate an R object", `dyn-dots.Rd` = "Dynamic dots", #> empty_env.Rd = "Get the empty environment", enquo0.Rd = "Defuse arguments without automatic injection", #> entrace.Rd = "Add backtrace from error handler", env.Rd = "Create a new environment", #> env_bind.Rd = "Bind symbols to objects in an environment", #> env_bind_exprs.Rd = "Bind a promise or active binding", #> env_binding_are_active.Rd = "What kind of environment binding?", #> env_binding_lock.Rd = "Lock or unlock environment bindings", #> env_browse.Rd = "Browse environments", env_bury.Rd = "Mask bindings by defining symbols deeper in a scope", #> env_clone.Rd = "Clone an environment", env_depth.Rd = "Depth of an environment chain", #> env_get.Rd = "Get an object in an environment", env_has.Rd = "Does an environment have or see bindings?", #> env_inherits.Rd = "Does environment inherit from another environment?", #> env_lock.Rd = "Lock an environment", env_name.Rd = "Label of an environment", #> env_names.Rd = "Names and numbers of symbols bound in an environment", #> env_parent.Rd = "Get parent environments", env_poke.Rd = "Poke an object in an environment", #> env_print.Rd = "Pretty-print an environment", env_unbind.Rd = "Remove bindings from an environment", #> env_unlock.Rd = "Unlock an environment", eval_bare.Rd = "Evaluate an expression in an environment", #> eval_tidy.Rd = "Evaluate an expression with quosures and pronoun support", #> exec.Rd = "Execute a function", exiting.Rd = "Exiting handler", #> expr_interp.Rd = "Process unquote operators in a captured expression", #> expr_label.Rd = "Turn an expression to a label", expr_print.Rd = "Print an expression", #> exprs_auto_name.Rd = "Ensure that all elements of a list of expressions are named", #> f_rhs.Rd = "Get or set formula components", f_text.Rd = "Turn RHS of formula into a string or label", #> `faq-options.Rd` = "Global options for rlang", flatten.Rd = "Flatten or squash a list of lists into a simpler vector", #> fn_body.Rd = "Get or set function body", fn_env.Rd = "Return the closure environment of a function", #> fn_fmls.Rd = "Extract arguments from a function", format_error_bullets.Rd = "Format bullets for error messages", #> frame_position.Rd = "Find the position or distance of a frame on the evaluation stack", #> friendly_type.Rd = "Format a type for error messages", #> get_env.Rd = "Get or set the environment of an object", #> has_length.Rd = "How long is an object?", has_name.Rd = "Does an object have an element with this name?", #> hash.Rd = "Hash an object", inherits_any.Rd = "Does an object inherit from a set of classes?", #> inject.Rd = "Inject objects in an R expression", invoke.Rd = "Invoke a function with a list of arguments", #> is_call.Rd = "Is object a call?", is_callable.Rd = "Is an object callable?", #> is_condition.Rd = "Is object a condition?", is_copyable.Rd = "Is an object copyable?", #> is_empty.Rd = "Is object an empty vector or NULL?", is_env.Rd = "Is an object an environment?", #> is_environment.Rd = "Is object an environment?", is_expr.Rd = "Is an object an expression?", #> is_expression.Rd = "Is an object an expression?", is_formula.Rd = "Is object a formula?", #> is_frame.Rd = "Is object a frame?", is_function.Rd = "Is object a function?", #> is_installed.Rd = "Are packages installed in any of the libraries?", #> is_integerish.Rd = "Is a vector integer-like?", is_interactive.Rd = "Is R running interactively?", #> is_lang.Rd = "Is object a call?", is_named.Rd = "Is object named?", #> is_namespace.Rd = "Is an object a namespace environment?", #> is_pairlist.Rd = "Is object a node or pairlist?", is_reference.Rd = "Is an object referencing another?", #> is_stack.Rd = "Is object a stack?", is_symbol.Rd = "Is object a symbol?", #> is_true.Rd = "Is object identical to TRUE or FALSE?", #> is_weakref.Rd = "Is object a weak reference?", lang.Rd = "Create a call", #> lang_head.Rd = "Return the head or tail of a call", lang_modify.Rd = "Manipulate or access a call", #> last_error.Rd = "Last <code>abort()</code> error", lifecycle.Rd = "Life cycle of the rlang package", #> list2.Rd = "Collect dots in a list", local_bindings.Rd = "Temporarily change bindings of an environment", #> local_options.Rd = "Change global options", missing.Rd = "Missing values", #> missing_arg.Rd = "Generate or handle a missing argument", #> mut_node_car.Rd = "Mutate node components", names2.Rd = "Get names of a vector", #> `new-vector-along-retired.Rd` = "Create vectors matching the length of a given vector", #> `new-vector.Rd` = "Create vectors matching a given length", #> new_call.Rd = "Create a new call from components", new_formula.Rd = "Create a formula", #> new_function.Rd = "Create a function", new_node.Rd = "Helpers for pairlist and language nodes", #> new_quosures.Rd = "Create a list of quosures", new_weakref.Rd = "Create a weak reference", #> ns_env.Rd = "Get the namespace of a package", `nse-defuse.Rd` = "Defuse R expressions", #> `nse-force.Rd` = "Force parts of an expression", `op-definition.Rd` = "Definition operator", #> `op-get-attr.Rd` = "Infix attribute accessor and setter", #> `op-na-default.Rd` = "Replace missing values", `op-null-default.Rd` = "Default value for <code>NULL</code>", #> overscope_eval_next.Rd = "Evaluate next quosure in a data mask", #> pairlist2.Rd = "Create pairlists with splicing support", #> parse_expr.Rd = "Parse R code", parse_quosure.Rd = "Parse text into a quosure", #> prepend.Rd = "Prepend a vector", prim_name.Rd = "Name of a primitive function", #> quo_expr.Rd = "Squash a quosure", quo_label.Rd = "Format quosures for printing or labelling", #> quo_squash.Rd = "Squash a quosure", quosure.Rd = "Quosure getters, setters and testers", #> raw_deparse_str.Rd = "Serialize a raw vector to a string", #> rep_along.Rd = "Create vectors matching the length of a given vector", #> restarting.Rd = "Create a restarting handler", return_from.Rd = "Jump to or from a frame", #> rlang_backtrace_on_error.Rd = "Display backtrace on error", #> rst_abort.Rd = "Jump to the abort restart", rst_list.Rd = "Restarts utilities", #> `scalar-type-predicates.Rd` = "Scalar type predicates", #> scoped_env.Rd = "Retired <code>scoped</code> functions", #> scoped_interactive.Rd = "Questioning <code>scoped_</code> functions", #> search_envs.Rd = "Search path environments", seq2.Rd = "Increasing sequence of integers in an interval", #> set_attrs.Rd = "Add attributes to an object", set_expr.Rd = "Set and get an expression", #> set_names.Rd = "Set names of a vector", splice.Rd = "Splice lists", #> stack.Rd = "Call stack information", stack_trim.Rd = "Trim top call layers from the evaluation stack", #> string.Rd = "Create a string", switch_type.Rd = "Dispatch on base types", #> sym.Rd = "Create a symbol or list of symbols", `tidyeval-data.Rd` = "Data pronouns for tidy evaluation", #> trace_back.Rd = "Capture a backtrace", `type-predicates.Rd` = "Type predicates", #> type_of.Rd = "Base type of an object", vec_poke_n.Rd = "Poke values into a vector", #> `vector-coercion.Rd` = "Coerce an object to a base type", #> `vector-construction.Rd` = "Create vectors", `vector-old-ctors.Rd` = "Retired vector construction by length", #> with_abort.Rd = "Promote all errors to rlang errors", #> with_env.Rd = "Evaluate an expression within a given environment", #> with_handlers.Rd = "Establish handlers on the stack", #> with_restarts.Rd = "Establish a restart point on the stack", #> wref_key.Rd = "Get key/value from a weak reference object", #> zap.Rd = "Create zap objects", zap_srcref.Rd = "Zap source references" #> ), rd = list(abort.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-abort.R, R/cnd-signal.R", #> "\n", list("abort"), "\n", list("abort"), "\n", list( #> "warn"), "\n", list("inform"), "\n", list("signal"), #> "\n", list("interrupt"), "\n", list("Signal an error, warning, or message"), #> "\n", list("\n", "abort(\n", " message = NULL,\n", #> " class = NULL,\n", " ...,\n", " trace = NULL,\n", #> " parent = NULL,\n", " .subclass = deprecated()\n", #> ")\n", "\n", "warn(\n", " message = NULL,\n", #> " class = NULL,\n", " ...,\n", " .frequency = c(\"always\", \"regularly\", \"once\"),\n", #> " .frequency_id = NULL,\n", " .subclass = deprecated()\n", #> ")\n", "\n", "inform(\n", " message = NULL,\n", #> " class = NULL,\n", " ...,\n", " .file = NULL,\n", #> " .frequency = c(\"always\", \"regularly\", \"once\"),\n", #> " .frequency_id = NULL,\n", " .subclass = deprecated()\n", #> ")\n", "\n", "signal(message, class, ..., .subclass = deprecated())\n", #> "\n", "interrupt()\n"), "\n", list("\n", list( #> list("message"), list("The message to display. Character vectors are\n", #> "formatted with ", list(list("format_error_bullets()")), #> ". The first element\n", "defines a message header and the rest of the vector defines\n", #> "bullets. Bullets named ", list("i"), " and ", #> list("x"), " define info and error bullets\n", #> "respectively, with special Unicode and colour formatting applied\n", #> "if possible.\n", "\n", "If a message is not supplied, it is expected that the message is\n", #> "generated lazily through ", list("conditionMessage()"), #> ". In\n", "that case, ", list("class"), " must be supplied. Only ", #> list("inform()"), " allows empty\n", "messages as it is occasionally useful to build user output\n", #> "incrementally.")), "\n", "\n", list(list("class"), #> list("Subclass of the condition. This allows your users\n", #> "to selectively handle the conditions signalled by your functions.")), #> "\n", "\n", list(list("..."), list("Additional data to be stored in the condition object.")), #> "\n", "\n", list(list("trace"), list("A ", list( #> "trace"), " object created by ", list(list( #> "trace_back()")), ".")), "\n", "\n", list(list( #> "parent"), list("A parent condition object created by ", #> list(list("abort()")), ".")), "\n", "\n", list( #> list(".subclass"), list("This argument was renamed to ", #> list("class"), " in rlang\n", "0.4.2. It will be deprecated in the next major version. This is\n", #> "for consistency with our conventions for class constructors\n", #> "documented in ", list("https://adv-r.hadley.nz/s3.html#s3-subclassing"), #> ".")), "\n", "\n", list(list(".frequency"), #> list("How frequently should the warning or message be\n", #> "displayed? By default (", list("\"always\""), #> ") it is displayed at each\n", "time. If ", #> list("\"regularly\""), ", it is displayed once every 8 hours. If\n", #> list("\"once\""), ", it is displayed once per session.")), #> "\n", "\n", list(list(".frequency_id"), list( #> "A unique identifier for the warning or\n", #> "message. This is used when ", list(".frequency"), #> " is supplied to recognise\n", "recurring conditions. This argument must be supplied if\n", #> list(".frequency"), " is not set to ", list( #> "\"always\""), ".")), "\n", "\n", list(list( #> ".file"), list("Where the message is printed. This should be a\n", #> "connection or character string which will be passed to ", #> list(list("cat()")), ".\n", "\n", "By default, ", #> list("inform()"), " prints to standard output in interactive\n", #> "sessions and standard error otherwise. This way IDEs can treat\n", #> "messages distinctly from warnings and errors, and R scripts can\n", #> "still filter out the messages easily by redirecting ", #> list("stderr"), ". If\n", "a sink is active, either on output or on messages, messages are\n", #> "printed to ", list("stderr"), ". This ensures consistency of behaviour in\n", #> "interactive and non-interactive sessions.")), #> "\n"), "\n", list("\n", "These functions are equivalent to base functions ", #> list(list("base::stop()")), ",\n", list(list( #> "base::warning()")), ", and ", list(list("base::message()")), #> ", but make it easy to supply\n", "condition metadata:\n", #> list("\n", list(), " Supply ", list("class"), #> " to create a classed condition. Typed\n", #> "conditions can be captured or handled selectively, allowing for\n", #> "finer-grained error handling.\n", list(), #> " Supply metadata with named ", list("..."), #> " arguments. This data will be\n", "stored in the condition object and can be examined by handlers.\n"), #> "\n", "\n", list("interrupt()"), " allows R code to simulate a user interrupt of the\n", #> "kind that is signalled with ", list("Ctrl-C"), #> ". It is currently not possible\n", "to create custom interrupt condition objects.\n"), #> "\n", list(list("Backtrace"), list("\n", "\n", "\n", #> "Unlike ", list("stop()"), " and ", list("warning()"), #> ", these functions don't include call\n", "information by default. This saves you from typing ", #> list("call. = FALSE"), "\n", "and produces cleaner error messages.\n", #> "\n", "A backtrace is always saved into error objects. You can print a\n", #> "simplified backtrace of the last error by calling ", #> list(list("last_error()")), "\n", "and a full backtrace with ", #> list("summary(last_error())"), ".\n", "\n", "You can also display a backtrace with the error message by setting\n", #> "the option ", list(list("rlang_backtrace_on_error")), #> ". It supports the following\n", "values:\n", #> list("\n", list(), " ", list("\"reminder\""), #> ": Invite users to call ", list("rlang::last_error()"), #> " to see a\n", "backtrace.\n", list(), " ", #> list("\"branch\""), ": Display a simplified backtrace.\n", #> list(), " ", list("\"collapse\""), ": Display a collapsed backtrace tree.\n", #> list(), " ", list("\"full\""), ": Display a full backtrace tree.\n", #> list(), " ", list("\"none\""), ": Display nothing.\n"), #> "\n")), "\n", "\n", list(list("Mufflable conditions"), #> list("\n", "\n", "\n", "Signalling a condition with ", #> list("inform()"), " or ", list("warn()"), " causes a message\n", #> "to be displayed in the console. These messages can be muffled with\n", #> list(list("base::suppressMessages()")), " or ", #> list(list("base::suppressWarnings()")), ".\n", #> "\n", "On recent R versions (>= R 3.5.0), interrupts are typically\n", #> "signalled with a ", list("\"resume\""), " restart. This is however not\n", #> "guaranteed.\n")), "\n", "\n", list("\n", "# These examples are guarded to avoid throwing errors\n", #> "if (FALSE) {\n", "\n", "# Signal an error with a message just like stop():\n", #> "abort(\"Something bad happened\")\n", "\n", #> "# Give a class to the error:\n", "abort(\"Something bad happened\", \"somepkg_bad_error\")\n", #> "\n", "# This will allow your users to handle the error selectively\n", #> "tryCatch(\n", " somepkg_function(),\n", " somepkg_bad_error = function(err) {\n", #> " warn(conditionMessage(err)) # Demote the error to a warning\n", #> " NA # Return an alternative value\n", #> " }\n", ")\n", "\n", "# You can also specify metadata that will be stored in the condition:\n", #> "abort(\"Something bad happened\", \"somepkg_bad_error\", data = 1:10)\n", #> "\n", "# This data can then be consulted by user handlers:\n", #> "tryCatch(\n", " somepkg_function(),\n", " somepkg_bad_error = function(err) {\n", #> " # Compute an alternative return value with the data:\n", #> " recover_error(err$data)\n", " }\n", ")\n", #> "\n", "# If you call low-level APIs it is good practice to handle\n", #> "# technical errors and rethrow them with a more meaningful\n", #> "# message. Always prefer doing this from `withCallinghandlers()`\n", #> "# rather than `tryCatch()` because the former preserves the stack\n", #> "# on error and makes it possible for users to use `recover()`.\n", #> "file <- \"http://foo.bar/baz\"\n", "try(withCallinghandlers(\n", #> " download(file),\n", " error = function(err) {\n", #> " msg <- sprintf(\"Can't download `%s`\", file)\n", #> " abort(msg, parent = err)\n", "}))\n", "# Note how we supplied the parent error to `abort()` as `parent` to\n", #> "# get a decomposition of error messages across error contexts.\n", #> "\n", "# Unhandled errors are saved automatically by `abort()` and can be\n", #> "# retrieved with `last_error()`. The error prints with a simplified\n", #> "# backtrace:\n", "abort(\"Saved error?\")\n", #> "last_error()\n", "\n", "# Use `summary()` to print the full backtrace and the condition fields:\n", #> "summary(last_error())\n", "\n", "}\n"), "\n", #> list("\n", list(list("with_abort()")), " to convert all errors to rlang errors.\n"), #> "\n"), are_na.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-na.R", #> "\n", list("are_na"), "\n", list("are_na"), "\n", #> list("is_na"), "\n", list("is_lgl_na"), "\n", list( #> "is_int_na"), "\n", list("is_dbl_na"), "\n", #> list("is_chr_na"), "\n", list("is_cpl_na"), "\n", #> list("Test for missing values"), "\n", list("\n", #> "are_na(x)\n", "\n", "is_na(x)\n", "\n", "is_lgl_na(x)\n", #> "\n", "is_int_na(x)\n", "\n", "is_dbl_na(x)\n", #> "\n", "is_chr_na(x)\n", "\n", "is_cpl_na(x)\n"), #> "\n", list("\n", list(list("x"), list("An object to test")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", list("are_na()"), " checks for missing values in a vector and is equivalent\n", #> "to ", list(list("base::is.na()")), ". It is a vectorised predicate, meaning that its\n", #> "output is always the same length as its input. On the other hand,\n", #> list("is_na()"), " is a scalar predicate and always returns a scalar\n", #> "boolean, ", list("TRUE"), " or ", list("FALSE"), #> ". If its input is not scalar, it returns\n", #> list("FALSE"), ". Finally, there are typed versions that check for\n", #> "particular ", list("missing types"), ".\n"), #> "\n", list("\n", "The scalar predicates accept non-vector inputs. They are equivalent\n", #> "to ", list(list("is_null()")), " in that respect. In contrast the vectorised\n", #> "predicate ", list("are_na()"), " requires a vector input since it is defined\n", #> "over vector values.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "These functions might be moved to the vctrs package at some\n", #> "point. This is why they are marked as questioning.\n")), #> "\n", "\n", list("\n", "# are_na() is vectorised and works regardless of the type\n", #> "are_na(c(1, 2, NA))\n", "are_na(c(1L, NA, 3L))\n", #> "\n", "# is_na() checks for scalar input and works for all types\n", #> "is_na(NA)\n", "is_na(na_dbl)\n", "is_na(character(0))\n", #> "\n", "# There are typed versions as well:\n", #> "is_lgl_na(NA)\n", "is_lgl_na(na_dbl)\n"), "\n", #> list("internal"), "\n"), arg_match.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/arg.R", "\n", #> list("arg_match"), "\n", list("arg_match"), "\n", #> list("arg_match0"), "\n", list("Match an argument to a character vector"), #> "\n", list("\n", "arg_match(arg, values = NULL)\n", #> "\n", "arg_match0(arg, values, arg_nm = as_label(substitute(arg)))\n"), #> "\n", list("\n", list(list("arg"), list("A symbol referring to an argument accepting strings.")), #> "\n", "\n", list(list("values"), list("The possible values that ", #> list("arg"), " can take.")), "\n", "\n", list( #> list("arg_nm"), list("The label to be used for ", #> list("arg"), " in error messages.")), "\n"), #> "\n", list("\n", "The string supplied to ", list( #> "arg"), ".\n"), "\n", list("\n", "This is equivalent to ", #> list(list("base::match.arg()")), " with a few differences:\n", #> list("\n", list(), " Partial matches trigger an error.\n", #> list(), " Error messages are a bit more informative and obey the tidyverse\n", #> "standards.\n"), "\n", "\n", list("arg_match()"), #> " derives the possible values from the\n", list( #> "caller frame"), ".\n", "\n", list("arg_match0()"), #> " is a bare-bones version if performance is at a premium.\n", #> "It requires a string as ", list("arg"), " and explicit ", #> list("values"), ".\n", "For convenience, ", list( #> "arg"), " may also be a character vector containing\n", #> "every element of ", list("values"), ", possibly permuted.\n", #> "In this case, the first element of ", list("arg"), #> " is used.\n"), "\n", list("\n", "fn <- function(x = c(\"foo\", \"bar\")) arg_match(x)\n", #> "fn(\"bar\")\n", "\n", "# Throws an informative error for mismatches:\n", #> "try(fn(\"b\"))\n", "try(fn(\"baz\"))\n", "\n", #> "# Use the bare-bones version with explicit values for speed:\n", #> "arg_match0(\"bar\", c(\"foo\", \"bar\", \"baz\"))\n", #> "\n", "# For convenience:\n", "fn1 <- function(x = c(\"bar\", \"baz\", \"foo\")) fn3(x)\n", #> "fn2 <- function(x = c(\"baz\", \"bar\", \"foo\")) fn3(x)\n", #> "fn3 <- function(x) arg_match0(x, c(\"foo\", \"bar\", \"baz\"))\n", #> "fn1()\n", "fn2(\"bar\")\n", "try(fn3(\"zoo\"))\n"), #> "\n"), as_box.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/s3.R", "\n", #> list("as_box"), "\n", list("as_box"), "\n", list( #> "as_box_if"), "\n", list("Convert object to a box"), #> "\n", list("\n", "as_box(x, class = NULL)\n", "\n", #> "as_box_if(.x, .p, .class = NULL, ...)\n"), "\n", #> list("\n", list(list("x"), list("An R object.")), #> "\n", "\n", list(list("class, .class"), list( #> "A box class. If the input is already a box of\n", #> "that class, it is returned as is. If the input needs to be boxed,\n", #> list("class"), " is passed to ", list(list( #> "new_box()")), ".")), "\n", "\n", list(list( #> ".x"), list("An R object.")), "\n", "\n", list( #> list(".p"), list("A predicate function.")), #> "\n", "\n", list(list("..."), list("Arguments passed to ", #> list(".p"), ".")), "\n"), "\n", list("\n", #> list("\n", list(), " ", list("as_box()"), " boxes its input only if it is not already a box. The\n", #> "class is also checked if supplied.\n", list(), #> " ", list("as_box_if()"), " boxes its input only if it not already a box, or if\n", #> "the predicate ", list(".p"), " returns ", #> list("TRUE"), ".\n"), "\n"), "\n"), as_bytes.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/utils-encoding.R", #> "\n", list("as_bytes"), "\n", list("as_bytes"), "\n", #> list("Coerce to a raw vector"), "\n", list("\n", #> "as_bytes(x)\n"), "\n", list("\n", list(list( #> "x"), list("A string.")), "\n"), "\n", list("\n", #> "A raw vector of bytes.\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "This currently only works with strings, and returns its hexadecimal\n", #> "representation.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "Raw vector functions are experimental.\n")), #> "\n", "\n", list("internal"), "\n"), as_data_mask.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/eval-tidy.R", "\n", #> list("as_data_mask"), "\n", list("as_data_mask"), #> "\n", list("as_data_pronoun"), "\n", list("new_data_mask"), #> "\n", list("Create a data mask"), "\n", list("\n", #> "as_data_mask(data)\n", "\n", "as_data_pronoun(data)\n", #> "\n", "new_data_mask(bottom, top = bottom)\n"), #> "\n", list("\n", list(list("data"), list("A data frame or named vector of masking data.")), #> "\n", "\n", list(list("bottom"), list("The environment containing masking objects if the\n", #> "data mask is one environment deep. The bottom environment if the\n", #> "data mask comprises multiple environment.\n", #> "\n", "If you haven't supplied ", list("top"), #> ", this ", list("must"), " be an environment\n", #> "that you own, i.e. that you have created yourself.")), #> "\n", "\n", list(list("top"), list("The last environment of the data mask. If the data mask\n", #> "is only one environment deep, ", list("top"), #> " should be the same as\n", list("bottom"), #> ".\n", "\n", "This ", list("must"), " be an environment that you own, i.e. that you have\n", #> "created yourself. The parent of ", list("top"), #> " will be changed by the tidy\n", "eval engine and should be considered undetermined. Never make\n", #> "assumption about the parent of ", list("top"), #> ".")), "\n"), "\n", list("\n", "A data mask that you can supply to ", #> list(list("eval_tidy()")), ".\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", "A data mask is an environment (or possibly multiple environments\n", #> "forming an ancestry) containing user-supplied objects. Objects in\n", #> "the mask have precedence over objects in the environment (i.e. they\n", #> "mask those objects). Many R functions evaluate quoted expressions\n", #> "in a data mask so these expressions can refer to objects within the\n", #> "user data.\n", "\n", "These functions let you construct a tidy eval data mask manually.\n", #> "They are meant for developers of tidy eval interfaces rather than\n", #> "for end users.\n"), "\n", list(list("Why build a data mask?"), #> list("\n", "\n", "\n", "Most of the time you can just call ", #> list(list("eval_tidy()")), " with a list or a\n", #> "data frame and the data mask will be constructed automatically.\n", #> "There are three main use cases for manual creation of data masks:\n", #> list("\n", list(), " When ", list(list("eval_tidy()")), #> " is called with the same data in a tight loop.\n", #> "Because there is some overhead to creating tidy eval data masks,\n", #> "constructing the mask once and reusing it for subsequent\n", #> "evaluations may improve performance.\n", #> list(), " When several expressions should be evaluated in the exact same\n", #> "environment because a quoted expression might create new objects\n", #> "that can be referred in other quoted expressions evaluated at a\n", #> "later time. One example of this is ", list( #> "tibble::lst()"), " where new\n", "columns can refer to previous ones.\n", #> list(), " When your data mask requires special features. For instance the\n", #> "data frame columns in dplyr data masks are implemented with\n", #> list("active bindings"), ".\n"), "\n")), #> "\n", "\n", list(list("Building your own data mask"), #> list("\n", "\n", "\n", "Unlike ", list(list("base::eval()")), #> " which takes any kind of environments as data\n", #> "mask, ", list(list("eval_tidy()")), " has specific requirements in order to support\n", #> list("quosures"), ". For this reason you can't supply bare\n", #> "environments.\n", "\n", "There are two ways of constructing an rlang data mask manually:\n", #> list("\n", list(), " ", list("as_data_mask()"), #> " transforms a list or data frame to a data mask.\n", #> "It automatically installs the data pronoun ", #> list(list(".data")), ".\n", list(), " ", #> list("new_data_mask()"), " is a bare bones data mask constructor for\n", #> "environments. You can supply a bottom and a top environment in\n", #> "case your data mask comprises multiple environments (see section\n", #> "below).\n", "\n", "Unlike ", list("as_data_mask()"), #> " it does not install the ", list(".data"), #> " pronoun\n", "so you need to provide one yourself. You can provide a pronoun\n", #> "constructed with ", list("as_data_pronoun()"), #> " or your own pronoun class.\n", "\n", list( #> "as_data_pronoun()"), " will create a pronoun from a list, an\n", #> "environment, or an rlang data mask. In the latter case, the whole\n", #> "ancestry is looked up from the bottom to the top of the mask.\n", #> "Functions stored in the mask are bypassed by the pronoun.\n"), #> "\n", "\n", "Once you have built a data mask, simply pass it to ", #> list(list("eval_tidy()")), " as\n", "the ", #> list("data"), " argument. You can repeat this as many times as\n", #> "needed. Note that any objects created there (perhaps because of a\n", #> "call to ", list("<-"), ") will persist in subsequent evaluations.\n")), #> "\n", "\n", list(list("Top and bottom of data mask"), #> list("\n", "\n", "\n", "In some cases you'll need several levels in your data mask. One\n", #> "good reason is when you include functions in the mask. It's a good\n", #> "idea to keep data objects one level lower than function objects, so\n", #> "that the former cannot override the definitions of the latter (see\n", #> "examples).\n", "\n", "In that case, set up all your environments and keep track of the\n", #> "bottom child and the top parent. You'll need to pass both to\n", #> list("new_data_mask()"), ".\n", "\n", "Note that the parent of the top environment is completely\n", #> "undetermined, you shouldn't expect it to remain the same at all\n", #> "times. This parent is replaced during evaluation by ", #> list(list("eval_tidy()")), "\n", "to one of the following environments:\n", #> list("\n", list(), " The default environment passed as the ", #> list("env"), " argument of ", list("eval_tidy()"), #> ".\n", list(), " The environment of the current quosure being evaluated, if applicable.\n"), #> "\n", "\n", "Consequently, all masking data should be contained between the\n", #> "bottom and top environment of the data mask.\n")), #> "\n", "\n", list("\n", "# Evaluating in a tidy evaluation environment enables all tidy\n", #> "# features:\n", "mask <- as_data_mask(mtcars)\n", #> "eval_tidy(quo(letters), mask)\n", "\n", "# You can install new pronouns in the mask:\n", #> "mask$.pronoun <- as_data_pronoun(list(foo = \"bar\", baz = \"bam\"))\n", #> "eval_tidy(quo(.pronoun$foo), mask)\n", "\n", #> "# In some cases the data mask can leak to the user, for example if\n", #> "# a function or formula is created in the data mask environment:\n", #> "cyl <- \"user variable from the context\"\n", #> "fn <- eval_tidy(quote(function() cyl), mask)\n", #> "fn()\n", "\n", "# If new objects are created in the mask, they persist in the\n", #> "# subsequent calls:\n", "eval_tidy(quote(new <- cyl + am), mask)\n", #> "eval_tidy(quote(new * 2), mask)\n", "\n", "\n", #> "# In some cases your data mask is a whole chain of environments\n", #> "# rather than a single environment. You'll have to use\n", #> "# `new_data_mask()` and let it know about the bottom of the mask\n", #> "# (the last child of the environment chain) and the topmost parent.\n", #> "\n", "# A common situation where you'll want a multiple-environment mask\n", #> "# is when you include functions in your mask. In that case you'll\n", #> "# put functions in the top environment and data in the bottom. This\n", #> "# will prevent the data from overwriting the functions.\n", #> "top <- new_environment(list(`+` = base::paste, c = base::paste))\n", #> "\n", "# Let's add a middle environment just for sport:\n", #> "middle <- env(top)\n", "\n", "# And finally the bottom environment containing data:\n", #> "bottom <- env(middle, a = \"a\", b = \"b\", c = \"c\")\n", #> "\n", "# We can now create a mask by supplying the top and bottom\n", #> "# environments:\n", "mask <- new_data_mask(bottom, top = top)\n", #> "\n", "# This data mask can be passed to eval_tidy() instead of a list or\n", #> "# data frame:\n", "eval_tidy(quote(a + b + c), data = mask)\n", #> "\n", "# Note how the function `c()` and the object `c` are looked up\n", #> "# properly because of the multi-level structure:\n", #> "eval_tidy(quote(c(a, b, c)), data = mask)\n", #> "\n", "# new_data_mask() does not create data pronouns, but\n", #> "# data pronouns can be added manually:\n", "mask$.fns <- as_data_pronoun(top)\n", #> "\n", "# The `.data` pronoun should generally be created from the\n", #> "# mask. This will ensure data is looked up throughout the whole\n", #> "# ancestry. Only non-function objects are looked up from this\n", #> "# pronoun:\n", "mask$.data <- as_data_pronoun(mask)\n", #> "mask$.data$c\n", "\n", "# Now we can reference the values with the pronouns:\n", #> "eval_tidy(quote(c(.data$a, .data$b, .data$c)), data = mask)\n"), #> "\n"), as_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("as_env"), "\n", list("as_env"), "\n", #> list("Coerce to an environment"), "\n", list("\n", #> "as_env(x, parent = NULL)\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"deprecated\")"), "\n", #> "\n", "This function is deprecated as it was renamed to ", #> list(list("as_environment()")), "\n", "in rlang 0.2.0.\n"), #> "\n", list("internal"), "\n"), as_environment.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/env.R", "\n", list( #> "as_environment"), "\n", list("as_environment"), #> "\n", list("Coerce to an environment"), "\n", list( #> "\n", "as_environment(x, parent = NULL)\n"), #> "\n", list("\n", list(list("x"), list("An object to coerce.")), #> "\n", "\n", list(list("parent"), list("A parent environment, ", #> list(list("empty_env()")), " by default. This\n", #> "argument is only used when ", list("x"), " is data actually coerced to an\n", #> "environment (as opposed to data representing an environment, like\n", #> list("NULL"), " representing the empty environment).")), #> "\n"), "\n", list("\n", list("as_environment()"), #> " coerces named vectors (including lists) to an\n", #> "environment. The names must be unique. If supplied an unnamed\n", #> "string, it returns the corresponding package environment (see\n", #> list(list("pkg_env()")), ").\n"), "\n", list( #> "\n", "If ", list("x"), " is an environment and ", #> list("parent"), " is not ", list("NULL"), ", the\n", #> "environment is duplicated before being set a new parent. The return\n", #> "value is therefore a different environment than ", #> list("x"), ".\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", list("as_env()"), " was soft-deprecated and renamed to ", #> list("as_environment()"), " in\n", "rlang 0.2.0. This is for consistency as type predicates should not\n", #> "be abbreviated.\n")), "\n", "\n", list("\n", #> "# Coerce a named vector to an environment:\n", #> "env <- as_environment(mtcars)\n", "\n", "# By default it gets the empty environment as parent:\n", #> "identical(env_parent(env), empty_env())\n", #> "\n", "\n", "# With strings it is a handy shortcut for pkg_env():\n", #> "as_environment(\"base\")\n", "as_environment(\"rlang\")\n", #> "\n", "# With NULL it returns the empty environment:\n", #> "as_environment(NULL)\n"), "\n"), as_function.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/fn.R", "\n", list( #> "as_function"), "\n", list("as_function"), "\n", #> list("is_lambda"), "\n", list("as_closure"), "\n", #> list("Convert to function or closure"), "\n", list( #> "\n", "as_function(x, env = caller_env())\n", #> "\n", "is_lambda(x)\n", "\n", "as_closure(x, env = caller_env())\n"), #> "\n", list("\n", list(list("x"), list("A function or formula.\n", #> "\n", "If a ", list("function"), ", it is used as is.\n", #> "\n", "If a ", list("formula"), ", e.g. ", list( #> "~ .x + 2"), ", it is converted to a function\n", #> "with up to two arguments: ", list(".x"), " (single argument) or ", #> list(".x"), " and ", list(".y"), "\n", "(two arguments). The ", #> list("."), " placeholder can be used instead of ", #> list(".x"), ".\n", "This allows you to create very compact anonymous functions (lambdas) with up\n", #> "to two inputs. Functions created from formulas have a special\n", #> "class. Use ", list("is_lambda()"), " to test for it.\n", #> "\n", "Lambdas currently do not support ", list( #> "nse-force"), ",\n", "due to the way the arguments are handled internally.")), #> "\n", "\n", list(list("env"), list("Environment in which to fetch the function in case ", #> list("x"), "\n", "is a string.")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", list("\n", list(), " ", list("as_function()"), #> " transforms a one-sided formula into a function.\n", #> "This powers the lambda syntax in packages like purrr.\n", #> list(), " ", list("as_closure()"), " first passes its argument to ", #> list("as_function()"), ". If\n", "the result is a primitive function, it regularises it to a proper\n", #> list("closure"), " (see ", list(list("is_function()")), #> " about primitive functions). Some\n", "special control flow primitives like ", #> list("if"), ", ", list("for"), ", or ", list( #> "break"), "\n", "can't be coerced to a closure.\n"), #> "\n"), "\n", list("\n", "f <- as_function(~ .x + 1)\n", #> "f(10)\n", "\n", "g <- as_function(~ -1 * .)\n", #> "g(4)\n", "\n", "h <- as_function(~ .x - .y)\n", #> "h(6, 3)\n", "\n", "# Functions created from a formula have a special class:\n", #> "is_lambda(f)\n", "is_lambda(as_function(function() \"foo\"))\n", #> "\n", "# Primitive functions are regularised as closures\n", #> "as_closure(list)\n", "as_closure(\"list\")\n", #> "\n", "# Operators have `.x` and `.y` as arguments, just like lambda\n", #> "# functions created with the formula syntax:\n", #> "as_closure(`+`)\n", "as_closure(`~`)\n", "\n", #> "# Use a regular function for tidy evaluation, also when calling functions\n", #> "# that use tidy evaluation:\n", "## Bad:\n", #> "e <- as_function(~ as_label(ensym(.x)))\n", #> "## Good:\n", "e <- as_function(function(x) as_label(ensym(x)))\n", #> "\n", "e(y)\n"), "\n"), as_label.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/deparse.R", #> "\n", list("as_label"), "\n", list("as_label"), "\n", #> list("Create a default name for an R object"), "\n", #> list("\n", "as_label(x)\n"), "\n", list("\n", list( #> list("x"), list("An object.")), "\n"), "\n", #> list("\n", list("as_label()"), " transforms R objects into a short, human-readable\n", #> "description. You can use labels to:\n", list( #> "\n", list(), " Display an object in a concise way, for example to labellise axes\n", #> "in a graphical plot.\n", list(), " Give default names to columns in a data frame. In this case,\n", #> "labelling is the first step before name repair.\n"), #> "\n", "\n", "See also ", list(list("as_name()")), #> " for transforming symbols back to a\n", "string. Unlike ", #> list("as_label()"), ", ", list("as_string()"), #> " is a well defined\n", "operation that guarantees the roundtrip symbol -> string ->\n", #> "symbol.\n", "\n", "In general, if you don't know for sure what kind of object you're\n", #> "dealing with (a call, a symbol, an unquoted constant), use\n", #> list("as_label()"), " and make no assumption about the resulting string. If\n", #> "you know you have a symbol and need the name of the object it\n", #> "refers to, use ", list(list("as_string()")), #> ". For instance, use ", list("as_label()"), " with\n", #> "objects captured with ", list("enquo()"), " and ", #> list("as_string()"), " with symbols\n", "captured with ", #> list("ensym()"), ".\n"), "\n", list(list("Transformation to string"), #> list("\n", "\n", list("\n", list(), " Quosures are ", #> list("squashed"), " before being labelled.\n", #> list(), " Symbols are transformed to string with ", #> list("as_string()"), ".\n", list(), " Calls are abbreviated.\n", #> list(), " Numbers are represented as such.\n", #> list(), " Other constants are represented by their type, such as ", #> list("<dbl>"), "\n", "or ", list("<data.frame>"), #> ".\n"), "\n", "\n", "Note that simple symbols should generally be transformed to strings\n", #> "with ", list(list("as_name()")), ". Labelling is not a well defined operation and\n", #> "no assumption should be made about how the label is created. On the\n", #> "other hand, ", list("as_name()"), " only works with symbols and is a well\n", #> "defined, deterministic operation.\n")), "\n", #> "\n", list("\n", "# as_label() is useful with quoted expressions:\n", #> "as_label(expr(foo(bar)))\n", "as_label(expr(foobar))\n", #> "\n", "# It works with any R object. This is also useful for quoted\n", #> "# arguments because the user might unquote constant objects:\n", #> "as_label(1:3)\n", "as_label(base::list)\n"), #> "\n", list("\n", list(list("as_name()")), " for transforming symbols back to a string\n", #> "deterministically.\n"), "\n"), as_name.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/deparse.R", "\n", #> list("as_name"), "\n", list("as_name"), "\n", list( #> "Extract names from symbols"), "\n", list("\n", #> "as_name(x)\n"), "\n", list("\n", list(list("x"), #> list("A string or symbol, possibly wrapped in a ", #> list("quosure"), ".\n", "If a string, the attributes are removed, if any.")), #> "\n"), "\n", list("\n", "A character vector of length 1.\n"), #> "\n", list("\n", list("as_name()"), " converts ", #> list("symbols"), " to character strings. The\n", #> "conversion is deterministic. That is, the roundtrip symbol -> name\n", #> "-> symbol always gets the same result.\n", list( #> "\n", list(), " Use ", list("as_name()"), " when you need to transform a symbol to a string\n", #> "to ", list("refer"), " to an object by its name.\n", #> list(), " Use ", list(list("as_label()")), #> " when you need to transform any kind of object to\n", #> "a string to ", list("represent"), " that object with a short description.\n"), #> "\n", "\n", "Expect ", list("as_name()"), " to gain\n", #> list(list("https://principles.tidyverse.org/names-attribute.html#minimal-unique-universal"), #> list("name-repairing")), "\n", "features in the future.\n", #> "\n", "Note that ", list("rlang::as_name()"), #> " is the ", list("opposite"), " of\n", list(list( #> "base::as.name()")), ". If you're writing base R code, we recommend\n", #> "using ", list(list("base::as.symbol()")), " which is an alias of ", #> list("as.name()"), " that\n", "follows a more modern terminology (R types instead of S modes).\n"), #> "\n", list("\n", "# Let's create some symbols:\n", #> "foo <- quote(foo)\n", "bar <- sym(\"bar\")\n", #> "\n", "# as_name() converts symbols to strings:\n", #> "foo\n", "as_name(foo)\n", "\n", "typeof(bar)\n", #> "typeof(as_name(bar))\n", "\n", "# as_name() unwraps quosured symbols automatically:\n", #> "as_name(quo(foo))\n"), "\n", list("\n", list( #> list("as_label()")), " for converting any object to a single string\n", #> "suitable as a label. ", list(list("as_string()")), #> " for a lower-level version that\n", "doesn't unwrap quosures.\n"), #> "\n"), as_overscope.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("as_overscope"), "\n", list("as_overscope"), #> "\n", list("new_overscope"), "\n", list("overscope_clean"), #> "\n", list("Create an overscope"), "\n", list("\n", #> "as_overscope(quo, data = NULL)\n", "\n", "new_overscope(bottom, top = NULL, enclosure = NULL)\n", #> "\n", "overscope_clean(overscope)\n"), "\n", #> list("\n", list(list("quo"), list("A ", list("quosure"), #> ".")), "\n", "\n", list(list("data"), list("A data frame or named vector of masking data.")), #> "\n", "\n", list(list("bottom"), list("The environment containing masking objects if the\n", #> "data mask is one environment deep. The bottom environment if the\n", #> "data mask comprises multiple environment.\n", #> "\n", "If you haven't supplied ", list("top"), #> ", this ", list("must"), " be an environment\n", #> "that you own, i.e. that you have created yourself.")), #> "\n", "\n", list(list("top"), list("The last environment of the data mask. If the data mask\n", #> "is only one environment deep, ", list("top"), #> " should be the same as\n", list("bottom"), #> ".\n", "\n", "This ", list("must"), " be an environment that you own, i.e. that you have\n", #> "created yourself. The parent of ", list("top"), #> " will be changed by the tidy\n", "eval engine and should be considered undetermined. Never make\n", #> "assumption about the parent of ", list("top"), #> ".")), "\n", "\n", list(list("enclosure"), #> list("The ", list("parent"), " argument of ", #> list(list("new_data_mask()")), ".")), "\n", #> "\n", list(list("overscope"), list("A data mask.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions have been deprecated in rlang 0.2.0. Please use\n", #> list(list("as_data_mask()")), " and ", list(list( #> "new_data_mask()")), " instead. We no longer\n", #> "require the mask to be cleaned up so ", list( #> "overscope_clean()"), " does not\n", "have a replacement.\n"), #> "\n", list("internal"), "\n"), as_pairlist.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/node.R", "\n", #> list("as_pairlist"), "\n", list("as_pairlist"), "\n", #> list("Coerce to pairlist"), "\n", list("\n", "as_pairlist(x)\n"), #> "\n", list("\n", list(list("x"), list("An object to coerce.")), #> "\n"), "\n", list("\n", "This transforms vector objects to a linked pairlist of nodes. See\n", #> "the ", list("pairlist"), " type help page.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", "\n", #> list("as_pairlist()"), " is experimental because we are still figuring out\n", #> "the naming scheme for pairlists and node-like objects.\n")), #> "\n", "\n", list("internal"), "\n"), as_quosure.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/quo.R", "\n", list( #> "as_quosure"), "\n", list("as_quosure"), "\n", #> list("new_quosure"), "\n", list("Coerce object to quosure"), #> "\n", list("\n", "as_quosure(x, env = NULL)\n", "\n", #> "new_quosure(expr, env = caller_env())\n"), "\n", #> list("\n", list(list("x"), list("An object to convert. Either an ", #> list("expression"), " or a\n", "formula.")), #> "\n", "\n", list(list("env"), list("The environment in which the expression should be\n", #> "evaluated. Only used for symbols and calls. This should typically\n", #> "be the environment in which the expression was created.")), #> "\n", "\n", list(list("expr"), list("The expression wrapped by the quosure.")), #> "\n"), "\n", list("\n", "While ", list("new_quosure()"), #> " wraps any R object (including expressions,\n", #> "formulas, or other quosures) into a quosure, ", #> list("as_quosure()"), "\n", "converts formulas and quosures and does not double-wrap.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", list( #> "\n", list(), " ", list("as_quosure()"), " now requires an explicit default environment for\n", #> "creating quosures from symbols and calls.\n", #> list(), " ", list("as_quosureish()"), " is deprecated as of rlang 0.2.0. This function\n", #> "assumes that quosures are formulas which is currently true but\n", #> "might not be in the future.\n"), "\n")), "\n", #> "\n", list("\n", "# as_quosure() converts expressions or any R object to a validly\n", #> "# scoped quosure:\n", "env <- env(var = \"thing\")\n", #> "as_quosure(quote(var), env)\n", "\n", "\n", #> "# The environment is ignored for formulas:\n", #> "as_quosure(~foo, env)\n", "as_quosure(~foo)\n", #> "\n", "# However you must supply it for symbols and calls:\n", #> "try(as_quosure(quote(var)))\n"), "\n", list( #> "\n", list(list("quo()")), ", ", list(list("is_quosure()")), #> "\n"), "\n"), as_string.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/sym.R", "\n", #> list("as_string"), "\n", list("as_string"), "\n", #> list("Cast symbol to string"), "\n", list("\n", "as_string(x)\n"), #> "\n", list("\n", list(list("x"), list("A string or symbol. If a string, the attributes are\n", #> "removed, if any.")), "\n"), "\n", list("\n", #> "A character vector of length 1.\n"), "\n", list( #> "\n", list("as_string()"), " converts ", list( #> "symbols"), " to character strings.\n"), "\n", #> list(list("Unicode tags"), list("\n", "\n", "\n", #> "Unlike ", list(list("base::as.symbol()")), " and ", #> list(list("base::as.name()")), ", ", list("as_string()"), #> "\n", "automatically transforms unicode tags such as ", #> list("\"<U+5E78>\""), " to the\n", "proper UTF-8 character. This is important on Windows because:\n", #> list("\n", list(), " R on Windows has no UTF-8 support, and uses native encoding instead.\n", #> list(), " The native encodings do not cover all Unicode characters. For\n", #> "example, Western encodings do not support CKJ characters.\n", #> list(), " When a lossy UTF-8 -> native transformation occurs, uncovered\n", #> "characters are transformed to an ASCII unicode tag like ", #> list("\"<U+5E78>\""), ".\n", list(), " Symbols are always encoded in native. This means that\n", #> "transforming the column names of a data frame to symbols might be\n", #> "a lossy operation.\n", list(), " This operation is very common in the tidyverse because of data\n", #> "masking APIs like dplyr where data frames are transformed to\n", #> "environments. While the names of a data frame are stored as a\n", #> "character vector, the bindings of environments are stored as\n", #> "symbols.\n"), "\n", "\n", "Because it reencodes the ASCII unicode tags to their UTF-8\n", #> "representation, the string -> symbol -> string roundtrip is\n", #> "more stable with ", list("as_string()"), ".\n")), #> "\n", "\n", list("\n", "# Let's create some symbols:\n", #> "foo <- quote(foo)\n", "bar <- sym(\"bar\")\n", #> "\n", "# as_string() converts symbols to strings:\n", #> "foo\n", "as_string(foo)\n", "\n", "typeof(bar)\n", #> "typeof(as_string(bar))\n"), "\n", list("\n", #> list(list("as_name()")), " for a higher-level variant of ", #> list("as_string()"), "\n", "that automatically unwraps quosures.\n"), #> "\n"), as_utf8_character.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/utils-encoding.R", #> "\n", list("as_utf8_character"), "\n", list("as_utf8_character"), #> "\n", list("Coerce to a character vector and attempt encoding conversion"), #> "\n", list("\n", "as_utf8_character(x)\n"), "\n", #> list("\n", list(list("x"), list("An object to coerce.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "Unlike specifying the ", list("encoding"), #> " argument in ", list("as_string()"), " and\n", #> list("as_character()"), ", which is only declarative, these functions\n", #> "actually attempt to convert the encoding of their input. There are\n", #> "two possible cases:\n", list("\n", list(), " The string is tagged as UTF-8 or latin1, the only two encodings\n", #> "for which R has specific support. In this case, converting to the\n", #> "same encoding is a no-op, and converting to native always works\n", #> "as expected, as long as the native encoding, the one specified by\n", #> "the ", list("LC_CTYPE"), " locale has support for all characters occurring in\n", #> "the strings. Unrepresentable characters are serialised as unicode\n", #> "points: \"<U+xxxx>\".\n", list(), " The string is not tagged. R assumes that it is encoded in the\n", #> "native encoding. Conversion to native is a no-op, and conversion\n", #> "to UTF-8 should work as long as the string is actually encoded in\n", #> "the locale codeset.\n"), "\n", "\n", "When translating to UTF-8, the strings are parsed for serialised\n", #> "unicode points (e.g. strings looking like \"U+xxxx\") with\n", #> list(list("chr_unserialise_unicode()")), ". This helps to alleviate the effects of\n", #> "character-to-symbol-to-character roundtrips on systems with\n", #> "non-UTF-8 native encoding.\n"), "\n", list("\n", #> "# Let's create a string marked as UTF-8 (which is guaranteed by the\n", #> "# Unicode escaping in the string):\n", "utf8 <- \"caf\\uE9\"\n", #> "Encoding(utf8)\n", "as_bytes(utf8)\n"), "\n", #> list("internal"), "\n"), `bare-type-predicates.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/types.R", "\n", #> list("bare-type-predicates"), "\n", list("bare-type-predicates"), #> "\n", list("is_bare_list"), "\n", list("is_bare_atomic"), #> "\n", list("is_bare_vector"), "\n", list("is_bare_double"), #> "\n", list("is_bare_integer"), "\n", list("is_bare_numeric"), #> "\n", list("is_bare_character"), "\n", list("is_bare_logical"), #> "\n", list("is_bare_raw"), "\n", list("is_bare_string"), #> "\n", list("is_bare_bytes"), "\n", list("Bare type predicates"), #> "\n", list("\n", "is_bare_list(x, n = NULL)\n", "\n", #> "is_bare_atomic(x, n = NULL)\n", "\n", "is_bare_vector(x, n = NULL)\n", #> "\n", "is_bare_double(x, n = NULL)\n", "\n", #> "is_bare_integer(x, n = NULL)\n", "\n", "is_bare_numeric(x, n = NULL)\n", #> "\n", "is_bare_character(x, n = NULL)\n", "\n", #> "is_bare_logical(x, n = NULL)\n", "\n", "is_bare_raw(x, n = NULL)\n", #> "\n", "is_bare_string(x, n = NULL)\n", "\n", #> "is_bare_bytes(x, n = NULL)\n"), "\n", list("\n", #> list(list("x"), list("Object to be tested.")), #> "\n", "\n", list(list("n"), list("Expected length of a vector.")), #> "\n"), "\n", list("\n", "These predicates check for a given type but only return ", #> list("TRUE"), " for\n", "bare R objects. Bare objects have no class attributes. For example,\n", #> "a data frame is a list, but not a bare list.\n"), #> "\n", list("\n", list("\n", list(), " The predicates for vectors include the ", #> list("n"), " argument for\n", "pattern-matching on the vector length.\n", #> list(), " Like ", list(list("is_atomic()")), #> " and unlike base R ", list("is.atomic()"), ",\n", #> list("is_bare_atomic()"), " does not return ", #> list("TRUE"), " for ", list("NULL"), ".\n", list(), #> " Unlike base R ", list("is.numeric()"), ", ", #> list("is_bare_double()"), " only returns\n", #> list("TRUE"), " for floating point numbers.\n"), #> "\n"), "\n", list("\n", list("type-predicates"), #> ", ", list("scalar-type-predicates"), "\n"), #> "\n"), box.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/s3.R", "\n", #> list("box"), "\n", list("box"), "\n", list("new_box"), #> "\n", list("is_box"), "\n", list("unbox"), "\n", #> list("Box a value"), "\n", list("\n", "new_box(.x, class = NULL, ...)\n", #> "\n", "is_box(x, class = NULL)\n", "\n", "unbox(box)\n"), #> "\n", list("\n", list(list("class"), list("For ", #> list("new_box()"), ", an additional class for the\n", #> "boxed value (in addition to ", list("rlang_box"), #> "). For ", list("is_box()"), ", a class\n", "or vector of classes passed to ", #> list(list("inherits_all()")), ".")), "\n", "\n", #> list(list("..."), list("Additional attributes passed to ", #> list(list("base::structure()")), ".")), "\n", #> "\n", list(list("x, .x"), list("An R object.")), #> "\n", "\n", list(list("box"), list("A boxed value to unbox.")), #> "\n"), "\n", list("\n", list("new_box()"), " is similar to ", #> list(list("base::I()")), " but it protects a value by\n", #> "wrapping it in a scalar list rather than by adding an attribute.\n", #> list("unbox()"), " retrieves the boxed value. ", #> list("is_box()"), " tests whether an\n", "object is boxed with optional class. ", #> list("as_box()"), " ensures that a\n", "value is wrapped in a box. ", #> list("as_box_if()"), " does the same but only if\n", #> "the value matches a predicate.\n"), "\n", list( #> "\n", "boxed <- new_box(letters, \"mybox\")\n", #> "is_box(boxed)\n", "is_box(boxed, \"mybox\")\n", #> "is_box(boxed, \"otherbox\")\n", "\n", "unbox(boxed)\n", #> "\n", "# as_box() avoids double-boxing:\n", "boxed2 <- as_box(boxed, \"mybox\")\n", #> "boxed2\n", "unbox(boxed2)\n", "\n", "# Compare to:\n", #> "boxed_boxed <- new_box(boxed, \"mybox\")\n", #> "boxed_boxed\n", "unbox(unbox(boxed_boxed))\n", #> "\n", "# Use `as_box_if()` with a predicate if you need to ensure a box\n", #> "# only for a subset of values:\n", "as_box_if(NULL, is_null, \"null_box\")\n", #> "as_box_if(\"foo\", is_null, \"null_box\")\n"), #> "\n"), call2.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call2"), "\n", list("call2"), "\n", list( #> "Create a call"), "\n", list("\n", "call2(.fn, ..., .ns = NULL)\n"), #> "\n", list("\n", list(list(".fn"), list("Function to call. Must be a callable object: a string,\n", #> "symbol, call, or a function.")), "\n", "\n", #> list(list("..."), list("<", list("dynamic"), #> "> Arguments for the function\n", "call. Empty arguments are preserved.")), #> "\n", "\n", list(list(".ns"), list("Namespace with which to prefix ", #> list(".fn"), ". Must be a string\n", "or symbol.")), #> "\n"), "\n", list("\n", "Quoted function calls are one of the two types of\n", #> list("symbolic"), " objects in R. They represent the action of\n", #> "calling a function, possibly with arguments. There are two ways of\n", #> "creating a quoted call:\n", list("\n", list(), #> " By ", list("quoting"), " it. Quoting prevents functions from being\n", #> "called. Instead, you get the description of the function call as\n", #> "an R object. That is, a quoted function call.\n", #> list(), " By constructing it with ", list(list( #> "base::call()")), ", ", list(list("base::as.call()")), #> ", or\n", list("call2()"), ". In this case, you pass the call elements (the function\n", #> "to call and the arguments to call it with) separately.\n"), #> "\n", "\n", "See section below for the difference between ", #> list("call2()"), " and the base\n", "constructors.\n"), #> "\n", list(list("Difference with base constructors"), #> list("\n", "\n", "\n", list("call2()"), " is more flexible and convenient than ", #> list("base::call()"), ":\n", list("\n", list(), #> " The function to call can be a string or a ", #> list("callable"), "\n", "object: a symbol, another call (e.g. a ", #> list("$"), " or ", list("[["), " call), or a\n", #> "function to inline. ", list("base::call()"), #> " only supports strings and you\n", "need to use ", #> list("base::as.call()"), " to construct a call with a callable\n", #> "object.", list("call2(list, 1, 2)\n", "\n", #> "as.call(list(list, 1, 2))\n"), "\n", list(), #> " The ", list(".ns"), " argument is convenient for creating namespaced calls.", #> list("call2(\"list\", 1, 2, .ns = \"base\")\n", #> "\n", "ns_call <- as.call(list(as.name(\"::\"), as.name(\"list\"), as.name(\"base\")))\n", #> "as.call(list(ns_call, 1, 2))\n"), "\n", #> list(), " ", list("call2()"), " has ", list( #> "tidy dots"), " support and you can splice lists\n", #> "of arguments with ", list("!!!"), ". With base R, you need to use ", #> list("as.call()"), "\n", "instead of ", list( #> "call()"), " if the arguments are in a list.", #> list("args <- list(na.rm = TRUE, trim = 0)\n", #> "\n", "call2(\"mean\", 1:10, !!!args)\n", #> "\n", "as.call(c(list(as.name(\"mean\"), 1:10), args))\n"), #> "\n"), "\n")), "\n", "\n", list(list("Caveats of inlining objects in calls"), #> list("\n", "\n", "\n", list("call2()"), " makes it possible to inline objects in calls, both in\n", #> "function and argument positions. Inlining an object or a function\n", #> "has the advantage that the correct object is used in all\n", #> "environments. If all components of the code are inlined, you can\n", #> "even evaluate in the ", list("empty environment"), #> ".\n", "\n", "However inlining also has drawbacks. It can cause issues with NSE\n", #> "functions that expect symbolic arguments. The objects may also leak\n", #> "in representations of the call stack, such as ", #> list(list("traceback()")), ".\n")), "\n", "\n", #> list("\n", "# fn can either be a string, a symbol or a call\n", #> "call2(\"f\", a = 1)\n", "call2(quote(f), a = 1)\n", #> "call2(quote(f()), a = 1)\n", "\n", "#' Can supply arguments individually or in a list\n", #> "call2(quote(f), a = 1, b = 2)\n", "call2(quote(f), !!!list(a = 1, b = 2))\n", #> "\n", "# Creating namespaced calls is easy:\n", #> "call2(\"fun\", arg = quote(baz), .ns = \"mypkg\")\n", #> "\n", "# Empty arguments are preserved:\n", "call2(\"[\", quote(x), , drop = )\n"), #> "\n", list("\n", "call_modify\n"), "\n"), call_args.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/call.R", "\n", #> list("call_args"), "\n", list("call_args"), "\n", #> list("call_args_names"), "\n", list("Extract arguments from a call"), #> "\n", list("\n", "call_args(call)\n", "\n", "call_args_names(call)\n"), #> "\n", list("\n", list(list("call"), list("Can be a call or a quosure that wraps a call.")), #> "\n"), "\n", list("\n", "A named list of arguments.\n"), #> "\n", list("\n", "Extract arguments from a call\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", "\n", #> "In rlang 0.2.0, ", list("lang_args()"), " and ", #> list("lang_args_names()"), " were\n", "deprecated and renamed to ", #> list("call_args()"), " and ", list("call_args_names()"), #> ".\n", "See lifecycle section in ", list(list( #> "call2()")), " for more about this change.\n")), #> "\n", "\n", list("\n", "call <- quote(f(a, b))\n", #> "\n", "# Subsetting a call returns the arguments converted to a language\n", #> "# object:\n", "call[-1]\n", "\n", "# On the other hand, call_args() returns a regular list that is\n", #> "# often easier to work with:\n", "str(call_args(call))\n", #> "\n", "# When the arguments are unnamed, a vector of empty strings is\n", #> "# supplied (rather than NULL):\n", "call_args_names(call)\n"), #> "\n", list("\n", list(list("fn_fmls()")), " and ", #> list(list("fn_fmls_names()")), "\n"), "\n"), #> call_fn.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call_fn"), "\n", list("call_fn"), #> "\n", list("Extract function from a call"), "\n", #> list("\n", "call_fn(call, env = caller_env())\n"), #> "\n", list("\n", list(list("call"), list("Can be a call or a quosure that wraps a call.")), #> "\n", "\n", list(list("env"), list("The environment where to find the definition of the\n", #> "function quoted in ", list("call"), " in case ", #> list("call"), " is not wrapped in a\n", "quosure.")), #> "\n"), "\n", list("\n", "If a frame or formula, the function will be retrieved from the\n", #> "associated environment. Otherwise, it is looked up in the calling\n", #> "frame.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "In rlang 0.2.0, ", #> list("lang_fn()"), " was deprecated and renamed to\n", #> list("call_fn()"), ". See lifecycle section in ", #> list(list("call2()")), " for more about this\n", #> "change.\n")), "\n", "\n", list("\n", "# Extract from a quoted call:\n", #> "call_fn(quote(matrix()))\n", "call_fn(quo(matrix()))\n", #> "\n", "# Extract the calling function\n", "test <- function() call_fn(call_frame())\n", #> "test()\n"), "\n", list("\n", list(list("call_name()")), #> "\n"), "\n"), call_inspect.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/stack.R", #> "\n", list("call_inspect"), "\n", list("call_inspect"), #> "\n", list("Inspect a call"), "\n", list("\n", #> "call_inspect(...)\n"), "\n", list("\n", list( #> list("..."), list("Arguments to display in the returned call.")), #> "\n"), "\n", list("\n", "This function is useful for quick testing and debugging when you\n", #> "manipulate expressions and calls. It lets you check that a function\n", #> "is called with the right arguments. This can be useful in unit\n", #> "tests for instance. Note that this is just a simple wrapper around\n", #> list(list("base::match.call()")), ".\n"), "\n", #> list("\n", "call_inspect(foo(bar), \"\" %>% identity())\n"), #> "\n"), call_modify.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call_modify"), "\n", list("call_modify"), #> "\n", list("Modify the arguments of a call"), #> "\n", list("\n", "call_modify(\n", " .call,\n", #> " ...,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .standardise = NULL,\n", " .env = caller_env()\n", #> ")\n"), "\n", list("\n", list(list(".call"), #> list("Can be a call, a formula quoting a call in the\n", #> "right-hand side, or a frame object from which to extract the call\n", #> "expression.")), "\n", "\n", list(list("..."), #> list("<", list("dynamic"), "> Named or unnamed expressions\n", #> "(constants, names or calls) used to modify the call. Use ", #> list(list("zap()")), "\n", "to remove arguments. Empty arguments are preserved.")), #> "\n", "\n", list(list(".homonyms"), list("How to treat arguments with the same name. The\n", #> "default, ", list("\"keep\""), ", preserves these arguments. Set ", #> list(".homonyms"), " to\n", list("\"first\""), #> " to only keep the first occurrences, to ", #> list("\"last\""), " to keep\n", "the last occurrences, and to ", #> list("\"error\""), " to raise an informative\n", #> "error and indicate what arguments have duplicated names.")), #> "\n", "\n", list(list(".standardise, .env"), #> list("Soft-deprecated as of rlang 0.3.0. Please\n", #> "call ", list(list("call_standardise()")), #> " manually.")), "\n"), "\n", list("\n", #> "A quosure if ", list(".call"), " is a quosure, a call otherwise.\n"), #> "\n", list("\n", "If you are working with a user-supplied call, make sure the\n", #> "arguments are standardised with ", list(list( #> "call_standardise()")), " before\n", "modifying the call.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> list("\n", list(), " The ", list(".standardise"), #> " argument is deprecated as of rlang 0.3.0.\n", #> list(), " In rlang 0.2.0, ", list("lang_modify()"), #> " was deprecated and renamed to\n", list( #> "call_modify()"), ". See lifecycle section in ", #> list(list("call2()")), " for more about\n", #> "this change.\n"), "\n")), "\n", "\n", list( #> "\n", "call <- quote(mean(x, na.rm = TRUE))\n", #> "\n", "# Modify an existing argument\n", "call_modify(call, na.rm = FALSE)\n", #> "call_modify(call, x = quote(y))\n", "\n", #> "# Remove an argument\n", "call_modify(call, na.rm = zap())\n", #> "\n", "# Add a new argument\n", "call_modify(call, trim = 0.1)\n", #> "\n", "# Add an explicit missing argument:\n", #> "call_modify(call, na.rm = )\n", "\n", "# Supply a list of new arguments with `!!!`\n", #> "newargs <- list(na.rm = NULL, trim = 0.1)\n", #> "call <- call_modify(call, !!!newargs)\n", #> "call\n", "\n", "# Remove multiple arguments by splicing zaps:\n", #> "newargs <- rep_named(c(\"na.rm\", \"trim\"), list(zap()))\n", #> "call <- call_modify(call, !!!newargs)\n", #> "call\n", "\n", "\n", "# Modify the `...` arguments as if it were a named argument:\n", #> "call <- call_modify(call, ... = )\n", "call\n", #> "\n", "call <- call_modify(call, ... = zap())\n", #> "call\n", "\n", "\n", "# When you're working with a user-supplied call, standardise it\n", #> "# beforehand because it might contain unmatched arguments:\n", #> "user_call <- quote(matrix(x, nc = 3))\n", #> "call_modify(user_call, ncol = 1)\n", "\n", #> "# Standardising applies the usual argument matching rules:\n", #> "user_call <- call_standardise(user_call)\n", #> "user_call\n", "call_modify(user_call, ncol = 1)\n", #> "\n", "\n", "# You can also modify quosures inplace:\n", #> "f <- quo(matrix(bar))\n", "call_modify(f, quote(foo))\n", #> "\n", "\n", "# By default, arguments with the same name are kept. This has\n", #> "# subtle implications, for instance you can move an argument to\n", #> "# last position by removing it and remapping it:\n", #> "call <- quote(foo(bar = , baz))\n", "call_modify(call, bar = NULL, bar = missing_arg())\n", #> "\n", "# You can also choose to keep only the first or last homonym\n", #> "# arguments:\n", "args <- list(bar = NULL, bar = missing_arg())\n", #> "call_modify(call, !!!args, .homonyms = \"first\")\n", #> "call_modify(call, !!!args, .homonyms = \"last\")\n"), #> "\n"), call_name.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call_name"), "\n", list("call_name"), #> "\n", list("call_ns"), "\n", list("Extract function name or namespace of a call"), #> "\n", list("\n", "call_name(call)\n", "\n", "call_ns(call)\n"), #> "\n", list("\n", list(list("call"), list("Can be a call or a quosure that wraps a call.")), #> "\n"), "\n", list("\n", "A string with the function name, or ", #> list("NULL"), " if the function\n", "is anonymous.\n"), #> "\n", list("\n", "Extract function name or namespace of a call\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "In rlang 0.2.0, ", list("lang_name()"), #> " was deprecated and renamed to\n", list("call_name()"), #> ". See lifecycle section in ", list(list("call2()")), #> " for more about\n", "this change.\n")), "\n", #> "\n", list("\n", "# Extract the function name from quoted calls:\n", #> "call_name(quote(foo(bar)))\n", "call_name(quo(foo(bar)))\n", #> "\n", "# Namespaced calls are correctly handled:\n", #> "call_name(~base::matrix(baz))\n", "\n", "# Anonymous and subsetted functions return NULL:\n", #> "call_name(quote(foo$bar()))\n", "call_name(quote(foo[[bar]]()))\n", #> "call_name(quote(foo()()))\n", "\n", "# Extract namespace of a call with call_ns():\n", #> "call_ns(quote(base::bar()))\n", "\n", "# If not namespaced, call_ns() returns NULL:\n", #> "call_ns(quote(bar()))\n"), "\n", list("\n", #> list(list("call_fn()")), "\n"), "\n"), call_parse_type.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call_parse_type"), "\n", list("call_parse_type"), #> "\n", list("What is the parser type of a call?"), #> "\n", list("\n", "call_parse_type(call)\n"), #> "\n", list("\n", "What is the parser type of a call?\n"), #> "\n", list("internal"), "\n"), call_standardise.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call_standardise"), "\n", list("call_standardise"), #> "\n", list("Standardise a call"), "\n", list( #> "\n", "call_standardise(call, env = caller_env())\n"), #> "\n", list("\n", list(list("call"), list("Can be a call or a quosure that wraps a call.")), #> "\n", "\n", list(list("env"), list("The environment where to find the definition of the\n", #> "function quoted in ", list("call"), " in case ", #> list("call"), " is not wrapped in a\n", "quosure.")), #> "\n"), "\n", list("\n", "A quosure if ", list( #> "call"), " is a quosure, a raw call otherwise.\n"), #> "\n", list("\n", "This is essentially equivalent to ", #> list(list("base::match.call()")), ", but with\n", #> "experimental handling of primitive functions.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "In rlang 0.2.0, ", list("lang_standardise()"), #> " was deprecated and renamed to\n", list("call_standardise()"), #> ". See lifecycle section in ", list(list("call2()")), #> " for more\n", "about this change.\n")), "\n", #> "\n"), caller_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("caller_env"), "\n", list("caller_env"), #> "\n", list("current_env"), "\n", list("Get the current or caller environment"), #> "\n", list("\n", "caller_env(n = 1)\n", "\n", #> "current_env()\n"), "\n", list("\n", list(list( #> "n"), list("Number of frames to go back.")), #> "\n"), "\n", list("\n", list("\n", list(), #> " The current environment is the execution environment of the\n", #> "current function (the one currently being evaluated).\n", #> list(), " The caller environment is the execution environment of the\n", #> "function that called the current function.\n"), #> "\n"), "\n", list("\n", "if (FALSE) {\n", "\n", #> "# Let's create a function that returns its current environment and\n", #> "# its caller environment:\n", "fn <- function() list(current = current_env(), caller = caller_env())\n", #> "\n", "# The current environment is an unique execution environment\n", #> "# created when `fn()` was called. The caller environment is the\n", #> "# global env because that's where we called `fn()`.\n", #> "fn()\n", "\n", "# Let's call `fn()` again but this time within a function:\n", #> "g <- function() fn()\n", "\n", "# Now the caller environment is also a unique execution environment.\n", #> "# This is the exec env created by R for our call to g():\n", #> "g()\n", "\n", "}\n"), "\n", list("\n", list( #> list("caller_frame()")), " and ", list(list( #> "current_frame()")), "\n"), "\n"), caller_fn.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/stack.R", #> "\n", list("caller_fn"), "\n", list("caller_fn"), #> "\n", list("current_fn"), "\n", list("Get properties of the current or caller frame"), #> "\n", list("\n", "caller_fn(n = 1)\n", "\n", #> "current_fn()\n"), "\n", list("\n", list(list( #> "n"), list("The number of generations to go back.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", list("\n", list(), " The current frame is the execution context of the function that\n", #> "is currently being evaluated.\n", list(), #> " The caller frame is the execution context of the function that\n", #> "called the function currently being evaluated.\n"), #> "\n", "\n", "See the ", list("call stack"), #> " topic for more information.\n"), "\n", list( #> list("Life cycle"), list("\n", "\n", "\n", #> "These functions are experimental.\n")), #> "\n", "\n", list("\n", list(list("caller_env()")), #> " and ", list(list("current_env()")), "\n"), #> "\n", list("internal"), "\n"), caller_frame.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("caller_frame"), "\n", list("caller_frame"), #> "\n", list("Get caller frame"), "\n", list("\n", #> "caller_frame(n = 1)\n"), "\n", list("\n", #> list(list("n"), list("Number of frames to go back.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n"), "\n", list("internal"), "\n"), catch_cnd.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-handlers.R", #> "\n", list("catch_cnd"), "\n", list("catch_cnd"), #> "\n", list("Catch a condition"), "\n", list("\n", #> "catch_cnd(expr, classes = \"condition\")\n"), #> "\n", list("\n", list(list("expr"), list("Expression to be evaluated with a catching condition\n", #> "handler.")), "\n", "\n", list(list("classes"), #> list("A character vector of condition classes to catch. By\n", #> "default, catches all conditions.")), "\n"), #> "\n", list("\n", "A condition if any was signalled, ", #> list("NULL"), " otherwise.\n"), "\n", list( #> "\n", "This is a small wrapper around ", list( #> "tryCatch()"), " that captures any\n", "condition signalled while evaluating its argument. It is useful for\n", #> "situations where you expect a specific condition to be signalled,\n", #> "for debugging, and for unit testing.\n"), #> "\n", list("\n", "catch_cnd(10)\n", "catch_cnd(abort(\"an error\"))\n", #> "catch_cnd(signal(\"my_condition\", message = \"a condition\"))\n"), #> "\n"), chr_unserialise_unicode.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/utils-encoding.R", #> "\n", list("chr_unserialise_unicode"), "\n", #> list("chr_unserialise_unicode"), "\n", list("Translate unicode points to UTF-8"), #> "\n", list("\n", "chr_unserialise_unicode(chr)\n"), #> "\n", list("\n", list(list("chr"), list("A character vector.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "For historical reasons, R translates strings to the native encoding\n", #> "when they are converted to symbols. This string-to-symbol\n", #> "conversion is not a rare occurrence and happens for instance to the\n", #> "names of a list of arguments converted to a call by ", #> list("do.call()"), ".\n", "\n", "If the string contains unicode characters that cannot be\n", #> "represented in the native encoding, R serialises those as an ASCII\n", #> "sequence representing the unicode point. This is why Windows users\n", #> "with western locales often see strings looking like ", #> list("<U+xxxx>"), ". To\n", "alleviate some of the pain, rlang parses strings and looks for\n", #> "serialised unicode points to translate them back to the proper\n", #> "UTF-8 representation. This transformation occurs automatically in\n", #> "functions like ", list(list("env_names()")), #> " and can be manually triggered with\n", list( #> "as_utf8_character()"), " and ", list("chr_unserialise_unicode()"), #> ".\n"), "\n", list(list("Life cycle"), list( #> "\n", "\n", "\n", "This function is experimental.\n")), #> "\n", "\n", list("\n", "ascii <- \"<U+5E78>\"\n", #> "chr_unserialise_unicode(ascii)\n", "\n", "identical(chr_unserialise_unicode(ascii), \"\\u5e78\")\n"), #> "\n", list("internal"), "\n"), cnd.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-error.R, R/cnd.R", #> "\n", list("error_cnd"), "\n", list("error_cnd"), #> "\n", list("cnd"), "\n", list("warning_cnd"), #> "\n", list("message_cnd"), "\n", list("Create a condition object"), #> "\n", list("\n", "error_cnd(class = NULL, ..., message = \"\", trace = NULL, parent = NULL)\n", #> "\n", "cnd(class, ..., message = \"\")\n", #> "\n", "warning_cnd(class = NULL, ..., message = \"\")\n", #> "\n", "message_cnd(class = NULL, ..., message = \"\")\n"), #> "\n", list("\n", list(list("class"), list("The condition subclass.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> Named data fields stored inside\n", #> "the condition object.")), "\n", "\n", list( #> list("message"), list("A default message to inform the user about the\n", #> "condition when it is signalled.")), "\n", #> "\n", list(list("trace"), list("A ", list("trace"), #> " object created by ", list(list("trace_back()")), #> ".")), "\n", "\n", list(list("parent"), list( #> "A parent condition object created by ", #> list(list("abort()")), ".")), "\n"), "\n", #> list("\n", "These constructors make it easy to create subclassed conditions.\n", #> "Conditions are objects that power the error system in R. They can\n", #> "also be used for passing messages to pre-established handlers.\n"), #> "\n", list("\n", list("cnd()"), " creates objects inheriting from ", #> list("condition"), ". Conditions\n", "created with ", #> list("error_cnd()"), ", ", list("warning_cnd()"), #> " and ", list("message_cnd()"), "\n", "inherit from ", #> list("error"), ", ", list("warning"), " or ", #> list("message"), ".\n"), "\n", list("\n", "# Create a condition inheriting from the s3 type \"foo\":\n", #> "cnd <- cnd(\"foo\")\n", "\n", "# Signal the condition to potential handlers. Since this is a bare\n", #> "# condition the signal has no effect if no handlers are set up:\n", #> "cnd_signal(cnd)\n", "\n", "# When a relevant handler is set up, the signal causes the handler\n", #> "# to be called:\n", "with_handlers(cnd_signal(cnd), foo = exiting(function(c) \"caught!\"))\n", #> "\n", "# Handlers can be thrown or executed inplace. See with_handlers()\n", #> "# documentation for more on this.\n", "\n", #> "# Signalling an error condition aborts the current computation:\n", #> "err <- error_cnd(\"foo\", message = \"I am an error\")\n", #> "try(cnd_signal(err))\n"), "\n", list("\n", #> list(list("cnd_signal()")), ", ", list(list( #> "with_handlers()")), ".\n"), "\n", list("internal"), #> "\n"), cnd_message.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-message.R", #> "\n", list("cnd_message"), "\n", list("cnd_message"), #> "\n", list("cnd_header"), "\n", list("cnd_body"), #> "\n", list("cnd_footer"), "\n", list("Build an error message from parts"), #> "\n", list("\n", "cnd_message(cnd)\n", "\n", #> "cnd_header(cnd, ...)\n", "\n", "cnd_body(cnd, ...)\n", #> "\n", "cnd_footer(cnd, ...)\n"), "\n", list( #> "\n", list(list("cnd"), list("A condition object.")), #> "\n", "\n", list(list("..."), list("Arguments passed to methods.")), #> "\n"), "\n", list("\n", list("cnd_message()"), #> " assembles an error message from three generics:\n", #> list("\n", list(), " ", list("cnd_header()"), #> "\n", list(), " ", list("cnd_body()"), "\n", #> list(), " ", list("cnd_footer()"), "\n"), #> "\n", "\n", "The default method for the error header returns the ", #> list("message"), " field\n", "of the condition object. The default methods for the body and\n", #> "footer return empty character vectors. In general, methods for\n", #> "these generics should return a character vector. The elements are\n", #> "combined into a single string with a newline separator.\n", #> "\n", list("cnd_message()"), " is automatically called by the ", #> list("conditionMessage()"), "\n", "for rlang errors. Error classes created with ", #> list(list("abort()")), " only need to\n", "implement header, body or footer methods. This provides a lot of\n", #> "flexibility for hierarchies of error classes, for instance you\n", #> "could inherit the body of an error message from a parent class\n", #> "while overriding the header and footer.\n"), #> "\n", list(list("Overriding ", list("cnd_body()")), #> list("\n", "\n", "\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "Sometimes the contents of an error message depends on the state of\n", #> "your checking routine. In that case, it can be tricky to lazily\n", #> "generate error messages with ", list("cnd_body()"), #> ": you have the choice\n", "between overspecifying your error class hierarchies with one class\n", #> "per state, or replicating the type-checking control flow within the\n", #> list("cnd_body()"), " method. None of these options are ideal.\n", #> "\n", "A better option is to define a ", #> list("body"), " field in your error object\n", #> "containing a static string, a ", list("lambda-formula"), #> ", or a\n", "function with the same signature as ", #> list("cnd_body()"), ". This field\n", "overrides the ", #> list("cnd_body()"), " generic and makes it easy to generate an\n", #> "error message tailored to the state in which the error was\n", #> "constructed.\n")), "\n", "\n"), cnd_muffle.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-handlers.R", #> "\n", list("cnd_muffle"), "\n", list("cnd_muffle"), #> "\n", list("Muffle a condition"), "\n", list( #> "\n", "cnd_muffle(cnd)\n"), "\n", list("\n", #> list(list("cnd"), list("A condition to muffle.")), #> "\n"), "\n", list("\n", "If ", list("cnd"), #> " is mufflable, ", list("cnd_muffle()"), " jumps to the muffle\n", #> "restart and doesn't return. Otherwise, it returns ", #> list("FALSE"), ".\n"), "\n", list("\n", "Unlike ", #> list(list("exiting()")), " handlers, ", list( #> list("calling()")), " handlers must be explicit\n", #> "that they have handled a condition to stop it from propagating to\n", #> "other handlers. Use ", list("cnd_muffle()"), #> " within a calling handler (or as\n", "a calling handler, see examples) to prevent any other handlers from\n", #> "being called for that condition.\n"), "\n", #> list(list("Mufflable conditions"), list("\n", #> "\n", "\n", "Most conditions signalled by base R are muffable, although the name\n", #> "of the restart varies. cnd_muffle() will automatically call the\n", #> "correct restart for you. It is compatible with the following\n", #> "conditions:\n", list("\n", list(), " ", list( #> "warning"), " and ", list("message"), " conditions. In this case ", #> list("cnd_muffle()"), "\n", "is equivalent to ", #> list(list("base::suppressMessages()")), " and\n", #> list(list("base::suppressWarnings()")), ".\n", #> list(), " Bare conditions signalled with ", #> list("signal()"), " or ", list(list("cnd_signal()")), #> ". Note\n", "that conditions signalled with ", #> list(list("base::signalCondition()")), " are not\n", #> "mufflable.\n", list(), " Interrupts are sometimes signalled with a ", #> list("resume"), " restart on\n", "recent R versions. When this is the case, you can muffle the\n", #> "interrupt with ", list("cnd_muffle()"), #> ". Check if a restart is available\n", "with ", #> list("base::findRestart(\"resume\")"), ".\n"), #> "\n", "\n", "If you call ", list("cnd_muffle()"), #> " with a condition that is not mufflable\n", #> "you will cause a new error to be signalled.\n", #> list("\n", list(), " Errors are not mufflable since they are signalled in critical\n", #> "situations where execution cannot continue safely.\n", #> list(), " Conditions captured with ", list( #> list("base::tryCatch()")), ", ", list(list( #> "with_handlers()")), " or\n", list(list( #> "catch_cnd()")), " are no longer mufflable. Muffling restarts ", #> list("must"), "\n", "be called from a ", #> list("calling"), " handler.\n"), "\n")), #> "\n", "\n", list("\n", "fn <- function() {\n", #> " inform(\"Beware!\", \"my_particular_msg\")\n", #> " inform(\"On your guard!\")\n", " \"foobar\"\n", #> "}\n", "\n", "# Let's install a muffling handler for the condition thrown by `fn()`.\n", #> "# This will suppress all `my_particular_wng` warnings but let other\n", #> "# types of warnings go through:\n", "with_handlers(fn(),\n", #> " my_particular_msg = calling(function(cnd) {\n", #> " inform(\"Dealt with this particular message\")\n", #> " cnd_muffle(cnd)\n", " })\n", ")\n", "\n", #> "# Note how execution of `fn()` continued normally after dealing\n", #> "# with that particular message.\n", "\n", #> "# cnd_muffle() can also be passed to with_handlers() as a calling\n", #> "# handler:\n", "with_handlers(fn(),\n", " my_particular_msg = calling(cnd_muffle)\n", #> ")\n"), "\n", list("internal"), "\n"), cnd_signal.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-signal.R", #> "\n", list("cnd_signal"), "\n", list("cnd_signal"), #> "\n", list("Signal a condition object"), "\n", #> list("\n", "cnd_signal(cnd, ...)\n"), "\n", list( #> "\n", list(list("cnd"), list("A condition object (see ", #> list(list("cnd()")), "). If ", list("NULL"), #> ",\n", list("cnd_signal()"), " returns without signalling a condition.")), #> "\n", "\n", list(list("..."), list("These dots are for extensions and must be empty.")), #> "\n"), "\n", list("\n", "The type of signal depends on the class of the condition:\n", #> list("\n", list(), " A message is signalled if the condition inherits from\n", #> list("\"message\""), ". This is equivalent to signalling with ", #> list(list("inform()")), " or\n", list(list( #> "base::message()")), ".\n", list(), " A warning is signalled if the condition inherits from\n", #> list("\"warning\""), ". This is equivalent to signalling with ", #> list(list("warn()")), " or\n", list(list( #> "base::warning()")), ".\n", list(), " An error is signalled if the condition inherits from\n", #> list("\"error\""), ". This is equivalent to signalling with ", #> list(list("abort()")), " or\n", list(list( #> "base::stop()")), ".\n", list(), " An interrupt is signalled if the condition inherits from\n", #> list("\"interrupt\""), ". This is equivalent to signalling with\n", #> list(list("interrupt()")), ".\n"), "\n", #> "\n", "Use ", list(list("cnd_type()")), " to determine the type of a condition.\n"), #> "\n", list("\n", "# The type of signal depends on the class. If the condition\n", #> "# inherits from \"warning\", a warning is issued:\n", #> "cnd <- warning_cnd(\"my_warning_class\", message = \"This is a warning\")\n", #> "cnd_signal(cnd)\n", "\n", "# If it inherits from \"error\", an error is raised:\n", #> "cnd <- error_cnd(\"my_error_class\", message = \"This is an error\")\n", #> "try(cnd_signal(cnd))\n"), "\n", list("\n", #> list(list("abort()")), ", ", list(list("warn()")), #> " and ", list(list("inform()")), " for creating and\n", #> "signalling structured R conditions. See ", #> list(list("with_handlers()")), " for\n", "establishing condition handlers.\n"), #> "\n"), cnd_type.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd.R", #> "\n", list("cnd_type"), "\n", list("cnd_type"), #> "\n", list("What type is a condition?"), "\n", #> list("\n", "cnd_type(cnd)\n"), "\n", list("\n", #> list(list("cnd"), list("A condition object.")), #> "\n"), "\n", list("\n", "A string, either ", #> list("\"condition\""), ", ", list("\"message\""), #> ", ", list("\"warning\""), ",\n", list("\"error\""), #> " or ", list("\"interrupt\""), ".\n"), "\n", #> list("\n", "Use ", list("cnd_type()"), " to check what type a condition is.\n"), #> "\n", list("\n", "cnd_type(catch_cnd(abort(\"Abort!\")))\n", #> "cnd_type(catch_cnd(interrupt()))\n"), "\n", #> list("internal"), "\n"), done.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/s3.R", #> "\n", list("done"), "\n", list("done"), "\n", #> list("is_done_box"), "\n", list("Box a final value for early termination"), #> "\n", list("\n", "done(x)\n", "\n", "is_done_box(x, empty = NULL)\n"), #> "\n", list("\n", list(list("x"), list("For ", #> list("done()"), ", a value to box. For ", list( #> "is_done_box()"), ", a\n", "value to test.")), #> "\n", "\n", list(list("empty"), list("Whether the box is empty. If ", #> list("NULL"), ", ", list("is_done_box()"), #> "\n", "returns ", list("TRUE"), " for all done boxes. If ", #> list("TRUE"), ", it returns ", list("TRUE"), #> "\n", "only for empty boxes. Otherwise it returns ", #> list("TRUE"), " only for\n", "non-empty boxes.")), #> "\n"), "\n", list("\n", "A ", list("boxed"), #> " value.\n"), "\n", list("\n", "A value boxed with ", #> list("done()"), " signals to its caller that it\n", #> "should stop iterating. Use it to shortcircuit a loop.\n"), #> "\n", list("\n", "done(3)\n", "\n", "x <- done(3)\n", #> "is_done_box(x)\n"), "\n"), dots_definitions.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("dots_definitions"), "\n", list("dots_definitions"), #> "\n", list("Capture definition objects"), "\n", #> list("\n", "dots_definitions(\n", " ...,\n", #> " .named = FALSE,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\")\n", #> ")\n"), "\n", list("\n", list(list("..."), #> list("For ", list("enexprs()"), ", ", list( #> "ensyms()"), " and ", list("enquos()"), ", names of\n", #> "arguments to capture without evaluation (including ", #> list("..."), "). For\n", list("exprs()"), #> " and ", list("quos()"), ", the expressions to capture unevaluated\n", #> "(including expressions contained in ", list( #> "..."), ").")), "\n", "\n", list(list(".named"), #> list("Whether to ensure all dots are named. Unnamed\n", #> "elements are processed with ", list(list( #> "as_label()")), " to build a default\n", #> "name.")), "\n", "\n", list(list(".ignore_empty"), #> list("Whether to ignore empty arguments. Can be one\n", #> "of ", list("\"trailing\""), ", ", list("\"none\""), #> ", ", list("\"all\""), ". If ", list("\"trailing\""), #> ", only the\n", "last argument is ignored if it is empty. Note that ", #> list("\"trailing\""), "\n", "applies only to arguments passed in ", #> list("..."), ", not to named\n", "arguments. On the other hand, ", #> list("\"all\""), " also applies to named\n", #> "arguments.")), "\n"), "\n", list("\n", "Capture definition objects\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", list("dots_definitions()"), " is experimental. Expect API changes.\n")), #> "\n", "\n", list("internal"), "\n"), dots_n.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("dots_n"), "\n", list("dots_n"), "\n", #> list("How many arguments are currently forwarded in dots?"), #> "\n", list("\n", "dots_n(...)\n"), "\n", list( #> "\n", list(list("..."), list("Forwarded arguments.")), #> "\n"), "\n", list("\n", "This returns the number of arguments currently forwarded in ", #> list("..."), "\n", "as an integer.\n"), "\n", #> list("\n", "fn <- function(...) dots_n(..., baz)\n", #> "fn(foo, bar)\n"), "\n", list("internal"), #> "\n"), dots_values.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("dots_values"), "\n", list("dots_values"), #> "\n", list("Evaluate dots with preliminary splicing"), #> "\n", list("\n", "dots_values(\n", " ...,\n", #> " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .preserve_empty = FALSE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n"), "\n", #> list("\n", list(list("..."), list("Arguments to evaluate and process splicing operators.")), #> "\n", "\n", list(list(".ignore_empty"), list( #> "Whether to ignore empty arguments. Can be one\n", #> "of ", list("\"trailing\""), ", ", list("\"none\""), #> ", ", list("\"all\""), ". If ", list("\"trailing\""), #> ", only the\n", "last argument is ignored if it is empty.")), #> "\n", "\n", list(list(".preserve_empty"), list( #> "Whether to preserve the empty arguments that\n", #> "were not ignored. If ", list("TRUE"), ", empty arguments are stored with\n", #> list(list("missing_arg()")), " values. If ", #> list("FALSE"), " (the default) an error is\n", #> "thrown when an empty argument is detected.")), #> "\n", "\n", list(list(".homonyms"), list("How to treat arguments with the same name. The\n", #> "default, ", list("\"keep\""), ", preserves these arguments. Set ", #> list(".homonyms"), " to\n", list("\"first\""), #> " to only keep the first occurrences, to ", #> list("\"last\""), " to keep\n", "the last occurrences, and to ", #> list("\"error\""), " to raise an informative\n", #> "error and indicate what arguments have duplicated names.")), #> "\n", "\n", list(list(".check_assign"), list( #> "Whether to check for ", list("<-"), " calls passed in\n", #> "dots. When ", list("TRUE"), " and a ", list( #> "<-"), " call is detected, a warning is\n", #> "issued to advise users to use ", list("="), #> " if they meant to match a\n", "function parameter, or wrap the ", #> list("<-"), " call in braces otherwise.\n", #> "This ensures assignments are explicit.")), #> "\n"), "\n", list("\n", "This is a tool for advanced users. It captures dots, processes\n", #> "unquoting and splicing operators, and evaluates them. Unlike\n", #> list(list("dots_list()")), ", it does not flatten spliced objects, instead they\n", #> "are attributed a ", list("spliced"), " class (see ", #> list(list("splice()")), "). You can process\n", #> "spliced objects manually, perhaps with a custom predicate (see\n", #> list(list("flatten_if()")), ").\n"), "\n", #> list("\n", "dots <- dots_values(!!! list(1, 2), 3)\n", #> "dots\n", "\n", "# Flatten the objects marked as spliced:\n", #> "flatten_if(dots, is_spliced)\n"), "\n", list( #> "internal"), "\n"), duplicate.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/sexp.R", #> "\n", list("duplicate"), "\n", list("duplicate"), #> "\n", list("Duplicate an R object"), "\n", list( #> "\n", "duplicate(x, shallow = FALSE)\n"), "\n", #> list("\n", list(list("x"), list("Any R object. However, uncopyable types like symbols and\n", #> "environments are returned as is (just like with ", #> list("<-"), ").")), "\n", "\n", list(list("shallow"), #> list("This is relevant for recursive data structures like\n", #> "lists, calls and pairlists. A shallow copy only duplicates the\n", #> "top-level data structure. The objects contained in the list are\n", #> "still the same.")), "\n"), "\n", list("\n", #> "In R semantics, objects are copied by value. This means that\n", #> "modifying the copy leaves the original object intact. Since\n", #> "copying data in memory is an expensive operation, copies in R are\n", #> "as lazy as possible. They only happen when the new object is\n", #> "actually modified. However, some operations (like ", #> list(list("node_poke_car()")), "\n", "or ", #> list(list("node_poke_cdr()")), ") do not support copy-on-write. In those cases,\n", #> "it is necessary to duplicate the object manually in order to\n", #> "preserve copy-by-value semantics.\n"), "\n", #> list("\n", "Some objects are not duplicable, like symbols and environments.\n", #> list("duplicate()"), " returns its input for these unique objects.\n"), #> "\n", list("\n", "pairlist\n"), "\n", list("internal"), #> "\n"), `dyn-dots.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("dyn-dots"), "\n", list("dyn-dots"), #> "\n", list("tidy-dots"), "\n", list("Dynamic dots"), #> "\n", list("\n", "The ", list("..."), " syntax of base R allows you to:\n", #> list("\n", list(), " ", list("Forward"), " arguments from function to function, matching them\n", #> "along the way to function parameters.\n", #> list(), " ", list("Collect"), " arguments inside data structures, e.g. with ", #> list(list("c()")), " or\n", list(list("list()")), #> ".\n"), "\n", "\n", "Dynamic dots offer a few additional features:\n", #> list("\n", list(), " You can ", list("splice"), #> " arguments saved in a list with the ", list( #> "big bang"), " operator ", list("!!!"), #> ".\n", list(), " You can ", list("unquote"), #> " names by using the ", list("glue"), " syntax\n", #> "or the ", list("bang bang"), " operator ", #> list("!!"), " on the\n", "left-hand side of ", #> list(":="), ".\n", list(), " Trailing commas are ignored, making it easier to copy and paste\n", #> "lines of arguments.\n"), "\n"), "\n", list( #> list("Add dynamic dots support in your functions"), #> list("\n", "\n", "\n", "If your function takes dots, adding support for dynamic features is\n", #> "as easy as collecting the dots with ", list( #> list("list2()")), " instead of ", list( #> list("list()")), ".\n", "\n", "Other dynamic dots collectors are ", #> list(list("dots_list()")), ", which is more\n", #> "configurable than ", list(list("list2()")), #> ", ", list("vars()"), " which doesn't force its\n", #> "arguments, and ", list(list("call2()")), #> " for creating calls.\n", "\n", "Document dynamic docs using this standard tag:", #> list(" @param ... <[`dynamic-dots`][rlang::dyn-dots]> What these dots do.\n"), #> "\n")), "\n", "\n", list("\n", "f <- function(...) {\n", #> " out <- list2(...)\n", " rev(out)\n", "}\n", #> "\n", "# Splice\n", "x <- list(alpha = \"first\", omega = \"last\")\n", #> "f(!!!x)\n", "\n", "# Unquote a name, showing both the `!!` bang bang and `{}` glue style\n", #> "nm <- \"key\"\n", "f(!!nm := \"value\")\n", #> "f(\"{nm}\" := \"value\")\n", "f(\"prefix_{nm}\" := \"value\")\n", #> "\n", "# Tolerate a trailing comma\n", "f(this = \"that\", )\n"), #> "\n"), empty_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("empty_env"), "\n", list("empty_env"), #> "\n", list("Get the empty environment"), "\n", #> list("\n", "empty_env()\n"), "\n", list("\n", #> "The empty environment is the only one that does not have a parent.\n", #> "It is always used as the tail of an environment chain such as the\n", #> "search path (see ", list(list("search_envs()")), #> ").\n"), "\n", list("\n", "# Create environments with nothing in scope:\n", #> "child_env(empty_env())\n"), "\n"), enquo0.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/nse-defuse.R", #> "\n", list("enquo0"), "\n", list("enquo0"), "\n", #> list("enquos0"), "\n", list("Defuse arguments without automatic injection"), #> "\n", list("\n", "enquo0(arg)\n", "\n", "enquos0(...)\n"), #> "\n", list("\n", list(list("arg"), list("A symbol for a function argument to defuse.")), #> "\n", "\n", list(list("..."), list("Dots to defuse.")), #> "\n"), "\n", list("\n", "The 0-suffixed variants of ", #> list(list("enquo()")), " and ", list(list("enquos()")), #> " defuse function\n", "arguments without automatic injection (unquotation). They are\n", #> "useful when defusing expressions that potentially include ", #> list("!!"), ",\n", list("!!!"), ", or ", list( #> "{{"), " operations, for instance tidyverse code. In that\n", #> "case, ", list("enquo()"), " would process these operators too early, creating a\n", #> "confusing experience for users. Callers can still inject objects\n", #> "or expressions using manual injection with ", #> list(list("inject()")), ".\n"), "\n", list( #> "\n", "None of the features of ", list("dynamic dots"), #> " are available when\n", "defusing with ", #> list("enquos0()"), ". For instance, trailing empty arguments\n", #> "are not automatically trimmed.\n"), "\n", #> list("\n", "automatic_injection <- function(x) enquo(x)\n", #> "no_injection <- function(x) enquo0(x)\n", #> "\n", "automatic_injection(foo(!!!1:3))\n", #> "no_injection(foo(!!!1:3))\n"), "\n", list( #> "\n", list(list("enquo()")), " and ", list( #> list("enquos()")), "\n"), "\n"), entrace.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-entrace.R", #> "\n", list("entrace"), "\n", list("entrace"), #> "\n", list("cnd_entrace"), "\n", list("Add backtrace from error handler"), #> "\n", list("\n", "entrace(cnd, ..., top = NULL, bottom = NULL)\n", #> "\n", "cnd_entrace(cnd, ..., top = NULL, bottom = NULL)\n"), #> "\n", list("\n", list(list("cnd"), list("When ", #> list("entrace()"), " is used as a calling handler, ", #> list("cnd"), " is\n", "the condition to handle.")), #> "\n", "\n", list(list("..."), list("Unused. These dots are for future extensions.")), #> "\n", "\n", list(list("top"), list("The first frame environment to be included in the\n", #> "backtrace. This becomes the top of the backtrace tree and\n", #> "represents the oldest call in the backtrace.\n", #> "\n", "This is needed in particular when you call ", #> list("trace_back()"), "\n", "indirectly or from a larger context, for example in tests or\n", #> "inside an RMarkdown document where you don't want all of the\n", #> "knitr evaluation mechanisms to appear in the backtrace.")), #> "\n", "\n", list(list("bottom"), list("The last frame environment to be included in the\n", #> "backtrace. This becomes the rightmost leaf of the backtrace tree\n", #> "and represents the youngest call in the backtrace.\n", #> "\n", "Set this when you would like to capture a backtrace without the\n", #> "capture context.\n", "\n", "Can also be an integer that will be passed to ", #> list(list("caller_env()")), ".")), "\n"), #> "\n", list("\n", list("entrace()"), " interrupts an error throw to add an ", #> list("rlang backtrace"), " to the error. The error throw is\n", #> "immediately resumed. ", list("cnd_entrace()"), #> " adds a backtrace to a\n", "condition object, without any other effect. Both functions should\n", #> "be called directly from an error handler.\n", #> "\n", "Set the ", list("error"), " global option to ", #> list("rlang::entrace"), " to\n", "transform base errors to rlang errors. These enriched errors\n", #> "include a backtrace. The RProfile is a good place to set the\n", #> "handler. See ", list(list("rlang_backtrace_on_error")), #> " for details.\n", "\n", list("entrace()"), #> " also works as a ", list("calling"), " handler, though it\n", #> "is often more practical to use the higher-level function\n", #> list(list("with_abort()")), ".\n"), "\n", list( #> "\n", "if (FALSE) { # Not run\n", "\n", "# Set the error handler in your RProfile like this:\n", #> "if (requireNamespace(\"rlang\", quietly = TRUE)) {\n", #> " options(error = rlang::entrace)\n", "}\n", #> "\n", "}\n"), "\n", list("\n", list(list("with_abort()")), #> " to promote conditions to rlang errors.\n", #> list(list("cnd_entrace()")), " to manually add a backtrace to a condition.\n"), #> "\n"), env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env"), "\n", list("env"), "\n", list( #> "child_env"), "\n", list("new_environment"), #> "\n", list("Create a new environment"), "\n", #> list("\n", "env(...)\n", "\n", "child_env(.parent, ...)\n", #> "\n", "new_environment(data = list(), parent = empty_env())\n"), #> "\n", list("\n", list(list("..., data"), list( #> "<", list("dynamic"), "> Named values. You can\n", #> "supply one unnamed to specify a custom parent, otherwise it\n", #> "defaults to the current environment.")), "\n", #> "\n", list(list(".parent, parent"), list("A parent environment. Can be an object\n", #> "supported by ", list(list("as_environment()")), #> ".")), "\n"), "\n", list("\n", "These functions create new environments.\n", #> list("\n", list(), " ", list("env()"), " creates a child of the current environment by default\n", #> "and takes a variable number of named objects to populate it.\n", #> list(), " ", list("new_environment()"), " creates a child of the empty environment by\n", #> "default and takes a named list of objects to populate it.\n"), #> "\n"), "\n", list(list("Environments as objects"), #> list("\n", "\n", "\n", "Environments are containers of uniquely named objects. Their most\n", #> "common use is to provide a scope for the evaluation of R\n", #> "expressions. Not all languages have first class environments,\n", #> "i.e. can manipulate scope as regular objects. Reification of scope\n", #> "is one of the most powerful features of R as it allows you to change\n", #> "what objects a function or expression sees when it is evaluated.\n", #> "\n", "Environments also constitute a data structure in their own\n", #> "right. They are a collection of uniquely named objects, subsettable\n", #> "by name and modifiable by reference. This latter property (see\n", #> "section on reference semantics) is especially useful for creating\n", #> "mutable OO systems (cf the ", list(list( #> "https://github.com/r-lib/R6"), list("R6 package")), #> "\n", "and the ", list(list("https://ggplot2.tidyverse.org/articles/extending-ggplot2.html"), #> list("ggproto system")), "\n", "for extending ggplot2).\n")), #> "\n", "\n", list(list("Inheritance"), list("\n", #> "\n", "\n", "All R environments (except the ", #> list("empty environment"), ") are\n", "defined with a parent environment. An environment and its\n", #> "grandparents thus form a linear hierarchy that is the basis for\n", #> list(list("https://en.wikipedia.org/wiki/Scope_(computer_science)"), #> list("lexical scoping")), " in\n", "R. When R evaluates an expression, it looks up symbols in a given\n", #> "environment. If it cannot find these symbols there, it keeps\n", #> "looking them up in parent environments. This way, objects defined\n", #> "in child environments have precedence over objects defined in\n", #> "parent environments.\n", "\n", "The ability of overriding specific definitions is used in the\n", #> "tidyeval framework to create powerful domain-specific grammars. A\n", #> "common use of masking is to put data frame columns in scope. See\n", #> "for example ", list(list("as_data_mask()")), #> ".\n")), "\n", "\n", list(list("Reference semantics"), #> list("\n", "\n", "\n", "Unlike regular objects such as vectors, environments are an\n", #> list("uncopyable"), " object type. This means that if you\n", #> "have multiple references to a given environment (by assigning the\n", #> "environment to another symbol with ", list( #> "<-"), " or passing the environment\n", #> "as argument to a function), modifying the bindings of one of those\n", #> "references changes all other references as well.\n")), #> "\n", "\n", list(list("Life cycle"), list("\n", #> "\n", list("\n", list(), " ", list("child_env()"), #> " is in the questioning stage. It is redundant now\n", #> "that ", list("env()"), " accepts parent environments.\n"), #> "\n")), "\n", "\n", list("\n", "# env() creates a new environment which has the current environment\n", #> "# as parent\n", "env <- env(a = 1, b = \"foo\")\n", #> "env$b\n", "identical(env_parent(env), current_env())\n", #> "\n", "# Supply one unnamed argument to override the default:\n", #> "env <- env(base_env(), a = 1, b = \"foo\")\n", #> "identical(env_parent(env), base_env())\n", #> "\n", "\n", "# child_env() lets you specify a parent:\n", #> "child <- child_env(env, c = \"bar\")\n", "identical(env_parent(child), env)\n", #> "\n", "# This child environment owns `c` but inherits `a` and `b` from `env`:\n", #> "env_has(child, c(\"a\", \"b\", \"c\", \"d\"))\n", #> "env_has(child, c(\"a\", \"b\", \"c\", \"d\"), inherit = TRUE)\n", #> "\n", "# `parent` is passed to as_environment() to provide handy\n", #> "# shortcuts. Pass a string to create a child of a package\n", #> "# environment:\n", "child_env(\"rlang\")\n", #> "env_parent(child_env(\"rlang\"))\n", "\n", #> "# Or `NULL` to create a child of the empty environment:\n", #> "child_env(NULL)\n", "env_parent(child_env(NULL))\n", #> "\n", "# The base package environment is often a good default choice for a\n", #> "# parent environment because it contains all standard base\n", #> "# functions. Also note that it will never inherit from other loaded\n", #> "# package environments since R keeps the base package at the tail\n", #> "# of the search path:\n", "base_child <- child_env(\"base\")\n", #> "env_has(base_child, c(\"lapply\", \"(\"), inherit = TRUE)\n", #> "\n", "# On the other hand, a child of the empty environment doesn't even\n", #> "# see a definition for `(`\n", "empty_child <- child_env(NULL)\n", #> "env_has(empty_child, c(\"lapply\", \"(\"), inherit = TRUE)\n", #> "\n", "# Note that all other package environments inherit from base_env()\n", #> "# as well:\n", "rlang_child <- child_env(\"rlang\")\n", #> "env_has(rlang_child, \"env\", inherit = TRUE) # rlang function\n", #> "env_has(rlang_child, \"lapply\", inherit = TRUE) # base function\n", #> "\n", "\n", "# Both env() and child_env() support tidy dots features:\n", #> "objs <- list(b = \"foo\", c = \"bar\")\n", #> "env <- env(a = 1, !!! objs)\n", "env$c\n", #> "\n", "# You can also unquote names with the definition operator `:=`\n", #> "var <- \"a\"\n", "env <- env(!!var := \"A\")\n", #> "env$a\n", "\n", "\n", "# Use new_environment() to create containers with the empty\n", #> "# environment as parent:\n", "env <- new_environment()\n", #> "env_parent(env)\n", "\n", "# Like other new_ constructors, it takes an object rather than dots:\n", #> "new_environment(list(a = \"foo\", b = \"bar\"))\n"), #> "\n", list("\n", list(list("env_has()")), ", ", #> list(list("env_bind()")), ".\n"), "\n"), env_bind.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_bind"), "\n", list("env_bind"), #> "\n", list("env_bind_lazy"), "\n", list("env_bind_active"), #> "\n", list("%<~%"), "\n", list("Bind symbols to objects in an environment"), #> "\n", list("\n", "env_bind(.env, ...)\n", "\n", #> "env_bind_lazy(.env, ..., .eval_env = caller_env())\n", #> "\n", "env_bind_active(.env, ...)\n", "\n", #> "lhs %<~% rhs\n"), "\n", list("\n", list(list( #> ".env"), list("An environment.")), "\n", "\n", #> list(list("..."), list("<", list("dynamic"), #> "> Named objects (", list("env_bind()"), #> "),\n", "expressions ", list("env_bind_lazy()"), #> ", or functions (", list("env_bind_active()"), #> ").\n", "Use ", list(list("zap()")), " to remove bindings.")), #> "\n", "\n", list(list(".eval_env"), list("The environment where the expressions will be\n", #> "evaluated when the symbols are forced.")), #> "\n", "\n", list(list("lhs"), list("The variable name to which ", #> list("rhs"), " will be lazily assigned.")), #> "\n", "\n", list(list("rhs"), list("An expression lazily evaluated and assigned to ", #> list("lhs"), ".")), "\n"), "\n", list("\n", #> "The input object ", list(".env"), ", with its associated environment\n", #> "modified in place, invisibly.\n"), "\n", list( #> "\n", "These functions create bindings in an environment. The bindings are\n", #> "supplied through ", list("..."), " as pairs of names and values or expressions.\n", #> list("env_bind()"), " is equivalent to evaluating a ", #> list("<-"), " expression within\n", "the given environment. This function should take care of the\n", #> "majority of use cases but the other variants can be useful for\n", #> "specific problems.\n", list("\n", list(), #> " ", list("env_bind()"), " takes named ", #> list("values"), " which are bound in ", list( #> ".env"), ".\n", list("env_bind()"), " is equivalent to ", #> list(list("base::assign()")), ".\n", list(), #> " ", list("env_bind_active()"), " takes named ", #> list("functions"), " and creates active\n", #> "bindings in ", list(".env"), ". This is equivalent to\n", #> list(list("base::makeActiveBinding()")), #> ". An active binding executes a\n", "function each time it is evaluated. The arguments are passed to\n", #> list(list("as_function()")), " so you can supply formulas instead of functions.\n", #> "\n", "Remember that functions are scoped in their own environment.\n", #> "These functions can thus refer to symbols from this enclosure\n", #> "that are not actually in scope in the dynamic environment where\n", #> "the active bindings are invoked. This allows creative solutions\n", #> "to difficult problems (see the implementations of ", #> list("dplyr::do()"), "\n", "methods for an example).\n", #> list(), " ", list("env_bind_lazy()"), " takes named ", #> list("expressions"), ". This is equivalent\n", #> "to ", list(list("base::delayedAssign()")), #> ". The arguments are captured with\n", list( #> list("exprs()")), " (and thus support call-splicing and unquoting) and\n", #> "assigned to symbols in ", list(".env"), #> ". These expressions are not\n", "evaluated immediately but lazily. Once a symbol is evaluated, the\n", #> "corresponding expression is evaluated in turn and its value is\n", #> "bound to the symbol (the expressions are thus evaluated only\n", #> "once, if at all).\n", list(), " ", list( #> "%<~%"), " is a shortcut for ", list("env_bind_lazy()"), #> ". It works like ", list("<-"), "\n", "but the RHS is evaluated lazily.\n"), #> "\n"), "\n", list(list("Side effects"), list( #> "\n", "\n", "\n", "Since environments have reference semantics (see relevant section\n", #> "in ", list(list("env()")), " documentation), modifying the bindings of an environment\n", #> "produces effects in all other references to that environment. In\n", #> "other words, ", list("env_bind()"), " and its variants have side effects.\n", #> "\n", "Like other side-effecty functions like ", #> list("par()"), " and ", list("options()"), #> ",\n", list("env_bind()"), " and variants return the old values invisibly.\n")), #> "\n", "\n", list(list("Life cycle"), list("\n", #> "\n", "\n", "Passing an environment wrapper like a formula or a function instead\n", #> "of an environment is soft-deprecated as of rlang 0.3.0. This\n", #> "internal genericity was causing confusion (see issue #427). You\n", #> "should now extract the environment separately before calling these\n", #> "functions.\n")), "\n", "\n", list("\n", "# env_bind() is a programmatic way of assigning values to symbols\n", #> "# with `<-`. We can add bindings in the current environment:\n", #> "env_bind(current_env(), foo = \"bar\")\n", #> "foo\n", "\n", "# Or modify those bindings:\n", #> "bar <- \"bar\"\n", "env_bind(current_env(), bar = \"BAR\")\n", #> "bar\n", "\n", "# You can remove bindings by supplying zap sentinels:\n", #> "env_bind(current_env(), foo = zap())\n", "try(foo)\n", #> "\n", "# Unquote-splice a named list of zaps\n", #> "zaps <- rep_named(c(\"foo\", \"bar\"), list(zap()))\n", #> "env_bind(current_env(), !!!zaps)\n", "try(bar)\n", #> "\n", "# It is most useful to change other environments:\n", #> "my_env <- env()\n", "env_bind(my_env, foo = \"foo\")\n", #> "my_env$foo\n", "\n", "# A useful feature is to splice lists of named values:\n", #> "vals <- list(a = 10, b = 20)\n", "env_bind(my_env, !!!vals, c = 30)\n", #> "my_env$b\n", "my_env$c\n", "\n", "# You can also unquote a variable referring to a symbol or a string\n", #> "# as binding name:\n", "var <- \"baz\"\n", #> "env_bind(my_env, !!var := \"BAZ\")\n", "my_env$baz\n", #> "\n", "\n", "# The old values of the bindings are returned invisibly:\n", #> "old <- env_bind(my_env, a = 1, b = 2, baz = \"baz\")\n", #> "old\n", "\n", "# You can restore the original environment state by supplying the\n", #> "# old values back:\n", "env_bind(my_env, !!!old)\n", #> "\n", "# env_bind_lazy() assigns expressions lazily:\n", #> "env <- env()\n", "env_bind_lazy(env, name = { cat(\"forced!\\n\"); \"value\" })\n", #> "\n", "# Referring to the binding will cause evaluation:\n", #> "env$name\n", "\n", "# But only once, subsequent references yield the final value:\n", #> "env$name\n", "\n", "# You can unquote expressions:\n", #> "expr <- quote(message(\"forced!\"))\n", "env_bind_lazy(env, name = !!expr)\n", #> "env$name\n", "\n", "\n", "# By default the expressions are evaluated in the current\n", #> "# environment. For instance we can create a local binding and refer\n", #> "# to it, even though the variable is bound in a different\n", #> "# environment:\n", "who <- \"mickey\"\n", #> "env_bind_lazy(env, name = paste(who, \"mouse\"))\n", #> "env$name\n", "\n", "# You can specify another evaluation environment with `.eval_env`:\n", #> "eval_env <- env(who = \"minnie\")\n", "env_bind_lazy(env, name = paste(who, \"mouse\"), .eval_env = eval_env)\n", #> "env$name\n", "\n", "# Or by unquoting a quosure:\n", #> "quo <- local({\n", " who <- \"fievel\"\n", #> " quo(paste(who, \"mouse\"))\n", "})\n", "env_bind_lazy(env, name = !!quo)\n", #> "env$name\n", "\n", "# You can create active bindings with env_bind_active(). Active\n", #> "# bindings execute a function each time they are evaluated:\n", #> "fn <- function() {\n", " cat(\"I have been called\\n\")\n", #> " rnorm(1)\n", "}\n", "\n", "env <- env()\n", #> "env_bind_active(env, symbol = fn)\n", "\n", #> "# `fn` is executed each time `symbol` is evaluated or retrieved:\n", #> "env$symbol\n", "env$symbol\n", "eval_bare(quote(symbol), env)\n", #> "eval_bare(quote(symbol), env)\n", "\n", "# All arguments are passed to as_function() so you can use the\n", #> "# formula shortcut:\n", "env_bind_active(env, foo = ~ runif(1))\n", #> "env$foo\n", "env$foo\n"), "\n", list("\n", #> list(list("env_poke()")), " for binding a single element.\n"), #> "\n"), env_bind_exprs.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("env_bind_exprs"), "\n", list("env_bind_exprs"), #> "\n", list("env_bind_fns"), "\n", list("Bind a promise or active binding"), #> "\n", list("\n", "env_bind_exprs(.env, ..., .eval_env = caller_env())\n", #> "\n", "env_bind_fns(.env, ...)\n"), "\n", list( #> "\n", list(list(".env"), list("An environment.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> Named objects (", list("env_bind()"), #> "),\n", "expressions ", list("env_bind_lazy()"), #> ", or functions (", list("env_bind_active()"), #> ").\n", "Use ", list(list("zap()")), " to remove bindings.")), #> "\n", "\n", list(list(".eval_env"), list("The environment where the expressions will be\n", #> "evaluated when the symbols are forced.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "As of rlang 0.3.0, ", list("env_bind_exprs()"), #> " and ", list("env_bind_fns()"), " have\n", #> "been renamed to ", list(list("env_bind_lazy()")), #> " and ", list(list("env_bind_active()")), " for\n", #> "consistency.\n"), "\n", list("internal"), #> "\n"), env_binding_are_active.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_binding_are_active"), "\n", list( #> "env_binding_are_active"), "\n", list("env_binding_are_lazy"), #> "\n", list("What kind of environment binding?"), #> "\n", list("\n", "env_binding_are_active(env, nms = NULL)\n", #> "\n", "env_binding_are_lazy(env, nms = NULL)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nms"), list("Names of bindings. Defaults to all bindings in ", #> list("env"), ".")), "\n"), "\n", list("\n", #> "A logical vector as long as ", list("nms"), #> " and named after it.\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"experimental\")"), #> "\n"), "\n", list("internal"), "\n"), env_binding_lock.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_binding_lock"), "\n", list("env_binding_lock"), #> "\n", list("env_binding_unlock"), "\n", list( #> "env_binding_are_locked"), "\n", list("Lock or unlock environment bindings"), #> "\n", list("\n", "env_binding_lock(env, nms = NULL)\n", #> "\n", "env_binding_unlock(env, nms = NULL)\n", #> "\n", "env_binding_are_locked(env, nms = NULL)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nms"), list("Names of bindings. Defaults to all bindings in ", #> list("env"), ".")), "\n"), "\n", list("\n", #> list("env_binding_are_unlocked()"), " returns a logical vector as\n", #> "long as ", list("nms"), " and named after it. ", #> list("env_binding_lock()"), " and\n", list( #> "env_binding_unlock()"), " return the old value of\n", #> list("env_binding_are_unlocked()"), " invisibly.\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "Locked environment bindings trigger an error when an attempt is\n", #> "made to redefine the binding.\n"), "\n", list( #> "\n", "# Bindings are unlocked by default:\n", #> "env <- env(a = \"A\", b = \"B\")\n", "env_binding_are_locked(env)\n", #> "\n", "# But can optionally be locked:\n", #> "env_binding_lock(env, \"a\")\n", "env_binding_are_locked(env)\n", #> "\n", "# If run, the following would now return an error because `a` is locked:\n", #> "# env_bind(env, a = \"foo\")\n", "# with_env(env, a <- \"bar\")\n", #> "\n", "# Let's unlock it. Note that the return value indicate which\n", #> "# bindings were locked:\n", "were_locked <- env_binding_unlock(env)\n", #> "were_locked\n", "\n", "# Now that it is unlocked we can modify it again:\n", #> "env_bind(env, a = \"foo\")\n", "with_env(env, a <- \"bar\")\n", #> "env$a\n"), "\n", list("\n", list(list("env_lock()")), #> " for locking an environment.\n"), "\n", list( #> "internal"), "\n"), env_browse.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_browse"), "\n", list("env_browse"), #> "\n", list("env_is_browsed"), "\n", list("Browse environments"), #> "\n", list("\n", "env_browse(env, value = TRUE)\n", #> "\n", "env_is_browsed(env)\n"), "\n", list( #> "\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("value"), list("Whether to browse ", #> list("env"), ".")), "\n"), "\n", list("\n", #> list("env_browse()"), " returns the previous value of\n", #> list("env_is_browsed()"), " (a logical), invisibly.\n"), #> "\n", list("\n", list("\n", list(), " ", list( #> "env_browse(env)"), " is equivalent to evaluating ", #> list("browser()"), " in\n", list("env"), ". It persistently sets the environment for step-debugging.\n", #> "Supply ", list("value = FALSE"), " to disable browsing.\n", #> list(), " ", list("env_is_browsed()"), " is a predicate that inspects whether an\n", #> "environment is being browsed.\n"), "\n"), #> "\n"), env_bury.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("env_bury"), "\n", list("env_bury"), #> "\n", list("Mask bindings by defining symbols deeper in a scope"), #> "\n", list("\n", "env_bury(.env, ...)\n"), "\n", #> list("\n", list(list(".env"), list("An environment.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> Named objects (", list("env_bind()"), #> "),\n", "expressions ", list("env_bind_lazy()"), #> ", or functions (", list("env_bind_active()"), #> ").\n", "Use ", list(list("zap()")), " to remove bindings.")), #> "\n"), "\n", list("\n", "A copy of ", list( #> ".env"), " enclosing the new environment containing\n", #> "bindings to ", list("..."), " arguments.\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"superseded\")"), #> "\n", "\n", "This function is superseded. Please use ", #> list(list("env()")), " (and possibly\n", list( #> list("set_env()")), " if you're masking the bindings for another object like\n", #> "a closure or a formula) instead.\n", "\n", #> list("env_bury()"), " is like ", list(list( #> "env_bind()")), " but it creates the bindings in a\n", #> "new child environment. This makes sure the new bindings have\n", #> "precedence over old ones, without altering existing environments.\n", #> "Unlike ", list("env_bind()"), ", this function does not have side effects and\n", #> "returns a new environment (or object wrapping that environment).\n"), #> "\n", list("\n", "orig_env <- env(a = 10)\n", #> "fn <- set_env(function() a, orig_env)\n", #> "\n", "# fn() currently sees `a` as the value `10`:\n", #> "fn()\n", "\n", "# env_bury() will bury the current scope of fn() behind a new\n", #> "# environment:\n", "fn <- env_bury(fn, a = 1000)\n", #> "fn()\n", "\n", "# Even though the symbol `a` is still defined deeper in the scope:\n", #> "orig_env$a\n"), "\n", list("\n", list(list( #> "env_bind()")), ", ", list(list("env_unbind()")), #> "\n"), "\n", list("internal"), "\n"), env_clone.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_clone"), "\n", list("env_clone"), #> "\n", list("Clone an environment"), "\n", list( #> "\n", "env_clone(env, parent = env_parent(env))\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("parent"), list("The parent of the cloned environment.")), #> "\n"), "\n", list("\n", "This creates a new environment containing exactly the same objects,\n", #> "optionally with a new parent.\n"), "\n", list( #> "\n", "env <- env(!!! mtcars)\n", "clone <- env_clone(env)\n", #> "identical(env, clone)\n", "identical(env$cyl, clone$cyl)\n"), #> "\n"), env_depth.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_depth"), "\n", list("env_depth"), #> "\n", list("Depth of an environment chain"), #> "\n", list("\n", "env_depth(env)\n"), "\n", list( #> "\n", list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "An integer.\n"), "\n", #> list("\n", "This function returns the number of environments between ", #> list("env"), " and\n", "the ", list("empty environment"), #> ", including ", list("env"), ". The depth of\n", #> list("env"), " is also the number of parents of ", #> list("env"), " (since the empty\n", "environment counts as a parent).\n"), #> "\n", list("\n", "env_depth(empty_env())\n", #> "env_depth(pkg_env(\"rlang\"))\n"), "\n", list( #> "\n", "The section on inheritance in ", list( #> list("env()")), " documentation.\n"), "\n"), #> env_get.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_get"), "\n", list("env_get"), #> "\n", list("env_get_list"), "\n", list("Get an object in an environment"), #> "\n", list("\n", "env_get(env = caller_env(), nm, default, inherit = FALSE)\n", #> "\n", "env_get_list(env = caller_env(), nms, default, inherit = FALSE)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nm, nms"), list("Names of bindings. ", #> list("nm"), " must be a single string.")), #> "\n", "\n", list(list("default"), list("A default value in case there is no binding for ", #> list("nm"), "\n", "in ", list("env"), ".")), #> "\n", "\n", list(list("inherit"), list("Whether to look for bindings in the parent\n", #> "environments.")), "\n"), "\n", list("\n", #> "An object if it exists. Otherwise, throws an error.\n"), #> "\n", list("\n", list("env_get()"), " extracts an object from an enviroment ", #> list("env"), ". By\n", "default, it does not look in the parent environments.\n", #> list("env_get_list()"), " extracts multiple objects from an environment into\n", #> "a named list.\n"), "\n", list("\n", "parent <- child_env(NULL, foo = \"foo\")\n", #> "env <- child_env(parent, bar = \"bar\")\n", #> "\n", "# This throws an error because `foo` is not directly defined in env:\n", #> "# env_get(env, \"foo\")\n", "\n", "# However `foo` can be fetched in the parent environment:\n", #> "env_get(env, \"foo\", inherit = TRUE)\n", #> "\n", "# You can also avoid an error by supplying a default value:\n", #> "env_get(env, \"foo\", default = \"FOO\")\n"), #> "\n"), env_has.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_has"), "\n", list("env_has"), #> "\n", list("Does an environment have or see bindings?"), #> "\n", list("\n", "env_has(env = caller_env(), nms, inherit = FALSE)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nms"), list("A character vector of binding names for which to check\n", #> "existence.")), "\n", "\n", list(list("inherit"), #> list("Whether to look for bindings in the parent\n", #> "environments.")), "\n"), "\n", list("\n", #> "A named logical vector as long as ", list( #> "nms"), ".\n"), "\n", list("\n", list("env_has()"), #> " is a vectorised predicate that queries whether an\n", #> "environment owns bindings personally (with ", #> list("inherit"), " set to\n", list("FALSE"), #> ", the default), or sees them in its own environment or in\n", #> "any of its parents (with ", list("inherit = TRUE"), #> ").\n"), "\n", list("\n", "parent <- child_env(NULL, foo = \"foo\")\n", #> "env <- child_env(parent, bar = \"bar\")\n", #> "\n", "# env does not own `foo` but sees it in its parent environment:\n", #> "env_has(env, \"foo\")\n", "env_has(env, \"foo\", inherit = TRUE)\n"), #> "\n"), env_inherits.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_inherits"), "\n", list("env_inherits"), #> "\n", list("Does environment inherit from another environment?"), #> "\n", list("\n", "env_inherits(env, ancestor)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("ancestor"), list("Another environment from which ", #> list("x"), " might inherit.")), "\n"), "\n", #> list("\n", "This returns ", list("TRUE"), " if ", #> list("x"), " has ", list("ancestor"), " among its parents.\n"), #> "\n"), env_lock.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_lock"), "\n", list("env_lock"), #> "\n", list("env_is_locked"), "\n", list("Lock an environment"), #> "\n", list("\n", "env_lock(env)\n", "\n", "env_is_locked(env)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "The old value of ", #> list("env_is_locked()"), " invisibly.\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "Locked environments cannot be modified. An important example is\n", #> "namespace environments which are locked by R when loaded in a\n", #> "session. Once an environment is locked it normally cannot be\n", #> "unlocked.\n", "\n", "Note that only the environment as a container is locked, not the\n", #> "individual bindings. You can't remove or add a binding but you can\n", #> "still modify the values of existing bindings. See\n", #> list(list("env_binding_lock()")), " for locking individual bindings.\n"), #> "\n", list("\n", "# New environments are unlocked by default:\n", #> "env <- env(a = 1)\n", "env_is_locked(env)\n", #> "\n", "# Use env_lock() to lock them:\n", "env_lock(env)\n", #> "env_is_locked(env)\n", "\n", "# Now that `env` is locked, it is no longer possible to remove or\n", #> "# add bindings. If run, the following would fail:\n", #> "# env_unbind(env, \"a\")\n", "# env_bind(env, b = 2)\n", #> "\n", "# Note that even though the environment as a container is locked,\n", #> "# the individual bindings are still unlocked and can be modified:\n", #> "env$a <- 10\n"), "\n", list("\n", list(list( #> "env_binding_lock()")), "\n"), "\n", list("internal"), #> "\n"), env_name.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("env_name"), "\n", list("env_name"), #> "\n", list("env_label"), "\n", list("Label of an environment"), #> "\n", list("\n", "env_name(env)\n", "\n", "env_label(env)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "Special environments like the global environment have their own\n", #> "names. ", list("env_name()"), " returns:\n", #> list("\n", list(), " \"global\" for the global environment.\n", #> list(), " \"empty\" for the empty environment.\n", #> list(), " \"base\" for the base package environment (the last environment on\n", #> "the search path).\n", list(), " \"namespace:pkg\" if ", #> list("env"), " is the namespace of the package \"pkg\".\n", #> list(), " The ", list("name"), " attribute of ", #> list("env"), " if it exists. This is how the\n", #> list("package environments"), " and the ", #> list("imports environments"), " store their names. The name of package\n", #> "environments is typically \"package:pkg\".\n", #> list(), " The empty string ", list("\"\""), #> " otherwise.\n"), "\n", "\n", list("env_label()"), #> " is exactly like ", list("env_name()"), " but returns the memory\n", #> "address of anonymous environments as fallback.\n"), #> "\n", list("\n", "# Some environments have specific names:\n", #> "env_name(global_env())\n", "env_name(ns_env(\"rlang\"))\n", #> "\n", "# Anonymous environments don't have names but are labelled by their\n", #> "# address in memory:\n", "env_name(env())\n", #> "env_label(env())\n"), "\n"), env_names.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_names"), "\n", list("env_names"), #> "\n", list("env_length"), "\n", list("Names and numbers of symbols bound in an environment"), #> "\n", list("\n", "env_names(env)\n", "\n", "env_length(env)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "A character vector of object names.\n"), #> "\n", list("\n", list("env_names()"), " returns object names from an enviroment ", #> list("env"), " as a\n", "character vector. All names are returned, even those starting with\n", #> "a dot. ", list("env_length()"), " returns the number of bindings.\n"), #> "\n", list(list("Names of symbols and objects"), #> list("\n", "\n", "\n", "Technically, objects are bound to symbols rather than strings,\n", #> "since the R interpreter evaluates symbols (see ", #> list(list("is_expression()")), " for a\n", #> "discussion of symbolic objects versus literal objects). However it\n", #> "is often more convenient to work with strings. In rlang\n", #> "terminology, the string corresponding to a symbol is called the\n", #> list("name"), " of the symbol (or by extension the name of an object bound\n", #> "to a symbol).\n")), "\n", "\n", list(list( #> "Encoding"), list("\n", "\n", "\n", "There are deep encoding issues when you convert a string to symbol\n", #> "and vice versa. Symbols are ", list("always"), #> " in the native encoding. If\n", "that encoding (let's say latin1) cannot support some characters,\n", #> "these characters are serialised to ASCII. That's why you sometimes\n", #> "see strings looking like ", list("<U+1234>"), #> ", especially if you're running\n", "Windows (as R doesn't support UTF-8 as native encoding on that\n", #> "platform).\n", "\n", "To alleviate some of the encoding pain, ", #> list("env_names()"), " always\n", "returns a UTF-8 character vector (which is fine even on Windows)\n", #> "with ASCII unicode points translated back to UTF-8.\n")), #> "\n", "\n", list("\n", "env <- env(a = 1, b = 2)\n", #> "env_names(env)\n"), "\n"), env_parent.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_parent"), "\n", list("env_parent"), #> "\n", list("env_tail"), "\n", list("env_parents"), #> "\n", list("Get parent environments"), "\n", #> list("\n", "env_parent(env = caller_env(), n = 1)\n", #> "\n", "env_tail(env = caller_env(), last = global_env())\n", #> "\n", "env_parents(env = caller_env(), last = global_env())\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("n"), list("The number of generations to go up.")), #> "\n", "\n", list(list("last"), list("The environment at which to stop. Defaults to the\n", #> "global environment. The empty environment is always a stopping\n", #> "condition so it is safe to leave the default even when taking the\n", #> "tail or the parents of an environment on the search path.\n", #> "\n", list("env_tail()"), " returns the environment which has ", #> list("last"), " as parent\n", "and ", list( #> "env_parents()"), " returns the list of environments up to ", #> list("last"), ".")), "\n"), "\n", list("\n", #> "An environment for ", list("env_parent()"), #> " and ", list("env_tail()"), ", a list\n", #> "of environments for ", list("env_parents()"), #> ".\n"), "\n", list("\n", list("\n", list(), #> " ", list("env_parent()"), " returns the parent environment of ", #> list("env"), " if called\n", "with ", list( #> "n = 1"), ", the grandparent with ", list( #> "n = 2"), ", etc.\n", list(), " ", list("env_tail()"), #> " searches through the parents and returns the one\n", #> "which has ", list(list("empty_env()")), " as parent.\n", #> list(), " ", list("env_parents()"), " returns the list of all parents, including the\n", #> "empty environment. This list is named using ", #> list(list("env_name()")), ".\n"), "\n", "\n", #> "See the section on ", list("inheritance"), #> " in ", list(list("env()")), "'s documentation.\n"), #> "\n", list("\n", "# Get the parent environment with env_parent():\n", #> "env_parent(global_env())\n", "\n", "# Or the tail environment with env_tail():\n", #> "env_tail(global_env())\n", "\n", "# By default, env_parent() returns the parent environment of the\n", #> "# current evaluation frame. If called at top-level (the global\n", #> "# frame), the following two expressions are equivalent:\n", #> "env_parent()\n", "env_parent(base_env())\n", #> "\n", "# This default is more handy when called within a function. In this\n", #> "# case, the enclosure environment of the function is returned\n", #> "# (since it is the parent of the evaluation frame):\n", #> "enclos_env <- env()\n", "fn <- set_env(function() env_parent(), enclos_env)\n", #> "identical(enclos_env, fn())\n"), "\n"), env_poke.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_poke"), "\n", list("env_poke"), #> "\n", list("Poke an object in an environment"), #> "\n", list("\n", "env_poke(env = caller_env(), nm, value, inherit = FALSE, create = !inherit)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nm"), list("Names of bindings. ", #> list("nm"), " must be a single string.")), #> "\n", "\n", list(list("value"), list("The value for a new binding.")), #> "\n", "\n", list(list("inherit"), list("Whether to look for bindings in the parent\n", #> "environments.")), "\n", "\n", list(list( #> "create"), list("Whether to create a binding if it does not already\n", #> "exist in the environment.")), "\n"), "\n", #> list("\n", "The old value of ", list("nm"), " or a ", #> list("zap sentinel"), " if the\n", "binding did not exist yet.\n"), #> "\n", list("\n", list("env_poke()"), " will assign or reassign a binding in ", #> list("env"), " if ", list("create"), "\n", #> "is ", list("TRUE"), ". If ", list("create"), #> " is ", list("FALSE"), " and a binding does not already\n", #> "exists, an error is issued.\n"), "\n", list( #> "\n", "If ", list("inherit"), " is ", list( #> "TRUE"), ", the parents environments are checked for\n", #> "an existing binding to reassign. If not found and ", #> list("create"), " is\n", list("TRUE"), ", a new binding is created in ", #> list("env"), ". The default value for\n", list( #> "create"), " is a function of ", list("inherit"), #> ": ", list("FALSE"), " when inheriting,\n", #> list("TRUE"), " otherwise.\n", "\n", "This default makes sense because the inheriting case is mostly\n", #> "for overriding an existing binding. If not found, something\n", #> "probably went wrong and it is safer to issue an error. Note that\n", #> "this is different to the base R operator ", #> list("<<-"), " which will create\n", "a binding in the global environment instead of the current\n", #> "environment when no existing binding is found in the parents.\n"), #> "\n", list("\n", list(list("env_bind()")), " for binding multiple elements.\n"), #> "\n"), env_print.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_print"), "\n", list("env_print"), #> "\n", list("Pretty-print an environment"), "\n", #> list("\n", "env_print(env = caller_env())\n"), #> "\n", list("\n", list(list("env"), list("An environment, or object that can be converted to an\n", #> "environment by ", list(list("get_env()")), #> ".")), "\n"), "\n", list("\n", "This prints:\n", #> list("\n", list(), " The ", list("label"), #> " and the parent label.\n", list(), " Whether the environment is ", #> list("locked"), ".\n", list(), " The bindings in the environment (up to 20 bindings). They are\n", #> "printed succintly using ", list("pillar::type_sum()"), #> " (if available,\n", "otherwise uses an internal version of that generic). In addition\n", #> list("fancy bindings"), " (actives and promises) are\n", #> "indicated as such.\n", list(), " Locked bindings get a ", #> list("[L]"), " tag\n"), "\n", "\n", "Note that printing a package namespace (see ", #> list(list("ns_env()")), ") with\n", list("env_print()"), #> " will typically tag function bindings as ", #> list("<lazy>"), "\n", "until they are evaluated the first time. This is because package\n", #> "functions are lazily-loaded from disk to improve performance when\n", #> "loading a package.\n"), "\n"), env_unbind.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_unbind"), "\n", list("env_unbind"), #> "\n", list("Remove bindings from an environment"), #> "\n", list("\n", "env_unbind(env = caller_env(), nms, inherit = FALSE)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nms"), list("A character vector of binding names to remove.")), #> "\n", "\n", list(list("inherit"), list("Whether to look for bindings in the parent\n", #> "environments.")), "\n"), "\n", list("\n", #> "The input object ", list("env"), " with its associated environment\n", #> "modified in place, invisibly.\n"), "\n", list( #> "\n", list("env_unbind()"), " is the complement of ", #> list(list("env_bind()")), ". Like ", list("env_has()"), #> ",\n", "it ignores the parent environments of ", #> list("env"), " by default. Set\n", list("inherit"), #> " to ", list("TRUE"), " to track down bindings in parent environments.\n"), #> "\n", list("\n", "env <- env(foo = 1, bar = 2)\n", #> "env_has(env, c(\"foo\", \"bar\"))\n", "\n", #> "# Remove bindings with `env_unbind()`\n", #> "env_unbind(env, c(\"foo\", \"bar\"))\n", "env_has(env, c(\"foo\", \"bar\"))\n", #> "\n", "# With inherit = TRUE, it removes bindings in parent environments\n", #> "# as well:\n", "parent <- env(empty_env(), foo = 1, bar = 2)\n", #> "env <- env(parent, foo = \"b\")\n", "\n", #> "env_unbind(env, \"foo\", inherit = TRUE)\n", #> "env_has(env, c(\"foo\", \"bar\"))\n", "env_has(env, c(\"foo\", \"bar\"), inherit = TRUE)\n"), #> "\n"), env_unlock.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_unlock"), "\n", list("env_unlock"), #> "\n", list("Unlock an environment"), "\n", list( #> "\n", "env_unlock(env)\n"), "\n", list("\n", #> list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "Whether the environment has been unlocked.\n"), #> "\n", list("\n", "This function should only be used in development tools or\n", #> "interactively.\n"), "\n", list("internal"), #> "\n"), eval_bare.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval.R", #> "\n", list("eval_bare"), "\n", list("eval_bare"), #> "\n", list("Evaluate an expression in an environment"), #> "\n", list("\n", "eval_bare(expr, env = parent.frame())\n"), #> "\n", list("\n", list(list("expr"), list("An expression to evaluate.")), #> "\n", "\n", list(list("env"), list("The environment in which to evaluate the expression.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", list("eval_bare()"), " is a lower-level version of function ", #> list(list("base::eval()")), ".\n", "Technically, it is a simple wrapper around the C function\n", #> list("Rf_eval()"), ". You generally don't need to use ", #> list("eval_bare()"), " instead\n", "of ", list( #> "eval()"), ". Its main advantage is that it handles stack-sensitive\n", #> "(calls such as ", list("return()"), ", ", #> list("on.exit()"), " or ", list("parent.frame()"), #> ") more\n", "consistently when you pass an enviroment of a frame on the call\n", #> "stack.\n"), "\n", list("\n", "These semantics are possible because ", #> list("eval_bare()"), " creates only one\n", #> "frame on the call stack whereas ", list("eval()"), #> " creates two frames, the\n", "second of which has the user-supplied environment as frame\n", #> "environment. When you supply an existing frame environment to\n", #> list("base::eval()"), " there will be two frames on the stack with the same\n", #> "frame environment. Stack-sensitive functions only detect the\n", #> "topmost of these frames. We call these evaluation semantics\n", #> "\"stack inconsistent\".\n", "\n", "Evaluating expressions in the actual frame environment has useful\n", #> "practical implications for ", list("eval_bare()"), #> ":\n", list("\n", list(), " ", list("return()"), #> " calls are evaluated in frame environments that might\n", #> "be burried deep in the call stack. This causes a long return that\n", #> "unwinds multiple frames (triggering the ", #> list("on.exit()"), " event for\n", "each frame). By contrast ", #> list("eval()"), " only returns from the ", #> list("eval()"), "\n", "call, one level up.\n", #> list(), " ", list("on.exit()"), ", ", list( #> "parent.frame()"), ", ", list("sys.call()"), #> ", and generally all\n", "the stack inspection functions ", #> list("sys.xxx()"), " are evaluated in the\n", #> "correct frame environment. This is similar to how this type of\n", #> "calls can be evaluated deep in the call stack because of lazy\n", #> "evaluation, when you force an argument that has been passed\n", #> "around several times.\n"), "\n", "\n", "The flip side of the semantics of ", #> list("eval_bare()"), " is that it can't\n", #> "evaluate ", list("break"), " or ", list("next"), #> " expressions even if called within a\n", "loop.\n"), #> "\n", list("\n", "# eval_bare() works just like base::eval() but you have to create\n", #> "# the evaluation environment yourself:\n", #> "eval_bare(quote(foo), env(foo = \"bar\"))\n", #> "\n", "# eval() has different evaluation semantics than eval_bare(). It\n", #> "# can return from the supplied environment even if its an\n", #> "# environment that is not on the call stack (i.e. because you've\n", #> "# created it yourself). The following would trigger an error with\n", #> "# eval_bare():\n", "ret <- quote(return(\"foo\"))\n", #> "eval(ret, env())\n", "# eval_bare(ret, env()) # \"no function to return from\" error\n", #> "\n", "# Another feature of eval() is that you can control surround loops:\n", #> "bail <- quote(break)\n", "while (TRUE) {\n", #> " eval(bail)\n", " # eval_bare(bail) # \"no loop for break/next\" error\n", #> "}\n", "\n", "# To explore the consequences of stack inconsistent semantics, let's\n", #> "# create a function that evaluates `parent.frame()` deep in the call\n", #> "# stack, in an environment corresponding to a frame in the middle of\n", #> "# the stack. For consistency with R's lazy evaluation semantics, we'd\n", #> "# expect to get the caller of that frame as result:\n", #> "fn <- function(eval_fn) {\n", " list(\n", #> " returned_env = middle(eval_fn),\n", " actual_env = current_env()\n", #> " )\n", "}\n", "middle <- function(eval_fn) {\n", #> " deep(eval_fn, current_env())\n", "}\n", #> "deep <- function(eval_fn, eval_env) {\n", #> " expr <- quote(parent.frame())\n", " eval_fn(expr, eval_env)\n", #> "}\n", "\n", "# With eval_bare(), we do get the expected environment:\n", #> "fn(rlang::eval_bare)\n", "\n", "# But that's not the case with base::eval():\n", #> "fn(base::eval)\n"), "\n", list("\n", list( #> list("eval_tidy()")), " for evaluation with data mask and quosure\n", #> "support.\n"), "\n"), eval_tidy.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval-tidy.R", #> "\n", list("eval_tidy"), "\n", list("eval_tidy"), #> "\n", list("Evaluate an expression with quosures and pronoun support"), #> "\n", list("\n", "eval_tidy(expr, data = NULL, env = caller_env())\n"), #> "\n", list("\n", list(list("expr"), list("An expression or quosure to evaluate.")), #> "\n", "\n", list(list("data"), list("A data frame, or named list or vector. Alternatively, a\n", #> "data mask created with ", list(list("as_data_mask()")), #> " or\n", list(list("new_data_mask()")), ". Objects in ", #> list("data"), " have priority over those in\n", #> list("env"), ". See the section about data masking.")), #> "\n", "\n", list(list("env"), list("The environment in which to evaluate ", #> list("expr"), ". This\n", "environment is not applicable for quosures because they have\n", #> "their own environments.")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", list("eval_tidy()"), " is a variant of ", #> list(list("base::eval()")), " that powers the tidy\n", #> "evaluation framework. Like ", list("eval()"), #> " it accepts user data as\n", "argument. Whereas ", #> list("eval()"), " simply transforms the data to an\n", #> "environment, ", list("eval_tidy()"), " transforms it to a ", #> list("data mask"), " with\n", list(list("as_data_mask()")), #> ". Evaluating in a data mask enables the following\n", #> "features:\n", list("\n", list(), " ", list( #> "Quosures"), ". Quosures are expressions bundled with an\n", #> "environment. If ", list("data"), " is supplied, objects in the data mask\n", #> "always have precedence over the quosure environment, i.e. the\n", #> "data masks the environment.\n", list(), #> " ", list("Pronouns"), ". If ", list("data"), #> " is supplied, the ", list(".env"), " and ", #> list(".data"), "\n", "pronouns are installed in the data mask. ", #> list(".env"), " is a reference to\n", "the calling environment and ", #> list(".data"), " refers to the ", list("data"), #> " argument.\n", "These pronouns lets you be explicit about where to find\n", #> "values and throw errors if you try to access non-existent values.\n"), #> "\n"), "\n", list(list("Data masking"), list( #> "\n", "\n", "\n", "Data masking refers to how columns or objects inside ", #> list("data"), " have\n", "priority over objects defined in ", #> list("env"), " (or in the quosure\n", "environment, if applicable). If there is a column ", #> list("var"), " in ", list("data"), "\n", "and an object ", #> list("var"), " in ", list("env"), ", and ", #> list("expr"), " refers to ", list("var"), ", the\n", #> "column has priority:", list("var <- \"this one?\"\n", #> "data <- data.frame(var = rep(\"Or that one?\", 3))\n", #> "\n", "within <- function(data, expr) {\n", #> " eval_tidy(enquo(expr), data)\n", "}\n", #> "\n", "within(data, toupper(var))\n", "#> [1] \"OR THAT ONE?\" \"OR THAT ONE?\" \"OR THAT ONE?\"\n"), #> "\n", "\n", "Because the columns or objects in ", #> list("data"), " are always found first,\n", #> "before objects from ", list("env"), ", we say that the data \"masks\" the\n", #> "environment.\n")), "\n", "\n", list(list("When should eval_tidy() be used instead of eval()?"), #> list("\n", "\n", "\n", list("base::eval()"), #> " is sufficient for simple evaluation. Use\n", #> list("eval_tidy()"), " when you'd like to support expressions referring to\n", #> "the ", list(".data"), " pronoun, or when you need to support quosures.\n", #> "\n", "If you're evaluating an expression captured with quasiquotation\n", #> "support, it is recommended to use ", list( #> "eval_tidy()"), " because users will\n", #> "likely unquote quosures.\n", "\n", "Note that unwrapping a quosure with ", #> list(list("quo_get_expr()")), " does not\n", #> "guarantee that there is no quosures inside the expression. Quosures\n", #> "might be unquoted anywhere. For instance, the following does not\n", #> "work reliably in the presence of nested quosures:", #> list("my_quoting_fn <- function(x) {\n", #> " x <- enquo(x)\n", " expr <- quo_get_expr(x)\n", #> " env <- quo_get_env(x)\n", " eval(expr, env)\n", #> "}\n", "\n", "# Works:\n", "my_quoting_fn(toupper(letters))\n", #> "\n", "# Fails because of a nested quosure:\n", #> "my_quoting_fn(toupper(!!quo(letters)))\n"), #> "\n")), "\n", "\n", list(list("Stack semantics of ", #> list("eval_tidy()")), list("\n", "\n", "\n", #> list("eval_tidy()"), " always evaluates in a data mask, even when ", #> list("data"), " is\n", list("NULL"), ". Because of this, it has different stack semantics than\n", #> list(list("base::eval()")), ":\n", list("\n", #> list(), " Lexical side effects, such as assignment with ", #> list("<-"), ", occur in the\n", "mask rather than ", #> list("env"), ".\n", list(), " Functions that require the evaluation environment to correspond\n", #> "to a frame on the call stack do not work. This is why ", #> list("return()"), "\n", "called from a quosure does not work.\n", #> list(), " The mask environment creates a new branch in the tree\n", #> "representation of backtraces (which you can visualise in a\n", #> list(list("browser()")), " session with ", #> list("lobstr::cst()"), ").\n"), "\n", "\n", #> "See also ", list(list("eval_bare()")), " for more information about these differences.\n")), #> "\n", "\n", list(list("Life cycle"), list("\n", #> "\n", "\n", list("rlang 0.3.0"), "\n", "\n", #> "Passing an environment to ", list("data"), #> " is deprecated. Please construct an\n", "rlang data mask with ", #> list(list("new_data_mask()")), ".\n")), "\n", #> "\n", list("\n", "\n", "# With simple quoted expressions eval_tidy() works the same way as\n", #> "# eval():\n", "apple <- \"apple\"\n", "kiwi <- \"kiwi\"\n", #> "expr <- quote(paste(apple, kiwi))\n", "expr\n", #> "\n", "eval(expr)\n", "eval_tidy(expr)\n", #> "\n", "# Both accept a data mask as argument:\n", #> "data <- list(apple = \"CARROT\", kiwi = \"TOMATO\")\n", #> "eval(expr, data)\n", "eval_tidy(expr, data)\n", #> "\n", "\n", "# In addition eval_tidy() has support for quosures:\n", #> "with_data <- function(data, expr) {\n", " quo <- enquo(expr)\n", #> " eval_tidy(quo, data)\n", "}\n", "with_data(NULL, apple)\n", #> "with_data(data, apple)\n", "with_data(data, list(apple, kiwi))\n", #> "\n", "# Secondly eval_tidy() installs handy pronouns that allow users to\n", #> "# be explicit about where to find symbols:\n", #> "with_data(data, .data$apple)\n", "with_data(data, .env$apple)\n", #> "\n", "\n", "# Note that instead of using `.env` it is often equivalent and may\n", #> "# be preferred to unquote a value. There are two differences. First\n", #> "# unquoting happens earlier, when the quosure is created. Secondly,\n", #> "# subsetting `.env` with the `$` operator may be brittle because\n", #> "# `$` does not look through the parents of the environment.\n", #> "#\n", "# For instance using `.env$name` in a magrittr pipeline is an\n", #> "# instance where this poses problem, because the magrittr pipe\n", #> "# currently (as of v1.5.0) evaluates its operands in a *child* of\n", #> "# the current environment (this child environment is where it\n", #> "# defines the pronoun `.`).\n", list("\n", #> " data %>% with_data(!!kiwi) # \"kiwi\"\n", #> " data %>% with_data(.env$kiwi) # NULL\n"), #> "\n"), "\n", list("\n", list("nse-force"), #> " for the second leg of the tidy evaluation\n", #> "framework.\n"), "\n"), exec.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval.R", #> "\n", list("exec"), "\n", list("exec"), "\n", #> list("Execute a function"), "\n", list("\n", #> "exec(.fn, ..., .env = caller_env())\n"), "\n", #> list("\n", list(list(".fn"), list("A function, or function name as a string.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> Arguments for ", list(".fn"), #> ".")), "\n", "\n", list(list(".env"), list( #> "Environment in which to evaluate the call. This will be\n", #> "most useful if ", list("f"), " is a string, or the function has side-effects.")), #> "\n"), "\n", list("\n", "This function constructs and evaluates a call to ", #> list(".fn"), ".\n", "It has two primary uses:\n", #> list("\n", list(), " To call a function with arguments stored in a list (if the\n", #> "function doesn't support ", list("dynamic dots"), #> "). Splice the\n", "list of arguments with ", #> list("!!!"), ".\n", list(), " To call every function stored in a list (in conjunction with ", #> list("map()"), "/\n", list(list("lapply()")), #> ")\n"), "\n"), "\n", list("\n", "args <- list(x = c(1:10, 100, NA), na.rm = TRUE)\n", #> "exec(\"mean\", !!!args)\n", "exec(\"mean\", !!!args, trim = 0.2)\n", #> "\n", "fs <- list(a = function() \"a\", b = function() \"b\")\n", #> "lapply(fs, exec)\n", "\n", "# Compare to do.call it will not automatically inline expressions\n", #> "# into the evaluated call.\n", "x <- 10\n", #> "args <- exprs(x1 = x + 1, x2 = x * 2)\n", #> "exec(list, !!!args)\n", "do.call(list, args)\n", #> "\n", "# exec() is not designed to generate pretty function calls. This is\n", #> "# most easily seen if you call a function that captures the call:\n", #> "f <- disp ~ cyl\n", "exec(\"lm\", f, data = mtcars)\n", #> "\n", "# If you need finer control over the generated call, you'll need to\n", #> "# construct it yourself. This may require creating a new environment\n", #> "# with carefully constructed bindings\n", #> "data_env <- env(data = mtcars)\n", "eval(expr(lm(!!f, data)), data_env)\n"), #> "\n"), exiting.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("exiting"), "\n", list("exiting"), #> "\n", list("Exiting handler"), "\n", list("\n", #> "exiting(handler)\n"), "\n", list("\n", list( #> "rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", "\n", list("exiting()"), " is no longer necessary as handlers are exiting by default.\n"), #> "\n", list("internal"), "\n"), expr_interp.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/nse-force.R", #> "\n", list("expr_interp"), "\n", list("expr_interp"), #> "\n", list("Process unquote operators in a captured expression"), #> "\n", list("\n", "expr_interp(x, env = NULL)\n"), #> "\n", list("\n", list(list("x"), list("A function, raw expression, or formula to interpolate.")), #> "\n", "\n", list(list("env"), list("The environment in which unquoted expressions should be\n", #> "evaluated. By default, the formula or closure environment if a\n", #> "formula or a function, or the current environment otherwise.")), #> "\n"), "\n", list("\n", "While all capturing functions in the tidy evaluation framework\n", #> "perform unquote on capture (most notably ", #> list(list("quo()")), "),\n", list("expr_interp()"), #> " manually processes unquoting operators in\n", #> "expressions that are already captured. ", #> list("expr_interp()"), " should be\n", "called in all user-facing functions expecting a formula as argument\n", #> "to provide the same quasiquotation functionality as NSE functions.\n"), #> "\n", list("\n", "# All tidy NSE functions like quo() unquote on capture:\n", #> "quo(list(!!(1 + 2)))\n", "\n", "# expr_interp() is meant to provide the same functionality when you\n", #> "# have a formula or expression that might contain unquoting\n", #> "# operators:\n", "f <- ~list(!!(1 + 2))\n", #> "expr_interp(f)\n", "\n", "# Note that only the outer formula is unquoted (which is a reason\n", #> "# to use expr_interp() as early as possible in all user-facing\n", #> "# functions):\n", "f <- ~list(~!!(1 + 2), !!(1 + 2))\n", #> "expr_interp(f)\n", "\n", "\n", "# Another purpose for expr_interp() is to interpolate a closure's\n", #> "# body. This is useful to inline a function within another. The\n", #> "# important limitation is that all formal arguments of the inlined\n", #> "# function should be defined in the receiving function:\n", #> "other_fn <- function(x) toupper(x)\n", "\n", #> "fn <- expr_interp(function(x) {\n", " x <- paste0(x, \"_suffix\")\n", #> " !!! body(other_fn)\n", "})\n", "fn\n", "fn(\"foo\")\n"), #> "\n"), expr_label.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/expr.R", #> "\n", list("expr_label"), "\n", list("expr_label"), #> "\n", list("expr_name"), "\n", list("expr_text"), #> "\n", list("Turn an expression to a label"), #> "\n", list("\n", "expr_label(expr)\n", "\n", #> "expr_name(expr)\n", "\n", "expr_text(expr, width = 60L, nlines = Inf)\n"), #> "\n", list("\n", list(list("expr"), list("An expression to labellise.")), #> "\n", "\n", list(list("width"), list("Width of each line.")), #> "\n", "\n", list(list("nlines"), list("Maximum number of lines to extract.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", list("expr_text()"), " turns the expression into a single string, which\n", #> "might be multi-line. ", list("expr_name()"), #> " is suitable for formatting\n", "names. It works best with symbols and scalar types, but also\n", #> "accepts calls. ", list("expr_label()"), " formats the expression nicely for use\n", #> "in messages.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "These functions are in the questioning stage because they are\n", #> "redundant with the ", list("quo_"), " variants and do not handle quosures.\n")), #> "\n", "\n", list("\n", "# To labellise a function argument, first capture it with\n", #> "# substitute():\n", "fn <- function(x) expr_label(substitute(x))\n", #> "fn(x:y)\n", "\n", "# Strings are encoded\n", #> "expr_label(\"a\\nb\")\n", "\n", "# Names and expressions are quoted with ``\n", #> "expr_label(quote(x))\n", "expr_label(quote(a + b + c))\n", #> "\n", "# Long expressions are collapsed\n", #> "expr_label(quote(foo({\n", " 1 + 2\n", " print(x)\n", #> "})))\n"), "\n"), expr_print.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/expr.R", #> "\n", list("expr_print"), "\n", list("expr_print"), #> "\n", list("expr_deparse"), "\n", list("Print an expression"), #> "\n", list("\n", "expr_print(x, width = peek_option(\"width\"))\n", #> "\n", "expr_deparse(x, width = peek_option(\"width\"))\n"), #> "\n", list("\n", list(list("x"), list("An object or expression to print.")), #> "\n", "\n", list(list("width"), list("The width of the deparsed or printed expression.\n", #> "Defaults to the global option ", list("width"), #> ".")), "\n"), "\n", list("\n", list("expr_print()"), #> ", powered by ", list("expr_deparse()"), ", is an alternative\n", #> "printer for R expressions with a few improvements over the base R\n", #> "printer.\n", list("\n", list(), " It colourises ", #> list("quosures"), " according to their environment.\n", #> "Quosures from the global environment are printed normally while\n", #> "quosures from local environments are printed in unique colour (or\n", #> "in italic when all colours are taken).\n", #> list(), " It wraps inlined objects in angular brackets. For instance, an\n", #> "integer vector unquoted in a function call (e.g.\n", #> list("expr(foo(!!(1:3)))"), ") is printed like this: ", #> list("foo(<int: 1L, 2L, 3L>)"), " while by default R prints the code to create that vector:\n", #> list("foo(1:3)"), " which is ambiguous.\n", #> list(), " It respects the width boundary (from the global option ", #> list("width"), ")\n", "in more cases.\n"), #> "\n"), "\n", list("\n", "# It supports any object. Non-symbolic objects are always printed\n", #> "# within angular brackets:\n", "expr_print(1:3)\n", #> "expr_print(function() NULL)\n", "\n", "# Contrast this to how the code to create these objects is printed:\n", #> "expr_print(quote(1:3))\n", "expr_print(quote(function() NULL))\n", #> "\n", "# The main cause of non-symbolic objects in expressions is\n", #> "# quasiquotation:\n", "expr_print(expr(foo(!!(1:3))))\n", #> "\n", "\n", "# Quosures from the global environment are printed normally:\n", #> "expr_print(quo(foo))\n", "expr_print(quo(foo(!!quo(bar))))\n", #> "\n", "# Quosures from local environments are colourised according to\n", #> "# their environments (if you have crayon installed):\n", #> "local_quo <- local(quo(foo))\n", "expr_print(local_quo)\n", #> "\n", "wrapper_quo <- local(quo(bar(!!local_quo, baz)))\n", #> "expr_print(wrapper_quo)\n"), "\n"), exprs_auto_name.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/nse-defuse.R", #> "\n", list("exprs_auto_name"), "\n", list("exprs_auto_name"), #> "\n", list("quos_auto_name"), "\n", list("Ensure that all elements of a list of expressions are named"), #> "\n", list("\n", "exprs_auto_name(exprs, width = NULL, printer = NULL)\n", #> "\n", "quos_auto_name(quos, width = NULL)\n"), #> "\n", list("\n", list(list("exprs"), list("A list of expressions.")), #> "\n", "\n", list(list("width"), list("Deprecated. Maximum width of names.")), #> "\n", "\n", list(list("printer"), list("Deprecated. A function that takes an expression\n", #> "and converts it to a string. This function must take an\n", #> "expression as the first argument and ", #> list("width"), " as the second\n", "argument.")), #> "\n", "\n", list(list("quos"), list("A list of quosures.")), #> "\n"), "\n", list("\n", "This gives default names to unnamed elements of a list of\n", #> "expressions (or expression wrappers such as formulas or\n", #> "quosures). ", list("exprs_auto_name()"), " deparses the expressions with\n", #> list(list("expr_name()")), " by default. ", #> list("quos_auto_name()"), " deparses with\n", #> list(list("quo_name()")), ".\n"), "\n"), f_rhs.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/formula.R", #> "\n", list("f_rhs"), "\n", list("f_rhs"), "\n", #> list("f_rhs<-"), "\n", list("f_lhs"), "\n", list( #> "f_lhs<-"), "\n", list("f_env"), "\n", list( #> "f_env<-"), "\n", list("Get or set formula components"), #> "\n", list("\n", "f_rhs(f)\n", "\n", "f_rhs(x) <- value\n", #> "\n", "f_lhs(f)\n", "\n", "f_lhs(x) <- value\n", #> "\n", "f_env(f)\n", "\n", "f_env(x) <- value\n"), #> "\n", list("\n", list(list("f, x"), list("A formula")), #> "\n", "\n", list(list("value"), list("The value to replace with.")), #> "\n"), "\n", list("\n", list("f_rhs"), " and ", #> list("f_lhs"), " return language objects (i.e. atomic\n", #> "vectors of length 1, a name, or a call). ", #> list("f_env"), " returns an\n", "environment.\n"), #> "\n", list("\n", list("f_rhs"), " extracts the righthand side, ", #> list("f_lhs"), " extracts the lefthand\n", #> "side, and ", list("f_env"), " extracts the environment. All functions throw an\n", #> "error if ", list("f"), " is not a formula.\n"), #> "\n", list("\n", "f_rhs(~ 1 + 2 + 3)\n", "f_rhs(~ x)\n", #> "f_rhs(~ \"A\")\n", "f_rhs(1 ~ 2)\n", "\n", #> "f_lhs(~ y)\n", "f_lhs(x ~ y)\n", "\n", "f_env(~ x)\n"), #> "\n"), f_text.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/formula.R", #> "\n", list("f_text"), "\n", list("f_text"), "\n", #> list("f_name"), "\n", list("f_label"), "\n", #> list("Turn RHS of formula into a string or label"), #> "\n", list("\n", "f_text(x, width = 60L, nlines = Inf)\n", #> "\n", "f_name(x)\n", "\n", "f_label(x)\n"), #> "\n", list("\n", list(list("x"), list("A formula.")), #> "\n", "\n", list(list("width"), list("Width of each line.")), #> "\n", "\n", list(list("nlines"), list("Maximum number of lines to extract.")), #> "\n"), "\n", list("\n", "Equivalent of ", list( #> list("expr_text()")), " and ", list(list("expr_label()")), #> " for formulas.\n"), "\n", list("\n", "f <- ~ a + b + bc\n", #> "f_text(f)\n", "f_label(f)\n", "\n", "# Names a quoted with ``\n", #> "f_label(~ x)\n", "# Strings are encoded\n", #> "f_label(~ \"a\\nb\")\n", "# Long expressions are collapsed\n", #> "f_label(~ foo({\n", " 1 + 2\n", " print(x)\n", #> "}))\n"), "\n"), `faq-options.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/faq.R", #> "\n", list("faq-options"), "\n", list("faq-options"), #> "\n", list("Global options for rlang"), "\n", #> list("\n", "rlang has several options which may be set globally to control\n", #> "behavior. A brief description of each is given here. If any functions\n", #> "are referenced, refer to their documentation for additional details.\n", #> list("\n", list(), " ", list("rlang_interactive"), #> ": A logical value used by ", list(list("is_interactive()")), #> ". This\n", "can be set to ", list("TRUE"), #> " to test interactive behavior in unit tests,\n", #> "for example.\n", list(), " ", list("rlang_backtrace_on_error"), #> ": A character string which controls whether\n", #> "backtraces are displayed with error messages, and the level of\n", #> "detail they print. See ", list("rlang_backtrace_on_error"), #> " for the possible option values.\n", list(), #> " ", list("rlang_trace_format_srcrefs"), #> ": A logical value used to control whether\n", #> "srcrefs are printed as part of the backtrace.\n", #> list(), " ", list("rlang_trace_top_env"), #> ": An environment which will be treated as the\n", #> "top-level environment when printing traces. See ", #> list(list("trace_back()")), "\n", "for examples.\n"), #> "\n"), "\n"), flatten.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-squash.R", #> "\n", list("flatten"), "\n", list("flatten"), #> "\n", list("flatten_lgl"), "\n", list("flatten_int"), #> "\n", list("flatten_dbl"), "\n", list("flatten_cpl"), #> "\n", list("flatten_chr"), "\n", list("flatten_raw"), #> "\n", list("squash"), "\n", list("squash_lgl"), #> "\n", list("squash_int"), "\n", list("squash_dbl"), #> "\n", list("squash_cpl"), "\n", list("squash_chr"), #> "\n", list("squash_raw"), "\n", list("flatten_if"), #> "\n", list("squash_if"), "\n", list("Flatten or squash a list of lists into a simpler vector"), #> "\n", list("\n", "flatten(x)\n", "\n", "flatten_lgl(x)\n", #> "\n", "flatten_int(x)\n", "\n", "flatten_dbl(x)\n", #> "\n", "flatten_cpl(x)\n", "\n", "flatten_chr(x)\n", #> "\n", "flatten_raw(x)\n", "\n", "squash(x)\n", #> "\n", "squash_lgl(x)\n", "\n", "squash_int(x)\n", #> "\n", "squash_dbl(x)\n", "\n", "squash_cpl(x)\n", #> "\n", "squash_chr(x)\n", "\n", "squash_raw(x)\n", #> "\n", "flatten_if(x, predicate = is_spliced)\n", #> "\n", "squash_if(x, predicate = is_spliced)\n"), #> "\n", list("\n", list(list("x"), list("A list to flatten or squash. The contents of the list can\n", #> "be anything for unsuffixed functions ", list( #> "flatten()"), " and ", list("squash()"), #> "\n", "(as a list is returned), but the contents must match the type for\n", #> "the other functions.")), "\n", "\n", list( #> list("predicate"), list("A function of one argument returning whether it\n", #> "should be spliced.")), "\n"), "\n", list( #> "\n", list("flatten()"), " returns a list, ", #> list("flatten_lgl()"), " a logical\n", "vector, ", #> list("flatten_int()"), " an integer vector, ", #> list("flatten_dbl()"), " a\n", "double vector, and ", #> list("flatten_chr()"), " a character vector. Similarly\n", #> "for ", list("squash()"), " and the typed variants (", #> list("squash_lgl()"), " etc).\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", list("flatten()"), " removes one level hierarchy from a list, while\n", #> list("squash()"), " removes all levels. These functions are similar to\n", #> list(list("unlist()")), " but they are type-stable so you always know what the\n", #> "type of the output is.\n"), "\n", list(list( #> "Life cycle"), list("\n", "\n", "\n", "These functions are in the questioning stage. They have slightly\n", #> "different semantics than the flattening functions in purrr and we\n", #> "are currently rethinking our approach to flattening with the new\n", #> "typing facilities of the vctrs package.\n")), #> "\n", "\n", list("\n", "x <- replicate(2, sample(4), simplify = FALSE)\n", #> "x\n", "\n", "flatten(x)\n", "flatten_int(x)\n", #> "\n", "# With flatten(), only one level gets removed at a time:\n", #> "deep <- list(1, list(2, list(3)))\n", "flatten(deep)\n", #> "flatten(flatten(deep))\n", "\n", "# But squash() removes all levels:\n", #> "squash(deep)\n", "squash_dbl(deep)\n", "\n", #> "# The typed flatten functions remove one level and coerce to an atomic\n", #> "# vector at the same time:\n", "flatten_dbl(list(1, list(2)))\n", #> "\n", "# Only bare lists are flattened, but you can splice S3 lists\n", #> "# explicitly:\n", "foo <- set_attrs(list(\"bar\"), class = \"foo\")\n", #> "str(flatten(list(1, foo, list(100))))\n", #> "str(flatten(list(1, splice(foo), list(100))))\n", #> "\n", "# Instead of splicing manually, flatten_if() and squash_if() let\n", #> "# you specify a predicate function:\n", "is_foo <- function(x) inherits(x, \"foo\") || is_bare_list(x)\n", #> "str(flatten_if(list(1, foo, list(100)), is_foo))\n", #> "\n", "# squash_if() does the same with deep lists:\n", #> "deep_foo <- list(1, list(foo, list(foo, 100)))\n", #> "str(deep_foo)\n", "\n", "str(squash(deep_foo))\n", #> "str(squash_if(deep_foo, is_foo))\n"), "\n", #> list("internal"), "\n"), fn_body.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("fn_body"), "\n", list("fn_body"), #> "\n", list("fn_body<-"), "\n", list("Get or set function body"), #> "\n", list("\n", "fn_body(fn = caller_fn())\n", #> "\n", "fn_body(fn) <- value\n"), "\n", list( #> "\n", list(list("fn"), list("A function. It is lookep up in the calling frame if not\n", #> "supplied.")), "\n", "\n", list(list("value"), #> list("New formals or formals names for ", #> list("fn"), ".")), "\n"), "\n", list("\n", #> list("fn_body()"), " is a simple wrapper around ", #> list(list("base::body()")), ". It always\n", #> "returns a ", list("\\{"), " expression and throws an error when the input is a\n", #> "primitive function (whereas ", list("body()"), #> " returns ", list("NULL"), "). The setter\n", #> "version preserves attributes, unlike ", list( #> "body<-"), ".\n"), "\n", list("\n", "# fn_body() is like body() but always returns a block:\n", #> "fn <- function() do()\n", "body(fn)\n", "fn_body(fn)\n", #> "\n", "# It also throws an error when used on a primitive function:\n", #> "try(fn_body(base::list))\n"), "\n"), fn_env.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("fn_env"), "\n", list("fn_env"), "\n", #> list("fn_env<-"), "\n", list("Return the closure environment of a function"), #> "\n", list("\n", "fn_env(fn)\n", "\n", "fn_env(x) <- value\n"), #> "\n", list("\n", list(list("fn, x"), list("A function.")), #> "\n", "\n", list(list("value"), list("A new closure environment for the function.")), #> "\n"), "\n", list("\n", "Closure environments define the scope of functions (see ", #> list(list("env()")), ").\n", "When a function call is evaluated, R creates an evaluation frame\n", #> "(see ", list(list("ctxt_stack()")), ") that inherits from the closure environment.\n", #> "This makes all objects defined in the closure environment and all\n", #> "its parents available to code executed within the function.\n"), #> "\n", list("\n", list("fn_env()"), " returns the closure environment of ", #> list("fn"), ". There is also\n", "an assignment method to set a new closure environment.\n"), #> "\n", list("\n", "env <- child_env(\"base\")\n", #> "fn <- with_env(env, function() NULL)\n", "identical(fn_env(fn), env)\n", #> "\n", "other_env <- child_env(\"base\")\n", #> "fn_env(fn) <- other_env\n", "identical(fn_env(fn), other_env)\n"), #> "\n"), fn_fmls.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("fn_fmls"), "\n", list("fn_fmls"), #> "\n", list("fn_fmls_names"), "\n", list("fn_fmls_syms"), #> "\n", list("fn_fmls<-"), "\n", list("fn_fmls_names<-"), #> "\n", list("Extract arguments from a function"), #> "\n", list("\n", "fn_fmls(fn = caller_fn())\n", #> "\n", "fn_fmls_names(fn = caller_fn())\n", #> "\n", "fn_fmls_syms(fn = caller_fn())\n", "\n", #> "fn_fmls(fn) <- value\n", "\n", "fn_fmls_names(fn) <- value\n"), #> "\n", list("\n", list(list("fn"), list("A function. It is lookep up in the calling frame if not\n", #> "supplied.")), "\n", "\n", list(list("value"), #> list("New formals or formals names for ", list( #> "fn"), ".")), "\n"), "\n", list("\n", list( #> "fn_fmls()"), " returns a named list of formal arguments.\n", #> list("fn_fmls_names()"), " returns the names of the arguments.\n", #> list("fn_fmls_syms()"), " returns formals as a named list of symbols. This\n", #> "is especially useful for forwarding arguments in ", #> list("constructed calls"), ".\n"), "\n", list( #> "\n", "Unlike ", list("formals()"), ", these helpers throw an error with primitive\n", #> "functions instead of returning ", list("NULL"), #> ".\n"), "\n", list("\n", "# Extract from current call:\n", #> "fn <- function(a = 1, b = 2) fn_fmls()\n", #> "fn()\n", "\n", "# fn_fmls_syms() makes it easy to forward arguments:\n", #> "call2(\"apply\", !!! fn_fmls_syms(lapply))\n", #> "\n", "# You can also change the formals:\n", #> "fn_fmls(fn) <- list(A = 10, B = 20)\n", "fn()\n", #> "\n", "fn_fmls_names(fn) <- c(\"foo\", \"bar\")\n", #> "fn()\n"), "\n", list("\n", list(list("call_args()")), #> " and ", list(list("call_args_names()")), "\n"), #> "\n"), format_error_bullets.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-message.R", #> "\n", list("format_error_bullets"), "\n", list( #> "format_error_bullets"), "\n", list("Format bullets for error messages"), #> "\n", list("\n", "format_error_bullets(x)\n"), #> "\n", list("\n", list(list("x"), list("A named character vector of messages. Elements named as\n", #> list("x"), " or ", list("i"), " are prefixed with the corresponding bullet.")), #> "\n"), "\n", list("\n", list("format_error_bullets()"), #> " takes a character vector and returns a single\n", #> "string (or an empty vector if the input is empty). The elements of\n", #> "the input vector are assembled as a list of bullets, depending on\n", #> "their names:\n", list("\n", list(), " Elements named ", #> list("\"i\""), " are bulleted with a blue \"info\" symbol.\n", #> list(), " Elements named ", list("\"x\""), #> " are bulleted with a red \"cross\" symbol.\n", #> list(), " Unnamed elements are bulleted with a \"*\" symbol.\n"), #> "\n", "\n", "This experimental infrastructure is based on the idea that\n", #> "sentences in error messages are best kept short and simple. From\n", #> "this point of view, the best way to present the information is in\n", #> "the ", list(list("cnd_body()")), " method of an error conditon, as a bullet list of\n", #> "simple sentences containing a single clause. The info and cross\n", #> "symbols of the bullets provide hints on how to interpret the bullet\n", #> "relative to the general error issue, which should be supplied as\n", #> list(list("cnd_header()")), ".\n"), "\n"), #> frame_position.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("frame_position"), "\n", list("frame_position"), #> "\n", list("Find the position or distance of a frame on the evaluation stack"), #> "\n", list("\n", "frame_position(frame, from = c(\"global\", \"current\"))\n"), #> "\n", list("\n", list(list("frame"), list("The environment of a frame. Can be any object with a\n", #> list(list("get_env()")), " method. Note that for frame objects, the position from\n", #> "the global frame is simply ", list("frame$pos"), #> ". Alternatively, ", list("frame"), "\n", "can be an integer that represents the position on the stack (and\n", #> "is thus returned as is if ", list("from"), #> " is \"global\".")), "\n", "\n", list(list( #> "from"), list("Whether to compute distance from the global frame (the\n", #> "bottom of the evaluation stack), or from the current frame (the\n", #> "top of the evaluation stack).")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "The frame position on the stack can be computed by counting frames\n", #> "from the global frame (the bottom of the stack, the default) or\n", #> "from the current frame (the top of the stack).\n"), #> "\n", list("\n", "While this function returns the position of the frame on the\n", #> "evaluation stack, it can safely be called with intervening frames\n", #> "as those will be discarded.\n"), "\n", list( #> list("Life cycle"), list("\n", "\n", "\n", #> "These functions are deprecated and replaced by ", #> list(list("trace_back()")), ".\n")), "\n", #> "\n", list("\n", "fn <- function() g(environment())\n", #> "g <- function(env) frame_position(env)\n", #> "\n", "# frame_position() returns the position of the frame on the evaluation stack:\n", #> "fn()\n", "identity(identity(fn()))\n", "\n", #> "# Note that it trims off intervening calls before counting so you\n", #> "# can safely nest it within other calls:\n", #> "g <- function(env) identity(identity(frame_position(env)))\n", #> "fn()\n", "\n", "# You can also ask for the position from the current frame rather\n", #> "# than the global frame:\n", "fn <- function() g(environment())\n", #> "g <- function(env) h(env)\n", "h <- function(env) frame_position(env, from = \"current\")\n", #> "fn()\n"), "\n", list("internal"), "\n"), friendly_type.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("friendly_type"), "\n", list("friendly_type"), #> "\n", list("Format a type for error messages"), #> "\n", list("\n", "friendly_type(type)\n"), "\n", #> list("\n", list(list("type"), list("A type as returned by ", #> list(list("typeof()")), ".")), "\n"), "\n", #> list("\n", "A string of the prettified type, qualified with an\n", #> "indefinite article.\n"), "\n", list("\n", #> "Format a type for error messages\n"), "\n", #> list(list("Life cycle"), list("\n", "\n", list( #> "\n", list(), " ", list("friendly_type()"), #> " is experimental.\n"), "\n")), "\n", "\n", #> list("\n", "friendly_type(\"logical\")\n", "friendly_type(\"integer\")\n", #> "friendly_type(\"string\")\n"), "\n", list( #> "internal"), "\n"), get_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("get_env"), "\n", list("get_env"), #> "\n", list("set_env"), "\n", list("env_poke_parent"), #> "\n", list("Get or set the environment of an object"), #> "\n", list("\n", "get_env(env, default = NULL)\n", #> "\n", "set_env(env, new_env = caller_env())\n", #> "\n", "env_poke_parent(env, new_env)\n"), "\n", #> list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("default"), list("The default environment in case ", #> list("env"), " does not wrap\n", "an environment. If ", #> list("NULL"), " and no environment could be extracted,\n", #> "an error is issued.")), "\n", "\n", list( #> list("new_env"), list("An environment to replace ", #> list("env"), " with.")), "\n"), "\n", list( #> "\n", "These functions dispatch internally with methods for functions,\n", #> "formulas and frames. If called with a missing argument, the\n", #> "environment of the current evaluation frame (see ", #> list(list("ctxt_stack()")), ") is\n", "returned. If you call ", #> list("get_env()"), " with an environment, it acts as\n", #> "the identity function and the environment is simply returned (this\n", #> "helps simplifying code when writing generic functions for\n", #> "environments).\n"), "\n", list("\n", "While ", #> list("set_env()"), " returns a modified copy and does not have side\n", #> "effects, ", list("env_poke_parent()"), " operates changes the environment by\n", #> "side effect. This is because environments are\n", #> list("uncopyable"), ". Be careful not to change environments\n", #> "that you don't own, e.g. a parent environment of a function from a\n", #> "package.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", list("\n", list(), " Using ", #> list("get_env()"), " without supplying ", #> list("env"), " is deprecated as\n", "of rlang 0.3.0. Please use ", #> list(list("current_env()")), " to retrieve the\n", #> "current environment.\n", list(), " Passing environment wrappers like formulas or functions instead\n", #> "of bare environments is deprecated as of rlang 0.3.0. This\n", #> "internal genericity was causing confusion (see issue #427). You\n", #> "should now extract the environment separately before calling\n", #> "these functions.\n"), "\n")), "\n", "\n", #> list("\n", "# Environment of closure functions:\n", #> "fn <- function() \"foo\"\n", "get_env(fn)\n", #> "\n", "# Or of quosures or formulas:\n", "get_env(~foo)\n", #> "get_env(quo(foo))\n", "\n", "\n", "# Provide a default in case the object doesn't bundle an environment.\n", #> "# Let's create an unevaluated formula:\n", #> "f <- quote(~foo)\n", "\n", "# The following line would fail if run because unevaluated formulas\n", #> "# don't bundle an environment (they didn't have the chance to\n", #> "# record one yet):\n", "# get_env(f)\n", "\n", #> "# It is often useful to provide a default when you're writing\n", #> "# functions accepting formulas as input:\n", #> "default <- env()\n", "identical(get_env(f, default), default)\n", #> "\n", "# set_env() can be used to set the enclosure of functions and\n", #> "# formulas. Let's create a function with a particular environment:\n", #> "env <- child_env(\"base\")\n", "fn <- set_env(function() NULL, env)\n", #> "\n", "# That function now has `env` as enclosure:\n", #> "identical(get_env(fn), env)\n", "identical(get_env(fn), current_env())\n", #> "\n", "# set_env() does not work by side effect. Setting a new environment\n", #> "# for fn has no effect on the original function:\n", #> "other_env <- child_env(NULL)\n", "set_env(fn, other_env)\n", #> "identical(get_env(fn), other_env)\n", "\n", #> "# Since set_env() returns a new function with a different\n", #> "# environment, you'll need to reassign the result:\n", #> "fn <- set_env(fn, other_env)\n", "identical(get_env(fn), other_env)\n"), #> "\n", list("\n", list(list("quo_get_env()")), #> " and ", list(list("quo_set_env()")), " for versions of\n", #> list(list("get_env()")), " and ", list(list( #> "set_env()")), " that only work on quosures.\n"), #> "\n"), has_length.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("has_length"), "\n", list("has_length"), #> "\n", list("How long is an object?"), "\n", list( #> "\n", "has_length(x, n = NULL)\n"), "\n", list( #> "\n", list(list("x"), list("A R object.")), #> "\n", "\n", list(list("n"), list("A specific length to test ", #> list("x"), " with. If ", list("NULL"), ",\n", #> list("has_length()"), " returns ", list("TRUE"), #> " if ", list("x"), " has length greater than\n", #> "zero, and ", list("FALSE"), " otherwise.")), #> "\n"), "\n", list("\n", "This is a function for the common task of testing the length of an\n", #> "object. It checks the length of an object in a non-generic way:\n", #> list(list("base::length()")), " methods are ignored.\n"), #> "\n", list("\n", "has_length(list())\n", "has_length(list(), 0)\n", #> "\n", "has_length(letters)\n", "has_length(letters, 20)\n", #> "has_length(letters, 26)\n"), "\n", list("internal"), #> "\n"), has_name.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("has_name"), "\n", list("has_name"), #> "\n", list("Does an object have an element with this name?"), #> "\n", list("\n", "has_name(x, name)\n"), "\n", #> list("\n", list(list("x"), list("A data frame or another named object")), #> "\n", "\n", list(list("name"), list("Element name(s) to check")), #> "\n"), "\n", list("\n", "A logical vector of the same length as ", #> list("name"), "\n"), "\n", list("\n", "This function returns a logical value that indicates if a data\n", #> "frame or another named object contains an element with a specific\n", #> "name. Note that ", list("has_name()"), " only works with vectors. For instance,\n", #> "environments need the specialised function ", #> list(list("env_has()")), ".\n"), "\n", list( #> "\n", "Unnamed objects are treated as if all names are empty strings. ", #> list("NA"), "\n", "input gives ", list("FALSE"), #> " as output.\n"), "\n", list("\n", "has_name(iris, \"Species\")\n", #> "has_name(mtcars, \"gears\")\n"), "\n"), hash.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/hash.R", #> "\n", list("hash"), "\n", list("hash"), "\n", #> list("Hash an object"), "\n", list("\n", "hash(x)\n"), #> "\n", list("\n", list(list("x"), list("An object.")), #> "\n"), "\n", list("\n", list("hash()"), " hashes an arbitrary R object.\n", #> "\n", "The generated hash is guaranteed to be reproducible across platforms, but\n", #> "not across R versions.\n"), "\n", list("\n", #> list("hash()"), " uses the XXH128 hash algorithm of the xxHash library, which\n", #> "generates a 128-bit hash. It is implemented as a streaming hash, which\n", #> "generates the hash with minimal extra memory usage.\n", #> "\n", "Objects are converted to binary using R's native serialization tools.\n", #> "On R >= 3.5.0, serialization version 3 is used, otherwise version 2 is used.\n", #> "See ", list(list("serialize()")), " for more information about the serialization version.\n"), #> "\n", list("\n", "hash(c(1, 2, 3))\n", "hash(mtcars)\n"), #> "\n"), inherits_any.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/s3.R", #> "\n", list("inherits_any"), "\n", list("inherits_any"), #> "\n", list("inherits_all"), "\n", list("inherits_only"), #> "\n", list("Does an object inherit from a set of classes?"), #> "\n", list("\n", "inherits_any(x, class)\n", #> "\n", "inherits_all(x, class)\n", "\n", "inherits_only(x, class)\n"), #> "\n", list("\n", list(list("x"), list("An object to test for inheritance.")), #> "\n", "\n", list(list("class"), list("A character vector of classes.")), #> "\n"), "\n", list("\n", list("\n", list(), #> " ", list("inherits_any()"), " is like ", list( #> list("base::inherits()")), " but is more explicit\n", #> "about its behaviour with multiple classes. If ", #> list("classes"), " contains\n", "several elements and the object inherits from at least one of\n", #> "them, ", list("inherits_any()"), " returns ", #> list("TRUE"), ".\n", list(), " ", list("inherits_all()"), #> " tests that an object inherits from all of the\n", #> "classes in the supplied order. This is usually the best way to\n", #> "test for inheritance of multiple classes.\n", #> list(), " ", list("inherits_only()"), " tests that the class vectors are identical. It\n", #> "is a shortcut for ", list("identical(class(x), class)"), #> ".\n"), "\n"), "\n", list("\n", "obj <- structure(list(), class = c(\"foo\", \"bar\", \"baz\"))\n", #> "\n", "# With the _any variant only one class must match:\n", #> "inherits_any(obj, c(\"foobar\", \"bazbaz\"))\n", #> "inherits_any(obj, c(\"foo\", \"bazbaz\"))\n", #> "\n", "# With the _all variant all classes must match:\n", #> "inherits_all(obj, c(\"foo\", \"bazbaz\"))\n", #> "inherits_all(obj, c(\"foo\", \"baz\"))\n", #> "\n", "# The order of classes must match as well:\n", #> "inherits_all(obj, c(\"baz\", \"foo\"))\n", #> "\n", "# inherits_only() checks that the class vectors are identical:\n", #> "inherits_only(obj, c(\"foo\", \"baz\"))\n", #> "inherits_only(obj, c(\"foo\", \"bar\", \"baz\"))\n"), #> "\n"), inject.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval.R", #> "\n", list("inject"), "\n", list("inject"), "\n", #> list("Inject objects in an R expression"), "\n", #> list("\n", "inject(expr, env = caller_env())\n"), #> "\n", list("\n", list(list("expr"), list("An argument to evaluate. This argument is immediately\n", #> "evaluated in ", list("env"), " (the current environment by default) with\n", #> "injected objects and expressions.")), "\n", #> "\n", list(list("env"), list("The environment in which to evaluate ", #> list("expr"), ". Defaults to\n", "the current environment. For expert use only.")), #> "\n"), "\n", list("\n", list("inject()"), " evaluates an expression with ", #> list("injection"), "\n", "(unquotation) support. There are three main usages:\n"), #> "\n", list("\n", list("\n", list(), " ", list( #> "Splicing"), " lists of arguments in a function call.\n", #> list(), " Inline objects or other expressions in an expression with ", #> list("!!"), "\n", "and ", list("!!!"), ". For instance to create functions or formulas\n", #> "programmatically.\n", list(), " Pass arguments to NSE functions that ", #> list("defuse"), " their\n", "arguments without injection support (see for instance\n", #> list(list("enquo0()")), "). You can use ", #> list("{{ arg }}"), " with functions documented\n", #> "to support quosures. Otherwise, use ", list( #> "!!enexpr(arg)"), ".\n"), "\n"), "\n", list( #> "\n", "# inject() simply evaluates its argument with injection\n", #> "# support. These expressions are equivalent:\n", #> "2 * 3\n", "inject(2 * 3)\n", "inject(!!2 * !!3)\n", #> "\n", "# Injection with `!!` can be useful to insert objects or\n", #> "# expressions within other expressions, like formulas:\n", #> "lhs <- sym(\"foo\")\n", "rhs <- sym(\"bar\")\n", #> "inject(!!lhs ~ !!rhs + 10)\n", "\n", "# Injection with `!!!` splices lists of arguments in function\n", #> "# calls:\n", "args <- list(na.rm = TRUE, finite = 0.2)\n", #> "inject(mean(1:10, !!!args))\n"), "\n"), invoke.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval.R", #> "\n", list("invoke"), "\n", list("invoke"), "\n", #> list("Invoke a function with a list of arguments"), #> "\n", list("\n", "invoke(.fn, .args = list(), ..., .env = caller_env(), .bury = c(\".fn\", \"\"))\n"), #> "\n", list("\n", list(list(".fn"), list("A function to invoke. Can be a function object or the\n", #> "name of a function in scope of ", list(".env"), #> ".")), "\n", "\n", list(list(".args, ..."), #> list("List of arguments (possibly named) to be passed to\n", #> list(".fn"), ".")), "\n", "\n", list(list( #> ".env"), list("The environment in which to call ", #> list(".fn"), ".")), "\n", "\n", list(list(".bury"), #> list("A character vector of length 2. The first string\n", #> "specifies which name should the function have in the call\n", #> "recorded in the evaluation stack. The second string specifies a\n", #> "prefix for the argument names. Set ", list( #> ".bury"), " to ", list("NULL"), " if you\n", #> "prefer to inline the function and its arguments in the call.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", "\n", "Normally, you invoke a R function by typing arguments manually. A\n", #> "powerful alternative is to call a function with a list of arguments\n", #> "assembled programmatically. This is the purpose of ", #> list("invoke()"), ".\n"), "\n", list("\n", #> "Technically, ", list("invoke()"), " is basically a version of ", #> list(list("base::do.call()")), "\n", "that creates cleaner call traces because it does not inline the\n", #> "function and the arguments in the call (see examples). To achieve\n", #> "this, ", list("invoke()"), " creates a child environment of ", #> list(".env"), " with ", list(".fn"), "\n", #> "and all arguments bound to new symbols (see ", #> list(list("env_bury()")), "). It then\n", "uses the same strategy as ", #> list(list("eval_bare()")), " to evaluate with minimal\n", #> "noise.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", list("invoke()"), " is soft-deprecated in favour of ", #> list(list("exec()")), ". Now that we\n", #> "understand better the interaction between unquoting and dots\n", #> "capture, we can take a simpler approach in ", #> list("exec()"), ".\n", "\n", "If you need finer control over the generated call, you should construct\n", #> "an environment and call yourself, manually burying large objects\n", #> "or complex expressions.\n")), "\n", "\n", #> list("\n", "# invoke() has the same purpose as do.call():\n", #> "invoke(paste, letters)\n", "\n", "# But it creates much cleaner calls:\n", #> "invoke(call_inspect, mtcars)\n", "\n", "# and stacktraces:\n", #> "fn <- function(...) sys.calls()\n", "invoke(fn, list(mtcars))\n", #> "\n", "# Compare to do.call():\n", "do.call(call_inspect, mtcars)\n", #> "do.call(fn, list(mtcars))\n", "\n", "\n", #> "# Specify the function name either by supplying a string\n", #> "# identifying the function (it should be visible in .env):\n", #> "invoke(\"call_inspect\", letters)\n", "\n", #> "# Or by changing the .bury argument, with which you can also change\n", #> "# the argument prefix:\n", "invoke(call_inspect, mtcars, .bury = c(\"inspect!\", \"col\"))\n"), #> "\n", list("internal"), "\n"), is_call.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("is_call"), "\n", list("is_call"), #> "\n", list("Is object a call?"), "\n", list("\n", #> "is_call(x, name = NULL, n = NULL, ns = NULL)\n"), #> "\n", list("\n", list(list("x"), list("An object to test. If a formula, the right-hand side is\n", #> "extracted.")), "\n", "\n", list(list("name"), #> list("An optional name that the call should match. It is\n", #> "passed to ", list(list("sym()")), " before matching. This argument is vectorised\n", #> "and you can supply a vector of names to match. In this case,\n", #> list("is_call()"), " returns ", list("TRUE"), #> " if at least one name matches.")), "\n", #> "\n", list(list("n"), list("An optional number of arguments that the call should\n", #> "match.")), "\n", "\n", list(list("ns"), #> list("The namespace of the call. If ", list( #> "NULL"), ", the namespace\n", "doesn't participate in the pattern-matching. If an empty string\n", #> list("\"\""), " and ", list("x"), " is a namespaced call, ", #> list("is_call()"), " returns\n", list("FALSE"), #> ". If any other string, ", list("is_call()"), #> " checks that ", list("x"), " is\n", "namespaced within ", #> list("ns"), ".\n", "\n", "Can be a character vector of namespaces, in which case the call\n", #> "has to match at least one of them, otherwise ", #> list("is_call()"), " returns\n", list("FALSE"), #> ".")), "\n"), "\n", list("\n", "This function tests if ", #> list("x"), " is a ", list("call"), ". This is a\n", #> "pattern-matching predicate that returns ", #> list("FALSE"), " if ", list("name"), " and ", #> list("n"), "\n", "are supplied and the call does not match these properties.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", list("is_lang()"), " has been soft-deprecated and renamed to ", #> list("is_call()"), " in\n", "rlang 0.2.0 and similarly for ", #> list("is_unary_lang()"), " and\n", list("is_binary_lang()"), #> ". This renaming follows the general switch from\n", #> "\"language\" to \"call\" in the rlang type nomenclature. See lifecycle\n", #> "section in ", list(list("call2()")), ".\n")), #> "\n", "\n", list("\n", "is_call(quote(foo(bar)))\n", #> "\n", "# You can pattern-match the call with additional arguments:\n", #> "is_call(quote(foo(bar)), \"foo\")\n", "is_call(quote(foo(bar)), \"bar\")\n", #> "is_call(quote(foo(bar)), quote(foo))\n", "\n", #> "# Match the number of arguments with is_call():\n", #> "is_call(quote(foo(bar)), \"foo\", 1)\n", "is_call(quote(foo(bar)), \"foo\", 2)\n", #> "\n", "\n", "# By default, namespaced calls are tested unqualified:\n", #> "ns_expr <- quote(base::list())\n", "is_call(ns_expr, \"list\")\n", #> "\n", "# You can also specify whether the call shouldn't be namespaced by\n", #> "# supplying an empty string:\n", "is_call(ns_expr, \"list\", ns = \"\")\n", #> "\n", "# Or if it should have a namespace:\n", #> "is_call(ns_expr, \"list\", ns = \"utils\")\n", #> "is_call(ns_expr, \"list\", ns = \"base\")\n", #> "\n", "# You can supply multiple namespaces:\n", #> "is_call(ns_expr, \"list\", ns = c(\"utils\", \"base\"))\n", #> "is_call(ns_expr, \"list\", ns = c(\"utils\", \"stats\"))\n", #> "\n", "# If one of them is \"\", unnamespaced calls will match as well:\n", #> "is_call(quote(list()), \"list\", ns = \"base\")\n", #> "is_call(quote(list()), \"list\", ns = c(\"base\", \"\"))\n", #> "is_call(quote(base::list()), \"list\", ns = c(\"base\", \"\"))\n", #> "\n", "\n", "# The name argument is vectorised so you can supply a list of names\n", #> "# to match with:\n", "is_call(quote(foo(bar)), c(\"bar\", \"baz\"))\n", #> "is_call(quote(foo(bar)), c(\"bar\", \"foo\"))\n", #> "is_call(quote(base::list), c(\"::\", \":::\", \"$\", \"@\"))\n"), #> "\n", list("\n", list(list("is_expression()")), #> "\n"), "\n"), is_callable.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("is_callable"), "\n", list("is_callable"), #> "\n", list("Is an object callable?"), "\n", list( #> "\n", "is_callable(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", "A callable object is an object that can appear in the function\n", #> "position of a call (as opposed to argument position). This includes\n", #> list("symbolic objects"), " that evaluate to a function or\n", #> "literal functions embedded in the call.\n"), #> "\n", list("\n", "Note that strings may look like callable objects because\n", #> "expressions of the form ", list("\"list\"()"), #> " are valid R code. However,\n", "that's only because the R parser transforms strings to symbols. It\n", #> "is not legal to manually set language heads to strings.\n"), #> "\n", list("\n", "# Symbolic objects and functions are callable:\n", #> "is_callable(quote(foo))\n", "is_callable(base::identity)\n", #> "\n", "# node_poke_car() lets you modify calls without any checking:\n", #> "lang <- quote(foo(10))\n", "node_poke_car(lang, current_env())\n", #> "\n", "# Use is_callable() to check an input object is safe to put as CAR:\n", #> "obj <- base::identity\n", "\n", "if (is_callable(obj)) {\n", #> " lang <- node_poke_car(lang, obj)\n", "} else {\n", #> " abort(\"`obj` must be callable\")\n", "}\n", #> "\n", "eval_bare(lang)\n"), "\n", list("internal"), #> "\n"), is_condition.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd.R", #> "\n", list("is_condition"), "\n", list("is_condition"), #> "\n", list("Is object a condition?"), "\n", list( #> "\n", "is_condition(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", "Is object a condition?\n"), #> "\n", list("internal"), "\n"), is_copyable.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_copyable"), "\n", list("is_copyable"), #> "\n", list("Is an object copyable?"), "\n", list( #> "\n", "is_copyable(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", "When an object is modified, R generally copies it (sometimes\n", #> "lazily) to enforce ", list(list("https://en.wikipedia.org/wiki/Value_semantics"), #> list("value semantics")), ".\n", "However, some internal types are uncopyable. If you try to copy\n", #> "them, either with ", list("<-"), " or by argument passing, you actually create\n", #> "references to the original object rather than actual\n", #> "copies. Modifying these references can thus have far reaching side\n", #> "effects.\n"), "\n", list("\n", "# Let's add attributes with structure() to uncopyable types. Since\n", #> "# they are not copied, the attributes are changed in place:\n", #> "env <- env()\n", "structure(env, foo = \"bar\")\n", #> "env\n", "\n", "# These objects that can only be changed with side effect are not\n", #> "# copyable:\n", "is_copyable(env)\n", "\n", #> "structure(base::list, foo = \"bar\")\n", "str(base::list)\n"), #> "\n", list("internal"), "\n"), is_empty.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_empty"), "\n", list("is_empty"), #> "\n", list("Is object an empty vector or NULL?"), #> "\n", list("\n", "is_empty(x)\n"), "\n", list( #> "\n", list(list("x"), list("object to test")), #> "\n"), "\n", list("\n", "Is object an empty vector or NULL?\n"), #> "\n", list("\n", "is_empty(NULL)\n", "is_empty(list())\n", #> "is_empty(list(NULL))\n"), "\n"), is_env.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("is_env"), "\n", list("is_env"), "\n", #> list("is_bare_env"), "\n", list("Is an object an environment?"), #> "\n", list("\n", "is_env(x)\n", "\n", "is_bare_env(x)\n"), #> "\n", list("\n", list(list("x"), list("object to test")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions were deprecated and renamed to ", #> list(list("is_environment()")), "\n", "and ", #> list(list("is_bare_environment()")), " in rlang 0.2.0. This is for consistency\n", #> "with other type predicates which are not abbreviated.\n"), #> "\n", list("internal"), "\n"), is_environment.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_environment"), "\n", list("is_environment"), #> "\n", list("is_bare_environment"), "\n", list( #> "Is object an environment?"), "\n", list("\n", #> "is_environment(x)\n", "\n", "is_bare_environment(x)\n"), #> "\n", list("\n", list(list("x"), list("object to test")), #> "\n"), "\n", list("\n", list("is_bare_environment()"), #> " tests whether ", list("x"), " is an environment without a s3 or\n", #> "s4 class.\n"), "\n"), is_expr.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("is_expr"), "\n", list("is_expr"), #> "\n", list("Is an object an expression?"), "\n", #> list("\n", "is_expr(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "This function was deprecated and renamed to ", #> list(list("is_expression()")), " in\n", "rlang 0.2.0. This is for consistency with other type predicates\n", #> "which are not abbreviated.\n"), "\n", list( #> "internal"), "\n"), is_expression.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/expr.R", #> "\n", list("is_expression"), "\n", list("is_expression"), #> "\n", list("is_syntactic_literal"), "\n", list( #> "is_symbolic"), "\n", list("Is an object an expression?"), #> "\n", list("\n", "is_expression(x)\n", "\n", #> "is_syntactic_literal(x)\n", "\n", "is_symbolic(x)\n"), #> "\n", list("\n", list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", list("is_expression()"), #> " tests for expressions, the set of objects that can be\n", #> "obtained from parsing R code. An expression can be one of two\n", #> "things: either a symbolic object (for which ", #> list("is_symbolic()"), " returns\n", list("TRUE"), #> "), or a syntactic literal (testable with\n", #> list("is_syntactic_literal()"), "). Technically, calls can contain any R\n", #> "object, not necessarily symbolic objects or syntactic\n", #> "literals. However, this only happens in artificial\n", #> "situations. Expressions as we define them only contain numbers,\n", #> "strings, ", list("NULL"), ", symbols, and calls: this is the complete set of R\n", #> "objects that can be created when R parses source code (e.g. from\n", #> "using ", list(list("parse_expr()")), ").\n", #> "\n", "Note that we are using the term expression in its colloquial sense\n", #> "and not to refer to ", list(list("expression()")), #> " vectors, a data type that wraps\n", "expressions in a vector and which isn't used much in modern R code.\n"), #> "\n", list("\n", list("is_symbolic()"), " returns ", #> list("TRUE"), " for symbols and calls (objects with\n", #> "type ", list("language"), "). Symbolic objects are replaced by their value\n", #> "during evaluation. Literals are the complement of symbolic\n", #> "objects. They are their own value and return themselves during\n", #> "evaluation.\n", "\n", list("is_syntactic_literal()"), #> " is a predicate that returns ", list("TRUE"), #> " for the\n", "subset of literals that are created by R when parsing text (see\n", #> list(list("parse_expr()")), "): numbers, strings and ", #> list("NULL"), ". Along with symbols,\n", "these literals are the terminating nodes in an AST.\n", #> "\n", "Note that in the most general sense, a literal is any R object that\n", #> "evaluates to itself and that can be evaluated in the empty\n", #> "environment. For instance, ", list("quote(c(1, 2))"), #> " is not a literal, it is\n", "a call. However, the result of evaluating it in ", #> list(list("base_env()")), " is a\n", "literal(in this case an atomic vector).\n", #> "\n", "Pairlists are also a kind of language objects. However, since they\n", #> "are mostly an internal data structure, ", #> list("is_expression()"), " returns ", list( #> "FALSE"), "\n", "for pairlists. You can use ", #> list("is_pairlist()"), " to explicitly check for\n", #> "them. Pairlists are the data structure for function arguments. They\n", #> "usually do not arise from R code because subsetting a call is a\n", #> "type-preserving operation. However, you can obtain the pairlist of\n", #> "arguments by taking the CDR of the call object from C code. The\n", #> "rlang function ", list(list("node_cdr()")), #> " will do it from R. Another way in\n", "which pairlist of arguments arise is by extracting the argument\n", #> "list of a closure with ", list(list("base::formals()")), #> " or ", list(list("fn_fmls()")), ".\n"), "\n", #> list("\n", "q1 <- quote(1)\n", "is_expression(q1)\n", #> "is_syntactic_literal(q1)\n", "\n", "q2 <- quote(x)\n", #> "is_expression(q2)\n", "is_symbol(q2)\n", "\n", #> "q3 <- quote(x + 1)\n", "is_expression(q3)\n", #> "is_call(q3)\n", "\n", "\n", "# Atomic expressions are the terminating nodes of a call tree:\n", #> "# NULL or a scalar atomic vector:\n", "is_syntactic_literal(\"string\")\n", #> "is_syntactic_literal(NULL)\n", "\n", "is_syntactic_literal(letters)\n", #> "is_syntactic_literal(quote(call()))\n", "\n", #> "# Parsable literals have the property of being self-quoting:\n", #> "identical(\"foo\", quote(\"foo\"))\n", "identical(1L, quote(1L))\n", #> "identical(NULL, quote(NULL))\n", "\n", "# Like any literals, they can be evaluated within the empty\n", #> "# environment:\n", "eval_bare(quote(1L), empty_env())\n", #> "\n", "# Whereas it would fail for symbolic expressions:\n", #> "# eval_bare(quote(c(1L, 2L)), empty_env())\n", #> "\n", "\n", "# Pairlists are also language objects representing argument lists.\n", #> "# You will usually encounter them with extracted formals:\n", #> "fmls <- formals(is_expression)\n", "typeof(fmls)\n", #> "\n", "# Since they are mostly an internal data structure, is_expression()\n", #> "# returns FALSE for pairlists, so you will have to check explicitly\n", #> "# for them:\n", "is_expression(fmls)\n", "is_pairlist(fmls)\n"), #> "\n", list("\n", list(list("is_call()")), " for a call predicate.\n"), #> "\n"), is_formula.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/formula.R", #> "\n", list("is_formula"), "\n", list("is_formula"), #> "\n", list("is_bare_formula"), "\n", list("Is object a formula?"), #> "\n", list("\n", "is_formula(x, scoped = NULL, lhs = NULL)\n", #> "\n", "is_bare_formula(x, scoped = NULL, lhs = NULL)\n"), #> "\n", list("\n", list(list("x"), list("An object to test.")), #> "\n", "\n", list(list("scoped"), list("A boolean indicating whether the quosure is scoped,\n", #> "that is, has a valid environment attribute. If ", #> list("NULL"), ", the scope\n", "is not inspected.")), #> "\n", "\n", list(list("lhs"), list("A boolean indicating whether the ", #> list("formula"), "\n", "or ", list("definition"), #> " has a left-hand side. If ", list("NULL"), #> ",\n", "the LHS is not inspected.")), "\n"), #> "\n", list("\n", list("is_formula()"), " tests if ", #> list("x"), " is a call to ", list("~"), ". ", #> list("is_bare_formula()"), "\n", "tests in addition that ", #> list("x"), " does not inherit from anything else than\n", #> list("\"formula\""), ".\n"), "\n", list("\n", #> "The ", list("scoped"), " argument patterns-match on whether the scoped bundled\n", #> "with the quosure is valid or not. Invalid scopes may happen in\n", #> "nested quotations like ", list("~~expr"), #> ", where the outer quosure is validly\n", "scoped but not the inner one. This is because ", #> list("~"), " saves the\n", "environment when it is evaluated, and quoted formulas are by\n", #> "definition not evaluated.\n"), "\n", list( #> "\n", "x <- disp ~ am\n", "is_formula(x)\n", #> "\n", "is_formula(~10)\n", "is_formula(10)\n", #> "\n", "is_formula(quo(foo))\n", "is_bare_formula(quo(foo))\n", #> "\n", "# Note that unevaluated formulas are treated as bare formulas even\n", #> "# though they don't inherit from \"formula\":\n", #> "f <- quote(~foo)\n", "is_bare_formula(f)\n", #> "\n", "# However you can specify `scoped` if you need the predicate to\n", #> "# return FALSE for these unevaluated formulas:\n", #> "is_bare_formula(f, scoped = TRUE)\n", "is_bare_formula(eval(f), scoped = TRUE)\n"), #> "\n"), is_frame.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("is_frame"), "\n", list("is_frame"), #> "\n", list("Is object a frame?"), "\n", list( #> "\n", "is_frame(x)\n"), "\n", list("\n", list( #> list("x"), list("Object to test")), "\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n"), "\n", list("internal"), "\n"), is_function.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("is_function"), "\n", list("is_function"), #> "\n", list("is_closure"), "\n", list("is_primitive"), #> "\n", list("is_primitive_eager"), "\n", list( #> "is_primitive_lazy"), "\n", list("Is object a function?"), #> "\n", list("\n", "is_function(x)\n", "\n", "is_closure(x)\n", #> "\n", "is_primitive(x)\n", "\n", "is_primitive_eager(x)\n", #> "\n", "is_primitive_lazy(x)\n"), "\n", list( #> "\n", list(list("x"), list("Object to be tested.")), #> "\n"), "\n", list("\n", "The R language defines two different types of functions: primitive\n", #> "functions, which are low-level, and closures, which are the regular\n", #> "kind of functions.\n"), "\n", list("\n", "Closures are functions written in R, named after the way their\n", #> "arguments are scoped within nested environments (see\n", #> list("https://en.wikipedia.org/wiki/Closure_(computer_programming)"), #> "). The\n", "root environment of the closure is called the closure\n", #> "environment. When closures are evaluated, a new environment called\n", #> "the evaluation frame is created with the closure environment as\n", #> "parent. This is where the body of the closure is evaluated. These\n", #> "closure frames appear on the evaluation stack (see ", #> list(list("ctxt_stack()")), "),\n", "as opposed to primitive functions which do not necessarily have\n", #> "their own evaluation frame and never appear on the stack.\n", #> "\n", "Primitive functions are more efficient than closures for two\n", #> "reasons. First, they are written entirely in fast low-level\n", #> "code. Second, the mechanism by which they are passed arguments is\n", #> "more efficient because they often do not need the full procedure of\n", #> "argument matching (dealing with positional versus named arguments,\n", #> "partial matching, etc). One practical consequence of the special\n", #> "way in which primitives are passed arguments is that they\n", #> "technically do not have formal arguments, and ", #> list(list("formals()")), " will\n", "return ", #> list("NULL"), " if called on a primitive function. Finally, primitive\n", #> "functions can either take arguments lazily, like R closures do,\n", #> "or evaluate them eagerly before being passed on to the C code.\n", #> "The former kind of primitives are called \"special\" in R terminology,\n", #> "while the latter is referred to as \"builtin\". ", #> list("is_primitive_eager()"), "\n", "and ", #> list("is_primitive_lazy()"), " allow you to check whether a primitive\n", #> "function evaluates arguments eagerly or lazily.\n", #> "\n", "You will also encounter the distinction between primitive and\n", #> "internal functions in technical documentation. Like primitive\n", #> "functions, internal functions are defined at a low level and\n", #> "written in C. However, internal functions have no representation in\n", #> "the R language. Instead, they are called via a call to\n", #> list(list("base::.Internal()")), " within a regular closure. This ensures that\n", #> "they appear as normal R function objects: they obey all the usual\n", #> "rules of argument passing, and they appear on the evaluation stack\n", #> "as any other closures. As a result, ", list( #> list("fn_fmls()")), " does not need to\n", #> "look in the ", list(".ArgsEnv"), " environment to obtain a representation of\n", #> "their arguments, and there is no way of querying from R whether\n", #> "they are lazy ('special' in R terminology) or eager ('builtin').\n", #> "\n", "You can call primitive functions with ", #> list(list(".Primitive()")), " and internal\n", #> "functions with ", list(list(".Internal()")), #> ". However, calling internal functions\n", #> "in a package is forbidden by CRAN's policy because they are\n", #> "considered part of the private API. They often assume that they\n", #> "have been called with correctly formed arguments, and may cause R\n", #> "to crash if you call them with unexpected objects.\n"), #> "\n", list("\n", "# Primitive functions are not closures:\n", #> "is_closure(base::c)\n", "is_primitive(base::c)\n", #> "\n", "# On the other hand, internal functions are wrapped in a closure\n", #> "# and appear as such from the R side:\n", #> "is_closure(base::eval)\n", "\n", "# Both closures and primitives are functions:\n", #> "is_function(base::c)\n", "is_function(base::eval)\n", #> "\n", "# Primitive functions never appear in evaluation stacks:\n", #> "is_primitive(base::`[[`)\n", "is_primitive(base::list)\n", #> "list(ctxt_stack())[[1]]\n", "\n", "# While closures do:\n", #> "identity(identity(ctxt_stack()))\n", "\n", #> "# Many primitive functions evaluate arguments eagerly:\n", #> "is_primitive_eager(base::c)\n", "is_primitive_eager(base::list)\n", #> "is_primitive_eager(base::`+`)\n", "\n", "# However, primitives that operate on expressions, like quote() or\n", #> "# substitute(), are lazy:\n", "is_primitive_lazy(base::quote)\n", #> "is_primitive_lazy(base::substitute)\n"), "\n"), #> is_installed.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("is_installed"), "\n", list("is_installed"), #> "\n", list("check_installed"), "\n", list("Are packages installed in any of the libraries?"), #> "\n", list("\n", "is_installed(pkg)\n", "\n", #> "check_installed(pkg, reason = NULL)\n"), "\n", #> list("\n", list(list("pkg"), list("The package names.")), #> "\n", "\n", list(list("reason"), list("Optional string indicating why is ", #> list("pkg"), " needed.\n", "Appears in error messages (if non-interactive) and user prompts\n", #> "(if interactive).")), "\n"), "\n", list( #> "\n", list("is_installed()"), " returns ", #> list("TRUE"), " if ", list("all"), " package names\n", #> "provided in ", list("pkg"), " are installed, ", #> list("FALSE"), "\n", "otherwise. ", list("check_installed()"), #> " either doesn't return or returns\n", list( #> "NULL"), ".\n"), "\n", list("\n", "These functions check that packages are installed with minimal side\n", #> "effects. If installed, the packages will be loaded but not\n", #> "attached.\n", list("\n", list(), " ", list( #> "is_installed()"), " doesn't interact with the user. It simply\n", #> "returns ", list("TRUE"), " or ", list("FALSE"), #> " depending on whether the packages are\n", #> "installed.\n", list(), " In interactive sessions, ", #> list("check_installed()"), " asks the user\n", #> "whether to install missing packages. If the user accepts, the\n", #> "packages are installed with ", list("pak::pkg_install()"), #> " if available, or\n", list(list("utils::install.packages()")), #> " otherwise. If the session is non\n", "interactive or if the user chooses not to install the packages,\n", #> "the current evaluation is aborted.\n"), #> "\n"), "\n", list("\n", "is_installed(\"utils\")\n", #> "is_installed(c(\"base\", \"ggplot5\"))\n"), #> "\n"), is_integerish.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_integerish"), "\n", list("is_integerish"), #> "\n", list("is_bare_integerish"), "\n", list( #> "is_scalar_integerish"), "\n", list("Is a vector integer-like?"), #> "\n", list("\n", "is_integerish(x, n = NULL, finite = NULL)\n", #> "\n", "is_bare_integerish(x, n = NULL, finite = NULL)\n", #> "\n", "is_scalar_integerish(x, finite = NULL)\n"), #> "\n", list("\n", list(list("x"), list("Object to be tested.")), #> "\n", "\n", list(list("n"), list("Expected length of a vector.")), #> "\n", "\n", list(list("finite"), list("Whether all values of the vector are finite. The\n", #> "non-finite values are ", list("NA"), ", ", #> list("Inf"), ", ", list("-Inf"), " and ", #> list("NaN"), ". Setting this\n", "to something other than ", #> list("NULL"), " can be expensive because the whole\n", #> "vector needs to be traversed and checked.")), #> "\n"), "\n", list("\n", "These predicates check whether R considers a number vector to be\n", #> "integer-like, according to its own tolerance check (which is in\n", #> "fact delegated to the C library). This function is not adapted to\n", #> "data analysis, see the help for ", list(list( #> "base::is.integer()")), " for examples\n", #> "of how to check for whole numbers.\n", "\n", #> "Things to consider when checking for integer-like doubles:\n", #> list("\n", list(), " This check can be expensive because the whole double vector has\n", #> "to be traversed and checked.\n", list(), #> " Large double values may be integerish but may still not be\n", #> "coercible to integer. This is because integers in R only support\n", #> "values up to ", list("2^31 - 1"), " while numbers stored as double can be\n", #> "much larger.\n"), "\n"), "\n", list("\n", #> "is_integerish(10L)\n", "is_integerish(10.0)\n", #> "is_integerish(10.0, n = 2)\n", "is_integerish(10.000001)\n", #> "is_integerish(TRUE)\n"), "\n", list("\n", #> list(list("is_bare_numeric()")), " for testing whether an object is a\n", #> "base numeric type (a bare double or integer vector).\n"), #> "\n"), is_interactive.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/state.R", #> "\n", list("is_interactive"), "\n", list("is_interactive"), #> "\n", list("local_interactive"), "\n", list("with_interactive"), #> "\n", list("Is R running interactively?"), "\n", #> list("\n", "is_interactive()\n", "\n", "local_interactive(value = TRUE, frame = caller_env())\n", #> "\n", "with_interactive(expr, value = TRUE)\n"), #> "\n", list("\n", list(list("value"), list("A single ", #> list("TRUE"), " or ", list("FALSE"), ". This overrides the return\n", #> "value of ", list("is_interactive()"), ".")), #> "\n", "\n", list(list("frame"), list("The environment of a running function which defines\n", #> "the scope of the temporary options. When the function returns,\n", #> "the options are reset to their original values.")), #> "\n", "\n", list(list("expr"), list("An expression to evaluate with interactivity set to\n", #> list("value"), ".")), "\n"), "\n", list("\n", #> "Like ", list(list("base::interactive()")), #> ", ", list("is_interactive()"), " returns ", #> list("TRUE"), " when\n", "the function runs interactively and ", #> list("FALSE"), " when it runs in batch\n", #> "mode. It also checks, in this order:\n", list( #> "\n", list(), " The ", list("rlang_interactive"), #> " global option. If set to a single ", list( #> "TRUE"), "\n", "or ", list("FALSE"), ", ", #> list("is_interactive()"), " returns that value immediately. This\n", #> "escape hatch is useful in unit tests or to manually turn on\n", #> "interactive features in RMarkdown outputs.\n", #> list(), " Whether knitr or testthat is in progress, in which case\n", #> list("is_interactive()"), " returns ", list( #> "FALSE"), ".\n"), "\n", "\n", list("with_interactive()"), #> " and ", list("local_interactive()"), " set the global\n", #> "option conveniently.\n"), "\n"), is_lang.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("is_lang"), "\n", list("is_lang"), #> "\n", list("is_unary_lang"), "\n", list("is_binary_lang"), #> "\n", list("quo_is_lang"), "\n", list("Is object a call?"), #> "\n", list("\n", "is_lang(x, name = NULL, n = NULL, ns = NULL)\n", #> "\n", "is_unary_lang(x, name = NULL, ns = NULL)\n", #> "\n", "is_binary_lang(x, name = NULL, ns = NULL)\n", #> "\n", "quo_is_lang(quo)\n"), "\n", list("\n", #> list(list("x"), list("An object to test. If a formula, the right-hand side is\n", #> "extracted.")), "\n", "\n", list(list("name"), #> list("An optional name that the call should match. It is\n", #> "passed to ", list(list("sym()")), " before matching. This argument is vectorised\n", #> "and you can supply a vector of names to match. In this case,\n", #> list("is_call()"), " returns ", list("TRUE"), #> " if at least one name matches.")), "\n", #> "\n", list(list("n"), list("An optional number of arguments that the call should\n", #> "match.")), "\n", "\n", list(list("ns"), #> list("The namespace of the call. If ", list( #> "NULL"), ", the namespace\n", "doesn't participate in the pattern-matching. If an empty string\n", #> list("\"\""), " and ", list("x"), " is a namespaced call, ", #> list("is_call()"), " returns\n", list("FALSE"), #> ". If any other string, ", list("is_call()"), #> " checks that ", list("x"), " is\n", "namespaced within ", #> list("ns"), ".\n", "\n", "Can be a character vector of namespaces, in which case the call\n", #> "has to match at least one of them, otherwise ", #> list("is_call()"), " returns\n", list("FALSE"), #> ".")), "\n", "\n", list(list("quo"), list( #> "A quosure to test.")), "\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions are deprecated, please use ", #> list(list("is_call()")), " and its ", list( #> "n"), "\n", "argument instead.\n"), "\n", #> list("internal"), "\n"), is_named.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("is_named"), "\n", list("is_named"), #> "\n", list("is_dictionaryish"), "\n", list("have_name"), #> "\n", list("Is object named?"), "\n", list("\n", #> "is_named(x)\n", "\n", "is_dictionaryish(x)\n", #> "\n", "have_name(x)\n"), "\n", list("\n", list( #> list("x"), list("An object to test.")), "\n"), #> "\n", list("\n", list("is_named()"), " and ", #> list("is_dictionaryish()"), " are scalar predicates\n", #> "and return ", list("TRUE"), " or ", list("FALSE"), #> ". ", list("have_name()"), " is vectorised and\n", #> "returns a logical vector as long as the input.\n"), #> "\n", list("\n", list("is_named()"), " checks that ", #> list("x"), " has names attributes, and that none of\n", #> "the names are missing or empty (", list("NA"), #> " or ", list("\"\""), "). ", list("is_dictionaryish()"), #> "\n", "checks that an object is a dictionary: that it has actual names and\n", #> "in addition that there are no duplicated names. ", #> list("have_name()"), "\n", "is a vectorised version of ", #> list("is_named()"), ".\n"), "\n", list("\n", #> "# A data frame usually has valid, unique names\n", #> "is_named(mtcars)\n", "have_name(mtcars)\n", #> "is_dictionaryish(mtcars)\n", "\n", "# But data frames can also have duplicated columns:\n", #> "dups <- cbind(mtcars, cyl = seq_len(nrow(mtcars)))\n", #> "is_dictionaryish(dups)\n", "\n", "# The names are still valid:\n", #> "is_named(dups)\n", "have_name(dups)\n", "\n", #> "\n", "# For empty objects the semantics are slightly different.\n", #> "# is_dictionaryish() returns TRUE for empty objects:\n", #> "is_dictionaryish(list())\n", "\n", "# But is_named() will only return TRUE if there is a names\n", #> "# attribute (a zero-length character vector in this case):\n", #> "x <- set_names(list(), character(0))\n", "is_named(x)\n", #> "\n", "\n", "# Empty and missing names are invalid:\n", #> "invalid <- dups\n", "names(invalid)[2] <- \"\"\n", #> "names(invalid)[5] <- NA\n", "\n", "# is_named() performs a global check while have_name() can show you\n", #> "# where the problem is:\n", "is_named(invalid)\n", #> "have_name(invalid)\n", "\n", "# have_name() will work even with vectors that don't have a names\n", #> "# attribute:\n", "have_name(letters)\n"), #> "\n"), is_namespace.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("is_namespace"), "\n", list("is_namespace"), #> "\n", list("Is an object a namespace environment?"), #> "\n", list("\n", "is_namespace(x)\n"), "\n", #> list("\n", list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", "Is an object a namespace environment?\n"), #> "\n"), is_pairlist.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/node.R", #> "\n", list("is_pairlist"), "\n", list("is_pairlist"), #> "\n", list("is_node"), "\n", list("is_node_list"), #> "\n", list("Is object a node or pairlist?"), #> "\n", list("\n", "is_pairlist(x)\n", "\n", "is_node(x)\n", #> "\n", "is_node_list(x)\n"), "\n", list("\n", #> list(list("x"), list("Object to test.")), "\n"), #> "\n", list("\n", list("\n", list(), " ", list( #> "is_pairlist()"), " checks that ", list("x"), #> " has type ", list("pairlist"), ".\n", list(), #> " ", list("is_node()"), " checks that ", list( #> "x"), " has type ", list("pairlist"), " or ", #> list("language"), ".\n", "It tests whether ", #> list("x"), " is a node that has a CAR and a CDR,\n", #> "including callable nodes (language objects).\n", #> list(), " ", list("is_node_list()"), " checks that ", #> list("x"), " has type ", list("pairlist"), #> " or ", list("NULL"), ".\n", list("NULL"), #> " is the empty node list.\n"), "\n"), "\n", #> list(list("Life cycle"), list("\n", "\n", "\n", #> "These functions are experimental. We are still figuring out a good\n", #> "naming convention to refer to the different lisp-like lists in R.\n")), #> "\n", "\n", list("\n", list(list("is_call()")), #> " tests for language nodes.\n"), "\n", list( #> "internal"), "\n"), is_reference.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_reference"), "\n", list("is_reference"), #> "\n", list("Is an object referencing another?"), #> "\n", list("\n", "is_reference(x, y)\n"), "\n", #> list("\n", list(list("x, y"), list("R objects.")), #> "\n"), "\n", list("\n", "There are typically two situations where two symbols may refer to\n", #> "the same object.\n", list("\n", list(), " R objects usually have copy-on-write semantics. This is an\n", #> "optimisation that ensures that objects are only copied if\n", #> "needed. When you copy a vector, no memory is actually copied\n", #> "until you modify either the original object or the copy is\n", #> "modified.\n", "\n", "Note that the copy-on-write optimisation is an implementation\n", #> "detail that is not guaranteed by the specification of the R\n", #> "language.\n", list(), " Assigning an ", #> list("uncopyable"), " object (like an\n", #> "environment) creates a reference. These objects are never copied\n", #> "even if you modify one of the references.\n"), #> "\n"), "\n", list("\n", "# Reassigning an uncopyable object such as an environment creates a\n", #> "# reference:\n", "env <- env()\n", "ref <- env\n", #> "is_reference(ref, env)\n", "\n", "# Due to copy-on-write optimisation, a copied vector can\n", #> "# temporarily reference the original vector:\n", #> "vec <- 1:10\n", "copy <- vec\n", "is_reference(copy, vec)\n", #> "\n", "# Once you modify on of them, the copy is triggered in the\n", #> "# background and the objects cease to reference each other:\n", #> "vec[[1]] <- 100\n", "is_reference(copy, vec)\n"), #> "\n", list("internal"), "\n"), is_stack.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("is_stack"), "\n", list("is_stack"), #> "\n", list("is_eval_stack"), "\n", list("is_call_stack"), #> "\n", list("Is object a stack?"), "\n", list( #> "\n", "is_stack(x)\n", "\n", "is_eval_stack(x)\n", #> "\n", "is_call_stack(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n"), "\n", list("internal"), "\n"), is_symbol.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/sym.R", #> "\n", list("is_symbol"), "\n", list("is_symbol"), #> "\n", list("Is object a symbol?"), "\n", list( #> "\n", "is_symbol(x, name = NULL)\n"), "\n", #> list("\n", list(list("x"), list("An object to test.")), #> "\n", "\n", list(list("name"), list("An optional name or vector of names that the symbol\n", #> "should match.")), "\n"), "\n", list("\n", #> "Is object a symbol?\n"), "\n"), is_true.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_true"), "\n", list("is_true"), #> "\n", list("is_false"), "\n", list("Is object identical to TRUE or FALSE?"), #> "\n", list("\n", "is_true(x)\n", "\n", "is_false(x)\n"), #> "\n", list("\n", list(list("x"), list("object to test")), #> "\n"), "\n", list("\n", "These functions bypass R's automatic conversion rules and check\n", #> "that ", list("x"), " is literally ", list( #> "TRUE"), " or ", list("FALSE"), ".\n"), "\n", #> list("\n", "is_true(TRUE)\n", "is_true(1)\n", #> "\n", "is_false(FALSE)\n", "is_false(0)\n"), #> "\n"), is_weakref.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/weakref.R", #> "\n", list("is_weakref"), "\n", list("is_weakref"), #> "\n", list("Is object a weak reference?"), "\n", #> list("\n", "is_weakref(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", "Is object a weak reference?\n"), #> "\n"), lang.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("lang"), "\n", list("lang"), "\n", #> list("new_language"), "\n", list("Create a call"), #> "\n", list("\n", "lang(.fn, ..., .ns = NULL)\n", #> "\n", "new_language(head, tail = NULL)\n"), #> "\n", list("\n", list(list(".fn"), list("Function to call. Must be a callable object: a string,\n", #> "symbol, call, or a function.")), "\n", "\n", #> list(list("..."), list("<", list("dynamic"), #> "> Arguments for the function\n", "call. Empty arguments are preserved.")), #> "\n", "\n", list(list(".ns"), list("Namespace with which to prefix ", #> list(".fn"), ". Must be a string\n", "or symbol.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions are deprecated, please use ", #> list(list("call2()")), " and\n", list(list( #> "new_call()")), " instead.\n"), "\n", list( #> "internal"), "\n"), lang_head.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("lang_head"), "\n", list("lang_head"), #> "\n", list("lang_tail"), "\n", list("Return the head or tail of a call"), #> "\n", list("\n", "lang_head(lang)\n", "\n", "lang_tail(lang)\n"), #> "\n", list("\n", list(list("lang"), list("A call.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "As of rlang 0.2.0 these functions are retired (deprecated for now)\n", #> "because they are low level accessors that are rarely needed for end\n", #> "users.\n"), "\n", list("internal"), "\n"), #> lang_modify.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("lang_modify"), "\n", list("lang_modify"), #> "\n", list("lang_standardise"), "\n", list("lang_fn"), #> "\n", list("lang_name"), "\n", list("lang_args"), #> "\n", list("lang_args_names"), "\n", list("Manipulate or access a call"), #> "\n", list("\n", "lang_modify(.lang, ..., .standardise = FALSE)\n", #> "\n", "lang_standardise(lang)\n", "\n", "lang_fn(lang)\n", #> "\n", "lang_name(lang)\n", "\n", "lang_args(lang)\n", #> "\n", "lang_args_names(lang)\n"), "\n", list( #> "\n", list(list("..."), list("<", list("dynamic"), #> "> Named or unnamed expressions\n", "(constants, names or calls) used to modify the call. Use ", #> list(list("zap()")), "\n", "to remove arguments. Empty arguments are preserved.")), #> "\n", "\n", list(list(".standardise"), list( #> "Soft-deprecated as of rlang 0.3.0. Please\n", #> "call ", list(list("call_standardise()")), #> " manually.")), "\n", "\n", list(list("lang, .lang"), #> list("The ", list("call"), " or ", list(".call"), #> " argument of the renamed\n", "functions.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions are deprecated, please use ", #> list(list("call_modify()")), ",\n", list(list( #> "call_standardise()")), ", or ", list(list( #> "call_fn()")), " instead.\n"), "\n", list( #> "internal"), "\n"), last_error.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-abort.R", #> "\n", list("last_error"), "\n", list("last_error"), #> "\n", list("last_trace"), "\n", list("Last ", #> list("abort()"), " error"), "\n", list("\n", #> "last_error()\n", "\n", "last_trace()\n"), #> "\n", list("\n", list("\n", list(), " ", list( #> "last_error()"), " returns the last error thrown with ", #> list(list("abort()")), ". The\n", "error is printed with a backtrace in simplified form.\n", #> list(), " ", list("last_trace()"), " is a shortcut to return the backtrace stored in\n", #> "the last error. This backtrace is printed in full form.\n"), #> "\n"), "\n"), lifecycle.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle.R", #> "\n", list("lifecycle"), "\n", list("lifecycle"), #> "\n", list("Life cycle of the rlang package"), #> "\n", list("\n", list("rlang:::lifecycle(\"maturing\")"), #> "\n", "\n", "The rlang package is currently maturing. Unless otherwise stated,\n", #> "this applies to all its exported functions. Maturing functions are\n", #> "susceptible to API changes. Only use these in packages if you're\n", #> "prepared to make changes as the package evolves. See sections below\n", #> "for a list of functions marked as stable.\n", #> "\n", "The documentation pages of retired functions contain life cycle\n", #> "sections that explain the reasons for their retirements.\n"), #> "\n", list(list("Stable functions"), list("\n", #> "\n", "\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", list("\n", list(), " ", list(list("eval_tidy()")), #> "\n", list(), " ", list("!!"), ", ", list( #> "!!!"), "\n", list(), " ", list(list("enquo()")), #> ", ", list(list("quo()")), ", ", list(list( #> "quos()")), "\n", list(), " ", list(list( #> "enexpr()")), ", ", list(list("expr()")), #> ", ", list(list("exprs()")), "\n", list(), #> " ", list(list("sym()")), ", ", list(list( #> "syms()")), "\n", list(), " ", list(list( #> "new_quosure()")), ", ", list(list("is_quosure()")), #> "\n", list(), " ", list(list("missing_arg()")), #> ", ", list(list("is_missing()")), "\n", list(), #> " ", list(list("quo_get_expr()")), ", ", #> list(list("quo_set_expr()")), "\n", list(), #> " ", list(list("quo_get_env()")), ", ", list( #> list("quo_set_env()")), "\n", list(), " ", #> list(list("eval_bare()")), "\n", list(), #> " ", list(list("set_names()")), ", ", list( #> list("names2()")), "\n", list(), " ", list( #> list("as_function()")), ", ", list(list( #> "new_function()")), "\n"), "\n")), "\n", #> "\n", list(list("Experimental functions"), list( #> "\n", "\n", "\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "These functions are not yet part of the rlang API. Expect breaking\n", #> "changes.\n", list("\n", list(), " ", list( #> list("with_env()")), ", ", list(list("locally()")), #> ", ", list(list("env_poke()")), "\n", list(), #> " ", list(list("pkg_env()")), ", ", list( #> list("pkg_env_name()")), ", ", list(list( #> "ns_env()")), ", ", list(list("ns_imports_env()")), #> ", ", list(list("ns_env_name()")), "\n", #> list(), " ", list(list("is_pairlist()")), #> ", ", list(list("as_pairlist()")), ", ", #> list(list("is_node()")), ", ", list(list( #> "is_node_list()")), "\n", list(), " ", #> list(list("is_definition()")), ", ", list( #> list("new_definition()")), ", ", list(list( #> "is_formulaish()")), ",\n", list(list("dots_definitions()")), #> "\n", list(), " ", list(list("local_options()")), #> ", ", list(list("with_options()")), ", ", #> list(list("push_options()")), ",\n", list( #> list("peek_options()")), ", ", list(list( #> "peek_option()")), "\n", list(), " ", list( #> list("as_bytes()")), ", ", list(list("chr_unserialise_unicode()")), #> "\n", list(), " ", list(list("caller_fn()")), #> ", ", list(list("current_fn()")), "\n"), #> "\n")), "\n", "\n", list(list("Questioning stage"), #> list("\n", "\n", "\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", list("In the questioning stage as of rlang 0.4.0"), #> "\n", "\n", "These functions are likely to be moved to the vctrs package:\n", #> list("\n", list(), " ", list(list("lgl()")), #> ", ", list(list("int()")), ", etc.\n", #> list(), " ", list(list("new_logical()")), #> ", ", list(list("new_integer()")), ", etc.\n", #> list(), " ", list("na_lgl"), ", ", list( #> "na_int"), ", ", list(list("is_lgl_na()")), #> ", ", list(list("is_int_na()")), ", etc.\n"), #> "\n", "\n", list("In the questioning stage as of rlang 0.3.0"), #> "\n", list("\n", list(), " ", list(list("child_env()")), #> "\n", list(), " ", list(list("flatten()")), #> ", ", list(list("squash()")), ", and their atomic vector variants\n", #> list(), " ", list(list("modify()")), " and ", #> list(list("prepend()")), "\n", list(), #> " ", list(list("with_restarts()")), ", ", #> list(list("rst_list()")), ", ", list(list( #> "rst_exists()")), ", ", list(list("rst_jump()")), #> ",\n", list(list("rst_maybe_jump()")), #> ", ", list(list("rst_abort()")), ". It is not clear yet whether we\n", #> "want to recommend restarts as a style of programming in R.\n", #> list(), " ", list(list("return_from()")), #> " and ", list(list("return_to()")), ".\n", #> list(), " ", list(list("expr_label()")), #> ", ", list(list("expr_name()")), ", and ", #> list(list("expr_text()")), ".\n"), "\n", #> "\n", list("In the questioning stage as of rlang 0.2.0"), #> "\n", list("\n", list(), " ", list(list("UQ()")), #> ", ", list(list("UQS()")), "\n", list(), #> " ", list(list("dots_splice()")), ", ", #> list(list("splice()")), "\n"), "\n")), #> "\n", "\n", list(list("Soft-deprecated functions and arguments"), #> list("\n", "\n", "\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", "\n", list("Soft-deprecated in rlang 0.4.0"), #> "\n", list("\n", list(), " ", list(list("exiting()")), #> ": Handlers are now treated as exiting by default.\n", #> list(), " ", list(list("invoke()")), ": Use the simpler ", #> list(list("exec()")), " instead.\n", list(), #> " ", list(list("as_logical()")), ", ", #> list(list("as_integer()")), ", etc. => ", #> list("vctrs::vec_cast()"), ".\n", list(), #> " ", list(list("type_of()")), ", ", list( #> list("switch_type()")), ", ", list(list( #> "coerce_type()")), ", ", list(list("switch_class()")), #> ",\n", list(list("coerce_class()")), "\n"), #> "\n")), "\n", "\n", list(list("Deprecated functions and arguments"), #> list("\n", "\n", "\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", list("Bumped to deprecated in rlang 0.4.0"), #> "\n", list("\n", list(), " ", list(list("modify()")), #> " and ", list(list("prepend()")), ".\n", #> list(), " ", list("new_logical_along()"), #> ", ", list("new_integer_along()"), ",\n", #> list("new_double_along()"), ", ", list( #> "new_complex_along()"), ",\n", list("new_character_along()"), #> ", ", list("new_raw_along()"), ", ", list( #> "new_list_along()"), ".\n", list(), " ", #> list(list("lang_modify()")), " => ", list( #> list("call_modify()")), "\n", list(), #> " ", list(list("lang_standardise()")), #> " => ", list(list("call_standardise()")), #> "\n", list(), " ", list(list("lang_fn()")), #> " => ", list(list("call_fn()")), "\n", #> list(), " ", list(list("lang_name()")), #> " => ", list(list("call_name()")), "\n", #> list(), " ", list(list("lang_args()")), #> " => ", list(list("call_args()")), "\n", #> list(), " ", list(list("lang_args_names()")), #> " => ", list(list("call_args_names()")), #> "\n", list(), " ", list(list("lang_head()")), #> ", ", list(list("lang_tail()")), "\n", #> list(), " ", list(list("lang()")), " => ", #> list(list("call2()")), "\n", list(), " ", #> list(list("new_language()")), " => ", list( #> list("new_call()")), "\n", list(), " ", #> list(list("is_lang()")), " => ", list(list( #> "is_call()")), "\n", list(), " ", list( #> list("is_unary_lang()")), " => Use the ", #> list("n"), " argument of ", list(list("is_call()")), #> "\n", list(), " ", list(list("is_binary_lang()")), #> " => Use the ", list("n"), " argument of ", #> list(list("is_call()")), "\n", list(), #> " ", list(list("quo_is_lang()")), " => ", #> list(list("quo_is_call()")), "\n", list(), #> " ", list(list("call_modify()")), ": ", #> list(".standardise"), " and ", list(".env"), #> " arguments.\n", list(), " ", list(list( #> "is_expr()")), " => ", list(list("is_expression()")), #> "\n", list(), " ", list("quo_expr()"), #> " => ", list(list("quo_squash()")), "\n", #> list(), " ", list(list("parse_quosure()")), #> " => ", list(list("parse_quo()")), "\n", #> list(), " ", list(list("parse_quosures()")), #> " => ", list(list("parse_quos()")), "\n", #> list(), " Assigning non-quosure objects to quosure lists.\n", #> list(), " ", list("as.character()"), " on quosures.\n", #> list(), " ", list(list("cnd_signal()")), #> ": ", list(".cnd"), " => ", list("cnd"), #> "\n", list(), " ", list(list("cnd_signal()")), #> ": The ", list(".mufflable"), " argument no longer has any effect\n", #> list(), " ", list("scoped_names()"), " => ", #> list(list("base::search()")), "\n", list(), #> " ", list("is_scoped()"), " => ", list( #> list("is_attached()")), "\n", list(), #> " ", list("scoped_env()"), " => ", list( #> list("search_env()")), "\n", list(), #> " ", list("scoped_envs()"), " => ", list( #> list("search_envs()")), "\n", list(), #> " ", list("env_bind_exprs()"), " => ", #> list(list("env_bind_lazy()")), "\n", list(), #> " ", list("env_bind_fns()"), " => ", list( #> list("env_bind_active()")), "\n", list(), #> " Passing a function or formula to ", list( #> "env_depth()"), ",\n", list("env_poke_parent()"), #> ", ", list("env_parent<-"), ", ", list( #> "env_tail()"), ", ", list("set_env()"), #> ",\n", list("env_clone()"), ", ", list( #> "env_inherits()"), ", ", list("env_bind()"), #> ",\n", list("local_bindings()"), ", ", #> list("with_bindings()"), ", ", list("env_poke()"), #> ",\n", list("env_has()"), ", ", list("env_get()"), #> ", ", list("env_names()"), ", ", list("env_bind_exprs()"), #> " and\n", list("env_bind_fns()"), ". This internal genericity was causing confusion\n", #> "(see issue #427). You should now extract the environment\n", #> "separately before calling these functions.\n", #> list(), " ", list(list("get_env()")), ": The ", #> list("env"), " argument no longer has a default and must be supplied\n", #> list(), " ", list(list("is_frame()")), #> ", ", list(list("global_frame()")), ", ", #> list(list("current_frame()")), ",\n", list( #> list("ctxt_frame()")), ", ", list(list( #> "call_frame()")), ", ", list(list("frame_position()")), #> ",\n", list(list("caller_frame()")), "\n", #> list(), " ", list(list("ctxt_depth()")), #> ", ", list(list("call_depth()")), ", ", #> list(list("ctxt_stack()")), ", ", list( #> list("call_stack()")), ",\n", list(list( #> "stack_trim()")), "\n", list(), " ", #> list(list("set_attrs()")), ", ", list(list( #> "mut_attrs()")), "\n", list(), " The ", #> list("width"), " and ", list("printer"), #> " arguments of ", list(list("exprs_auto_name()")), #> " and\n", list(list("quos_auto_name()")), #> " no longer have any effect. For the same\n", #> "reason, passing a width as ", list(".named"), #> " argument of dots collectors\n", "like ", #> list("quos()"), " is deprecated.\n", list(), #> " ", list("as_overscope()"), " => ", list( #> list("as_data_mask()")), "\n", list(), #> " ", list("new_overscope()"), " => ", list( #> list("new_data_mask()")), "\n", list(), #> " ", list("overscope_eval_next()"), " => ", #> list(list("eval_tidy()")), "\n", list(), #> " ", list("overscope_clean()"), "\n"), #> "\n")), "\n", "\n", list(list("Defunct functions and arguments"), #> list("\n", "\n", "\n", list("rlang:::lifecycle(\"defunct\")"), #> "\n", "\n", list("Defunct as of rlang 0.4.0"), #> "\n", list("\n", list(), " ", list("length()"), #> " and ", list("names()"), " on tidy eval ", #> list(".data"), " pronouns.\n", list(), #> " Supplying a named ", list("!!!"), " call.\n"), #> "\n")), "\n", "\n", list("internal"), "\n"), #> list2.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("list2"), "\n", list("list2"), "\n", #> list("ll"), "\n", list("dots_list"), "\n", list( #> "Collect dots in a list"), "\n", list("\n", #> "list2(...)\n", "\n", "dots_list(\n", " ...,\n", #> " .named = FALSE,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .preserve_empty = FALSE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n"), "\n", #> list("\n", list(list("..."), list("Arguments to collect in a list. These dots are\n", #> list("dynamic"), ".")), "\n", "\n", list(list( #> ".named"), list("Whether to ensure all dots are named. Unnamed\n", #> "elements are processed with ", list(list("as_label()")), #> " to build a default\n", "name.")), "\n", "\n", #> list(list(".ignore_empty"), list("Whether to ignore empty arguments. Can be one\n", #> "of ", list("\"trailing\""), ", ", list("\"none\""), #> ", ", list("\"all\""), ". If ", list("\"trailing\""), #> ", only the\n", "last argument is ignored if it is empty.")), #> "\n", "\n", list(list(".preserve_empty"), list( #> "Whether to preserve the empty arguments that\n", #> "were not ignored. If ", list("TRUE"), ", empty arguments are stored with\n", #> list(list("missing_arg()")), " values. If ", #> list("FALSE"), " (the default) an error is\n", #> "thrown when an empty argument is detected.")), #> "\n", "\n", list(list(".homonyms"), list("How to treat arguments with the same name. The\n", #> "default, ", list("\"keep\""), ", preserves these arguments. Set ", #> list(".homonyms"), " to\n", list("\"first\""), #> " to only keep the first occurrences, to ", #> list("\"last\""), " to keep\n", "the last occurrences, and to ", #> list("\"error\""), " to raise an informative\n", #> "error and indicate what arguments have duplicated names.")), #> "\n", "\n", list(list(".check_assign"), list( #> "Whether to check for ", list("<-"), " calls passed in\n", #> "dots. When ", list("TRUE"), " and a ", list( #> "<-"), " call is detected, a warning is\n", #> "issued to advise users to use ", list("="), #> " if they meant to match a\n", "function parameter, or wrap the ", #> list("<-"), " call in braces otherwise.\n", #> "This ensures assignments are explicit.")), #> "\n"), "\n", list("\n", "A list containing the ", #> list("..."), " inputs.\n"), "\n", list("\n", #> list("list2(...)"), " is equivalent to ", list( #> "list(...)"), " with a few additional\n", #> "features, collectively called ", list("dynamic dots"), #> ". While\n", list("list2()"), " hard-code these features, ", #> list("dots_list()"), " is a lower-level\n", #> "version that offers more control.\n"), "\n", #> list("\n", "# Let's create a function that takes a variable number of arguments:\n", #> "numeric <- function(...) {\n", " dots <- list2(...)\n", #> " num <- as.numeric(dots)\n", " set_names(num, names(dots))\n", #> "}\n", "numeric(1, 2, 3)\n", "\n", "# The main difference with list(...) is that list2(...) enables\n", #> "# the `!!!` syntax to splice lists:\n", "x <- list(2, 3)\n", #> "numeric(1, !!! x, 4)\n", "\n", "# As well as unquoting of names:\n", #> "nm <- \"yup!\"\n", "numeric(!!nm := 1)\n", #> "\n", "\n", "# One useful application of splicing is to work around exact and\n", #> "# partial matching of arguments. Let's create a function taking\n", #> "# named arguments and dots:\n", "fn <- function(data, ...) {\n", #> " list2(...)\n", "}\n", "\n", "# You normally cannot pass an argument named `data` through the dots\n", #> "# as it will match `fn`'s `data` argument. The splicing syntax\n", #> "# provides a workaround:\n", "fn(\"wrong!\", data = letters) # exact matching of `data`\n", #> "fn(\"wrong!\", dat = letters) # partial matching of `data`\n", #> "fn(some_data, !!!list(data = letters)) # no matching\n", #> "\n", "\n", "# Empty arguments trigger an error by default:\n", #> "try(fn(, ))\n", "\n", "# You can choose to preserve empty arguments instead:\n", #> "list3 <- function(...) dots_list(..., .preserve_empty = TRUE)\n", #> "\n", "# Note how the last empty argument is still ignored because\n", #> "# `.ignore_empty` defaults to \"trailing\":\n", #> "list3(, )\n", "\n", "# The list with preserved empty arguments is equivalent to:\n", #> "list(missing_arg())\n", "\n", "\n", "# Arguments with duplicated names are kept by default:\n", #> "list2(a = 1, a = 2, b = 3, b = 4, 5, 6)\n", #> "\n", "# Use the `.homonyms` argument to keep only the first of these:\n", #> "dots_list(a = 1, a = 2, b = 3, b = 4, 5, 6, .homonyms = \"first\")\n", #> "\n", "# Or the last:\n", "dots_list(a = 1, a = 2, b = 3, b = 4, 5, 6, .homonyms = \"last\")\n", #> "\n", "# Or raise an informative error:\n", #> "try(dots_list(a = 1, a = 2, b = 3, b = 4, 5, 6, .homonyms = \"error\"))\n", #> "\n", "\n", "# dots_list() can be configured to warn when a `<-` call is\n", #> "# detected:\n", "my_list <- function(...) dots_list(..., .check_assign = TRUE)\n", #> "my_list(a <- 1)\n", "\n", "# There is no warning if the assignment is wrapped in braces.\n", #> "# This requires users to be explicit about their intent:\n", #> "my_list({ a <- 1 })\n"), "\n"), local_bindings.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("local_bindings"), "\n", list("local_bindings"), #> "\n", list("with_bindings"), "\n", list("Temporarily change bindings of an environment"), #> "\n", list("\n", "local_bindings(..., .env = .frame, .frame = caller_env())\n", #> "\n", "with_bindings(.expr, ..., .env = caller_env())\n"), #> "\n", list("\n", list(list("..."), list("Pairs of names and values. These dots support splicing\n", #> "(with value semantics) and name unquoting.")), #> "\n", "\n", list(list(".env"), list("An environment.")), #> "\n", "\n", list(list(".frame"), list("The frame environment that determines the scope of\n", #> "the temporary bindings. When that frame is popped from the call\n", #> "stack, bindings are switched back to their original values.")), #> "\n", "\n", list(list(".expr"), list("An expression to evaluate with temporary bindings.")), #> "\n"), "\n", list("\n", list("local_bindings()"), #> " returns the values of old bindings\n", "invisibly; ", #> list("with_bindings()"), " returns the value of ", #> list("expr"), ".\n"), "\n", list("\n", list( #> "\n", list(), " ", list("local_bindings()"), #> " temporarily changes bindings in ", list(".env"), #> " (which\n", "is by default the caller environment). The bindings are reset to\n", #> "their original values when the current frame (or an arbitrary one\n", #> "if you specify ", list(".frame"), ") goes out of scope.\n", #> list(), " ", list("with_bindings()"), " evaluates ", #> list("expr"), " with temporary bindings. When\n", #> list("with_bindings()"), " returns, bindings are reset to their original\n", #> "values. It is a simple wrapper around ", list( #> "local_bindings()"), ".\n"), "\n"), "\n", #> list("\n", "foo <- \"foo\"\n", "bar <- \"bar\"\n", #> "\n", "# `foo` will be temporarily rebinded while executing `expr`\n", #> "with_bindings(paste(foo, bar), foo = \"rebinded\")\n", #> "paste(foo, bar)\n"), "\n"), local_options.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/state.R", #> "\n", list("local_options"), "\n", list("local_options"), #> "\n", list("with_options"), "\n", list("push_options"), #> "\n", list("peek_options"), "\n", list("peek_option"), #> "\n", list("Change global options"), "\n", list( #> "\n", "local_options(..., .frame = caller_env())\n", #> "\n", "with_options(.expr, ...)\n", "\n", "push_options(...)\n", #> "\n", "peek_options(...)\n", "\n", "peek_option(name)\n"), #> "\n", list("\n", list(list("..."), list("For ", #> list("local_options()"), " and ", list("push_options()"), #> ", named\n", "values defining new option values. For ", #> list("peek_options()"), ", strings\n", "or character vectors of option names.")), #> "\n", "\n", list(list(".frame"), list("The environment of a stack frame which defines the\n", #> "scope of the temporary options. When the frame returns, the\n", #> "options are set back to their original values.")), #> "\n", "\n", list(list(".expr"), list("An expression to evaluate with temporary options.")), #> "\n", "\n", list(list("name"), list("An option name as string.")), #> "\n"), "\n", list("\n", "For ", list("local_options()"), #> " and ", list("push_options()"), ", the old option\n", #> "values. ", list("peek_option()"), " returns the current value of an option\n", #> "while the plural ", list("peek_options()"), #> " returns a list of current\n", "option values.\n"), #> "\n", list("\n", list("\n", list(), " ", list( #> "local_options()"), " changes options for the duration of a stack\n", #> "frame (by default the current one). Options are set back to their\n", #> "old values when the frame returns.\n", list(), #> " ", list("with_options()"), " changes options while an expression is\n", #> "evaluated. Options are restored when the expression returns.\n", #> list(), " ", list("push_options()"), " adds or changes options permanently.\n", #> list(), " ", list("peek_option()"), " and ", #> list("peek_options()"), " return option values. The\n", #> "former returns the option directly while the latter returns a\n", #> "list.\n"), "\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "These functions are experimental.\n")), #> "\n", "\n", list("\n", "# Store and retrieve a global option:\n", #> "push_options(my_option = 10)\n", "peek_option(\"my_option\")\n", #> "\n", "# Change the option temporarily:\n", #> "with_options(my_option = 100, peek_option(\"my_option\"))\n", #> "peek_option(\"my_option\")\n", "\n", "# The scoped variant is useful within functions:\n", #> "fn <- function() {\n", " local_options(my_option = 100)\n", #> " peek_option(\"my_option\")\n", "}\n", "fn()\n", #> "peek_option(\"my_option\")\n", "\n", "# The plural peek returns a named list:\n", #> "peek_options(\"my_option\")\n", "peek_options(\"my_option\", \"digits\")\n"), #> "\n", list("experimental"), "\n"), missing.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-na.R", #> "\n", list("data"), "\n", list("missing"), "\n", #> list("missing"), "\n", list("na_lgl"), "\n", #> list("na_int"), "\n", list("na_dbl"), "\n", list( #> "na_chr"), "\n", list("na_cpl"), "\n", list( #> "Missing values"), "\n", list("\n", "An object of class ", #> list("logical"), " of length 1.\n", "\n", "An object of class ", #> list("integer"), " of length 1.\n", "\n", "An object of class ", #> list("numeric"), " of length 1.\n", "\n", "An object of class ", #> list("character"), " of length 1.\n", "\n", #> "An object of class ", list("complex"), " of length 1.\n"), #> "\n", list("\n", "na_lgl\n", "\n", "na_int\n", #> "\n", "na_dbl\n", "\n", "na_chr\n", "\n", "na_cpl\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "Missing values are represented in R with the general symbol\n", #> list("NA"), ". They can be inserted in almost all data containers: all\n", #> "atomic vectors except raw vectors can contain missing values. To\n", #> "achieve this, R automatically converts the general ", #> list("NA"), " symbol to a\n", "typed missing value appropriate for the target vector. The objects\n", #> "provided here are aliases for those typed ", #> list("NA"), " objects.\n"), "\n", list("\n", #> "Typed missing values are necessary because R needs sentinel values\n", #> "of the same type (i.e. the same machine representation of the data)\n", #> "as the containers into which they are inserted. The official typed\n", #> "missing values are ", list("NA_integer_"), #> ", ", list("NA_real_"), ", ", list("NA_character_"), #> " and\n", list("NA_complex_"), ". The missing value for logical vectors is simply the\n", #> "default ", list("NA"), ". The aliases provided in rlang are consistently named\n", #> "and thus simpler to remember. Also, ", list( #> "na_lgl"), " is provided as an\n", "alias to ", #> list("NA"), " that makes intent clearer.\n", #> "\n", "Since ", list("na_lgl"), " is the default ", #> list("NA"), ", expressions such as ", list( #> "c(NA, NA)"), "\n", "yield logical vectors as no data is available to give a clue of the\n", #> "target type. In the same way, since lists and environments can\n", #> "contain any types, expressions like ", list( #> "list(NA)"), " store a logical\n", list("NA"), #> ".\n"), "\n", list(list("Life cycle"), list( #> "\n", "\n", "\n", "These shortcuts might be moved to the vctrs package at some\n", #> "point. This is why they are marked as questioning.\n")), #> "\n", "\n", list("\n", "typeof(NA)\n", "typeof(na_lgl)\n", #> "typeof(na_int)\n", "\n", "# Note that while the base R missing symbols cannot be overwritten,\n", #> "# that's not the case for rlang's aliases:\n", #> "na_dbl <- NA\n", "typeof(na_dbl)\n"), "\n", #> list("datasets"), "\n", list("internal"), "\n"), #> missing_arg.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/arg.R", #> "\n", list("missing_arg"), "\n", list("missing_arg"), #> "\n", list("is_missing"), "\n", list("maybe_missing"), #> "\n", list("Generate or handle a missing argument"), #> "\n", list("\n", "missing_arg()\n", "\n", "is_missing(x)\n", #> "\n", "maybe_missing(x, default = missing_arg())\n"), #> "\n", list("\n", list(list("x"), list("An object that might be the missing argument.")), #> "\n", "\n", list(list("default"), list("The object to return if the input is missing,\n", #> "defaults to ", list("missing_arg()"), ".")), #> "\n"), "\n", list("\n", "These functions help using the missing argument as a regular R\n", #> "object.\n", list("\n", list(), " ", list("missing_arg()"), #> " generates a missing argument.\n", list(), #> " ", list("is_missing()"), " is like ", list( #> list("base::missing()")), " but also supports\n", #> "testing for missing arguments contained in other objects like\n", #> "lists.\n", list(), " ", list("maybe_missing()"), #> " is useful to pass down an input that might be\n", #> "missing to another function, potentially substituting by a\n", #> "default value. It avoids triggering an \"argument is missing\" error.\n"), #> "\n"), "\n", list(list("Other ways to reify the missing argument"), #> list("\n", "\n", list("\n", list(), " ", list( #> "base::quote(expr = )"), " is the canonical way to create a missing\n", #> "argument object.\n", list(), " ", list("expr()"), #> " called without argument creates a missing argument.\n", #> list(), " ", list("quo()"), " called without argument creates an empty quosure, i.e. a\n", #> "quosure containing the missing argument object.\n"), #> "\n")), "\n", "\n", list(list("Fragility of the missing argument object"), #> list("\n", "\n", "\n", "The missing argument is an object that triggers an error if and\n", #> "only if it is the result of evaluating a symbol. No error is\n", #> "produced when a function call evaluates to the missing argument\n", #> "object. This means that expressions like ", #> list("x[[1]] <- missing_arg()"), "\n", "are perfectly safe. Likewise, ", #> list("x[[1]]"), " is safe even if the result\n", #> "is the missing object.\n", "\n", "However, as soon as the missing argument is passed down between\n", #> "functions through an argument, you're at risk of triggering a\n", #> "missing error. This is because arguments are passed through\n", #> "symbols. To work around this, ", list("is_missing()"), #> " and ", list("maybe_missing(x)"), "\n", #> "use a bit of magic to determine if the input is the missing\n", #> "argument without triggering a missing error.\n", #> "\n", list("maybe_missing()"), " is particularly useful for prototyping\n", #> "meta-programming algorithms in R. The missing argument is a likely\n", #> "input when computing on the language because it is a standard\n", #> "object in formals lists. While C functions are always allowed to\n", #> "return the missing argument and pass it to other C functions, this\n", #> "is not the case on the R side. If you're implementing your\n", #> "meta-programming algorithm in R, use ", #> list("maybe_missing()"), " when an\n", "input might be the missing argument object.\n")), #> "\n", "\n", list(list("Life cycle"), list("\n", #> "\n", list("\n", list(), " ", list("missing_arg()"), #> " and ", list("is_missing()"), " are stable.\n", #> list(), " Like the rest of rlang, ", list( #> "maybe_missing()"), " is maturing.\n"), #> "\n")), "\n", "\n", list("\n", "# The missing argument usually arises inside a function when the\n", #> "# user omits an argument that does not have a default:\n", #> "fn <- function(x) is_missing(x)\n", "fn()\n", #> "\n", "# Creating a missing argument can also be useful to generate calls\n", #> "args <- list(1, missing_arg(), 3, missing_arg())\n", #> "quo(fn(!!! args))\n", "\n", "# Other ways to create that object include:\n", #> "quote(expr = )\n", "expr()\n", "\n", "# It is perfectly valid to generate and assign the missing\n", #> "# argument in a list.\n", "x <- missing_arg()\n", #> "l <- list(missing_arg())\n", "\n", "# Just don't evaluate a symbol that contains the empty argument.\n", #> "# Evaluating the object `x` that we created above would trigger an\n", #> "# error.\n", "# x # Not run\n", "\n", "# On the other hand accessing a missing argument contained in a\n", #> "# list does not trigger an error because subsetting is a function\n", #> "# call:\n", "l[[1]]\n", "is.null(l[[1]])\n", #> "\n", "# In case you really need to access a symbol that might contain the\n", #> "# empty argument object, use maybe_missing():\n", #> "maybe_missing(x)\n", "is.null(maybe_missing(x))\n", #> "is_missing(maybe_missing(x))\n", "\n", "\n", #> "# Note that base::missing() only works on symbols and does not\n", #> "# support complex expressions. For this reason the following lines\n", #> "# would throw an error:\n", "\n", "#> missing(missing_arg())\n", #> "#> missing(l[[1]])\n", "\n", "# while is_missing() will work as expected:\n", #> "is_missing(missing_arg())\n", "is_missing(l[[1]])\n"), #> "\n"), mut_node_car.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("mut_node_car"), "\n", list("mut_node_car"), #> "\n", list("mut_node_cdr"), "\n", list("mut_node_caar"), #> "\n", list("mut_node_cadr"), "\n", list("mut_node_cdar"), #> "\n", list("mut_node_cddr"), "\n", list("mut_node_tag"), #> "\n", list("Mutate node components"), "\n", list( #> "\n", "mut_node_car(x, newcar)\n", "\n", "mut_node_cdr(x, newcdr)\n", #> "\n", "mut_node_caar(x, newcar)\n", "\n", "mut_node_cadr(x, newcar)\n", #> "\n", "mut_node_cdar(x, newcdr)\n", "\n", "mut_node_cddr(x, newcdr)\n", #> "\n", "mut_node_tag(x, newtag)\n"), "\n", list( #> "\n", list(list("x"), list("A language or pairlist node. Note that these functions are\n", #> "barebones and do not perform any type checking.")), #> "\n", "\n", list(list("newcar"), list("The new CAR or CDR for the node. These\n", #> "can be any R objects.")), "\n", "\n", list( #> list("newcdr"), list("The new CAR or CDR for the node. These\n", #> "can be any R objects.")), "\n", "\n", #> list(list("newtag"), list("The new tag for the node. This should be a symbol.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions were deprecated and renamed with ", #> list("node_poke_"), "\n", "prefix in rlang 0.2.0. This change follows a new naming convention\n", #> "where mutation is referred to as \"poking\".\n"), #> "\n", list("internal"), "\n"), names2.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("names2"), "\n", list("names2"), "\n", #> list("Get names of a vector"), "\n", list("\n", #> "names2(x)\n"), "\n", list("\n", list(list( #> "x"), list("A vector.")), "\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", "This names getter always returns a character vector, even when an\n", #> "object does not have a ", list("names"), " attribute. In this case, it returns\n", #> "a vector of empty names ", list("\"\""), ". It also standardises missing names to\n", #> list("\"\""), ".\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", list("names2()"), " is stable.\n")), #> "\n", "\n", list("\n", "names2(letters)\n", "\n", #> "# It also takes care of standardising missing names:\n", #> "x <- set_names(1:3, c(\"a\", NA, \"b\"))\n", #> "names2(x)\n"), "\n"), `new-vector-along-retired.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("new-vector-along-retired"), "\n", #> list("new-vector-along-retired"), "\n", list( #> "new_logical_along"), "\n", list("new_integer_along"), #> "\n", list("new_double_along"), "\n", list("new_character_along"), #> "\n", list("new_complex_along"), "\n", list("new_raw_along"), #> "\n", list("new_list_along"), "\n", list("Create vectors matching the length of a given vector"), #> "\n", list("\n", "new_logical_along(x, names = base::names(x))\n", #> "\n", "new_integer_along(x, names = base::names(x))\n", #> "\n", "new_double_along(x, names = base::names(x))\n", #> "\n", "new_character_along(x, names = base::names(x))\n", #> "\n", "new_complex_along(x, names = base::names(x))\n", #> "\n", "new_raw_along(x, names = base::names(x))\n", #> "\n", "new_list_along(x, names = base::names(x))\n"), #> "\n", list("\n", list(list("x"), list("A vector.")), #> "\n", "\n", list(list("names"), list("Names for the new vector.")), #> "\n"), "\n", list("\n", "These functions are deprecated as of rlang 0.3.0 because they\n", #> "are longer to type than the equivalent ", #> list(list("rep_along()")), " or\n", list(list( #> "rep_named()")), " calls without added clarity.\n"), #> "\n", list("internal"), "\n"), `new-vector.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-new.R", #> "\n", list("new-vector"), "\n", list("new-vector"), #> "\n", list("new_logical"), "\n", list("new_integer"), #> "\n", list("new_double"), "\n", list("new_character"), #> "\n", list("new_complex"), "\n", list("new_raw"), #> "\n", list("new_list"), "\n", list("Create vectors matching a given length"), #> "\n", list("\n", "new_logical(n, names = NULL)\n", #> "\n", "new_integer(n, names = NULL)\n", "\n", #> "new_double(n, names = NULL)\n", "\n", "new_character(n, names = NULL)\n", #> "\n", "new_complex(n, names = NULL)\n", "\n", #> "new_raw(n, names = NULL)\n", "\n", "new_list(n, names = NULL)\n"), #> "\n", list("\n", list(list("n"), list("The vector length.")), #> "\n", "\n", list(list("names"), list("Names for the new vector.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "These functions construct vectors of a given length, with attributes\n", #> "specified via dots. Except for ", list("new_list()"), #> " and ", list("new_raw()"), ", the\n", "empty vectors are filled with typed ", #> list("missing"), " values. This is in\n", "contrast to the base function ", #> list(list("base::vector()")), " which creates\n", #> "zero-filled vectors.\n"), "\n", list(list( #> "Lifecycle"), list("\n", "\n", "\n", "These functions are likely to be replaced by a vctrs equivalent in\n", #> "the future. They are in the questioning lifecycle stage.\n")), #> "\n", "\n", list("\n", "new_list(10)\n", "new_logical(10)\n"), #> "\n", list("\n", "rep_along\n"), "\n", list("internal"), #> "\n"), new_call.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/node.R", #> "\n", list("new_call"), "\n", list("new_call"), #> "\n", list("Create a new call from components"), #> "\n", list("\n", "new_call(car, cdr = NULL)\n"), #> "\n", list("\n", list(list("car"), list("The head of the call. It should be a\n", #> list("callable"), " object: a symbol, call, or literal\n", #> "function.")), "\n", "\n", list(list("cdr"), #> list("The tail of the call, i.e. a ", list( #> "node list"), " of\n", "arguments.")), "\n"), #> "\n", list("\n", "Create a new call from components\n"), #> "\n", list("internal"), "\n"), new_formula.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/formula.R", #> "\n", list("new_formula"), "\n", list("new_formula"), #> "\n", list("Create a formula"), "\n", list("\n", #> "new_formula(lhs, rhs, env = caller_env())\n"), #> "\n", list("\n", list(list("lhs, rhs"), list( #> "A call, name, or atomic vector.")), "\n", #> "\n", list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "A formula object.\n"), #> "\n", list("\n", "Create a formula\n"), "\n", #> list("\n", "new_formula(quote(a), quote(b))\n", #> "new_formula(NULL, quote(b))\n"), "\n", list( #> "\n", list(list("new_quosure()")), "\n"), "\n"), #> new_function.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("new_function"), "\n", list("new_function"), #> "\n", list("Create a function"), "\n", list("\n", #> "new_function(args, body, env = caller_env())\n"), #> "\n", list("\n", list(list("args"), list("A named list or pairlist of default arguments. Note\n", #> "that if you want arguments that don't have defaults, you'll need\n", #> "to use the special function ", list(list("pairlist2()")), #> ". If you need quoted\n", "defaults, use ", #> list(list("exprs()")), ".")), "\n", "\n", list( #> list("body"), list("A language object representing the code inside the\n", #> "function. Usually this will be most easily generated with\n", #> list(list("base::quote()")))), "\n", "\n", #> list(list("env"), list("The parent environment of the function, defaults to the\n", #> "calling environment of ", list("new_function()"))), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", "This constructs a new function given its three components:\n", #> "list of arguments, body code and parent environment.\n"), #> "\n", list("\n", "f <- function() letters\n", #> "g <- new_function(NULL, quote(letters))\n", #> "identical(f, g)\n", "\n", "# Pass a list or pairlist of named arguments to create a function\n", #> "# with parameters. The name becomes the parameter name and the\n", #> "# argument the default value for this parameter:\n", #> "new_function(list(x = 10), quote(x))\n", "new_function(pairlist2(x = 10), quote(x))\n", #> "\n", "# Use `exprs()` to create quoted defaults. Compare:\n", #> "new_function(pairlist2(x = 5 + 5), quote(x))\n", #> "new_function(exprs(x = 5 + 5), quote(x))\n", #> "\n", "# Pass empty arguments to omit defaults. `list()` doesn't allow\n", #> "# empty arguments but `pairlist2()` does:\n", #> "new_function(pairlist2(x = , y = 5 + 5), quote(x + y))\n", #> "new_function(exprs(x = , y = 5 + 5), quote(x + y))\n"), #> "\n"), new_node.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/node.R", #> "\n", list("new_node"), "\n", list("new_node"), #> "\n", list("node_car"), "\n", list("node_cdr"), #> "\n", list("node_caar"), "\n", list("node_cadr"), #> "\n", list("node_cdar"), "\n", list("node_cddr"), #> "\n", list("node_poke_car"), "\n", list("node_poke_cdr"), #> "\n", list("node_poke_caar"), "\n", list("node_poke_cadr"), #> "\n", list("node_poke_cdar"), "\n", list("node_poke_cddr"), #> "\n", list("node_tag"), "\n", list("node_poke_tag"), #> "\n", list("Helpers for pairlist and language nodes"), #> "\n", list("\n", "new_node(car, cdr = NULL)\n", #> "\n", "node_car(x)\n", "\n", "node_cdr(x)\n", #> "\n", "node_caar(x)\n", "\n", "node_cadr(x)\n", #> "\n", "node_cdar(x)\n", "\n", "node_cddr(x)\n", #> "\n", "node_poke_car(x, newcar)\n", "\n", "node_poke_cdr(x, newcdr)\n", #> "\n", "node_poke_caar(x, newcar)\n", "\n", #> "node_poke_cadr(x, newcar)\n", "\n", "node_poke_cdar(x, newcdr)\n", #> "\n", "node_poke_cddr(x, newcdr)\n", "\n", #> "node_tag(x)\n", "\n", "node_poke_tag(x, newtag)\n"), #> "\n", list("\n", list(list("car, newcar, cdr, newcdr"), #> list("The new CAR or CDR for the node. These\n", #> "can be any R objects.")), "\n", "\n", list( #> list("x"), list("A language or pairlist node. Note that these functions are\n", #> "barebones and do not perform any type checking.")), #> "\n", "\n", list(list("newtag"), list("The new tag for the node. This should be a symbol.")), #> "\n"), "\n", list("\n", "Setters like ", list( #> "node_poke_car()"), " invisibly return ", list( #> "x"), " modified\n", "in place. Getters return the requested node component.\n"), #> "\n", list("\n", list("Important"), ": These functions are for expert R programmers only.\n", #> "You should only use them if you feel comfortable manipulating low\n", #> "level R data structures at the C level. We export them at the R level\n", #> "in order to make it easy to prototype C code. They don't perform\n", #> "any type checking and can crash R very easily (try to take the CAR\n", #> "of an integer vector --- save any important objects beforehand!).\n"), #> "\n", list("\n", list(list("duplicate()")), " for creating copy-safe objects and\n", #> list(list("base::pairlist()")), " for an easier way of creating a linked list of\n", #> "nodes.\n"), "\n", list("internal"), "\n"), #> new_quosures.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/quo.R", #> "\n", list("new_quosures"), "\n", list("new_quosures"), #> "\n", list("as_quosures"), "\n", list("is_quosures"), #> "\n", list("Create a list of quosures"), "\n", #> list("\n", "new_quosures(x)\n", "\n", "as_quosures(x, env, named = FALSE)\n", #> "\n", "is_quosures(x)\n"), "\n", list("\n", #> list(list("x"), list("A list of quosures or objects to coerce to quosures.")), #> "\n", "\n", list(list("env"), list("The default environment for the new quosures.")), #> "\n", "\n", list(list("named"), list("Whether to name the list with ", #> list(list("quos_auto_name()")), ".")), "\n"), #> "\n", list("\n", "This small S3 class provides methods for ", #> list("["), " and ", list("c()"), " and ensures\n", #> "the following invariants:\n", list("\n", list(), #> " The list only contains quosures.\n", list(), #> " It is always named, possibly with a vector of empty strings.\n"), #> "\n", "\n", list("new_quosures()"), " takes a list of quosures and adds the ", #> list("quosures"), "\n", "class and a vector of empty names if needed. ", #> list("as_quosures()"), " calls\n", list(list( #> "as_quosure()")), " on all elements before creating the ", #> list("quosures"), "\n", "object.\n"), "\n"), #> new_weakref.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/weakref.R", #> "\n", list("new_weakref"), "\n", list("new_weakref"), #> "\n", list("Create a weak reference"), "\n", #> list("\n", "new_weakref(key, value = NULL, finalizer = NULL, on_quit = FALSE)\n"), #> "\n", list("\n", list(list("key"), list("The key for the weak reference. Must be a reference object -- that\n", #> "is, an environment or external pointer.")), #> "\n", "\n", list(list("value"), list("The value for the weak reference. This can be ", #> list("NULL"), ", if you\n", "want to use the weak reference like a weak pointer.")), #> "\n", "\n", list(list("finalizer"), list("A function that is run after the key becomes unreachable.")), #> "\n", "\n", list(list("on_quit"), list("Should the finalizer be run when R exits?")), #> "\n"), "\n", list("\n", "A weak reference is a special R object which makes it possible to keep a\n", #> "reference to an object without preventing garbage collection of that object.\n", #> "It can also be used to keep data about an object without preventing GC of the\n", #> "object, similar to WeakMaps in JavaScript.\n", #> "\n", "Objects in R are considered ", list( #> "reachable"), " if they can be accessed by following\n", #> "a chain of references, starting from a ", #> list("root node"), "; root nodes are\n", "specially-designated R objects, and include the global environment and base\n", #> "environment. As long as the key is reachable, the value will not be garbage\n", #> "collected. This is true even if the weak reference object becomes\n", #> "unreachable. The key effectively prevents the weak reference and its value\n", #> "from being collected, according to the following chain of ownership:\n", #> list("weakref <- key -> value"), ".\n", "\n", #> "When the key becomes unreachable, the key and value in the weak reference\n", #> "object are replaced by ", list("NULL"), ", and the finalizer is scheduled to execute.\n"), #> "\n", list("\n", "e <- env()\n", "\n", "# Create a weak reference to e\n", #> "w <- new_weakref(e, finalizer = function(e) message(\"finalized\"))\n", #> "\n", "# Get the key object from the weak reference\n", #> "identical(wref_key(w), e)\n", "\n", "# When the regular reference (the `e` binding) is removed and a GC occurs,\n", #> "# the weak reference will not keep the object alive.\n", #> "rm(e)\n", "gc()\n", "identical(wref_key(w), NULL)\n", #> "\n", "\n", "# A weak reference with a key and value. The value contains data about the\n", #> "# key.\n", "k <- env()\n", "v <- list(1, 2, 3)\n", #> "w <- new_weakref(k, v)\n", "\n", "identical(wref_key(w), k)\n", #> "identical(wref_value(w), v)\n", "\n", "# When v is removed, the weak ref keeps it alive because k is still reachable.\n", #> "rm(v)\n", "gc()\n", "identical(wref_value(w), list(1, 2, 3))\n", #> "\n", "# When k is removed, the weak ref does not keep k or v alive.\n", #> "rm(k)\n", "gc()\n", "identical(wref_key(w), NULL)\n", #> "identical(wref_value(w), NULL)\n"), "\n", #> list("\n", list(list("is_weakref()")), ", ", #> list(list("wref_key()")), " and ", list(list( #> "wref_value()")), ".\n"), "\n", list("experimental"), #> "\n"), ns_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("ns_env"), "\n", list("ns_env"), "\n", #> list("ns_imports_env"), "\n", list("ns_env_name"), #> "\n", list("Get the namespace of a package"), #> "\n", list("\n", "ns_env(x = caller_env())\n", #> "\n", "ns_imports_env(x = caller_env())\n", #> "\n", "ns_env_name(x = caller_env())\n"), "\n", #> list("\n", list(list("x"), list(list("\n", list(), #> " For ", list("ns_env()"), ", the name of a package or an environment as a\n", #> "string.\n", list("\n", list(), " An environment (the current environment by default).\n", #> list(), " A function.\n"), "\n", "\n", "In the latter two cases, the environment ancestry is searched for\n", #> "a namespace with ", list(list("base::topenv()")), #> ". If the environment doesn't\n", "inherit from a namespace, this is an error.\n"))), #> "\n", "\n", list(list("env"), list("A namespace environment.")), #> "\n"), "\n", list("\n", "Namespaces are the environment where all the functions of a package\n", #> "live. The parent environments of namespaces are the ", #> list("imports"), "\n", "environments, which contain all the functions imported from other\n", #> "packages.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "These functions are experimental and may not belong to the rlang\n", #> "package. Expect API changes.\n")), "\n", #> "\n", list("\n", list(list("pkg_env()")), "\n"), #> "\n", list("internal"), "\n"), `nse-defuse.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/nse-defuse.R", #> "\n", list("nse-defuse"), "\n", list("nse-defuse"), #> "\n", list("quotation"), "\n", list("expr"), #> "\n", list("enexpr"), "\n", list("exprs"), "\n", #> list("enexprs"), "\n", list("ensym"), "\n", list( #> "ensyms"), "\n", list("quo"), "\n", list("enquo"), #> "\n", list("quos"), "\n", list("enquos"), "\n", #> list("Defuse R expressions"), "\n", list("\n", #> "expr(expr)\n", "\n", "enexpr(arg)\n", "\n", #> "exprs(\n", " ...,\n", " .named = FALSE,\n", #> " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .unquote_names = TRUE\n", ")\n", "\n", "enexprs(\n", #> " ...,\n", " .named = FALSE,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .unquote_names = TRUE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n", "\n", "ensym(arg)\n", #> "\n", "ensyms(\n", " ...,\n", " .named = FALSE,\n", #> " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .unquote_names = TRUE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n", "\n", "quo(expr)\n", #> "\n", "enquo(arg)\n", "\n", "quos(\n", " ...,\n", #> " .named = FALSE,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .unquote_names = TRUE\n", ")\n", "\n", "enquos(\n", #> " ...,\n", " .named = FALSE,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .unquote_names = TRUE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n"), "\n", #> list("\n", list(list("expr"), list("An expression.")), #> "\n", "\n", list(list("arg"), list("A symbol representing an argument. The expression\n", #> "supplied to that argument will be captured instead of being\n", #> "evaluated.")), "\n", "\n", list(list("..."), #> list("For ", list("enexprs()"), ", ", list( #> "ensyms()"), " and ", list("enquos()"), #> ", names of\n", "arguments to capture without evaluation (including ", #> list("..."), "). For\n", list("exprs()"), #> " and ", list("quos()"), ", the expressions to capture unevaluated\n", #> "(including expressions contained in ", #> list("..."), ").")), "\n", "\n", list(list( #> ".named"), list("Whether to ensure all dots are named. Unnamed\n", #> "elements are processed with ", list(list( #> "as_label()")), " to build a default\n", #> "name.")), "\n", "\n", list(list(".ignore_empty"), #> list("Whether to ignore empty arguments. Can be one\n", #> "of ", list("\"trailing\""), ", ", list( #> "\"none\""), ", ", list("\"all\""), ". If ", #> list("\"trailing\""), ", only the\n", "last argument is ignored if it is empty. Note that ", #> list("\"trailing\""), "\n", "applies only to arguments passed in ", #> list("..."), ", not to named\n", "arguments. On the other hand, ", #> list("\"all\""), " also applies to named\n", #> "arguments.")), "\n", "\n", list(list(".unquote_names"), #> list("Whether to treat ", list(":="), " as ", #> list("="), ". Unlike ", list("="), ", the\n", #> list(":="), " syntax supports ", list("!!"), #> " unquoting on the LHS.")), "\n", "\n", #> list(list(".homonyms"), list("How to treat arguments with the same name. The\n", #> "default, ", list("\"keep\""), ", preserves these arguments. Set ", #> list(".homonyms"), " to\n", list("\"first\""), #> " to only keep the first occurrences, to ", #> list("\"last\""), " to keep\n", "the last occurrences, and to ", #> list("\"error\""), " to raise an informative\n", #> "error and indicate what arguments have duplicated names.")), #> "\n", "\n", list(list(".check_assign"), list( #> "Whether to check for ", list("<-"), " calls passed in\n", #> "dots. When ", list("TRUE"), " and a ", list( #> "<-"), " call is detected, a warning is\n", #> "issued to advise users to use ", list("="), #> " if they meant to match a\n", "function parameter, or wrap the ", #> list("<-"), " call in braces otherwise.\n", #> "This ensures assignments are explicit.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", "The defusing operators ", list( #> "expr()"), " and ", list("enquo()"), " prevent the\n", #> "evaluation of R code. Defusing is also known as ", #> list("quoting"), ", and is\n", "done in base R by ", #> list(list("quote()")), " and ", list(list("substitute()")), #> ". When a function\n", "argument is defused, R doesn't return its value like it normally\n", #> "would but it returns the R expression describing how to make the\n", #> "value. These defused expressions are like blueprints for computing\n", #> "values.\n", "\n", "There are two main ways to defuse expressions, to which correspond\n", #> "the two functions ", list("expr()"), " and ", #> list("enquo()"), ". Whereas ", list("expr()"), #> " defuses\n", "your own expression, ", list( #> "enquo()"), " defuses expressions supplied as\n", #> "argument by the user of a function. See section on function\n", #> "arguments for more on this distinction.\n", #> "\n", "The main purpose of defusing evaluation of an expression is to\n", #> "enable data-masking, where an expression is evaluated in the\n", #> "context of a data frame so that you can write ", #> list("var"), " instead of\n", list("data$var"), #> ". The expression is defused so it can be resumed later\n", #> "on, in a context where the data-variables have been defined.\n", #> "\n", "Defusing prevents the evaluation of R code, but you can still force\n", #> "evaluation inside a defused expression with the ", #> list("forcing operators"), " ", list("!!"), #> " and ", list("!!!"), ".\n"), "\n", list(list( #> "Types of defused expressions"), list("\n", #> "\n", list("\n", list(), " ", list("Calls"), #> ", like ", list("f(1, 2, 3)"), " or ", list( #> "1 + 1"), " represent the action of\n", #> "calling a function to compute a new value, such as a vector.\n", #> list(), " ", list("Symbols"), ", like ", #> list("x"), " or ", list("df"), ", represent named objects. When the\n", #> "object pointed to by the symbol was defined in a function or in\n", #> "the global environment, we call it an environment-variable. When\n", #> "the object is a column in a data frame, we call it a\n", #> "data-variable.\n"), "\n", "\n", "You can create new call or symbol objects by using the defusing\n", #> "function ", list("expr()"), ":", list("# Create a symbol representing objects called `foo`\n", #> "expr(foo)\n", "\n", "# Create a call representing the computation of the mean of `foo`\n", #> "expr(mean(foo, na.rm = TRUE))\n"), "\n", #> "\n", "Defusing is not the only way to create defused expressions. You can\n", #> "also assemble them from data:", list("# Assemble a symbol from a string\n", #> "var <- \"foo\"\n", "sym(var)\n", "\n", "# Assemble a call from strings, symbols, and other objects\n", #> "call(\"mean\", sym(var), na.rm = TRUE)\n"), #> "\n")), "\n", "\n", list(list("Defusing function arguments"), #> list("\n", "\n", "\n", "There are two points of view when it comes to defusing an\n", #> "expression:\n", list("\n", list(), " You can defuse expressions that ", #> list("you"), " supply with ", list("expr()"), #> ". This\n", "is one way of creating symbols and calls (see previous section).\n", #> list(), " You can defuse the expressions supplied by ", #> list("the user"), " of your\n", "function with the operators starting with ", #> list("en"), " like ", list("ensym()"), #> ",\n", list("enquo()"), " and their plural variants. They defuse function\n", #> "arguments .\n"), "\n")), "\n", "\n", list( #> list("Defused arguments and quosures"), list( #> "\n", "\n", "\n", "If you inspect the return values of ", #> list("expr()"), " and ", list("enquo()"), #> ", you'll\n", "notice that the latter doesn't return a raw expression like the\n", #> "former. Instead it returns a ", list("quosure"), #> ", a wrapper containing an\n", "expression and an environment. R needs information about the\n", #> "environment to properly evaluate the argument expression because it\n", #> "comes from a different context than the current function.\n", #> "\n", "See the ", list("quosure"), " help topic about tools to work with quosures.\n")), #> "\n", "\n", list(list("Comparison to base R"), #> list("\n", "\n", list("\n", list(), " The defusing operator ", #> list("expr()"), " is similar to ", list(list( #> "quote()")), ". Like\n", list(list("bquote()")), #> ", it allows ", list("forcing"), " evaluation of parts\n", #> "of an expression.\n", list(), " The plural variant ", #> list("exprs()"), " is similar to ", list( #> list("alist()")), ".\n", list(), " The argument-defusing operator ", #> list("enquo()"), " is similar to\n", list( #> list("substitute()")), ".\n"), "\n")), #> "\n", "\n", list("\n", "# expr() and exprs() capture expressions that you supply:\n", #> "expr(symbol)\n", "exprs(several, such, symbols)\n", #> "\n", "# enexpr() and enexprs() capture expressions that your user supplied:\n", #> "expr_inputs <- function(arg, ...) {\n", " user_exprs <- enexprs(arg, ...)\n", #> " user_exprs\n", "}\n", "expr_inputs(hello)\n", #> "expr_inputs(hello, bonjour, ciao)\n", "\n", #> "# ensym() and ensyms() provide additional type checking to ensure\n", #> "# the user calling your function has supplied bare object names:\n", #> "sym_inputs <- function(...) {\n", " user_symbols <- ensyms(...)\n", #> " user_symbols\n", "}\n", "sym_inputs(hello, \"bonjour\")\n", #> "## sym_inputs(say(hello)) # Error: Must supply symbols or strings\n", #> "expr_inputs(say(hello))\n", "\n", "\n", "# All these quoting functions have quasiquotation support. This\n", #> "# means that you can unquote (evaluate and inline) part of the\n", #> "# captured expression:\n", "what <- sym(\"bonjour\")\n", #> "expr(say(what))\n", "expr(say(!!what))\n", #> "\n", "# This also applies to expressions supplied by the user. This is\n", #> "# like an escape hatch that allows control over the captured\n", #> "# expression:\n", "expr_inputs(say(!!what), !!what)\n", #> "\n", "\n", "# Finally, you can capture expressions as quosures. A quosure is an\n", #> "# object that contains both the expression and its environment:\n", #> "quo <- quo(letters)\n", "quo\n", "\n", "get_expr(quo)\n", #> "get_env(quo)\n", "\n", "# Quosures can be evaluated with eval_tidy():\n", #> "eval_tidy(quo)\n", "\n", "# They have the nice property that you can pass them around from\n", #> "# context to context (that is, from function to function) and they\n", #> "# still evaluate in their original environment:\n", #> "multiply_expr_by_10 <- function(expr) {\n", #> " # We capture the user expression and its environment:\n", #> " expr <- enquo(expr)\n", "\n", " # Then create an object that only exists in this function:\n", #> " local_ten <- 10\n", "\n", " # Now let's create a multiplication expression that (a) inlines\n", #> " # the user expression as LHS (still wrapped in its quosure) and\n", #> " # (b) refers to the local object in the RHS:\n", #> " quo(!!expr * local_ten)\n", "}\n", "quo <- multiply_expr_by_10(2 + 3)\n", #> "\n", "# The local parts of the quosure are printed in colour if your\n", #> "# terminal is capable of displaying colours:\n", #> "quo\n", "\n", "# All the quosures in the expression evaluate in their original\n", #> "# context. The local objects are looked up properly and we get the\n", #> "# expected result:\n", "eval_tidy(quo)\n"), #> "\n", list("\n", list(list("enquo0()")), " and ", #> list(list("enquos0()")), " for variants that do not\n", #> "perform automatic injection/unquotation.\n"), #> "\n"), `nse-force.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/nse-force.R", #> "\n", list("nse-force"), "\n", list("nse-force"), #> "\n", list("quasiquotation"), "\n", list("UQ"), #> "\n", list("UQS"), "\n", list("{{}}"), "\n", #> list("{{"), "\n", list("!!"), "\n", list("!!!"), #> "\n", list(":="), "\n", list("qq_show"), "\n", #> list("Force parts of an expression"), "\n", list( #> "\n", "qq_show(expr)\n"), "\n", list("\n", #> list(list("expr"), list("An expression to be quasiquoted.")), #> "\n"), "\n", list("\n", "It is sometimes useful to force early evaluation of part of an\n", #> "expression before it gets fully evaluated. The tidy eval framework\n", #> "provides several forcing operators for different use cases.\n", #> list("\n", list(), " The bang-bang operator ", #> list("!!"), " forces a ", list("single"), #> " object. One\n", "common case for ", list( #> "!!"), " is to substitute an environment-variable\n", #> "(created with ", list("<-"), ") with a data-variable (inside a data frame).", #> list("library(dplyr)\n", "\n", "# The environment variable `var` refers to the data-variable\n", #> "# `height`\n", "var <- sym(\"height\")\n", #> "\n", "# We force `var`, which substitutes it with `height`\n", #> "starwars %>%\n", " summarise(avg = mean(!!var, na.rm = TRUE))\n"), #> "\n", list(), " The big-bang operator ", #> list("!!!"), " forces-splice a ", list("list"), #> " of objects.\n", "The elements of the list are spliced in place, meaning that they\n", #> "each become one single argument.", list( #> "vars <- syms(c(\"height\", \"mass\"))\n", #> "\n", "# Force-splicing is equivalent to supplying the elements separately\n", #> "starwars %>% select(!!!vars)\n", "starwars %>% select(height, mass)\n"), #> "\n", list(), " The curly-curly operator ", #> list("{{ }}"), " for function arguments is a bit\n", #> "special because it forces the function argument and immediately\n", #> "defuses it. The defused expression is substituted in place, ready\n", #> "to be evaluated in another context, such as the data frame.\n", #> "\n", "In practice, this is useful when you have a data-variable in an\n", #> "env-variable (such as a function argument).", #> list("# Force-defuse all function arguments that might contain\n", #> "# data-variables by embracing them with {{ }}\n", #> "mean_by <- function(data, by, var) {\n", #> " data %>%\n", " group_by({{ by }}) %>%\n", #> " summarise(avg = mean({{ var }}, na.rm = TRUE))\n", #> "}\n", "\n", "# The env-variables `by` and `var` are forced but defused.\n", #> "# The data-variables they contain are evaluated by dplyr later on\n", #> "# in data context.\n", "iris %>% mean_by(by = Species, var = Sepal.Width)\n"), #> "\n"), "\n", "\n", "Use ", list("qq_show()"), #> " to experiment with forcing operators. ", #> list("qq_show()"), "\n", "defuses its input, processes all forcing operators, and prints the\n", #> "result with ", list(list("expr_print()")), #> " to reveal objects inlined in the\n", "expression by the forcing operators.\n"), #> "\n", list(list("Forcing names"), list("\n", #> "\n", "\n", "When a function takes multiple named arguments\n", #> "(e.g. ", list("dplyr::mutate()"), "), it is difficult to supply a variable as\n", #> "name. Since the LHS of ", list("="), " is ", #> list("defused"), ", giving the name\n", "of a variable results in the argument having the name of the\n", #> "variable rather than the name stored in that variable. This problem\n", #> "of forcing evaluation of names is exactly what the ", #> list("!!"), " operator is\n", "for.\n", "\n", #> "Unfortunately R is very strict about the kind of expressions\n", #> "supported on the LHS of ", list("="), ". This is why rlang interprets the\n", #> "walrus operator ", list(":="), " as an alias of ", #> list("="), ". You can use it to supply\n", #> "names, e.g. ", list("a := b"), " is equivalent to ", #> list("a = b"), ". Since its syntax is\n", "more flexible you can also force names on its LHS:", #> list("name <- \"Jane\"\n", "\n", "list2(!!name := 1 + 2)\n", #> "exprs(!!name := 1 + 2)\n"), "\n", "\n", #> "Like ", list("="), ", the ", list(":="), " operator expects strings or symbols on its LHS.\n", #> "\n", "Since unquoting names is related to interpolating within a string\n", #> "with the glue package, we have made the glue syntax available on\n", #> "the LHS of ", list(":="), ":", list("list2(\"{name}\" := 1)\n", #> "tibble(\"{name}\" := 1)\n"), "\n", "\n", #> "You can also interpolate defused function arguments with double\n", #> "braces ", list("{{"), ", similar to the curly-curly syntax:", #> list("wrapper <- function(data, var) {\n", #> " data %>% mutate(\"{{ var }}_foo\" := {{ var }} * 2)\n", #> "}\n"), "\n", "\n", "Currently, forcing names with ", #> list(":="), " only works in top level\n", "expressions. These are all valid:", #> list("exprs(\"{name}\" := x)\n", "tibble(\"{name}\" := x)\n"), #> "\n", "\n", "But deep-forcing names isn't supported:", #> list("exprs(this(is(deep(\"{name}\" := x))))\n"), #> "\n")), "\n", "\n", list(list("Theory"), list( #> "\n", "\n", "\n", "Formally, ", list("quo()"), #> " and ", list("expr()"), " are quasiquotation functions, ", #> list("!!"), "\n", "is the unquote operator, and ", #> list("!!!"), " is the unquote-splice operator.\n", #> "These terms have a rich history in Lisp languages, and live on in\n", #> "modern languages like\n", list(list("https://docs.julialang.org/en/v1/manual/metaprogramming/"), #> list("Julia")), "\n", "and\n", list(list( #> "https://docs.racket-lang.org/reference/quasiquote.html"), #> list("Racket")), ".\n")), "\n", "\n", list( #> list("Life cycle"), list("\n", "\n", list("\n", #> list(), " Calling ", list("UQ()"), " and ", #> list("UQS()"), " with the rlang namespace qualifier is\n", #> "deprecated as of rlang 0.3.0. Just use the unqualified forms\n", #> "instead:", list("# Bad\n", "rlang::expr(mean(rlang::UQ(var) * 100))\n", #> "\n", "# Ok\n", "rlang::expr(mean(UQ(var) * 100))\n", #> "\n", "# Good\n", "rlang::expr(mean(!!var * 100))\n"), #> "\n", "\n", "Supporting namespace qualifiers complicates the implementation of\n", #> "unquotation and is misleading as to the nature of unquoting\n", #> "operators (which are syntactic operators that operate at\n", #> "quotation-time rather than function calls at evaluation-time).\n", #> list(), " ", list("UQ()"), " and ", list( #> "UQS()"), " were soft-deprecated in rlang 0.2.0 in order\n", #> "to make the syntax of quasiquotation more consistent. The prefix\n", #> "forms are now ", list("`!!`()"), " and ", #> list("`!!!`()"), " which is\n", "consistent with other R operators (e.g. ", #> list("`+`(a, b)"), " is the\n", "prefix form of ", #> list("a + b"), ").\n", "\n", "Note that the prefix forms are not as relevant as before because\n", #> list("!!"), " now has the right operator precedence, i.e. the same as\n", #> "unary ", list("-"), " or ", list("+"), ". It is thus safe to mingle it with other\n", #> "operators, e.g. ", list("!!a + !!b"), " does the right thing. In addition the\n", #> "parser now strips one level of parentheses around unquoted\n", #> "expressions. This way ", list("(!!\"foo\")(...)"), #> " expands to ", list("foo(...)"), ".\n", #> "These changes make the prefix forms less useful.\n", #> "\n", "Finally, the named functional forms ", #> list("UQ()"), " and ", list("UQS()"), " were\n", #> "misleading because they suggested that existing knowledge about\n", #> "functions is applicable to quasiquotation. This was reinforced by\n", #> "the visible definitions of these functions exported by rlang and\n", #> "by the tidy eval parser interpreting ", #> list("rlang::UQ()"), " as ", list("!!"), #> ". In\n", "reality unquoting is ", list("not"), #> " a function call, it is a syntactic\n", #> "operation. The operator form makes it clearer that unquoting is\n", #> "special.\n"), "\n")), "\n", "\n", list("\n", #> "# Interpolation with {{ }} is the easiest way to forward\n", #> "# arguments to tidy eval functions:\n", "if (is_attached(\"package:dplyr\")) {\n", #> "\n", "# Forward all arguments involving data frame columns by\n", #> "# interpolating them within other data masked arguments.\n", #> "# Here we interpolate `arg` in a `summarise()` call:\n", #> "my_function <- function(data, arg) {\n", " summarise(data, avg = mean({{ arg }}, na.rm = TRUE))\n", #> "}\n", "\n", "my_function(mtcars, cyl)\n", #> "my_function(mtcars, cyl * 10)\n", "\n", "# The operator is just a shortcut for `!!enquo()`:\n", #> "my_function <- function(data, arg) {\n", " summarise(data, avg = mean(!!enquo(arg), na.rm = TRUE))\n", #> "}\n", "\n", "my_function(mtcars, cyl)\n", #> "\n", "}\n", "\n", "# Quasiquotation functions quote expressions like base::quote()\n", #> "quote(how_many(this))\n", "expr(how_many(this))\n", #> "quo(how_many(this))\n", "\n", "# In addition, they support unquoting. Let's store symbols\n", #> "# (i.e. object names) in variables:\n", "this <- sym(\"apples\")\n", #> "that <- sym(\"oranges\")\n", "\n", "# With unquotation you can insert the contents of these variables\n", #> "# inside the quoted expression:\n", "expr(how_many(!!this))\n", #> "expr(how_many(!!that))\n", "\n", "# You can also insert values:\n", #> "expr(how_many(!!(1 + 2)))\n", "quo(how_many(!!(1 + 2)))\n", #> "\n", "\n", "# Note that when you unquote complex objects into an expression,\n", #> "# the base R printer may be a bit misleading. For instance compare\n", #> "# the output of `expr()` and `quo()` (which uses a custom printer)\n", #> "# when we unquote an integer vector:\n", "expr(how_many(!!(1:10)))\n", #> "quo(how_many(!!(1:10)))\n", "\n", "# This is why it's often useful to use qq_show() to examine the\n", #> "# result of unquotation operators. It uses the same printer as\n", #> "# quosures but does not return anything:\n", #> "qq_show(how_many(!!(1:10)))\n", "\n", "\n", #> "# Use `!!!` to add multiple arguments to a function. Its argument\n", #> "# should evaluate to a list or vector:\n", #> "args <- list(1:3, na.rm = TRUE)\n", "quo(mean(!!!args))\n", #> "\n", "# You can combine the two\n", "var <- quote(xyz)\n", #> "extra_args <- list(trim = 0.9, na.rm = TRUE)\n", #> "quo(mean(!!var , !!!extra_args))\n", "\n", #> "\n", "# The plural versions have support for the `:=` operator.\n", #> "# Like `=`, `:=` creates named arguments:\n", #> "quos(mouse1 := bernard, mouse2 = bianca)\n", #> "\n", "# The `:=` is mainly useful to unquote names. Unlike `=` it\n", #> "# supports `!!` on its LHS:\n", "var <- \"unquote me!\"\n", #> "quos(!!var := bernard, mouse2 = bianca)\n", #> "\n", "\n", "# All these features apply to dots captured by enquos():\n", #> "fn <- function(...) enquos(...)\n", "fn(!!!args, !!var := penny)\n", #> "\n", "\n", "# Unquoting is especially useful for building an expression by\n", #> "# expanding around a variable part (the unquoted part):\n", #> "quo1 <- quo(toupper(foo))\n", "quo1\n", "\n", #> "quo2 <- quo(paste(!!quo1, bar))\n", "quo2\n", #> "\n", "quo3 <- quo(list(!!quo2, !!!syms(letters[1:5])))\n", #> "quo3\n"), "\n"), `op-definition.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/operators.R", #> "\n", list("op-definition"), "\n", list("op-definition"), #> "\n", list("is_definition"), "\n", list("new_definition"), #> "\n", list("is_formulaish"), "\n", list("Definition operator"), #> "\n", list("\n", "is_definition(x)\n", "\n", #> "new_definition(lhs, rhs, env = caller_env())\n", #> "\n", "is_formulaish(x, scoped = NULL, lhs = NULL)\n"), #> "\n", list("\n", list(list("x"), list("An object to test.")), #> "\n", "\n", list(list("lhs, rhs"), list("Expressions for the LHS and RHS of the definition.")), #> "\n", "\n", list(list("env"), list("The evaluation environment bundled with the definition.")), #> "\n"), "\n", list("\n", "The definition operator is typically used in DSL packages like\n", #> list("ggvis"), " and ", list("data.table"), #> ". It is also used in the tidyverse as a way\n", #> "of unquoting names (see ", list("nse-force"), #> ").\n", list("\n", list(), " ", list("is_definition()"), #> " returns ", list("TRUE"), " for calls to ", #> list(":="), ".\n", list(), " ", list("is_formulaish()"), #> " returns ", list("TRUE"), " for both formulas and\n", #> "colon-equals operators.\n"), "\n"), "\n", #> list("\n", "The recommended way to use it is to capture arguments as\n", #> "expressions or quosures. You can then give a special function\n", #> "definition for the ", list(":="), " symbol in an overscope. Note that if you\n", #> "capture dots with ", list(list("exprs()")), #> " or ", list(list("quos()")), ", you need to disable\n", #> "interpretation of ", list(":="), " by setting ", #> list(".unquote_names"), " to ", list("FALSE"), #> ".\n", "\n", "From rlang and data.table perspectives, this operator is not meant\n", #> "to be evaluated directly at top-level which is why the exported\n", #> "definitions issue an error.\n"), "\n", list( #> list("Life cycle"), list("\n", "\n", "\n", #> "These functions are experimental.\n")), #> "\n", "\n", list("\n", "\n", "# A predicate is provided to distinguish formulas from the\n", #> "# colon-equals operator:\n", "is_definition(quote(a := b))\n", #> "is_definition(a ~ b)\n", "\n", "\n", "# is_formulaish() tests for both definitions and formulas:\n", #> "is_formulaish(a ~ b)\n", "is_formulaish(quote(a := b))\n"), #> "\n", list("internal"), "\n"), `op-get-attr.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/operators.R", #> "\n", list("op-get-attr"), "\n", list("op-get-attr"), #> "\n", list("%@%"), "\n", list("%@%<-"), "\n", #> list("Infix attribute accessor and setter"), #> "\n", list("\n", "x %@% name\n", "\n", "x %@% name <- value\n"), #> "\n", list("\n", list(list("x"), list("Object")), #> "\n", "\n", list(list("name"), list("Attribute name")), #> "\n", "\n", list(list("value"), list("New value for attribute ", #> list("name"), ".")), "\n"), "\n", list("\n", #> "This operator extracts or sets attributes for regular objects and\n", #> "S4 fields for S4 objects.\n"), "\n", list( #> "\n", "# Unlike `@`, this operator extracts attributes for any kind of\n", #> "# objects:\n", "factor(1:3) %@% \"levels\"\n", #> "mtcars %@% class\n", "\n", "mtcars %@% class <- NULL\n", #> "mtcars\n", "\n", "# It also works on S4 objects:\n", #> ".Person <- setClass(\"Person\", slots = c(name = \"character\", species = \"character\"))\n", #> "fievel <- .Person(name = \"Fievel\", species = \"mouse\")\n", #> "fievel %@% name\n"), "\n"), `op-na-default.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/operators.R", #> "\n", list("op-na-default"), "\n", list("op-na-default"), #> "\n", list("%|%"), "\n", list("Replace missing values"), #> "\n", list("\n", "x %|% y\n"), "\n", list("\n", #> list(list("x"), list("The original values.")), #> "\n", "\n", list(list("y"), list("The replacement values. Must be of length 1 or the same length as ", #> list("x"), ".")), "\n"), "\n", list("\n", #> "This infix function is similar to ", list( #> "%||%"), " but is vectorised\n", "and provides a default value for missing elements. It is faster\n", #> "than using ", list(list("base::ifelse()")), #> " and does not perform type conversions.\n"), #> "\n", list("\n", "c(\"a\", \"b\", NA, \"c\") %|% \"default\"\n", #> "c(1L, NA, 3L, NA, NA) %|% (6L:10L)\n"), "\n", #> list("\n", list("op-null-default"), "\n"), "\n"), #> `op-null-default.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/operators.R", #> "\n", list("op-null-default"), "\n", list("op-null-default"), #> "\n", list("%||%"), "\n", list("Default value for ", #> list("NULL")), "\n", list("\n", "x %||% y\n"), #> "\n", list("\n", list(list("x, y"), list("If ", #> list("x"), " is NULL, will return ", list("y"), #> "; otherwise returns ", list("x"), ".")), "\n"), #> "\n", list("\n", "This infix function makes it easy to replace ", #> list("NULL"), "s with a default\n", "value. It's inspired by the way that Ruby's or operation (", #> list("||"), ")\n", "works.\n"), "\n", list( #> "\n", "1 %||% 2\n", "NULL %||% 2\n"), "\n"), #> overscope_eval_next.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("overscope_eval_next"), "\n", list( #> "overscope_eval_next"), "\n", list("Evaluate next quosure in a data mask"), #> "\n", list("\n", "overscope_eval_next(overscope, quo, env = base_env())\n"), #> "\n", list("\n", list(list("overscope"), list( #> "A valid overscope containing bindings for ", #> list("~"), ",\n", list(".top_env"), " and ", #> list("_F"), " and whose parents contain overscoped bindings\n", #> "for tidy evaluation.")), "\n", "\n", list( #> list("quo"), list("A quosure.")), "\n", "\n", #> list(list("env"), list("The lexical enclosure in case ", #> list("quo"), " is not a validly\n", "scoped quosure. This is the ", #> list("base environment"), " by\n", "default.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", list("overscope_eval_next()"), #> " is deprecated as of rlang 0.2.0. Please use\n", #> list("eval_tidy()"), " to which you can now supply an overscope.\n"), #> "\n", list("internal"), "\n"), pairlist2.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("pairlist2"), "\n", list("pairlist2"), #> "\n", list("Create pairlists with splicing support"), #> "\n", list("\n", "pairlist2(...)\n"), "\n", list( #> "\n", list(list("..."), list("<", list("dynamic"), #> "> Arguments stored in the\n", "pairlist. Empty arguments are preserved.")), #> "\n"), "\n", list("\n", "This pairlist constructor uses ", #> list("dynamic dots"), ". Use\n", "it to manually create argument lists for calls or parameter lists\n", #> "for functions.\n"), "\n", list("\n", "# Unlike `exprs()`, `pairlist2()` evaluates its arguments.\n", #> "new_function(pairlist2(x = 1, y = 3 * 6), quote(x * y))\n", #> "new_function(exprs(x = 1, y = 3 * 6), quote(x * y))\n", #> "\n", "# It preserves missing arguments, which is useful for creating\n", #> "# parameters without defaults:\n", "new_function(pairlist2(x = , y = 3 * 6), quote(x * y))\n"), #> "\n"), parse_expr.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/parse.R", #> "\n", list("parse_expr"), "\n", list("parse_expr"), #> "\n", list("parse_exprs"), "\n", list("parse_quo"), #> "\n", list("parse_quos"), "\n", list("Parse R code"), #> "\n", list("\n", "parse_expr(x)\n", "\n", "parse_exprs(x)\n", #> "\n", "parse_quo(x, env = global_env())\n", #> "\n", "parse_quos(x, env = global_env())\n"), #> "\n", list("\n", list(list("x"), list("Text containing expressions to parse_expr for\n", #> list("parse_expr()"), " and ", list("parse_exprs()"), #> ". Can also be an R connection,\n", "for instance to a file. If the supplied connection is not open,\n", #> "it will be automatically closed and destroyed.")), #> "\n", "\n", list(list("env"), list("The environment for the quosures. The ", #> list("global environment"), " (the default) may be the right choice\n", #> "when you are parsing external user inputs. You might also want to\n", #> "evaluate the R code in an isolated context (perhaps a child of\n", #> "the global environment or of the ", list( #> "base environment"), ").")), "\n"), "\n", #> list("\n", list("parse_expr()"), " returns an ", #> list("expression"), ",\n", list("parse_exprs()"), #> " returns a list of expressions. Note that for the\n", #> "plural variants the length of the output may be greater than the\n", #> "length of the input. This would happen is one of the strings\n", #> "contain several expressions (such as ", list( #> "\"foo; bar\""), "). The names of\n", list( #> "x"), " are preserved (and recycled in case of multiple expressions).\n", #> "The ", list("_quo"), " suffixed variants return quosures.\n"), #> "\n", list("\n", "These functions parse and transform text into R expressions. This\n", #> "is the first step to interpret or evaluate a piece of R code\n", #> "written by a programmer.\n", list("\n", list(), #> " ", list("parse_expr()"), " returns one expression. If the text contains more\n", #> "than one expression (separated by semicolons or new lines), an\n", #> "error is issued. On the other hand ", list( #> "parse_exprs()"), " can handle\n", "multiple expressions. It always returns a list of expressions\n", #> "(compare to ", list(list("base::parse()")), #> " which returns a base::expression\n", "vector). All functions also support R connections.\n", #> list(), " ", list("parse_quo()"), " and ", #> list("parse_quos()"), " are variants that create a\n", #> list("quosure"), " that inherits from the global environment by\n", #> "default. This is appropriate when you're parsing external user\n", #> "input to be evaluated in user context (rather than the private\n", #> "contexts of your functions).\n", "\n", "Unlike quosures created with ", #> list(list("enquo()")), ", ", list(list("enquos()")), #> ", or ", list("{{"), ", a\n", "parsed quosure never contains injected quosures. It is thus safe\n", #> "to evaluate them with ", list("eval()"), #> " instead of ", list(list("eval_tidy()")), #> ", though\n", "the latter is more convenient as you don't need to extract ", #> list("expr"), "\n", "and ", list("env"), #> ".\n"), "\n"), "\n", list("\n", "# parse_expr() can parse any R expression:\n", #> "parse_expr(\"mtcars %>% dplyr::mutate(cyl_prime = cyl / sd(cyl))\")\n", #> "\n", "# A string can contain several expressions separated by ; or \\n\n", #> "parse_exprs(\"NULL; list()\\n foo(bar)\")\n", #> "\n", "# Use names to figure out which input produced an expression:\n", #> "parse_exprs(c(foo = \"1; 2\", bar = \"3\"))\n", #> "\n", "# You can also parse source files by passing a R connection. Let's\n", #> "# create a file containing R code:\n", "path <- tempfile(\"my-file.R\")\n", #> "cat(\"1; 2; mtcars\", file = path)\n", "\n", #> "# We can now parse it by supplying a connection:\n", #> "parse_exprs(file(path))\n"), "\n", list("\n", #> list(list("base::parse()")), "\n"), "\n"), #> parse_quosure.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("parse_quosure"), "\n", list("parse_quosure"), #> "\n", list("parse_quosures"), "\n", list("Parse text into a quosure"), #> "\n", list("\n", "parse_quosure(x, env = caller_env())\n", #> "\n", "parse_quosures(x, env = caller_env())\n"), #> "\n", list("\n", list(list("x"), list("Text containing expressions to parse_expr for\n", #> list("parse_expr()"), " and ", list("parse_exprs()"), #> ". Can also be an R connection,\n", "for instance to a file. If the supplied connection is not open,\n", #> "it will be automatically closed and destroyed.")), #> "\n", "\n", list(list("env"), list("The environment for the quosures. The ", #> list("global environment"), " (the default) may be the right choice\n", #> "when you are parsing external user inputs. You might also want to\n", #> "evaluate the R code in an isolated context (perhaps a child of\n", #> "the global environment or of the ", list( #> "base environment"), ").")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions were deprecated and renamed to ", #> list(list("parse_quo()")), "\n", "and ", list( #> list("parse_quos()")), " in rlang 0.2.0. This is for consistency with the\n", #> "convention that suffixes indicating return types are not\n", #> "abbreviated.\n"), "\n", list("internal"), #> "\n"), prepend.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("prepend"), "\n", list("prepend"), #> "\n", list("modify"), "\n", list("Prepend a vector"), #> "\n", list("\n", "prepend(x, values, before = 1)\n", #> "\n", "modify(.x, ...)\n"), "\n", list("\n", #> list(list("x"), list("the vector to be modified.")), #> "\n", "\n", list(list("values"), list("to be included in the modified vector.")), #> "\n", "\n", list(list("before"), list("a subscript, before which the values are to be appended.")), #> "\n", "\n", list(list(".x"), list("A vector to modify.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> List of elements to merge into\n", #> list(".x"), ". Named elements already existing in ", #> list(".x"), " are used as\n", "replacements. Elements that have new or no names are inserted at\n", #> "the end.")), "\n"), "\n", list("\n", list( #> "rlang:::lifecycle(\"deprecated\")"), "\n", #> "\n", "Vector functions are now out of scope for rlang. They might be\n", #> "revived in the vctrs or funs packages.\n"), #> "\n", list("internal"), "\n"), prim_name.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("prim_name"), "\n", list("prim_name"), #> "\n", list("Name of a primitive function"), "\n", #> list("\n", "prim_name(prim)\n"), "\n", list("\n", #> list(list("prim"), list("A primitive function such as ", #> list(list("base::c()")), ".")), "\n"), "\n", #> list("\n", "Name of a primitive function\n"), #> "\n", list("internal"), "\n"), quo_expr.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("quo_expr"), "\n", list("quo_expr"), #> "\n", list("Squash a quosure"), "\n", list("\n", #> "quo_expr(quo, warn = FALSE)\n"), "\n", list( #> "\n", list(list("quo"), list("A quosure or expression.")), #> "\n", "\n", list(list("warn"), list("Whether to warn if the quosure contains other quosures\n", #> "(those will be collapsed). This is useful when you use\n", #> list("quo_squash()"), " in order to make a non-tidyeval API compatible\n", #> "with quosures. In that case, getting rid of the nested quosures\n", #> "is likely to cause subtle bugs and it is good practice to warn\n", #> "the user about it.")), "\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "This function is deprecated, please use ", #> list(list("quo_squash()")), " instead.\n"), #> "\n", list("internal"), "\n"), quo_label.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/quo.R", #> "\n", list("quo_label"), "\n", list("quo_label"), #> "\n", list("quo_text"), "\n", list("quo_name"), #> "\n", list("Format quosures for printing or labelling"), #> "\n", list("\n", "quo_label(quo)\n", "\n", "quo_text(quo, width = 60L, nlines = Inf)\n", #> "\n", "quo_name(quo)\n"), "\n", list("\n", #> list(list("quo"), list("A quosure or expression.")), #> "\n", "\n", list(list("width"), list("Width of each line.")), #> "\n", "\n", list(list("nlines"), list("Maximum number of lines to extract.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", list("Note:"), " You should now use ", #> list(list("as_label()")), " or ", list(list( #> "as_name()")), " instead\n", "of ", list( #> "quo_name()"), ". See life cycle section below.\n", #> "\n", "These functions take an arbitrary R object, typically an\n", #> list("expression"), ", and represent it as a string.\n", #> list("\n", list(), " ", list("quo_name()"), #> " returns an abbreviated representation of the object\n", #> "as a single line string. It is suitable for default names.\n", #> list(), " ", list("quo_text()"), " returns a multiline string. For instance block\n", #> "expressions like ", list("{ foo; bar }"), #> " are represented on 4 lines (one\n", "for each symbol, and the curly braces on their own lines).\n"), #> "\n", "\n", "These deparsers are only suitable for creating default names or\n", #> "printing output at the console. The behaviour of your functions\n", #> "should not depend on deparsed objects. If you are looking for a way\n", #> "of transforming symbols to strings, use ", #> list(list("as_string()")), " instead of\n", #> list("quo_name()"), ". Unlike deparsing, the transformation between symbols\n", #> "and strings is non-lossy and well defined.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "These functions are in the questioning life cycle stage.\n", #> list("\n", list(), " ", list(list("as_label()")), #> " and ", list(list("as_name()")), " should be used instead of\n", #> list("quo_name()"), ". ", list("as_label()"), #> " transforms any R object to a string\n", #> "but should only be used to create a default name. Labelisation is\n", #> "not a well defined operation and no assumption should be made\n", #> "about the label. On the other hand, ", list( #> "as_name()"), " only works with\n", "(possibly quosured) symbols, but is a well defined and\n", #> "deterministic operation.\n", list(), " We don't have a good replacement for ", #> list("quo_text()"), " yet. See\n", list("https://github.com/r-lib/rlang/issues/636"), #> " to follow discussions\n", "about a new deparsing API.\n"), #> "\n")), "\n", "\n", list("\n", "# Quosures can contain nested quosures:\n", #> "quo <- quo(foo(!! quo(bar)))\n", "quo\n", #> "\n", "# quo_squash() unwraps all quosures and returns a raw expression:\n", #> "quo_squash(quo)\n", "\n", "# This is used by quo_text() and quo_label():\n", #> "quo_text(quo)\n", "\n", "# Compare to the unwrapped expression:\n", #> "expr_text(quo)\n", "\n", "# quo_name() is helpful when you need really short labels:\n", #> "quo_name(quo(sym))\n", "quo_name(quo(!! sym))\n"), #> "\n", list("\n", list(list("expr_label()")), #> ", ", list(list("f_label()")), "\n"), "\n"), #> quo_squash.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/quo.R", #> "\n", list("quo_squash"), "\n", list("quo_squash"), #> "\n", list("Squash a quosure"), "\n", list("\n", #> "quo_squash(quo, warn = FALSE)\n"), "\n", list( #> "\n", list(list("quo"), list("A quosure or expression.")), #> "\n", "\n", list(list("warn"), list("Whether to warn if the quosure contains other quosures\n", #> "(those will be collapsed). This is useful when you use\n", #> list("quo_squash()"), " in order to make a non-tidyeval API compatible\n", #> "with quosures. In that case, getting rid of the nested quosures\n", #> "is likely to cause subtle bugs and it is good practice to warn\n", #> "the user about it.")), "\n"), "\n", list( #> "\n", list("quo_squash()"), " flattens all nested quosures within an expression.\n", #> "For example it transforms ", list("^foo(^bar(), ^baz)"), #> " to the bare\n", "expression ", list("foo(bar(), baz)"), #> ".\n", "\n", "This operation is safe if the squashed quosure is used for\n", #> "labelling or printing (see ", list(list("quo_label()")), #> " or ", list(list("quo_name()")), "). However\n", #> "if the squashed quosure is evaluated, all expressions of the\n", #> "flattened quosures are resolved in a single environment. This is a\n", #> "source of bugs so it is good practice to set ", #> list("warn"), " to ", list("TRUE"), " to\n", #> "let the user know about the lossy squashing.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "This function replaces ", list("quo_expr()"), #> " which was deprecated in\n", "rlang 0.2.0. ", #> list("quo_expr()"), " was a misnomer because it implied that it\n", #> "was a mere expression acccessor for quosures whereas it was really\n", #> "a lossy operation that squashed all nested quosures.\n")), #> "\n", "\n", list("\n", "# Quosures can contain nested quosures:\n", #> "quo <- quo(wrapper(!!quo(wrappee)))\n", "quo\n", #> "\n", "# quo_squash() flattens all the quosures and returns a simple expression:\n", #> "quo_squash(quo)\n"), "\n"), quosure.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/quo.R", #> "\n", list("quosure"), "\n", list("quosure"), #> "\n", list("is_quosure"), "\n", list("quo_is_missing"), #> "\n", list("quo_is_symbol"), "\n", list("quo_is_call"), #> "\n", list("quo_is_symbolic"), "\n", list("quo_is_null"), #> "\n", list("quo_get_expr"), "\n", list("quo_get_env"), #> "\n", list("quo_set_expr"), "\n", list("quo_set_env"), #> "\n", list("Quosure getters, setters and testers"), #> "\n", list("\n", "is_quosure(x)\n", "\n", "quo_is_missing(quo)\n", #> "\n", "quo_is_symbol(quo, name = NULL)\n", #> "\n", "quo_is_call(quo, name = NULL, n = NULL, ns = NULL)\n", #> "\n", "quo_is_symbolic(quo)\n", "\n", "quo_is_null(quo)\n", #> "\n", "quo_get_expr(quo)\n", "\n", "quo_get_env(quo)\n", #> "\n", "quo_set_expr(quo, expr)\n", "\n", "quo_set_env(quo, env)\n"), #> "\n", list("\n", list(list("x"), list("An object to test.")), #> "\n", "\n", list(list("quo"), list("A quosure to test.")), #> "\n", "\n", list(list("name"), list("The name of the symbol or function call. If ", #> list("NULL"), " the\n", "name is not tested.")), #> "\n", "\n", list(list("n"), list("An optional number of arguments that the call should\n", #> "match.")), "\n", "\n", list(list("ns"), #> list("The namespace of the call. If ", list( #> "NULL"), ", the namespace\n", "doesn't participate in the pattern-matching. If an empty string\n", #> list("\"\""), " and ", list("x"), " is a namespaced call, ", #> list("is_call()"), " returns\n", list("FALSE"), #> ". If any other string, ", list("is_call()"), #> " checks that ", list("x"), " is\n", "namespaced within ", #> list("ns"), ".\n", "\n", "Can be a character vector of namespaces, in which case the call\n", #> "has to match at least one of them, otherwise ", #> list("is_call()"), " returns\n", list("FALSE"), #> ".")), "\n", "\n", list(list("expr"), list( #> "A new expression for the quosure.")), "\n", #> "\n", list(list("env"), list("A new environment for the quosure.")), #> "\n"), "\n", list("\n", "A quosure is a type of ", #> list("quoted expression"), " that includes\n", #> "a reference to the context where it was created. A quosure is thus\n", #> "guaranteed to evaluate in its original environment and can refer to\n", #> "local objects.\n", "\n", "You can access the quosure components (its expression and its\n", #> "environment) with:\n", list("\n", list(), #> " ", list(list("get_expr()")), " and ", list( #> list("get_env()")), ". These getters also support other\n", #> "kinds of objects such as formulas.\n", list(), #> " ", list("quo_get_expr()"), " and ", list( #> "quo_get_env()"), ". These getters only work\n", #> "with quosures and throw an error with other types of input.\n"), #> "\n", "\n", "Test if an object is a quosure with ", #> list("is_quosure()"), ". If you know an\n", #> "object is a quosure, use the ", list("quo_"), #> " prefixed predicates to check\n", "its contents, ", #> list("quo_is_missing()"), ", ", list("quo_is_symbol()"), #> ", etc.\n"), "\n", list(list("Quosured constants"), #> list("\n", "\n", "\n", "A quosure usually does not carry environments for ", #> list("constant objects"), " like strings or numbers. ", #> list(list("quo()")), " and\n", list(list( #> "enquo()")), " only capture an environment for ", #> list("symbolic expressions"), ". For instance, all of these return the\n", #> list("empty environment"), ":", list("quo_get_env(quo(\"constant\"))\n", #> "quo_get_env(quo(100))\n", "quo_get_env(quo(NA))\n"), #> "\n", "\n", "On the other hand, quosures capture the environment of symbolic\n", #> "expressions, i.e. expressions whose meaning depends on the\n", #> "environment in which they are evaluated and what objects are\n", #> "defined there:", list("quo_get_env(quo(some_object))\n", #> "quo_get_env(quo(some_function()))\n"), #> "\n")), "\n", "\n", list(list("Empty quosures"), #> list("\n", "\n", "\n", "When missing arguments are captured as quosures, either through\n", #> list(list("enquo()")), " or ", list(list( #> "quos()")), ", they are returned as an empty quosure. These\n", #> "quosures contain the ", list("missing argument"), #> " and typically\n", "have the ", list("empty environment"), #> " as enclosure.\n")), "\n", "\n", list(list( #> "Life cycle"), list("\n", "\n", list("\n", #> list(), " ", list("is_quosure()"), " is stable.\n", #> list(), " ", list("quo_get_expr()"), " and ", #> list("quo_get_env()"), " are stable.\n"), "\n")), #> "\n", "\n", list("\n", "quo <- quo(my_quosure)\n", #> "quo\n", "\n", "\n", "# Access and set the components of a quosure:\n", #> "quo_get_expr(quo)\n", "quo_get_env(quo)\n", #> "\n", "quo <- quo_set_expr(quo, quote(baz))\n", #> "quo <- quo_set_env(quo, empty_env())\n", "quo\n", #> "\n", "# Test wether an object is a quosure:\n", #> "is_quosure(quo)\n", "\n", "# If it is a quosure, you can use the specialised type predicates\n", #> "# to check what is inside it:\n", "quo_is_symbol(quo)\n", #> "quo_is_call(quo)\n", "quo_is_null(quo)\n", #> "\n", "# quo_is_missing() checks for a special kind of quosure, the one\n", #> "# that contains the missing argument:\n", #> "quo()\n", "quo_is_missing(quo())\n", "\n", #> "fn <- function(arg) enquo(arg)\n", "fn()\n", #> "quo_is_missing(fn())\n"), "\n", list("\n", #> list(list("quo()")), " for creating quosures by quotation; ", #> list(list("as_quosure()")), "\n", "and ", list( #> list("new_quosure()")), " for constructing quosures manually.\n"), #> "\n"), raw_deparse_str.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/raw.R", #> "\n", list("raw_deparse_str"), "\n", list("raw_deparse_str"), #> "\n", list("Serialize a raw vector to a string"), #> "\n", list("\n", "raw_deparse_str(x, prefix = NULL, suffix = NULL)\n"), #> "\n", list("\n", list(list("x"), list("A raw vector.")), #> "\n", "\n", list(list("prefix, suffix"), list( #> "Prefix and suffix strings, or `NULL.")), #> "\n"), "\n", list("\n", "A string.\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "This function converts a raw vector to a hexadecimal string,\n", #> "optionally adding a prefix and a suffix.\n", #> "It is roughly equivalent to\n", list("paste0(prefix, paste(format(x), collapse = \"\"), suffix)"), #> "\n", "and much faster.\n"), "\n", list("\n", #> "raw_deparse_str(raw())\n", "raw_deparse_str(charToRaw(\"string\"))\n", #> "raw_deparse_str(raw(10), prefix = \"'0x\", suffix = \"'\")\n"), #> "\n"), rep_along.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-new.R", #> "\n", list("rep_along"), "\n", list("rep_along"), #> "\n", list("rep_named"), "\n", list("Create vectors matching the length of a given vector"), #> "\n", list("\n", "rep_along(along, x)\n", "\n", #> "rep_named(names, x)\n"), "\n", list("\n", #> list(list("along"), list("Vector whose length determine how many times ", #> list("x"), "\n", "is repeated.")), "\n", #> "\n", list(list("x"), list("Values to repeat.")), #> "\n", "\n", list(list("names"), list("Names for the new vector. The length of ", #> list("names"), "\n", "determines how many times ", #> list("x"), " is repeated.")), "\n"), "\n", #> list("\n", "These functions take the idea of ", #> list(list("seq_along()")), " and apply it to\n", #> "repeating values.\n"), "\n", list("\n", "x <- 0:5\n", #> "rep_along(x, 1:2)\n", "rep_along(x, 1)\n", #> "\n", "# Create fresh vectors by repeating missing values:\n", #> "rep_along(x, na_int)\n", "rep_along(x, na_chr)\n", #> "\n", "# rep_named() repeats a value along a names vectors\n", #> "rep_named(c(\"foo\", \"bar\"), list(letters))\n"), #> "\n", list("\n", "new-vector\n"), "\n"), restarting.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-handlers.R", #> "\n", list("restarting"), "\n", list("restarting"), #> "\n", list("Create a restarting handler"), "\n", #> list("\n", "restarting(.restart, ..., .fields = NULL)\n"), #> "\n", list("\n", list(list(".restart"), list( #> "The name of a restart.")), "\n", "\n", list( #> list("..."), list("<", list("dynamic"), "> Additional arguments passed on\n", #> "the restart function. These arguments are evaluated only once\n", #> "and immediately, when creating the restarting handler.")), #> "\n", "\n", list(list(".fields"), list("A character vector specifying the fields of the\n", #> "condition that should be passed as arguments to the restart. If\n", #> "named, the names (except empty names ", #> list("\"\""), ") are used as\n", "argument names for calling the restart function. Otherwise the\n", #> "the fields themselves are used as argument names.")), #> "\n"), "\n", list("\n", "This constructor automates the common task of creating an\n", #> list(list("calling()")), " handler that invokes a restart.\n"), #> "\n", list("\n", "Jumping to a restart point from a calling handler has two\n", #> "effects. First, the control flow jumps to wherever the restart was\n", #> "established, and the restart function is called (with ", #> list("..."), ", or\n", list(".fields"), " as arguments). Execution resumes from the\n", #> list(list("with_restarts()")), " call. Secondly, the transfer of the control flow\n", #> "out of the function that signalled the condition means that the\n", #> "handler has dealt with the condition. Thus the condition will not\n", #> "be passed on to other potential handlers established on the stack.\n"), #> "\n", list("\n", "# This is a restart that takes a data frame and names as arguments\n", #> "rst_bar <- function(df, nms) {\n", " stats::setNames(df, nms)\n", #> "}\n", "\n", "# This restart is simpler and does not take arguments\n", #> "rst_baz <- function() \"baz\"\n", "\n", "# Signalling a condition parameterised with a data frame\n", #> "fn <- function() {\n", " with_restarts(signal(\"A foobar condition occurred\", \"foo\", foo_field = mtcars),\n", #> " rst_bar = rst_bar,\n", " rst_baz = rst_baz\n", #> " )\n", "}\n", "\n", "# Creating a restarting handler that passes arguments `nms` and\n", #> "# `df`, the latter taken from a data field of the condition object\n", #> "restart_bar <- restarting(\"rst_bar\",\n", #> " nms = LETTERS[1:11], .fields = c(df = \"foo_field\")\n", #> ")\n", "\n", "# The restarting handlers jumps to `rst_bar` when `foo` is signalled:\n", #> "with_handlers(fn(), foo = restart_bar)\n", #> "\n", "# The restarting() constructor is especially nice to use with\n", #> "# restarts that do not need arguments:\n", #> "with_handlers(fn(), foo = restarting(\"rst_baz\"))\n"), #> "\n", list("\n", list(list("calling()")), " and ", #> list(list("exiting()")), ".\n"), "\n", list( #> "internal"), "\n"), return_from.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/stack.R", #> "\n", list("return_from"), "\n", list("return_from"), #> "\n", list("return_to"), "\n", list("Jump to or from a frame"), #> "\n", list("\n", "return_from(frame, value = NULL)\n", #> "\n", "return_to(frame, value = NULL)\n"), #> "\n", list("\n", list(list("frame"), list("An environment, a frame object, or any object with an\n", #> list(list("get_env()")), " method. The environment should be an evaluation\n", #> "environment currently on the stack.")), "\n", #> "\n", list(list("value"), list("The return value.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "While ", list(list("base::return()")), #> " can only return from the current local\n", #> "frame, these two functions will return from any frame on the\n", #> "current evaluation stack, between the global and the currently\n", #> "active context. They provide a way of performing arbitrary\n", #> "non-local jumps out of the function currently under evaluation.\n"), #> "\n", list("\n", list("return_from()"), " will jump out of ", #> list("frame"), ". ", list("return_to()"), " is a bit\n", #> "trickier. It will jump out of the frame located just before ", #> list("frame"), "\n", "in the evaluation stack, so that control flow ends up in ", #> list("frame"), ",\n", "at the location where the previous frame was called from.\n", #> "\n", "These functions should only be used rarely. These sort of non-local\n", #> "gotos can be hard to reason about in casual code, though they can\n", #> "sometimes be useful. Also, consider to use the condition system to\n", #> "perform non-local jumps.\n"), "\n", list(list( #> "Life cycle"), list("\n", "\n", "\n", "The support for ", #> list("frame"), " object is soft-deprecated. Please pass\n", #> "simple environments to ", list("return_from()"), #> " and ", list("return_to()"), ".\n", "\n", #> "These functions are in the questioning lifecycle because we are\n", #> "considering simpler alternatives.\n")), "\n", #> "\n", list("\n", "# Passing fn() evaluation frame to g():\n", #> "fn <- function() {\n", " val <- g(current_env())\n", #> " cat(\"g returned:\", val, \"\\n\")\n", " \"normal return\"\n", #> "}\n", "g <- function(env) h(env)\n", "\n", #> "# Here we return from fn() with a new return value:\n", #> "h <- function(env) return_from(env, \"early return\")\n", #> "fn()\n", "\n", "# Here we return to fn(). The call stack unwinds until the last frame\n", #> "# called by fn(), which is g() in that case.\n", #> "h <- function(env) return_to(env, \"early return\")\n", #> "fn()\n"), "\n", list("internal"), "\n"), rlang_backtrace_on_error.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-abort.R", #> "\n", list("rlang_backtrace_on_error"), "\n", #> list("rlang_backtrace_on_error"), "\n", list( #> "add_backtrace"), "\n", list("Display backtrace on error"), #> "\n", list("\n", "Errors thrown with ", list( #> list("abort()")), " automatically save a backtrace that\n", #> "can be inspected by calling ", list(list("last_error()")), #> ". Optionally, you can\n", "also display the backtrace alongside the error message by setting\n", #> "the option ", list("rlang_backtrace_on_error"), #> " to one of the following\n", "values:\n", #> list("\n", list(), " ", list("\"reminder\""), #> ": Display a reminder that the backtrace can be\n", #> "inspected by calling ", list(list("last_error()")), #> ".\n", list(), " ", list("\"branch\""), ": Display a simplified backtrace.\n", #> list(), " ", list("\"collapse\""), ": Display a collapsed backtrace tree.\n", #> list(), " ", list("\"full\""), ": Display the full backtrace tree.\n"), #> "\n"), "\n", list(list("Promote base errors to rlang errors"), #> list("\n", "\n", "\n", "Call ", list("options(error = rlang::entrace)"), #> " to instrument base\n", "errors with rlang features. This handler does two things:\n", #> list("\n", list(), " It saves the base error as an rlang object. This allows you to\n", #> "call ", list(list("last_error()")), " to print the backtrace or inspect its data.\n", #> list(), " It prints the backtrace for the current error according to the\n", #> list("rlang_backtrace_on_error"), " option.\n"), #> "\n")), "\n", "\n", list("\n", "# Display a simplified backtrace on error for both base and rlang\n", #> "# errors:\n", "\n", "# options(\n", "# rlang_backtrace_on_error = \"branch\",\n", #> "# error = rlang::entrace\n", "# )\n", "# stop(\"foo\")\n"), #> "\n"), rst_abort.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-restarts.R", #> "\n", list("rst_abort"), "\n", list("rst_abort"), #> "\n", list("Jump to the abort restart"), "\n", #> list("\n", "rst_abort()\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "The abort restart is the only restart that is established at top\n", #> "level. It is used by R as a top-level target, most notably when an\n", #> "error is issued (see ", list(list("abort()")), #> ") that no handler is able\n", "to deal with (see ", #> list(list("with_handlers()")), ").\n"), "\n", #> list(list("Life cycle"), list("\n", "\n", "\n", #> "All the restart functions are in the questioning stage. It is not\n", #> "clear yet whether we want to recommend restarts as a style of\n", #> "programming in R.\n")), "\n", "\n", list("\n", #> "# The `abort` restart is a bit special in that it is always\n", #> "# registered in a R session. You will always find it on the restart\n", #> "# stack because it is established at top level:\n", #> "rst_list()\n", "\n", "# You can use the `above` restart to jump to top level without\n", #> "# signalling an error:\n", list("\n", "fn <- function() {\n", #> " cat(\"aborting...\\n\")\n", " rst_abort()\n", #> " cat(\"This is never called\\n\")\n", "}\n", #> "{\n", " fn()\n", " cat(\"This is never called\\n\")\n", #> "}\n"), "\n", "\n", "# The `above` restart is the target that R uses to jump to top\n", #> "# level when critical errors are signalled:\n", #> list("\n", "{\n", " abort(\"error\")\n", " cat(\"This is never called\\n\")\n", #> "}\n"), "\n", "\n", "# If another `abort` restart is specified, errors are signalled as\n", #> "# usual but then control flow resumes with from the new restart:\n", #> list("\n", "out <- NULL\n", "{\n", " out <- with_restarts(abort(\"error\"), abort = function() \"restart!\")\n", #> " cat(\"This is called\\n\")\n", "}\n", #> "cat(\"`out` has now become:\", out, \"\\n\")\n"), #> "\n"), "\n", list("\n", list(list("rst_jump()")), #> ", ", list(list("abort()")), "\n"), "\n", list( #> "internal"), "\n"), rst_list.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-restarts.R", #> "\n", list("rst_list"), "\n", list("rst_list"), #> "\n", list("rst_exists"), "\n", list("rst_jump"), #> "\n", list("rst_maybe_jump"), "\n", list("Restarts utilities"), #> "\n", list("\n", "rst_list()\n", "\n", "rst_exists(.restart)\n", #> "\n", "rst_jump(.restart, ...)\n", "\n", "rst_maybe_jump(.restart, ...)\n"), #> "\n", list("\n", list(list(".restart"), list( #> "The name of a restart.")), "\n", "\n", list( #> list("..."), list("<", list("dynamic"), "> Arguments passed on to the\n", #> "restart function.")), "\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "Restarts are named jumping points established by ", #> list(list("with_restarts()")), ".\n", list( #> "rst_list()"), " returns the names of all restarts currently\n", #> "established. ", list("rst_exists()"), " checks if a given restart is\n", #> "established. ", list("rst_jump()"), " stops execution of the current function\n", #> "and jumps to a restart point. If the restart does not exist, an\n", #> "error is thrown. ", list("rst_maybe_jump()"), #> " first checks that a restart\n", "exists before jumping.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "All the restart functions are in the questioning stage. It is not\n", #> "clear yet whether we want to recommend restarts as a style of\n", #> "programming in R.\n")), "\n", "\n", list("\n", #> list(list("with_restarts()")), "\n"), "\n", #> list("internal"), "\n"), `scalar-type-predicates.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("scalar-type-predicates"), "\n", list( #> "scalar-type-predicates"), "\n", list("is_scalar_list"), #> "\n", list("is_scalar_atomic"), "\n", list("is_scalar_vector"), #> "\n", list("is_scalar_integer"), "\n", list("is_scalar_double"), #> "\n", list("is_scalar_character"), "\n", list( #> "is_scalar_logical"), "\n", list("is_scalar_raw"), #> "\n", list("is_string"), "\n", list("is_scalar_bytes"), #> "\n", list("is_bool"), "\n", list("Scalar type predicates"), #> "\n", list("\n", "is_scalar_list(x)\n", "\n", #> "is_scalar_atomic(x)\n", "\n", "is_scalar_vector(x)\n", #> "\n", "is_scalar_integer(x)\n", "\n", "is_scalar_double(x)\n", #> "\n", "is_scalar_character(x)\n", "\n", "is_scalar_logical(x)\n", #> "\n", "is_scalar_raw(x)\n", "\n", "is_string(x, string = NULL)\n", #> "\n", "is_scalar_bytes(x)\n", "\n", "is_bool(x)\n"), #> "\n", list("\n", list(list("x"), list("object to be tested.")), #> "\n", "\n", list(list("string"), list("A string to compare to ", #> list("x"), ". If a character vector,\n", #> "returns ", list("TRUE"), " if at least one element is equal to ", #> list("x"), ".")), "\n"), "\n", list("\n", #> "These predicates check for a given type and whether the vector is\n", #> "\"scalar\", that is, of length 1.\n", "\n", #> "In addition to the length check, ", list("is_string()"), #> " and ", list("is_bool()"), "\n", "return ", #> list("FALSE"), " if their input is missing. This is useful for\n", #> "type-checking arguments, when your function expects a single string\n", #> "or a single ", list("TRUE"), " or ", list( #> "FALSE"), ".\n"), "\n", list("\n", list("type-predicates"), #> ", ", list("bare-type-predicates"), "\n"), #> "\n"), scoped_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("scoped_env"), "\n", list("scoped_env"), #> "\n", list("is_scoped"), "\n", list("scoped_envs"), #> "\n", list("scoped_names"), "\n", list("Retired ", #> list("scoped"), " functions"), "\n", list("\n", #> "scoped_env(nm)\n", "\n", "is_scoped(nm)\n", #> "\n", "scoped_envs()\n", "\n", "scoped_names()\n"), #> "\n", list("\n", list(list("nm"), list("The name of an environment attached to the search\n", #> "path. Call ", list(list("base::search()")), #> " to see what is currently on the path.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions are deprecated as of rlang 0.3.0. They are replaced\n", #> "by ", list(list("is_attached()")), ", ...\n"), #> "\n", list("internal"), "\n"), scoped_interactive.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("scoped_interactive"), "\n", list( #> "scoped_interactive"), "\n", list("scoped_options"), #> "\n", list("scoped_bindings"), "\n", list("Questioning ", #> list("scoped_"), " functions"), "\n", list( #> "\n", "scoped_interactive(value = TRUE, frame = caller_env())\n", #> "\n", "scoped_options(..., .frame = caller_env())\n", #> "\n", "scoped_bindings(..., .env = .frame, .frame = caller_env())\n"), #> "\n", list("\n", list(list("value"), list("A single ", #> list("TRUE"), " or ", list("FALSE"), ". This overrides the return\n", #> "value of ", list("is_interactive()"), ".")), #> "\n", "\n", list(list("frame"), list("The environment of a running function which defines\n", #> "the scope of the temporary options. When the function returns,\n", #> "the options are reset to their original values.")), #> "\n", "\n", list(list("..."), list("For ", #> list("local_options()"), " and ", list("push_options()"), #> ", named\n", "values defining new option values. For ", #> list("peek_options()"), ", strings\n", "or character vectors of option names.")), #> "\n", "\n", list(list(".frame"), list("The environment of a running function which defines\n", #> "the scope of the temporary options. When the function returns,\n", #> "the options are reset to their original values.")), #> "\n", "\n", list(list(".env"), list("An environment.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "These functions have been renamed to use the conventional ", #> list("local_"), "\n", "prefix. They will be deprecated in the next minor version of rlang.\n"), #> "\n"), search_envs.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("search_envs"), "\n", list("search_envs"), #> "\n", list("search_env"), "\n", list("pkg_env"), #> "\n", list("pkg_env_name"), "\n", list("is_attached"), #> "\n", list("base_env"), "\n", list("global_env"), #> "\n", list("Search path environments"), "\n", #> list("\n", "search_envs()\n", "\n", "search_env(name)\n", #> "\n", "pkg_env(pkg)\n", "\n", "pkg_env_name(pkg)\n", #> "\n", "is_attached(x)\n", "\n", "base_env()\n", #> "\n", "global_env()\n"), "\n", list("\n", list( #> list("name"), list("The name of an environment attached to the search\n", #> "path. Call ", list(list("base::search()")), #> " to get the names of environments\n", "currently attached to the search path. Note that the search name\n", #> "of a package environment is prefixed with ", #> list("\"package:\""), ".")), "\n", "\n", #> list(list("pkg"), list("The name of a package.")), #> "\n", "\n", list(list("x"), list("An environment or a search name.")), #> "\n"), "\n", list("\n", "The search path is a chain of environments containing exported\n", #> "functions of attached packages.\n", "\n", #> "The API includes:\n", list("\n", list(), " ", #> list(list("base::search()")), " to get the names of environments attached to the\n", #> "search path.\n", list(), " ", list("search_envs()"), #> " returns the environments on the search path as a\n", #> "list.\n", list(), " ", list("pkg_env_name()"), #> " takes a bare package name and prefixes it with\n", #> list("\"package:\""), ". Attached package environments have search names of\n", #> "the form ", list("package:name"), ".\n", #> list(), " ", list("pkg_env()"), " takes a bare package name and returns the scoped\n", #> "environment of packages if they are attached to the search path,\n", #> "and throws an error otherwise. It is a shortcut for\n", #> list("search_env(pkg_env_name(\"pkgname\"))"), #> ".\n", list(), " ", list("global_env()"), #> " and ", list("base_env()"), " (simple aliases for ", #> list(list("globalenv()")), "\n", "and ", #> list(list("baseenv()")), "). These are respectively the first and last\n", #> "environments of the search path.\n", list(), #> " ", list("is_attached()"), " returns ", #> list("TRUE"), " when its argument (a search name\n", #> "or a package environment) is attached to the search path.\n"), #> "\n"), "\n", list(list("The search path"), #> list("\n", "\n", "\n", "This chain of environments determines what objects are visible from\n", #> "the global workspace. It contains the following elements:\n", #> list("\n", list(), " The chain always starts with ", #> list("global_env()"), " and finishes with\n", #> list("base_env()"), " which inherits from the terminal environment\n", #> list("empty_env()"), ".\n", list(), " Each ", #> list(list("base::library()")), " call attaches a new package environment to\n", #> "the search path. Attached packages are associated with a ", #> list("search name"), ".\n", list(), " In addition, any list, data frame, or environment can be attached\n", #> "to the search path with ", list(list("base::attach()")), #> ".\n"), "\n")), "\n", "\n", list("\n", #> "# List the search names of environments attached to the search path:\n", #> "search()\n", "\n", "# Get the corresponding environments:\n", #> "search_envs()\n", "\n", "# The global environment and the base package are always first and\n", #> "# last in the chain, respectively:\n", "envs <- search_envs()\n", #> "envs[[1]]\n", "envs[[length(envs)]]\n", "\n", #> "# These two environments have their own shortcuts:\n", #> "global_env()\n", "base_env()\n", "\n", "# Packages appear in the search path with a special name. Use\n", #> "# pkg_env_name() to create that name:\n", #> "pkg_env_name(\"rlang\")\n", "search_env(pkg_env_name(\"rlang\"))\n", #> "\n", "# Alternatively, get the scoped environment of a package with\n", #> "# pkg_env():\n", "pkg_env(\"utils\")\n"), #> "\n", list("internal"), "\n"), seq2.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec.R", #> "\n", list("seq2"), "\n", list("seq2"), "\n", #> list("seq2_along"), "\n", list("Increasing sequence of integers in an interval"), #> "\n", list("\n", "seq2(from, to)\n", "\n", "seq2_along(from, x)\n"), #> "\n", list("\n", list(list("from"), list("The starting point of the sequence.")), #> "\n", "\n", list(list("to"), list("The end point.")), #> "\n", "\n", list(list("x"), list("A vector whose length is the end point.")), #> "\n"), "\n", list("\n", "An integer vector containing a strictly increasing\n", #> "sequence.\n"), "\n", list("\n", "These helpers take two endpoints and return the sequence of all\n", #> "integers within that interval. For ", list( #> "seq2_along()"), ", the upper\n", "endpoint is taken from the length of a vector. Unlike\n", #> list("base::seq()"), ", they return an empty vector if the starting point is\n", #> "a larger integer than the end point.\n"), #> "\n", list("\n", "seq2(2, 10)\n", "seq2(10, 2)\n", #> "seq(10, 2)\n", "\n", "seq2_along(10, letters)\n"), #> "\n"), set_attrs.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("set_attrs"), "\n", list("set_attrs"), #> "\n", list("mut_attrs"), "\n", list("Add attributes to an object"), #> "\n", list("\n", "set_attrs(.x, ...)\n", "\n", #> "mut_attrs(.x, ...)\n"), "\n", list("\n", list( #> list(".x"), list("An object to decorate with attributes.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> A list of named attributes. Pass\n", #> "a single unnamed ", list("NULL"), " argument to zap all attributes from ", #> list(".x"), ".")), "\n"), "\n", list("\n", #> list("set_attrs()"), " returns a modified ", #> list("shallow copy"), "\n", "of ", list(".x"), #> ". ", list("mut_attrs()"), " invisibly returns the original ", #> list(".x"), "\n", "modified in place.\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", list("set_attrs()"), " adds, changes, or zaps attributes of objects. Pass a\n", #> "single unnamed ", list("NULL"), " argument to zap all attributes. For\n", #> list("uncopyable"), " types, use ", list("mut_attrs()"), #> ".\n"), "\n", list("\n", "Unlike ", list(list( #> "structure()")), ", these setters have no special handling of\n", #> "internal attributes names like ", list(".Dim"), #> ", ", list(".Dimnames"), " or ", list(".Names"), #> ".\n"), "\n", list(list("Life cycle"), list( #> "\n", "\n", "\n", "These functions are deprecated since rlang 0.3.0.\n")), #> "\n", "\n", list("\n", "set_attrs(letters, names = 1:26, class = \"my_chr\")\n", #> "\n", "# Splice a list of attributes:\n", "attrs <- list(attr = \"attr\", names = 1:26, class = \"my_chr\")\n", #> "obj <- set_attrs(letters, splice(attrs))\n", #> "obj\n", "\n", "# Zap attributes by passing a single unnamed NULL argument:\n", #> "set_attrs(obj, NULL)\n", "set_attrs(obj, !!! list(NULL))\n", #> "\n", "# Note that set_attrs() never modifies objects in place:\n", #> "obj\n", "\n", "# For uncopyable types, mut_attrs() lets you modify in place:\n", #> "env <- env()\n", "mut_attrs(env, foo = \"bar\")\n", #> "env\n"), "\n", list("internal"), "\n"), set_expr.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/expr.R", #> "\n", list("set_expr"), "\n", list("set_expr"), #> "\n", list("get_expr"), "\n", list("Set and get an expression"), #> "\n", list("\n", "set_expr(x, value)\n", "\n", #> "get_expr(x, default = x)\n"), "\n", list("\n", #> list(list("x"), list("An expression, closure, or one-sided formula. In addition,\n", #> list("set_expr()"), " accept frames.")), #> "\n", "\n", list(list("value"), list("An updated expression.")), #> "\n", "\n", list(list("default"), list("A default expression to return when ", #> list("x"), " is not an\n", "expression wrapper. Defaults to ", #> list("x"), " itself.")), "\n"), "\n", list( #> "\n", "The updated original input for ", list( #> "set_expr()"), ". A raw\n", "expression for ", #> list("get_expr()"), ".\n"), "\n", list("\n", #> "These helpers are useful to make your function work generically\n", #> "with quosures and raw expressions. First call ", #> list("get_expr()"), " to\n", "extract an expression. Once you're done processing the expression,\n", #> "call ", list("set_expr()"), " on the original object to update the expression.\n", #> "You can return the result of ", list("set_expr()"), #> ", either a formula or an\n", "expression depending on the input type. Note that ", #> list("set_expr()"), " does\n", "not change its input, it creates a new object.\n"), #> "\n", list("\n", "f <- ~foo(bar)\n", "e <- quote(foo(bar))\n", #> "frame <- identity(identity(ctxt_frame()))\n", #> "\n", "get_expr(f)\n", "get_expr(e)\n", "get_expr(frame)\n", #> "\n", "set_expr(f, quote(baz))\n", "set_expr(e, quote(baz))\n"), #> "\n", list("\n", list(list("quo_get_expr()")), #> " and ", list(list("quo_set_expr()")), " for versions of\n", #> list(list("get_expr()")), " and ", list(list( #> "set_expr()")), " that only work on quosures.\n"), #> "\n"), set_names.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("set_names"), "\n", list("set_names"), #> "\n", list("Set names of a vector"), "\n", list( #> "\n", "set_names(x, nm = x, ...)\n"), "\n", #> list("\n", list(list("x"), list("Vector to name.")), #> "\n", "\n", list(list("nm, ..."), list("Vector of names, the same length as ", #> list("x"), ".\n", "\n", "You can specify names in the following ways:\n", #> list("\n", list(), " If you do nothing, ", #> list("x"), " will be named with itself.\n", #> list(), " If ", list("x"), " already has names, you can provide a function or formula\n", #> "to transform the existing names. In that case, ", #> list("..."), " is passed\n", "to the function.\n", #> list(), " If ", list("nm"), " is ", list( #> "NULL"), ", the names are removed (if present).\n", #> list(), " In all other cases, ", list("nm"), #> " and ", list("..."), " are coerced to character.\n"))), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", "This is equivalent to ", list( #> list("stats::setNames()")), ", with more features and\n", #> "stricter argument checking.\n"), "\n", list( #> list("Life cycle"), list("\n", "\n", "\n", #> list("set_names()"), " is stable and exported in purrr.\n")), #> "\n", "\n", list("\n", "set_names(1:4, c(\"a\", \"b\", \"c\", \"d\"))\n", #> "set_names(1:4, letters[1:4])\n", "set_names(1:4, \"a\", \"b\", \"c\", \"d\")\n", #> "\n", "# If the second argument is ommitted a vector is named with itself\n", #> "set_names(letters[1:5])\n", "\n", "# Alternatively you can supply a function\n", #> "set_names(1:10, ~ letters[seq_along(.)])\n", #> "set_names(head(mtcars), toupper)\n", "\n", #> "# If the input vector is unnamed, it is first named after itself\n", #> "# before the function is applied:\n", "set_names(letters, toupper)\n", #> "\n", "# `...` is passed to the function:\n", #> "set_names(head(mtcars), paste0, \"_foo\")\n"), #> "\n"), splice.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("splice"), "\n", list("splice"), "\n", #> list("is_spliced"), "\n", list("is_spliced_bare"), #> "\n", list("dots_splice"), "\n", list("Splice lists"), #> "\n", list("\n", "splice(x)\n", "\n", "is_spliced(x)\n", #> "\n", "is_spliced_bare(x)\n", "\n", "dots_splice(\n", #> " ...,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .preserve_empty = FALSE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n"), "\n", #> list("\n", list(list("x"), list("A list to splice.")), #> "\n", "\n", list(list("..."), list("Arguments to collect in a list. These dots are\n", #> list("dynamic"), ".")), "\n", "\n", list( #> list(".ignore_empty"), list("Whether to ignore empty arguments. Can be one\n", #> "of ", list("\"trailing\""), ", ", list( #> "\"none\""), ", ", list("\"all\""), ". If ", #> list("\"trailing\""), ", only the\n", "last argument is ignored if it is empty.")), #> "\n", "\n", list(list(".preserve_empty"), list( #> "Whether to preserve the empty arguments that\n", #> "were not ignored. If ", list("TRUE"), ", empty arguments are stored with\n", #> list(list("missing_arg()")), " values. If ", #> list("FALSE"), " (the default) an error is\n", #> "thrown when an empty argument is detected.")), #> "\n", "\n", list(list(".homonyms"), list("How to treat arguments with the same name. The\n", #> "default, ", list("\"keep\""), ", preserves these arguments. Set ", #> list(".homonyms"), " to\n", list("\"first\""), #> " to only keep the first occurrences, to ", #> list("\"last\""), " to keep\n", "the last occurrences, and to ", #> list("\"error\""), " to raise an informative\n", #> "error and indicate what arguments have duplicated names.")), #> "\n", "\n", list(list(".check_assign"), list( #> "Whether to check for ", list("<-"), " calls passed in\n", #> "dots. When ", list("TRUE"), " and a ", list( #> "<-"), " call is detected, a warning is\n", #> "issued to advise users to use ", list("="), #> " if they meant to match a\n", "function parameter, or wrap the ", #> list("<-"), " call in braces otherwise.\n", #> "This ensures assignments are explicit.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", list("\n", list(), " ", list("splice"), #> " marks an object to be spliced. It is equivalent to using\n", #> list("!!!"), " in a function taking ", list( #> "dynamic dots"), ".\n", list(), " ", list( #> "dots_splice()"), " is like ", list(list( #> "dots_list()")), " but automatically splices\n", #> "list inputs.\n"), "\n"), "\n", list(list( #> "Standard splicing versus quoting splicing"), #> list("\n", "\n", "\n", "The ", list("!!!"), #> " operator works differently in ", list("standard"), #> " functions taking\n", "dots with ", list( #> "dots_list()"), " than in ", list("quoting"), #> " functions taking dots\n", "with ", list( #> list("enexprs()")), " or ", list(list("enquos()")), #> ".\n", list("\n", list(), " In quoting functions ", #> list("!!!"), " disaggregates its argument (let's call\n", #> "it ", list("x"), ") into as many objects as there are elements in\n", #> list("x"), ". E.g. ", list("quo(foo(!!! c(1, 2)))"), #> " is completely equivalent to\n", list( #> "quo(foo(1, 2))"), ". The creation of those separate objects has an\n", #> "overhead but is typically not important when manipulating calls\n", #> "because function calls typically take a small number of\n", #> "arguments.\n", list(), " In standard functions, disaggregating the spliced collection\n", #> "would have a negative performance impact in cases where\n", #> list("dots_list()"), " is used to build up data structures from user\n", #> "inputs. To avoid this spliced inputs are marked with ", #> list(list("splice()")), "\n", "and the final list is built with (the equivalent of)\n", #> list("flatten_if(dots, is_spliced)"), ".\n"), #> "\n", "\n", "Most of the time you should not care about the difference. However\n", #> "if you use a standard function taking tidy dots within a quoting\n", #> "function, the ", list("!!!"), " operator will disaggregate its argument because\n", #> "the behaviour of the quasiquoting function has priority. You might\n", #> "then observe some performance cost in edge cases. Here is one\n", #> "example where this would happen:", list( #> "purrr::rerun(10, dplyr::bind_rows(!!! x))\n"), #> "\n", "\n", list("purrr::rerun()"), " is a quoting function and ", #> list("dplyr::bind_rows()"), " is\n", "a standard function. Because ", #> list("bind_rows()"), " is called ", list( #> "inside"), "\n", list("rerun()"), ", the list ", #> list("x"), " will be disaggregated into a pairlist of\n", #> "arguments. To avoid this you can use ", #> list("splice()"), " instead:", list("purrr::rerun(10, dplyr::bind_rows(splice(x)))\n"), #> "\n")), "\n", "\n", list(list("Life cycle"), #> list("\n", "\n", list("\n", list(), " ", list( #> "dots_splice()"), " is in the questioning stage. It is part of our\n", #> "experiments with dots semantics. Compared to ", #> list("dots_list()"), ",\n", list("dots_splice()"), #> " automatically splices lists. We now lean towards\n", #> "adopting a single type of dots semantics (those of ", #> list("dots_list()"), ")\n", "where splicing is explicit.\n", #> list(), " ", list("splice()"), " is in the questioning stage. It is not clear whether it is\n", #> "really needed as there are other ways to avoid the performance\n", #> "issue discussed above.\n"), "\n")), "\n", #> "\n", list("internal"), "\n"), stack.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("stack"), "\n", list("stack"), "\n", #> list("global_frame"), "\n", list("current_frame"), #> "\n", list("ctxt_frame"), "\n", list("call_frame"), #> "\n", list("ctxt_depth"), "\n", list("call_depth"), #> "\n", list("ctxt_stack"), "\n", list("call_stack"), #> "\n", list("Call stack information"), "\n", list( #> "\n", "global_frame()\n", "\n", "current_frame()\n", #> "\n", "ctxt_frame(n = 1)\n", "\n", "call_frame(n = 1, clean = TRUE)\n", #> "\n", "ctxt_depth()\n", "\n", "call_depth()\n", #> "\n", "ctxt_stack(n = NULL, trim = 0)\n", "\n", #> "call_stack(n = NULL, clean = TRUE)\n"), "\n", #> list("\n", list(list("n"), list("The number of frames to go back in the stack.")), #> "\n", "\n", list(list("clean"), list("Whether to post-process the call stack to clean\n", #> "non-standard frames. If ", list("TRUE"), #> ", suboptimal call-stack entries by\n", list( #> list("base::eval()")), " will be cleaned up: the duplicate frame created by\n", #> list("eval()"), " is eliminated.")), "\n", #> "\n", list(list("trim"), list("The number of layers of intervening frames to trim off\n", #> "the stack. See ", list(list("stack_trim()")), #> " and examples.")), "\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "The ", list("eval_"), " and ", #> list("call_"), " families of functions provide a replacement\n", #> "for the base R functions prefixed with ", #> list("sys."), " (which are all about\n", "the context stack), as well as for ", #> list(list("parent.frame()")), " (which is the\n", #> "only base R function for querying the call stack). The context\n", #> "stack includes all R-level evaluation contexts. It is linear in\n", #> "terms of execution history but due to lazy evaluation it is\n", #> "potentially nonlinear in terms of call history. The call stack\n", #> "history, on the other hand, is homogenous.\n"), #> "\n", list("\n", list("ctxt_frame()"), " and ", #> list("call_frame()"), " return a ", list("frame"), #> " object\n", "containing the following fields: ", #> list("expr"), " and ", list("env"), " (call expression\n", #> "and evaluation environment), ", list("pos"), #> " and ", list("caller_pos"), " (position of\n", #> "current frame in the context stack and position of the caller), and\n", #> list("fun"), " (function of the current frame). ", #> list("ctxt_stack()"), " and\n", list("call_stack()"), #> " return a list of all context or call frames on the\n", #> "stack. Finally, ", list("ctxt_depth()"), " and ", #> list("call_depth()"), " report the\n", "current context position or the number of calling frames on the\n", #> "stack.\n", "\n", "The base R functions take two sorts of arguments to indicate which\n", #> "frame to query: ", list("which"), " and ", #> list("n"), ". The ", list("n"), " argument is\n", #> "straightforward: it's the number of frames to go down the stack,\n", #> "with ", list("n = 1"), " referring to the current context. The ", #> list("which"), " argument\n", "is more complicated and changes meaning for values lower than 1.\n", #> "For the sake of consistency, the rlang functions all take the\n", #> "same kind of argument ", list("n"), ". This argument has a single meaning (the\n", #> "number of frames to go down the stack) and cannot be lower than 1.\n", #> "\n", "Note finally that ", list("parent.frame(1)"), #> " corresponds to\n", list("call_frame(2)$env"), #> ", as ", list("n = 1"), " always refers to the current\n", #> "frame. This makes the ", list("_frame()"), #> " and ", list("_stack()"), " functions\n", #> "consistent: ", list("ctxt_frame(2)"), " is the same as ", #> list("ctxt_stack()[[2]]"), ".\n", "Also, ", #> list("ctxt_depth()"), " returns one more frame than\n", #> list(list("base::sys.nframe()")), " because it counts the global frame. That is\n", #> "consistent with the ", list("_stack()"), " functions which return the global\n", #> "frame as well. This way, ", list("call_stack(call_depth())"), #> " is the same as\n", list("global_frame()"), #> ".\n"), "\n", list(list("Life cycle"), list( #> "\n", "\n", "\n", "These functions are soft-deprecated and replaced by ", #> list(list("trace_back()")), ".\n")), "\n", #> "\n", list("\n", "# Expressions within arguments count as contexts\n", #> "identity(identity(ctxt_depth())) # returns 2\n", #> "\n", "# But they are not part of the call stack because arguments are\n", #> "# evaluated within the calling function (or the global environment\n", #> "# if called at top level)\n", "identity(identity(call_depth())) # returns 0\n", #> "\n", "# The context stacks includes all intervening execution frames. The\n", #> "# call stack doesn't:\n", "f <- function(x) identity(x)\n", #> "f(f(ctxt_stack()))\n", "f(f(call_stack()))\n", #> "\n", "g <- function(cmd) cmd()\n", "f(g(ctxt_stack))\n", #> "f(g(call_stack))\n", "\n", "# The rlang _stack() functions return a list of frame\n", #> "# objects. Use purrr::transpose() or index a field with\n", #> "# purrr::map()'s to extract a particular field from a stack:\n", #> "\n", "# stack <- f(f(call_stack()))\n", "# purrr::map(stack, \"env\")\n", #> "# purrr::transpose(stack)$expr\n", "\n", "# current_frame() is an alias for ctxt_frame(1)\n", #> "fn <- function() list(current = current_frame(), first = ctxt_frame(1))\n", #> "fn()\n", "\n", "# While current_frame() is the top of the stack, global_frame() is\n", #> "# the bottom:\n", "fn <- function() {\n", #> " n <- ctxt_depth()\n", " ctxt_frame(n)\n", #> "}\n", "identical(fn(), global_frame())\n", #> "\n", "\n", "# ctxt_stack() returns a stack with all intervening frames. You can\n", #> "# trim layers of intervening frames with the trim argument:\n", #> "identity(identity(ctxt_stack()))\n", "identity(identity(ctxt_stack(trim = 1)))\n", #> "\n", "# ctxt_stack() is called within fn() with intervening frames:\n", #> "fn <- function(trim) identity(identity(ctxt_stack(trim = trim)))\n", #> "fn(0)\n", "\n", "# We can trim the first layer of those:\n", #> "fn(1)\n", "\n", "# The outside intervening frames (at the fn() call site) are still\n", #> "# returned, but can be trimmed as well:\n", #> "identity(identity(fn(1)))\n", "identity(identity(fn(2)))\n", #> "\n", "g <- function(trim) identity(identity(fn(trim)))\n", #> "g(2)\n", "g(3)\n"), "\n", list("internal"), #> "\n"), stack_trim.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("stack_trim"), "\n", list("stack_trim"), #> "\n", list("Trim top call layers from the evaluation stack"), #> "\n", list("\n", "stack_trim(stack, n = 1)\n"), #> "\n", list("\n", list(list("stack"), list("An evaluation stack.")), #> "\n", "\n", list(list("n"), list("The number of call frames (not eval frames) to trim off\n", #> "the top of the stack. In other words, the number of layers of\n", #> "intervening frames to trim.")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", list(list("ctxt_stack()")), " can be tricky to use in real code because all\n", #> "intervening frames are returned with the stack, including those at\n", #> list("ctxt_stack()"), " own call site. ", list( #> "stack_trim()"), " makes it easy to\n", "remove layers of intervening calls.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "These functions are deprecated and replaced by ", #> list(list("trace_back()")), ".\n")), "\n", #> "\n", list("\n", "# Intervening frames appear on the evaluation stack:\n", #> "identity(identity(ctxt_stack()))\n", "\n", #> "# stack_trim() will trim the first n layers of calls:\n", #> "stack_trim(identity(identity(ctxt_stack())))\n", #> "\n", "# Note that it also takes care of calls intervening at its own call\n", #> "# site:\n", "identity(identity(\n", " stack_trim(identity(identity(ctxt_stack())))\n", #> "))\n", "\n", "# It is especially useful when used within a function that needs to\n", #> "# inspect the evaluation stack but should nonetheless be callable\n", #> "# within nested calls without side effects:\n", #> "stack_util <- function() {\n", " # n = 2 means that two layers of intervening calls should be\n", #> " # removed: The layer at ctxt_stack()'s call site (including the\n", #> " # stack_trim() call), and the layer at stack_util()'s call.\n", #> " stack <- stack_trim(ctxt_stack(), n = 2)\n", #> " stack\n", "}\n", "user_fn <- function() {\n", #> " # A user calls your stack utility with intervening frames:\n", #> " identity(identity(stack_util()))\n", "}\n", #> "# These intervening frames won't appear in the evaluation stack\n", #> "identity(user_fn())\n"), "\n", list("internal"), #> "\n"), string.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/utils-encoding.R", #> "\n", list("string"), "\n", list("string"), "\n", #> list("Create a string"), "\n", list("\n", "string(x, encoding = NULL)\n"), #> "\n", list("\n", list(list("x"), list("A character vector or a vector or list of string-like\n", #> "objects.")), "\n", "\n", list(list("encoding"), #> list("If non-null, set an encoding mark. This is only\n", #> "declarative, no encoding conversion is performed.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "These base-type constructors allow more control over the creation\n", #> "of strings in R. They take character vectors or string-like objects\n", #> "(integerish or raw vectors), and optionally set the encoding. The\n", #> "string version checks that the input contains a scalar string.\n"), #> "\n", list("\n", "# As everywhere in R, you can specify a string with Unicode\n", #> "# escapes. The characters corresponding to Unicode codepoints will\n", #> "# be encoded in UTF-8, and the string will be marked as UTF-8\n", #> "# automatically:\n", "cafe <- string(\"caf\\uE9\")\n", #> "Encoding(cafe)\n", "as_bytes(cafe)\n", "\n", #> "# In addition, string() provides useful conversions to let\n", #> "# programmers control how the string is represented in memory. For\n", #> "# encodings other than UTF-8, you'll need to supply the bytes in\n", #> "# hexadecimal form. If it is a latin1 encoding, you can mark the\n", #> "# string explicitly:\n", "cafe_latin1 <- string(c(0x63, 0x61, 0x66, 0xE9), \"latin1\")\n", #> "Encoding(cafe_latin1)\n", "as_bytes(cafe_latin1)\n"), #> "\n", list("internal"), "\n"), switch_type.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("switch_type"), "\n", list("switch_type"), #> "\n", list("coerce_type"), "\n", list("switch_class"), #> "\n", list("coerce_class"), "\n", list("Dispatch on base types"), #> "\n", list("\n", "switch_type(.x, ...)\n", "\n", #> "coerce_type(.x, .to, ...)\n", "\n", "switch_class(.x, ...)\n", #> "\n", "coerce_class(.x, .to, ...)\n"), "\n", #> list("\n", list(list(".x"), list("An object from which to dispatch.")), #> "\n", "\n", list(list("..."), list("Named clauses. The names should be types as returned by\n", #> list(list("type_of()")), ".")), "\n", "\n", #> list(list(".to"), list("This is useful when you switchpatch within a coercing\n", #> "function. If supplied, this should be a string indicating the\n", #> "target type. A catch-all clause is then added to signal an error\n", #> "stating the conversion failure. This type is prettified unless\n", #> list(".to"), " inherits from the S3 class ", #> list("\"AsIs\""), " (see ", list(list("base::I()")), #> ").")), "\n"), "\n", list("\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", list("switch_type()"), " is equivalent to\n", #> list(list("switch"), "(", list("type_of"), #> "(x, ...))"), ", while\n", list("switch_class()"), #> " switchpatches based on ", list("class(x)"), #> ". The ", list("coerce_"), "\n", "versions are intended for type conversion and provide a standard\n", #> "error message when conversion fails.\n"), #> "\n", list("\n", "switch_type(3L,\n", " double = \"foo\",\n", #> " integer = \"bar\",\n", " \"default\"\n", #> ")\n", "\n", "# Use the coerce_ version to get standardised error handling when no\n", #> "# type matches:\n", "to_chr <- function(x) {\n", #> " coerce_type(x, \"a chr\",\n", " integer = as.character(x),\n", #> " double = as.character(x)\n", " )\n", #> "}\n", "to_chr(3L)\n", "\n", "# Strings have their own type:\n", #> "switch_type(\"str\",\n", " character = \"foo\",\n", #> " string = \"bar\",\n", " \"default\"\n", #> ")\n", "\n", "# Use a fallthrough clause if you need to dispatch on all character\n", #> "# vectors, including strings:\n", "switch_type(\"str\",\n", #> " string = ,\n", " character = \"foo\",\n", #> " \"default\"\n", ")\n", "\n", "# special and builtin functions are treated as primitive, since\n", #> "# there is usually no reason to treat them differently:\n", #> "switch_type(base::list,\n", " primitive = \"foo\",\n", #> " \"default\"\n", ")\n", "switch_type(base::`$`,\n", #> " primitive = \"foo\",\n", " \"default\"\n", #> ")\n", "\n", "# closures are not primitives:\n", #> "switch_type(rlang::switch_type,\n", " primitive = \"foo\",\n", #> " \"default\"\n", ")\n"), "\n", list("internal"), #> "\n"), sym.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/sym.R", #> "\n", list("sym"), "\n", list("sym"), "\n", list( #> "syms"), "\n", list("Create a symbol or list of symbols"), #> "\n", list("\n", "sym(x)\n", "\n", "syms(x)\n"), #> "\n", list("\n", list(list("x"), list("A string or list of strings.")), #> "\n"), "\n", list("\n", "A symbol for ", list( #> "sym()"), " and a list of symbols for ", list( #> "syms()"), ".\n"), "\n", list("\n", "These functions take strings as input and turn them into symbols.\n"), #> "\n", list("\n", "# The empty string returns the missing argument:\n", #> "sym(\"\")\n", "\n", "# This way sym() and as_string() are inverse of each other:\n", #> "as_string(missing_arg())\n", "sym(as_string(missing_arg()))\n"), #> "\n"), `tidyeval-data.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval-tidy.R", #> "\n", list("data"), "\n", list("tidyeval-data"), #> "\n", list("tidyeval-data"), "\n", list(".data"), #> "\n", list(".env"), "\n", list("Data pronouns for tidy evaluation"), #> "\n", list("\n", ".data\n", "\n", ".env\n"), #> "\n", list("\n", "These pronouns allow you to be explicit about where to find objects\n", #> "when programming with data masked functions.", #> list("m <- 10\n", "mtcars %>% mutate(disp = .data$disp * .env$m)\n"), #> "\n", list("\n", list(), " ", list(".data"), #> " retrieves data-variables from the data frame.\n", #> list(), " ", list(".env"), " retrieves env-variables from the environment.\n"), #> "\n", "\n", "Because the lookup is explicit, there is no ambiguity between both\n", #> "kinds of variables. Compare:", list("disp <- 10\n", #> "mtcars %>% mutate(disp = .data$disp * .env$disp)\n", #> "mtcars %>% mutate(disp = disp * disp)\n"), #> "\n", "\n", "The ", list(".data"), " object exported from rlang is also useful to import in\n", #> "your package namespace to avoid a ", list( #> "R CMD check"), " note when referring\n", #> "to objects from the data mask.\n", "\n", "Note that ", #> list(".data"), " is only a pronoun, it is not a real data\n", #> "frame. This means that you can't take its names or map a function\n", #> "over the contents of ", list(".data"), ". Similarly, ", #> list(".env"), " is not an actual R\n", "environment. For instance, it doesn't have a parent and the\n", #> "subsetting operators behave differently.\n"), #> "\n", list("datasets"), "\n"), trace_back.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/trace.R", #> "\n", list("trace_back"), "\n", list("trace_back"), #> "\n", list("trace_length"), "\n", list("Capture a backtrace"), #> "\n", list("\n", "trace_back(top = NULL, bottom = NULL)\n", #> "\n", "trace_length(trace)\n"), "\n", list( #> "\n", list(list("top"), list("The first frame environment to be included in the\n", #> "backtrace. This becomes the top of the backtrace tree and\n", #> "represents the oldest call in the backtrace.\n", #> "\n", "This is needed in particular when you call ", #> list("trace_back()"), "\n", "indirectly or from a larger context, for example in tests or\n", #> "inside an RMarkdown document where you don't want all of the\n", #> "knitr evaluation mechanisms to appear in the backtrace.")), #> "\n", "\n", list(list("bottom"), list("The last frame environment to be included in the\n", #> "backtrace. This becomes the rightmost leaf of the backtrace tree\n", #> "and represents the youngest call in the backtrace.\n", #> "\n", "Set this when you would like to capture a backtrace without the\n", #> "capture context.\n", "\n", "Can also be an integer that will be passed to ", #> list(list("caller_env()")), ".")), "\n", #> "\n", list(list("trace"), list("A backtrace created by ", #> list("trace_back()"), ".")), "\n"), "\n", #> list("\n", "A backtrace captures the sequence of calls that lead to the current\n", #> "function, sometimes called the call stack. Because of lazy\n", #> "evaluation, the call stack in R is actually a tree, which the\n", #> list("summary()"), " method of this object will reveal.\n"), #> "\n", list("\n", list("trace_length()"), " returns the number of frames in a backtrace.\n"), #> "\n", list("\n", "# Trim backtraces automatically (this improves the generated\n", #> "# documentation for the rlang website and the same trick can be\n", #> "# useful within knitr documents):\n", "options(rlang_trace_top_env = current_env())\n", #> "\n", "f <- function() g()\n", "g <- function() h()\n", #> "h <- function() trace_back()\n", "\n", "# When no lazy evaluation is involved the backtrace is linear\n", #> "# (i.e. every call has only one child)\n", #> "f()\n", "\n", "# Lazy evaluation introduces a tree like structure\n", #> "identity(identity(f()))\n", "identity(try(f()))\n", #> "try(identity(f()))\n", "\n", "# When printing, you can request to simplify this tree to only show\n", #> "# the direct sequence of calls that lead to `trace_back()`\n", #> "x <- try(identity(f()))\n", "x\n", "print(x, simplify = \"branch\")\n", #> "\n", "# With a little cunning you can also use it to capture the\n", #> "# tree from within a base NSE function\n", #> "x <- NULL\n", "with(mtcars, {x <<- f(); 10})\n", #> "x\n", "\n", "\n", "# Restore default top env for next example\n", #> "options(rlang_trace_top_env = NULL)\n", "\n", #> "# When code is executed indirectly, i.e. via source or within an\n", #> "# RMarkdown document, you'll tend to get a lot of guff at the beginning\n", #> "# related to the execution environment:\n", #> "conn <- textConnection(\"summary(f())\")\n", #> "source(conn, echo = TRUE, local = TRUE)\n", #> "close(conn)\n", "\n", "# To automatically strip this off, specify which frame should be\n", #> "# the top of the backtrace. This will automatically trim off calls\n", #> "# prior to that frame:\n", "top <- current_env()\n", #> "h <- function() trace_back(top)\n", "\n", #> "conn <- textConnection(\"summary(f())\")\n", #> "source(conn, echo = TRUE, local = TRUE)\n", #> "close(conn)\n"), "\n"), `type-predicates.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("type-predicates"), "\n", list("type-predicates"), #> "\n", list("is_list"), "\n", list("is_atomic"), #> "\n", list("is_vector"), "\n", list("is_integer"), #> "\n", list("is_double"), "\n", list("is_character"), #> "\n", list("is_logical"), "\n", list("is_raw"), #> "\n", list("is_bytes"), "\n", list("is_null"), #> "\n", list("Type predicates"), "\n", list("\n", #> "is_list(x, n = NULL)\n", "\n", "is_atomic(x, n = NULL)\n", #> "\n", "is_vector(x, n = NULL)\n", "\n", "is_integer(x, n = NULL)\n", #> "\n", "is_double(x, n = NULL, finite = NULL)\n", #> "\n", "is_character(x, n = NULL)\n", "\n", #> "is_logical(x, n = NULL)\n", "\n", "is_raw(x, n = NULL)\n", #> "\n", "is_bytes(x, n = NULL)\n", "\n", "is_null(x)\n"), #> "\n", list("\n", list(list("x"), list("Object to be tested.")), #> "\n", "\n", list(list("n"), list("Expected length of a vector.")), #> "\n", "\n", list(list("finite"), list("Whether all values of the vector are finite. The\n", #> "non-finite values are ", list("NA"), ", ", #> list("Inf"), ", ", list("-Inf"), " and ", #> list("NaN"), ". Setting this\n", "to something other than ", #> list("NULL"), " can be expensive because the whole\n", #> "vector needs to be traversed and checked.")), #> "\n"), "\n", list("\n", "These type predicates aim to make type testing in R more\n", #> "consistent. They are wrappers around ", list( #> list("base::typeof()")), ", so operate\n", #> "at a level beneath S3/S4 etc.\n"), "\n", list( #> "\n", "Compared to base R functions:\n", list( #> "\n", list(), " The predicates for vectors include the ", #> list("n"), " argument for\n", "pattern-matching on the vector length.\n", #> list(), " Unlike ", list("is.atomic()"), #> ", ", list("is_atomic()"), " does not return ", #> list("TRUE"), " for\n", list("NULL"), ".\n", #> list(), " Unlike ", list("is.vector()"), #> ", ", list("is_vector()"), " tests if an object is an\n", #> "atomic vector or a list. ", list("is.vector"), #> " checks for the presence of\n", "attributes (other than name).\n"), #> "\n"), "\n", list("\n", list("bare-type-predicates"), #> " ", list("scalar-type-predicates"), "\n"), #> "\n"), type_of.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("type_of"), "\n", list("type_of"), #> "\n", list("Base type of an object"), "\n", list( #> "\n", "type_of(x)\n"), "\n", list("\n", list( #> list("x"), list("An R object.")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "This is equivalent to ", list( #> list("base::typeof()")), " with a few differences that\n", #> "make dispatching easier:\n", list("\n", list(), #> " The type of one-sided formulas is \"quote\".\n", #> list(), " The type of character vectors of length 1 is \"string\".\n", #> list(), " The type of special and builtin functions is \"primitive\".\n"), #> "\n"), "\n", list(list("Life cycle"), list( #> "\n", "\n", "\n", list("type_of()"), " is an experimental function. Expect API changes.\n")), #> "\n", "\n", list("\n", "type_of(10L)\n", "\n", #> "# Quosures are treated as a new base type but not formulas:\n", #> "type_of(quo(10L))\n", "type_of(~10L)\n", "\n", #> "# Compare to base::typeof():\n", "typeof(quo(10L))\n", #> "\n", "# Strings are treated as a new base type:\n", #> "type_of(letters)\n", "type_of(letters[[1]])\n", #> "\n", "# This is a bit inconsistent with the core language tenet that data\n", #> "# types are vectors. However, treating strings as a different\n", #> "# scalar type is quite helpful for switching on function inputs\n", #> "# since so many arguments expect strings:\n", #> "switch_type(\"foo\", character = abort(\"vector!\"), string = \"result\")\n", #> "\n", "# Special and builtin primitives are both treated as primitives.\n", #> "# That's because it is often irrelevant which type of primitive an\n", #> "# input is:\n", "typeof(list)\n", "typeof(`$`)\n", #> "type_of(list)\n", "type_of(`$`)\n"), "\n", #> list("internal"), "\n"), vec_poke_n.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec.R", #> "\n", list("vec_poke_n"), "\n", list("vec_poke_n"), #> "\n", list("vec_poke_range"), "\n", list("Poke values into a vector"), #> "\n", list("\n", "vec_poke_n(x, start, y, from = 1L, n = length(y))\n", #> "\n", "vec_poke_range(x, start, y, from = 1L, to = length(y) - from + 1L)\n"), #> "\n", list("\n", list(list("x"), list("The destination vector.")), #> "\n", "\n", list(list("start"), list("The index indicating where to start modifying ", #> list("x"), ".")), "\n", "\n", list(list("y"), #> list("The source vector.")), "\n", "\n", #> list(list("from"), list("The index indicating where to start copying from ", #> list("y"), ".")), "\n", "\n", list(list("n"), #> list("How many elements should be copied from ", #> list("y"), " to ", list("x"), ".")), "\n", #> "\n", list(list("to"), list("The index indicating the end of the range to copy from ", #> list("y"), ".")), "\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "These tools are for R experts only. They copy elements from ", #> list("y"), "\n", "into ", list("x"), " by mutation. You should only do this if you own ", #> list("x"), ",\n", "i.e. if you have created it or if you are certain that it doesn't\n", #> "exist in any other context. Otherwise you might create unintended\n", #> "side effects that have undefined consequences.\n"), #> "\n", list("internal"), "\n"), `vector-coercion.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("vector-coercion"), "\n", list("vector-coercion"), #> "\n", list("as_logical"), "\n", list("as_integer"), #> "\n", list("as_double"), "\n", list("as_complex"), #> "\n", list("as_character"), "\n", list("as_list"), #> "\n", list("Coerce an object to a base type"), #> "\n", list("\n", "as_logical(x)\n", "\n", "as_integer(x)\n", #> "\n", "as_double(x)\n", "\n", "as_complex(x)\n", #> "\n", "as_character(x, encoding = NULL)\n", #> "\n", "as_list(x)\n"), "\n", list("\n", list( #> list("x"), list("An object to coerce to a base type.")), #> "\n", "\n", list(list("encoding"), list("If non-null, set an encoding mark. This is only\n", #> "declarative, no encoding conversion is performed.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", "\n", "These are equivalent to the base functions (e.g. ", #> list(list("as.logical()")), ",\n", list(list( #> "as.list()")), ", etc), but perform coercion rather than conversion.\n", #> "This means they are not generic and will not call S3 conversion\n", #> "methods. They only attempt to coerce the base type of their\n", #> "input. In addition, they have stricter implicit coercion rules and\n", #> "will never attempt any kind of parsing. E.g. they will not try to\n", #> "figure out if a character vector represents integers or booleans.\n", #> "Finally, they treat attributes consistently, unlike the base R\n", #> "functions: all attributes except names are removed.\n"), #> "\n", list(list("Lifecycle"), list("\n", "\n", #> "\n", "These functions are deprecated in favour of ", #> list("vctrs::vec_cast()"), ".\n")), "\n", "\n", #> list(list("Coercion to logical and numeric atomic vectors"), #> list("\n", "\n", list("\n", list(), " To logical vectors: Integer and integerish double vectors. See\n", #> list(list("is_integerish()")), ".\n", list(), #> " To integer vectors: Logical and integerish double vectors.\n", #> list(), " To double vectors: Logical and integer vectors.\n", #> list(), " To complex vectors: Logical, integer and double vectors.\n"), #> "\n")), "\n", "\n", list(list("Coercion to character vectors"), #> list("\n", "\n", "\n", list("as_character()"), #> " and ", list("as_string()"), " have an optional ", #> list("encoding"), "\n", "argument to specify the encoding. R uses this information for\n", #> "internal handling of strings and character vectors. Note that this\n", #> "is only declarative, no encoding conversion is attempted.\n", #> "\n", "Note that only ", list("as_string()"), #> " can coerce symbols to a scalar\n", "character vector. This makes the code more explicit and adds an\n", #> "extra type check.\n")), "\n", "\n", list( #> list("Coercion to lists"), list("\n", "\n", #> "\n", list("as_list()"), " only coerces vector and dictionary types (environments\n", #> "are an example of dictionary type). Unlike ", #> list(list("base::as.list()")), ",\n", list( #> "as_list()"), " removes all attributes except names.\n")), #> "\n", "\n", list(list("Effects of removing attributes"), #> list("\n", "\n", "\n", "A technical side-effect of removing the attributes of the input is\n", #> "that the underlying objects has to be copied. This has no\n", #> "performance implications in the case of lists because this is a\n", #> "shallow copy: only the list structure is copied, not the contents\n", #> "(see ", list(list("duplicate()")), "). However, be aware that atomic vectors\n", #> "containing large amounts of data will have to be copied.\n", #> "\n", "In general, any attribute modification creates a copy, which is why\n", #> "it is better to avoid using attributes with heavy atomic vectors.\n", #> "Uncopyable objects like environments and symbols are an exception\n", #> "to this rule: in this case, attributes modification happens in\n", #> "place and has side-effects.\n")), "\n", #> "\n", list("\n", "# Coercing atomic vectors removes attributes with both base R and rlang:\n", #> "x <- structure(TRUE, class = \"foo\", bar = \"baz\")\n", #> "as.logical(x)\n", "\n", "# But coercing lists preserves attributes in base R but not rlang:\n", #> "l <- structure(list(TRUE), class = \"foo\", bar = \"baz\")\n", #> "as.list(l)\n", "as_list(l)\n", "\n", "# Implicit conversions are performed in base R but not rlang:\n", #> "as.logical(l)\n", list("\n", "as_logical(l)\n"), #> "\n", "\n", "# Conversion methods are bypassed, making the result of the\n", #> "# coercion more predictable:\n", "as.list.foo <- function(x) \"wrong\"\n", #> "as.list(l)\n", "as_list(l)\n", "\n", "# The input is never parsed. E.g. character vectors of numbers are\n", #> "# not converted to numeric types:\n", "as.integer(\"33\")\n", #> list("\n", "as_integer(\"33\")\n"), "\n", "\n", #> "\n", "# With base R tools there is no way to convert an environment to a\n", #> "# list without either triggering method dispatch, or changing the\n", #> "# original environment. as_list() makes it easy:\n", #> "x <- structure(as_environment(mtcars[1:2]), class = \"foobar\")\n", #> "as.list.foobar <- function(x) abort(\"dont call me\")\n", #> "as_list(x)\n"), "\n", list("internal"), "\n"), #> `vector-construction.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-new.R", #> "\n", list("vector-construction"), "\n", list( #> "vector-construction"), "\n", list("lgl"), #> "\n", list("int"), "\n", list("dbl"), "\n", list( #> "cpl"), "\n", list("chr"), "\n", list("bytes"), #> "\n", list("Create vectors"), "\n", list("\n", #> "lgl(...)\n", "\n", "int(...)\n", "\n", "dbl(...)\n", #> "\n", "cpl(...)\n", "\n", "chr(...)\n", "\n", #> "bytes(...)\n"), "\n", list("\n", list(list( #> "..."), list("Components of the new vector. Bare lists and explicitly\n", #> "spliced lists are spliced.")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "The atomic vector constructors are equivalent to ", #> list(list("c()")), " but:\n", list("\n", list(), #> " They allow you to be more explicit about the output\n", #> "type. Implicit coercions (e.g. from integer to logical) follow\n", #> "the rules described in ", list("vector-coercion"), #> ".\n", list(), " They use ", list("dynamic dots"), #> ".\n"), "\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", list("\n", list(), " All the abbreviated constructors such as ", #> list("lgl()"), " will probably be\n", "moved to the vctrs package at some point. This is why they are\n", #> "marked as questioning.\n", list(), " Automatic splicing is soft-deprecated and will trigger a warning\n", #> "in a future version. Please splice explicitly with ", #> list("!!!"), ".\n"), "\n")), "\n", "\n", #> list("\n", "# These constructors are like a typed version of c():\n", #> "c(TRUE, FALSE)\n", "lgl(TRUE, FALSE)\n", "\n", #> "# They follow a restricted set of coercion rules:\n", #> "int(TRUE, FALSE, 20)\n", "\n", "# Lists can be spliced:\n", #> "dbl(10, !!! list(1, 2L), TRUE)\n", "\n", "\n", #> "# They splice names a bit differently than c(). The latter\n", #> "# automatically composes inner and outer names:\n", #> "c(a = c(A = 10), b = c(B = 20, C = 30))\n", #> "\n", "# On the other hand, rlang's ctors use the inner names and issue a\n", #> "# warning to inform the user that the outer names are ignored:\n", #> "dbl(a = c(A = 10), b = c(B = 20, C = 30))\n", #> "dbl(a = c(1, 2))\n", "\n", "# As an exception, it is allowed to provide an outer name when the\n", #> "# inner vector is an unnamed scalar atomic:\n", #> "dbl(a = 1)\n", "\n", "# Spliced lists behave the same way:\n", #> "dbl(!!! list(a = 1))\n", "dbl(!!! list(a = c(A = 1)))\n", #> "\n", "# bytes() accepts integerish inputs\n", #> "bytes(1:10)\n", "bytes(0x01, 0xff, c(0x03, 0x05), list(10, 20, 30L))\n"), #> "\n"), `vector-old-ctors.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("node"), "\n", list("node"), "\n", #> list("vector-old-ctors"), "\n", list("lgl_len"), #> "\n", list("int_len"), "\n", list("dbl_len"), #> "\n", list("chr_len"), "\n", list("cpl_len"), #> "\n", list("raw_len"), "\n", list("bytes_len"), #> "\n", list("list_len"), "\n", list("lgl_along"), #> "\n", list("int_along"), "\n", list("dbl_along"), #> "\n", list("chr_along"), "\n", list("cpl_along"), #> "\n", list("raw_along"), "\n", list("bytes_along"), #> "\n", list("list_along"), "\n", list("Retired vector construction by length"), #> "\n", list("\n", "node(car, cdr = NULL)\n", "\n", #> "lgl_len(.n)\n", "\n", "int_len(.n)\n", "\n", #> "dbl_len(.n)\n", "\n", "chr_len(.n)\n", "\n", #> "cpl_len(.n)\n", "\n", "raw_len(.n)\n", "\n", #> "bytes_len(.n)\n", "\n", "list_len(.n)\n", #> "\n", "lgl_along(.x)\n", "\n", "int_along(.x)\n", #> "\n", "dbl_along(.x)\n", "\n", "chr_along(.x)\n", #> "\n", "cpl_along(.x)\n", "\n", "raw_along(.x)\n", #> "\n", "bytes_along(.x)\n", "\n", "list_along(.x)\n"), #> "\n", list("\n", list(list(".n"), list("The vector length.")), #> "\n", "\n", list(list(".x"), list("A vector.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions were deprecated and renamed with ", #> list("new_"), " prefix in\n", "rlang 0.2.0. This is for consistency with other non-variadic object\n", #> "constructors.\n"), "\n", list("internal"), #> "\n"), with_abort.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-entrace.R", #> "\n", list("with_abort"), "\n", list("with_abort"), #> "\n", list("Promote all errors to rlang errors"), #> "\n", list("\n", "with_abort(expr, classes = \"error\")\n"), #> "\n", list("\n", list(list("expr"), list("An expression run in a context where errors are\n", #> "promoted to rlang errors.")), "\n", "\n", #> list(list("classes"), list("Character vector of condition classes that should be\n", #> "promoted to rlang errors.")), "\n"), "\n", #> list("\n", list("with_abort()"), " promotes conditions as if they were thrown with\n", #> list(list("abort()")), ". These errors embed a ", #> list("backtrace"), ". They are\n", "particularly suitable to be set as ", #> list("parent errors"), " (see ", list("parent"), #> "\n", "argument of ", list(list("abort()")), #> ").\n"), "\n", list("\n", list("with_abort()"), #> " installs a ", list("calling handler"), " for errors and\n", #> "rethrows non-rlang errors with ", list(list( #> "abort()")), ". However, error handlers\n", #> "installed ", list("within"), " ", list("with_abort()"), #> " have priority. For this reason,\n", "you should use ", #> list(list("tryCatch()")), " and ", list("exiting"), #> " handlers outside\n", list("with_abort()"), #> " rather than inside.\n"), "\n", list("\n", #> "# with_abort() automatically casts simple errors thrown by stop()\n", #> "# to rlang errors. It is is handy for rethrowing low level\n", #> "# errors. The backtraces are then segmented between the low level\n", #> "# and high level contexts.\n", "f <- function() g()\n", #> "g <- function() stop(\"Low level error\")\n", #> "\n", "high_level <- function() {\n", " with_handlers(\n", #> " with_abort(f()),\n", " error = ~ abort(\"High level error\", parent = .)\n", #> " )\n", "}\n"), "\n"), with_env.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval.R", #> "\n", list("with_env"), "\n", list("with_env"), #> "\n", list("locally"), "\n", list("Evaluate an expression within a given environment"), #> "\n", list("\n", "with_env(env, expr)\n", "\n", #> "locally(expr)\n"), "\n", list("\n", list(list( #> "env"), list("An environment within which to evaluate ", #> list("expr"), ". Can be\n", "an object with a ", #> list(list("get_env()")), " method.")), "\n", #> "\n", list(list("expr"), list("An expression to evaluate.")), #> "\n"), "\n", list("\n", "These functions evaluate ", #> list("expr"), " within a given environment (", #> list("env"), "\n", "for ", list("with_env()"), #> ", or the child of the current environment for\n", #> list("locally"), "). They rely on ", list(list( #> "eval_bare()")), " which features a lighter\n", #> "evaluation mechanism than base R ", list(list( #> "base::eval()")), ", and which also has\n", #> "some subtle implications when evaluting stack sensitive functions\n", #> "(see help for ", list(list("eval_bare()")), #> ").\n"), "\n", list("\n", list("locally()"), #> " is equivalent to the base function\n", list( #> list("base::local()")), " but it produces a much cleaner\n", #> "evaluation stack, and has stack-consistent semantics. It is thus\n", #> "more suited for experimenting with the R language.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "These functions are experimental. Expect API changes.\n")), #> "\n", "\n", list("\n", "# with_env() is handy to create formulas with a given environment:\n", #> "env <- child_env(\"rlang\")\n", "f <- with_env(env, ~new_formula())\n", #> "identical(f_env(f), env)\n", "\n", "# Or functions with a given enclosure:\n", #> "fn <- with_env(env, function() NULL)\n", "identical(get_env(fn), env)\n", #> "\n", "\n", "# Unlike eval() it doesn't create duplicates on the evaluation\n", #> "# stack. You can thus use it e.g. to create non-local returns:\n", #> "fn <- function() {\n", " g(current_env())\n", #> " \"normal return\"\n", "}\n", "g <- function(env) {\n", #> " with_env(env, return(\"early return\"))\n", #> "}\n", "fn()\n", "\n", "\n", "# Since env is passed to as_environment(), it can be any object with an\n", #> "# as_environment() method. For strings, the pkg_env() is returned:\n", #> "with_env(\"base\", ~mtcars)\n", "\n", "# This can be handy to put dictionaries in scope:\n", #> "with_env(mtcars, cyl)\n"), "\n", list("internal"), #> "\n"), with_handlers.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-handlers.R", #> "\n", list("with_handlers"), "\n", list("with_handlers"), #> "\n", list("calling"), "\n", list("Establish handlers on the stack"), #> "\n", list("\n", "with_handlers(.expr, ...)\n", #> "\n", "calling(handler)\n"), "\n", list("\n", #> list(list(".expr"), list("An expression to execute in a context where new\n", #> "handlers are established. The underscored version takes a quoted\n", #> "expression or a quoted formula.")), "\n", #> "\n", list(list("..."), list("<", list("dynamic"), #> "> Named handlers. These should be\n", "functions of one argument, or ", #> list("formula functions"), ".\n", "The handlers are considered exiting by default, use ", #> list(list("calling()")), "\n", "to specify a calling handler.")), #> "\n", "\n", list(list("handler"), list("A handler function that takes a condition as\n", #> "argument. This is passed to ", list(list( #> "as_function()")), " and can thus be a\n", #> "formula describing a lambda function.")), #> "\n"), "\n", list("\n", "Condition handlers are functions established on the evaluation\n", #> "stack (see ", list(list("ctxt_stack()")), #> ") that are called by R when a condition is\n", #> "signalled (see ", list(list("cnd_signal()")), #> " and ", list(list("abort()")), " for two common signal\n", #> "functions). They come in two types:\n", list( #> "\n", list(), " Exiting handlers aborts all code currently run between\n", #> list("with_handlers()"), " and the point where the condition has been\n", #> "raised. ", list("with_handlers()"), " passes the return value of the handler\n", #> "to its caller.\n", list(), " Calling handlers, which are executed from inside the signalling\n", #> "functions. Their return values are ignored, only their side\n", #> "effects matters. Valid side effects are writing a log message, or\n", #> "jumping out of the signalling context by ", #> list("invoking a restart"), " or using ", #> list(list("return_from()")), ". If the raised\n", #> "condition was an error, this interrupts the aborting process.\n", #> "\n", "If a calling handler returns normally, it effectively declines to\n", #> "handle the condition and other handlers on the stack (calling or\n", #> "exiting) are given a chance to handle the condition.\n"), #> "\n", "\n", "Handlers are exiting by default, use ", #> list(list("calling()")), " to create a\n", #> "calling handler.\n"), "\n", list(list("Life cycle"), #> list("\n", " ", list("exiting()"), " is soft-deprecated as of rlang\n", #> "0.4.0 because ", list(list("with_handlers()")), #> " now treats handlers as exiting by\n", "default.\n")), #> "\n", "\n", list("\n", "# Signal a condition with signal():\n", #> "fn <- function() {\n", " g()\n", " cat(\"called?\\n\")\n", #> " \"fn() return value\"\n", "}\n", "g <- function() {\n", #> " h()\n", " cat(\"called?\\n\")\n", "}\n", #> "h <- function() {\n", " signal(\"A foobar condition occurred\", \"foo\")\n", #> " cat(\"called?\\n\")\n", "}\n", "\n", "# Exiting handlers jump to with_handlers() before being\n", #> "# executed. Their return value is handed over:\n", #> "handler <- function(c) \"handler return value\"\n", #> "with_handlers(fn(), foo = handler)\n", "\n", #> "# Calling handlers are called in turn and their return value is\n", #> "# ignored. Returning just means they are declining to take charge of\n", #> "# the condition. However, they can produce side-effects such as\n", #> "# displaying a message:\n", "some_handler <- function(c) cat(\"some handler!\\n\")\n", #> "other_handler <- function(c) cat(\"other handler!\\n\")\n", #> "with_handlers(fn(), foo = calling(some_handler), foo = calling(other_handler))\n", #> "\n", "# If a calling handler jumps to an earlier context, it takes\n", #> "# charge of the condition and no other handler gets a chance to\n", #> "# deal with it. The canonical way of transferring control is by\n", #> "# jumping to a restart. See with_restarts() and restarting()\n", #> "# documentation for more on this:\n", "exiting_handler <- function(c) rst_jump(\"rst_foo\")\n", #> "fn2 <- function() {\n", " with_restarts(g(), rst_foo = function() \"restart value\")\n", #> "}\n", "with_handlers(fn2(), foo = calling(exiting_handler), foo = calling(other_handler))\n"), #> "\n"), with_restarts.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-restarts.R", #> "\n", list("with_restarts"), "\n", list("with_restarts"), #> "\n", list("Establish a restart point on the stack"), #> "\n", list("\n", "with_restarts(.expr, ...)\n"), #> "\n", list("\n", list(list(".expr"), list("An expression to execute with new restarts established\n", #> "on the stack. This argument is passed by expression and supports\n", #> list("unquoting"), ". It is evaluated in a context where\n", #> "restarts are established.")), "\n", "\n", #> list(list("..."), list("<", list("dynamic"), #> "> Named restart functions. The\n", "name is taken as the restart name and the function is executed\n", #> "after the jump.")), "\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "Restart points are named functions that are established with\n", #> list("with_restarts()"), ". Once established, you can interrupt the normal\n", #> "execution of R code, jump to the restart, and resume execution from\n", #> "there. Each restart is established along with a restart function\n", #> "that is executed after the jump and that provides a return value\n", #> "from the establishing point (i.e., a return value for\n", #> list("with_restarts()"), ").\n"), "\n", list( #> "\n", "Restarts are not the only way of jumping to a previous call frame\n", #> "(see ", list(list("return_from()")), " or ", #> list(list("return_to()")), "). However, they have the\n", #> "advantage of being callable by name once established.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "All the restart functions are in the questioning stage. It is not\n", #> "clear yet whether we want to recommend restarts as a style of\n", #> "programming in R.\n")), "\n", "\n", list("\n", #> "# Restarts are not the only way to jump to a previous frame, but\n", #> "# they have the advantage of being callable by name:\n", #> "fn <- function() with_restarts(g(), my_restart = function() \"returned\")\n", #> "g <- function() h()\n", "h <- function() { rst_jump(\"my_restart\"); \"not returned\" }\n", #> "fn()\n", "\n", "# Whereas a non-local return requires to manually pass the calling\n", #> "# frame to the return function:\n", "fn <- function() g(current_env())\n", #> "g <- function(env) h(env)\n", "h <- function(env) { return_from(env, \"returned\"); \"not returned\" }\n", #> "fn()\n", "\n", "\n", "# rst_maybe_jump() checks that a restart exists before trying to jump:\n", #> "fn <- function() {\n", " g()\n", " cat(\"will this be called?\\n\")\n", #> "}\n", "g <- function() {\n", " rst_maybe_jump(\"my_restart\")\n", #> " cat(\"will this be called?\\n\")\n", "}\n", #> "\n", "# Here no restart are on the stack:\n", #> "fn()\n", "\n", "# If a restart point called `my_restart` was established on the\n", #> "# stack before calling fn(), the control flow will jump there:\n", #> "rst <- function() {\n", " cat(\"restarting...\\n\")\n", #> " \"return value\"\n", "}\n", "with_restarts(fn(), my_restart = rst)\n", #> "\n", "\n", "# Restarts are particularly useful to provide alternative default\n", #> "# values when the normal output cannot be computed:\n", #> "\n", "fn <- function(valid_input) {\n", " if (valid_input) {\n", #> " return(\"normal value\")\n", " }\n", #> "\n", " # We decide to return the empty string \"\" as default value. An\n", #> " # altenative strategy would be to signal an error. In any case,\n", #> " # we want to provide a way for the caller to get a different\n", #> " # output. For this purpose, we provide two restart functions that\n", #> " # returns alternative defaults:\n", " restarts <- list(\n", #> " rst_empty_chr = function() character(0),\n", #> " rst_null = function() NULL\n", " )\n", #> "\n", " with_restarts(splice(restarts), .expr = {\n", #> "\n", " # Signal a typed condition to let the caller know that we are\n", #> " # about to return an empty string as default value:\n", #> " cnd_signal(\"default_empty_string\")\n", #> "\n", " # If no jump to with_restarts, return default value:\n", #> " \"\"\n", " })\n", "}\n", "\n", "# Normal value for valid input:\n", #> "fn(TRUE)\n", "\n", "# Default value for bad input:\n", #> "fn(FALSE)\n", "\n", "# Change the default value if you need an empty character vector by\n", #> "# defining a calling handler that jumps to the restart. It has to\n", #> "# be calling because exiting handlers jump to the place where they\n", #> "# are established before being executed, and the restart is not\n", #> "# defined anymore at that point:\n", "rst_handler <- calling(function(c) rst_jump(\"rst_empty_chr\"))\n", #> "with_handlers(fn(FALSE), default_empty_string = rst_handler)\n", #> "\n", "# You can use restarting() to create restarting handlers easily:\n", #> "with_handlers(fn(FALSE), default_empty_string = restarting(\"rst_null\"))\n"), #> "\n", list("\n", list(list("return_from()")), #> " and ", list(list("return_to()")), " for a more flexible way\n", #> "of performing a non-local jump to an arbitrary call frame.\n"), #> "\n", list("internal"), "\n"), wref_key.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/weakref.R", #> "\n", list("wref_key"), "\n", list("wref_key"), #> "\n", list("wref_value"), "\n", list("Get key/value from a weak reference object"), #> "\n", list("\n", "wref_key(x)\n", "\n", "wref_value(x)\n"), #> "\n", list("\n", list(list("x"), list("A weak reference object.")), #> "\n"), "\n", list("\n", "Get key/value from a weak reference object\n"), #> "\n", list("\n", list(list("is_weakref()")), #> " and ", list(list("new_weakref()")), ".\n"), #> "\n"), zap.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/s3.R", #> "\n", list("zap"), "\n", list("zap"), "\n", list( #> "is_zap"), "\n", list("Create zap objects"), #> "\n", list("\n", "zap()\n", "\n", "is_zap(x)\n"), #> "\n", list("\n", list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", list("zap()"), " creates a sentinel object that indicates that an object\n", #> "should be removed. For instance, named zaps instruct ", #> list(list("env_bind()")), "\n", "and ", list( #> list("call_modify()")), " to remove those objects from the environment or\n", #> "the call.\n", "\n", "The advantage of zap objects is that they unambiguously signal the\n", #> "intent of removing an object. Sentinels like ", #> list("NULL"), " or\n", list(list("missing_arg()")), #> " are ambiguous because they represent valid R\n", #> "objects.\n"), "\n", list("\n", "# Create one zap object:\n", #> "zap()\n", "\n", "# Create a list of zaps:\n", #> "rep(list(zap()), 3)\n", "rep_named(c(\"foo\", \"bar\"), list(zap()))\n"), #> "\n"), zap_srcref.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("zap_srcref"), "\n", list("zap_srcref"), #> "\n", list("Zap source references"), "\n", list( #> "\n", "zap_srcref(x)\n"), "\n", list("\n", #> list(list("x"), list("An R object. Functions and calls are walked recursively.")), #> "\n"), "\n", list("\n", "There are a number of situations where R creates source references:\n", #> list("\n", list(), " Reading R code from a file with ", #> list("source()"), " and ", list("parse()"), #> " might save\n", "source references inside calls to ", #> list("function"), " and ", list("{"), ".\n", #> list(), " ", list(list("sys.call()")), " includes a source reference if possible.\n", #> list(), " Creating a closure stores the source reference from the call to\n", #> list("function"), ", if any.\n"), "\n", "\n", #> "These source references take up space and might cause a number of\n", #> "issues. ", list("zap_srcref()"), " recursively walks through expressions and\n", #> "functions to remove all source references.\n"), #> "\n")), source = list(abort.Rd = c("R/cnd-abort.R", #> "R/cnd-signal.R"), are_na.Rd = "R/vec-na.R", arg_match.Rd = "R/arg.R", #> as_box.Rd = "R/s3.R", as_bytes.Rd = "R/utils-encoding.R", #> as_data_mask.Rd = "R/eval-tidy.R", as_env.Rd = "R/lifecycle-retired.R", #> as_environment.Rd = "R/env.R", as_function.Rd = "R/fn.R", #> as_label.Rd = "R/deparse.R", as_name.Rd = "R/deparse.R", #> as_overscope.Rd = "R/lifecycle-retired.R", as_pairlist.Rd = "R/node.R", #> as_quosure.Rd = "R/quo.R", as_string.Rd = "R/sym.R", #> as_utf8_character.Rd = "R/utils-encoding.R", `bare-type-predicates.Rd` = "R/types.R", #> box.Rd = "R/s3.R", call2.Rd = "R/call.R", call_args.Rd = "R/call.R", #> call_fn.Rd = "R/call.R", call_inspect.Rd = "R/stack.R", #> call_modify.Rd = "R/call.R", call_name.Rd = "R/call.R", #> call_parse_type.Rd = "R/call.R", call_standardise.Rd = "R/call.R", #> caller_env.Rd = "R/env-special.R", caller_fn.Rd = "R/stack.R", #> caller_frame.Rd = "R/lifecycle-retired.R", catch_cnd.Rd = "R/cnd-handlers.R", #> chr_unserialise_unicode.Rd = "R/utils-encoding.R", #> cnd.Rd = c("R/cnd-error.R", "R/cnd.R"), cnd_message.Rd = "R/cnd-message.R", #> cnd_muffle.Rd = "R/cnd-handlers.R", cnd_signal.Rd = "R/cnd-signal.R", #> cnd_type.Rd = "R/cnd.R", done.Rd = "R/s3.R", dots_definitions.Rd = "R/dots.R", #> dots_n.Rd = "R/dots.R", dots_values.Rd = "R/dots.R", #> duplicate.Rd = "R/sexp.R", `dyn-dots.Rd` = "R/dots.R", #> empty_env.Rd = "R/env-special.R", enquo0.Rd = "R/nse-defuse.R", #> entrace.Rd = "R/cnd-entrace.R", env.Rd = "R/env.R", #> env_bind.Rd = "R/env-binding.R", env_bind_exprs.Rd = "R/lifecycle-retired.R", #> env_binding_are_active.Rd = "R/env-binding.R", env_binding_lock.Rd = "R/env-binding.R", #> env_browse.Rd = "R/env.R", env_bury.Rd = "R/lifecycle-retired.R", #> env_clone.Rd = "R/env.R", env_depth.Rd = "R/env.R", #> env_get.Rd = "R/env-binding.R", env_has.Rd = "R/env-binding.R", #> env_inherits.Rd = "R/env.R", env_lock.Rd = "R/env.R", #> env_name.Rd = "R/env-special.R", env_names.Rd = "R/env-binding.R", #> env_parent.Rd = "R/env.R", env_poke.Rd = "R/env-binding.R", #> env_print.Rd = "R/env.R", env_unbind.Rd = "R/env-binding.R", #> env_unlock.Rd = "R/env.R", eval_bare.Rd = "R/eval.R", #> eval_tidy.Rd = "R/eval-tidy.R", exec.Rd = "R/eval.R", #> exiting.Rd = "R/lifecycle-retired.R", expr_interp.Rd = "R/nse-force.R", #> expr_label.Rd = "R/expr.R", expr_print.Rd = "R/expr.R", #> exprs_auto_name.Rd = "R/nse-defuse.R", f_rhs.Rd = "R/formula.R", #> f_text.Rd = "R/formula.R", `faq-options.Rd` = "R/faq.R", #> flatten.Rd = "R/vec-squash.R", fn_body.Rd = "R/fn.R", #> fn_env.Rd = "R/fn.R", fn_fmls.Rd = "R/fn.R", format_error_bullets.Rd = "R/cnd-message.R", #> frame_position.Rd = "R/lifecycle-retired.R", friendly_type.Rd = "R/types.R", #> get_env.Rd = "R/env.R", has_length.Rd = "R/attr.R", #> has_name.Rd = "R/attr.R", hash.Rd = "R/hash.R", inherits_any.Rd = "R/s3.R", #> inject.Rd = "R/eval.R", invoke.Rd = "R/eval.R", is_call.Rd = "R/call.R", #> is_callable.Rd = "R/call.R", is_condition.Rd = "R/cnd.R", #> is_copyable.Rd = "R/types.R", is_empty.Rd = "R/types.R", #> is_env.Rd = "R/lifecycle-retired.R", is_environment.Rd = "R/types.R", #> is_expr.Rd = "R/lifecycle-retired.R", is_expression.Rd = "R/expr.R", #> is_formula.Rd = "R/formula.R", is_frame.Rd = "R/lifecycle-retired.R", #> is_function.Rd = "R/fn.R", is_installed.Rd = "R/env-special.R", #> is_integerish.Rd = "R/types.R", is_interactive.Rd = "R/state.R", #> is_lang.Rd = "R/lifecycle-retired.R", is_named.Rd = "R/attr.R", #> is_namespace.Rd = "R/env-special.R", is_pairlist.Rd = "R/node.R", #> is_reference.Rd = "R/types.R", is_stack.Rd = "R/lifecycle-retired.R", #> is_symbol.Rd = "R/sym.R", is_true.Rd = "R/types.R", #> is_weakref.Rd = "R/weakref.R", lang.Rd = "R/lifecycle-retired.R", #> lang_head.Rd = "R/lifecycle-retired.R", lang_modify.Rd = "R/lifecycle-retired.R", #> last_error.Rd = "R/cnd-abort.R", lifecycle.Rd = "R/lifecycle.R", #> list2.Rd = "R/dots.R", local_bindings.Rd = "R/env-binding.R", #> local_options.Rd = "R/state.R", missing.Rd = "R/vec-na.R", #> missing_arg.Rd = "R/arg.R", mut_node_car.Rd = "R/lifecycle-retired.R", #> names2.Rd = "R/attr.R", `new-vector-along-retired.Rd` = "R/lifecycle-retired.R", #> `new-vector.Rd` = "R/vec-new.R", new_call.Rd = "R/node.R", #> new_formula.Rd = "R/formula.R", new_function.Rd = "R/fn.R", #> new_node.Rd = "R/node.R", new_quosures.Rd = "R/quo.R", #> new_weakref.Rd = "R/weakref.R", ns_env.Rd = "R/env-special.R", #> `nse-defuse.Rd` = "R/nse-defuse.R", `nse-force.Rd` = "R/nse-force.R", #> `op-definition.Rd` = "R/operators.R", `op-get-attr.Rd` = "R/operators.R", #> `op-na-default.Rd` = "R/operators.R", `op-null-default.Rd` = "R/operators.R", #> overscope_eval_next.Rd = "R/lifecycle-retired.R", #> pairlist2.Rd = "R/call.R", parse_expr.Rd = "R/parse.R", #> parse_quosure.Rd = "R/lifecycle-retired.R", prepend.Rd = "R/lifecycle-retired.R", #> prim_name.Rd = "R/fn.R", quo_expr.Rd = "R/lifecycle-retired.R", #> quo_label.Rd = "R/quo.R", quo_squash.Rd = "R/quo.R", #> quosure.Rd = "R/quo.R", raw_deparse_str.Rd = "R/raw.R", #> rep_along.Rd = "R/vec-new.R", restarting.Rd = "R/cnd-handlers.R", #> return_from.Rd = "R/stack.R", rlang_backtrace_on_error.Rd = "R/cnd-abort.R", #> rst_abort.Rd = "R/cnd-restarts.R", rst_list.Rd = "R/cnd-restarts.R", #> `scalar-type-predicates.Rd` = "R/types.R", scoped_env.Rd = "R/lifecycle-retired.R", #> scoped_interactive.Rd = "R/lifecycle-retired.R", #> search_envs.Rd = "R/env-special.R", seq2.Rd = "R/vec.R", #> set_attrs.Rd = "R/lifecycle-retired.R", set_expr.Rd = "R/expr.R", #> set_names.Rd = "R/attr.R", splice.Rd = "R/dots.R", #> stack.Rd = "R/lifecycle-retired.R", stack_trim.Rd = "R/lifecycle-retired.R", #> string.Rd = "R/utils-encoding.R", switch_type.Rd = "R/lifecycle-retired.R", #> sym.Rd = "R/sym.R", `tidyeval-data.Rd` = "R/eval-tidy.R", #> trace_back.Rd = "R/trace.R", `type-predicates.Rd` = "R/types.R", #> type_of.Rd = "R/lifecycle-retired.R", vec_poke_n.Rd = "R/vec.R", #> `vector-coercion.Rd` = "R/lifecycle-retired.R", `vector-construction.Rd` = "R/vec-new.R", #> `vector-old-ctors.Rd` = "R/lifecycle-retired.R", #> with_abort.Rd = "R/cnd-entrace.R", with_env.Rd = "R/eval.R", #> with_handlers.Rd = "R/cnd-handlers.R", with_restarts.Rd = "R/cnd-restarts.R", #> wref_key.Rd = "R/weakref.R", zap.Rd = "R/s3.R", zap_srcref.Rd = "R/attr.R"), #> keywords = list(character(0), "internal", character(0), #> character(0), "internal", character(0), "internal", #> character(0), character(0), character(0), character(0), #> "internal", "internal", character(0), character(0), #> "internal", character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), "internal", character(0), character(0), #> "internal", "internal", character(0), "internal", #> "internal", character(0), "internal", character(0), #> "internal", character(0), "internal", "internal", #> "internal", "internal", character(0), character(0), #> character(0), character(0), character(0), character(0), #> "internal", "internal", "internal", character(0), #> "internal", character(0), character(0), character(0), #> character(0), character(0), "internal", character(0), #> character(0), character(0), character(0), character(0), #> character(0), "internal", character(0), character(0), #> character(0), "internal", character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), "internal", character(0), character(0), #> character(0), character(0), "internal", "internal", #> character(0), "internal", character(0), character(0), #> character(0), character(0), "internal", character(0), #> "internal", "internal", "internal", character(0), #> "internal", character(0), "internal", character(0), #> character(0), "internal", character(0), character(0), #> character(0), character(0), "internal", character(0), #> character(0), "internal", "internal", "internal", #> character(0), character(0), character(0), "internal", #> "internal", "internal", character(0), "internal", #> character(0), character(0), "experimental", c("datasets", #> "internal"), character(0), "internal", character(0), #> "internal", "internal", "internal", character(0), #> character(0), "internal", character(0), "experimental", #> "internal", character(0), character(0), "internal", #> character(0), character(0), character(0), "internal", #> character(0), character(0), "internal", "internal", #> "internal", "internal", character(0), character(0), #> character(0), character(0), character(0), "internal", #> "internal", character(0), "internal", "internal", #> character(0), "internal", character(0), "internal", #> character(0), "internal", character(0), character(0), #> "internal", "internal", "internal", "internal", "internal", #> character(0), "datasets", character(0), character(0), #> "internal", "internal", "internal", character(0), #> "internal", character(0), "internal", character(0), #> "internal", character(0), character(0), character(0)), #> concepts = list(character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0)), #> internal = c(FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, #> TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, #> FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, #> FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, #> TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, #> TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, #> TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, #> FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, #> TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, #> FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, #> FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, #> FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, #> TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, #> TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, #> TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, #> FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, #> FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, #> FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, #> FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, #> TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, #> TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, #> TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, #> FALSE, FALSE, FALSE)), tutorials = list(name = character(0), #> file_out = character(0), title = character(0), pagetitle = character(0), #> url = character(0)), vignettes = list(name = character(0), #> file_in = character(0), file_out = character(0), title = character(0), #> description = character(0))), examples = TRUE, run_dont_run = FALSE, #> seed = 1014, lazy = FALSE, override = list(), install = FALSE, #> preview = FALSE, new_process = FALSE, devel = FALSE, crayon_enabled = TRUE, #> crayon_colors = 256L, pkgdown_internet = TRUE)), envir = base::quote(<environment>), #> quote = base::quote(TRUE)) #> #> [[12]] #> (function (..., crayon_enabled, crayon_colors, pkgdown_internet) #> { #> options(crayon.enabled = crayon_enabled, crayon.colors = crayon_colors, #> pkgdown.internet = pkgdown_internet) #> pkgdown::build_site(...) #> })(pkg = base::quote(list(package = "rlang", version = "0.4.12", #> src_path = "/tmp/RtmpVTMEEO/rlang-0.4.12", dst_path = "/tmp/RtmpVTMEEO/rlang-0.4.12/docs", #> install_metadata = FALSE, desc = <environment>, meta = list( #> url = "mpn.metworx.com/packages/rlang/0.4.12", home = list( #> links = list(list(text = "Programming with dplyr", #> href = "https://dplyr.tidyverse.org/articles/programming.html"), #> list(text = "Using ggplot2 in packages", href = "https://ggplot2.tidyverse.org/articles/ggplot2-in-packages.html"))), #> navbar = list(structure = list(left = c("home", "reference", #> "lifecycle", "news"), right = "github"), components = list( #> lifecycle = list(text = "Life cycle", href = "reference/lifecycle.html"), #> news = list(text = "News", menu = list(list(text = "Release notes"), #> list(text = "Version 0.4.3", href = "https://www.tidyverse.org/blog/2020/02/glue-strings-and-tidy-eval/"), #> list(text = "Version 0.4.0", href = "https://www.tidyverse.org/articles/2019/06/rlang-0-4-0/"), #> list(text = "Version 0.3.1", href = "https://www.tidyverse.org/articles/2019/01/rlang-0-3-1/"), #> list(text = "Version 0.3.0", href = "https://www.tidyverse.org/articles/2018/10/rlang-0-3-0/"), #> list(text = "Version 0.2.0", href = "https://www.tidyverse.org/articles/2018/03/rlang-0.2.0/"), #> list(text = "------------------"), list(text = "Change log", #> href = "news/index.html"))))), reference = list( #> list(title = "Tidy evaluation", desc = "Quote arguments and expressions with unquoting support. The quosure variants wrap an environment with the expression.\n", #> contents = c("quo", "quos", "enquo", "enquos", #> "expr", "exprs", "enexpr", "enexprs", "nse-force", #> "nse-defuse", "as_label", "as_name")), list(title = "Tidy dots", #> desc = "Collect arguments contained in `...` with `!!!` and name-unquoting support.\n", #> contents = c("dyn-dots", "list2", "dots_list", #> "pairlist2")), list(title = "Errors, conditions, and backtraces", #> contents = c("abort", "warn", "inform", "signal", #> "cnd_message", "format_error_bullets", "trace_back", #> "with_abort", "entrace", "cnd_signal", "last_error", #> "rlang_backtrace_on_error", "catch_cnd")), list( #> title = "Evaluate expressions", contents = c("eval_tidy", #> "eval_bare", "exec")), list(title = "Symbols", #> contents = c("sym", "syms", "is_symbol", "as_string" #> )), list(title = "Calls", contents = c("starts_with(\"call_\")", #> "call2", "is_call")), list(title = "Expressions", #> contents = c("starts_with(\"expr_\")", "starts_with(\"exprs_\")", #> "starts_with(\"parse_\")", "is_expression", "is_symbolic", #> "expr_text", "expr_label", "expr_name", "set_expr", #> "get_expr")), list(title = "Quosures", contents = c("starts_with(\"quo_\")", #> "new_quosure", "is_quosure", "as_quosure", "is_quosures", #> "quos_auto_name")), list(title = "Formulas", contents = c("starts_with(\"f_\")", #> "new_formula", "is_formula", "is_bare_formula")), #> list(title = "Functions", contents = c("starts_with(\"fn_\")", #> "new_function", "is_function", "is_closure", "is_primitive", #> "as_function", "as_closure")), list(title = "Environments", #> contents = c("env", "new_environment", "env_print", #> "env_parent", "env_tail", "env_parents", "env_depth", #> "get_env", "set_env", "env_clone", "env_inherits", #> "is_environment", "is_bare_environment", "as_environment", #> "caller_env")), list(title = "Environment bindings", #> contents = c("env_bind", "env_bind_lazy", "env_bind_active", #> "env_unbind", "env_poke", "with_bindings", "scoped_bindings", #> "env_has", "env_get", "env_get_list", "env_names", #> "env_length", "env_poke")), list(title = "Search path and namespaces", #> contents = c("search_envs", "search_env", "base_env", #> "global_env", "empty_env", "is_installed", "is_namespace", #> "ns_env", "pkg_env", "env_name", "env_label")), #> list(title = "S3", contents = c("inherits_any", "inherits_all", #> "inherits_only", "new_box", "is_box", "as_box", "as_box_if", #> "unbox", "zap", "is_zap", "done")), list(title = "Create vectors", #> desc = "Atomic vector constructors have implicit splicing (i.e. splice lists automatically), while the list constructor has explicit splicing.\n", #> contents = c("lgl", "int", "dbl", "cpl", "chr", #> "list2", "rep_along", "rep_named", "seq2", "seq2_along" #> )), list(title = "Attributes", contents = c("set_names", #> "names2", "has_name", "is_named")), list(title = "Type predicates", #> contents = c("is_list", "is_atomic", "is_vector", #> "is_integer", "is_double", "is_character", "is_logical", #> "is_raw", "is_bytes", "is_scalar_list", "is_scalar_atomic", #> "is_scalar_vector", "is_scalar_integer", "is_scalar_double", #> "is_scalar_character", "is_scalar_logical", "is_scalar_raw", #> "is_scalar_bytes", "is_bare_list", "is_bare_atomic", #> "is_bare_vector", "is_bare_double", "is_bare_integer", #> "is_bare_numeric", "is_bare_character", "is_bare_logical", #> "is_bare_raw", "is_bare_bytes", "is_empty", "is_integerish", #> "is_bare_integerish", "is_scalar_integerish", #> "is_null", "is_true", "is_false", "is_string", #> "is_bool", "is_bare_string")), list(title = "Operators", #> contents = c("`%||%`", "`%|%`", "`%@%`")), list( #> title = "Function arguments", contents = c("arg_match", #> "missing_arg", "is_missing", "maybe_missing")), #> list(title = "Create tidy evaluation APIs", desc = "Create data masking APIs à-la dplyr or tidyr. These functions are meant for developers rather than users.\n", #> contents = c("`tidyeval-data`", "eval_tidy", #> "as_data_mask", "new_data_mask", "as_data_pronoun" #> )), list(title = "Condition handlers", contents = c("with_handlers", #> "calling")), list(title = "Session state", contents = c("matches(\"interactive\")", #> "matches(\"option\")")), list(title = "Weak references", #> contents = c("matches(\"weakref\")", "matches(\"wref\")" #> )), list(title = "FAQ", contents = "matches(\"faq\")"))), #> figures = list(dev = "ragg::agg_png", dpi = 96L, dev.args = list(), #> fig.ext = "png", fig.width = 7.29166666666667, fig.height = NULL, #> fig.retina = 2L, fig.asp = 0.618046971569839, bg = NULL), #> repo = list(url = list(home = "https://github.com/r-lib/rlang/", #> source = "https://github.com/r-lib/rlang/blob/master/", #> issue = "https://github.com/r-lib/rlang/issues/", user = "https://github.com/")), #> development = list(destination = "dev", mode = "release", #> version_label = "default", version_tooltip = "Released version", #> in_dev = FALSE), topics = list(name = c(abort.Rd = "abort", #> are_na.Rd = "are_na", arg_match.Rd = "arg_match", as_box.Rd = "as_box", #> as_bytes.Rd = "as_bytes", as_data_mask.Rd = "as_data_mask", #> as_env.Rd = "as_env", as_environment.Rd = "as_environment", #> as_function.Rd = "as_function", as_label.Rd = "as_label", #> as_name.Rd = "as_name", as_overscope.Rd = "as_overscope", #> as_pairlist.Rd = "as_pairlist", as_quosure.Rd = "as_quosure", #> as_string.Rd = "as_string", as_utf8_character.Rd = "as_utf8_character", #> `bare-type-predicates.Rd` = "bare-type-predicates", box.Rd = "box", #> call2.Rd = "call2", call_args.Rd = "call_args", call_fn.Rd = "call_fn", #> call_inspect.Rd = "call_inspect", call_modify.Rd = "call_modify", #> call_name.Rd = "call_name", call_parse_type.Rd = "call_parse_type", #> call_standardise.Rd = "call_standardise", caller_env.Rd = "caller_env", #> caller_fn.Rd = "caller_fn", caller_frame.Rd = "caller_frame", #> catch_cnd.Rd = "catch_cnd", chr_unserialise_unicode.Rd = "chr_unserialise_unicode", #> cnd.Rd = "error_cnd", cnd_message.Rd = "cnd_message", cnd_muffle.Rd = "cnd_muffle", #> cnd_signal.Rd = "cnd_signal", cnd_type.Rd = "cnd_type", done.Rd = "done", #> dots_definitions.Rd = "dots_definitions", dots_n.Rd = "dots_n", #> dots_values.Rd = "dots_values", duplicate.Rd = "duplicate", #> `dyn-dots.Rd` = "dyn-dots", empty_env.Rd = "empty_env", enquo0.Rd = "enquo0", #> entrace.Rd = "entrace", env.Rd = "env", env_bind.Rd = "env_bind", #> env_bind_exprs.Rd = "env_bind_exprs", env_binding_are_active.Rd = "env_binding_are_active", #> env_binding_lock.Rd = "env_binding_lock", env_browse.Rd = "env_browse", #> env_bury.Rd = "env_bury", env_clone.Rd = "env_clone", env_depth.Rd = "env_depth", #> env_get.Rd = "env_get", env_has.Rd = "env_has", env_inherits.Rd = "env_inherits", #> env_lock.Rd = "env_lock", env_name.Rd = "env_name", env_names.Rd = "env_names", #> env_parent.Rd = "env_parent", env_poke.Rd = "env_poke", env_print.Rd = "env_print", #> env_unbind.Rd = "env_unbind", env_unlock.Rd = "env_unlock", #> eval_bare.Rd = "eval_bare", eval_tidy.Rd = "eval_tidy", exec.Rd = "exec", #> exiting.Rd = "exiting", expr_interp.Rd = "expr_interp", expr_label.Rd = "expr_label", #> expr_print.Rd = "expr_print", exprs_auto_name.Rd = "exprs_auto_name", #> f_rhs.Rd = "f_rhs", f_text.Rd = "f_text", `faq-options.Rd` = "faq-options", #> flatten.Rd = "flatten", fn_body.Rd = "fn_body", fn_env.Rd = "fn_env", #> fn_fmls.Rd = "fn_fmls", format_error_bullets.Rd = "format_error_bullets", #> frame_position.Rd = "frame_position", friendly_type.Rd = "friendly_type", #> get_env.Rd = "get_env", has_length.Rd = "has_length", has_name.Rd = "has_name", #> hash.Rd = "hash", inherits_any.Rd = "inherits_any", inject.Rd = "inject", #> invoke.Rd = "invoke", is_call.Rd = "is_call", is_callable.Rd = "is_callable", #> is_condition.Rd = "is_condition", is_copyable.Rd = "is_copyable", #> is_empty.Rd = "is_empty", is_env.Rd = "is_env", is_environment.Rd = "is_environment", #> is_expr.Rd = "is_expr", is_expression.Rd = "is_expression", #> is_formula.Rd = "is_formula", is_frame.Rd = "is_frame", is_function.Rd = "is_function", #> is_installed.Rd = "is_installed", is_integerish.Rd = "is_integerish", #> is_interactive.Rd = "is_interactive", is_lang.Rd = "is_lang", #> is_named.Rd = "is_named", is_namespace.Rd = "is_namespace", #> is_pairlist.Rd = "is_pairlist", is_reference.Rd = "is_reference", #> is_stack.Rd = "is_stack", is_symbol.Rd = "is_symbol", is_true.Rd = "is_true", #> is_weakref.Rd = "is_weakref", lang.Rd = "lang", lang_head.Rd = "lang_head", #> lang_modify.Rd = "lang_modify", last_error.Rd = "last_error", #> lifecycle.Rd = "lifecycle", list2.Rd = "list2", local_bindings.Rd = "local_bindings", #> local_options.Rd = "local_options", missing.Rd = "missing", #> missing_arg.Rd = "missing_arg", mut_node_car.Rd = "mut_node_car", #> names2.Rd = "names2", `new-vector-along-retired.Rd` = "new-vector-along-retired", #> `new-vector.Rd` = "new-vector", new_call.Rd = "new_call", #> new_formula.Rd = "new_formula", new_function.Rd = "new_function", #> new_node.Rd = "new_node", new_quosures.Rd = "new_quosures", #> new_weakref.Rd = "new_weakref", ns_env.Rd = "ns_env", `nse-defuse.Rd` = "nse-defuse", #> `nse-force.Rd` = "nse-force", `op-definition.Rd` = "op-definition", #> `op-get-attr.Rd` = "op-get-attr", `op-na-default.Rd` = "op-na-default", #> `op-null-default.Rd` = "op-null-default", overscope_eval_next.Rd = "overscope_eval_next", #> pairlist2.Rd = "pairlist2", parse_expr.Rd = "parse_expr", #> parse_quosure.Rd = "parse_quosure", prepend.Rd = "prepend", #> prim_name.Rd = "prim_name", quo_expr.Rd = "quo_expr", quo_label.Rd = "quo_label", #> quo_squash.Rd = "quo_squash", quosure.Rd = "quosure", raw_deparse_str.Rd = "raw_deparse_str", #> rep_along.Rd = "rep_along", restarting.Rd = "restarting", #> return_from.Rd = "return_from", rlang_backtrace_on_error.Rd = "rlang_backtrace_on_error", #> rst_abort.Rd = "rst_abort", rst_list.Rd = "rst_list", `scalar-type-predicates.Rd` = "scalar-type-predicates", #> scoped_env.Rd = "scoped_env", scoped_interactive.Rd = "scoped_interactive", #> search_envs.Rd = "search_envs", seq2.Rd = "seq2", set_attrs.Rd = "set_attrs", #> set_expr.Rd = "set_expr", set_names.Rd = "set_names", splice.Rd = "splice", #> stack.Rd = "stack", stack_trim.Rd = "stack_trim", string.Rd = "string", #> switch_type.Rd = "switch_type", sym.Rd = "sym", `tidyeval-data.Rd` = "tidyeval-data", #> trace_back.Rd = "trace_back", `type-predicates.Rd` = "type-predicates", #> type_of.Rd = "type_of", vec_poke_n.Rd = "vec_poke_n", `vector-coercion.Rd` = "vector-coercion", #> `vector-construction.Rd` = "vector-construction", `vector-old-ctors.Rd` = "node", #> with_abort.Rd = "with_abort", with_env.Rd = "with_env", with_handlers.Rd = "with_handlers", #> with_restarts.Rd = "with_restarts", wref_key.Rd = "wref_key", #> zap.Rd = "zap", zap_srcref.Rd = "zap_srcref"), file_in = c("abort.Rd", #> "are_na.Rd", "arg_match.Rd", "as_box.Rd", "as_bytes.Rd", #> "as_data_mask.Rd", "as_env.Rd", "as_environment.Rd", "as_function.Rd", #> "as_label.Rd", "as_name.Rd", "as_overscope.Rd", "as_pairlist.Rd", #> "as_quosure.Rd", "as_string.Rd", "as_utf8_character.Rd", #> "bare-type-predicates.Rd", "box.Rd", "call2.Rd", "call_args.Rd", #> "call_fn.Rd", "call_inspect.Rd", "call_modify.Rd", "call_name.Rd", #> "call_parse_type.Rd", "call_standardise.Rd", "caller_env.Rd", #> "caller_fn.Rd", "caller_frame.Rd", "catch_cnd.Rd", "chr_unserialise_unicode.Rd", #> "cnd.Rd", "cnd_message.Rd", "cnd_muffle.Rd", "cnd_signal.Rd", #> "cnd_type.Rd", "done.Rd", "dots_definitions.Rd", "dots_n.Rd", #> "dots_values.Rd", "duplicate.Rd", "dyn-dots.Rd", "empty_env.Rd", #> "enquo0.Rd", "entrace.Rd", "env.Rd", "env_bind.Rd", "env_bind_exprs.Rd", #> "env_binding_are_active.Rd", "env_binding_lock.Rd", "env_browse.Rd", #> "env_bury.Rd", "env_clone.Rd", "env_depth.Rd", "env_get.Rd", #> "env_has.Rd", "env_inherits.Rd", "env_lock.Rd", "env_name.Rd", #> "env_names.Rd", "env_parent.Rd", "env_poke.Rd", "env_print.Rd", #> "env_unbind.Rd", "env_unlock.Rd", "eval_bare.Rd", "eval_tidy.Rd", #> "exec.Rd", "exiting.Rd", "expr_interp.Rd", "expr_label.Rd", #> "expr_print.Rd", "exprs_auto_name.Rd", "f_rhs.Rd", "f_text.Rd", #> "faq-options.Rd", "flatten.Rd", "fn_body.Rd", "fn_env.Rd", #> "fn_fmls.Rd", "format_error_bullets.Rd", "frame_position.Rd", #> "friendly_type.Rd", "get_env.Rd", "has_length.Rd", "has_name.Rd", #> "hash.Rd", "inherits_any.Rd", "inject.Rd", "invoke.Rd", "is_call.Rd", #> "is_callable.Rd", "is_condition.Rd", "is_copyable.Rd", "is_empty.Rd", #> "is_env.Rd", "is_environment.Rd", "is_expr.Rd", "is_expression.Rd", #> "is_formula.Rd", "is_frame.Rd", "is_function.Rd", "is_installed.Rd", #> "is_integerish.Rd", "is_interactive.Rd", "is_lang.Rd", "is_named.Rd", #> "is_namespace.Rd", "is_pairlist.Rd", "is_reference.Rd", "is_stack.Rd", #> "is_symbol.Rd", "is_true.Rd", "is_weakref.Rd", "lang.Rd", #> "lang_head.Rd", "lang_modify.Rd", "last_error.Rd", "lifecycle.Rd", #> "list2.Rd", "local_bindings.Rd", "local_options.Rd", "missing.Rd", #> "missing_arg.Rd", "mut_node_car.Rd", "names2.Rd", "new-vector-along-retired.Rd", #> "new-vector.Rd", "new_call.Rd", "new_formula.Rd", "new_function.Rd", #> "new_node.Rd", "new_quosures.Rd", "new_weakref.Rd", "ns_env.Rd", #> "nse-defuse.Rd", "nse-force.Rd", "op-definition.Rd", "op-get-attr.Rd", #> "op-na-default.Rd", "op-null-default.Rd", "overscope_eval_next.Rd", #> "pairlist2.Rd", "parse_expr.Rd", "parse_quosure.Rd", "prepend.Rd", #> "prim_name.Rd", "quo_expr.Rd", "quo_label.Rd", "quo_squash.Rd", #> "quosure.Rd", "raw_deparse_str.Rd", "rep_along.Rd", "restarting.Rd", #> "return_from.Rd", "rlang_backtrace_on_error.Rd", "rst_abort.Rd", #> "rst_list.Rd", "scalar-type-predicates.Rd", "scoped_env.Rd", #> "scoped_interactive.Rd", "search_envs.Rd", "seq2.Rd", "set_attrs.Rd", #> "set_expr.Rd", "set_names.Rd", "splice.Rd", "stack.Rd", "stack_trim.Rd", #> "string.Rd", "switch_type.Rd", "sym.Rd", "tidyeval-data.Rd", #> "trace_back.Rd", "type-predicates.Rd", "type_of.Rd", "vec_poke_n.Rd", #> "vector-coercion.Rd", "vector-construction.Rd", "vector-old-ctors.Rd", #> "with_abort.Rd", "with_env.Rd", "with_handlers.Rd", "with_restarts.Rd", #> "wref_key.Rd", "zap.Rd", "zap_srcref.Rd"), file_out = c("abort.html", #> "are_na.html", "arg_match.html", "as_box.html", "as_bytes.html", #> "as_data_mask.html", "as_env.html", "as_environment.html", #> "as_function.html", "as_label.html", "as_name.html", "as_overscope.html", #> "as_pairlist.html", "as_quosure.html", "as_string.html", #> "as_utf8_character.html", "bare-type-predicates.html", "box.html", #> "call2.html", "call_args.html", "call_fn.html", "call_inspect.html", #> "call_modify.html", "call_name.html", "call_parse_type.html", #> "call_standardise.html", "caller_env.html", "caller_fn.html", #> "caller_frame.html", "catch_cnd.html", "chr_unserialise_unicode.html", #> "cnd.html", "cnd_message.html", "cnd_muffle.html", "cnd_signal.html", #> "cnd_type.html", "done.html", "dots_definitions.html", "dots_n.html", #> "dots_values.html", "duplicate.html", "dyn-dots.html", "empty_env.html", #> "enquo0.html", "entrace.html", "env.html", "env_bind.html", #> "env_bind_exprs.html", "env_binding_are_active.html", "env_binding_lock.html", #> "env_browse.html", "env_bury.html", "env_clone.html", "env_depth.html", #> "env_get.html", "env_has.html", "env_inherits.html", "env_lock.html", #> "env_name.html", "env_names.html", "env_parent.html", "env_poke.html", #> "env_print.html", "env_unbind.html", "env_unlock.html", "eval_bare.html", #> "eval_tidy.html", "exec.html", "exiting.html", "expr_interp.html", #> "expr_label.html", "expr_print.html", "exprs_auto_name.html", #> "f_rhs.html", "f_text.html", "faq-options.html", "flatten.html", #> "fn_body.html", "fn_env.html", "fn_fmls.html", "format_error_bullets.html", #> "frame_position.html", "friendly_type.html", "get_env.html", #> "has_length.html", "has_name.html", "hash.html", "inherits_any.html", #> "inject.html", "invoke.html", "is_call.html", "is_callable.html", #> "is_condition.html", "is_copyable.html", "is_empty.html", #> "is_env.html", "is_environment.html", "is_expr.html", "is_expression.html", #> "is_formula.html", "is_frame.html", "is_function.html", "is_installed.html", #> "is_integerish.html", "is_interactive.html", "is_lang.html", #> "is_named.html", "is_namespace.html", "is_pairlist.html", #> "is_reference.html", "is_stack.html", "is_symbol.html", "is_true.html", #> "is_weakref.html", "lang.html", "lang_head.html", "lang_modify.html", #> "last_error.html", "lifecycle.html", "list2.html", "local_bindings.html", #> "local_options.html", "missing.html", "missing_arg.html", #> "mut_node_car.html", "names2.html", "new-vector-along-retired.html", #> "new-vector.html", "new_call.html", "new_formula.html", "new_function.html", #> "new_node.html", "new_quosures.html", "new_weakref.html", #> "ns_env.html", "nse-defuse.html", "nse-force.html", "op-definition.html", #> "op-get-attr.html", "op-na-default.html", "op-null-default.html", #> "overscope_eval_next.html", "pairlist2.html", "parse_expr.html", #> "parse_quosure.html", "prepend.html", "prim_name.html", "quo_expr.html", #> "quo_label.html", "quo_squash.html", "quosure.html", "raw_deparse_str.html", #> "rep_along.html", "restarting.html", "return_from.html", #> "rlang_backtrace_on_error.html", "rst_abort.html", "rst_list.html", #> "scalar-type-predicates.html", "scoped_env.html", "scoped_interactive.html", #> "search_envs.html", "seq2.html", "set_attrs.html", "set_expr.html", #> "set_names.html", "splice.html", "stack.html", "stack_trim.html", #> "string.html", "switch_type.html", "sym.html", "tidyeval-data.html", #> "trace_back.html", "type-predicates.html", "type_of.html", #> "vec_poke_n.html", "vector-coercion.html", "vector-construction.html", #> "vector-old-ctors.html", "with_abort.html", "with_env.html", #> "with_handlers.html", "with_restarts.html", "wref_key.html", #> "zap.html", "zap_srcref.html"), alias = list(abort.Rd = c("abort", #> "warn", "inform", "signal", "interrupt"), are_na.Rd = c("are_na", #> "is_na", "is_lgl_na", "is_int_na", "is_dbl_na", "is_chr_na", #> "is_cpl_na"), arg_match.Rd = c("arg_match", "arg_match0"), #> as_box.Rd = c("as_box", "as_box_if"), as_bytes.Rd = "as_bytes", #> as_data_mask.Rd = c("as_data_mask", "as_data_pronoun", #> "new_data_mask"), as_env.Rd = "as_env", as_environment.Rd = "as_environment", #> as_function.Rd = c("as_function", "is_lambda", "as_closure" #> ), as_label.Rd = "as_label", as_name.Rd = "as_name", #> as_overscope.Rd = c("as_overscope", "new_overscope", #> "overscope_clean"), as_pairlist.Rd = "as_pairlist", as_quosure.Rd = c("as_quosure", #> "new_quosure"), as_string.Rd = "as_string", as_utf8_character.Rd = "as_utf8_character", #> `bare-type-predicates.Rd` = c("bare-type-predicates", #> "is_bare_list", "is_bare_atomic", "is_bare_vector", "is_bare_double", #> "is_bare_integer", "is_bare_numeric", "is_bare_character", #> "is_bare_logical", "is_bare_raw", "is_bare_string", "is_bare_bytes" #> ), box.Rd = c("box", "new_box", "is_box", "unbox"), call2.Rd = "call2", #> call_args.Rd = c("call_args", "call_args_names"), call_fn.Rd = "call_fn", #> call_inspect.Rd = "call_inspect", call_modify.Rd = "call_modify", #> call_name.Rd = c("call_name", "call_ns"), call_parse_type.Rd = "call_parse_type", #> call_standardise.Rd = "call_standardise", caller_env.Rd = c("caller_env", #> "current_env"), caller_fn.Rd = c("caller_fn", "current_fn" #> ), caller_frame.Rd = "caller_frame", catch_cnd.Rd = "catch_cnd", #> chr_unserialise_unicode.Rd = "chr_unserialise_unicode", #> cnd.Rd = c("error_cnd", "cnd", "warning_cnd", "message_cnd" #> ), cnd_message.Rd = c("cnd_message", "cnd_header", "cnd_body", #> "cnd_footer"), cnd_muffle.Rd = "cnd_muffle", cnd_signal.Rd = "cnd_signal", #> cnd_type.Rd = "cnd_type", done.Rd = c("done", "is_done_box" #> ), dots_definitions.Rd = "dots_definitions", dots_n.Rd = "dots_n", #> dots_values.Rd = "dots_values", duplicate.Rd = "duplicate", #> `dyn-dots.Rd` = c("dyn-dots", "tidy-dots"), empty_env.Rd = "empty_env", #> enquo0.Rd = c("enquo0", "enquos0"), entrace.Rd = c("entrace", #> "cnd_entrace"), env.Rd = c("env", "child_env", "new_environment" #> ), env_bind.Rd = c("env_bind", "env_bind_lazy", "env_bind_active", #> "%<~%"), env_bind_exprs.Rd = c("env_bind_exprs", "env_bind_fns" #> ), env_binding_are_active.Rd = c("env_binding_are_active", #> "env_binding_are_lazy"), env_binding_lock.Rd = c("env_binding_lock", #> "env_binding_unlock", "env_binding_are_locked"), env_browse.Rd = c("env_browse", #> "env_is_browsed"), env_bury.Rd = "env_bury", env_clone.Rd = "env_clone", #> env_depth.Rd = "env_depth", env_get.Rd = c("env_get", #> "env_get_list"), env_has.Rd = "env_has", env_inherits.Rd = "env_inherits", #> env_lock.Rd = c("env_lock", "env_is_locked"), env_name.Rd = c("env_name", #> "env_label"), env_names.Rd = c("env_names", "env_length" #> ), env_parent.Rd = c("env_parent", "env_tail", "env_parents" #> ), env_poke.Rd = "env_poke", env_print.Rd = "env_print", #> env_unbind.Rd = "env_unbind", env_unlock.Rd = "env_unlock", #> eval_bare.Rd = "eval_bare", eval_tidy.Rd = "eval_tidy", #> exec.Rd = "exec", exiting.Rd = "exiting", expr_interp.Rd = "expr_interp", #> expr_label.Rd = c("expr_label", "expr_name", "expr_text" #> ), expr_print.Rd = c("expr_print", "expr_deparse"), exprs_auto_name.Rd = c("exprs_auto_name", #> "quos_auto_name"), f_rhs.Rd = c("f_rhs", "f_rhs<-", "f_lhs", #> "f_lhs<-", "f_env", "f_env<-"), f_text.Rd = c("f_text", #> "f_name", "f_label"), `faq-options.Rd` = "faq-options", #> flatten.Rd = c("flatten", "flatten_lgl", "flatten_int", #> "flatten_dbl", "flatten_cpl", "flatten_chr", "flatten_raw", #> "squash", "squash_lgl", "squash_int", "squash_dbl", "squash_cpl", #> "squash_chr", "squash_raw", "flatten_if", "squash_if" #> ), fn_body.Rd = c("fn_body", "fn_body<-"), fn_env.Rd = c("fn_env", #> "fn_env<-"), fn_fmls.Rd = c("fn_fmls", "fn_fmls_names", #> "fn_fmls_syms", "fn_fmls<-", "fn_fmls_names<-"), format_error_bullets.Rd = "format_error_bullets", #> frame_position.Rd = "frame_position", friendly_type.Rd = "friendly_type", #> get_env.Rd = c("get_env", "set_env", "env_poke_parent" #> ), has_length.Rd = "has_length", has_name.Rd = "has_name", #> hash.Rd = "hash", inherits_any.Rd = c("inherits_any", #> "inherits_all", "inherits_only"), inject.Rd = "inject", #> invoke.Rd = "invoke", is_call.Rd = "is_call", is_callable.Rd = "is_callable", #> is_condition.Rd = "is_condition", is_copyable.Rd = "is_copyable", #> is_empty.Rd = "is_empty", is_env.Rd = c("is_env", "is_bare_env" #> ), is_environment.Rd = c("is_environment", "is_bare_environment" #> ), is_expr.Rd = "is_expr", is_expression.Rd = c("is_expression", #> "is_syntactic_literal", "is_symbolic"), is_formula.Rd = c("is_formula", #> "is_bare_formula"), is_frame.Rd = "is_frame", is_function.Rd = c("is_function", #> "is_closure", "is_primitive", "is_primitive_eager", "is_primitive_lazy" #> ), is_installed.Rd = c("is_installed", "check_installed" #> ), is_integerish.Rd = c("is_integerish", "is_bare_integerish", #> "is_scalar_integerish"), is_interactive.Rd = c("is_interactive", #> "local_interactive", "with_interactive"), is_lang.Rd = c("is_lang", #> "is_unary_lang", "is_binary_lang", "quo_is_lang"), is_named.Rd = c("is_named", #> "is_dictionaryish", "have_name"), is_namespace.Rd = "is_namespace", #> is_pairlist.Rd = c("is_pairlist", "is_node", "is_node_list" #> ), is_reference.Rd = "is_reference", is_stack.Rd = c("is_stack", #> "is_eval_stack", "is_call_stack"), is_symbol.Rd = "is_symbol", #> is_true.Rd = c("is_true", "is_false"), is_weakref.Rd = "is_weakref", #> lang.Rd = c("lang", "new_language"), lang_head.Rd = c("lang_head", #> "lang_tail"), lang_modify.Rd = c("lang_modify", "lang_standardise", #> "lang_fn", "lang_name", "lang_args", "lang_args_names" #> ), last_error.Rd = c("last_error", "last_trace"), lifecycle.Rd = "lifecycle", #> list2.Rd = c("list2", "ll", "dots_list"), local_bindings.Rd = c("local_bindings", #> "with_bindings"), local_options.Rd = c("local_options", #> "with_options", "push_options", "peek_options", "peek_option" #> ), missing.Rd = c("missing", "na_lgl", "na_int", "na_dbl", #> "na_chr", "na_cpl"), missing_arg.Rd = c("missing_arg", #> "is_missing", "maybe_missing"), mut_node_car.Rd = c("mut_node_car", #> "mut_node_cdr", "mut_node_caar", "mut_node_cadr", "mut_node_cdar", #> "mut_node_cddr", "mut_node_tag"), names2.Rd = "names2", #> `new-vector-along-retired.Rd` = c("new-vector-along-retired", #> "new_logical_along", "new_integer_along", "new_double_along", #> "new_character_along", "new_complex_along", "new_raw_along", #> "new_list_along"), `new-vector.Rd` = c("new-vector", #> "new_logical", "new_integer", "new_double", "new_character", #> "new_complex", "new_raw", "new_list"), new_call.Rd = "new_call", #> new_formula.Rd = "new_formula", new_function.Rd = "new_function", #> new_node.Rd = c("new_node", "node_car", "node_cdr", "node_caar", #> "node_cadr", "node_cdar", "node_cddr", "node_poke_car", #> "node_poke_cdr", "node_poke_caar", "node_poke_cadr", #> "node_poke_cdar", "node_poke_cddr", "node_tag", "node_poke_tag" #> ), new_quosures.Rd = c("new_quosures", "as_quosures", #> "is_quosures"), new_weakref.Rd = "new_weakref", ns_env.Rd = c("ns_env", #> "ns_imports_env", "ns_env_name"), `nse-defuse.Rd` = c("nse-defuse", #> "quotation", "expr", "enexpr", "exprs", "enexprs", "ensym", #> "ensyms", "quo", "enquo", "quos", "enquos"), `nse-force.Rd` = c("nse-force", #> "quasiquotation", "UQ", "UQS", "{{}}", "{{", "!!", "!!!", #> ":=", "qq_show"), `op-definition.Rd` = c("op-definition", #> "is_definition", "new_definition", "is_formulaish"), #> `op-get-attr.Rd` = c("op-get-attr", "%@%", "%@%<-"), #> `op-na-default.Rd` = c("op-na-default", "%|%"), `op-null-default.Rd` = c("op-null-default", #> "%||%"), overscope_eval_next.Rd = "overscope_eval_next", #> pairlist2.Rd = "pairlist2", parse_expr.Rd = c("parse_expr", #> "parse_exprs", "parse_quo", "parse_quos"), parse_quosure.Rd = c("parse_quosure", #> "parse_quosures"), prepend.Rd = c("prepend", "modify" #> ), prim_name.Rd = "prim_name", quo_expr.Rd = "quo_expr", #> quo_label.Rd = c("quo_label", "quo_text", "quo_name"), #> quo_squash.Rd = "quo_squash", quosure.Rd = c("quosure", #> "is_quosure", "quo_is_missing", "quo_is_symbol", "quo_is_call", #> "quo_is_symbolic", "quo_is_null", "quo_get_expr", "quo_get_env", #> "quo_set_expr", "quo_set_env"), raw_deparse_str.Rd = "raw_deparse_str", #> rep_along.Rd = c("rep_along", "rep_named"), restarting.Rd = "restarting", #> return_from.Rd = c("return_from", "return_to"), rlang_backtrace_on_error.Rd = c("rlang_backtrace_on_error", #> "add_backtrace"), rst_abort.Rd = "rst_abort", rst_list.Rd = c("rst_list", #> "rst_exists", "rst_jump", "rst_maybe_jump"), `scalar-type-predicates.Rd` = c("scalar-type-predicates", #> "is_scalar_list", "is_scalar_atomic", "is_scalar_vector", #> "is_scalar_integer", "is_scalar_double", "is_scalar_character", #> "is_scalar_logical", "is_scalar_raw", "is_string", "is_scalar_bytes", #> "is_bool"), scoped_env.Rd = c("scoped_env", "is_scoped", #> "scoped_envs", "scoped_names"), scoped_interactive.Rd = c("scoped_interactive", #> "scoped_options", "scoped_bindings"), search_envs.Rd = c("search_envs", #> "search_env", "pkg_env", "pkg_env_name", "is_attached", #> "base_env", "global_env"), seq2.Rd = c("seq2", "seq2_along" #> ), set_attrs.Rd = c("set_attrs", "mut_attrs"), set_expr.Rd = c("set_expr", #> "get_expr"), set_names.Rd = "set_names", splice.Rd = c("splice", #> "is_spliced", "is_spliced_bare", "dots_splice"), stack.Rd = c("stack", #> "global_frame", "current_frame", "ctxt_frame", "call_frame", #> "ctxt_depth", "call_depth", "ctxt_stack", "call_stack" #> ), stack_trim.Rd = "stack_trim", string.Rd = "string", #> switch_type.Rd = c("switch_type", "coerce_type", "switch_class", #> "coerce_class"), sym.Rd = c("sym", "syms"), `tidyeval-data.Rd` = c("tidyeval-data", #> ".data", ".env"), trace_back.Rd = c("trace_back", "trace_length" #> ), `type-predicates.Rd` = c("type-predicates", "is_list", #> "is_atomic", "is_vector", "is_integer", "is_double", #> "is_character", "is_logical", "is_raw", "is_bytes", "is_null" #> ), type_of.Rd = "type_of", vec_poke_n.Rd = c("vec_poke_n", #> "vec_poke_range"), `vector-coercion.Rd` = c("vector-coercion", #> "as_logical", "as_integer", "as_double", "as_complex", #> "as_character", "as_list"), `vector-construction.Rd` = c("vector-construction", #> "lgl", "int", "dbl", "cpl", "chr", "bytes"), `vector-old-ctors.Rd` = c("node", #> "vector-old-ctors", "lgl_len", "int_len", "dbl_len", #> "chr_len", "cpl_len", "raw_len", "bytes_len", "list_len", #> "lgl_along", "int_along", "dbl_along", "chr_along", "cpl_along", #> "raw_along", "bytes_along", "list_along"), with_abort.Rd = "with_abort", #> with_env.Rd = c("with_env", "locally"), with_handlers.Rd = c("with_handlers", #> "calling"), with_restarts.Rd = "with_restarts", wref_key.Rd = c("wref_key", #> "wref_value"), zap.Rd = c("zap", "is_zap"), zap_srcref.Rd = "zap_srcref"), #> funs = list(abort.Rd = c("abort()", "warn()", "inform()", #> "signal()", "interrupt()"), are_na.Rd = c("are_na()", #> "is_na()", "is_lgl_na()", "is_int_na()", "is_dbl_na()", #> "is_chr_na()", "is_cpl_na()"), arg_match.Rd = c("arg_match()", #> "arg_match0()"), as_box.Rd = c("as_box()", "as_box_if()" #> ), as_bytes.Rd = "as_bytes()", as_data_mask.Rd = c("as_data_mask()", #> "as_data_pronoun()", "new_data_mask()"), as_env.Rd = "as_env()", #> as_environment.Rd = "as_environment()", as_function.Rd = c("as_function()", #> "is_lambda()", "as_closure()"), as_label.Rd = "as_label()", #> as_name.Rd = "as_name()", as_overscope.Rd = c("as_overscope()", #> "new_overscope()", "overscope_clean()"), as_pairlist.Rd = "as_pairlist()", #> as_quosure.Rd = c("as_quosure()", "new_quosure()" #> ), as_string.Rd = "as_string()", as_utf8_character.Rd = "as_utf8_character()", #> `bare-type-predicates.Rd` = c("is_bare_list()", "is_bare_atomic()", #> "is_bare_vector()", "is_bare_double()", "is_bare_integer()", #> "is_bare_numeric()", "is_bare_character()", "is_bare_logical()", #> "is_bare_raw()", "is_bare_string()", "is_bare_bytes()" #> ), box.Rd = c("new_box()", "is_box()", "unbox()"), #> call2.Rd = "call2()", call_args.Rd = c("call_args()", #> "call_args_names()"), call_fn.Rd = "call_fn()", call_inspect.Rd = "call_inspect()", #> call_modify.Rd = "call_modify()", call_name.Rd = c("call_name()", #> "call_ns()"), call_parse_type.Rd = "call_parse_type()", #> call_standardise.Rd = "call_standardise()", caller_env.Rd = c("caller_env()", #> "current_env()"), caller_fn.Rd = c("caller_fn()", #> "current_fn()"), caller_frame.Rd = "caller_frame()", #> catch_cnd.Rd = "catch_cnd()", chr_unserialise_unicode.Rd = "chr_unserialise_unicode()", #> cnd.Rd = c("error_cnd()", "cnd()", "warning_cnd()", #> "message_cnd()"), cnd_message.Rd = c("cnd_message()", #> "cnd_header()", "cnd_body()", "cnd_footer()"), cnd_muffle.Rd = "cnd_muffle()", #> cnd_signal.Rd = "cnd_signal()", cnd_type.Rd = "cnd_type()", #> done.Rd = c("done()", "is_done_box()"), dots_definitions.Rd = "dots_definitions()", #> dots_n.Rd = "dots_n()", dots_values.Rd = "dots_values()", #> duplicate.Rd = "duplicate()", `dyn-dots.Rd` = character(0), #> empty_env.Rd = "empty_env()", enquo0.Rd = c("enquo0()", #> "enquos0()"), entrace.Rd = c("entrace()", "cnd_entrace()" #> ), env.Rd = c("env()", "child_env()", "new_environment()" #> ), env_bind.Rd = c("env_bind()", "env_bind_lazy()", #> "env_bind_active()", "`%<~%`"), env_bind_exprs.Rd = c("env_bind_exprs()", #> "env_bind_fns()"), env_binding_are_active.Rd = c("env_binding_are_active()", #> "env_binding_are_lazy()"), env_binding_lock.Rd = c("env_binding_lock()", #> "env_binding_unlock()", "env_binding_are_locked()" #> ), env_browse.Rd = c("env_browse()", "env_is_browsed()" #> ), env_bury.Rd = "env_bury()", env_clone.Rd = "env_clone()", #> env_depth.Rd = "env_depth()", env_get.Rd = c("env_get()", #> "env_get_list()"), env_has.Rd = "env_has()", env_inherits.Rd = "env_inherits()", #> env_lock.Rd = c("env_lock()", "env_is_locked()"), #> env_name.Rd = c("env_name()", "env_label()"), env_names.Rd = c("env_names()", #> "env_length()"), env_parent.Rd = c("env_parent()", #> "env_tail()", "env_parents()"), env_poke.Rd = "env_poke()", #> env_print.Rd = "env_print()", env_unbind.Rd = "env_unbind()", #> env_unlock.Rd = "env_unlock()", eval_bare.Rd = "eval_bare()", #> eval_tidy.Rd = "eval_tidy()", exec.Rd = "exec()", #> exiting.Rd = "exiting()", expr_interp.Rd = "expr_interp()", #> expr_label.Rd = c("expr_label()", "expr_name()", #> "expr_text()"), expr_print.Rd = c("expr_print()", #> "expr_deparse()"), exprs_auto_name.Rd = c("exprs_auto_name()", #> "quos_auto_name()"), f_rhs.Rd = c("f_rhs()", "`f_rhs<-`()", #> "f_lhs()", "`f_lhs<-`()", "f_env()", "`f_env<-`()" #> ), f_text.Rd = c("f_text()", "f_name()", "f_label()" #> ), `faq-options.Rd` = character(0), flatten.Rd = c("flatten()", #> "flatten_lgl()", "flatten_int()", "flatten_dbl()", #> "flatten_cpl()", "flatten_chr()", "flatten_raw()", #> "squash()", "squash_lgl()", "squash_int()", "squash_dbl()", #> "squash_cpl()", "squash_chr()", "squash_raw()", "flatten_if()", #> "squash_if()"), fn_body.Rd = c("fn_body()", "`fn_body<-`()" #> ), fn_env.Rd = c("fn_env()", "`fn_env<-`()"), #> fn_fmls.Rd = c("fn_fmls()", "fn_fmls_names()", "fn_fmls_syms()", #> "`fn_fmls<-`()", "`fn_fmls_names<-`()"), format_error_bullets.Rd = "format_error_bullets()", #> frame_position.Rd = "frame_position()", friendly_type.Rd = "friendly_type()", #> get_env.Rd = c("get_env()", "set_env()", "env_poke_parent()" #> ), has_length.Rd = "has_length()", has_name.Rd = "has_name()", #> hash.Rd = "hash()", inherits_any.Rd = c("inherits_any()", #> "inherits_all()", "inherits_only()"), inject.Rd = "inject()", #> invoke.Rd = "invoke()", is_call.Rd = "is_call()", #> is_callable.Rd = "is_callable()", is_condition.Rd = "is_condition()", #> is_copyable.Rd = "is_copyable()", is_empty.Rd = "is_empty()", #> is_env.Rd = c("is_env()", "is_bare_env()"), is_environment.Rd = c("is_environment()", #> "is_bare_environment()"), is_expr.Rd = "is_expr()", #> is_expression.Rd = c("is_expression()", "is_syntactic_literal()", #> "is_symbolic()"), is_formula.Rd = c("is_formula()", #> "is_bare_formula()"), is_frame.Rd = "is_frame()", #> is_function.Rd = c("is_function()", "is_closure()", #> "is_primitive()", "is_primitive_eager()", "is_primitive_lazy()" #> ), is_installed.Rd = c("is_installed()", "check_installed()" #> ), is_integerish.Rd = c("is_integerish()", "is_bare_integerish()", #> "is_scalar_integerish()"), is_interactive.Rd = c("is_interactive()", #> "local_interactive()", "with_interactive()"), is_lang.Rd = c("is_lang()", #> "is_unary_lang()", "is_binary_lang()", "quo_is_lang()" #> ), is_named.Rd = c("is_named()", "is_dictionaryish()", #> "have_name()"), is_namespace.Rd = "is_namespace()", #> is_pairlist.Rd = c("is_pairlist()", "is_node()", #> "is_node_list()"), is_reference.Rd = "is_reference()", #> is_stack.Rd = c("is_stack()", "is_eval_stack()", #> "is_call_stack()"), is_symbol.Rd = "is_symbol()", #> is_true.Rd = c("is_true()", "is_false()"), is_weakref.Rd = "is_weakref()", #> lang.Rd = c("lang()", "new_language()"), lang_head.Rd = c("lang_head()", #> "lang_tail()"), lang_modify.Rd = c("lang_modify()", #> "lang_standardise()", "lang_fn()", "lang_name()", #> "lang_args()", "lang_args_names()"), last_error.Rd = c("last_error()", #> "last_trace()"), lifecycle.Rd = character(0), list2.Rd = c("list2()", #> "dots_list()"), local_bindings.Rd = c("local_bindings()", #> "with_bindings()"), local_options.Rd = c("local_options()", #> "with_options()", "push_options()", "peek_options()", #> "peek_option()"), missing.Rd = c("na_lgl", "na_int", #> "na_dbl", "na_chr", "na_cpl"), missing_arg.Rd = c("missing_arg()", #> "is_missing()", "maybe_missing()"), mut_node_car.Rd = c("mut_node_car()", #> "mut_node_cdr()", "mut_node_caar()", "mut_node_cadr()", #> "mut_node_cdar()", "mut_node_cddr()", "mut_node_tag()" #> ), names2.Rd = "names2()", `new-vector-along-retired.Rd` = c("new_logical_along()", #> "new_integer_along()", "new_double_along()", "new_character_along()", #> "new_complex_along()", "new_raw_along()", "new_list_along()" #> ), `new-vector.Rd` = c("new_logical()", "new_integer()", #> "new_double()", "new_character()", "new_complex()", #> "new_raw()", "new_list()"), new_call.Rd = "new_call()", #> new_formula.Rd = "new_formula()", new_function.Rd = "new_function()", #> new_node.Rd = c("new_node()", "node_car()", "node_cdr()", #> "node_caar()", "node_cadr()", "node_cdar()", "node_cddr()", #> "node_poke_car()", "node_poke_cdr()", "node_poke_caar()", #> "node_poke_cadr()", "node_poke_cdar()", "node_poke_cddr()", #> "node_tag()", "node_poke_tag()"), new_quosures.Rd = c("new_quosures()", #> "as_quosures()", "is_quosures()"), new_weakref.Rd = "new_weakref()", #> ns_env.Rd = c("ns_env()", "ns_imports_env()", "ns_env_name()" #> ), `nse-defuse.Rd` = c("expr()", "enexpr()", "exprs()", #> "enexprs()", "ensym()", "ensyms()", "quo()", "enquo()", #> "quos()", "enquos()"), `nse-force.Rd` = "qq_show()", #> `op-definition.Rd` = c("is_definition()", "new_definition()", #> "is_formulaish()"), `op-get-attr.Rd` = c("`%@%`", #> "`%@%<-`()"), `op-na-default.Rd` = "`%|%`", `op-null-default.Rd` = "`%||%`", #> overscope_eval_next.Rd = "overscope_eval_next()", #> pairlist2.Rd = "pairlist2()", parse_expr.Rd = c("parse_expr()", #> "parse_exprs()", "parse_quo()", "parse_quos()"), #> parse_quosure.Rd = c("parse_quosure()", "parse_quosures()" #> ), prepend.Rd = c("prepend()", "modify()"), prim_name.Rd = "prim_name()", #> quo_expr.Rd = "quo_expr()", quo_label.Rd = c("quo_label()", #> "quo_text()", "quo_name()"), quo_squash.Rd = "quo_squash()", #> quosure.Rd = c("is_quosure()", "quo_is_missing()", #> "quo_is_symbol()", "quo_is_call()", "quo_is_symbolic()", #> "quo_is_null()", "quo_get_expr()", "quo_get_env()", #> "quo_set_expr()", "quo_set_env()"), raw_deparse_str.Rd = "raw_deparse_str()", #> rep_along.Rd = c("rep_along()", "rep_named()"), restarting.Rd = "restarting()", #> return_from.Rd = c("return_from()", "return_to()" #> ), rlang_backtrace_on_error.Rd = character(0), rst_abort.Rd = "rst_abort()", #> rst_list.Rd = c("rst_list()", "rst_exists()", "rst_jump()", #> "rst_maybe_jump()"), `scalar-type-predicates.Rd` = c("is_scalar_list()", #> "is_scalar_atomic()", "is_scalar_vector()", "is_scalar_integer()", #> "is_scalar_double()", "is_scalar_character()", "is_scalar_logical()", #> "is_scalar_raw()", "is_string()", "is_scalar_bytes()", #> "is_bool()"), scoped_env.Rd = c("scoped_env()", "is_scoped()", #> "scoped_envs()", "scoped_names()"), scoped_interactive.Rd = c("scoped_interactive()", #> "scoped_options()", "scoped_bindings()"), search_envs.Rd = c("search_envs()", #> "search_env()", "pkg_env()", "pkg_env_name()", "is_attached()", #> "base_env()", "global_env()"), seq2.Rd = c("seq2()", #> "seq2_along()"), set_attrs.Rd = c("set_attrs()", #> "mut_attrs()"), set_expr.Rd = c("set_expr()", "get_expr()" #> ), set_names.Rd = "set_names()", splice.Rd = c("splice()", #> "is_spliced()", "is_spliced_bare()", "dots_splice()" #> ), stack.Rd = c("global_frame()", "current_frame()", #> "ctxt_frame()", "call_frame()", "ctxt_depth()", "call_depth()", #> "ctxt_stack()", "call_stack()"), stack_trim.Rd = "stack_trim()", #> string.Rd = "string()", switch_type.Rd = c("switch_type()", #> "coerce_type()", "switch_class()", "coerce_class()" #> ), sym.Rd = c("sym()", "syms()"), `tidyeval-data.Rd` = c(".data", #> ".env"), trace_back.Rd = c("trace_back()", "trace_length()" #> ), `type-predicates.Rd` = c("is_list()", "is_atomic()", #> "is_vector()", "is_integer()", "is_double()", "is_character()", #> "is_logical()", "is_raw()", "is_bytes()", "is_null()" #> ), type_of.Rd = "type_of()", vec_poke_n.Rd = c("vec_poke_n()", #> "vec_poke_range()"), `vector-coercion.Rd` = c("as_logical()", #> "as_integer()", "as_double()", "as_complex()", "as_character()", #> "as_list()"), `vector-construction.Rd` = c("lgl()", #> "int()", "dbl()", "cpl()", "chr()", "bytes()"), `vector-old-ctors.Rd` = c("node()", #> "lgl_len()", "int_len()", "dbl_len()", "chr_len()", #> "cpl_len()", "raw_len()", "bytes_len()", "list_len()", #> "lgl_along()", "int_along()", "dbl_along()", "chr_along()", #> "cpl_along()", "raw_along()", "bytes_along()", "list_along()" #> ), with_abort.Rd = "with_abort()", with_env.Rd = c("with_env()", #> "locally()"), with_handlers.Rd = c("with_handlers()", #> "calling()"), with_restarts.Rd = "with_restarts()", #> wref_key.Rd = c("wref_key()", "wref_value()"), zap.Rd = c("zap()", #> "is_zap()"), zap_srcref.Rd = "zap_srcref()"), title = c(abort.Rd = "Signal an error, warning, or message", #> are_na.Rd = "Test for missing values", arg_match.Rd = "Match an argument to a character vector", #> as_box.Rd = "Convert object to a box", as_bytes.Rd = "Coerce to a raw vector", #> as_data_mask.Rd = "Create a data mask", as_env.Rd = "Coerce to an environment", #> as_environment.Rd = "Coerce to an environment", as_function.Rd = "Convert to function or closure", #> as_label.Rd = "Create a default name for an R object", #> as_name.Rd = "Extract names from symbols", as_overscope.Rd = "Create an overscope", #> as_pairlist.Rd = "Coerce to pairlist", as_quosure.Rd = "Coerce object to quosure", #> as_string.Rd = "Cast symbol to string", as_utf8_character.Rd = "Coerce to a character vector and attempt encoding conversion", #> `bare-type-predicates.Rd` = "Bare type predicates", box.Rd = "Box a value", #> call2.Rd = "Create a call", call_args.Rd = "Extract arguments from a call", #> call_fn.Rd = "Extract function from a call", call_inspect.Rd = "Inspect a call", #> call_modify.Rd = "Modify the arguments of a call", call_name.Rd = "Extract function name or namespace of a call", #> call_parse_type.Rd = "What is the parser type of a call?", #> call_standardise.Rd = "Standardise a call", caller_env.Rd = "Get the current or caller environment", #> caller_fn.Rd = "Get properties of the current or caller frame", #> caller_frame.Rd = "Get caller frame", catch_cnd.Rd = "Catch a condition", #> chr_unserialise_unicode.Rd = "Translate unicode points to UTF-8", #> cnd.Rd = "Create a condition object", cnd_message.Rd = "Build an error message from parts", #> cnd_muffle.Rd = "Muffle a condition", cnd_signal.Rd = "Signal a condition object", #> cnd_type.Rd = "What type is a condition?", done.Rd = "Box a final value for early termination", #> dots_definitions.Rd = "Capture definition objects", dots_n.Rd = "How many arguments are currently forwarded in dots?", #> dots_values.Rd = "Evaluate dots with preliminary splicing", #> duplicate.Rd = "Duplicate an R object", `dyn-dots.Rd` = "Dynamic dots", #> empty_env.Rd = "Get the empty environment", enquo0.Rd = "Defuse arguments without automatic injection", #> entrace.Rd = "Add backtrace from error handler", env.Rd = "Create a new environment", #> env_bind.Rd = "Bind symbols to objects in an environment", #> env_bind_exprs.Rd = "Bind a promise or active binding", #> env_binding_are_active.Rd = "What kind of environment binding?", #> env_binding_lock.Rd = "Lock or unlock environment bindings", #> env_browse.Rd = "Browse environments", env_bury.Rd = "Mask bindings by defining symbols deeper in a scope", #> env_clone.Rd = "Clone an environment", env_depth.Rd = "Depth of an environment chain", #> env_get.Rd = "Get an object in an environment", env_has.Rd = "Does an environment have or see bindings?", #> env_inherits.Rd = "Does environment inherit from another environment?", #> env_lock.Rd = "Lock an environment", env_name.Rd = "Label of an environment", #> env_names.Rd = "Names and numbers of symbols bound in an environment", #> env_parent.Rd = "Get parent environments", env_poke.Rd = "Poke an object in an environment", #> env_print.Rd = "Pretty-print an environment", env_unbind.Rd = "Remove bindings from an environment", #> env_unlock.Rd = "Unlock an environment", eval_bare.Rd = "Evaluate an expression in an environment", #> eval_tidy.Rd = "Evaluate an expression with quosures and pronoun support", #> exec.Rd = "Execute a function", exiting.Rd = "Exiting handler", #> expr_interp.Rd = "Process unquote operators in a captured expression", #> expr_label.Rd = "Turn an expression to a label", expr_print.Rd = "Print an expression", #> exprs_auto_name.Rd = "Ensure that all elements of a list of expressions are named", #> f_rhs.Rd = "Get or set formula components", f_text.Rd = "Turn RHS of formula into a string or label", #> `faq-options.Rd` = "Global options for rlang", flatten.Rd = "Flatten or squash a list of lists into a simpler vector", #> fn_body.Rd = "Get or set function body", fn_env.Rd = "Return the closure environment of a function", #> fn_fmls.Rd = "Extract arguments from a function", format_error_bullets.Rd = "Format bullets for error messages", #> frame_position.Rd = "Find the position or distance of a frame on the evaluation stack", #> friendly_type.Rd = "Format a type for error messages", #> get_env.Rd = "Get or set the environment of an object", #> has_length.Rd = "How long is an object?", has_name.Rd = "Does an object have an element with this name?", #> hash.Rd = "Hash an object", inherits_any.Rd = "Does an object inherit from a set of classes?", #> inject.Rd = "Inject objects in an R expression", invoke.Rd = "Invoke a function with a list of arguments", #> is_call.Rd = "Is object a call?", is_callable.Rd = "Is an object callable?", #> is_condition.Rd = "Is object a condition?", is_copyable.Rd = "Is an object copyable?", #> is_empty.Rd = "Is object an empty vector or NULL?", is_env.Rd = "Is an object an environment?", #> is_environment.Rd = "Is object an environment?", is_expr.Rd = "Is an object an expression?", #> is_expression.Rd = "Is an object an expression?", is_formula.Rd = "Is object a formula?", #> is_frame.Rd = "Is object a frame?", is_function.Rd = "Is object a function?", #> is_installed.Rd = "Are packages installed in any of the libraries?", #> is_integerish.Rd = "Is a vector integer-like?", is_interactive.Rd = "Is R running interactively?", #> is_lang.Rd = "Is object a call?", is_named.Rd = "Is object named?", #> is_namespace.Rd = "Is an object a namespace environment?", #> is_pairlist.Rd = "Is object a node or pairlist?", is_reference.Rd = "Is an object referencing another?", #> is_stack.Rd = "Is object a stack?", is_symbol.Rd = "Is object a symbol?", #> is_true.Rd = "Is object identical to TRUE or FALSE?", #> is_weakref.Rd = "Is object a weak reference?", lang.Rd = "Create a call", #> lang_head.Rd = "Return the head or tail of a call", lang_modify.Rd = "Manipulate or access a call", #> last_error.Rd = "Last <code>abort()</code> error", lifecycle.Rd = "Life cycle of the rlang package", #> list2.Rd = "Collect dots in a list", local_bindings.Rd = "Temporarily change bindings of an environment", #> local_options.Rd = "Change global options", missing.Rd = "Missing values", #> missing_arg.Rd = "Generate or handle a missing argument", #> mut_node_car.Rd = "Mutate node components", names2.Rd = "Get names of a vector", #> `new-vector-along-retired.Rd` = "Create vectors matching the length of a given vector", #> `new-vector.Rd` = "Create vectors matching a given length", #> new_call.Rd = "Create a new call from components", new_formula.Rd = "Create a formula", #> new_function.Rd = "Create a function", new_node.Rd = "Helpers for pairlist and language nodes", #> new_quosures.Rd = "Create a list of quosures", new_weakref.Rd = "Create a weak reference", #> ns_env.Rd = "Get the namespace of a package", `nse-defuse.Rd` = "Defuse R expressions", #> `nse-force.Rd` = "Force parts of an expression", `op-definition.Rd` = "Definition operator", #> `op-get-attr.Rd` = "Infix attribute accessor and setter", #> `op-na-default.Rd` = "Replace missing values", `op-null-default.Rd` = "Default value for <code>NULL</code>", #> overscope_eval_next.Rd = "Evaluate next quosure in a data mask", #> pairlist2.Rd = "Create pairlists with splicing support", #> parse_expr.Rd = "Parse R code", parse_quosure.Rd = "Parse text into a quosure", #> prepend.Rd = "Prepend a vector", prim_name.Rd = "Name of a primitive function", #> quo_expr.Rd = "Squash a quosure", quo_label.Rd = "Format quosures for printing or labelling", #> quo_squash.Rd = "Squash a quosure", quosure.Rd = "Quosure getters, setters and testers", #> raw_deparse_str.Rd = "Serialize a raw vector to a string", #> rep_along.Rd = "Create vectors matching the length of a given vector", #> restarting.Rd = "Create a restarting handler", return_from.Rd = "Jump to or from a frame", #> rlang_backtrace_on_error.Rd = "Display backtrace on error", #> rst_abort.Rd = "Jump to the abort restart", rst_list.Rd = "Restarts utilities", #> `scalar-type-predicates.Rd` = "Scalar type predicates", #> scoped_env.Rd = "Retired <code>scoped</code> functions", #> scoped_interactive.Rd = "Questioning <code>scoped_</code> functions", #> search_envs.Rd = "Search path environments", seq2.Rd = "Increasing sequence of integers in an interval", #> set_attrs.Rd = "Add attributes to an object", set_expr.Rd = "Set and get an expression", #> set_names.Rd = "Set names of a vector", splice.Rd = "Splice lists", #> stack.Rd = "Call stack information", stack_trim.Rd = "Trim top call layers from the evaluation stack", #> string.Rd = "Create a string", switch_type.Rd = "Dispatch on base types", #> sym.Rd = "Create a symbol or list of symbols", `tidyeval-data.Rd` = "Data pronouns for tidy evaluation", #> trace_back.Rd = "Capture a backtrace", `type-predicates.Rd` = "Type predicates", #> type_of.Rd = "Base type of an object", vec_poke_n.Rd = "Poke values into a vector", #> `vector-coercion.Rd` = "Coerce an object to a base type", #> `vector-construction.Rd` = "Create vectors", `vector-old-ctors.Rd` = "Retired vector construction by length", #> with_abort.Rd = "Promote all errors to rlang errors", #> with_env.Rd = "Evaluate an expression within a given environment", #> with_handlers.Rd = "Establish handlers on the stack", #> with_restarts.Rd = "Establish a restart point on the stack", #> wref_key.Rd = "Get key/value from a weak reference object", #> zap.Rd = "Create zap objects", zap_srcref.Rd = "Zap source references" #> ), rd = list(abort.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-abort.R, R/cnd-signal.R", #> "\n", list("abort"), "\n", list("abort"), "\n", list( #> "warn"), "\n", list("inform"), "\n", list("signal"), #> "\n", list("interrupt"), "\n", list("Signal an error, warning, or message"), #> "\n", list("\n", "abort(\n", " message = NULL,\n", #> " class = NULL,\n", " ...,\n", " trace = NULL,\n", #> " parent = NULL,\n", " .subclass = deprecated()\n", #> ")\n", "\n", "warn(\n", " message = NULL,\n", #> " class = NULL,\n", " ...,\n", " .frequency = c(\"always\", \"regularly\", \"once\"),\n", #> " .frequency_id = NULL,\n", " .subclass = deprecated()\n", #> ")\n", "\n", "inform(\n", " message = NULL,\n", #> " class = NULL,\n", " ...,\n", " .file = NULL,\n", #> " .frequency = c(\"always\", \"regularly\", \"once\"),\n", #> " .frequency_id = NULL,\n", " .subclass = deprecated()\n", #> ")\n", "\n", "signal(message, class, ..., .subclass = deprecated())\n", #> "\n", "interrupt()\n"), "\n", list("\n", list( #> list("message"), list("The message to display. Character vectors are\n", #> "formatted with ", list(list("format_error_bullets()")), #> ". The first element\n", "defines a message header and the rest of the vector defines\n", #> "bullets. Bullets named ", list("i"), " and ", #> list("x"), " define info and error bullets\n", #> "respectively, with special Unicode and colour formatting applied\n", #> "if possible.\n", "\n", "If a message is not supplied, it is expected that the message is\n", #> "generated lazily through ", list("conditionMessage()"), #> ". In\n", "that case, ", list("class"), " must be supplied. Only ", #> list("inform()"), " allows empty\n", "messages as it is occasionally useful to build user output\n", #> "incrementally.")), "\n", "\n", list(list("class"), #> list("Subclass of the condition. This allows your users\n", #> "to selectively handle the conditions signalled by your functions.")), #> "\n", "\n", list(list("..."), list("Additional data to be stored in the condition object.")), #> "\n", "\n", list(list("trace"), list("A ", list( #> "trace"), " object created by ", list(list( #> "trace_back()")), ".")), "\n", "\n", list(list( #> "parent"), list("A parent condition object created by ", #> list(list("abort()")), ".")), "\n", "\n", list( #> list(".subclass"), list("This argument was renamed to ", #> list("class"), " in rlang\n", "0.4.2. It will be deprecated in the next major version. This is\n", #> "for consistency with our conventions for class constructors\n", #> "documented in ", list("https://adv-r.hadley.nz/s3.html#s3-subclassing"), #> ".")), "\n", "\n", list(list(".frequency"), #> list("How frequently should the warning or message be\n", #> "displayed? By default (", list("\"always\""), #> ") it is displayed at each\n", "time. If ", #> list("\"regularly\""), ", it is displayed once every 8 hours. If\n", #> list("\"once\""), ", it is displayed once per session.")), #> "\n", "\n", list(list(".frequency_id"), list( #> "A unique identifier for the warning or\n", #> "message. This is used when ", list(".frequency"), #> " is supplied to recognise\n", "recurring conditions. This argument must be supplied if\n", #> list(".frequency"), " is not set to ", list( #> "\"always\""), ".")), "\n", "\n", list(list( #> ".file"), list("Where the message is printed. This should be a\n", #> "connection or character string which will be passed to ", #> list(list("cat()")), ".\n", "\n", "By default, ", #> list("inform()"), " prints to standard output in interactive\n", #> "sessions and standard error otherwise. This way IDEs can treat\n", #> "messages distinctly from warnings and errors, and R scripts can\n", #> "still filter out the messages easily by redirecting ", #> list("stderr"), ". If\n", "a sink is active, either on output or on messages, messages are\n", #> "printed to ", list("stderr"), ". This ensures consistency of behaviour in\n", #> "interactive and non-interactive sessions.")), #> "\n"), "\n", list("\n", "These functions are equivalent to base functions ", #> list(list("base::stop()")), ",\n", list(list( #> "base::warning()")), ", and ", list(list("base::message()")), #> ", but make it easy to supply\n", "condition metadata:\n", #> list("\n", list(), " Supply ", list("class"), #> " to create a classed condition. Typed\n", #> "conditions can be captured or handled selectively, allowing for\n", #> "finer-grained error handling.\n", list(), #> " Supply metadata with named ", list("..."), #> " arguments. This data will be\n", "stored in the condition object and can be examined by handlers.\n"), #> "\n", "\n", list("interrupt()"), " allows R code to simulate a user interrupt of the\n", #> "kind that is signalled with ", list("Ctrl-C"), #> ". It is currently not possible\n", "to create custom interrupt condition objects.\n"), #> "\n", list(list("Backtrace"), list("\n", "\n", "\n", #> "Unlike ", list("stop()"), " and ", list("warning()"), #> ", these functions don't include call\n", "information by default. This saves you from typing ", #> list("call. = FALSE"), "\n", "and produces cleaner error messages.\n", #> "\n", "A backtrace is always saved into error objects. You can print a\n", #> "simplified backtrace of the last error by calling ", #> list(list("last_error()")), "\n", "and a full backtrace with ", #> list("summary(last_error())"), ".\n", "\n", "You can also display a backtrace with the error message by setting\n", #> "the option ", list(list("rlang_backtrace_on_error")), #> ". It supports the following\n", "values:\n", #> list("\n", list(), " ", list("\"reminder\""), #> ": Invite users to call ", list("rlang::last_error()"), #> " to see a\n", "backtrace.\n", list(), " ", #> list("\"branch\""), ": Display a simplified backtrace.\n", #> list(), " ", list("\"collapse\""), ": Display a collapsed backtrace tree.\n", #> list(), " ", list("\"full\""), ": Display a full backtrace tree.\n", #> list(), " ", list("\"none\""), ": Display nothing.\n"), #> "\n")), "\n", "\n", list(list("Mufflable conditions"), #> list("\n", "\n", "\n", "Signalling a condition with ", #> list("inform()"), " or ", list("warn()"), " causes a message\n", #> "to be displayed in the console. These messages can be muffled with\n", #> list(list("base::suppressMessages()")), " or ", #> list(list("base::suppressWarnings()")), ".\n", #> "\n", "On recent R versions (>= R 3.5.0), interrupts are typically\n", #> "signalled with a ", list("\"resume\""), " restart. This is however not\n", #> "guaranteed.\n")), "\n", "\n", list("\n", "# These examples are guarded to avoid throwing errors\n", #> "if (FALSE) {\n", "\n", "# Signal an error with a message just like stop():\n", #> "abort(\"Something bad happened\")\n", "\n", #> "# Give a class to the error:\n", "abort(\"Something bad happened\", \"somepkg_bad_error\")\n", #> "\n", "# This will allow your users to handle the error selectively\n", #> "tryCatch(\n", " somepkg_function(),\n", " somepkg_bad_error = function(err) {\n", #> " warn(conditionMessage(err)) # Demote the error to a warning\n", #> " NA # Return an alternative value\n", #> " }\n", ")\n", "\n", "# You can also specify metadata that will be stored in the condition:\n", #> "abort(\"Something bad happened\", \"somepkg_bad_error\", data = 1:10)\n", #> "\n", "# This data can then be consulted by user handlers:\n", #> "tryCatch(\n", " somepkg_function(),\n", " somepkg_bad_error = function(err) {\n", #> " # Compute an alternative return value with the data:\n", #> " recover_error(err$data)\n", " }\n", ")\n", #> "\n", "# If you call low-level APIs it is good practice to handle\n", #> "# technical errors and rethrow them with a more meaningful\n", #> "# message. Always prefer doing this from `withCallinghandlers()`\n", #> "# rather than `tryCatch()` because the former preserves the stack\n", #> "# on error and makes it possible for users to use `recover()`.\n", #> "file <- \"http://foo.bar/baz\"\n", "try(withCallinghandlers(\n", #> " download(file),\n", " error = function(err) {\n", #> " msg <- sprintf(\"Can't download `%s`\", file)\n", #> " abort(msg, parent = err)\n", "}))\n", "# Note how we supplied the parent error to `abort()` as `parent` to\n", #> "# get a decomposition of error messages across error contexts.\n", #> "\n", "# Unhandled errors are saved automatically by `abort()` and can be\n", #> "# retrieved with `last_error()`. The error prints with a simplified\n", #> "# backtrace:\n", "abort(\"Saved error?\")\n", #> "last_error()\n", "\n", "# Use `summary()` to print the full backtrace and the condition fields:\n", #> "summary(last_error())\n", "\n", "}\n"), "\n", #> list("\n", list(list("with_abort()")), " to convert all errors to rlang errors.\n"), #> "\n"), are_na.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-na.R", #> "\n", list("are_na"), "\n", list("are_na"), "\n", #> list("is_na"), "\n", list("is_lgl_na"), "\n", list( #> "is_int_na"), "\n", list("is_dbl_na"), "\n", #> list("is_chr_na"), "\n", list("is_cpl_na"), "\n", #> list("Test for missing values"), "\n", list("\n", #> "are_na(x)\n", "\n", "is_na(x)\n", "\n", "is_lgl_na(x)\n", #> "\n", "is_int_na(x)\n", "\n", "is_dbl_na(x)\n", #> "\n", "is_chr_na(x)\n", "\n", "is_cpl_na(x)\n"), #> "\n", list("\n", list(list("x"), list("An object to test")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", list("are_na()"), " checks for missing values in a vector and is equivalent\n", #> "to ", list(list("base::is.na()")), ". It is a vectorised predicate, meaning that its\n", #> "output is always the same length as its input. On the other hand,\n", #> list("is_na()"), " is a scalar predicate and always returns a scalar\n", #> "boolean, ", list("TRUE"), " or ", list("FALSE"), #> ". If its input is not scalar, it returns\n", #> list("FALSE"), ". Finally, there are typed versions that check for\n", #> "particular ", list("missing types"), ".\n"), #> "\n", list("\n", "The scalar predicates accept non-vector inputs. They are equivalent\n", #> "to ", list(list("is_null()")), " in that respect. In contrast the vectorised\n", #> "predicate ", list("are_na()"), " requires a vector input since it is defined\n", #> "over vector values.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "These functions might be moved to the vctrs package at some\n", #> "point. This is why they are marked as questioning.\n")), #> "\n", "\n", list("\n", "# are_na() is vectorised and works regardless of the type\n", #> "are_na(c(1, 2, NA))\n", "are_na(c(1L, NA, 3L))\n", #> "\n", "# is_na() checks for scalar input and works for all types\n", #> "is_na(NA)\n", "is_na(na_dbl)\n", "is_na(character(0))\n", #> "\n", "# There are typed versions as well:\n", #> "is_lgl_na(NA)\n", "is_lgl_na(na_dbl)\n"), "\n", #> list("internal"), "\n"), arg_match.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/arg.R", "\n", #> list("arg_match"), "\n", list("arg_match"), "\n", #> list("arg_match0"), "\n", list("Match an argument to a character vector"), #> "\n", list("\n", "arg_match(arg, values = NULL)\n", #> "\n", "arg_match0(arg, values, arg_nm = as_label(substitute(arg)))\n"), #> "\n", list("\n", list(list("arg"), list("A symbol referring to an argument accepting strings.")), #> "\n", "\n", list(list("values"), list("The possible values that ", #> list("arg"), " can take.")), "\n", "\n", list( #> list("arg_nm"), list("The label to be used for ", #> list("arg"), " in error messages.")), "\n"), #> "\n", list("\n", "The string supplied to ", list( #> "arg"), ".\n"), "\n", list("\n", "This is equivalent to ", #> list(list("base::match.arg()")), " with a few differences:\n", #> list("\n", list(), " Partial matches trigger an error.\n", #> list(), " Error messages are a bit more informative and obey the tidyverse\n", #> "standards.\n"), "\n", "\n", list("arg_match()"), #> " derives the possible values from the\n", list( #> "caller frame"), ".\n", "\n", list("arg_match0()"), #> " is a bare-bones version if performance is at a premium.\n", #> "It requires a string as ", list("arg"), " and explicit ", #> list("values"), ".\n", "For convenience, ", list( #> "arg"), " may also be a character vector containing\n", #> "every element of ", list("values"), ", possibly permuted.\n", #> "In this case, the first element of ", list("arg"), #> " is used.\n"), "\n", list("\n", "fn <- function(x = c(\"foo\", \"bar\")) arg_match(x)\n", #> "fn(\"bar\")\n", "\n", "# Throws an informative error for mismatches:\n", #> "try(fn(\"b\"))\n", "try(fn(\"baz\"))\n", "\n", #> "# Use the bare-bones version with explicit values for speed:\n", #> "arg_match0(\"bar\", c(\"foo\", \"bar\", \"baz\"))\n", #> "\n", "# For convenience:\n", "fn1 <- function(x = c(\"bar\", \"baz\", \"foo\")) fn3(x)\n", #> "fn2 <- function(x = c(\"baz\", \"bar\", \"foo\")) fn3(x)\n", #> "fn3 <- function(x) arg_match0(x, c(\"foo\", \"bar\", \"baz\"))\n", #> "fn1()\n", "fn2(\"bar\")\n", "try(fn3(\"zoo\"))\n"), #> "\n"), as_box.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/s3.R", "\n", #> list("as_box"), "\n", list("as_box"), "\n", list( #> "as_box_if"), "\n", list("Convert object to a box"), #> "\n", list("\n", "as_box(x, class = NULL)\n", "\n", #> "as_box_if(.x, .p, .class = NULL, ...)\n"), "\n", #> list("\n", list(list("x"), list("An R object.")), #> "\n", "\n", list(list("class, .class"), list( #> "A box class. If the input is already a box of\n", #> "that class, it is returned as is. If the input needs to be boxed,\n", #> list("class"), " is passed to ", list(list( #> "new_box()")), ".")), "\n", "\n", list(list( #> ".x"), list("An R object.")), "\n", "\n", list( #> list(".p"), list("A predicate function.")), #> "\n", "\n", list(list("..."), list("Arguments passed to ", #> list(".p"), ".")), "\n"), "\n", list("\n", #> list("\n", list(), " ", list("as_box()"), " boxes its input only if it is not already a box. The\n", #> "class is also checked if supplied.\n", list(), #> " ", list("as_box_if()"), " boxes its input only if it not already a box, or if\n", #> "the predicate ", list(".p"), " returns ", #> list("TRUE"), ".\n"), "\n"), "\n"), as_bytes.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/utils-encoding.R", #> "\n", list("as_bytes"), "\n", list("as_bytes"), "\n", #> list("Coerce to a raw vector"), "\n", list("\n", #> "as_bytes(x)\n"), "\n", list("\n", list(list( #> "x"), list("A string.")), "\n"), "\n", list("\n", #> "A raw vector of bytes.\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "This currently only works with strings, and returns its hexadecimal\n", #> "representation.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "Raw vector functions are experimental.\n")), #> "\n", "\n", list("internal"), "\n"), as_data_mask.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/eval-tidy.R", "\n", #> list("as_data_mask"), "\n", list("as_data_mask"), #> "\n", list("as_data_pronoun"), "\n", list("new_data_mask"), #> "\n", list("Create a data mask"), "\n", list("\n", #> "as_data_mask(data)\n", "\n", "as_data_pronoun(data)\n", #> "\n", "new_data_mask(bottom, top = bottom)\n"), #> "\n", list("\n", list(list("data"), list("A data frame or named vector of masking data.")), #> "\n", "\n", list(list("bottom"), list("The environment containing masking objects if the\n", #> "data mask is one environment deep. The bottom environment if the\n", #> "data mask comprises multiple environment.\n", #> "\n", "If you haven't supplied ", list("top"), #> ", this ", list("must"), " be an environment\n", #> "that you own, i.e. that you have created yourself.")), #> "\n", "\n", list(list("top"), list("The last environment of the data mask. If the data mask\n", #> "is only one environment deep, ", list("top"), #> " should be the same as\n", list("bottom"), #> ".\n", "\n", "This ", list("must"), " be an environment that you own, i.e. that you have\n", #> "created yourself. The parent of ", list("top"), #> " will be changed by the tidy\n", "eval engine and should be considered undetermined. Never make\n", #> "assumption about the parent of ", list("top"), #> ".")), "\n"), "\n", list("\n", "A data mask that you can supply to ", #> list(list("eval_tidy()")), ".\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", "A data mask is an environment (or possibly multiple environments\n", #> "forming an ancestry) containing user-supplied objects. Objects in\n", #> "the mask have precedence over objects in the environment (i.e. they\n", #> "mask those objects). Many R functions evaluate quoted expressions\n", #> "in a data mask so these expressions can refer to objects within the\n", #> "user data.\n", "\n", "These functions let you construct a tidy eval data mask manually.\n", #> "They are meant for developers of tidy eval interfaces rather than\n", #> "for end users.\n"), "\n", list(list("Why build a data mask?"), #> list("\n", "\n", "\n", "Most of the time you can just call ", #> list(list("eval_tidy()")), " with a list or a\n", #> "data frame and the data mask will be constructed automatically.\n", #> "There are three main use cases for manual creation of data masks:\n", #> list("\n", list(), " When ", list(list("eval_tidy()")), #> " is called with the same data in a tight loop.\n", #> "Because there is some overhead to creating tidy eval data masks,\n", #> "constructing the mask once and reusing it for subsequent\n", #> "evaluations may improve performance.\n", #> list(), " When several expressions should be evaluated in the exact same\n", #> "environment because a quoted expression might create new objects\n", #> "that can be referred in other quoted expressions evaluated at a\n", #> "later time. One example of this is ", list( #> "tibble::lst()"), " where new\n", "columns can refer to previous ones.\n", #> list(), " When your data mask requires special features. For instance the\n", #> "data frame columns in dplyr data masks are implemented with\n", #> list("active bindings"), ".\n"), "\n")), #> "\n", "\n", list(list("Building your own data mask"), #> list("\n", "\n", "\n", "Unlike ", list(list("base::eval()")), #> " which takes any kind of environments as data\n", #> "mask, ", list(list("eval_tidy()")), " has specific requirements in order to support\n", #> list("quosures"), ". For this reason you can't supply bare\n", #> "environments.\n", "\n", "There are two ways of constructing an rlang data mask manually:\n", #> list("\n", list(), " ", list("as_data_mask()"), #> " transforms a list or data frame to a data mask.\n", #> "It automatically installs the data pronoun ", #> list(list(".data")), ".\n", list(), " ", #> list("new_data_mask()"), " is a bare bones data mask constructor for\n", #> "environments. You can supply a bottom and a top environment in\n", #> "case your data mask comprises multiple environments (see section\n", #> "below).\n", "\n", "Unlike ", list("as_data_mask()"), #> " it does not install the ", list(".data"), #> " pronoun\n", "so you need to provide one yourself. You can provide a pronoun\n", #> "constructed with ", list("as_data_pronoun()"), #> " or your own pronoun class.\n", "\n", list( #> "as_data_pronoun()"), " will create a pronoun from a list, an\n", #> "environment, or an rlang data mask. In the latter case, the whole\n", #> "ancestry is looked up from the bottom to the top of the mask.\n", #> "Functions stored in the mask are bypassed by the pronoun.\n"), #> "\n", "\n", "Once you have built a data mask, simply pass it to ", #> list(list("eval_tidy()")), " as\n", "the ", #> list("data"), " argument. You can repeat this as many times as\n", #> "needed. Note that any objects created there (perhaps because of a\n", #> "call to ", list("<-"), ") will persist in subsequent evaluations.\n")), #> "\n", "\n", list(list("Top and bottom of data mask"), #> list("\n", "\n", "\n", "In some cases you'll need several levels in your data mask. One\n", #> "good reason is when you include functions in the mask. It's a good\n", #> "idea to keep data objects one level lower than function objects, so\n", #> "that the former cannot override the definitions of the latter (see\n", #> "examples).\n", "\n", "In that case, set up all your environments and keep track of the\n", #> "bottom child and the top parent. You'll need to pass both to\n", #> list("new_data_mask()"), ".\n", "\n", "Note that the parent of the top environment is completely\n", #> "undetermined, you shouldn't expect it to remain the same at all\n", #> "times. This parent is replaced during evaluation by ", #> list(list("eval_tidy()")), "\n", "to one of the following environments:\n", #> list("\n", list(), " The default environment passed as the ", #> list("env"), " argument of ", list("eval_tidy()"), #> ".\n", list(), " The environment of the current quosure being evaluated, if applicable.\n"), #> "\n", "\n", "Consequently, all masking data should be contained between the\n", #> "bottom and top environment of the data mask.\n")), #> "\n", "\n", list("\n", "# Evaluating in a tidy evaluation environment enables all tidy\n", #> "# features:\n", "mask <- as_data_mask(mtcars)\n", #> "eval_tidy(quo(letters), mask)\n", "\n", "# You can install new pronouns in the mask:\n", #> "mask$.pronoun <- as_data_pronoun(list(foo = \"bar\", baz = \"bam\"))\n", #> "eval_tidy(quo(.pronoun$foo), mask)\n", "\n", #> "# In some cases the data mask can leak to the user, for example if\n", #> "# a function or formula is created in the data mask environment:\n", #> "cyl <- \"user variable from the context\"\n", #> "fn <- eval_tidy(quote(function() cyl), mask)\n", #> "fn()\n", "\n", "# If new objects are created in the mask, they persist in the\n", #> "# subsequent calls:\n", "eval_tidy(quote(new <- cyl + am), mask)\n", #> "eval_tidy(quote(new * 2), mask)\n", "\n", "\n", #> "# In some cases your data mask is a whole chain of environments\n", #> "# rather than a single environment. You'll have to use\n", #> "# `new_data_mask()` and let it know about the bottom of the mask\n", #> "# (the last child of the environment chain) and the topmost parent.\n", #> "\n", "# A common situation where you'll want a multiple-environment mask\n", #> "# is when you include functions in your mask. In that case you'll\n", #> "# put functions in the top environment and data in the bottom. This\n", #> "# will prevent the data from overwriting the functions.\n", #> "top <- new_environment(list(`+` = base::paste, c = base::paste))\n", #> "\n", "# Let's add a middle environment just for sport:\n", #> "middle <- env(top)\n", "\n", "# And finally the bottom environment containing data:\n", #> "bottom <- env(middle, a = \"a\", b = \"b\", c = \"c\")\n", #> "\n", "# We can now create a mask by supplying the top and bottom\n", #> "# environments:\n", "mask <- new_data_mask(bottom, top = top)\n", #> "\n", "# This data mask can be passed to eval_tidy() instead of a list or\n", #> "# data frame:\n", "eval_tidy(quote(a + b + c), data = mask)\n", #> "\n", "# Note how the function `c()` and the object `c` are looked up\n", #> "# properly because of the multi-level structure:\n", #> "eval_tidy(quote(c(a, b, c)), data = mask)\n", #> "\n", "# new_data_mask() does not create data pronouns, but\n", #> "# data pronouns can be added manually:\n", "mask$.fns <- as_data_pronoun(top)\n", #> "\n", "# The `.data` pronoun should generally be created from the\n", #> "# mask. This will ensure data is looked up throughout the whole\n", #> "# ancestry. Only non-function objects are looked up from this\n", #> "# pronoun:\n", "mask$.data <- as_data_pronoun(mask)\n", #> "mask$.data$c\n", "\n", "# Now we can reference the values with the pronouns:\n", #> "eval_tidy(quote(c(.data$a, .data$b, .data$c)), data = mask)\n"), #> "\n"), as_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("as_env"), "\n", list("as_env"), "\n", #> list("Coerce to an environment"), "\n", list("\n", #> "as_env(x, parent = NULL)\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"deprecated\")"), "\n", #> "\n", "This function is deprecated as it was renamed to ", #> list(list("as_environment()")), "\n", "in rlang 0.2.0.\n"), #> "\n", list("internal"), "\n"), as_environment.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/env.R", "\n", list( #> "as_environment"), "\n", list("as_environment"), #> "\n", list("Coerce to an environment"), "\n", list( #> "\n", "as_environment(x, parent = NULL)\n"), #> "\n", list("\n", list(list("x"), list("An object to coerce.")), #> "\n", "\n", list(list("parent"), list("A parent environment, ", #> list(list("empty_env()")), " by default. This\n", #> "argument is only used when ", list("x"), " is data actually coerced to an\n", #> "environment (as opposed to data representing an environment, like\n", #> list("NULL"), " representing the empty environment).")), #> "\n"), "\n", list("\n", list("as_environment()"), #> " coerces named vectors (including lists) to an\n", #> "environment. The names must be unique. If supplied an unnamed\n", #> "string, it returns the corresponding package environment (see\n", #> list(list("pkg_env()")), ").\n"), "\n", list( #> "\n", "If ", list("x"), " is an environment and ", #> list("parent"), " is not ", list("NULL"), ", the\n", #> "environment is duplicated before being set a new parent. The return\n", #> "value is therefore a different environment than ", #> list("x"), ".\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", list("as_env()"), " was soft-deprecated and renamed to ", #> list("as_environment()"), " in\n", "rlang 0.2.0. This is for consistency as type predicates should not\n", #> "be abbreviated.\n")), "\n", "\n", list("\n", #> "# Coerce a named vector to an environment:\n", #> "env <- as_environment(mtcars)\n", "\n", "# By default it gets the empty environment as parent:\n", #> "identical(env_parent(env), empty_env())\n", #> "\n", "\n", "# With strings it is a handy shortcut for pkg_env():\n", #> "as_environment(\"base\")\n", "as_environment(\"rlang\")\n", #> "\n", "# With NULL it returns the empty environment:\n", #> "as_environment(NULL)\n"), "\n"), as_function.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/fn.R", "\n", list( #> "as_function"), "\n", list("as_function"), "\n", #> list("is_lambda"), "\n", list("as_closure"), "\n", #> list("Convert to function or closure"), "\n", list( #> "\n", "as_function(x, env = caller_env())\n", #> "\n", "is_lambda(x)\n", "\n", "as_closure(x, env = caller_env())\n"), #> "\n", list("\n", list(list("x"), list("A function or formula.\n", #> "\n", "If a ", list("function"), ", it is used as is.\n", #> "\n", "If a ", list("formula"), ", e.g. ", list( #> "~ .x + 2"), ", it is converted to a function\n", #> "with up to two arguments: ", list(".x"), " (single argument) or ", #> list(".x"), " and ", list(".y"), "\n", "(two arguments). The ", #> list("."), " placeholder can be used instead of ", #> list(".x"), ".\n", "This allows you to create very compact anonymous functions (lambdas) with up\n", #> "to two inputs. Functions created from formulas have a special\n", #> "class. Use ", list("is_lambda()"), " to test for it.\n", #> "\n", "Lambdas currently do not support ", list( #> "nse-force"), ",\n", "due to the way the arguments are handled internally.")), #> "\n", "\n", list(list("env"), list("Environment in which to fetch the function in case ", #> list("x"), "\n", "is a string.")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", list("\n", list(), " ", list("as_function()"), #> " transforms a one-sided formula into a function.\n", #> "This powers the lambda syntax in packages like purrr.\n", #> list(), " ", list("as_closure()"), " first passes its argument to ", #> list("as_function()"), ". If\n", "the result is a primitive function, it regularises it to a proper\n", #> list("closure"), " (see ", list(list("is_function()")), #> " about primitive functions). Some\n", "special control flow primitives like ", #> list("if"), ", ", list("for"), ", or ", list( #> "break"), "\n", "can't be coerced to a closure.\n"), #> "\n"), "\n", list("\n", "f <- as_function(~ .x + 1)\n", #> "f(10)\n", "\n", "g <- as_function(~ -1 * .)\n", #> "g(4)\n", "\n", "h <- as_function(~ .x - .y)\n", #> "h(6, 3)\n", "\n", "# Functions created from a formula have a special class:\n", #> "is_lambda(f)\n", "is_lambda(as_function(function() \"foo\"))\n", #> "\n", "# Primitive functions are regularised as closures\n", #> "as_closure(list)\n", "as_closure(\"list\")\n", #> "\n", "# Operators have `.x` and `.y` as arguments, just like lambda\n", #> "# functions created with the formula syntax:\n", #> "as_closure(`+`)\n", "as_closure(`~`)\n", "\n", #> "# Use a regular function for tidy evaluation, also when calling functions\n", #> "# that use tidy evaluation:\n", "## Bad:\n", #> "e <- as_function(~ as_label(ensym(.x)))\n", #> "## Good:\n", "e <- as_function(function(x) as_label(ensym(x)))\n", #> "\n", "e(y)\n"), "\n"), as_label.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/deparse.R", #> "\n", list("as_label"), "\n", list("as_label"), "\n", #> list("Create a default name for an R object"), "\n", #> list("\n", "as_label(x)\n"), "\n", list("\n", list( #> list("x"), list("An object.")), "\n"), "\n", #> list("\n", list("as_label()"), " transforms R objects into a short, human-readable\n", #> "description. You can use labels to:\n", list( #> "\n", list(), " Display an object in a concise way, for example to labellise axes\n", #> "in a graphical plot.\n", list(), " Give default names to columns in a data frame. In this case,\n", #> "labelling is the first step before name repair.\n"), #> "\n", "\n", "See also ", list(list("as_name()")), #> " for transforming symbols back to a\n", "string. Unlike ", #> list("as_label()"), ", ", list("as_string()"), #> " is a well defined\n", "operation that guarantees the roundtrip symbol -> string ->\n", #> "symbol.\n", "\n", "In general, if you don't know for sure what kind of object you're\n", #> "dealing with (a call, a symbol, an unquoted constant), use\n", #> list("as_label()"), " and make no assumption about the resulting string. If\n", #> "you know you have a symbol and need the name of the object it\n", #> "refers to, use ", list(list("as_string()")), #> ". For instance, use ", list("as_label()"), " with\n", #> "objects captured with ", list("enquo()"), " and ", #> list("as_string()"), " with symbols\n", "captured with ", #> list("ensym()"), ".\n"), "\n", list(list("Transformation to string"), #> list("\n", "\n", list("\n", list(), " Quosures are ", #> list("squashed"), " before being labelled.\n", #> list(), " Symbols are transformed to string with ", #> list("as_string()"), ".\n", list(), " Calls are abbreviated.\n", #> list(), " Numbers are represented as such.\n", #> list(), " Other constants are represented by their type, such as ", #> list("<dbl>"), "\n", "or ", list("<data.frame>"), #> ".\n"), "\n", "\n", "Note that simple symbols should generally be transformed to strings\n", #> "with ", list(list("as_name()")), ". Labelling is not a well defined operation and\n", #> "no assumption should be made about how the label is created. On the\n", #> "other hand, ", list("as_name()"), " only works with symbols and is a well\n", #> "defined, deterministic operation.\n")), "\n", #> "\n", list("\n", "# as_label() is useful with quoted expressions:\n", #> "as_label(expr(foo(bar)))\n", "as_label(expr(foobar))\n", #> "\n", "# It works with any R object. This is also useful for quoted\n", #> "# arguments because the user might unquote constant objects:\n", #> "as_label(1:3)\n", "as_label(base::list)\n"), #> "\n", list("\n", list(list("as_name()")), " for transforming symbols back to a string\n", #> "deterministically.\n"), "\n"), as_name.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/deparse.R", "\n", #> list("as_name"), "\n", list("as_name"), "\n", list( #> "Extract names from symbols"), "\n", list("\n", #> "as_name(x)\n"), "\n", list("\n", list(list("x"), #> list("A string or symbol, possibly wrapped in a ", #> list("quosure"), ".\n", "If a string, the attributes are removed, if any.")), #> "\n"), "\n", list("\n", "A character vector of length 1.\n"), #> "\n", list("\n", list("as_name()"), " converts ", #> list("symbols"), " to character strings. The\n", #> "conversion is deterministic. That is, the roundtrip symbol -> name\n", #> "-> symbol always gets the same result.\n", list( #> "\n", list(), " Use ", list("as_name()"), " when you need to transform a symbol to a string\n", #> "to ", list("refer"), " to an object by its name.\n", #> list(), " Use ", list(list("as_label()")), #> " when you need to transform any kind of object to\n", #> "a string to ", list("represent"), " that object with a short description.\n"), #> "\n", "\n", "Expect ", list("as_name()"), " to gain\n", #> list(list("https://principles.tidyverse.org/names-attribute.html#minimal-unique-universal"), #> list("name-repairing")), "\n", "features in the future.\n", #> "\n", "Note that ", list("rlang::as_name()"), #> " is the ", list("opposite"), " of\n", list(list( #> "base::as.name()")), ". If you're writing base R code, we recommend\n", #> "using ", list(list("base::as.symbol()")), " which is an alias of ", #> list("as.name()"), " that\n", "follows a more modern terminology (R types instead of S modes).\n"), #> "\n", list("\n", "# Let's create some symbols:\n", #> "foo <- quote(foo)\n", "bar <- sym(\"bar\")\n", #> "\n", "# as_name() converts symbols to strings:\n", #> "foo\n", "as_name(foo)\n", "\n", "typeof(bar)\n", #> "typeof(as_name(bar))\n", "\n", "# as_name() unwraps quosured symbols automatically:\n", #> "as_name(quo(foo))\n"), "\n", list("\n", list( #> list("as_label()")), " for converting any object to a single string\n", #> "suitable as a label. ", list(list("as_string()")), #> " for a lower-level version that\n", "doesn't unwrap quosures.\n"), #> "\n"), as_overscope.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("as_overscope"), "\n", list("as_overscope"), #> "\n", list("new_overscope"), "\n", list("overscope_clean"), #> "\n", list("Create an overscope"), "\n", list("\n", #> "as_overscope(quo, data = NULL)\n", "\n", "new_overscope(bottom, top = NULL, enclosure = NULL)\n", #> "\n", "overscope_clean(overscope)\n"), "\n", #> list("\n", list(list("quo"), list("A ", list("quosure"), #> ".")), "\n", "\n", list(list("data"), list("A data frame or named vector of masking data.")), #> "\n", "\n", list(list("bottom"), list("The environment containing masking objects if the\n", #> "data mask is one environment deep. The bottom environment if the\n", #> "data mask comprises multiple environment.\n", #> "\n", "If you haven't supplied ", list("top"), #> ", this ", list("must"), " be an environment\n", #> "that you own, i.e. that you have created yourself.")), #> "\n", "\n", list(list("top"), list("The last environment of the data mask. If the data mask\n", #> "is only one environment deep, ", list("top"), #> " should be the same as\n", list("bottom"), #> ".\n", "\n", "This ", list("must"), " be an environment that you own, i.e. that you have\n", #> "created yourself. The parent of ", list("top"), #> " will be changed by the tidy\n", "eval engine and should be considered undetermined. Never make\n", #> "assumption about the parent of ", list("top"), #> ".")), "\n", "\n", list(list("enclosure"), #> list("The ", list("parent"), " argument of ", #> list(list("new_data_mask()")), ".")), "\n", #> "\n", list(list("overscope"), list("A data mask.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions have been deprecated in rlang 0.2.0. Please use\n", #> list(list("as_data_mask()")), " and ", list(list( #> "new_data_mask()")), " instead. We no longer\n", #> "require the mask to be cleaned up so ", list( #> "overscope_clean()"), " does not\n", "have a replacement.\n"), #> "\n", list("internal"), "\n"), as_pairlist.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/node.R", "\n", #> list("as_pairlist"), "\n", list("as_pairlist"), "\n", #> list("Coerce to pairlist"), "\n", list("\n", "as_pairlist(x)\n"), #> "\n", list("\n", list(list("x"), list("An object to coerce.")), #> "\n"), "\n", list("\n", "This transforms vector objects to a linked pairlist of nodes. See\n", #> "the ", list("pairlist"), " type help page.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", "\n", #> list("as_pairlist()"), " is experimental because we are still figuring out\n", #> "the naming scheme for pairlists and node-like objects.\n")), #> "\n", "\n", list("internal"), "\n"), as_quosure.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/quo.R", "\n", list( #> "as_quosure"), "\n", list("as_quosure"), "\n", #> list("new_quosure"), "\n", list("Coerce object to quosure"), #> "\n", list("\n", "as_quosure(x, env = NULL)\n", "\n", #> "new_quosure(expr, env = caller_env())\n"), "\n", #> list("\n", list(list("x"), list("An object to convert. Either an ", #> list("expression"), " or a\n", "formula.")), #> "\n", "\n", list(list("env"), list("The environment in which the expression should be\n", #> "evaluated. Only used for symbols and calls. This should typically\n", #> "be the environment in which the expression was created.")), #> "\n", "\n", list(list("expr"), list("The expression wrapped by the quosure.")), #> "\n"), "\n", list("\n", "While ", list("new_quosure()"), #> " wraps any R object (including expressions,\n", #> "formulas, or other quosures) into a quosure, ", #> list("as_quosure()"), "\n", "converts formulas and quosures and does not double-wrap.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", list( #> "\n", list(), " ", list("as_quosure()"), " now requires an explicit default environment for\n", #> "creating quosures from symbols and calls.\n", #> list(), " ", list("as_quosureish()"), " is deprecated as of rlang 0.2.0. This function\n", #> "assumes that quosures are formulas which is currently true but\n", #> "might not be in the future.\n"), "\n")), "\n", #> "\n", list("\n", "# as_quosure() converts expressions or any R object to a validly\n", #> "# scoped quosure:\n", "env <- env(var = \"thing\")\n", #> "as_quosure(quote(var), env)\n", "\n", "\n", #> "# The environment is ignored for formulas:\n", #> "as_quosure(~foo, env)\n", "as_quosure(~foo)\n", #> "\n", "# However you must supply it for symbols and calls:\n", #> "try(as_quosure(quote(var)))\n"), "\n", list( #> "\n", list(list("quo()")), ", ", list(list("is_quosure()")), #> "\n"), "\n"), as_string.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/sym.R", "\n", #> list("as_string"), "\n", list("as_string"), "\n", #> list("Cast symbol to string"), "\n", list("\n", "as_string(x)\n"), #> "\n", list("\n", list(list("x"), list("A string or symbol. If a string, the attributes are\n", #> "removed, if any.")), "\n"), "\n", list("\n", #> "A character vector of length 1.\n"), "\n", list( #> "\n", list("as_string()"), " converts ", list( #> "symbols"), " to character strings.\n"), "\n", #> list(list("Unicode tags"), list("\n", "\n", "\n", #> "Unlike ", list(list("base::as.symbol()")), " and ", #> list(list("base::as.name()")), ", ", list("as_string()"), #> "\n", "automatically transforms unicode tags such as ", #> list("\"<U+5E78>\""), " to the\n", "proper UTF-8 character. This is important on Windows because:\n", #> list("\n", list(), " R on Windows has no UTF-8 support, and uses native encoding instead.\n", #> list(), " The native encodings do not cover all Unicode characters. For\n", #> "example, Western encodings do not support CKJ characters.\n", #> list(), " When a lossy UTF-8 -> native transformation occurs, uncovered\n", #> "characters are transformed to an ASCII unicode tag like ", #> list("\"<U+5E78>\""), ".\n", list(), " Symbols are always encoded in native. This means that\n", #> "transforming the column names of a data frame to symbols might be\n", #> "a lossy operation.\n", list(), " This operation is very common in the tidyverse because of data\n", #> "masking APIs like dplyr where data frames are transformed to\n", #> "environments. While the names of a data frame are stored as a\n", #> "character vector, the bindings of environments are stored as\n", #> "symbols.\n"), "\n", "\n", "Because it reencodes the ASCII unicode tags to their UTF-8\n", #> "representation, the string -> symbol -> string roundtrip is\n", #> "more stable with ", list("as_string()"), ".\n")), #> "\n", "\n", list("\n", "# Let's create some symbols:\n", #> "foo <- quote(foo)\n", "bar <- sym(\"bar\")\n", #> "\n", "# as_string() converts symbols to strings:\n", #> "foo\n", "as_string(foo)\n", "\n", "typeof(bar)\n", #> "typeof(as_string(bar))\n"), "\n", list("\n", #> list(list("as_name()")), " for a higher-level variant of ", #> list("as_string()"), "\n", "that automatically unwraps quosures.\n"), #> "\n"), as_utf8_character.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/utils-encoding.R", #> "\n", list("as_utf8_character"), "\n", list("as_utf8_character"), #> "\n", list("Coerce to a character vector and attempt encoding conversion"), #> "\n", list("\n", "as_utf8_character(x)\n"), "\n", #> list("\n", list(list("x"), list("An object to coerce.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "Unlike specifying the ", list("encoding"), #> " argument in ", list("as_string()"), " and\n", #> list("as_character()"), ", which is only declarative, these functions\n", #> "actually attempt to convert the encoding of their input. There are\n", #> "two possible cases:\n", list("\n", list(), " The string is tagged as UTF-8 or latin1, the only two encodings\n", #> "for which R has specific support. In this case, converting to the\n", #> "same encoding is a no-op, and converting to native always works\n", #> "as expected, as long as the native encoding, the one specified by\n", #> "the ", list("LC_CTYPE"), " locale has support for all characters occurring in\n", #> "the strings. Unrepresentable characters are serialised as unicode\n", #> "points: \"<U+xxxx>\".\n", list(), " The string is not tagged. R assumes that it is encoded in the\n", #> "native encoding. Conversion to native is a no-op, and conversion\n", #> "to UTF-8 should work as long as the string is actually encoded in\n", #> "the locale codeset.\n"), "\n", "\n", "When translating to UTF-8, the strings are parsed for serialised\n", #> "unicode points (e.g. strings looking like \"U+xxxx\") with\n", #> list(list("chr_unserialise_unicode()")), ". This helps to alleviate the effects of\n", #> "character-to-symbol-to-character roundtrips on systems with\n", #> "non-UTF-8 native encoding.\n"), "\n", list("\n", #> "# Let's create a string marked as UTF-8 (which is guaranteed by the\n", #> "# Unicode escaping in the string):\n", "utf8 <- \"caf\\uE9\"\n", #> "Encoding(utf8)\n", "as_bytes(utf8)\n"), "\n", #> list("internal"), "\n"), `bare-type-predicates.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/types.R", "\n", #> list("bare-type-predicates"), "\n", list("bare-type-predicates"), #> "\n", list("is_bare_list"), "\n", list("is_bare_atomic"), #> "\n", list("is_bare_vector"), "\n", list("is_bare_double"), #> "\n", list("is_bare_integer"), "\n", list("is_bare_numeric"), #> "\n", list("is_bare_character"), "\n", list("is_bare_logical"), #> "\n", list("is_bare_raw"), "\n", list("is_bare_string"), #> "\n", list("is_bare_bytes"), "\n", list("Bare type predicates"), #> "\n", list("\n", "is_bare_list(x, n = NULL)\n", "\n", #> "is_bare_atomic(x, n = NULL)\n", "\n", "is_bare_vector(x, n = NULL)\n", #> "\n", "is_bare_double(x, n = NULL)\n", "\n", #> "is_bare_integer(x, n = NULL)\n", "\n", "is_bare_numeric(x, n = NULL)\n", #> "\n", "is_bare_character(x, n = NULL)\n", "\n", #> "is_bare_logical(x, n = NULL)\n", "\n", "is_bare_raw(x, n = NULL)\n", #> "\n", "is_bare_string(x, n = NULL)\n", "\n", #> "is_bare_bytes(x, n = NULL)\n"), "\n", list("\n", #> list(list("x"), list("Object to be tested.")), #> "\n", "\n", list(list("n"), list("Expected length of a vector.")), #> "\n"), "\n", list("\n", "These predicates check for a given type but only return ", #> list("TRUE"), " for\n", "bare R objects. Bare objects have no class attributes. For example,\n", #> "a data frame is a list, but not a bare list.\n"), #> "\n", list("\n", list("\n", list(), " The predicates for vectors include the ", #> list("n"), " argument for\n", "pattern-matching on the vector length.\n", #> list(), " Like ", list(list("is_atomic()")), #> " and unlike base R ", list("is.atomic()"), ",\n", #> list("is_bare_atomic()"), " does not return ", #> list("TRUE"), " for ", list("NULL"), ".\n", list(), #> " Unlike base R ", list("is.numeric()"), ", ", #> list("is_bare_double()"), " only returns\n", #> list("TRUE"), " for floating point numbers.\n"), #> "\n"), "\n", list("\n", list("type-predicates"), #> ", ", list("scalar-type-predicates"), "\n"), #> "\n"), box.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/s3.R", "\n", #> list("box"), "\n", list("box"), "\n", list("new_box"), #> "\n", list("is_box"), "\n", list("unbox"), "\n", #> list("Box a value"), "\n", list("\n", "new_box(.x, class = NULL, ...)\n", #> "\n", "is_box(x, class = NULL)\n", "\n", "unbox(box)\n"), #> "\n", list("\n", list(list("class"), list("For ", #> list("new_box()"), ", an additional class for the\n", #> "boxed value (in addition to ", list("rlang_box"), #> "). For ", list("is_box()"), ", a class\n", "or vector of classes passed to ", #> list(list("inherits_all()")), ".")), "\n", "\n", #> list(list("..."), list("Additional attributes passed to ", #> list(list("base::structure()")), ".")), "\n", #> "\n", list(list("x, .x"), list("An R object.")), #> "\n", "\n", list(list("box"), list("A boxed value to unbox.")), #> "\n"), "\n", list("\n", list("new_box()"), " is similar to ", #> list(list("base::I()")), " but it protects a value by\n", #> "wrapping it in a scalar list rather than by adding an attribute.\n", #> list("unbox()"), " retrieves the boxed value. ", #> list("is_box()"), " tests whether an\n", "object is boxed with optional class. ", #> list("as_box()"), " ensures that a\n", "value is wrapped in a box. ", #> list("as_box_if()"), " does the same but only if\n", #> "the value matches a predicate.\n"), "\n", list( #> "\n", "boxed <- new_box(letters, \"mybox\")\n", #> "is_box(boxed)\n", "is_box(boxed, \"mybox\")\n", #> "is_box(boxed, \"otherbox\")\n", "\n", "unbox(boxed)\n", #> "\n", "# as_box() avoids double-boxing:\n", "boxed2 <- as_box(boxed, \"mybox\")\n", #> "boxed2\n", "unbox(boxed2)\n", "\n", "# Compare to:\n", #> "boxed_boxed <- new_box(boxed, \"mybox\")\n", #> "boxed_boxed\n", "unbox(unbox(boxed_boxed))\n", #> "\n", "# Use `as_box_if()` with a predicate if you need to ensure a box\n", #> "# only for a subset of values:\n", "as_box_if(NULL, is_null, \"null_box\")\n", #> "as_box_if(\"foo\", is_null, \"null_box\")\n"), #> "\n"), call2.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call2"), "\n", list("call2"), "\n", list( #> "Create a call"), "\n", list("\n", "call2(.fn, ..., .ns = NULL)\n"), #> "\n", list("\n", list(list(".fn"), list("Function to call. Must be a callable object: a string,\n", #> "symbol, call, or a function.")), "\n", "\n", #> list(list("..."), list("<", list("dynamic"), #> "> Arguments for the function\n", "call. Empty arguments are preserved.")), #> "\n", "\n", list(list(".ns"), list("Namespace with which to prefix ", #> list(".fn"), ". Must be a string\n", "or symbol.")), #> "\n"), "\n", list("\n", "Quoted function calls are one of the two types of\n", #> list("symbolic"), " objects in R. They represent the action of\n", #> "calling a function, possibly with arguments. There are two ways of\n", #> "creating a quoted call:\n", list("\n", list(), #> " By ", list("quoting"), " it. Quoting prevents functions from being\n", #> "called. Instead, you get the description of the function call as\n", #> "an R object. That is, a quoted function call.\n", #> list(), " By constructing it with ", list(list( #> "base::call()")), ", ", list(list("base::as.call()")), #> ", or\n", list("call2()"), ". In this case, you pass the call elements (the function\n", #> "to call and the arguments to call it with) separately.\n"), #> "\n", "\n", "See section below for the difference between ", #> list("call2()"), " and the base\n", "constructors.\n"), #> "\n", list(list("Difference with base constructors"), #> list("\n", "\n", "\n", list("call2()"), " is more flexible and convenient than ", #> list("base::call()"), ":\n", list("\n", list(), #> " The function to call can be a string or a ", #> list("callable"), "\n", "object: a symbol, another call (e.g. a ", #> list("$"), " or ", list("[["), " call), or a\n", #> "function to inline. ", list("base::call()"), #> " only supports strings and you\n", "need to use ", #> list("base::as.call()"), " to construct a call with a callable\n", #> "object.", list("call2(list, 1, 2)\n", "\n", #> "as.call(list(list, 1, 2))\n"), "\n", list(), #> " The ", list(".ns"), " argument is convenient for creating namespaced calls.", #> list("call2(\"list\", 1, 2, .ns = \"base\")\n", #> "\n", "ns_call <- as.call(list(as.name(\"::\"), as.name(\"list\"), as.name(\"base\")))\n", #> "as.call(list(ns_call, 1, 2))\n"), "\n", #> list(), " ", list("call2()"), " has ", list( #> "tidy dots"), " support and you can splice lists\n", #> "of arguments with ", list("!!!"), ". With base R, you need to use ", #> list("as.call()"), "\n", "instead of ", list( #> "call()"), " if the arguments are in a list.", #> list("args <- list(na.rm = TRUE, trim = 0)\n", #> "\n", "call2(\"mean\", 1:10, !!!args)\n", #> "\n", "as.call(c(list(as.name(\"mean\"), 1:10), args))\n"), #> "\n"), "\n")), "\n", "\n", list(list("Caveats of inlining objects in calls"), #> list("\n", "\n", "\n", list("call2()"), " makes it possible to inline objects in calls, both in\n", #> "function and argument positions. Inlining an object or a function\n", #> "has the advantage that the correct object is used in all\n", #> "environments. If all components of the code are inlined, you can\n", #> "even evaluate in the ", list("empty environment"), #> ".\n", "\n", "However inlining also has drawbacks. It can cause issues with NSE\n", #> "functions that expect symbolic arguments. The objects may also leak\n", #> "in representations of the call stack, such as ", #> list(list("traceback()")), ".\n")), "\n", "\n", #> list("\n", "# fn can either be a string, a symbol or a call\n", #> "call2(\"f\", a = 1)\n", "call2(quote(f), a = 1)\n", #> "call2(quote(f()), a = 1)\n", "\n", "#' Can supply arguments individually or in a list\n", #> "call2(quote(f), a = 1, b = 2)\n", "call2(quote(f), !!!list(a = 1, b = 2))\n", #> "\n", "# Creating namespaced calls is easy:\n", #> "call2(\"fun\", arg = quote(baz), .ns = \"mypkg\")\n", #> "\n", "# Empty arguments are preserved:\n", "call2(\"[\", quote(x), , drop = )\n"), #> "\n", list("\n", "call_modify\n"), "\n"), call_args.Rd = list( #> "% Generated by roxygen2: do not edit by hand", "\n", #> "% Please edit documentation in R/call.R", "\n", #> list("call_args"), "\n", list("call_args"), "\n", #> list("call_args_names"), "\n", list("Extract arguments from a call"), #> "\n", list("\n", "call_args(call)\n", "\n", "call_args_names(call)\n"), #> "\n", list("\n", list(list("call"), list("Can be a call or a quosure that wraps a call.")), #> "\n"), "\n", list("\n", "A named list of arguments.\n"), #> "\n", list("\n", "Extract arguments from a call\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", "\n", #> "In rlang 0.2.0, ", list("lang_args()"), " and ", #> list("lang_args_names()"), " were\n", "deprecated and renamed to ", #> list("call_args()"), " and ", list("call_args_names()"), #> ".\n", "See lifecycle section in ", list(list( #> "call2()")), " for more about this change.\n")), #> "\n", "\n", list("\n", "call <- quote(f(a, b))\n", #> "\n", "# Subsetting a call returns the arguments converted to a language\n", #> "# object:\n", "call[-1]\n", "\n", "# On the other hand, call_args() returns a regular list that is\n", #> "# often easier to work with:\n", "str(call_args(call))\n", #> "\n", "# When the arguments are unnamed, a vector of empty strings is\n", #> "# supplied (rather than NULL):\n", "call_args_names(call)\n"), #> "\n", list("\n", list(list("fn_fmls()")), " and ", #> list(list("fn_fmls_names()")), "\n"), "\n"), #> call_fn.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call_fn"), "\n", list("call_fn"), #> "\n", list("Extract function from a call"), "\n", #> list("\n", "call_fn(call, env = caller_env())\n"), #> "\n", list("\n", list(list("call"), list("Can be a call or a quosure that wraps a call.")), #> "\n", "\n", list(list("env"), list("The environment where to find the definition of the\n", #> "function quoted in ", list("call"), " in case ", #> list("call"), " is not wrapped in a\n", "quosure.")), #> "\n"), "\n", list("\n", "If a frame or formula, the function will be retrieved from the\n", #> "associated environment. Otherwise, it is looked up in the calling\n", #> "frame.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "In rlang 0.2.0, ", #> list("lang_fn()"), " was deprecated and renamed to\n", #> list("call_fn()"), ". See lifecycle section in ", #> list(list("call2()")), " for more about this\n", #> "change.\n")), "\n", "\n", list("\n", "# Extract from a quoted call:\n", #> "call_fn(quote(matrix()))\n", "call_fn(quo(matrix()))\n", #> "\n", "# Extract the calling function\n", "test <- function() call_fn(call_frame())\n", #> "test()\n"), "\n", list("\n", list(list("call_name()")), #> "\n"), "\n"), call_inspect.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/stack.R", #> "\n", list("call_inspect"), "\n", list("call_inspect"), #> "\n", list("Inspect a call"), "\n", list("\n", #> "call_inspect(...)\n"), "\n", list("\n", list( #> list("..."), list("Arguments to display in the returned call.")), #> "\n"), "\n", list("\n", "This function is useful for quick testing and debugging when you\n", #> "manipulate expressions and calls. It lets you check that a function\n", #> "is called with the right arguments. This can be useful in unit\n", #> "tests for instance. Note that this is just a simple wrapper around\n", #> list(list("base::match.call()")), ".\n"), "\n", #> list("\n", "call_inspect(foo(bar), \"\" %>% identity())\n"), #> "\n"), call_modify.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call_modify"), "\n", list("call_modify"), #> "\n", list("Modify the arguments of a call"), #> "\n", list("\n", "call_modify(\n", " .call,\n", #> " ...,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .standardise = NULL,\n", " .env = caller_env()\n", #> ")\n"), "\n", list("\n", list(list(".call"), #> list("Can be a call, a formula quoting a call in the\n", #> "right-hand side, or a frame object from which to extract the call\n", #> "expression.")), "\n", "\n", list(list("..."), #> list("<", list("dynamic"), "> Named or unnamed expressions\n", #> "(constants, names or calls) used to modify the call. Use ", #> list(list("zap()")), "\n", "to remove arguments. Empty arguments are preserved.")), #> "\n", "\n", list(list(".homonyms"), list("How to treat arguments with the same name. The\n", #> "default, ", list("\"keep\""), ", preserves these arguments. Set ", #> list(".homonyms"), " to\n", list("\"first\""), #> " to only keep the first occurrences, to ", #> list("\"last\""), " to keep\n", "the last occurrences, and to ", #> list("\"error\""), " to raise an informative\n", #> "error and indicate what arguments have duplicated names.")), #> "\n", "\n", list(list(".standardise, .env"), #> list("Soft-deprecated as of rlang 0.3.0. Please\n", #> "call ", list(list("call_standardise()")), #> " manually.")), "\n"), "\n", list("\n", #> "A quosure if ", list(".call"), " is a quosure, a call otherwise.\n"), #> "\n", list("\n", "If you are working with a user-supplied call, make sure the\n", #> "arguments are standardised with ", list(list( #> "call_standardise()")), " before\n", "modifying the call.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> list("\n", list(), " The ", list(".standardise"), #> " argument is deprecated as of rlang 0.3.0.\n", #> list(), " In rlang 0.2.0, ", list("lang_modify()"), #> " was deprecated and renamed to\n", list( #> "call_modify()"), ". See lifecycle section in ", #> list(list("call2()")), " for more about\n", #> "this change.\n"), "\n")), "\n", "\n", list( #> "\n", "call <- quote(mean(x, na.rm = TRUE))\n", #> "\n", "# Modify an existing argument\n", "call_modify(call, na.rm = FALSE)\n", #> "call_modify(call, x = quote(y))\n", "\n", #> "# Remove an argument\n", "call_modify(call, na.rm = zap())\n", #> "\n", "# Add a new argument\n", "call_modify(call, trim = 0.1)\n", #> "\n", "# Add an explicit missing argument:\n", #> "call_modify(call, na.rm = )\n", "\n", "# Supply a list of new arguments with `!!!`\n", #> "newargs <- list(na.rm = NULL, trim = 0.1)\n", #> "call <- call_modify(call, !!!newargs)\n", #> "call\n", "\n", "# Remove multiple arguments by splicing zaps:\n", #> "newargs <- rep_named(c(\"na.rm\", \"trim\"), list(zap()))\n", #> "call <- call_modify(call, !!!newargs)\n", #> "call\n", "\n", "\n", "# Modify the `...` arguments as if it were a named argument:\n", #> "call <- call_modify(call, ... = )\n", "call\n", #> "\n", "call <- call_modify(call, ... = zap())\n", #> "call\n", "\n", "\n", "# When you're working with a user-supplied call, standardise it\n", #> "# beforehand because it might contain unmatched arguments:\n", #> "user_call <- quote(matrix(x, nc = 3))\n", #> "call_modify(user_call, ncol = 1)\n", "\n", #> "# Standardising applies the usual argument matching rules:\n", #> "user_call <- call_standardise(user_call)\n", #> "user_call\n", "call_modify(user_call, ncol = 1)\n", #> "\n", "\n", "# You can also modify quosures inplace:\n", #> "f <- quo(matrix(bar))\n", "call_modify(f, quote(foo))\n", #> "\n", "\n", "# By default, arguments with the same name are kept. This has\n", #> "# subtle implications, for instance you can move an argument to\n", #> "# last position by removing it and remapping it:\n", #> "call <- quote(foo(bar = , baz))\n", "call_modify(call, bar = NULL, bar = missing_arg())\n", #> "\n", "# You can also choose to keep only the first or last homonym\n", #> "# arguments:\n", "args <- list(bar = NULL, bar = missing_arg())\n", #> "call_modify(call, !!!args, .homonyms = \"first\")\n", #> "call_modify(call, !!!args, .homonyms = \"last\")\n"), #> "\n"), call_name.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call_name"), "\n", list("call_name"), #> "\n", list("call_ns"), "\n", list("Extract function name or namespace of a call"), #> "\n", list("\n", "call_name(call)\n", "\n", "call_ns(call)\n"), #> "\n", list("\n", list(list("call"), list("Can be a call or a quosure that wraps a call.")), #> "\n"), "\n", list("\n", "A string with the function name, or ", #> list("NULL"), " if the function\n", "is anonymous.\n"), #> "\n", list("\n", "Extract function name or namespace of a call\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "In rlang 0.2.0, ", list("lang_name()"), #> " was deprecated and renamed to\n", list("call_name()"), #> ". See lifecycle section in ", list(list("call2()")), #> " for more about\n", "this change.\n")), "\n", #> "\n", list("\n", "# Extract the function name from quoted calls:\n", #> "call_name(quote(foo(bar)))\n", "call_name(quo(foo(bar)))\n", #> "\n", "# Namespaced calls are correctly handled:\n", #> "call_name(~base::matrix(baz))\n", "\n", "# Anonymous and subsetted functions return NULL:\n", #> "call_name(quote(foo$bar()))\n", "call_name(quote(foo[[bar]]()))\n", #> "call_name(quote(foo()()))\n", "\n", "# Extract namespace of a call with call_ns():\n", #> "call_ns(quote(base::bar()))\n", "\n", "# If not namespaced, call_ns() returns NULL:\n", #> "call_ns(quote(bar()))\n"), "\n", list("\n", #> list(list("call_fn()")), "\n"), "\n"), call_parse_type.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call_parse_type"), "\n", list("call_parse_type"), #> "\n", list("What is the parser type of a call?"), #> "\n", list("\n", "call_parse_type(call)\n"), #> "\n", list("\n", "What is the parser type of a call?\n"), #> "\n", list("internal"), "\n"), call_standardise.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("call_standardise"), "\n", list("call_standardise"), #> "\n", list("Standardise a call"), "\n", list( #> "\n", "call_standardise(call, env = caller_env())\n"), #> "\n", list("\n", list(list("call"), list("Can be a call or a quosure that wraps a call.")), #> "\n", "\n", list(list("env"), list("The environment where to find the definition of the\n", #> "function quoted in ", list("call"), " in case ", #> list("call"), " is not wrapped in a\n", "quosure.")), #> "\n"), "\n", list("\n", "A quosure if ", list( #> "call"), " is a quosure, a raw call otherwise.\n"), #> "\n", list("\n", "This is essentially equivalent to ", #> list(list("base::match.call()")), ", but with\n", #> "experimental handling of primitive functions.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "In rlang 0.2.0, ", list("lang_standardise()"), #> " was deprecated and renamed to\n", list("call_standardise()"), #> ". See lifecycle section in ", list(list("call2()")), #> " for more\n", "about this change.\n")), "\n", #> "\n"), caller_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("caller_env"), "\n", list("caller_env"), #> "\n", list("current_env"), "\n", list("Get the current or caller environment"), #> "\n", list("\n", "caller_env(n = 1)\n", "\n", #> "current_env()\n"), "\n", list("\n", list(list( #> "n"), list("Number of frames to go back.")), #> "\n"), "\n", list("\n", list("\n", list(), #> " The current environment is the execution environment of the\n", #> "current function (the one currently being evaluated).\n", #> list(), " The caller environment is the execution environment of the\n", #> "function that called the current function.\n"), #> "\n"), "\n", list("\n", "if (FALSE) {\n", "\n", #> "# Let's create a function that returns its current environment and\n", #> "# its caller environment:\n", "fn <- function() list(current = current_env(), caller = caller_env())\n", #> "\n", "# The current environment is an unique execution environment\n", #> "# created when `fn()` was called. The caller environment is the\n", #> "# global env because that's where we called `fn()`.\n", #> "fn()\n", "\n", "# Let's call `fn()` again but this time within a function:\n", #> "g <- function() fn()\n", "\n", "# Now the caller environment is also a unique execution environment.\n", #> "# This is the exec env created by R for our call to g():\n", #> "g()\n", "\n", "}\n"), "\n", list("\n", list( #> list("caller_frame()")), " and ", list(list( #> "current_frame()")), "\n"), "\n"), caller_fn.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/stack.R", #> "\n", list("caller_fn"), "\n", list("caller_fn"), #> "\n", list("current_fn"), "\n", list("Get properties of the current or caller frame"), #> "\n", list("\n", "caller_fn(n = 1)\n", "\n", #> "current_fn()\n"), "\n", list("\n", list(list( #> "n"), list("The number of generations to go back.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", list("\n", list(), " The current frame is the execution context of the function that\n", #> "is currently being evaluated.\n", list(), #> " The caller frame is the execution context of the function that\n", #> "called the function currently being evaluated.\n"), #> "\n", "\n", "See the ", list("call stack"), #> " topic for more information.\n"), "\n", list( #> list("Life cycle"), list("\n", "\n", "\n", #> "These functions are experimental.\n")), #> "\n", "\n", list("\n", list(list("caller_env()")), #> " and ", list(list("current_env()")), "\n"), #> "\n", list("internal"), "\n"), caller_frame.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("caller_frame"), "\n", list("caller_frame"), #> "\n", list("Get caller frame"), "\n", list("\n", #> "caller_frame(n = 1)\n"), "\n", list("\n", #> list(list("n"), list("Number of frames to go back.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n"), "\n", list("internal"), "\n"), catch_cnd.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-handlers.R", #> "\n", list("catch_cnd"), "\n", list("catch_cnd"), #> "\n", list("Catch a condition"), "\n", list("\n", #> "catch_cnd(expr, classes = \"condition\")\n"), #> "\n", list("\n", list(list("expr"), list("Expression to be evaluated with a catching condition\n", #> "handler.")), "\n", "\n", list(list("classes"), #> list("A character vector of condition classes to catch. By\n", #> "default, catches all conditions.")), "\n"), #> "\n", list("\n", "A condition if any was signalled, ", #> list("NULL"), " otherwise.\n"), "\n", list( #> "\n", "This is a small wrapper around ", list( #> "tryCatch()"), " that captures any\n", "condition signalled while evaluating its argument. It is useful for\n", #> "situations where you expect a specific condition to be signalled,\n", #> "for debugging, and for unit testing.\n"), #> "\n", list("\n", "catch_cnd(10)\n", "catch_cnd(abort(\"an error\"))\n", #> "catch_cnd(signal(\"my_condition\", message = \"a condition\"))\n"), #> "\n"), chr_unserialise_unicode.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/utils-encoding.R", #> "\n", list("chr_unserialise_unicode"), "\n", #> list("chr_unserialise_unicode"), "\n", list("Translate unicode points to UTF-8"), #> "\n", list("\n", "chr_unserialise_unicode(chr)\n"), #> "\n", list("\n", list(list("chr"), list("A character vector.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "For historical reasons, R translates strings to the native encoding\n", #> "when they are converted to symbols. This string-to-symbol\n", #> "conversion is not a rare occurrence and happens for instance to the\n", #> "names of a list of arguments converted to a call by ", #> list("do.call()"), ".\n", "\n", "If the string contains unicode characters that cannot be\n", #> "represented in the native encoding, R serialises those as an ASCII\n", #> "sequence representing the unicode point. This is why Windows users\n", #> "with western locales often see strings looking like ", #> list("<U+xxxx>"), ". To\n", "alleviate some of the pain, rlang parses strings and looks for\n", #> "serialised unicode points to translate them back to the proper\n", #> "UTF-8 representation. This transformation occurs automatically in\n", #> "functions like ", list(list("env_names()")), #> " and can be manually triggered with\n", list( #> "as_utf8_character()"), " and ", list("chr_unserialise_unicode()"), #> ".\n"), "\n", list(list("Life cycle"), list( #> "\n", "\n", "\n", "This function is experimental.\n")), #> "\n", "\n", list("\n", "ascii <- \"<U+5E78>\"\n", #> "chr_unserialise_unicode(ascii)\n", "\n", "identical(chr_unserialise_unicode(ascii), \"\\u5e78\")\n"), #> "\n", list("internal"), "\n"), cnd.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-error.R, R/cnd.R", #> "\n", list("error_cnd"), "\n", list("error_cnd"), #> "\n", list("cnd"), "\n", list("warning_cnd"), #> "\n", list("message_cnd"), "\n", list("Create a condition object"), #> "\n", list("\n", "error_cnd(class = NULL, ..., message = \"\", trace = NULL, parent = NULL)\n", #> "\n", "cnd(class, ..., message = \"\")\n", #> "\n", "warning_cnd(class = NULL, ..., message = \"\")\n", #> "\n", "message_cnd(class = NULL, ..., message = \"\")\n"), #> "\n", list("\n", list(list("class"), list("The condition subclass.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> Named data fields stored inside\n", #> "the condition object.")), "\n", "\n", list( #> list("message"), list("A default message to inform the user about the\n", #> "condition when it is signalled.")), "\n", #> "\n", list(list("trace"), list("A ", list("trace"), #> " object created by ", list(list("trace_back()")), #> ".")), "\n", "\n", list(list("parent"), list( #> "A parent condition object created by ", #> list(list("abort()")), ".")), "\n"), "\n", #> list("\n", "These constructors make it easy to create subclassed conditions.\n", #> "Conditions are objects that power the error system in R. They can\n", #> "also be used for passing messages to pre-established handlers.\n"), #> "\n", list("\n", list("cnd()"), " creates objects inheriting from ", #> list("condition"), ". Conditions\n", "created with ", #> list("error_cnd()"), ", ", list("warning_cnd()"), #> " and ", list("message_cnd()"), "\n", "inherit from ", #> list("error"), ", ", list("warning"), " or ", #> list("message"), ".\n"), "\n", list("\n", "# Create a condition inheriting from the s3 type \"foo\":\n", #> "cnd <- cnd(\"foo\")\n", "\n", "# Signal the condition to potential handlers. Since this is a bare\n", #> "# condition the signal has no effect if no handlers are set up:\n", #> "cnd_signal(cnd)\n", "\n", "# When a relevant handler is set up, the signal causes the handler\n", #> "# to be called:\n", "with_handlers(cnd_signal(cnd), foo = exiting(function(c) \"caught!\"))\n", #> "\n", "# Handlers can be thrown or executed inplace. See with_handlers()\n", #> "# documentation for more on this.\n", "\n", #> "# Signalling an error condition aborts the current computation:\n", #> "err <- error_cnd(\"foo\", message = \"I am an error\")\n", #> "try(cnd_signal(err))\n"), "\n", list("\n", #> list(list("cnd_signal()")), ", ", list(list( #> "with_handlers()")), ".\n"), "\n", list("internal"), #> "\n"), cnd_message.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-message.R", #> "\n", list("cnd_message"), "\n", list("cnd_message"), #> "\n", list("cnd_header"), "\n", list("cnd_body"), #> "\n", list("cnd_footer"), "\n", list("Build an error message from parts"), #> "\n", list("\n", "cnd_message(cnd)\n", "\n", #> "cnd_header(cnd, ...)\n", "\n", "cnd_body(cnd, ...)\n", #> "\n", "cnd_footer(cnd, ...)\n"), "\n", list( #> "\n", list(list("cnd"), list("A condition object.")), #> "\n", "\n", list(list("..."), list("Arguments passed to methods.")), #> "\n"), "\n", list("\n", list("cnd_message()"), #> " assembles an error message from three generics:\n", #> list("\n", list(), " ", list("cnd_header()"), #> "\n", list(), " ", list("cnd_body()"), "\n", #> list(), " ", list("cnd_footer()"), "\n"), #> "\n", "\n", "The default method for the error header returns the ", #> list("message"), " field\n", "of the condition object. The default methods for the body and\n", #> "footer return empty character vectors. In general, methods for\n", #> "these generics should return a character vector. The elements are\n", #> "combined into a single string with a newline separator.\n", #> "\n", list("cnd_message()"), " is automatically called by the ", #> list("conditionMessage()"), "\n", "for rlang errors. Error classes created with ", #> list(list("abort()")), " only need to\n", "implement header, body or footer methods. This provides a lot of\n", #> "flexibility for hierarchies of error classes, for instance you\n", #> "could inherit the body of an error message from a parent class\n", #> "while overriding the header and footer.\n"), #> "\n", list(list("Overriding ", list("cnd_body()")), #> list("\n", "\n", "\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "Sometimes the contents of an error message depends on the state of\n", #> "your checking routine. In that case, it can be tricky to lazily\n", #> "generate error messages with ", list("cnd_body()"), #> ": you have the choice\n", "between overspecifying your error class hierarchies with one class\n", #> "per state, or replicating the type-checking control flow within the\n", #> list("cnd_body()"), " method. None of these options are ideal.\n", #> "\n", "A better option is to define a ", #> list("body"), " field in your error object\n", #> "containing a static string, a ", list("lambda-formula"), #> ", or a\n", "function with the same signature as ", #> list("cnd_body()"), ". This field\n", "overrides the ", #> list("cnd_body()"), " generic and makes it easy to generate an\n", #> "error message tailored to the state in which the error was\n", #> "constructed.\n")), "\n", "\n"), cnd_muffle.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-handlers.R", #> "\n", list("cnd_muffle"), "\n", list("cnd_muffle"), #> "\n", list("Muffle a condition"), "\n", list( #> "\n", "cnd_muffle(cnd)\n"), "\n", list("\n", #> list(list("cnd"), list("A condition to muffle.")), #> "\n"), "\n", list("\n", "If ", list("cnd"), #> " is mufflable, ", list("cnd_muffle()"), " jumps to the muffle\n", #> "restart and doesn't return. Otherwise, it returns ", #> list("FALSE"), ".\n"), "\n", list("\n", "Unlike ", #> list(list("exiting()")), " handlers, ", list( #> list("calling()")), " handlers must be explicit\n", #> "that they have handled a condition to stop it from propagating to\n", #> "other handlers. Use ", list("cnd_muffle()"), #> " within a calling handler (or as\n", "a calling handler, see examples) to prevent any other handlers from\n", #> "being called for that condition.\n"), "\n", #> list(list("Mufflable conditions"), list("\n", #> "\n", "\n", "Most conditions signalled by base R are muffable, although the name\n", #> "of the restart varies. cnd_muffle() will automatically call the\n", #> "correct restart for you. It is compatible with the following\n", #> "conditions:\n", list("\n", list(), " ", list( #> "warning"), " and ", list("message"), " conditions. In this case ", #> list("cnd_muffle()"), "\n", "is equivalent to ", #> list(list("base::suppressMessages()")), " and\n", #> list(list("base::suppressWarnings()")), ".\n", #> list(), " Bare conditions signalled with ", #> list("signal()"), " or ", list(list("cnd_signal()")), #> ". Note\n", "that conditions signalled with ", #> list(list("base::signalCondition()")), " are not\n", #> "mufflable.\n", list(), " Interrupts are sometimes signalled with a ", #> list("resume"), " restart on\n", "recent R versions. When this is the case, you can muffle the\n", #> "interrupt with ", list("cnd_muffle()"), #> ". Check if a restart is available\n", "with ", #> list("base::findRestart(\"resume\")"), ".\n"), #> "\n", "\n", "If you call ", list("cnd_muffle()"), #> " with a condition that is not mufflable\n", #> "you will cause a new error to be signalled.\n", #> list("\n", list(), " Errors are not mufflable since they are signalled in critical\n", #> "situations where execution cannot continue safely.\n", #> list(), " Conditions captured with ", list( #> list("base::tryCatch()")), ", ", list(list( #> "with_handlers()")), " or\n", list(list( #> "catch_cnd()")), " are no longer mufflable. Muffling restarts ", #> list("must"), "\n", "be called from a ", #> list("calling"), " handler.\n"), "\n")), #> "\n", "\n", list("\n", "fn <- function() {\n", #> " inform(\"Beware!\", \"my_particular_msg\")\n", #> " inform(\"On your guard!\")\n", " \"foobar\"\n", #> "}\n", "\n", "# Let's install a muffling handler for the condition thrown by `fn()`.\n", #> "# This will suppress all `my_particular_wng` warnings but let other\n", #> "# types of warnings go through:\n", "with_handlers(fn(),\n", #> " my_particular_msg = calling(function(cnd) {\n", #> " inform(\"Dealt with this particular message\")\n", #> " cnd_muffle(cnd)\n", " })\n", ")\n", "\n", #> "# Note how execution of `fn()` continued normally after dealing\n", #> "# with that particular message.\n", "\n", #> "# cnd_muffle() can also be passed to with_handlers() as a calling\n", #> "# handler:\n", "with_handlers(fn(),\n", " my_particular_msg = calling(cnd_muffle)\n", #> ")\n"), "\n", list("internal"), "\n"), cnd_signal.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-signal.R", #> "\n", list("cnd_signal"), "\n", list("cnd_signal"), #> "\n", list("Signal a condition object"), "\n", #> list("\n", "cnd_signal(cnd, ...)\n"), "\n", list( #> "\n", list(list("cnd"), list("A condition object (see ", #> list(list("cnd()")), "). If ", list("NULL"), #> ",\n", list("cnd_signal()"), " returns without signalling a condition.")), #> "\n", "\n", list(list("..."), list("These dots are for extensions and must be empty.")), #> "\n"), "\n", list("\n", "The type of signal depends on the class of the condition:\n", #> list("\n", list(), " A message is signalled if the condition inherits from\n", #> list("\"message\""), ". This is equivalent to signalling with ", #> list(list("inform()")), " or\n", list(list( #> "base::message()")), ".\n", list(), " A warning is signalled if the condition inherits from\n", #> list("\"warning\""), ". This is equivalent to signalling with ", #> list(list("warn()")), " or\n", list(list( #> "base::warning()")), ".\n", list(), " An error is signalled if the condition inherits from\n", #> list("\"error\""), ". This is equivalent to signalling with ", #> list(list("abort()")), " or\n", list(list( #> "base::stop()")), ".\n", list(), " An interrupt is signalled if the condition inherits from\n", #> list("\"interrupt\""), ". This is equivalent to signalling with\n", #> list(list("interrupt()")), ".\n"), "\n", #> "\n", "Use ", list(list("cnd_type()")), " to determine the type of a condition.\n"), #> "\n", list("\n", "# The type of signal depends on the class. If the condition\n", #> "# inherits from \"warning\", a warning is issued:\n", #> "cnd <- warning_cnd(\"my_warning_class\", message = \"This is a warning\")\n", #> "cnd_signal(cnd)\n", "\n", "# If it inherits from \"error\", an error is raised:\n", #> "cnd <- error_cnd(\"my_error_class\", message = \"This is an error\")\n", #> "try(cnd_signal(cnd))\n"), "\n", list("\n", #> list(list("abort()")), ", ", list(list("warn()")), #> " and ", list(list("inform()")), " for creating and\n", #> "signalling structured R conditions. See ", #> list(list("with_handlers()")), " for\n", "establishing condition handlers.\n"), #> "\n"), cnd_type.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd.R", #> "\n", list("cnd_type"), "\n", list("cnd_type"), #> "\n", list("What type is a condition?"), "\n", #> list("\n", "cnd_type(cnd)\n"), "\n", list("\n", #> list(list("cnd"), list("A condition object.")), #> "\n"), "\n", list("\n", "A string, either ", #> list("\"condition\""), ", ", list("\"message\""), #> ", ", list("\"warning\""), ",\n", list("\"error\""), #> " or ", list("\"interrupt\""), ".\n"), "\n", #> list("\n", "Use ", list("cnd_type()"), " to check what type a condition is.\n"), #> "\n", list("\n", "cnd_type(catch_cnd(abort(\"Abort!\")))\n", #> "cnd_type(catch_cnd(interrupt()))\n"), "\n", #> list("internal"), "\n"), done.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/s3.R", #> "\n", list("done"), "\n", list("done"), "\n", #> list("is_done_box"), "\n", list("Box a final value for early termination"), #> "\n", list("\n", "done(x)\n", "\n", "is_done_box(x, empty = NULL)\n"), #> "\n", list("\n", list(list("x"), list("For ", #> list("done()"), ", a value to box. For ", list( #> "is_done_box()"), ", a\n", "value to test.")), #> "\n", "\n", list(list("empty"), list("Whether the box is empty. If ", #> list("NULL"), ", ", list("is_done_box()"), #> "\n", "returns ", list("TRUE"), " for all done boxes. If ", #> list("TRUE"), ", it returns ", list("TRUE"), #> "\n", "only for empty boxes. Otherwise it returns ", #> list("TRUE"), " only for\n", "non-empty boxes.")), #> "\n"), "\n", list("\n", "A ", list("boxed"), #> " value.\n"), "\n", list("\n", "A value boxed with ", #> list("done()"), " signals to its caller that it\n", #> "should stop iterating. Use it to shortcircuit a loop.\n"), #> "\n", list("\n", "done(3)\n", "\n", "x <- done(3)\n", #> "is_done_box(x)\n"), "\n"), dots_definitions.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("dots_definitions"), "\n", list("dots_definitions"), #> "\n", list("Capture definition objects"), "\n", #> list("\n", "dots_definitions(\n", " ...,\n", #> " .named = FALSE,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\")\n", #> ")\n"), "\n", list("\n", list(list("..."), #> list("For ", list("enexprs()"), ", ", list( #> "ensyms()"), " and ", list("enquos()"), ", names of\n", #> "arguments to capture without evaluation (including ", #> list("..."), "). For\n", list("exprs()"), #> " and ", list("quos()"), ", the expressions to capture unevaluated\n", #> "(including expressions contained in ", list( #> "..."), ").")), "\n", "\n", list(list(".named"), #> list("Whether to ensure all dots are named. Unnamed\n", #> "elements are processed with ", list(list( #> "as_label()")), " to build a default\n", #> "name.")), "\n", "\n", list(list(".ignore_empty"), #> list("Whether to ignore empty arguments. Can be one\n", #> "of ", list("\"trailing\""), ", ", list("\"none\""), #> ", ", list("\"all\""), ". If ", list("\"trailing\""), #> ", only the\n", "last argument is ignored if it is empty. Note that ", #> list("\"trailing\""), "\n", "applies only to arguments passed in ", #> list("..."), ", not to named\n", "arguments. On the other hand, ", #> list("\"all\""), " also applies to named\n", #> "arguments.")), "\n"), "\n", list("\n", "Capture definition objects\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", list("dots_definitions()"), " is experimental. Expect API changes.\n")), #> "\n", "\n", list("internal"), "\n"), dots_n.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("dots_n"), "\n", list("dots_n"), "\n", #> list("How many arguments are currently forwarded in dots?"), #> "\n", list("\n", "dots_n(...)\n"), "\n", list( #> "\n", list(list("..."), list("Forwarded arguments.")), #> "\n"), "\n", list("\n", "This returns the number of arguments currently forwarded in ", #> list("..."), "\n", "as an integer.\n"), "\n", #> list("\n", "fn <- function(...) dots_n(..., baz)\n", #> "fn(foo, bar)\n"), "\n", list("internal"), #> "\n"), dots_values.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("dots_values"), "\n", list("dots_values"), #> "\n", list("Evaluate dots with preliminary splicing"), #> "\n", list("\n", "dots_values(\n", " ...,\n", #> " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .preserve_empty = FALSE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n"), "\n", #> list("\n", list(list("..."), list("Arguments to evaluate and process splicing operators.")), #> "\n", "\n", list(list(".ignore_empty"), list( #> "Whether to ignore empty arguments. Can be one\n", #> "of ", list("\"trailing\""), ", ", list("\"none\""), #> ", ", list("\"all\""), ". If ", list("\"trailing\""), #> ", only the\n", "last argument is ignored if it is empty.")), #> "\n", "\n", list(list(".preserve_empty"), list( #> "Whether to preserve the empty arguments that\n", #> "were not ignored. If ", list("TRUE"), ", empty arguments are stored with\n", #> list(list("missing_arg()")), " values. If ", #> list("FALSE"), " (the default) an error is\n", #> "thrown when an empty argument is detected.")), #> "\n", "\n", list(list(".homonyms"), list("How to treat arguments with the same name. The\n", #> "default, ", list("\"keep\""), ", preserves these arguments. Set ", #> list(".homonyms"), " to\n", list("\"first\""), #> " to only keep the first occurrences, to ", #> list("\"last\""), " to keep\n", "the last occurrences, and to ", #> list("\"error\""), " to raise an informative\n", #> "error and indicate what arguments have duplicated names.")), #> "\n", "\n", list(list(".check_assign"), list( #> "Whether to check for ", list("<-"), " calls passed in\n", #> "dots. When ", list("TRUE"), " and a ", list( #> "<-"), " call is detected, a warning is\n", #> "issued to advise users to use ", list("="), #> " if they meant to match a\n", "function parameter, or wrap the ", #> list("<-"), " call in braces otherwise.\n", #> "This ensures assignments are explicit.")), #> "\n"), "\n", list("\n", "This is a tool for advanced users. It captures dots, processes\n", #> "unquoting and splicing operators, and evaluates them. Unlike\n", #> list(list("dots_list()")), ", it does not flatten spliced objects, instead they\n", #> "are attributed a ", list("spliced"), " class (see ", #> list(list("splice()")), "). You can process\n", #> "spliced objects manually, perhaps with a custom predicate (see\n", #> list(list("flatten_if()")), ").\n"), "\n", #> list("\n", "dots <- dots_values(!!! list(1, 2), 3)\n", #> "dots\n", "\n", "# Flatten the objects marked as spliced:\n", #> "flatten_if(dots, is_spliced)\n"), "\n", list( #> "internal"), "\n"), duplicate.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/sexp.R", #> "\n", list("duplicate"), "\n", list("duplicate"), #> "\n", list("Duplicate an R object"), "\n", list( #> "\n", "duplicate(x, shallow = FALSE)\n"), "\n", #> list("\n", list(list("x"), list("Any R object. However, uncopyable types like symbols and\n", #> "environments are returned as is (just like with ", #> list("<-"), ").")), "\n", "\n", list(list("shallow"), #> list("This is relevant for recursive data structures like\n", #> "lists, calls and pairlists. A shallow copy only duplicates the\n", #> "top-level data structure. The objects contained in the list are\n", #> "still the same.")), "\n"), "\n", list("\n", #> "In R semantics, objects are copied by value. This means that\n", #> "modifying the copy leaves the original object intact. Since\n", #> "copying data in memory is an expensive operation, copies in R are\n", #> "as lazy as possible. They only happen when the new object is\n", #> "actually modified. However, some operations (like ", #> list(list("node_poke_car()")), "\n", "or ", #> list(list("node_poke_cdr()")), ") do not support copy-on-write. In those cases,\n", #> "it is necessary to duplicate the object manually in order to\n", #> "preserve copy-by-value semantics.\n"), "\n", #> list("\n", "Some objects are not duplicable, like symbols and environments.\n", #> list("duplicate()"), " returns its input for these unique objects.\n"), #> "\n", list("\n", "pairlist\n"), "\n", list("internal"), #> "\n"), `dyn-dots.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("dyn-dots"), "\n", list("dyn-dots"), #> "\n", list("tidy-dots"), "\n", list("Dynamic dots"), #> "\n", list("\n", "The ", list("..."), " syntax of base R allows you to:\n", #> list("\n", list(), " ", list("Forward"), " arguments from function to function, matching them\n", #> "along the way to function parameters.\n", #> list(), " ", list("Collect"), " arguments inside data structures, e.g. with ", #> list(list("c()")), " or\n", list(list("list()")), #> ".\n"), "\n", "\n", "Dynamic dots offer a few additional features:\n", #> list("\n", list(), " You can ", list("splice"), #> " arguments saved in a list with the ", list( #> "big bang"), " operator ", list("!!!"), #> ".\n", list(), " You can ", list("unquote"), #> " names by using the ", list("glue"), " syntax\n", #> "or the ", list("bang bang"), " operator ", #> list("!!"), " on the\n", "left-hand side of ", #> list(":="), ".\n", list(), " Trailing commas are ignored, making it easier to copy and paste\n", #> "lines of arguments.\n"), "\n"), "\n", list( #> list("Add dynamic dots support in your functions"), #> list("\n", "\n", "\n", "If your function takes dots, adding support for dynamic features is\n", #> "as easy as collecting the dots with ", list( #> list("list2()")), " instead of ", list( #> list("list()")), ".\n", "\n", "Other dynamic dots collectors are ", #> list(list("dots_list()")), ", which is more\n", #> "configurable than ", list(list("list2()")), #> ", ", list("vars()"), " which doesn't force its\n", #> "arguments, and ", list(list("call2()")), #> " for creating calls.\n", "\n", "Document dynamic docs using this standard tag:", #> list(" @param ... <[`dynamic-dots`][rlang::dyn-dots]> What these dots do.\n"), #> "\n")), "\n", "\n", list("\n", "f <- function(...) {\n", #> " out <- list2(...)\n", " rev(out)\n", "}\n", #> "\n", "# Splice\n", "x <- list(alpha = \"first\", omega = \"last\")\n", #> "f(!!!x)\n", "\n", "# Unquote a name, showing both the `!!` bang bang and `{}` glue style\n", #> "nm <- \"key\"\n", "f(!!nm := \"value\")\n", #> "f(\"{nm}\" := \"value\")\n", "f(\"prefix_{nm}\" := \"value\")\n", #> "\n", "# Tolerate a trailing comma\n", "f(this = \"that\", )\n"), #> "\n"), empty_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("empty_env"), "\n", list("empty_env"), #> "\n", list("Get the empty environment"), "\n", #> list("\n", "empty_env()\n"), "\n", list("\n", #> "The empty environment is the only one that does not have a parent.\n", #> "It is always used as the tail of an environment chain such as the\n", #> "search path (see ", list(list("search_envs()")), #> ").\n"), "\n", list("\n", "# Create environments with nothing in scope:\n", #> "child_env(empty_env())\n"), "\n"), enquo0.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/nse-defuse.R", #> "\n", list("enquo0"), "\n", list("enquo0"), "\n", #> list("enquos0"), "\n", list("Defuse arguments without automatic injection"), #> "\n", list("\n", "enquo0(arg)\n", "\n", "enquos0(...)\n"), #> "\n", list("\n", list(list("arg"), list("A symbol for a function argument to defuse.")), #> "\n", "\n", list(list("..."), list("Dots to defuse.")), #> "\n"), "\n", list("\n", "The 0-suffixed variants of ", #> list(list("enquo()")), " and ", list(list("enquos()")), #> " defuse function\n", "arguments without automatic injection (unquotation). They are\n", #> "useful when defusing expressions that potentially include ", #> list("!!"), ",\n", list("!!!"), ", or ", list( #> "{{"), " operations, for instance tidyverse code. In that\n", #> "case, ", list("enquo()"), " would process these operators too early, creating a\n", #> "confusing experience for users. Callers can still inject objects\n", #> "or expressions using manual injection with ", #> list(list("inject()")), ".\n"), "\n", list( #> "\n", "None of the features of ", list("dynamic dots"), #> " are available when\n", "defusing with ", #> list("enquos0()"), ". For instance, trailing empty arguments\n", #> "are not automatically trimmed.\n"), "\n", #> list("\n", "automatic_injection <- function(x) enquo(x)\n", #> "no_injection <- function(x) enquo0(x)\n", #> "\n", "automatic_injection(foo(!!!1:3))\n", #> "no_injection(foo(!!!1:3))\n"), "\n", list( #> "\n", list(list("enquo()")), " and ", list( #> list("enquos()")), "\n"), "\n"), entrace.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-entrace.R", #> "\n", list("entrace"), "\n", list("entrace"), #> "\n", list("cnd_entrace"), "\n", list("Add backtrace from error handler"), #> "\n", list("\n", "entrace(cnd, ..., top = NULL, bottom = NULL)\n", #> "\n", "cnd_entrace(cnd, ..., top = NULL, bottom = NULL)\n"), #> "\n", list("\n", list(list("cnd"), list("When ", #> list("entrace()"), " is used as a calling handler, ", #> list("cnd"), " is\n", "the condition to handle.")), #> "\n", "\n", list(list("..."), list("Unused. These dots are for future extensions.")), #> "\n", "\n", list(list("top"), list("The first frame environment to be included in the\n", #> "backtrace. This becomes the top of the backtrace tree and\n", #> "represents the oldest call in the backtrace.\n", #> "\n", "This is needed in particular when you call ", #> list("trace_back()"), "\n", "indirectly or from a larger context, for example in tests or\n", #> "inside an RMarkdown document where you don't want all of the\n", #> "knitr evaluation mechanisms to appear in the backtrace.")), #> "\n", "\n", list(list("bottom"), list("The last frame environment to be included in the\n", #> "backtrace. This becomes the rightmost leaf of the backtrace tree\n", #> "and represents the youngest call in the backtrace.\n", #> "\n", "Set this when you would like to capture a backtrace without the\n", #> "capture context.\n", "\n", "Can also be an integer that will be passed to ", #> list(list("caller_env()")), ".")), "\n"), #> "\n", list("\n", list("entrace()"), " interrupts an error throw to add an ", #> list("rlang backtrace"), " to the error. The error throw is\n", #> "immediately resumed. ", list("cnd_entrace()"), #> " adds a backtrace to a\n", "condition object, without any other effect. Both functions should\n", #> "be called directly from an error handler.\n", #> "\n", "Set the ", list("error"), " global option to ", #> list("rlang::entrace"), " to\n", "transform base errors to rlang errors. These enriched errors\n", #> "include a backtrace. The RProfile is a good place to set the\n", #> "handler. See ", list(list("rlang_backtrace_on_error")), #> " for details.\n", "\n", list("entrace()"), #> " also works as a ", list("calling"), " handler, though it\n", #> "is often more practical to use the higher-level function\n", #> list(list("with_abort()")), ".\n"), "\n", list( #> "\n", "if (FALSE) { # Not run\n", "\n", "# Set the error handler in your RProfile like this:\n", #> "if (requireNamespace(\"rlang\", quietly = TRUE)) {\n", #> " options(error = rlang::entrace)\n", "}\n", #> "\n", "}\n"), "\n", list("\n", list(list("with_abort()")), #> " to promote conditions to rlang errors.\n", #> list(list("cnd_entrace()")), " to manually add a backtrace to a condition.\n"), #> "\n"), env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env"), "\n", list("env"), "\n", list( #> "child_env"), "\n", list("new_environment"), #> "\n", list("Create a new environment"), "\n", #> list("\n", "env(...)\n", "\n", "child_env(.parent, ...)\n", #> "\n", "new_environment(data = list(), parent = empty_env())\n"), #> "\n", list("\n", list(list("..., data"), list( #> "<", list("dynamic"), "> Named values. You can\n", #> "supply one unnamed to specify a custom parent, otherwise it\n", #> "defaults to the current environment.")), "\n", #> "\n", list(list(".parent, parent"), list("A parent environment. Can be an object\n", #> "supported by ", list(list("as_environment()")), #> ".")), "\n"), "\n", list("\n", "These functions create new environments.\n", #> list("\n", list(), " ", list("env()"), " creates a child of the current environment by default\n", #> "and takes a variable number of named objects to populate it.\n", #> list(), " ", list("new_environment()"), " creates a child of the empty environment by\n", #> "default and takes a named list of objects to populate it.\n"), #> "\n"), "\n", list(list("Environments as objects"), #> list("\n", "\n", "\n", "Environments are containers of uniquely named objects. Their most\n", #> "common use is to provide a scope for the evaluation of R\n", #> "expressions. Not all languages have first class environments,\n", #> "i.e. can manipulate scope as regular objects. Reification of scope\n", #> "is one of the most powerful features of R as it allows you to change\n", #> "what objects a function or expression sees when it is evaluated.\n", #> "\n", "Environments also constitute a data structure in their own\n", #> "right. They are a collection of uniquely named objects, subsettable\n", #> "by name and modifiable by reference. This latter property (see\n", #> "section on reference semantics) is especially useful for creating\n", #> "mutable OO systems (cf the ", list(list( #> "https://github.com/r-lib/R6"), list("R6 package")), #> "\n", "and the ", list(list("https://ggplot2.tidyverse.org/articles/extending-ggplot2.html"), #> list("ggproto system")), "\n", "for extending ggplot2).\n")), #> "\n", "\n", list(list("Inheritance"), list("\n", #> "\n", "\n", "All R environments (except the ", #> list("empty environment"), ") are\n", "defined with a parent environment. An environment and its\n", #> "grandparents thus form a linear hierarchy that is the basis for\n", #> list(list("https://en.wikipedia.org/wiki/Scope_(computer_science)"), #> list("lexical scoping")), " in\n", "R. When R evaluates an expression, it looks up symbols in a given\n", #> "environment. If it cannot find these symbols there, it keeps\n", #> "looking them up in parent environments. This way, objects defined\n", #> "in child environments have precedence over objects defined in\n", #> "parent environments.\n", "\n", "The ability of overriding specific definitions is used in the\n", #> "tidyeval framework to create powerful domain-specific grammars. A\n", #> "common use of masking is to put data frame columns in scope. See\n", #> "for example ", list(list("as_data_mask()")), #> ".\n")), "\n", "\n", list(list("Reference semantics"), #> list("\n", "\n", "\n", "Unlike regular objects such as vectors, environments are an\n", #> list("uncopyable"), " object type. This means that if you\n", #> "have multiple references to a given environment (by assigning the\n", #> "environment to another symbol with ", list( #> "<-"), " or passing the environment\n", #> "as argument to a function), modifying the bindings of one of those\n", #> "references changes all other references as well.\n")), #> "\n", "\n", list(list("Life cycle"), list("\n", #> "\n", list("\n", list(), " ", list("child_env()"), #> " is in the questioning stage. It is redundant now\n", #> "that ", list("env()"), " accepts parent environments.\n"), #> "\n")), "\n", "\n", list("\n", "# env() creates a new environment which has the current environment\n", #> "# as parent\n", "env <- env(a = 1, b = \"foo\")\n", #> "env$b\n", "identical(env_parent(env), current_env())\n", #> "\n", "# Supply one unnamed argument to override the default:\n", #> "env <- env(base_env(), a = 1, b = \"foo\")\n", #> "identical(env_parent(env), base_env())\n", #> "\n", "\n", "# child_env() lets you specify a parent:\n", #> "child <- child_env(env, c = \"bar\")\n", "identical(env_parent(child), env)\n", #> "\n", "# This child environment owns `c` but inherits `a` and `b` from `env`:\n", #> "env_has(child, c(\"a\", \"b\", \"c\", \"d\"))\n", #> "env_has(child, c(\"a\", \"b\", \"c\", \"d\"), inherit = TRUE)\n", #> "\n", "# `parent` is passed to as_environment() to provide handy\n", #> "# shortcuts. Pass a string to create a child of a package\n", #> "# environment:\n", "child_env(\"rlang\")\n", #> "env_parent(child_env(\"rlang\"))\n", "\n", #> "# Or `NULL` to create a child of the empty environment:\n", #> "child_env(NULL)\n", "env_parent(child_env(NULL))\n", #> "\n", "# The base package environment is often a good default choice for a\n", #> "# parent environment because it contains all standard base\n", #> "# functions. Also note that it will never inherit from other loaded\n", #> "# package environments since R keeps the base package at the tail\n", #> "# of the search path:\n", "base_child <- child_env(\"base\")\n", #> "env_has(base_child, c(\"lapply\", \"(\"), inherit = TRUE)\n", #> "\n", "# On the other hand, a child of the empty environment doesn't even\n", #> "# see a definition for `(`\n", "empty_child <- child_env(NULL)\n", #> "env_has(empty_child, c(\"lapply\", \"(\"), inherit = TRUE)\n", #> "\n", "# Note that all other package environments inherit from base_env()\n", #> "# as well:\n", "rlang_child <- child_env(\"rlang\")\n", #> "env_has(rlang_child, \"env\", inherit = TRUE) # rlang function\n", #> "env_has(rlang_child, \"lapply\", inherit = TRUE) # base function\n", #> "\n", "\n", "# Both env() and child_env() support tidy dots features:\n", #> "objs <- list(b = \"foo\", c = \"bar\")\n", #> "env <- env(a = 1, !!! objs)\n", "env$c\n", #> "\n", "# You can also unquote names with the definition operator `:=`\n", #> "var <- \"a\"\n", "env <- env(!!var := \"A\")\n", #> "env$a\n", "\n", "\n", "# Use new_environment() to create containers with the empty\n", #> "# environment as parent:\n", "env <- new_environment()\n", #> "env_parent(env)\n", "\n", "# Like other new_ constructors, it takes an object rather than dots:\n", #> "new_environment(list(a = \"foo\", b = \"bar\"))\n"), #> "\n", list("\n", list(list("env_has()")), ", ", #> list(list("env_bind()")), ".\n"), "\n"), env_bind.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_bind"), "\n", list("env_bind"), #> "\n", list("env_bind_lazy"), "\n", list("env_bind_active"), #> "\n", list("%<~%"), "\n", list("Bind symbols to objects in an environment"), #> "\n", list("\n", "env_bind(.env, ...)\n", "\n", #> "env_bind_lazy(.env, ..., .eval_env = caller_env())\n", #> "\n", "env_bind_active(.env, ...)\n", "\n", #> "lhs %<~% rhs\n"), "\n", list("\n", list(list( #> ".env"), list("An environment.")), "\n", "\n", #> list(list("..."), list("<", list("dynamic"), #> "> Named objects (", list("env_bind()"), #> "),\n", "expressions ", list("env_bind_lazy()"), #> ", or functions (", list("env_bind_active()"), #> ").\n", "Use ", list(list("zap()")), " to remove bindings.")), #> "\n", "\n", list(list(".eval_env"), list("The environment where the expressions will be\n", #> "evaluated when the symbols are forced.")), #> "\n", "\n", list(list("lhs"), list("The variable name to which ", #> list("rhs"), " will be lazily assigned.")), #> "\n", "\n", list(list("rhs"), list("An expression lazily evaluated and assigned to ", #> list("lhs"), ".")), "\n"), "\n", list("\n", #> "The input object ", list(".env"), ", with its associated environment\n", #> "modified in place, invisibly.\n"), "\n", list( #> "\n", "These functions create bindings in an environment. The bindings are\n", #> "supplied through ", list("..."), " as pairs of names and values or expressions.\n", #> list("env_bind()"), " is equivalent to evaluating a ", #> list("<-"), " expression within\n", "the given environment. This function should take care of the\n", #> "majority of use cases but the other variants can be useful for\n", #> "specific problems.\n", list("\n", list(), #> " ", list("env_bind()"), " takes named ", #> list("values"), " which are bound in ", list( #> ".env"), ".\n", list("env_bind()"), " is equivalent to ", #> list(list("base::assign()")), ".\n", list(), #> " ", list("env_bind_active()"), " takes named ", #> list("functions"), " and creates active\n", #> "bindings in ", list(".env"), ". This is equivalent to\n", #> list(list("base::makeActiveBinding()")), #> ". An active binding executes a\n", "function each time it is evaluated. The arguments are passed to\n", #> list(list("as_function()")), " so you can supply formulas instead of functions.\n", #> "\n", "Remember that functions are scoped in their own environment.\n", #> "These functions can thus refer to symbols from this enclosure\n", #> "that are not actually in scope in the dynamic environment where\n", #> "the active bindings are invoked. This allows creative solutions\n", #> "to difficult problems (see the implementations of ", #> list("dplyr::do()"), "\n", "methods for an example).\n", #> list(), " ", list("env_bind_lazy()"), " takes named ", #> list("expressions"), ". This is equivalent\n", #> "to ", list(list("base::delayedAssign()")), #> ". The arguments are captured with\n", list( #> list("exprs()")), " (and thus support call-splicing and unquoting) and\n", #> "assigned to symbols in ", list(".env"), #> ". These expressions are not\n", "evaluated immediately but lazily. Once a symbol is evaluated, the\n", #> "corresponding expression is evaluated in turn and its value is\n", #> "bound to the symbol (the expressions are thus evaluated only\n", #> "once, if at all).\n", list(), " ", list( #> "%<~%"), " is a shortcut for ", list("env_bind_lazy()"), #> ". It works like ", list("<-"), "\n", "but the RHS is evaluated lazily.\n"), #> "\n"), "\n", list(list("Side effects"), list( #> "\n", "\n", "\n", "Since environments have reference semantics (see relevant section\n", #> "in ", list(list("env()")), " documentation), modifying the bindings of an environment\n", #> "produces effects in all other references to that environment. In\n", #> "other words, ", list("env_bind()"), " and its variants have side effects.\n", #> "\n", "Like other side-effecty functions like ", #> list("par()"), " and ", list("options()"), #> ",\n", list("env_bind()"), " and variants return the old values invisibly.\n")), #> "\n", "\n", list(list("Life cycle"), list("\n", #> "\n", "\n", "Passing an environment wrapper like a formula or a function instead\n", #> "of an environment is soft-deprecated as of rlang 0.3.0. This\n", #> "internal genericity was causing confusion (see issue #427). You\n", #> "should now extract the environment separately before calling these\n", #> "functions.\n")), "\n", "\n", list("\n", "# env_bind() is a programmatic way of assigning values to symbols\n", #> "# with `<-`. We can add bindings in the current environment:\n", #> "env_bind(current_env(), foo = \"bar\")\n", #> "foo\n", "\n", "# Or modify those bindings:\n", #> "bar <- \"bar\"\n", "env_bind(current_env(), bar = \"BAR\")\n", #> "bar\n", "\n", "# You can remove bindings by supplying zap sentinels:\n", #> "env_bind(current_env(), foo = zap())\n", "try(foo)\n", #> "\n", "# Unquote-splice a named list of zaps\n", #> "zaps <- rep_named(c(\"foo\", \"bar\"), list(zap()))\n", #> "env_bind(current_env(), !!!zaps)\n", "try(bar)\n", #> "\n", "# It is most useful to change other environments:\n", #> "my_env <- env()\n", "env_bind(my_env, foo = \"foo\")\n", #> "my_env$foo\n", "\n", "# A useful feature is to splice lists of named values:\n", #> "vals <- list(a = 10, b = 20)\n", "env_bind(my_env, !!!vals, c = 30)\n", #> "my_env$b\n", "my_env$c\n", "\n", "# You can also unquote a variable referring to a symbol or a string\n", #> "# as binding name:\n", "var <- \"baz\"\n", #> "env_bind(my_env, !!var := \"BAZ\")\n", "my_env$baz\n", #> "\n", "\n", "# The old values of the bindings are returned invisibly:\n", #> "old <- env_bind(my_env, a = 1, b = 2, baz = \"baz\")\n", #> "old\n", "\n", "# You can restore the original environment state by supplying the\n", #> "# old values back:\n", "env_bind(my_env, !!!old)\n", #> "\n", "# env_bind_lazy() assigns expressions lazily:\n", #> "env <- env()\n", "env_bind_lazy(env, name = { cat(\"forced!\\n\"); \"value\" })\n", #> "\n", "# Referring to the binding will cause evaluation:\n", #> "env$name\n", "\n", "# But only once, subsequent references yield the final value:\n", #> "env$name\n", "\n", "# You can unquote expressions:\n", #> "expr <- quote(message(\"forced!\"))\n", "env_bind_lazy(env, name = !!expr)\n", #> "env$name\n", "\n", "\n", "# By default the expressions are evaluated in the current\n", #> "# environment. For instance we can create a local binding and refer\n", #> "# to it, even though the variable is bound in a different\n", #> "# environment:\n", "who <- \"mickey\"\n", #> "env_bind_lazy(env, name = paste(who, \"mouse\"))\n", #> "env$name\n", "\n", "# You can specify another evaluation environment with `.eval_env`:\n", #> "eval_env <- env(who = \"minnie\")\n", "env_bind_lazy(env, name = paste(who, \"mouse\"), .eval_env = eval_env)\n", #> "env$name\n", "\n", "# Or by unquoting a quosure:\n", #> "quo <- local({\n", " who <- \"fievel\"\n", #> " quo(paste(who, \"mouse\"))\n", "})\n", "env_bind_lazy(env, name = !!quo)\n", #> "env$name\n", "\n", "# You can create active bindings with env_bind_active(). Active\n", #> "# bindings execute a function each time they are evaluated:\n", #> "fn <- function() {\n", " cat(\"I have been called\\n\")\n", #> " rnorm(1)\n", "}\n", "\n", "env <- env()\n", #> "env_bind_active(env, symbol = fn)\n", "\n", #> "# `fn` is executed each time `symbol` is evaluated or retrieved:\n", #> "env$symbol\n", "env$symbol\n", "eval_bare(quote(symbol), env)\n", #> "eval_bare(quote(symbol), env)\n", "\n", "# All arguments are passed to as_function() so you can use the\n", #> "# formula shortcut:\n", "env_bind_active(env, foo = ~ runif(1))\n", #> "env$foo\n", "env$foo\n"), "\n", list("\n", #> list(list("env_poke()")), " for binding a single element.\n"), #> "\n"), env_bind_exprs.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("env_bind_exprs"), "\n", list("env_bind_exprs"), #> "\n", list("env_bind_fns"), "\n", list("Bind a promise or active binding"), #> "\n", list("\n", "env_bind_exprs(.env, ..., .eval_env = caller_env())\n", #> "\n", "env_bind_fns(.env, ...)\n"), "\n", list( #> "\n", list(list(".env"), list("An environment.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> Named objects (", list("env_bind()"), #> "),\n", "expressions ", list("env_bind_lazy()"), #> ", or functions (", list("env_bind_active()"), #> ").\n", "Use ", list(list("zap()")), " to remove bindings.")), #> "\n", "\n", list(list(".eval_env"), list("The environment where the expressions will be\n", #> "evaluated when the symbols are forced.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "As of rlang 0.3.0, ", list("env_bind_exprs()"), #> " and ", list("env_bind_fns()"), " have\n", #> "been renamed to ", list(list("env_bind_lazy()")), #> " and ", list(list("env_bind_active()")), " for\n", #> "consistency.\n"), "\n", list("internal"), #> "\n"), env_binding_are_active.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_binding_are_active"), "\n", list( #> "env_binding_are_active"), "\n", list("env_binding_are_lazy"), #> "\n", list("What kind of environment binding?"), #> "\n", list("\n", "env_binding_are_active(env, nms = NULL)\n", #> "\n", "env_binding_are_lazy(env, nms = NULL)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nms"), list("Names of bindings. Defaults to all bindings in ", #> list("env"), ".")), "\n"), "\n", list("\n", #> "A logical vector as long as ", list("nms"), #> " and named after it.\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"experimental\")"), #> "\n"), "\n", list("internal"), "\n"), env_binding_lock.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_binding_lock"), "\n", list("env_binding_lock"), #> "\n", list("env_binding_unlock"), "\n", list( #> "env_binding_are_locked"), "\n", list("Lock or unlock environment bindings"), #> "\n", list("\n", "env_binding_lock(env, nms = NULL)\n", #> "\n", "env_binding_unlock(env, nms = NULL)\n", #> "\n", "env_binding_are_locked(env, nms = NULL)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nms"), list("Names of bindings. Defaults to all bindings in ", #> list("env"), ".")), "\n"), "\n", list("\n", #> list("env_binding_are_unlocked()"), " returns a logical vector as\n", #> "long as ", list("nms"), " and named after it. ", #> list("env_binding_lock()"), " and\n", list( #> "env_binding_unlock()"), " return the old value of\n", #> list("env_binding_are_unlocked()"), " invisibly.\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "Locked environment bindings trigger an error when an attempt is\n", #> "made to redefine the binding.\n"), "\n", list( #> "\n", "# Bindings are unlocked by default:\n", #> "env <- env(a = \"A\", b = \"B\")\n", "env_binding_are_locked(env)\n", #> "\n", "# But can optionally be locked:\n", #> "env_binding_lock(env, \"a\")\n", "env_binding_are_locked(env)\n", #> "\n", "# If run, the following would now return an error because `a` is locked:\n", #> "# env_bind(env, a = \"foo\")\n", "# with_env(env, a <- \"bar\")\n", #> "\n", "# Let's unlock it. Note that the return value indicate which\n", #> "# bindings were locked:\n", "were_locked <- env_binding_unlock(env)\n", #> "were_locked\n", "\n", "# Now that it is unlocked we can modify it again:\n", #> "env_bind(env, a = \"foo\")\n", "with_env(env, a <- \"bar\")\n", #> "env$a\n"), "\n", list("\n", list(list("env_lock()")), #> " for locking an environment.\n"), "\n", list( #> "internal"), "\n"), env_browse.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_browse"), "\n", list("env_browse"), #> "\n", list("env_is_browsed"), "\n", list("Browse environments"), #> "\n", list("\n", "env_browse(env, value = TRUE)\n", #> "\n", "env_is_browsed(env)\n"), "\n", list( #> "\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("value"), list("Whether to browse ", #> list("env"), ".")), "\n"), "\n", list("\n", #> list("env_browse()"), " returns the previous value of\n", #> list("env_is_browsed()"), " (a logical), invisibly.\n"), #> "\n", list("\n", list("\n", list(), " ", list( #> "env_browse(env)"), " is equivalent to evaluating ", #> list("browser()"), " in\n", list("env"), ". It persistently sets the environment for step-debugging.\n", #> "Supply ", list("value = FALSE"), " to disable browsing.\n", #> list(), " ", list("env_is_browsed()"), " is a predicate that inspects whether an\n", #> "environment is being browsed.\n"), "\n"), #> "\n"), env_bury.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("env_bury"), "\n", list("env_bury"), #> "\n", list("Mask bindings by defining symbols deeper in a scope"), #> "\n", list("\n", "env_bury(.env, ...)\n"), "\n", #> list("\n", list(list(".env"), list("An environment.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> Named objects (", list("env_bind()"), #> "),\n", "expressions ", list("env_bind_lazy()"), #> ", or functions (", list("env_bind_active()"), #> ").\n", "Use ", list(list("zap()")), " to remove bindings.")), #> "\n"), "\n", list("\n", "A copy of ", list( #> ".env"), " enclosing the new environment containing\n", #> "bindings to ", list("..."), " arguments.\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"superseded\")"), #> "\n", "\n", "This function is superseded. Please use ", #> list(list("env()")), " (and possibly\n", list( #> list("set_env()")), " if you're masking the bindings for another object like\n", #> "a closure or a formula) instead.\n", "\n", #> list("env_bury()"), " is like ", list(list( #> "env_bind()")), " but it creates the bindings in a\n", #> "new child environment. This makes sure the new bindings have\n", #> "precedence over old ones, without altering existing environments.\n", #> "Unlike ", list("env_bind()"), ", this function does not have side effects and\n", #> "returns a new environment (or object wrapping that environment).\n"), #> "\n", list("\n", "orig_env <- env(a = 10)\n", #> "fn <- set_env(function() a, orig_env)\n", #> "\n", "# fn() currently sees `a` as the value `10`:\n", #> "fn()\n", "\n", "# env_bury() will bury the current scope of fn() behind a new\n", #> "# environment:\n", "fn <- env_bury(fn, a = 1000)\n", #> "fn()\n", "\n", "# Even though the symbol `a` is still defined deeper in the scope:\n", #> "orig_env$a\n"), "\n", list("\n", list(list( #> "env_bind()")), ", ", list(list("env_unbind()")), #> "\n"), "\n", list("internal"), "\n"), env_clone.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_clone"), "\n", list("env_clone"), #> "\n", list("Clone an environment"), "\n", list( #> "\n", "env_clone(env, parent = env_parent(env))\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("parent"), list("The parent of the cloned environment.")), #> "\n"), "\n", list("\n", "This creates a new environment containing exactly the same objects,\n", #> "optionally with a new parent.\n"), "\n", list( #> "\n", "env <- env(!!! mtcars)\n", "clone <- env_clone(env)\n", #> "identical(env, clone)\n", "identical(env$cyl, clone$cyl)\n"), #> "\n"), env_depth.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_depth"), "\n", list("env_depth"), #> "\n", list("Depth of an environment chain"), #> "\n", list("\n", "env_depth(env)\n"), "\n", list( #> "\n", list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "An integer.\n"), "\n", #> list("\n", "This function returns the number of environments between ", #> list("env"), " and\n", "the ", list("empty environment"), #> ", including ", list("env"), ". The depth of\n", #> list("env"), " is also the number of parents of ", #> list("env"), " (since the empty\n", "environment counts as a parent).\n"), #> "\n", list("\n", "env_depth(empty_env())\n", #> "env_depth(pkg_env(\"rlang\"))\n"), "\n", list( #> "\n", "The section on inheritance in ", list( #> list("env()")), " documentation.\n"), "\n"), #> env_get.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_get"), "\n", list("env_get"), #> "\n", list("env_get_list"), "\n", list("Get an object in an environment"), #> "\n", list("\n", "env_get(env = caller_env(), nm, default, inherit = FALSE)\n", #> "\n", "env_get_list(env = caller_env(), nms, default, inherit = FALSE)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nm, nms"), list("Names of bindings. ", #> list("nm"), " must be a single string.")), #> "\n", "\n", list(list("default"), list("A default value in case there is no binding for ", #> list("nm"), "\n", "in ", list("env"), ".")), #> "\n", "\n", list(list("inherit"), list("Whether to look for bindings in the parent\n", #> "environments.")), "\n"), "\n", list("\n", #> "An object if it exists. Otherwise, throws an error.\n"), #> "\n", list("\n", list("env_get()"), " extracts an object from an enviroment ", #> list("env"), ". By\n", "default, it does not look in the parent environments.\n", #> list("env_get_list()"), " extracts multiple objects from an environment into\n", #> "a named list.\n"), "\n", list("\n", "parent <- child_env(NULL, foo = \"foo\")\n", #> "env <- child_env(parent, bar = \"bar\")\n", #> "\n", "# This throws an error because `foo` is not directly defined in env:\n", #> "# env_get(env, \"foo\")\n", "\n", "# However `foo` can be fetched in the parent environment:\n", #> "env_get(env, \"foo\", inherit = TRUE)\n", #> "\n", "# You can also avoid an error by supplying a default value:\n", #> "env_get(env, \"foo\", default = \"FOO\")\n"), #> "\n"), env_has.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_has"), "\n", list("env_has"), #> "\n", list("Does an environment have or see bindings?"), #> "\n", list("\n", "env_has(env = caller_env(), nms, inherit = FALSE)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nms"), list("A character vector of binding names for which to check\n", #> "existence.")), "\n", "\n", list(list("inherit"), #> list("Whether to look for bindings in the parent\n", #> "environments.")), "\n"), "\n", list("\n", #> "A named logical vector as long as ", list( #> "nms"), ".\n"), "\n", list("\n", list("env_has()"), #> " is a vectorised predicate that queries whether an\n", #> "environment owns bindings personally (with ", #> list("inherit"), " set to\n", list("FALSE"), #> ", the default), or sees them in its own environment or in\n", #> "any of its parents (with ", list("inherit = TRUE"), #> ").\n"), "\n", list("\n", "parent <- child_env(NULL, foo = \"foo\")\n", #> "env <- child_env(parent, bar = \"bar\")\n", #> "\n", "# env does not own `foo` but sees it in its parent environment:\n", #> "env_has(env, \"foo\")\n", "env_has(env, \"foo\", inherit = TRUE)\n"), #> "\n"), env_inherits.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_inherits"), "\n", list("env_inherits"), #> "\n", list("Does environment inherit from another environment?"), #> "\n", list("\n", "env_inherits(env, ancestor)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("ancestor"), list("Another environment from which ", #> list("x"), " might inherit.")), "\n"), "\n", #> list("\n", "This returns ", list("TRUE"), " if ", #> list("x"), " has ", list("ancestor"), " among its parents.\n"), #> "\n"), env_lock.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_lock"), "\n", list("env_lock"), #> "\n", list("env_is_locked"), "\n", list("Lock an environment"), #> "\n", list("\n", "env_lock(env)\n", "\n", "env_is_locked(env)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "The old value of ", #> list("env_is_locked()"), " invisibly.\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "Locked environments cannot be modified. An important example is\n", #> "namespace environments which are locked by R when loaded in a\n", #> "session. Once an environment is locked it normally cannot be\n", #> "unlocked.\n", "\n", "Note that only the environment as a container is locked, not the\n", #> "individual bindings. You can't remove or add a binding but you can\n", #> "still modify the values of existing bindings. See\n", #> list(list("env_binding_lock()")), " for locking individual bindings.\n"), #> "\n", list("\n", "# New environments are unlocked by default:\n", #> "env <- env(a = 1)\n", "env_is_locked(env)\n", #> "\n", "# Use env_lock() to lock them:\n", "env_lock(env)\n", #> "env_is_locked(env)\n", "\n", "# Now that `env` is locked, it is no longer possible to remove or\n", #> "# add bindings. If run, the following would fail:\n", #> "# env_unbind(env, \"a\")\n", "# env_bind(env, b = 2)\n", #> "\n", "# Note that even though the environment as a container is locked,\n", #> "# the individual bindings are still unlocked and can be modified:\n", #> "env$a <- 10\n"), "\n", list("\n", list(list( #> "env_binding_lock()")), "\n"), "\n", list("internal"), #> "\n"), env_name.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("env_name"), "\n", list("env_name"), #> "\n", list("env_label"), "\n", list("Label of an environment"), #> "\n", list("\n", "env_name(env)\n", "\n", "env_label(env)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "Special environments like the global environment have their own\n", #> "names. ", list("env_name()"), " returns:\n", #> list("\n", list(), " \"global\" for the global environment.\n", #> list(), " \"empty\" for the empty environment.\n", #> list(), " \"base\" for the base package environment (the last environment on\n", #> "the search path).\n", list(), " \"namespace:pkg\" if ", #> list("env"), " is the namespace of the package \"pkg\".\n", #> list(), " The ", list("name"), " attribute of ", #> list("env"), " if it exists. This is how the\n", #> list("package environments"), " and the ", #> list("imports environments"), " store their names. The name of package\n", #> "environments is typically \"package:pkg\".\n", #> list(), " The empty string ", list("\"\""), #> " otherwise.\n"), "\n", "\n", list("env_label()"), #> " is exactly like ", list("env_name()"), " but returns the memory\n", #> "address of anonymous environments as fallback.\n"), #> "\n", list("\n", "# Some environments have specific names:\n", #> "env_name(global_env())\n", "env_name(ns_env(\"rlang\"))\n", #> "\n", "# Anonymous environments don't have names but are labelled by their\n", #> "# address in memory:\n", "env_name(env())\n", #> "env_label(env())\n"), "\n"), env_names.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_names"), "\n", list("env_names"), #> "\n", list("env_length"), "\n", list("Names and numbers of symbols bound in an environment"), #> "\n", list("\n", "env_names(env)\n", "\n", "env_length(env)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "A character vector of object names.\n"), #> "\n", list("\n", list("env_names()"), " returns object names from an enviroment ", #> list("env"), " as a\n", "character vector. All names are returned, even those starting with\n", #> "a dot. ", list("env_length()"), " returns the number of bindings.\n"), #> "\n", list(list("Names of symbols and objects"), #> list("\n", "\n", "\n", "Technically, objects are bound to symbols rather than strings,\n", #> "since the R interpreter evaluates symbols (see ", #> list(list("is_expression()")), " for a\n", #> "discussion of symbolic objects versus literal objects). However it\n", #> "is often more convenient to work with strings. In rlang\n", #> "terminology, the string corresponding to a symbol is called the\n", #> list("name"), " of the symbol (or by extension the name of an object bound\n", #> "to a symbol).\n")), "\n", "\n", list(list( #> "Encoding"), list("\n", "\n", "\n", "There are deep encoding issues when you convert a string to symbol\n", #> "and vice versa. Symbols are ", list("always"), #> " in the native encoding. If\n", "that encoding (let's say latin1) cannot support some characters,\n", #> "these characters are serialised to ASCII. That's why you sometimes\n", #> "see strings looking like ", list("<U+1234>"), #> ", especially if you're running\n", "Windows (as R doesn't support UTF-8 as native encoding on that\n", #> "platform).\n", "\n", "To alleviate some of the encoding pain, ", #> list("env_names()"), " always\n", "returns a UTF-8 character vector (which is fine even on Windows)\n", #> "with ASCII unicode points translated back to UTF-8.\n")), #> "\n", "\n", list("\n", "env <- env(a = 1, b = 2)\n", #> "env_names(env)\n"), "\n"), env_parent.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_parent"), "\n", list("env_parent"), #> "\n", list("env_tail"), "\n", list("env_parents"), #> "\n", list("Get parent environments"), "\n", #> list("\n", "env_parent(env = caller_env(), n = 1)\n", #> "\n", "env_tail(env = caller_env(), last = global_env())\n", #> "\n", "env_parents(env = caller_env(), last = global_env())\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("n"), list("The number of generations to go up.")), #> "\n", "\n", list(list("last"), list("The environment at which to stop. Defaults to the\n", #> "global environment. The empty environment is always a stopping\n", #> "condition so it is safe to leave the default even when taking the\n", #> "tail or the parents of an environment on the search path.\n", #> "\n", list("env_tail()"), " returns the environment which has ", #> list("last"), " as parent\n", "and ", list( #> "env_parents()"), " returns the list of environments up to ", #> list("last"), ".")), "\n"), "\n", list("\n", #> "An environment for ", list("env_parent()"), #> " and ", list("env_tail()"), ", a list\n", #> "of environments for ", list("env_parents()"), #> ".\n"), "\n", list("\n", list("\n", list(), #> " ", list("env_parent()"), " returns the parent environment of ", #> list("env"), " if called\n", "with ", list( #> "n = 1"), ", the grandparent with ", list( #> "n = 2"), ", etc.\n", list(), " ", list("env_tail()"), #> " searches through the parents and returns the one\n", #> "which has ", list(list("empty_env()")), " as parent.\n", #> list(), " ", list("env_parents()"), " returns the list of all parents, including the\n", #> "empty environment. This list is named using ", #> list(list("env_name()")), ".\n"), "\n", "\n", #> "See the section on ", list("inheritance"), #> " in ", list(list("env()")), "'s documentation.\n"), #> "\n", list("\n", "# Get the parent environment with env_parent():\n", #> "env_parent(global_env())\n", "\n", "# Or the tail environment with env_tail():\n", #> "env_tail(global_env())\n", "\n", "# By default, env_parent() returns the parent environment of the\n", #> "# current evaluation frame. If called at top-level (the global\n", #> "# frame), the following two expressions are equivalent:\n", #> "env_parent()\n", "env_parent(base_env())\n", #> "\n", "# This default is more handy when called within a function. In this\n", #> "# case, the enclosure environment of the function is returned\n", #> "# (since it is the parent of the evaluation frame):\n", #> "enclos_env <- env()\n", "fn <- set_env(function() env_parent(), enclos_env)\n", #> "identical(enclos_env, fn())\n"), "\n"), env_poke.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_poke"), "\n", list("env_poke"), #> "\n", list("Poke an object in an environment"), #> "\n", list("\n", "env_poke(env = caller_env(), nm, value, inherit = FALSE, create = !inherit)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nm"), list("Names of bindings. ", #> list("nm"), " must be a single string.")), #> "\n", "\n", list(list("value"), list("The value for a new binding.")), #> "\n", "\n", list(list("inherit"), list("Whether to look for bindings in the parent\n", #> "environments.")), "\n", "\n", list(list( #> "create"), list("Whether to create a binding if it does not already\n", #> "exist in the environment.")), "\n"), "\n", #> list("\n", "The old value of ", list("nm"), " or a ", #> list("zap sentinel"), " if the\n", "binding did not exist yet.\n"), #> "\n", list("\n", list("env_poke()"), " will assign or reassign a binding in ", #> list("env"), " if ", list("create"), "\n", #> "is ", list("TRUE"), ". If ", list("create"), #> " is ", list("FALSE"), " and a binding does not already\n", #> "exists, an error is issued.\n"), "\n", list( #> "\n", "If ", list("inherit"), " is ", list( #> "TRUE"), ", the parents environments are checked for\n", #> "an existing binding to reassign. If not found and ", #> list("create"), " is\n", list("TRUE"), ", a new binding is created in ", #> list("env"), ". The default value for\n", list( #> "create"), " is a function of ", list("inherit"), #> ": ", list("FALSE"), " when inheriting,\n", #> list("TRUE"), " otherwise.\n", "\n", "This default makes sense because the inheriting case is mostly\n", #> "for overriding an existing binding. If not found, something\n", #> "probably went wrong and it is safer to issue an error. Note that\n", #> "this is different to the base R operator ", #> list("<<-"), " which will create\n", "a binding in the global environment instead of the current\n", #> "environment when no existing binding is found in the parents.\n"), #> "\n", list("\n", list(list("env_bind()")), " for binding multiple elements.\n"), #> "\n"), env_print.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_print"), "\n", list("env_print"), #> "\n", list("Pretty-print an environment"), "\n", #> list("\n", "env_print(env = caller_env())\n"), #> "\n", list("\n", list(list("env"), list("An environment, or object that can be converted to an\n", #> "environment by ", list(list("get_env()")), #> ".")), "\n"), "\n", list("\n", "This prints:\n", #> list("\n", list(), " The ", list("label"), #> " and the parent label.\n", list(), " Whether the environment is ", #> list("locked"), ".\n", list(), " The bindings in the environment (up to 20 bindings). They are\n", #> "printed succintly using ", list("pillar::type_sum()"), #> " (if available,\n", "otherwise uses an internal version of that generic). In addition\n", #> list("fancy bindings"), " (actives and promises) are\n", #> "indicated as such.\n", list(), " Locked bindings get a ", #> list("[L]"), " tag\n"), "\n", "\n", "Note that printing a package namespace (see ", #> list(list("ns_env()")), ") with\n", list("env_print()"), #> " will typically tag function bindings as ", #> list("<lazy>"), "\n", "until they are evaluated the first time. This is because package\n", #> "functions are lazily-loaded from disk to improve performance when\n", #> "loading a package.\n"), "\n"), env_unbind.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("env_unbind"), "\n", list("env_unbind"), #> "\n", list("Remove bindings from an environment"), #> "\n", list("\n", "env_unbind(env = caller_env(), nms, inherit = FALSE)\n"), #> "\n", list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("nms"), list("A character vector of binding names to remove.")), #> "\n", "\n", list(list("inherit"), list("Whether to look for bindings in the parent\n", #> "environments.")), "\n"), "\n", list("\n", #> "The input object ", list("env"), " with its associated environment\n", #> "modified in place, invisibly.\n"), "\n", list( #> "\n", list("env_unbind()"), " is the complement of ", #> list(list("env_bind()")), ". Like ", list("env_has()"), #> ",\n", "it ignores the parent environments of ", #> list("env"), " by default. Set\n", list("inherit"), #> " to ", list("TRUE"), " to track down bindings in parent environments.\n"), #> "\n", list("\n", "env <- env(foo = 1, bar = 2)\n", #> "env_has(env, c(\"foo\", \"bar\"))\n", "\n", #> "# Remove bindings with `env_unbind()`\n", #> "env_unbind(env, c(\"foo\", \"bar\"))\n", "env_has(env, c(\"foo\", \"bar\"))\n", #> "\n", "# With inherit = TRUE, it removes bindings in parent environments\n", #> "# as well:\n", "parent <- env(empty_env(), foo = 1, bar = 2)\n", #> "env <- env(parent, foo = \"b\")\n", "\n", #> "env_unbind(env, \"foo\", inherit = TRUE)\n", #> "env_has(env, c(\"foo\", \"bar\"))\n", "env_has(env, c(\"foo\", \"bar\"), inherit = TRUE)\n"), #> "\n"), env_unlock.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("env_unlock"), "\n", list("env_unlock"), #> "\n", list("Unlock an environment"), "\n", list( #> "\n", "env_unlock(env)\n"), "\n", list("\n", #> list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "Whether the environment has been unlocked.\n"), #> "\n", list("\n", "This function should only be used in development tools or\n", #> "interactively.\n"), "\n", list("internal"), #> "\n"), eval_bare.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval.R", #> "\n", list("eval_bare"), "\n", list("eval_bare"), #> "\n", list("Evaluate an expression in an environment"), #> "\n", list("\n", "eval_bare(expr, env = parent.frame())\n"), #> "\n", list("\n", list(list("expr"), list("An expression to evaluate.")), #> "\n", "\n", list(list("env"), list("The environment in which to evaluate the expression.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", list("eval_bare()"), " is a lower-level version of function ", #> list(list("base::eval()")), ".\n", "Technically, it is a simple wrapper around the C function\n", #> list("Rf_eval()"), ". You generally don't need to use ", #> list("eval_bare()"), " instead\n", "of ", list( #> "eval()"), ". Its main advantage is that it handles stack-sensitive\n", #> "(calls such as ", list("return()"), ", ", #> list("on.exit()"), " or ", list("parent.frame()"), #> ") more\n", "consistently when you pass an enviroment of a frame on the call\n", #> "stack.\n"), "\n", list("\n", "These semantics are possible because ", #> list("eval_bare()"), " creates only one\n", #> "frame on the call stack whereas ", list("eval()"), #> " creates two frames, the\n", "second of which has the user-supplied environment as frame\n", #> "environment. When you supply an existing frame environment to\n", #> list("base::eval()"), " there will be two frames on the stack with the same\n", #> "frame environment. Stack-sensitive functions only detect the\n", #> "topmost of these frames. We call these evaluation semantics\n", #> "\"stack inconsistent\".\n", "\n", "Evaluating expressions in the actual frame environment has useful\n", #> "practical implications for ", list("eval_bare()"), #> ":\n", list("\n", list(), " ", list("return()"), #> " calls are evaluated in frame environments that might\n", #> "be burried deep in the call stack. This causes a long return that\n", #> "unwinds multiple frames (triggering the ", #> list("on.exit()"), " event for\n", "each frame). By contrast ", #> list("eval()"), " only returns from the ", #> list("eval()"), "\n", "call, one level up.\n", #> list(), " ", list("on.exit()"), ", ", list( #> "parent.frame()"), ", ", list("sys.call()"), #> ", and generally all\n", "the stack inspection functions ", #> list("sys.xxx()"), " are evaluated in the\n", #> "correct frame environment. This is similar to how this type of\n", #> "calls can be evaluated deep in the call stack because of lazy\n", #> "evaluation, when you force an argument that has been passed\n", #> "around several times.\n"), "\n", "\n", "The flip side of the semantics of ", #> list("eval_bare()"), " is that it can't\n", #> "evaluate ", list("break"), " or ", list("next"), #> " expressions even if called within a\n", "loop.\n"), #> "\n", list("\n", "# eval_bare() works just like base::eval() but you have to create\n", #> "# the evaluation environment yourself:\n", #> "eval_bare(quote(foo), env(foo = \"bar\"))\n", #> "\n", "# eval() has different evaluation semantics than eval_bare(). It\n", #> "# can return from the supplied environment even if its an\n", #> "# environment that is not on the call stack (i.e. because you've\n", #> "# created it yourself). The following would trigger an error with\n", #> "# eval_bare():\n", "ret <- quote(return(\"foo\"))\n", #> "eval(ret, env())\n", "# eval_bare(ret, env()) # \"no function to return from\" error\n", #> "\n", "# Another feature of eval() is that you can control surround loops:\n", #> "bail <- quote(break)\n", "while (TRUE) {\n", #> " eval(bail)\n", " # eval_bare(bail) # \"no loop for break/next\" error\n", #> "}\n", "\n", "# To explore the consequences of stack inconsistent semantics, let's\n", #> "# create a function that evaluates `parent.frame()` deep in the call\n", #> "# stack, in an environment corresponding to a frame in the middle of\n", #> "# the stack. For consistency with R's lazy evaluation semantics, we'd\n", #> "# expect to get the caller of that frame as result:\n", #> "fn <- function(eval_fn) {\n", " list(\n", #> " returned_env = middle(eval_fn),\n", " actual_env = current_env()\n", #> " )\n", "}\n", "middle <- function(eval_fn) {\n", #> " deep(eval_fn, current_env())\n", "}\n", #> "deep <- function(eval_fn, eval_env) {\n", #> " expr <- quote(parent.frame())\n", " eval_fn(expr, eval_env)\n", #> "}\n", "\n", "# With eval_bare(), we do get the expected environment:\n", #> "fn(rlang::eval_bare)\n", "\n", "# But that's not the case with base::eval():\n", #> "fn(base::eval)\n"), "\n", list("\n", list( #> list("eval_tidy()")), " for evaluation with data mask and quosure\n", #> "support.\n"), "\n"), eval_tidy.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval-tidy.R", #> "\n", list("eval_tidy"), "\n", list("eval_tidy"), #> "\n", list("Evaluate an expression with quosures and pronoun support"), #> "\n", list("\n", "eval_tidy(expr, data = NULL, env = caller_env())\n"), #> "\n", list("\n", list(list("expr"), list("An expression or quosure to evaluate.")), #> "\n", "\n", list(list("data"), list("A data frame, or named list or vector. Alternatively, a\n", #> "data mask created with ", list(list("as_data_mask()")), #> " or\n", list(list("new_data_mask()")), ". Objects in ", #> list("data"), " have priority over those in\n", #> list("env"), ". See the section about data masking.")), #> "\n", "\n", list(list("env"), list("The environment in which to evaluate ", #> list("expr"), ". This\n", "environment is not applicable for quosures because they have\n", #> "their own environments.")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", list("eval_tidy()"), " is a variant of ", #> list(list("base::eval()")), " that powers the tidy\n", #> "evaluation framework. Like ", list("eval()"), #> " it accepts user data as\n", "argument. Whereas ", #> list("eval()"), " simply transforms the data to an\n", #> "environment, ", list("eval_tidy()"), " transforms it to a ", #> list("data mask"), " with\n", list(list("as_data_mask()")), #> ". Evaluating in a data mask enables the following\n", #> "features:\n", list("\n", list(), " ", list( #> "Quosures"), ". Quosures are expressions bundled with an\n", #> "environment. If ", list("data"), " is supplied, objects in the data mask\n", #> "always have precedence over the quosure environment, i.e. the\n", #> "data masks the environment.\n", list(), #> " ", list("Pronouns"), ". If ", list("data"), #> " is supplied, the ", list(".env"), " and ", #> list(".data"), "\n", "pronouns are installed in the data mask. ", #> list(".env"), " is a reference to\n", "the calling environment and ", #> list(".data"), " refers to the ", list("data"), #> " argument.\n", "These pronouns lets you be explicit about where to find\n", #> "values and throw errors if you try to access non-existent values.\n"), #> "\n"), "\n", list(list("Data masking"), list( #> "\n", "\n", "\n", "Data masking refers to how columns or objects inside ", #> list("data"), " have\n", "priority over objects defined in ", #> list("env"), " (or in the quosure\n", "environment, if applicable). If there is a column ", #> list("var"), " in ", list("data"), "\n", "and an object ", #> list("var"), " in ", list("env"), ", and ", #> list("expr"), " refers to ", list("var"), ", the\n", #> "column has priority:", list("var <- \"this one?\"\n", #> "data <- data.frame(var = rep(\"Or that one?\", 3))\n", #> "\n", "within <- function(data, expr) {\n", #> " eval_tidy(enquo(expr), data)\n", "}\n", #> "\n", "within(data, toupper(var))\n", "#> [1] \"OR THAT ONE?\" \"OR THAT ONE?\" \"OR THAT ONE?\"\n"), #> "\n", "\n", "Because the columns or objects in ", #> list("data"), " are always found first,\n", #> "before objects from ", list("env"), ", we say that the data \"masks\" the\n", #> "environment.\n")), "\n", "\n", list(list("When should eval_tidy() be used instead of eval()?"), #> list("\n", "\n", "\n", list("base::eval()"), #> " is sufficient for simple evaluation. Use\n", #> list("eval_tidy()"), " when you'd like to support expressions referring to\n", #> "the ", list(".data"), " pronoun, or when you need to support quosures.\n", #> "\n", "If you're evaluating an expression captured with quasiquotation\n", #> "support, it is recommended to use ", list( #> "eval_tidy()"), " because users will\n", #> "likely unquote quosures.\n", "\n", "Note that unwrapping a quosure with ", #> list(list("quo_get_expr()")), " does not\n", #> "guarantee that there is no quosures inside the expression. Quosures\n", #> "might be unquoted anywhere. For instance, the following does not\n", #> "work reliably in the presence of nested quosures:", #> list("my_quoting_fn <- function(x) {\n", #> " x <- enquo(x)\n", " expr <- quo_get_expr(x)\n", #> " env <- quo_get_env(x)\n", " eval(expr, env)\n", #> "}\n", "\n", "# Works:\n", "my_quoting_fn(toupper(letters))\n", #> "\n", "# Fails because of a nested quosure:\n", #> "my_quoting_fn(toupper(!!quo(letters)))\n"), #> "\n")), "\n", "\n", list(list("Stack semantics of ", #> list("eval_tidy()")), list("\n", "\n", "\n", #> list("eval_tidy()"), " always evaluates in a data mask, even when ", #> list("data"), " is\n", list("NULL"), ". Because of this, it has different stack semantics than\n", #> list(list("base::eval()")), ":\n", list("\n", #> list(), " Lexical side effects, such as assignment with ", #> list("<-"), ", occur in the\n", "mask rather than ", #> list("env"), ".\n", list(), " Functions that require the evaluation environment to correspond\n", #> "to a frame on the call stack do not work. This is why ", #> list("return()"), "\n", "called from a quosure does not work.\n", #> list(), " The mask environment creates a new branch in the tree\n", #> "representation of backtraces (which you can visualise in a\n", #> list(list("browser()")), " session with ", #> list("lobstr::cst()"), ").\n"), "\n", "\n", #> "See also ", list(list("eval_bare()")), " for more information about these differences.\n")), #> "\n", "\n", list(list("Life cycle"), list("\n", #> "\n", "\n", list("rlang 0.3.0"), "\n", "\n", #> "Passing an environment to ", list("data"), #> " is deprecated. Please construct an\n", "rlang data mask with ", #> list(list("new_data_mask()")), ".\n")), "\n", #> "\n", list("\n", "\n", "# With simple quoted expressions eval_tidy() works the same way as\n", #> "# eval():\n", "apple <- \"apple\"\n", "kiwi <- \"kiwi\"\n", #> "expr <- quote(paste(apple, kiwi))\n", "expr\n", #> "\n", "eval(expr)\n", "eval_tidy(expr)\n", #> "\n", "# Both accept a data mask as argument:\n", #> "data <- list(apple = \"CARROT\", kiwi = \"TOMATO\")\n", #> "eval(expr, data)\n", "eval_tidy(expr, data)\n", #> "\n", "\n", "# In addition eval_tidy() has support for quosures:\n", #> "with_data <- function(data, expr) {\n", " quo <- enquo(expr)\n", #> " eval_tidy(quo, data)\n", "}\n", "with_data(NULL, apple)\n", #> "with_data(data, apple)\n", "with_data(data, list(apple, kiwi))\n", #> "\n", "# Secondly eval_tidy() installs handy pronouns that allow users to\n", #> "# be explicit about where to find symbols:\n", #> "with_data(data, .data$apple)\n", "with_data(data, .env$apple)\n", #> "\n", "\n", "# Note that instead of using `.env` it is often equivalent and may\n", #> "# be preferred to unquote a value. There are two differences. First\n", #> "# unquoting happens earlier, when the quosure is created. Secondly,\n", #> "# subsetting `.env` with the `$` operator may be brittle because\n", #> "# `$` does not look through the parents of the environment.\n", #> "#\n", "# For instance using `.env$name` in a magrittr pipeline is an\n", #> "# instance where this poses problem, because the magrittr pipe\n", #> "# currently (as of v1.5.0) evaluates its operands in a *child* of\n", #> "# the current environment (this child environment is where it\n", #> "# defines the pronoun `.`).\n", list("\n", #> " data %>% with_data(!!kiwi) # \"kiwi\"\n", #> " data %>% with_data(.env$kiwi) # NULL\n"), #> "\n"), "\n", list("\n", list("nse-force"), #> " for the second leg of the tidy evaluation\n", #> "framework.\n"), "\n"), exec.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval.R", #> "\n", list("exec"), "\n", list("exec"), "\n", #> list("Execute a function"), "\n", list("\n", #> "exec(.fn, ..., .env = caller_env())\n"), "\n", #> list("\n", list(list(".fn"), list("A function, or function name as a string.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> Arguments for ", list(".fn"), #> ".")), "\n", "\n", list(list(".env"), list( #> "Environment in which to evaluate the call. This will be\n", #> "most useful if ", list("f"), " is a string, or the function has side-effects.")), #> "\n"), "\n", list("\n", "This function constructs and evaluates a call to ", #> list(".fn"), ".\n", "It has two primary uses:\n", #> list("\n", list(), " To call a function with arguments stored in a list (if the\n", #> "function doesn't support ", list("dynamic dots"), #> "). Splice the\n", "list of arguments with ", #> list("!!!"), ".\n", list(), " To call every function stored in a list (in conjunction with ", #> list("map()"), "/\n", list(list("lapply()")), #> ")\n"), "\n"), "\n", list("\n", "args <- list(x = c(1:10, 100, NA), na.rm = TRUE)\n", #> "exec(\"mean\", !!!args)\n", "exec(\"mean\", !!!args, trim = 0.2)\n", #> "\n", "fs <- list(a = function() \"a\", b = function() \"b\")\n", #> "lapply(fs, exec)\n", "\n", "# Compare to do.call it will not automatically inline expressions\n", #> "# into the evaluated call.\n", "x <- 10\n", #> "args <- exprs(x1 = x + 1, x2 = x * 2)\n", #> "exec(list, !!!args)\n", "do.call(list, args)\n", #> "\n", "# exec() is not designed to generate pretty function calls. This is\n", #> "# most easily seen if you call a function that captures the call:\n", #> "f <- disp ~ cyl\n", "exec(\"lm\", f, data = mtcars)\n", #> "\n", "# If you need finer control over the generated call, you'll need to\n", #> "# construct it yourself. This may require creating a new environment\n", #> "# with carefully constructed bindings\n", #> "data_env <- env(data = mtcars)\n", "eval(expr(lm(!!f, data)), data_env)\n"), #> "\n"), exiting.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("exiting"), "\n", list("exiting"), #> "\n", list("Exiting handler"), "\n", list("\n", #> "exiting(handler)\n"), "\n", list("\n", list( #> "rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", "\n", list("exiting()"), " is no longer necessary as handlers are exiting by default.\n"), #> "\n", list("internal"), "\n"), expr_interp.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/nse-force.R", #> "\n", list("expr_interp"), "\n", list("expr_interp"), #> "\n", list("Process unquote operators in a captured expression"), #> "\n", list("\n", "expr_interp(x, env = NULL)\n"), #> "\n", list("\n", list(list("x"), list("A function, raw expression, or formula to interpolate.")), #> "\n", "\n", list(list("env"), list("The environment in which unquoted expressions should be\n", #> "evaluated. By default, the formula or closure environment if a\n", #> "formula or a function, or the current environment otherwise.")), #> "\n"), "\n", list("\n", "While all capturing functions in the tidy evaluation framework\n", #> "perform unquote on capture (most notably ", #> list(list("quo()")), "),\n", list("expr_interp()"), #> " manually processes unquoting operators in\n", #> "expressions that are already captured. ", #> list("expr_interp()"), " should be\n", "called in all user-facing functions expecting a formula as argument\n", #> "to provide the same quasiquotation functionality as NSE functions.\n"), #> "\n", list("\n", "# All tidy NSE functions like quo() unquote on capture:\n", #> "quo(list(!!(1 + 2)))\n", "\n", "# expr_interp() is meant to provide the same functionality when you\n", #> "# have a formula or expression that might contain unquoting\n", #> "# operators:\n", "f <- ~list(!!(1 + 2))\n", #> "expr_interp(f)\n", "\n", "# Note that only the outer formula is unquoted (which is a reason\n", #> "# to use expr_interp() as early as possible in all user-facing\n", #> "# functions):\n", "f <- ~list(~!!(1 + 2), !!(1 + 2))\n", #> "expr_interp(f)\n", "\n", "\n", "# Another purpose for expr_interp() is to interpolate a closure's\n", #> "# body. This is useful to inline a function within another. The\n", #> "# important limitation is that all formal arguments of the inlined\n", #> "# function should be defined in the receiving function:\n", #> "other_fn <- function(x) toupper(x)\n", "\n", #> "fn <- expr_interp(function(x) {\n", " x <- paste0(x, \"_suffix\")\n", #> " !!! body(other_fn)\n", "})\n", "fn\n", "fn(\"foo\")\n"), #> "\n"), expr_label.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/expr.R", #> "\n", list("expr_label"), "\n", list("expr_label"), #> "\n", list("expr_name"), "\n", list("expr_text"), #> "\n", list("Turn an expression to a label"), #> "\n", list("\n", "expr_label(expr)\n", "\n", #> "expr_name(expr)\n", "\n", "expr_text(expr, width = 60L, nlines = Inf)\n"), #> "\n", list("\n", list(list("expr"), list("An expression to labellise.")), #> "\n", "\n", list(list("width"), list("Width of each line.")), #> "\n", "\n", list(list("nlines"), list("Maximum number of lines to extract.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", list("expr_text()"), " turns the expression into a single string, which\n", #> "might be multi-line. ", list("expr_name()"), #> " is suitable for formatting\n", "names. It works best with symbols and scalar types, but also\n", #> "accepts calls. ", list("expr_label()"), " formats the expression nicely for use\n", #> "in messages.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "These functions are in the questioning stage because they are\n", #> "redundant with the ", list("quo_"), " variants and do not handle quosures.\n")), #> "\n", "\n", list("\n", "# To labellise a function argument, first capture it with\n", #> "# substitute():\n", "fn <- function(x) expr_label(substitute(x))\n", #> "fn(x:y)\n", "\n", "# Strings are encoded\n", #> "expr_label(\"a\\nb\")\n", "\n", "# Names and expressions are quoted with ``\n", #> "expr_label(quote(x))\n", "expr_label(quote(a + b + c))\n", #> "\n", "# Long expressions are collapsed\n", #> "expr_label(quote(foo({\n", " 1 + 2\n", " print(x)\n", #> "})))\n"), "\n"), expr_print.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/expr.R", #> "\n", list("expr_print"), "\n", list("expr_print"), #> "\n", list("expr_deparse"), "\n", list("Print an expression"), #> "\n", list("\n", "expr_print(x, width = peek_option(\"width\"))\n", #> "\n", "expr_deparse(x, width = peek_option(\"width\"))\n"), #> "\n", list("\n", list(list("x"), list("An object or expression to print.")), #> "\n", "\n", list(list("width"), list("The width of the deparsed or printed expression.\n", #> "Defaults to the global option ", list("width"), #> ".")), "\n"), "\n", list("\n", list("expr_print()"), #> ", powered by ", list("expr_deparse()"), ", is an alternative\n", #> "printer for R expressions with a few improvements over the base R\n", #> "printer.\n", list("\n", list(), " It colourises ", #> list("quosures"), " according to their environment.\n", #> "Quosures from the global environment are printed normally while\n", #> "quosures from local environments are printed in unique colour (or\n", #> "in italic when all colours are taken).\n", #> list(), " It wraps inlined objects in angular brackets. For instance, an\n", #> "integer vector unquoted in a function call (e.g.\n", #> list("expr(foo(!!(1:3)))"), ") is printed like this: ", #> list("foo(<int: 1L, 2L, 3L>)"), " while by default R prints the code to create that vector:\n", #> list("foo(1:3)"), " which is ambiguous.\n", #> list(), " It respects the width boundary (from the global option ", #> list("width"), ")\n", "in more cases.\n"), #> "\n"), "\n", list("\n", "# It supports any object. Non-symbolic objects are always printed\n", #> "# within angular brackets:\n", "expr_print(1:3)\n", #> "expr_print(function() NULL)\n", "\n", "# Contrast this to how the code to create these objects is printed:\n", #> "expr_print(quote(1:3))\n", "expr_print(quote(function() NULL))\n", #> "\n", "# The main cause of non-symbolic objects in expressions is\n", #> "# quasiquotation:\n", "expr_print(expr(foo(!!(1:3))))\n", #> "\n", "\n", "# Quosures from the global environment are printed normally:\n", #> "expr_print(quo(foo))\n", "expr_print(quo(foo(!!quo(bar))))\n", #> "\n", "# Quosures from local environments are colourised according to\n", #> "# their environments (if you have crayon installed):\n", #> "local_quo <- local(quo(foo))\n", "expr_print(local_quo)\n", #> "\n", "wrapper_quo <- local(quo(bar(!!local_quo, baz)))\n", #> "expr_print(wrapper_quo)\n"), "\n"), exprs_auto_name.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/nse-defuse.R", #> "\n", list("exprs_auto_name"), "\n", list("exprs_auto_name"), #> "\n", list("quos_auto_name"), "\n", list("Ensure that all elements of a list of expressions are named"), #> "\n", list("\n", "exprs_auto_name(exprs, width = NULL, printer = NULL)\n", #> "\n", "quos_auto_name(quos, width = NULL)\n"), #> "\n", list("\n", list(list("exprs"), list("A list of expressions.")), #> "\n", "\n", list(list("width"), list("Deprecated. Maximum width of names.")), #> "\n", "\n", list(list("printer"), list("Deprecated. A function that takes an expression\n", #> "and converts it to a string. This function must take an\n", #> "expression as the first argument and ", #> list("width"), " as the second\n", "argument.")), #> "\n", "\n", list(list("quos"), list("A list of quosures.")), #> "\n"), "\n", list("\n", "This gives default names to unnamed elements of a list of\n", #> "expressions (or expression wrappers such as formulas or\n", #> "quosures). ", list("exprs_auto_name()"), " deparses the expressions with\n", #> list(list("expr_name()")), " by default. ", #> list("quos_auto_name()"), " deparses with\n", #> list(list("quo_name()")), ".\n"), "\n"), f_rhs.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/formula.R", #> "\n", list("f_rhs"), "\n", list("f_rhs"), "\n", #> list("f_rhs<-"), "\n", list("f_lhs"), "\n", list( #> "f_lhs<-"), "\n", list("f_env"), "\n", list( #> "f_env<-"), "\n", list("Get or set formula components"), #> "\n", list("\n", "f_rhs(f)\n", "\n", "f_rhs(x) <- value\n", #> "\n", "f_lhs(f)\n", "\n", "f_lhs(x) <- value\n", #> "\n", "f_env(f)\n", "\n", "f_env(x) <- value\n"), #> "\n", list("\n", list(list("f, x"), list("A formula")), #> "\n", "\n", list(list("value"), list("The value to replace with.")), #> "\n"), "\n", list("\n", list("f_rhs"), " and ", #> list("f_lhs"), " return language objects (i.e. atomic\n", #> "vectors of length 1, a name, or a call). ", #> list("f_env"), " returns an\n", "environment.\n"), #> "\n", list("\n", list("f_rhs"), " extracts the righthand side, ", #> list("f_lhs"), " extracts the lefthand\n", #> "side, and ", list("f_env"), " extracts the environment. All functions throw an\n", #> "error if ", list("f"), " is not a formula.\n"), #> "\n", list("\n", "f_rhs(~ 1 + 2 + 3)\n", "f_rhs(~ x)\n", #> "f_rhs(~ \"A\")\n", "f_rhs(1 ~ 2)\n", "\n", #> "f_lhs(~ y)\n", "f_lhs(x ~ y)\n", "\n", "f_env(~ x)\n"), #> "\n"), f_text.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/formula.R", #> "\n", list("f_text"), "\n", list("f_text"), "\n", #> list("f_name"), "\n", list("f_label"), "\n", #> list("Turn RHS of formula into a string or label"), #> "\n", list("\n", "f_text(x, width = 60L, nlines = Inf)\n", #> "\n", "f_name(x)\n", "\n", "f_label(x)\n"), #> "\n", list("\n", list(list("x"), list("A formula.")), #> "\n", "\n", list(list("width"), list("Width of each line.")), #> "\n", "\n", list(list("nlines"), list("Maximum number of lines to extract.")), #> "\n"), "\n", list("\n", "Equivalent of ", list( #> list("expr_text()")), " and ", list(list("expr_label()")), #> " for formulas.\n"), "\n", list("\n", "f <- ~ a + b + bc\n", #> "f_text(f)\n", "f_label(f)\n", "\n", "# Names a quoted with ``\n", #> "f_label(~ x)\n", "# Strings are encoded\n", #> "f_label(~ \"a\\nb\")\n", "# Long expressions are collapsed\n", #> "f_label(~ foo({\n", " 1 + 2\n", " print(x)\n", #> "}))\n"), "\n"), `faq-options.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/faq.R", #> "\n", list("faq-options"), "\n", list("faq-options"), #> "\n", list("Global options for rlang"), "\n", #> list("\n", "rlang has several options which may be set globally to control\n", #> "behavior. A brief description of each is given here. If any functions\n", #> "are referenced, refer to their documentation for additional details.\n", #> list("\n", list(), " ", list("rlang_interactive"), #> ": A logical value used by ", list(list("is_interactive()")), #> ". This\n", "can be set to ", list("TRUE"), #> " to test interactive behavior in unit tests,\n", #> "for example.\n", list(), " ", list("rlang_backtrace_on_error"), #> ": A character string which controls whether\n", #> "backtraces are displayed with error messages, and the level of\n", #> "detail they print. See ", list("rlang_backtrace_on_error"), #> " for the possible option values.\n", list(), #> " ", list("rlang_trace_format_srcrefs"), #> ": A logical value used to control whether\n", #> "srcrefs are printed as part of the backtrace.\n", #> list(), " ", list("rlang_trace_top_env"), #> ": An environment which will be treated as the\n", #> "top-level environment when printing traces. See ", #> list(list("trace_back()")), "\n", "for examples.\n"), #> "\n"), "\n"), flatten.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-squash.R", #> "\n", list("flatten"), "\n", list("flatten"), #> "\n", list("flatten_lgl"), "\n", list("flatten_int"), #> "\n", list("flatten_dbl"), "\n", list("flatten_cpl"), #> "\n", list("flatten_chr"), "\n", list("flatten_raw"), #> "\n", list("squash"), "\n", list("squash_lgl"), #> "\n", list("squash_int"), "\n", list("squash_dbl"), #> "\n", list("squash_cpl"), "\n", list("squash_chr"), #> "\n", list("squash_raw"), "\n", list("flatten_if"), #> "\n", list("squash_if"), "\n", list("Flatten or squash a list of lists into a simpler vector"), #> "\n", list("\n", "flatten(x)\n", "\n", "flatten_lgl(x)\n", #> "\n", "flatten_int(x)\n", "\n", "flatten_dbl(x)\n", #> "\n", "flatten_cpl(x)\n", "\n", "flatten_chr(x)\n", #> "\n", "flatten_raw(x)\n", "\n", "squash(x)\n", #> "\n", "squash_lgl(x)\n", "\n", "squash_int(x)\n", #> "\n", "squash_dbl(x)\n", "\n", "squash_cpl(x)\n", #> "\n", "squash_chr(x)\n", "\n", "squash_raw(x)\n", #> "\n", "flatten_if(x, predicate = is_spliced)\n", #> "\n", "squash_if(x, predicate = is_spliced)\n"), #> "\n", list("\n", list(list("x"), list("A list to flatten or squash. The contents of the list can\n", #> "be anything for unsuffixed functions ", list( #> "flatten()"), " and ", list("squash()"), #> "\n", "(as a list is returned), but the contents must match the type for\n", #> "the other functions.")), "\n", "\n", list( #> list("predicate"), list("A function of one argument returning whether it\n", #> "should be spliced.")), "\n"), "\n", list( #> "\n", list("flatten()"), " returns a list, ", #> list("flatten_lgl()"), " a logical\n", "vector, ", #> list("flatten_int()"), " an integer vector, ", #> list("flatten_dbl()"), " a\n", "double vector, and ", #> list("flatten_chr()"), " a character vector. Similarly\n", #> "for ", list("squash()"), " and the typed variants (", #> list("squash_lgl()"), " etc).\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", list("flatten()"), " removes one level hierarchy from a list, while\n", #> list("squash()"), " removes all levels. These functions are similar to\n", #> list(list("unlist()")), " but they are type-stable so you always know what the\n", #> "type of the output is.\n"), "\n", list(list( #> "Life cycle"), list("\n", "\n", "\n", "These functions are in the questioning stage. They have slightly\n", #> "different semantics than the flattening functions in purrr and we\n", #> "are currently rethinking our approach to flattening with the new\n", #> "typing facilities of the vctrs package.\n")), #> "\n", "\n", list("\n", "x <- replicate(2, sample(4), simplify = FALSE)\n", #> "x\n", "\n", "flatten(x)\n", "flatten_int(x)\n", #> "\n", "# With flatten(), only one level gets removed at a time:\n", #> "deep <- list(1, list(2, list(3)))\n", "flatten(deep)\n", #> "flatten(flatten(deep))\n", "\n", "# But squash() removes all levels:\n", #> "squash(deep)\n", "squash_dbl(deep)\n", "\n", #> "# The typed flatten functions remove one level and coerce to an atomic\n", #> "# vector at the same time:\n", "flatten_dbl(list(1, list(2)))\n", #> "\n", "# Only bare lists are flattened, but you can splice S3 lists\n", #> "# explicitly:\n", "foo <- set_attrs(list(\"bar\"), class = \"foo\")\n", #> "str(flatten(list(1, foo, list(100))))\n", #> "str(flatten(list(1, splice(foo), list(100))))\n", #> "\n", "# Instead of splicing manually, flatten_if() and squash_if() let\n", #> "# you specify a predicate function:\n", "is_foo <- function(x) inherits(x, \"foo\") || is_bare_list(x)\n", #> "str(flatten_if(list(1, foo, list(100)), is_foo))\n", #> "\n", "# squash_if() does the same with deep lists:\n", #> "deep_foo <- list(1, list(foo, list(foo, 100)))\n", #> "str(deep_foo)\n", "\n", "str(squash(deep_foo))\n", #> "str(squash_if(deep_foo, is_foo))\n"), "\n", #> list("internal"), "\n"), fn_body.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("fn_body"), "\n", list("fn_body"), #> "\n", list("fn_body<-"), "\n", list("Get or set function body"), #> "\n", list("\n", "fn_body(fn = caller_fn())\n", #> "\n", "fn_body(fn) <- value\n"), "\n", list( #> "\n", list(list("fn"), list("A function. It is lookep up in the calling frame if not\n", #> "supplied.")), "\n", "\n", list(list("value"), #> list("New formals or formals names for ", #> list("fn"), ".")), "\n"), "\n", list("\n", #> list("fn_body()"), " is a simple wrapper around ", #> list(list("base::body()")), ". It always\n", #> "returns a ", list("\\{"), " expression and throws an error when the input is a\n", #> "primitive function (whereas ", list("body()"), #> " returns ", list("NULL"), "). The setter\n", #> "version preserves attributes, unlike ", list( #> "body<-"), ".\n"), "\n", list("\n", "# fn_body() is like body() but always returns a block:\n", #> "fn <- function() do()\n", "body(fn)\n", "fn_body(fn)\n", #> "\n", "# It also throws an error when used on a primitive function:\n", #> "try(fn_body(base::list))\n"), "\n"), fn_env.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("fn_env"), "\n", list("fn_env"), "\n", #> list("fn_env<-"), "\n", list("Return the closure environment of a function"), #> "\n", list("\n", "fn_env(fn)\n", "\n", "fn_env(x) <- value\n"), #> "\n", list("\n", list(list("fn, x"), list("A function.")), #> "\n", "\n", list(list("value"), list("A new closure environment for the function.")), #> "\n"), "\n", list("\n", "Closure environments define the scope of functions (see ", #> list(list("env()")), ").\n", "When a function call is evaluated, R creates an evaluation frame\n", #> "(see ", list(list("ctxt_stack()")), ") that inherits from the closure environment.\n", #> "This makes all objects defined in the closure environment and all\n", #> "its parents available to code executed within the function.\n"), #> "\n", list("\n", list("fn_env()"), " returns the closure environment of ", #> list("fn"), ". There is also\n", "an assignment method to set a new closure environment.\n"), #> "\n", list("\n", "env <- child_env(\"base\")\n", #> "fn <- with_env(env, function() NULL)\n", "identical(fn_env(fn), env)\n", #> "\n", "other_env <- child_env(\"base\")\n", #> "fn_env(fn) <- other_env\n", "identical(fn_env(fn), other_env)\n"), #> "\n"), fn_fmls.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("fn_fmls"), "\n", list("fn_fmls"), #> "\n", list("fn_fmls_names"), "\n", list("fn_fmls_syms"), #> "\n", list("fn_fmls<-"), "\n", list("fn_fmls_names<-"), #> "\n", list("Extract arguments from a function"), #> "\n", list("\n", "fn_fmls(fn = caller_fn())\n", #> "\n", "fn_fmls_names(fn = caller_fn())\n", #> "\n", "fn_fmls_syms(fn = caller_fn())\n", "\n", #> "fn_fmls(fn) <- value\n", "\n", "fn_fmls_names(fn) <- value\n"), #> "\n", list("\n", list(list("fn"), list("A function. It is lookep up in the calling frame if not\n", #> "supplied.")), "\n", "\n", list(list("value"), #> list("New formals or formals names for ", list( #> "fn"), ".")), "\n"), "\n", list("\n", list( #> "fn_fmls()"), " returns a named list of formal arguments.\n", #> list("fn_fmls_names()"), " returns the names of the arguments.\n", #> list("fn_fmls_syms()"), " returns formals as a named list of symbols. This\n", #> "is especially useful for forwarding arguments in ", #> list("constructed calls"), ".\n"), "\n", list( #> "\n", "Unlike ", list("formals()"), ", these helpers throw an error with primitive\n", #> "functions instead of returning ", list("NULL"), #> ".\n"), "\n", list("\n", "# Extract from current call:\n", #> "fn <- function(a = 1, b = 2) fn_fmls()\n", #> "fn()\n", "\n", "# fn_fmls_syms() makes it easy to forward arguments:\n", #> "call2(\"apply\", !!! fn_fmls_syms(lapply))\n", #> "\n", "# You can also change the formals:\n", #> "fn_fmls(fn) <- list(A = 10, B = 20)\n", "fn()\n", #> "\n", "fn_fmls_names(fn) <- c(\"foo\", \"bar\")\n", #> "fn()\n"), "\n", list("\n", list(list("call_args()")), #> " and ", list(list("call_args_names()")), "\n"), #> "\n"), format_error_bullets.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-message.R", #> "\n", list("format_error_bullets"), "\n", list( #> "format_error_bullets"), "\n", list("Format bullets for error messages"), #> "\n", list("\n", "format_error_bullets(x)\n"), #> "\n", list("\n", list(list("x"), list("A named character vector of messages. Elements named as\n", #> list("x"), " or ", list("i"), " are prefixed with the corresponding bullet.")), #> "\n"), "\n", list("\n", list("format_error_bullets()"), #> " takes a character vector and returns a single\n", #> "string (or an empty vector if the input is empty). The elements of\n", #> "the input vector are assembled as a list of bullets, depending on\n", #> "their names:\n", list("\n", list(), " Elements named ", #> list("\"i\""), " are bulleted with a blue \"info\" symbol.\n", #> list(), " Elements named ", list("\"x\""), #> " are bulleted with a red \"cross\" symbol.\n", #> list(), " Unnamed elements are bulleted with a \"*\" symbol.\n"), #> "\n", "\n", "This experimental infrastructure is based on the idea that\n", #> "sentences in error messages are best kept short and simple. From\n", #> "this point of view, the best way to present the information is in\n", #> "the ", list(list("cnd_body()")), " method of an error conditon, as a bullet list of\n", #> "simple sentences containing a single clause. The info and cross\n", #> "symbols of the bullets provide hints on how to interpret the bullet\n", #> "relative to the general error issue, which should be supplied as\n", #> list(list("cnd_header()")), ".\n"), "\n"), #> frame_position.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("frame_position"), "\n", list("frame_position"), #> "\n", list("Find the position or distance of a frame on the evaluation stack"), #> "\n", list("\n", "frame_position(frame, from = c(\"global\", \"current\"))\n"), #> "\n", list("\n", list(list("frame"), list("The environment of a frame. Can be any object with a\n", #> list(list("get_env()")), " method. Note that for frame objects, the position from\n", #> "the global frame is simply ", list("frame$pos"), #> ". Alternatively, ", list("frame"), "\n", "can be an integer that represents the position on the stack (and\n", #> "is thus returned as is if ", list("from"), #> " is \"global\".")), "\n", "\n", list(list( #> "from"), list("Whether to compute distance from the global frame (the\n", #> "bottom of the evaluation stack), or from the current frame (the\n", #> "top of the evaluation stack).")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "The frame position on the stack can be computed by counting frames\n", #> "from the global frame (the bottom of the stack, the default) or\n", #> "from the current frame (the top of the stack).\n"), #> "\n", list("\n", "While this function returns the position of the frame on the\n", #> "evaluation stack, it can safely be called with intervening frames\n", #> "as those will be discarded.\n"), "\n", list( #> list("Life cycle"), list("\n", "\n", "\n", #> "These functions are deprecated and replaced by ", #> list(list("trace_back()")), ".\n")), "\n", #> "\n", list("\n", "fn <- function() g(environment())\n", #> "g <- function(env) frame_position(env)\n", #> "\n", "# frame_position() returns the position of the frame on the evaluation stack:\n", #> "fn()\n", "identity(identity(fn()))\n", "\n", #> "# Note that it trims off intervening calls before counting so you\n", #> "# can safely nest it within other calls:\n", #> "g <- function(env) identity(identity(frame_position(env)))\n", #> "fn()\n", "\n", "# You can also ask for the position from the current frame rather\n", #> "# than the global frame:\n", "fn <- function() g(environment())\n", #> "g <- function(env) h(env)\n", "h <- function(env) frame_position(env, from = \"current\")\n", #> "fn()\n"), "\n", list("internal"), "\n"), friendly_type.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("friendly_type"), "\n", list("friendly_type"), #> "\n", list("Format a type for error messages"), #> "\n", list("\n", "friendly_type(type)\n"), "\n", #> list("\n", list(list("type"), list("A type as returned by ", #> list(list("typeof()")), ".")), "\n"), "\n", #> list("\n", "A string of the prettified type, qualified with an\n", #> "indefinite article.\n"), "\n", list("\n", #> "Format a type for error messages\n"), "\n", #> list(list("Life cycle"), list("\n", "\n", list( #> "\n", list(), " ", list("friendly_type()"), #> " is experimental.\n"), "\n")), "\n", "\n", #> list("\n", "friendly_type(\"logical\")\n", "friendly_type(\"integer\")\n", #> "friendly_type(\"string\")\n"), "\n", list( #> "internal"), "\n"), get_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env.R", #> "\n", list("get_env"), "\n", list("get_env"), #> "\n", list("set_env"), "\n", list("env_poke_parent"), #> "\n", list("Get or set the environment of an object"), #> "\n", list("\n", "get_env(env, default = NULL)\n", #> "\n", "set_env(env, new_env = caller_env())\n", #> "\n", "env_poke_parent(env, new_env)\n"), "\n", #> list("\n", list(list("env"), list("An environment.")), #> "\n", "\n", list(list("default"), list("The default environment in case ", #> list("env"), " does not wrap\n", "an environment. If ", #> list("NULL"), " and no environment could be extracted,\n", #> "an error is issued.")), "\n", "\n", list( #> list("new_env"), list("An environment to replace ", #> list("env"), " with.")), "\n"), "\n", list( #> "\n", "These functions dispatch internally with methods for functions,\n", #> "formulas and frames. If called with a missing argument, the\n", #> "environment of the current evaluation frame (see ", #> list(list("ctxt_stack()")), ") is\n", "returned. If you call ", #> list("get_env()"), " with an environment, it acts as\n", #> "the identity function and the environment is simply returned (this\n", #> "helps simplifying code when writing generic functions for\n", #> "environments).\n"), "\n", list("\n", "While ", #> list("set_env()"), " returns a modified copy and does not have side\n", #> "effects, ", list("env_poke_parent()"), " operates changes the environment by\n", #> "side effect. This is because environments are\n", #> list("uncopyable"), ". Be careful not to change environments\n", #> "that you don't own, e.g. a parent environment of a function from a\n", #> "package.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", list("\n", list(), " Using ", #> list("get_env()"), " without supplying ", #> list("env"), " is deprecated as\n", "of rlang 0.3.0. Please use ", #> list(list("current_env()")), " to retrieve the\n", #> "current environment.\n", list(), " Passing environment wrappers like formulas or functions instead\n", #> "of bare environments is deprecated as of rlang 0.3.0. This\n", #> "internal genericity was causing confusion (see issue #427). You\n", #> "should now extract the environment separately before calling\n", #> "these functions.\n"), "\n")), "\n", "\n", #> list("\n", "# Environment of closure functions:\n", #> "fn <- function() \"foo\"\n", "get_env(fn)\n", #> "\n", "# Or of quosures or formulas:\n", "get_env(~foo)\n", #> "get_env(quo(foo))\n", "\n", "\n", "# Provide a default in case the object doesn't bundle an environment.\n", #> "# Let's create an unevaluated formula:\n", #> "f <- quote(~foo)\n", "\n", "# The following line would fail if run because unevaluated formulas\n", #> "# don't bundle an environment (they didn't have the chance to\n", #> "# record one yet):\n", "# get_env(f)\n", "\n", #> "# It is often useful to provide a default when you're writing\n", #> "# functions accepting formulas as input:\n", #> "default <- env()\n", "identical(get_env(f, default), default)\n", #> "\n", "# set_env() can be used to set the enclosure of functions and\n", #> "# formulas. Let's create a function with a particular environment:\n", #> "env <- child_env(\"base\")\n", "fn <- set_env(function() NULL, env)\n", #> "\n", "# That function now has `env` as enclosure:\n", #> "identical(get_env(fn), env)\n", "identical(get_env(fn), current_env())\n", #> "\n", "# set_env() does not work by side effect. Setting a new environment\n", #> "# for fn has no effect on the original function:\n", #> "other_env <- child_env(NULL)\n", "set_env(fn, other_env)\n", #> "identical(get_env(fn), other_env)\n", "\n", #> "# Since set_env() returns a new function with a different\n", #> "# environment, you'll need to reassign the result:\n", #> "fn <- set_env(fn, other_env)\n", "identical(get_env(fn), other_env)\n"), #> "\n", list("\n", list(list("quo_get_env()")), #> " and ", list(list("quo_set_env()")), " for versions of\n", #> list(list("get_env()")), " and ", list(list( #> "set_env()")), " that only work on quosures.\n"), #> "\n"), has_length.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("has_length"), "\n", list("has_length"), #> "\n", list("How long is an object?"), "\n", list( #> "\n", "has_length(x, n = NULL)\n"), "\n", list( #> "\n", list(list("x"), list("A R object.")), #> "\n", "\n", list(list("n"), list("A specific length to test ", #> list("x"), " with. If ", list("NULL"), ",\n", #> list("has_length()"), " returns ", list("TRUE"), #> " if ", list("x"), " has length greater than\n", #> "zero, and ", list("FALSE"), " otherwise.")), #> "\n"), "\n", list("\n", "This is a function for the common task of testing the length of an\n", #> "object. It checks the length of an object in a non-generic way:\n", #> list(list("base::length()")), " methods are ignored.\n"), #> "\n", list("\n", "has_length(list())\n", "has_length(list(), 0)\n", #> "\n", "has_length(letters)\n", "has_length(letters, 20)\n", #> "has_length(letters, 26)\n"), "\n", list("internal"), #> "\n"), has_name.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("has_name"), "\n", list("has_name"), #> "\n", list("Does an object have an element with this name?"), #> "\n", list("\n", "has_name(x, name)\n"), "\n", #> list("\n", list(list("x"), list("A data frame or another named object")), #> "\n", "\n", list(list("name"), list("Element name(s) to check")), #> "\n"), "\n", list("\n", "A logical vector of the same length as ", #> list("name"), "\n"), "\n", list("\n", "This function returns a logical value that indicates if a data\n", #> "frame or another named object contains an element with a specific\n", #> "name. Note that ", list("has_name()"), " only works with vectors. For instance,\n", #> "environments need the specialised function ", #> list(list("env_has()")), ".\n"), "\n", list( #> "\n", "Unnamed objects are treated as if all names are empty strings. ", #> list("NA"), "\n", "input gives ", list("FALSE"), #> " as output.\n"), "\n", list("\n", "has_name(iris, \"Species\")\n", #> "has_name(mtcars, \"gears\")\n"), "\n"), hash.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/hash.R", #> "\n", list("hash"), "\n", list("hash"), "\n", #> list("Hash an object"), "\n", list("\n", "hash(x)\n"), #> "\n", list("\n", list(list("x"), list("An object.")), #> "\n"), "\n", list("\n", list("hash()"), " hashes an arbitrary R object.\n", #> "\n", "The generated hash is guaranteed to be reproducible across platforms, but\n", #> "not across R versions.\n"), "\n", list("\n", #> list("hash()"), " uses the XXH128 hash algorithm of the xxHash library, which\n", #> "generates a 128-bit hash. It is implemented as a streaming hash, which\n", #> "generates the hash with minimal extra memory usage.\n", #> "\n", "Objects are converted to binary using R's native serialization tools.\n", #> "On R >= 3.5.0, serialization version 3 is used, otherwise version 2 is used.\n", #> "See ", list(list("serialize()")), " for more information about the serialization version.\n"), #> "\n", list("\n", "hash(c(1, 2, 3))\n", "hash(mtcars)\n"), #> "\n"), inherits_any.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/s3.R", #> "\n", list("inherits_any"), "\n", list("inherits_any"), #> "\n", list("inherits_all"), "\n", list("inherits_only"), #> "\n", list("Does an object inherit from a set of classes?"), #> "\n", list("\n", "inherits_any(x, class)\n", #> "\n", "inherits_all(x, class)\n", "\n", "inherits_only(x, class)\n"), #> "\n", list("\n", list(list("x"), list("An object to test for inheritance.")), #> "\n", "\n", list(list("class"), list("A character vector of classes.")), #> "\n"), "\n", list("\n", list("\n", list(), #> " ", list("inherits_any()"), " is like ", list( #> list("base::inherits()")), " but is more explicit\n", #> "about its behaviour with multiple classes. If ", #> list("classes"), " contains\n", "several elements and the object inherits from at least one of\n", #> "them, ", list("inherits_any()"), " returns ", #> list("TRUE"), ".\n", list(), " ", list("inherits_all()"), #> " tests that an object inherits from all of the\n", #> "classes in the supplied order. This is usually the best way to\n", #> "test for inheritance of multiple classes.\n", #> list(), " ", list("inherits_only()"), " tests that the class vectors are identical. It\n", #> "is a shortcut for ", list("identical(class(x), class)"), #> ".\n"), "\n"), "\n", list("\n", "obj <- structure(list(), class = c(\"foo\", \"bar\", \"baz\"))\n", #> "\n", "# With the _any variant only one class must match:\n", #> "inherits_any(obj, c(\"foobar\", \"bazbaz\"))\n", #> "inherits_any(obj, c(\"foo\", \"bazbaz\"))\n", #> "\n", "# With the _all variant all classes must match:\n", #> "inherits_all(obj, c(\"foo\", \"bazbaz\"))\n", #> "inherits_all(obj, c(\"foo\", \"baz\"))\n", #> "\n", "# The order of classes must match as well:\n", #> "inherits_all(obj, c(\"baz\", \"foo\"))\n", #> "\n", "# inherits_only() checks that the class vectors are identical:\n", #> "inherits_only(obj, c(\"foo\", \"baz\"))\n", #> "inherits_only(obj, c(\"foo\", \"bar\", \"baz\"))\n"), #> "\n"), inject.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval.R", #> "\n", list("inject"), "\n", list("inject"), "\n", #> list("Inject objects in an R expression"), "\n", #> list("\n", "inject(expr, env = caller_env())\n"), #> "\n", list("\n", list(list("expr"), list("An argument to evaluate. This argument is immediately\n", #> "evaluated in ", list("env"), " (the current environment by default) with\n", #> "injected objects and expressions.")), "\n", #> "\n", list(list("env"), list("The environment in which to evaluate ", #> list("expr"), ". Defaults to\n", "the current environment. For expert use only.")), #> "\n"), "\n", list("\n", list("inject()"), " evaluates an expression with ", #> list("injection"), "\n", "(unquotation) support. There are three main usages:\n"), #> "\n", list("\n", list("\n", list(), " ", list( #> "Splicing"), " lists of arguments in a function call.\n", #> list(), " Inline objects or other expressions in an expression with ", #> list("!!"), "\n", "and ", list("!!!"), ". For instance to create functions or formulas\n", #> "programmatically.\n", list(), " Pass arguments to NSE functions that ", #> list("defuse"), " their\n", "arguments without injection support (see for instance\n", #> list(list("enquo0()")), "). You can use ", #> list("{{ arg }}"), " with functions documented\n", #> "to support quosures. Otherwise, use ", list( #> "!!enexpr(arg)"), ".\n"), "\n"), "\n", list( #> "\n", "# inject() simply evaluates its argument with injection\n", #> "# support. These expressions are equivalent:\n", #> "2 * 3\n", "inject(2 * 3)\n", "inject(!!2 * !!3)\n", #> "\n", "# Injection with `!!` can be useful to insert objects or\n", #> "# expressions within other expressions, like formulas:\n", #> "lhs <- sym(\"foo\")\n", "rhs <- sym(\"bar\")\n", #> "inject(!!lhs ~ !!rhs + 10)\n", "\n", "# Injection with `!!!` splices lists of arguments in function\n", #> "# calls:\n", "args <- list(na.rm = TRUE, finite = 0.2)\n", #> "inject(mean(1:10, !!!args))\n"), "\n"), invoke.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval.R", #> "\n", list("invoke"), "\n", list("invoke"), "\n", #> list("Invoke a function with a list of arguments"), #> "\n", list("\n", "invoke(.fn, .args = list(), ..., .env = caller_env(), .bury = c(\".fn\", \"\"))\n"), #> "\n", list("\n", list(list(".fn"), list("A function to invoke. Can be a function object or the\n", #> "name of a function in scope of ", list(".env"), #> ".")), "\n", "\n", list(list(".args, ..."), #> list("List of arguments (possibly named) to be passed to\n", #> list(".fn"), ".")), "\n", "\n", list(list( #> ".env"), list("The environment in which to call ", #> list(".fn"), ".")), "\n", "\n", list(list(".bury"), #> list("A character vector of length 2. The first string\n", #> "specifies which name should the function have in the call\n", #> "recorded in the evaluation stack. The second string specifies a\n", #> "prefix for the argument names. Set ", list( #> ".bury"), " to ", list("NULL"), " if you\n", #> "prefer to inline the function and its arguments in the call.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", "\n", "Normally, you invoke a R function by typing arguments manually. A\n", #> "powerful alternative is to call a function with a list of arguments\n", #> "assembled programmatically. This is the purpose of ", #> list("invoke()"), ".\n"), "\n", list("\n", #> "Technically, ", list("invoke()"), " is basically a version of ", #> list(list("base::do.call()")), "\n", "that creates cleaner call traces because it does not inline the\n", #> "function and the arguments in the call (see examples). To achieve\n", #> "this, ", list("invoke()"), " creates a child environment of ", #> list(".env"), " with ", list(".fn"), "\n", #> "and all arguments bound to new symbols (see ", #> list(list("env_bury()")), "). It then\n", "uses the same strategy as ", #> list(list("eval_bare()")), " to evaluate with minimal\n", #> "noise.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", list("invoke()"), " is soft-deprecated in favour of ", #> list(list("exec()")), ". Now that we\n", #> "understand better the interaction between unquoting and dots\n", #> "capture, we can take a simpler approach in ", #> list("exec()"), ".\n", "\n", "If you need finer control over the generated call, you should construct\n", #> "an environment and call yourself, manually burying large objects\n", #> "or complex expressions.\n")), "\n", "\n", #> list("\n", "# invoke() has the same purpose as do.call():\n", #> "invoke(paste, letters)\n", "\n", "# But it creates much cleaner calls:\n", #> "invoke(call_inspect, mtcars)\n", "\n", "# and stacktraces:\n", #> "fn <- function(...) sys.calls()\n", "invoke(fn, list(mtcars))\n", #> "\n", "# Compare to do.call():\n", "do.call(call_inspect, mtcars)\n", #> "do.call(fn, list(mtcars))\n", "\n", "\n", #> "# Specify the function name either by supplying a string\n", #> "# identifying the function (it should be visible in .env):\n", #> "invoke(\"call_inspect\", letters)\n", "\n", #> "# Or by changing the .bury argument, with which you can also change\n", #> "# the argument prefix:\n", "invoke(call_inspect, mtcars, .bury = c(\"inspect!\", \"col\"))\n"), #> "\n", list("internal"), "\n"), is_call.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("is_call"), "\n", list("is_call"), #> "\n", list("Is object a call?"), "\n", list("\n", #> "is_call(x, name = NULL, n = NULL, ns = NULL)\n"), #> "\n", list("\n", list(list("x"), list("An object to test. If a formula, the right-hand side is\n", #> "extracted.")), "\n", "\n", list(list("name"), #> list("An optional name that the call should match. It is\n", #> "passed to ", list(list("sym()")), " before matching. This argument is vectorised\n", #> "and you can supply a vector of names to match. In this case,\n", #> list("is_call()"), " returns ", list("TRUE"), #> " if at least one name matches.")), "\n", #> "\n", list(list("n"), list("An optional number of arguments that the call should\n", #> "match.")), "\n", "\n", list(list("ns"), #> list("The namespace of the call. If ", list( #> "NULL"), ", the namespace\n", "doesn't participate in the pattern-matching. If an empty string\n", #> list("\"\""), " and ", list("x"), " is a namespaced call, ", #> list("is_call()"), " returns\n", list("FALSE"), #> ". If any other string, ", list("is_call()"), #> " checks that ", list("x"), " is\n", "namespaced within ", #> list("ns"), ".\n", "\n", "Can be a character vector of namespaces, in which case the call\n", #> "has to match at least one of them, otherwise ", #> list("is_call()"), " returns\n", list("FALSE"), #> ".")), "\n"), "\n", list("\n", "This function tests if ", #> list("x"), " is a ", list("call"), ". This is a\n", #> "pattern-matching predicate that returns ", #> list("FALSE"), " if ", list("name"), " and ", #> list("n"), "\n", "are supplied and the call does not match these properties.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", list("is_lang()"), " has been soft-deprecated and renamed to ", #> list("is_call()"), " in\n", "rlang 0.2.0 and similarly for ", #> list("is_unary_lang()"), " and\n", list("is_binary_lang()"), #> ". This renaming follows the general switch from\n", #> "\"language\" to \"call\" in the rlang type nomenclature. See lifecycle\n", #> "section in ", list(list("call2()")), ".\n")), #> "\n", "\n", list("\n", "is_call(quote(foo(bar)))\n", #> "\n", "# You can pattern-match the call with additional arguments:\n", #> "is_call(quote(foo(bar)), \"foo\")\n", "is_call(quote(foo(bar)), \"bar\")\n", #> "is_call(quote(foo(bar)), quote(foo))\n", "\n", #> "# Match the number of arguments with is_call():\n", #> "is_call(quote(foo(bar)), \"foo\", 1)\n", "is_call(quote(foo(bar)), \"foo\", 2)\n", #> "\n", "\n", "# By default, namespaced calls are tested unqualified:\n", #> "ns_expr <- quote(base::list())\n", "is_call(ns_expr, \"list\")\n", #> "\n", "# You can also specify whether the call shouldn't be namespaced by\n", #> "# supplying an empty string:\n", "is_call(ns_expr, \"list\", ns = \"\")\n", #> "\n", "# Or if it should have a namespace:\n", #> "is_call(ns_expr, \"list\", ns = \"utils\")\n", #> "is_call(ns_expr, \"list\", ns = \"base\")\n", #> "\n", "# You can supply multiple namespaces:\n", #> "is_call(ns_expr, \"list\", ns = c(\"utils\", \"base\"))\n", #> "is_call(ns_expr, \"list\", ns = c(\"utils\", \"stats\"))\n", #> "\n", "# If one of them is \"\", unnamespaced calls will match as well:\n", #> "is_call(quote(list()), \"list\", ns = \"base\")\n", #> "is_call(quote(list()), \"list\", ns = c(\"base\", \"\"))\n", #> "is_call(quote(base::list()), \"list\", ns = c(\"base\", \"\"))\n", #> "\n", "\n", "# The name argument is vectorised so you can supply a list of names\n", #> "# to match with:\n", "is_call(quote(foo(bar)), c(\"bar\", \"baz\"))\n", #> "is_call(quote(foo(bar)), c(\"bar\", \"foo\"))\n", #> "is_call(quote(base::list), c(\"::\", \":::\", \"$\", \"@\"))\n"), #> "\n", list("\n", list(list("is_expression()")), #> "\n"), "\n"), is_callable.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("is_callable"), "\n", list("is_callable"), #> "\n", list("Is an object callable?"), "\n", list( #> "\n", "is_callable(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", "A callable object is an object that can appear in the function\n", #> "position of a call (as opposed to argument position). This includes\n", #> list("symbolic objects"), " that evaluate to a function or\n", #> "literal functions embedded in the call.\n"), #> "\n", list("\n", "Note that strings may look like callable objects because\n", #> "expressions of the form ", list("\"list\"()"), #> " are valid R code. However,\n", "that's only because the R parser transforms strings to symbols. It\n", #> "is not legal to manually set language heads to strings.\n"), #> "\n", list("\n", "# Symbolic objects and functions are callable:\n", #> "is_callable(quote(foo))\n", "is_callable(base::identity)\n", #> "\n", "# node_poke_car() lets you modify calls without any checking:\n", #> "lang <- quote(foo(10))\n", "node_poke_car(lang, current_env())\n", #> "\n", "# Use is_callable() to check an input object is safe to put as CAR:\n", #> "obj <- base::identity\n", "\n", "if (is_callable(obj)) {\n", #> " lang <- node_poke_car(lang, obj)\n", "} else {\n", #> " abort(\"`obj` must be callable\")\n", "}\n", #> "\n", "eval_bare(lang)\n"), "\n", list("internal"), #> "\n"), is_condition.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd.R", #> "\n", list("is_condition"), "\n", list("is_condition"), #> "\n", list("Is object a condition?"), "\n", list( #> "\n", "is_condition(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", "Is object a condition?\n"), #> "\n", list("internal"), "\n"), is_copyable.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_copyable"), "\n", list("is_copyable"), #> "\n", list("Is an object copyable?"), "\n", list( #> "\n", "is_copyable(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", "When an object is modified, R generally copies it (sometimes\n", #> "lazily) to enforce ", list(list("https://en.wikipedia.org/wiki/Value_semantics"), #> list("value semantics")), ".\n", "However, some internal types are uncopyable. If you try to copy\n", #> "them, either with ", list("<-"), " or by argument passing, you actually create\n", #> "references to the original object rather than actual\n", #> "copies. Modifying these references can thus have far reaching side\n", #> "effects.\n"), "\n", list("\n", "# Let's add attributes with structure() to uncopyable types. Since\n", #> "# they are not copied, the attributes are changed in place:\n", #> "env <- env()\n", "structure(env, foo = \"bar\")\n", #> "env\n", "\n", "# These objects that can only be changed with side effect are not\n", #> "# copyable:\n", "is_copyable(env)\n", "\n", #> "structure(base::list, foo = \"bar\")\n", "str(base::list)\n"), #> "\n", list("internal"), "\n"), is_empty.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_empty"), "\n", list("is_empty"), #> "\n", list("Is object an empty vector or NULL?"), #> "\n", list("\n", "is_empty(x)\n"), "\n", list( #> "\n", list(list("x"), list("object to test")), #> "\n"), "\n", list("\n", "Is object an empty vector or NULL?\n"), #> "\n", list("\n", "is_empty(NULL)\n", "is_empty(list())\n", #> "is_empty(list(NULL))\n"), "\n"), is_env.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("is_env"), "\n", list("is_env"), "\n", #> list("is_bare_env"), "\n", list("Is an object an environment?"), #> "\n", list("\n", "is_env(x)\n", "\n", "is_bare_env(x)\n"), #> "\n", list("\n", list(list("x"), list("object to test")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions were deprecated and renamed to ", #> list(list("is_environment()")), "\n", "and ", #> list(list("is_bare_environment()")), " in rlang 0.2.0. This is for consistency\n", #> "with other type predicates which are not abbreviated.\n"), #> "\n", list("internal"), "\n"), is_environment.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_environment"), "\n", list("is_environment"), #> "\n", list("is_bare_environment"), "\n", list( #> "Is object an environment?"), "\n", list("\n", #> "is_environment(x)\n", "\n", "is_bare_environment(x)\n"), #> "\n", list("\n", list(list("x"), list("object to test")), #> "\n"), "\n", list("\n", list("is_bare_environment()"), #> " tests whether ", list("x"), " is an environment without a s3 or\n", #> "s4 class.\n"), "\n"), is_expr.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("is_expr"), "\n", list("is_expr"), #> "\n", list("Is an object an expression?"), "\n", #> list("\n", "is_expr(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "This function was deprecated and renamed to ", #> list(list("is_expression()")), " in\n", "rlang 0.2.0. This is for consistency with other type predicates\n", #> "which are not abbreviated.\n"), "\n", list( #> "internal"), "\n"), is_expression.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/expr.R", #> "\n", list("is_expression"), "\n", list("is_expression"), #> "\n", list("is_syntactic_literal"), "\n", list( #> "is_symbolic"), "\n", list("Is an object an expression?"), #> "\n", list("\n", "is_expression(x)\n", "\n", #> "is_syntactic_literal(x)\n", "\n", "is_symbolic(x)\n"), #> "\n", list("\n", list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", list("is_expression()"), #> " tests for expressions, the set of objects that can be\n", #> "obtained from parsing R code. An expression can be one of two\n", #> "things: either a symbolic object (for which ", #> list("is_symbolic()"), " returns\n", list("TRUE"), #> "), or a syntactic literal (testable with\n", #> list("is_syntactic_literal()"), "). Technically, calls can contain any R\n", #> "object, not necessarily symbolic objects or syntactic\n", #> "literals. However, this only happens in artificial\n", #> "situations. Expressions as we define them only contain numbers,\n", #> "strings, ", list("NULL"), ", symbols, and calls: this is the complete set of R\n", #> "objects that can be created when R parses source code (e.g. from\n", #> "using ", list(list("parse_expr()")), ").\n", #> "\n", "Note that we are using the term expression in its colloquial sense\n", #> "and not to refer to ", list(list("expression()")), #> " vectors, a data type that wraps\n", "expressions in a vector and which isn't used much in modern R code.\n"), #> "\n", list("\n", list("is_symbolic()"), " returns ", #> list("TRUE"), " for symbols and calls (objects with\n", #> "type ", list("language"), "). Symbolic objects are replaced by their value\n", #> "during evaluation. Literals are the complement of symbolic\n", #> "objects. They are their own value and return themselves during\n", #> "evaluation.\n", "\n", list("is_syntactic_literal()"), #> " is a predicate that returns ", list("TRUE"), #> " for the\n", "subset of literals that are created by R when parsing text (see\n", #> list(list("parse_expr()")), "): numbers, strings and ", #> list("NULL"), ". Along with symbols,\n", "these literals are the terminating nodes in an AST.\n", #> "\n", "Note that in the most general sense, a literal is any R object that\n", #> "evaluates to itself and that can be evaluated in the empty\n", #> "environment. For instance, ", list("quote(c(1, 2))"), #> " is not a literal, it is\n", "a call. However, the result of evaluating it in ", #> list(list("base_env()")), " is a\n", "literal(in this case an atomic vector).\n", #> "\n", "Pairlists are also a kind of language objects. However, since they\n", #> "are mostly an internal data structure, ", #> list("is_expression()"), " returns ", list( #> "FALSE"), "\n", "for pairlists. You can use ", #> list("is_pairlist()"), " to explicitly check for\n", #> "them. Pairlists are the data structure for function arguments. They\n", #> "usually do not arise from R code because subsetting a call is a\n", #> "type-preserving operation. However, you can obtain the pairlist of\n", #> "arguments by taking the CDR of the call object from C code. The\n", #> "rlang function ", list(list("node_cdr()")), #> " will do it from R. Another way in\n", "which pairlist of arguments arise is by extracting the argument\n", #> "list of a closure with ", list(list("base::formals()")), #> " or ", list(list("fn_fmls()")), ".\n"), "\n", #> list("\n", "q1 <- quote(1)\n", "is_expression(q1)\n", #> "is_syntactic_literal(q1)\n", "\n", "q2 <- quote(x)\n", #> "is_expression(q2)\n", "is_symbol(q2)\n", "\n", #> "q3 <- quote(x + 1)\n", "is_expression(q3)\n", #> "is_call(q3)\n", "\n", "\n", "# Atomic expressions are the terminating nodes of a call tree:\n", #> "# NULL or a scalar atomic vector:\n", "is_syntactic_literal(\"string\")\n", #> "is_syntactic_literal(NULL)\n", "\n", "is_syntactic_literal(letters)\n", #> "is_syntactic_literal(quote(call()))\n", "\n", #> "# Parsable literals have the property of being self-quoting:\n", #> "identical(\"foo\", quote(\"foo\"))\n", "identical(1L, quote(1L))\n", #> "identical(NULL, quote(NULL))\n", "\n", "# Like any literals, they can be evaluated within the empty\n", #> "# environment:\n", "eval_bare(quote(1L), empty_env())\n", #> "\n", "# Whereas it would fail for symbolic expressions:\n", #> "# eval_bare(quote(c(1L, 2L)), empty_env())\n", #> "\n", "\n", "# Pairlists are also language objects representing argument lists.\n", #> "# You will usually encounter them with extracted formals:\n", #> "fmls <- formals(is_expression)\n", "typeof(fmls)\n", #> "\n", "# Since they are mostly an internal data structure, is_expression()\n", #> "# returns FALSE for pairlists, so you will have to check explicitly\n", #> "# for them:\n", "is_expression(fmls)\n", "is_pairlist(fmls)\n"), #> "\n", list("\n", list(list("is_call()")), " for a call predicate.\n"), #> "\n"), is_formula.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/formula.R", #> "\n", list("is_formula"), "\n", list("is_formula"), #> "\n", list("is_bare_formula"), "\n", list("Is object a formula?"), #> "\n", list("\n", "is_formula(x, scoped = NULL, lhs = NULL)\n", #> "\n", "is_bare_formula(x, scoped = NULL, lhs = NULL)\n"), #> "\n", list("\n", list(list("x"), list("An object to test.")), #> "\n", "\n", list(list("scoped"), list("A boolean indicating whether the quosure is scoped,\n", #> "that is, has a valid environment attribute. If ", #> list("NULL"), ", the scope\n", "is not inspected.")), #> "\n", "\n", list(list("lhs"), list("A boolean indicating whether the ", #> list("formula"), "\n", "or ", list("definition"), #> " has a left-hand side. If ", list("NULL"), #> ",\n", "the LHS is not inspected.")), "\n"), #> "\n", list("\n", list("is_formula()"), " tests if ", #> list("x"), " is a call to ", list("~"), ". ", #> list("is_bare_formula()"), "\n", "tests in addition that ", #> list("x"), " does not inherit from anything else than\n", #> list("\"formula\""), ".\n"), "\n", list("\n", #> "The ", list("scoped"), " argument patterns-match on whether the scoped bundled\n", #> "with the quosure is valid or not. Invalid scopes may happen in\n", #> "nested quotations like ", list("~~expr"), #> ", where the outer quosure is validly\n", "scoped but not the inner one. This is because ", #> list("~"), " saves the\n", "environment when it is evaluated, and quoted formulas are by\n", #> "definition not evaluated.\n"), "\n", list( #> "\n", "x <- disp ~ am\n", "is_formula(x)\n", #> "\n", "is_formula(~10)\n", "is_formula(10)\n", #> "\n", "is_formula(quo(foo))\n", "is_bare_formula(quo(foo))\n", #> "\n", "# Note that unevaluated formulas are treated as bare formulas even\n", #> "# though they don't inherit from \"formula\":\n", #> "f <- quote(~foo)\n", "is_bare_formula(f)\n", #> "\n", "# However you can specify `scoped` if you need the predicate to\n", #> "# return FALSE for these unevaluated formulas:\n", #> "is_bare_formula(f, scoped = TRUE)\n", "is_bare_formula(eval(f), scoped = TRUE)\n"), #> "\n"), is_frame.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("is_frame"), "\n", list("is_frame"), #> "\n", list("Is object a frame?"), "\n", list( #> "\n", "is_frame(x)\n"), "\n", list("\n", list( #> list("x"), list("Object to test")), "\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n"), "\n", list("internal"), "\n"), is_function.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("is_function"), "\n", list("is_function"), #> "\n", list("is_closure"), "\n", list("is_primitive"), #> "\n", list("is_primitive_eager"), "\n", list( #> "is_primitive_lazy"), "\n", list("Is object a function?"), #> "\n", list("\n", "is_function(x)\n", "\n", "is_closure(x)\n", #> "\n", "is_primitive(x)\n", "\n", "is_primitive_eager(x)\n", #> "\n", "is_primitive_lazy(x)\n"), "\n", list( #> "\n", list(list("x"), list("Object to be tested.")), #> "\n"), "\n", list("\n", "The R language defines two different types of functions: primitive\n", #> "functions, which are low-level, and closures, which are the regular\n", #> "kind of functions.\n"), "\n", list("\n", "Closures are functions written in R, named after the way their\n", #> "arguments are scoped within nested environments (see\n", #> list("https://en.wikipedia.org/wiki/Closure_(computer_programming)"), #> "). The\n", "root environment of the closure is called the closure\n", #> "environment. When closures are evaluated, a new environment called\n", #> "the evaluation frame is created with the closure environment as\n", #> "parent. This is where the body of the closure is evaluated. These\n", #> "closure frames appear on the evaluation stack (see ", #> list(list("ctxt_stack()")), "),\n", "as opposed to primitive functions which do not necessarily have\n", #> "their own evaluation frame and never appear on the stack.\n", #> "\n", "Primitive functions are more efficient than closures for two\n", #> "reasons. First, they are written entirely in fast low-level\n", #> "code. Second, the mechanism by which they are passed arguments is\n", #> "more efficient because they often do not need the full procedure of\n", #> "argument matching (dealing with positional versus named arguments,\n", #> "partial matching, etc). One practical consequence of the special\n", #> "way in which primitives are passed arguments is that they\n", #> "technically do not have formal arguments, and ", #> list(list("formals()")), " will\n", "return ", #> list("NULL"), " if called on a primitive function. Finally, primitive\n", #> "functions can either take arguments lazily, like R closures do,\n", #> "or evaluate them eagerly before being passed on to the C code.\n", #> "The former kind of primitives are called \"special\" in R terminology,\n", #> "while the latter is referred to as \"builtin\". ", #> list("is_primitive_eager()"), "\n", "and ", #> list("is_primitive_lazy()"), " allow you to check whether a primitive\n", #> "function evaluates arguments eagerly or lazily.\n", #> "\n", "You will also encounter the distinction between primitive and\n", #> "internal functions in technical documentation. Like primitive\n", #> "functions, internal functions are defined at a low level and\n", #> "written in C. However, internal functions have no representation in\n", #> "the R language. Instead, they are called via a call to\n", #> list(list("base::.Internal()")), " within a regular closure. This ensures that\n", #> "they appear as normal R function objects: they obey all the usual\n", #> "rules of argument passing, and they appear on the evaluation stack\n", #> "as any other closures. As a result, ", list( #> list("fn_fmls()")), " does not need to\n", #> "look in the ", list(".ArgsEnv"), " environment to obtain a representation of\n", #> "their arguments, and there is no way of querying from R whether\n", #> "they are lazy ('special' in R terminology) or eager ('builtin').\n", #> "\n", "You can call primitive functions with ", #> list(list(".Primitive()")), " and internal\n", #> "functions with ", list(list(".Internal()")), #> ". However, calling internal functions\n", #> "in a package is forbidden by CRAN's policy because they are\n", #> "considered part of the private API. They often assume that they\n", #> "have been called with correctly formed arguments, and may cause R\n", #> "to crash if you call them with unexpected objects.\n"), #> "\n", list("\n", "# Primitive functions are not closures:\n", #> "is_closure(base::c)\n", "is_primitive(base::c)\n", #> "\n", "# On the other hand, internal functions are wrapped in a closure\n", #> "# and appear as such from the R side:\n", #> "is_closure(base::eval)\n", "\n", "# Both closures and primitives are functions:\n", #> "is_function(base::c)\n", "is_function(base::eval)\n", #> "\n", "# Primitive functions never appear in evaluation stacks:\n", #> "is_primitive(base::`[[`)\n", "is_primitive(base::list)\n", #> "list(ctxt_stack())[[1]]\n", "\n", "# While closures do:\n", #> "identity(identity(ctxt_stack()))\n", "\n", #> "# Many primitive functions evaluate arguments eagerly:\n", #> "is_primitive_eager(base::c)\n", "is_primitive_eager(base::list)\n", #> "is_primitive_eager(base::`+`)\n", "\n", "# However, primitives that operate on expressions, like quote() or\n", #> "# substitute(), are lazy:\n", "is_primitive_lazy(base::quote)\n", #> "is_primitive_lazy(base::substitute)\n"), "\n"), #> is_installed.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("is_installed"), "\n", list("is_installed"), #> "\n", list("check_installed"), "\n", list("Are packages installed in any of the libraries?"), #> "\n", list("\n", "is_installed(pkg)\n", "\n", #> "check_installed(pkg, reason = NULL)\n"), "\n", #> list("\n", list(list("pkg"), list("The package names.")), #> "\n", "\n", list(list("reason"), list("Optional string indicating why is ", #> list("pkg"), " needed.\n", "Appears in error messages (if non-interactive) and user prompts\n", #> "(if interactive).")), "\n"), "\n", list( #> "\n", list("is_installed()"), " returns ", #> list("TRUE"), " if ", list("all"), " package names\n", #> "provided in ", list("pkg"), " are installed, ", #> list("FALSE"), "\n", "otherwise. ", list("check_installed()"), #> " either doesn't return or returns\n", list( #> "NULL"), ".\n"), "\n", list("\n", "These functions check that packages are installed with minimal side\n", #> "effects. If installed, the packages will be loaded but not\n", #> "attached.\n", list("\n", list(), " ", list( #> "is_installed()"), " doesn't interact with the user. It simply\n", #> "returns ", list("TRUE"), " or ", list("FALSE"), #> " depending on whether the packages are\n", #> "installed.\n", list(), " In interactive sessions, ", #> list("check_installed()"), " asks the user\n", #> "whether to install missing packages. If the user accepts, the\n", #> "packages are installed with ", list("pak::pkg_install()"), #> " if available, or\n", list(list("utils::install.packages()")), #> " otherwise. If the session is non\n", "interactive or if the user chooses not to install the packages,\n", #> "the current evaluation is aborted.\n"), #> "\n"), "\n", list("\n", "is_installed(\"utils\")\n", #> "is_installed(c(\"base\", \"ggplot5\"))\n"), #> "\n"), is_integerish.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_integerish"), "\n", list("is_integerish"), #> "\n", list("is_bare_integerish"), "\n", list( #> "is_scalar_integerish"), "\n", list("Is a vector integer-like?"), #> "\n", list("\n", "is_integerish(x, n = NULL, finite = NULL)\n", #> "\n", "is_bare_integerish(x, n = NULL, finite = NULL)\n", #> "\n", "is_scalar_integerish(x, finite = NULL)\n"), #> "\n", list("\n", list(list("x"), list("Object to be tested.")), #> "\n", "\n", list(list("n"), list("Expected length of a vector.")), #> "\n", "\n", list(list("finite"), list("Whether all values of the vector are finite. The\n", #> "non-finite values are ", list("NA"), ", ", #> list("Inf"), ", ", list("-Inf"), " and ", #> list("NaN"), ". Setting this\n", "to something other than ", #> list("NULL"), " can be expensive because the whole\n", #> "vector needs to be traversed and checked.")), #> "\n"), "\n", list("\n", "These predicates check whether R considers a number vector to be\n", #> "integer-like, according to its own tolerance check (which is in\n", #> "fact delegated to the C library). This function is not adapted to\n", #> "data analysis, see the help for ", list(list( #> "base::is.integer()")), " for examples\n", #> "of how to check for whole numbers.\n", "\n", #> "Things to consider when checking for integer-like doubles:\n", #> list("\n", list(), " This check can be expensive because the whole double vector has\n", #> "to be traversed and checked.\n", list(), #> " Large double values may be integerish but may still not be\n", #> "coercible to integer. This is because integers in R only support\n", #> "values up to ", list("2^31 - 1"), " while numbers stored as double can be\n", #> "much larger.\n"), "\n"), "\n", list("\n", #> "is_integerish(10L)\n", "is_integerish(10.0)\n", #> "is_integerish(10.0, n = 2)\n", "is_integerish(10.000001)\n", #> "is_integerish(TRUE)\n"), "\n", list("\n", #> list(list("is_bare_numeric()")), " for testing whether an object is a\n", #> "base numeric type (a bare double or integer vector).\n"), #> "\n"), is_interactive.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/state.R", #> "\n", list("is_interactive"), "\n", list("is_interactive"), #> "\n", list("local_interactive"), "\n", list("with_interactive"), #> "\n", list("Is R running interactively?"), "\n", #> list("\n", "is_interactive()\n", "\n", "local_interactive(value = TRUE, frame = caller_env())\n", #> "\n", "with_interactive(expr, value = TRUE)\n"), #> "\n", list("\n", list(list("value"), list("A single ", #> list("TRUE"), " or ", list("FALSE"), ". This overrides the return\n", #> "value of ", list("is_interactive()"), ".")), #> "\n", "\n", list(list("frame"), list("The environment of a running function which defines\n", #> "the scope of the temporary options. When the function returns,\n", #> "the options are reset to their original values.")), #> "\n", "\n", list(list("expr"), list("An expression to evaluate with interactivity set to\n", #> list("value"), ".")), "\n"), "\n", list("\n", #> "Like ", list(list("base::interactive()")), #> ", ", list("is_interactive()"), " returns ", #> list("TRUE"), " when\n", "the function runs interactively and ", #> list("FALSE"), " when it runs in batch\n", #> "mode. It also checks, in this order:\n", list( #> "\n", list(), " The ", list("rlang_interactive"), #> " global option. If set to a single ", list( #> "TRUE"), "\n", "or ", list("FALSE"), ", ", #> list("is_interactive()"), " returns that value immediately. This\n", #> "escape hatch is useful in unit tests or to manually turn on\n", #> "interactive features in RMarkdown outputs.\n", #> list(), " Whether knitr or testthat is in progress, in which case\n", #> list("is_interactive()"), " returns ", list( #> "FALSE"), ".\n"), "\n", "\n", list("with_interactive()"), #> " and ", list("local_interactive()"), " set the global\n", #> "option conveniently.\n"), "\n"), is_lang.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("is_lang"), "\n", list("is_lang"), #> "\n", list("is_unary_lang"), "\n", list("is_binary_lang"), #> "\n", list("quo_is_lang"), "\n", list("Is object a call?"), #> "\n", list("\n", "is_lang(x, name = NULL, n = NULL, ns = NULL)\n", #> "\n", "is_unary_lang(x, name = NULL, ns = NULL)\n", #> "\n", "is_binary_lang(x, name = NULL, ns = NULL)\n", #> "\n", "quo_is_lang(quo)\n"), "\n", list("\n", #> list(list("x"), list("An object to test. If a formula, the right-hand side is\n", #> "extracted.")), "\n", "\n", list(list("name"), #> list("An optional name that the call should match. It is\n", #> "passed to ", list(list("sym()")), " before matching. This argument is vectorised\n", #> "and you can supply a vector of names to match. In this case,\n", #> list("is_call()"), " returns ", list("TRUE"), #> " if at least one name matches.")), "\n", #> "\n", list(list("n"), list("An optional number of arguments that the call should\n", #> "match.")), "\n", "\n", list(list("ns"), #> list("The namespace of the call. If ", list( #> "NULL"), ", the namespace\n", "doesn't participate in the pattern-matching. If an empty string\n", #> list("\"\""), " and ", list("x"), " is a namespaced call, ", #> list("is_call()"), " returns\n", list("FALSE"), #> ". If any other string, ", list("is_call()"), #> " checks that ", list("x"), " is\n", "namespaced within ", #> list("ns"), ".\n", "\n", "Can be a character vector of namespaces, in which case the call\n", #> "has to match at least one of them, otherwise ", #> list("is_call()"), " returns\n", list("FALSE"), #> ".")), "\n", "\n", list(list("quo"), list( #> "A quosure to test.")), "\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions are deprecated, please use ", #> list(list("is_call()")), " and its ", list( #> "n"), "\n", "argument instead.\n"), "\n", #> list("internal"), "\n"), is_named.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("is_named"), "\n", list("is_named"), #> "\n", list("is_dictionaryish"), "\n", list("have_name"), #> "\n", list("Is object named?"), "\n", list("\n", #> "is_named(x)\n", "\n", "is_dictionaryish(x)\n", #> "\n", "have_name(x)\n"), "\n", list("\n", list( #> list("x"), list("An object to test.")), "\n"), #> "\n", list("\n", list("is_named()"), " and ", #> list("is_dictionaryish()"), " are scalar predicates\n", #> "and return ", list("TRUE"), " or ", list("FALSE"), #> ". ", list("have_name()"), " is vectorised and\n", #> "returns a logical vector as long as the input.\n"), #> "\n", list("\n", list("is_named()"), " checks that ", #> list("x"), " has names attributes, and that none of\n", #> "the names are missing or empty (", list("NA"), #> " or ", list("\"\""), "). ", list("is_dictionaryish()"), #> "\n", "checks that an object is a dictionary: that it has actual names and\n", #> "in addition that there are no duplicated names. ", #> list("have_name()"), "\n", "is a vectorised version of ", #> list("is_named()"), ".\n"), "\n", list("\n", #> "# A data frame usually has valid, unique names\n", #> "is_named(mtcars)\n", "have_name(mtcars)\n", #> "is_dictionaryish(mtcars)\n", "\n", "# But data frames can also have duplicated columns:\n", #> "dups <- cbind(mtcars, cyl = seq_len(nrow(mtcars)))\n", #> "is_dictionaryish(dups)\n", "\n", "# The names are still valid:\n", #> "is_named(dups)\n", "have_name(dups)\n", "\n", #> "\n", "# For empty objects the semantics are slightly different.\n", #> "# is_dictionaryish() returns TRUE for empty objects:\n", #> "is_dictionaryish(list())\n", "\n", "# But is_named() will only return TRUE if there is a names\n", #> "# attribute (a zero-length character vector in this case):\n", #> "x <- set_names(list(), character(0))\n", "is_named(x)\n", #> "\n", "\n", "# Empty and missing names are invalid:\n", #> "invalid <- dups\n", "names(invalid)[2] <- \"\"\n", #> "names(invalid)[5] <- NA\n", "\n", "# is_named() performs a global check while have_name() can show you\n", #> "# where the problem is:\n", "is_named(invalid)\n", #> "have_name(invalid)\n", "\n", "# have_name() will work even with vectors that don't have a names\n", #> "# attribute:\n", "have_name(letters)\n"), #> "\n"), is_namespace.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("is_namespace"), "\n", list("is_namespace"), #> "\n", list("Is an object a namespace environment?"), #> "\n", list("\n", "is_namespace(x)\n"), "\n", #> list("\n", list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", "Is an object a namespace environment?\n"), #> "\n"), is_pairlist.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/node.R", #> "\n", list("is_pairlist"), "\n", list("is_pairlist"), #> "\n", list("is_node"), "\n", list("is_node_list"), #> "\n", list("Is object a node or pairlist?"), #> "\n", list("\n", "is_pairlist(x)\n", "\n", "is_node(x)\n", #> "\n", "is_node_list(x)\n"), "\n", list("\n", #> list(list("x"), list("Object to test.")), "\n"), #> "\n", list("\n", list("\n", list(), " ", list( #> "is_pairlist()"), " checks that ", list("x"), #> " has type ", list("pairlist"), ".\n", list(), #> " ", list("is_node()"), " checks that ", list( #> "x"), " has type ", list("pairlist"), " or ", #> list("language"), ".\n", "It tests whether ", #> list("x"), " is a node that has a CAR and a CDR,\n", #> "including callable nodes (language objects).\n", #> list(), " ", list("is_node_list()"), " checks that ", #> list("x"), " has type ", list("pairlist"), #> " or ", list("NULL"), ".\n", list("NULL"), #> " is the empty node list.\n"), "\n"), "\n", #> list(list("Life cycle"), list("\n", "\n", "\n", #> "These functions are experimental. We are still figuring out a good\n", #> "naming convention to refer to the different lisp-like lists in R.\n")), #> "\n", "\n", list("\n", list(list("is_call()")), #> " tests for language nodes.\n"), "\n", list( #> "internal"), "\n"), is_reference.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_reference"), "\n", list("is_reference"), #> "\n", list("Is an object referencing another?"), #> "\n", list("\n", "is_reference(x, y)\n"), "\n", #> list("\n", list(list("x, y"), list("R objects.")), #> "\n"), "\n", list("\n", "There are typically two situations where two symbols may refer to\n", #> "the same object.\n", list("\n", list(), " R objects usually have copy-on-write semantics. This is an\n", #> "optimisation that ensures that objects are only copied if\n", #> "needed. When you copy a vector, no memory is actually copied\n", #> "until you modify either the original object or the copy is\n", #> "modified.\n", "\n", "Note that the copy-on-write optimisation is an implementation\n", #> "detail that is not guaranteed by the specification of the R\n", #> "language.\n", list(), " Assigning an ", #> list("uncopyable"), " object (like an\n", #> "environment) creates a reference. These objects are never copied\n", #> "even if you modify one of the references.\n"), #> "\n"), "\n", list("\n", "# Reassigning an uncopyable object such as an environment creates a\n", #> "# reference:\n", "env <- env()\n", "ref <- env\n", #> "is_reference(ref, env)\n", "\n", "# Due to copy-on-write optimisation, a copied vector can\n", #> "# temporarily reference the original vector:\n", #> "vec <- 1:10\n", "copy <- vec\n", "is_reference(copy, vec)\n", #> "\n", "# Once you modify on of them, the copy is triggered in the\n", #> "# background and the objects cease to reference each other:\n", #> "vec[[1]] <- 100\n", "is_reference(copy, vec)\n"), #> "\n", list("internal"), "\n"), is_stack.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("is_stack"), "\n", list("is_stack"), #> "\n", list("is_eval_stack"), "\n", list("is_call_stack"), #> "\n", list("Is object a stack?"), "\n", list( #> "\n", "is_stack(x)\n", "\n", "is_eval_stack(x)\n", #> "\n", "is_call_stack(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n"), "\n", list("internal"), "\n"), is_symbol.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/sym.R", #> "\n", list("is_symbol"), "\n", list("is_symbol"), #> "\n", list("Is object a symbol?"), "\n", list( #> "\n", "is_symbol(x, name = NULL)\n"), "\n", #> list("\n", list(list("x"), list("An object to test.")), #> "\n", "\n", list(list("name"), list("An optional name or vector of names that the symbol\n", #> "should match.")), "\n"), "\n", list("\n", #> "Is object a symbol?\n"), "\n"), is_true.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("is_true"), "\n", list("is_true"), #> "\n", list("is_false"), "\n", list("Is object identical to TRUE or FALSE?"), #> "\n", list("\n", "is_true(x)\n", "\n", "is_false(x)\n"), #> "\n", list("\n", list(list("x"), list("object to test")), #> "\n"), "\n", list("\n", "These functions bypass R's automatic conversion rules and check\n", #> "that ", list("x"), " is literally ", list( #> "TRUE"), " or ", list("FALSE"), ".\n"), "\n", #> list("\n", "is_true(TRUE)\n", "is_true(1)\n", #> "\n", "is_false(FALSE)\n", "is_false(0)\n"), #> "\n"), is_weakref.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/weakref.R", #> "\n", list("is_weakref"), "\n", list("is_weakref"), #> "\n", list("Is object a weak reference?"), "\n", #> list("\n", "is_weakref(x)\n"), "\n", list("\n", #> list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", "Is object a weak reference?\n"), #> "\n"), lang.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("lang"), "\n", list("lang"), "\n", #> list("new_language"), "\n", list("Create a call"), #> "\n", list("\n", "lang(.fn, ..., .ns = NULL)\n", #> "\n", "new_language(head, tail = NULL)\n"), #> "\n", list("\n", list(list(".fn"), list("Function to call. Must be a callable object: a string,\n", #> "symbol, call, or a function.")), "\n", "\n", #> list(list("..."), list("<", list("dynamic"), #> "> Arguments for the function\n", "call. Empty arguments are preserved.")), #> "\n", "\n", list(list(".ns"), list("Namespace with which to prefix ", #> list(".fn"), ". Must be a string\n", "or symbol.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions are deprecated, please use ", #> list(list("call2()")), " and\n", list(list( #> "new_call()")), " instead.\n"), "\n", list( #> "internal"), "\n"), lang_head.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("lang_head"), "\n", list("lang_head"), #> "\n", list("lang_tail"), "\n", list("Return the head or tail of a call"), #> "\n", list("\n", "lang_head(lang)\n", "\n", "lang_tail(lang)\n"), #> "\n", list("\n", list(list("lang"), list("A call.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "As of rlang 0.2.0 these functions are retired (deprecated for now)\n", #> "because they are low level accessors that are rarely needed for end\n", #> "users.\n"), "\n", list("internal"), "\n"), #> lang_modify.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("lang_modify"), "\n", list("lang_modify"), #> "\n", list("lang_standardise"), "\n", list("lang_fn"), #> "\n", list("lang_name"), "\n", list("lang_args"), #> "\n", list("lang_args_names"), "\n", list("Manipulate or access a call"), #> "\n", list("\n", "lang_modify(.lang, ..., .standardise = FALSE)\n", #> "\n", "lang_standardise(lang)\n", "\n", "lang_fn(lang)\n", #> "\n", "lang_name(lang)\n", "\n", "lang_args(lang)\n", #> "\n", "lang_args_names(lang)\n"), "\n", list( #> "\n", list(list("..."), list("<", list("dynamic"), #> "> Named or unnamed expressions\n", "(constants, names or calls) used to modify the call. Use ", #> list(list("zap()")), "\n", "to remove arguments. Empty arguments are preserved.")), #> "\n", "\n", list(list(".standardise"), list( #> "Soft-deprecated as of rlang 0.3.0. Please\n", #> "call ", list(list("call_standardise()")), #> " manually.")), "\n", "\n", list(list("lang, .lang"), #> list("The ", list("call"), " or ", list(".call"), #> " argument of the renamed\n", "functions.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions are deprecated, please use ", #> list(list("call_modify()")), ",\n", list(list( #> "call_standardise()")), ", or ", list(list( #> "call_fn()")), " instead.\n"), "\n", list( #> "internal"), "\n"), last_error.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-abort.R", #> "\n", list("last_error"), "\n", list("last_error"), #> "\n", list("last_trace"), "\n", list("Last ", #> list("abort()"), " error"), "\n", list("\n", #> "last_error()\n", "\n", "last_trace()\n"), #> "\n", list("\n", list("\n", list(), " ", list( #> "last_error()"), " returns the last error thrown with ", #> list(list("abort()")), ". The\n", "error is printed with a backtrace in simplified form.\n", #> list(), " ", list("last_trace()"), " is a shortcut to return the backtrace stored in\n", #> "the last error. This backtrace is printed in full form.\n"), #> "\n"), "\n"), lifecycle.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle.R", #> "\n", list("lifecycle"), "\n", list("lifecycle"), #> "\n", list("Life cycle of the rlang package"), #> "\n", list("\n", list("rlang:::lifecycle(\"maturing\")"), #> "\n", "\n", "The rlang package is currently maturing. Unless otherwise stated,\n", #> "this applies to all its exported functions. Maturing functions are\n", #> "susceptible to API changes. Only use these in packages if you're\n", #> "prepared to make changes as the package evolves. See sections below\n", #> "for a list of functions marked as stable.\n", #> "\n", "The documentation pages of retired functions contain life cycle\n", #> "sections that explain the reasons for their retirements.\n"), #> "\n", list(list("Stable functions"), list("\n", #> "\n", "\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", list("\n", list(), " ", list(list("eval_tidy()")), #> "\n", list(), " ", list("!!"), ", ", list( #> "!!!"), "\n", list(), " ", list(list("enquo()")), #> ", ", list(list("quo()")), ", ", list(list( #> "quos()")), "\n", list(), " ", list(list( #> "enexpr()")), ", ", list(list("expr()")), #> ", ", list(list("exprs()")), "\n", list(), #> " ", list(list("sym()")), ", ", list(list( #> "syms()")), "\n", list(), " ", list(list( #> "new_quosure()")), ", ", list(list("is_quosure()")), #> "\n", list(), " ", list(list("missing_arg()")), #> ", ", list(list("is_missing()")), "\n", list(), #> " ", list(list("quo_get_expr()")), ", ", #> list(list("quo_set_expr()")), "\n", list(), #> " ", list(list("quo_get_env()")), ", ", list( #> list("quo_set_env()")), "\n", list(), " ", #> list(list("eval_bare()")), "\n", list(), #> " ", list(list("set_names()")), ", ", list( #> list("names2()")), "\n", list(), " ", list( #> list("as_function()")), ", ", list(list( #> "new_function()")), "\n"), "\n")), "\n", #> "\n", list(list("Experimental functions"), list( #> "\n", "\n", "\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "These functions are not yet part of the rlang API. Expect breaking\n", #> "changes.\n", list("\n", list(), " ", list( #> list("with_env()")), ", ", list(list("locally()")), #> ", ", list(list("env_poke()")), "\n", list(), #> " ", list(list("pkg_env()")), ", ", list( #> list("pkg_env_name()")), ", ", list(list( #> "ns_env()")), ", ", list(list("ns_imports_env()")), #> ", ", list(list("ns_env_name()")), "\n", #> list(), " ", list(list("is_pairlist()")), #> ", ", list(list("as_pairlist()")), ", ", #> list(list("is_node()")), ", ", list(list( #> "is_node_list()")), "\n", list(), " ", #> list(list("is_definition()")), ", ", list( #> list("new_definition()")), ", ", list(list( #> "is_formulaish()")), ",\n", list(list("dots_definitions()")), #> "\n", list(), " ", list(list("local_options()")), #> ", ", list(list("with_options()")), ", ", #> list(list("push_options()")), ",\n", list( #> list("peek_options()")), ", ", list(list( #> "peek_option()")), "\n", list(), " ", list( #> list("as_bytes()")), ", ", list(list("chr_unserialise_unicode()")), #> "\n", list(), " ", list(list("caller_fn()")), #> ", ", list(list("current_fn()")), "\n"), #> "\n")), "\n", "\n", list(list("Questioning stage"), #> list("\n", "\n", "\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", list("In the questioning stage as of rlang 0.4.0"), #> "\n", "\n", "These functions are likely to be moved to the vctrs package:\n", #> list("\n", list(), " ", list(list("lgl()")), #> ", ", list(list("int()")), ", etc.\n", #> list(), " ", list(list("new_logical()")), #> ", ", list(list("new_integer()")), ", etc.\n", #> list(), " ", list("na_lgl"), ", ", list( #> "na_int"), ", ", list(list("is_lgl_na()")), #> ", ", list(list("is_int_na()")), ", etc.\n"), #> "\n", "\n", list("In the questioning stage as of rlang 0.3.0"), #> "\n", list("\n", list(), " ", list(list("child_env()")), #> "\n", list(), " ", list(list("flatten()")), #> ", ", list(list("squash()")), ", and their atomic vector variants\n", #> list(), " ", list(list("modify()")), " and ", #> list(list("prepend()")), "\n", list(), #> " ", list(list("with_restarts()")), ", ", #> list(list("rst_list()")), ", ", list(list( #> "rst_exists()")), ", ", list(list("rst_jump()")), #> ",\n", list(list("rst_maybe_jump()")), #> ", ", list(list("rst_abort()")), ". It is not clear yet whether we\n", #> "want to recommend restarts as a style of programming in R.\n", #> list(), " ", list(list("return_from()")), #> " and ", list(list("return_to()")), ".\n", #> list(), " ", list(list("expr_label()")), #> ", ", list(list("expr_name()")), ", and ", #> list(list("expr_text()")), ".\n"), "\n", #> "\n", list("In the questioning stage as of rlang 0.2.0"), #> "\n", list("\n", list(), " ", list(list("UQ()")), #> ", ", list(list("UQS()")), "\n", list(), #> " ", list(list("dots_splice()")), ", ", #> list(list("splice()")), "\n"), "\n")), #> "\n", "\n", list(list("Soft-deprecated functions and arguments"), #> list("\n", "\n", "\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", "\n", list("Soft-deprecated in rlang 0.4.0"), #> "\n", list("\n", list(), " ", list(list("exiting()")), #> ": Handlers are now treated as exiting by default.\n", #> list(), " ", list(list("invoke()")), ": Use the simpler ", #> list(list("exec()")), " instead.\n", list(), #> " ", list(list("as_logical()")), ", ", #> list(list("as_integer()")), ", etc. => ", #> list("vctrs::vec_cast()"), ".\n", list(), #> " ", list(list("type_of()")), ", ", list( #> list("switch_type()")), ", ", list(list( #> "coerce_type()")), ", ", list(list("switch_class()")), #> ",\n", list(list("coerce_class()")), "\n"), #> "\n")), "\n", "\n", list(list("Deprecated functions and arguments"), #> list("\n", "\n", "\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", list("Bumped to deprecated in rlang 0.4.0"), #> "\n", list("\n", list(), " ", list(list("modify()")), #> " and ", list(list("prepend()")), ".\n", #> list(), " ", list("new_logical_along()"), #> ", ", list("new_integer_along()"), ",\n", #> list("new_double_along()"), ", ", list( #> "new_complex_along()"), ",\n", list("new_character_along()"), #> ", ", list("new_raw_along()"), ", ", list( #> "new_list_along()"), ".\n", list(), " ", #> list(list("lang_modify()")), " => ", list( #> list("call_modify()")), "\n", list(), #> " ", list(list("lang_standardise()")), #> " => ", list(list("call_standardise()")), #> "\n", list(), " ", list(list("lang_fn()")), #> " => ", list(list("call_fn()")), "\n", #> list(), " ", list(list("lang_name()")), #> " => ", list(list("call_name()")), "\n", #> list(), " ", list(list("lang_args()")), #> " => ", list(list("call_args()")), "\n", #> list(), " ", list(list("lang_args_names()")), #> " => ", list(list("call_args_names()")), #> "\n", list(), " ", list(list("lang_head()")), #> ", ", list(list("lang_tail()")), "\n", #> list(), " ", list(list("lang()")), " => ", #> list(list("call2()")), "\n", list(), " ", #> list(list("new_language()")), " => ", list( #> list("new_call()")), "\n", list(), " ", #> list(list("is_lang()")), " => ", list(list( #> "is_call()")), "\n", list(), " ", list( #> list("is_unary_lang()")), " => Use the ", #> list("n"), " argument of ", list(list("is_call()")), #> "\n", list(), " ", list(list("is_binary_lang()")), #> " => Use the ", list("n"), " argument of ", #> list(list("is_call()")), "\n", list(), #> " ", list(list("quo_is_lang()")), " => ", #> list(list("quo_is_call()")), "\n", list(), #> " ", list(list("call_modify()")), ": ", #> list(".standardise"), " and ", list(".env"), #> " arguments.\n", list(), " ", list(list( #> "is_expr()")), " => ", list(list("is_expression()")), #> "\n", list(), " ", list("quo_expr()"), #> " => ", list(list("quo_squash()")), "\n", #> list(), " ", list(list("parse_quosure()")), #> " => ", list(list("parse_quo()")), "\n", #> list(), " ", list(list("parse_quosures()")), #> " => ", list(list("parse_quos()")), "\n", #> list(), " Assigning non-quosure objects to quosure lists.\n", #> list(), " ", list("as.character()"), " on quosures.\n", #> list(), " ", list(list("cnd_signal()")), #> ": ", list(".cnd"), " => ", list("cnd"), #> "\n", list(), " ", list(list("cnd_signal()")), #> ": The ", list(".mufflable"), " argument no longer has any effect\n", #> list(), " ", list("scoped_names()"), " => ", #> list(list("base::search()")), "\n", list(), #> " ", list("is_scoped()"), " => ", list( #> list("is_attached()")), "\n", list(), #> " ", list("scoped_env()"), " => ", list( #> list("search_env()")), "\n", list(), #> " ", list("scoped_envs()"), " => ", list( #> list("search_envs()")), "\n", list(), #> " ", list("env_bind_exprs()"), " => ", #> list(list("env_bind_lazy()")), "\n", list(), #> " ", list("env_bind_fns()"), " => ", list( #> list("env_bind_active()")), "\n", list(), #> " Passing a function or formula to ", list( #> "env_depth()"), ",\n", list("env_poke_parent()"), #> ", ", list("env_parent<-"), ", ", list( #> "env_tail()"), ", ", list("set_env()"), #> ",\n", list("env_clone()"), ", ", list( #> "env_inherits()"), ", ", list("env_bind()"), #> ",\n", list("local_bindings()"), ", ", #> list("with_bindings()"), ", ", list("env_poke()"), #> ",\n", list("env_has()"), ", ", list("env_get()"), #> ", ", list("env_names()"), ", ", list("env_bind_exprs()"), #> " and\n", list("env_bind_fns()"), ". This internal genericity was causing confusion\n", #> "(see issue #427). You should now extract the environment\n", #> "separately before calling these functions.\n", #> list(), " ", list(list("get_env()")), ": The ", #> list("env"), " argument no longer has a default and must be supplied\n", #> list(), " ", list(list("is_frame()")), #> ", ", list(list("global_frame()")), ", ", #> list(list("current_frame()")), ",\n", list( #> list("ctxt_frame()")), ", ", list(list( #> "call_frame()")), ", ", list(list("frame_position()")), #> ",\n", list(list("caller_frame()")), "\n", #> list(), " ", list(list("ctxt_depth()")), #> ", ", list(list("call_depth()")), ", ", #> list(list("ctxt_stack()")), ", ", list( #> list("call_stack()")), ",\n", list(list( #> "stack_trim()")), "\n", list(), " ", #> list(list("set_attrs()")), ", ", list(list( #> "mut_attrs()")), "\n", list(), " The ", #> list("width"), " and ", list("printer"), #> " arguments of ", list(list("exprs_auto_name()")), #> " and\n", list(list("quos_auto_name()")), #> " no longer have any effect. For the same\n", #> "reason, passing a width as ", list(".named"), #> " argument of dots collectors\n", "like ", #> list("quos()"), " is deprecated.\n", list(), #> " ", list("as_overscope()"), " => ", list( #> list("as_data_mask()")), "\n", list(), #> " ", list("new_overscope()"), " => ", list( #> list("new_data_mask()")), "\n", list(), #> " ", list("overscope_eval_next()"), " => ", #> list(list("eval_tidy()")), "\n", list(), #> " ", list("overscope_clean()"), "\n"), #> "\n")), "\n", "\n", list(list("Defunct functions and arguments"), #> list("\n", "\n", "\n", list("rlang:::lifecycle(\"defunct\")"), #> "\n", "\n", list("Defunct as of rlang 0.4.0"), #> "\n", list("\n", list(), " ", list("length()"), #> " and ", list("names()"), " on tidy eval ", #> list(".data"), " pronouns.\n", list(), #> " Supplying a named ", list("!!!"), " call.\n"), #> "\n")), "\n", "\n", list("internal"), "\n"), #> list2.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("list2"), "\n", list("list2"), "\n", #> list("ll"), "\n", list("dots_list"), "\n", list( #> "Collect dots in a list"), "\n", list("\n", #> "list2(...)\n", "\n", "dots_list(\n", " ...,\n", #> " .named = FALSE,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .preserve_empty = FALSE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n"), "\n", #> list("\n", list(list("..."), list("Arguments to collect in a list. These dots are\n", #> list("dynamic"), ".")), "\n", "\n", list(list( #> ".named"), list("Whether to ensure all dots are named. Unnamed\n", #> "elements are processed with ", list(list("as_label()")), #> " to build a default\n", "name.")), "\n", "\n", #> list(list(".ignore_empty"), list("Whether to ignore empty arguments. Can be one\n", #> "of ", list("\"trailing\""), ", ", list("\"none\""), #> ", ", list("\"all\""), ". If ", list("\"trailing\""), #> ", only the\n", "last argument is ignored if it is empty.")), #> "\n", "\n", list(list(".preserve_empty"), list( #> "Whether to preserve the empty arguments that\n", #> "were not ignored. If ", list("TRUE"), ", empty arguments are stored with\n", #> list(list("missing_arg()")), " values. If ", #> list("FALSE"), " (the default) an error is\n", #> "thrown when an empty argument is detected.")), #> "\n", "\n", list(list(".homonyms"), list("How to treat arguments with the same name. The\n", #> "default, ", list("\"keep\""), ", preserves these arguments. Set ", #> list(".homonyms"), " to\n", list("\"first\""), #> " to only keep the first occurrences, to ", #> list("\"last\""), " to keep\n", "the last occurrences, and to ", #> list("\"error\""), " to raise an informative\n", #> "error and indicate what arguments have duplicated names.")), #> "\n", "\n", list(list(".check_assign"), list( #> "Whether to check for ", list("<-"), " calls passed in\n", #> "dots. When ", list("TRUE"), " and a ", list( #> "<-"), " call is detected, a warning is\n", #> "issued to advise users to use ", list("="), #> " if they meant to match a\n", "function parameter, or wrap the ", #> list("<-"), " call in braces otherwise.\n", #> "This ensures assignments are explicit.")), #> "\n"), "\n", list("\n", "A list containing the ", #> list("..."), " inputs.\n"), "\n", list("\n", #> list("list2(...)"), " is equivalent to ", list( #> "list(...)"), " with a few additional\n", #> "features, collectively called ", list("dynamic dots"), #> ". While\n", list("list2()"), " hard-code these features, ", #> list("dots_list()"), " is a lower-level\n", #> "version that offers more control.\n"), "\n", #> list("\n", "# Let's create a function that takes a variable number of arguments:\n", #> "numeric <- function(...) {\n", " dots <- list2(...)\n", #> " num <- as.numeric(dots)\n", " set_names(num, names(dots))\n", #> "}\n", "numeric(1, 2, 3)\n", "\n", "# The main difference with list(...) is that list2(...) enables\n", #> "# the `!!!` syntax to splice lists:\n", "x <- list(2, 3)\n", #> "numeric(1, !!! x, 4)\n", "\n", "# As well as unquoting of names:\n", #> "nm <- \"yup!\"\n", "numeric(!!nm := 1)\n", #> "\n", "\n", "# One useful application of splicing is to work around exact and\n", #> "# partial matching of arguments. Let's create a function taking\n", #> "# named arguments and dots:\n", "fn <- function(data, ...) {\n", #> " list2(...)\n", "}\n", "\n", "# You normally cannot pass an argument named `data` through the dots\n", #> "# as it will match `fn`'s `data` argument. The splicing syntax\n", #> "# provides a workaround:\n", "fn(\"wrong!\", data = letters) # exact matching of `data`\n", #> "fn(\"wrong!\", dat = letters) # partial matching of `data`\n", #> "fn(some_data, !!!list(data = letters)) # no matching\n", #> "\n", "\n", "# Empty arguments trigger an error by default:\n", #> "try(fn(, ))\n", "\n", "# You can choose to preserve empty arguments instead:\n", #> "list3 <- function(...) dots_list(..., .preserve_empty = TRUE)\n", #> "\n", "# Note how the last empty argument is still ignored because\n", #> "# `.ignore_empty` defaults to \"trailing\":\n", #> "list3(, )\n", "\n", "# The list with preserved empty arguments is equivalent to:\n", #> "list(missing_arg())\n", "\n", "\n", "# Arguments with duplicated names are kept by default:\n", #> "list2(a = 1, a = 2, b = 3, b = 4, 5, 6)\n", #> "\n", "# Use the `.homonyms` argument to keep only the first of these:\n", #> "dots_list(a = 1, a = 2, b = 3, b = 4, 5, 6, .homonyms = \"first\")\n", #> "\n", "# Or the last:\n", "dots_list(a = 1, a = 2, b = 3, b = 4, 5, 6, .homonyms = \"last\")\n", #> "\n", "# Or raise an informative error:\n", #> "try(dots_list(a = 1, a = 2, b = 3, b = 4, 5, 6, .homonyms = \"error\"))\n", #> "\n", "\n", "# dots_list() can be configured to warn when a `<-` call is\n", #> "# detected:\n", "my_list <- function(...) dots_list(..., .check_assign = TRUE)\n", #> "my_list(a <- 1)\n", "\n", "# There is no warning if the assignment is wrapped in braces.\n", #> "# This requires users to be explicit about their intent:\n", #> "my_list({ a <- 1 })\n"), "\n"), local_bindings.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-binding.R", #> "\n", list("local_bindings"), "\n", list("local_bindings"), #> "\n", list("with_bindings"), "\n", list("Temporarily change bindings of an environment"), #> "\n", list("\n", "local_bindings(..., .env = .frame, .frame = caller_env())\n", #> "\n", "with_bindings(.expr, ..., .env = caller_env())\n"), #> "\n", list("\n", list(list("..."), list("Pairs of names and values. These dots support splicing\n", #> "(with value semantics) and name unquoting.")), #> "\n", "\n", list(list(".env"), list("An environment.")), #> "\n", "\n", list(list(".frame"), list("The frame environment that determines the scope of\n", #> "the temporary bindings. When that frame is popped from the call\n", #> "stack, bindings are switched back to their original values.")), #> "\n", "\n", list(list(".expr"), list("An expression to evaluate with temporary bindings.")), #> "\n"), "\n", list("\n", list("local_bindings()"), #> " returns the values of old bindings\n", "invisibly; ", #> list("with_bindings()"), " returns the value of ", #> list("expr"), ".\n"), "\n", list("\n", list( #> "\n", list(), " ", list("local_bindings()"), #> " temporarily changes bindings in ", list(".env"), #> " (which\n", "is by default the caller environment). The bindings are reset to\n", #> "their original values when the current frame (or an arbitrary one\n", #> "if you specify ", list(".frame"), ") goes out of scope.\n", #> list(), " ", list("with_bindings()"), " evaluates ", #> list("expr"), " with temporary bindings. When\n", #> list("with_bindings()"), " returns, bindings are reset to their original\n", #> "values. It is a simple wrapper around ", list( #> "local_bindings()"), ".\n"), "\n"), "\n", #> list("\n", "foo <- \"foo\"\n", "bar <- \"bar\"\n", #> "\n", "# `foo` will be temporarily rebinded while executing `expr`\n", #> "with_bindings(paste(foo, bar), foo = \"rebinded\")\n", #> "paste(foo, bar)\n"), "\n"), local_options.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/state.R", #> "\n", list("local_options"), "\n", list("local_options"), #> "\n", list("with_options"), "\n", list("push_options"), #> "\n", list("peek_options"), "\n", list("peek_option"), #> "\n", list("Change global options"), "\n", list( #> "\n", "local_options(..., .frame = caller_env())\n", #> "\n", "with_options(.expr, ...)\n", "\n", "push_options(...)\n", #> "\n", "peek_options(...)\n", "\n", "peek_option(name)\n"), #> "\n", list("\n", list(list("..."), list("For ", #> list("local_options()"), " and ", list("push_options()"), #> ", named\n", "values defining new option values. For ", #> list("peek_options()"), ", strings\n", "or character vectors of option names.")), #> "\n", "\n", list(list(".frame"), list("The environment of a stack frame which defines the\n", #> "scope of the temporary options. When the frame returns, the\n", #> "options are set back to their original values.")), #> "\n", "\n", list(list(".expr"), list("An expression to evaluate with temporary options.")), #> "\n", "\n", list(list("name"), list("An option name as string.")), #> "\n"), "\n", list("\n", "For ", list("local_options()"), #> " and ", list("push_options()"), ", the old option\n", #> "values. ", list("peek_option()"), " returns the current value of an option\n", #> "while the plural ", list("peek_options()"), #> " returns a list of current\n", "option values.\n"), #> "\n", list("\n", list("\n", list(), " ", list( #> "local_options()"), " changes options for the duration of a stack\n", #> "frame (by default the current one). Options are set back to their\n", #> "old values when the frame returns.\n", list(), #> " ", list("with_options()"), " changes options while an expression is\n", #> "evaluated. Options are restored when the expression returns.\n", #> list(), " ", list("push_options()"), " adds or changes options permanently.\n", #> list(), " ", list("peek_option()"), " and ", #> list("peek_options()"), " return option values. The\n", #> "former returns the option directly while the latter returns a\n", #> "list.\n"), "\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "These functions are experimental.\n")), #> "\n", "\n", list("\n", "# Store and retrieve a global option:\n", #> "push_options(my_option = 10)\n", "peek_option(\"my_option\")\n", #> "\n", "# Change the option temporarily:\n", #> "with_options(my_option = 100, peek_option(\"my_option\"))\n", #> "peek_option(\"my_option\")\n", "\n", "# The scoped variant is useful within functions:\n", #> "fn <- function() {\n", " local_options(my_option = 100)\n", #> " peek_option(\"my_option\")\n", "}\n", "fn()\n", #> "peek_option(\"my_option\")\n", "\n", "# The plural peek returns a named list:\n", #> "peek_options(\"my_option\")\n", "peek_options(\"my_option\", \"digits\")\n"), #> "\n", list("experimental"), "\n"), missing.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-na.R", #> "\n", list("data"), "\n", list("missing"), "\n", #> list("missing"), "\n", list("na_lgl"), "\n", #> list("na_int"), "\n", list("na_dbl"), "\n", list( #> "na_chr"), "\n", list("na_cpl"), "\n", list( #> "Missing values"), "\n", list("\n", "An object of class ", #> list("logical"), " of length 1.\n", "\n", "An object of class ", #> list("integer"), " of length 1.\n", "\n", "An object of class ", #> list("numeric"), " of length 1.\n", "\n", "An object of class ", #> list("character"), " of length 1.\n", "\n", #> "An object of class ", list("complex"), " of length 1.\n"), #> "\n", list("\n", "na_lgl\n", "\n", "na_int\n", #> "\n", "na_dbl\n", "\n", "na_chr\n", "\n", "na_cpl\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "Missing values are represented in R with the general symbol\n", #> list("NA"), ". They can be inserted in almost all data containers: all\n", #> "atomic vectors except raw vectors can contain missing values. To\n", #> "achieve this, R automatically converts the general ", #> list("NA"), " symbol to a\n", "typed missing value appropriate for the target vector. The objects\n", #> "provided here are aliases for those typed ", #> list("NA"), " objects.\n"), "\n", list("\n", #> "Typed missing values are necessary because R needs sentinel values\n", #> "of the same type (i.e. the same machine representation of the data)\n", #> "as the containers into which they are inserted. The official typed\n", #> "missing values are ", list("NA_integer_"), #> ", ", list("NA_real_"), ", ", list("NA_character_"), #> " and\n", list("NA_complex_"), ". The missing value for logical vectors is simply the\n", #> "default ", list("NA"), ". The aliases provided in rlang are consistently named\n", #> "and thus simpler to remember. Also, ", list( #> "na_lgl"), " is provided as an\n", "alias to ", #> list("NA"), " that makes intent clearer.\n", #> "\n", "Since ", list("na_lgl"), " is the default ", #> list("NA"), ", expressions such as ", list( #> "c(NA, NA)"), "\n", "yield logical vectors as no data is available to give a clue of the\n", #> "target type. In the same way, since lists and environments can\n", #> "contain any types, expressions like ", list( #> "list(NA)"), " store a logical\n", list("NA"), #> ".\n"), "\n", list(list("Life cycle"), list( #> "\n", "\n", "\n", "These shortcuts might be moved to the vctrs package at some\n", #> "point. This is why they are marked as questioning.\n")), #> "\n", "\n", list("\n", "typeof(NA)\n", "typeof(na_lgl)\n", #> "typeof(na_int)\n", "\n", "# Note that while the base R missing symbols cannot be overwritten,\n", #> "# that's not the case for rlang's aliases:\n", #> "na_dbl <- NA\n", "typeof(na_dbl)\n"), "\n", #> list("datasets"), "\n", list("internal"), "\n"), #> missing_arg.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/arg.R", #> "\n", list("missing_arg"), "\n", list("missing_arg"), #> "\n", list("is_missing"), "\n", list("maybe_missing"), #> "\n", list("Generate or handle a missing argument"), #> "\n", list("\n", "missing_arg()\n", "\n", "is_missing(x)\n", #> "\n", "maybe_missing(x, default = missing_arg())\n"), #> "\n", list("\n", list(list("x"), list("An object that might be the missing argument.")), #> "\n", "\n", list(list("default"), list("The object to return if the input is missing,\n", #> "defaults to ", list("missing_arg()"), ".")), #> "\n"), "\n", list("\n", "These functions help using the missing argument as a regular R\n", #> "object.\n", list("\n", list(), " ", list("missing_arg()"), #> " generates a missing argument.\n", list(), #> " ", list("is_missing()"), " is like ", list( #> list("base::missing()")), " but also supports\n", #> "testing for missing arguments contained in other objects like\n", #> "lists.\n", list(), " ", list("maybe_missing()"), #> " is useful to pass down an input that might be\n", #> "missing to another function, potentially substituting by a\n", #> "default value. It avoids triggering an \"argument is missing\" error.\n"), #> "\n"), "\n", list(list("Other ways to reify the missing argument"), #> list("\n", "\n", list("\n", list(), " ", list( #> "base::quote(expr = )"), " is the canonical way to create a missing\n", #> "argument object.\n", list(), " ", list("expr()"), #> " called without argument creates a missing argument.\n", #> list(), " ", list("quo()"), " called without argument creates an empty quosure, i.e. a\n", #> "quosure containing the missing argument object.\n"), #> "\n")), "\n", "\n", list(list("Fragility of the missing argument object"), #> list("\n", "\n", "\n", "The missing argument is an object that triggers an error if and\n", #> "only if it is the result of evaluating a symbol. No error is\n", #> "produced when a function call evaluates to the missing argument\n", #> "object. This means that expressions like ", #> list("x[[1]] <- missing_arg()"), "\n", "are perfectly safe. Likewise, ", #> list("x[[1]]"), " is safe even if the result\n", #> "is the missing object.\n", "\n", "However, as soon as the missing argument is passed down between\n", #> "functions through an argument, you're at risk of triggering a\n", #> "missing error. This is because arguments are passed through\n", #> "symbols. To work around this, ", list("is_missing()"), #> " and ", list("maybe_missing(x)"), "\n", #> "use a bit of magic to determine if the input is the missing\n", #> "argument without triggering a missing error.\n", #> "\n", list("maybe_missing()"), " is particularly useful for prototyping\n", #> "meta-programming algorithms in R. The missing argument is a likely\n", #> "input when computing on the language because it is a standard\n", #> "object in formals lists. While C functions are always allowed to\n", #> "return the missing argument and pass it to other C functions, this\n", #> "is not the case on the R side. If you're implementing your\n", #> "meta-programming algorithm in R, use ", #> list("maybe_missing()"), " when an\n", "input might be the missing argument object.\n")), #> "\n", "\n", list(list("Life cycle"), list("\n", #> "\n", list("\n", list(), " ", list("missing_arg()"), #> " and ", list("is_missing()"), " are stable.\n", #> list(), " Like the rest of rlang, ", list( #> "maybe_missing()"), " is maturing.\n"), #> "\n")), "\n", "\n", list("\n", "# The missing argument usually arises inside a function when the\n", #> "# user omits an argument that does not have a default:\n", #> "fn <- function(x) is_missing(x)\n", "fn()\n", #> "\n", "# Creating a missing argument can also be useful to generate calls\n", #> "args <- list(1, missing_arg(), 3, missing_arg())\n", #> "quo(fn(!!! args))\n", "\n", "# Other ways to create that object include:\n", #> "quote(expr = )\n", "expr()\n", "\n", "# It is perfectly valid to generate and assign the missing\n", #> "# argument in a list.\n", "x <- missing_arg()\n", #> "l <- list(missing_arg())\n", "\n", "# Just don't evaluate a symbol that contains the empty argument.\n", #> "# Evaluating the object `x` that we created above would trigger an\n", #> "# error.\n", "# x # Not run\n", "\n", "# On the other hand accessing a missing argument contained in a\n", #> "# list does not trigger an error because subsetting is a function\n", #> "# call:\n", "l[[1]]\n", "is.null(l[[1]])\n", #> "\n", "# In case you really need to access a symbol that might contain the\n", #> "# empty argument object, use maybe_missing():\n", #> "maybe_missing(x)\n", "is.null(maybe_missing(x))\n", #> "is_missing(maybe_missing(x))\n", "\n", "\n", #> "# Note that base::missing() only works on symbols and does not\n", #> "# support complex expressions. For this reason the following lines\n", #> "# would throw an error:\n", "\n", "#> missing(missing_arg())\n", #> "#> missing(l[[1]])\n", "\n", "# while is_missing() will work as expected:\n", #> "is_missing(missing_arg())\n", "is_missing(l[[1]])\n"), #> "\n"), mut_node_car.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("mut_node_car"), "\n", list("mut_node_car"), #> "\n", list("mut_node_cdr"), "\n", list("mut_node_caar"), #> "\n", list("mut_node_cadr"), "\n", list("mut_node_cdar"), #> "\n", list("mut_node_cddr"), "\n", list("mut_node_tag"), #> "\n", list("Mutate node components"), "\n", list( #> "\n", "mut_node_car(x, newcar)\n", "\n", "mut_node_cdr(x, newcdr)\n", #> "\n", "mut_node_caar(x, newcar)\n", "\n", "mut_node_cadr(x, newcar)\n", #> "\n", "mut_node_cdar(x, newcdr)\n", "\n", "mut_node_cddr(x, newcdr)\n", #> "\n", "mut_node_tag(x, newtag)\n"), "\n", list( #> "\n", list(list("x"), list("A language or pairlist node. Note that these functions are\n", #> "barebones and do not perform any type checking.")), #> "\n", "\n", list(list("newcar"), list("The new CAR or CDR for the node. These\n", #> "can be any R objects.")), "\n", "\n", list( #> list("newcdr"), list("The new CAR or CDR for the node. These\n", #> "can be any R objects.")), "\n", "\n", #> list(list("newtag"), list("The new tag for the node. This should be a symbol.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions were deprecated and renamed with ", #> list("node_poke_"), "\n", "prefix in rlang 0.2.0. This change follows a new naming convention\n", #> "where mutation is referred to as \"poking\".\n"), #> "\n", list("internal"), "\n"), names2.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("names2"), "\n", list("names2"), "\n", #> list("Get names of a vector"), "\n", list("\n", #> "names2(x)\n"), "\n", list("\n", list(list( #> "x"), list("A vector.")), "\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", "This names getter always returns a character vector, even when an\n", #> "object does not have a ", list("names"), " attribute. In this case, it returns\n", #> "a vector of empty names ", list("\"\""), ". It also standardises missing names to\n", #> list("\"\""), ".\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", list("names2()"), " is stable.\n")), #> "\n", "\n", list("\n", "names2(letters)\n", "\n", #> "# It also takes care of standardising missing names:\n", #> "x <- set_names(1:3, c(\"a\", NA, \"b\"))\n", #> "names2(x)\n"), "\n"), `new-vector-along-retired.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("new-vector-along-retired"), "\n", #> list("new-vector-along-retired"), "\n", list( #> "new_logical_along"), "\n", list("new_integer_along"), #> "\n", list("new_double_along"), "\n", list("new_character_along"), #> "\n", list("new_complex_along"), "\n", list("new_raw_along"), #> "\n", list("new_list_along"), "\n", list("Create vectors matching the length of a given vector"), #> "\n", list("\n", "new_logical_along(x, names = base::names(x))\n", #> "\n", "new_integer_along(x, names = base::names(x))\n", #> "\n", "new_double_along(x, names = base::names(x))\n", #> "\n", "new_character_along(x, names = base::names(x))\n", #> "\n", "new_complex_along(x, names = base::names(x))\n", #> "\n", "new_raw_along(x, names = base::names(x))\n", #> "\n", "new_list_along(x, names = base::names(x))\n"), #> "\n", list("\n", list(list("x"), list("A vector.")), #> "\n", "\n", list(list("names"), list("Names for the new vector.")), #> "\n"), "\n", list("\n", "These functions are deprecated as of rlang 0.3.0 because they\n", #> "are longer to type than the equivalent ", #> list(list("rep_along()")), " or\n", list(list( #> "rep_named()")), " calls without added clarity.\n"), #> "\n", list("internal"), "\n"), `new-vector.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-new.R", #> "\n", list("new-vector"), "\n", list("new-vector"), #> "\n", list("new_logical"), "\n", list("new_integer"), #> "\n", list("new_double"), "\n", list("new_character"), #> "\n", list("new_complex"), "\n", list("new_raw"), #> "\n", list("new_list"), "\n", list("Create vectors matching a given length"), #> "\n", list("\n", "new_logical(n, names = NULL)\n", #> "\n", "new_integer(n, names = NULL)\n", "\n", #> "new_double(n, names = NULL)\n", "\n", "new_character(n, names = NULL)\n", #> "\n", "new_complex(n, names = NULL)\n", "\n", #> "new_raw(n, names = NULL)\n", "\n", "new_list(n, names = NULL)\n"), #> "\n", list("\n", list(list("n"), list("The vector length.")), #> "\n", "\n", list(list("names"), list("Names for the new vector.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "These functions construct vectors of a given length, with attributes\n", #> "specified via dots. Except for ", list("new_list()"), #> " and ", list("new_raw()"), ", the\n", "empty vectors are filled with typed ", #> list("missing"), " values. This is in\n", "contrast to the base function ", #> list(list("base::vector()")), " which creates\n", #> "zero-filled vectors.\n"), "\n", list(list( #> "Lifecycle"), list("\n", "\n", "\n", "These functions are likely to be replaced by a vctrs equivalent in\n", #> "the future. They are in the questioning lifecycle stage.\n")), #> "\n", "\n", list("\n", "new_list(10)\n", "new_logical(10)\n"), #> "\n", list("\n", "rep_along\n"), "\n", list("internal"), #> "\n"), new_call.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/node.R", #> "\n", list("new_call"), "\n", list("new_call"), #> "\n", list("Create a new call from components"), #> "\n", list("\n", "new_call(car, cdr = NULL)\n"), #> "\n", list("\n", list(list("car"), list("The head of the call. It should be a\n", #> list("callable"), " object: a symbol, call, or literal\n", #> "function.")), "\n", "\n", list(list("cdr"), #> list("The tail of the call, i.e. a ", list( #> "node list"), " of\n", "arguments.")), "\n"), #> "\n", list("\n", "Create a new call from components\n"), #> "\n", list("internal"), "\n"), new_formula.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/formula.R", #> "\n", list("new_formula"), "\n", list("new_formula"), #> "\n", list("Create a formula"), "\n", list("\n", #> "new_formula(lhs, rhs, env = caller_env())\n"), #> "\n", list("\n", list(list("lhs, rhs"), list( #> "A call, name, or atomic vector.")), "\n", #> "\n", list(list("env"), list("An environment.")), #> "\n"), "\n", list("\n", "A formula object.\n"), #> "\n", list("\n", "Create a formula\n"), "\n", #> list("\n", "new_formula(quote(a), quote(b))\n", #> "new_formula(NULL, quote(b))\n"), "\n", list( #> "\n", list(list("new_quosure()")), "\n"), "\n"), #> new_function.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("new_function"), "\n", list("new_function"), #> "\n", list("Create a function"), "\n", list("\n", #> "new_function(args, body, env = caller_env())\n"), #> "\n", list("\n", list(list("args"), list("A named list or pairlist of default arguments. Note\n", #> "that if you want arguments that don't have defaults, you'll need\n", #> "to use the special function ", list(list("pairlist2()")), #> ". If you need quoted\n", "defaults, use ", #> list(list("exprs()")), ".")), "\n", "\n", list( #> list("body"), list("A language object representing the code inside the\n", #> "function. Usually this will be most easily generated with\n", #> list(list("base::quote()")))), "\n", "\n", #> list(list("env"), list("The parent environment of the function, defaults to the\n", #> "calling environment of ", list("new_function()"))), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", "This constructs a new function given its three components:\n", #> "list of arguments, body code and parent environment.\n"), #> "\n", list("\n", "f <- function() letters\n", #> "g <- new_function(NULL, quote(letters))\n", #> "identical(f, g)\n", "\n", "# Pass a list or pairlist of named arguments to create a function\n", #> "# with parameters. The name becomes the parameter name and the\n", #> "# argument the default value for this parameter:\n", #> "new_function(list(x = 10), quote(x))\n", "new_function(pairlist2(x = 10), quote(x))\n", #> "\n", "# Use `exprs()` to create quoted defaults. Compare:\n", #> "new_function(pairlist2(x = 5 + 5), quote(x))\n", #> "new_function(exprs(x = 5 + 5), quote(x))\n", #> "\n", "# Pass empty arguments to omit defaults. `list()` doesn't allow\n", #> "# empty arguments but `pairlist2()` does:\n", #> "new_function(pairlist2(x = , y = 5 + 5), quote(x + y))\n", #> "new_function(exprs(x = , y = 5 + 5), quote(x + y))\n"), #> "\n"), new_node.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/node.R", #> "\n", list("new_node"), "\n", list("new_node"), #> "\n", list("node_car"), "\n", list("node_cdr"), #> "\n", list("node_caar"), "\n", list("node_cadr"), #> "\n", list("node_cdar"), "\n", list("node_cddr"), #> "\n", list("node_poke_car"), "\n", list("node_poke_cdr"), #> "\n", list("node_poke_caar"), "\n", list("node_poke_cadr"), #> "\n", list("node_poke_cdar"), "\n", list("node_poke_cddr"), #> "\n", list("node_tag"), "\n", list("node_poke_tag"), #> "\n", list("Helpers for pairlist and language nodes"), #> "\n", list("\n", "new_node(car, cdr = NULL)\n", #> "\n", "node_car(x)\n", "\n", "node_cdr(x)\n", #> "\n", "node_caar(x)\n", "\n", "node_cadr(x)\n", #> "\n", "node_cdar(x)\n", "\n", "node_cddr(x)\n", #> "\n", "node_poke_car(x, newcar)\n", "\n", "node_poke_cdr(x, newcdr)\n", #> "\n", "node_poke_caar(x, newcar)\n", "\n", #> "node_poke_cadr(x, newcar)\n", "\n", "node_poke_cdar(x, newcdr)\n", #> "\n", "node_poke_cddr(x, newcdr)\n", "\n", #> "node_tag(x)\n", "\n", "node_poke_tag(x, newtag)\n"), #> "\n", list("\n", list(list("car, newcar, cdr, newcdr"), #> list("The new CAR or CDR for the node. These\n", #> "can be any R objects.")), "\n", "\n", list( #> list("x"), list("A language or pairlist node. Note that these functions are\n", #> "barebones and do not perform any type checking.")), #> "\n", "\n", list(list("newtag"), list("The new tag for the node. This should be a symbol.")), #> "\n"), "\n", list("\n", "Setters like ", list( #> "node_poke_car()"), " invisibly return ", list( #> "x"), " modified\n", "in place. Getters return the requested node component.\n"), #> "\n", list("\n", list("Important"), ": These functions are for expert R programmers only.\n", #> "You should only use them if you feel comfortable manipulating low\n", #> "level R data structures at the C level. We export them at the R level\n", #> "in order to make it easy to prototype C code. They don't perform\n", #> "any type checking and can crash R very easily (try to take the CAR\n", #> "of an integer vector --- save any important objects beforehand!).\n"), #> "\n", list("\n", list(list("duplicate()")), " for creating copy-safe objects and\n", #> list(list("base::pairlist()")), " for an easier way of creating a linked list of\n", #> "nodes.\n"), "\n", list("internal"), "\n"), #> new_quosures.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/quo.R", #> "\n", list("new_quosures"), "\n", list("new_quosures"), #> "\n", list("as_quosures"), "\n", list("is_quosures"), #> "\n", list("Create a list of quosures"), "\n", #> list("\n", "new_quosures(x)\n", "\n", "as_quosures(x, env, named = FALSE)\n", #> "\n", "is_quosures(x)\n"), "\n", list("\n", #> list(list("x"), list("A list of quosures or objects to coerce to quosures.")), #> "\n", "\n", list(list("env"), list("The default environment for the new quosures.")), #> "\n", "\n", list(list("named"), list("Whether to name the list with ", #> list(list("quos_auto_name()")), ".")), "\n"), #> "\n", list("\n", "This small S3 class provides methods for ", #> list("["), " and ", list("c()"), " and ensures\n", #> "the following invariants:\n", list("\n", list(), #> " The list only contains quosures.\n", list(), #> " It is always named, possibly with a vector of empty strings.\n"), #> "\n", "\n", list("new_quosures()"), " takes a list of quosures and adds the ", #> list("quosures"), "\n", "class and a vector of empty names if needed. ", #> list("as_quosures()"), " calls\n", list(list( #> "as_quosure()")), " on all elements before creating the ", #> list("quosures"), "\n", "object.\n"), "\n"), #> new_weakref.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/weakref.R", #> "\n", list("new_weakref"), "\n", list("new_weakref"), #> "\n", list("Create a weak reference"), "\n", #> list("\n", "new_weakref(key, value = NULL, finalizer = NULL, on_quit = FALSE)\n"), #> "\n", list("\n", list(list("key"), list("The key for the weak reference. Must be a reference object -- that\n", #> "is, an environment or external pointer.")), #> "\n", "\n", list(list("value"), list("The value for the weak reference. This can be ", #> list("NULL"), ", if you\n", "want to use the weak reference like a weak pointer.")), #> "\n", "\n", list(list("finalizer"), list("A function that is run after the key becomes unreachable.")), #> "\n", "\n", list(list("on_quit"), list("Should the finalizer be run when R exits?")), #> "\n"), "\n", list("\n", "A weak reference is a special R object which makes it possible to keep a\n", #> "reference to an object without preventing garbage collection of that object.\n", #> "It can also be used to keep data about an object without preventing GC of the\n", #> "object, similar to WeakMaps in JavaScript.\n", #> "\n", "Objects in R are considered ", list( #> "reachable"), " if they can be accessed by following\n", #> "a chain of references, starting from a ", #> list("root node"), "; root nodes are\n", "specially-designated R objects, and include the global environment and base\n", #> "environment. As long as the key is reachable, the value will not be garbage\n", #> "collected. This is true even if the weak reference object becomes\n", #> "unreachable. The key effectively prevents the weak reference and its value\n", #> "from being collected, according to the following chain of ownership:\n", #> list("weakref <- key -> value"), ".\n", "\n", #> "When the key becomes unreachable, the key and value in the weak reference\n", #> "object are replaced by ", list("NULL"), ", and the finalizer is scheduled to execute.\n"), #> "\n", list("\n", "e <- env()\n", "\n", "# Create a weak reference to e\n", #> "w <- new_weakref(e, finalizer = function(e) message(\"finalized\"))\n", #> "\n", "# Get the key object from the weak reference\n", #> "identical(wref_key(w), e)\n", "\n", "# When the regular reference (the `e` binding) is removed and a GC occurs,\n", #> "# the weak reference will not keep the object alive.\n", #> "rm(e)\n", "gc()\n", "identical(wref_key(w), NULL)\n", #> "\n", "\n", "# A weak reference with a key and value. The value contains data about the\n", #> "# key.\n", "k <- env()\n", "v <- list(1, 2, 3)\n", #> "w <- new_weakref(k, v)\n", "\n", "identical(wref_key(w), k)\n", #> "identical(wref_value(w), v)\n", "\n", "# When v is removed, the weak ref keeps it alive because k is still reachable.\n", #> "rm(v)\n", "gc()\n", "identical(wref_value(w), list(1, 2, 3))\n", #> "\n", "# When k is removed, the weak ref does not keep k or v alive.\n", #> "rm(k)\n", "gc()\n", "identical(wref_key(w), NULL)\n", #> "identical(wref_value(w), NULL)\n"), "\n", #> list("\n", list(list("is_weakref()")), ", ", #> list(list("wref_key()")), " and ", list(list( #> "wref_value()")), ".\n"), "\n", list("experimental"), #> "\n"), ns_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("ns_env"), "\n", list("ns_env"), "\n", #> list("ns_imports_env"), "\n", list("ns_env_name"), #> "\n", list("Get the namespace of a package"), #> "\n", list("\n", "ns_env(x = caller_env())\n", #> "\n", "ns_imports_env(x = caller_env())\n", #> "\n", "ns_env_name(x = caller_env())\n"), "\n", #> list("\n", list(list("x"), list(list("\n", list(), #> " For ", list("ns_env()"), ", the name of a package or an environment as a\n", #> "string.\n", list("\n", list(), " An environment (the current environment by default).\n", #> list(), " A function.\n"), "\n", "\n", "In the latter two cases, the environment ancestry is searched for\n", #> "a namespace with ", list(list("base::topenv()")), #> ". If the environment doesn't\n", "inherit from a namespace, this is an error.\n"))), #> "\n", "\n", list(list("env"), list("A namespace environment.")), #> "\n"), "\n", list("\n", "Namespaces are the environment where all the functions of a package\n", #> "live. The parent environments of namespaces are the ", #> list("imports"), "\n", "environments, which contain all the functions imported from other\n", #> "packages.\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", "\n", "These functions are experimental and may not belong to the rlang\n", #> "package. Expect API changes.\n")), "\n", #> "\n", list("\n", list(list("pkg_env()")), "\n"), #> "\n", list("internal"), "\n"), `nse-defuse.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/nse-defuse.R", #> "\n", list("nse-defuse"), "\n", list("nse-defuse"), #> "\n", list("quotation"), "\n", list("expr"), #> "\n", list("enexpr"), "\n", list("exprs"), "\n", #> list("enexprs"), "\n", list("ensym"), "\n", list( #> "ensyms"), "\n", list("quo"), "\n", list("enquo"), #> "\n", list("quos"), "\n", list("enquos"), "\n", #> list("Defuse R expressions"), "\n", list("\n", #> "expr(expr)\n", "\n", "enexpr(arg)\n", "\n", #> "exprs(\n", " ...,\n", " .named = FALSE,\n", #> " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .unquote_names = TRUE\n", ")\n", "\n", "enexprs(\n", #> " ...,\n", " .named = FALSE,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .unquote_names = TRUE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n", "\n", "ensym(arg)\n", #> "\n", "ensyms(\n", " ...,\n", " .named = FALSE,\n", #> " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .unquote_names = TRUE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n", "\n", "quo(expr)\n", #> "\n", "enquo(arg)\n", "\n", "quos(\n", " ...,\n", #> " .named = FALSE,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .unquote_names = TRUE\n", ")\n", "\n", "enquos(\n", #> " ...,\n", " .named = FALSE,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .unquote_names = TRUE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n"), "\n", #> list("\n", list(list("expr"), list("An expression.")), #> "\n", "\n", list(list("arg"), list("A symbol representing an argument. The expression\n", #> "supplied to that argument will be captured instead of being\n", #> "evaluated.")), "\n", "\n", list(list("..."), #> list("For ", list("enexprs()"), ", ", list( #> "ensyms()"), " and ", list("enquos()"), #> ", names of\n", "arguments to capture without evaluation (including ", #> list("..."), "). For\n", list("exprs()"), #> " and ", list("quos()"), ", the expressions to capture unevaluated\n", #> "(including expressions contained in ", #> list("..."), ").")), "\n", "\n", list(list( #> ".named"), list("Whether to ensure all dots are named. Unnamed\n", #> "elements are processed with ", list(list( #> "as_label()")), " to build a default\n", #> "name.")), "\n", "\n", list(list(".ignore_empty"), #> list("Whether to ignore empty arguments. Can be one\n", #> "of ", list("\"trailing\""), ", ", list( #> "\"none\""), ", ", list("\"all\""), ". If ", #> list("\"trailing\""), ", only the\n", "last argument is ignored if it is empty. Note that ", #> list("\"trailing\""), "\n", "applies only to arguments passed in ", #> list("..."), ", not to named\n", "arguments. On the other hand, ", #> list("\"all\""), " also applies to named\n", #> "arguments.")), "\n", "\n", list(list(".unquote_names"), #> list("Whether to treat ", list(":="), " as ", #> list("="), ". Unlike ", list("="), ", the\n", #> list(":="), " syntax supports ", list("!!"), #> " unquoting on the LHS.")), "\n", "\n", #> list(list(".homonyms"), list("How to treat arguments with the same name. The\n", #> "default, ", list("\"keep\""), ", preserves these arguments. Set ", #> list(".homonyms"), " to\n", list("\"first\""), #> " to only keep the first occurrences, to ", #> list("\"last\""), " to keep\n", "the last occurrences, and to ", #> list("\"error\""), " to raise an informative\n", #> "error and indicate what arguments have duplicated names.")), #> "\n", "\n", list(list(".check_assign"), list( #> "Whether to check for ", list("<-"), " calls passed in\n", #> "dots. When ", list("TRUE"), " and a ", list( #> "<-"), " call is detected, a warning is\n", #> "issued to advise users to use ", list("="), #> " if they meant to match a\n", "function parameter, or wrap the ", #> list("<-"), " call in braces otherwise.\n", #> "This ensures assignments are explicit.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", "The defusing operators ", list( #> "expr()"), " and ", list("enquo()"), " prevent the\n", #> "evaluation of R code. Defusing is also known as ", #> list("quoting"), ", and is\n", "done in base R by ", #> list(list("quote()")), " and ", list(list("substitute()")), #> ". When a function\n", "argument is defused, R doesn't return its value like it normally\n", #> "would but it returns the R expression describing how to make the\n", #> "value. These defused expressions are like blueprints for computing\n", #> "values.\n", "\n", "There are two main ways to defuse expressions, to which correspond\n", #> "the two functions ", list("expr()"), " and ", #> list("enquo()"), ". Whereas ", list("expr()"), #> " defuses\n", "your own expression, ", list( #> "enquo()"), " defuses expressions supplied as\n", #> "argument by the user of a function. See section on function\n", #> "arguments for more on this distinction.\n", #> "\n", "The main purpose of defusing evaluation of an expression is to\n", #> "enable data-masking, where an expression is evaluated in the\n", #> "context of a data frame so that you can write ", #> list("var"), " instead of\n", list("data$var"), #> ". The expression is defused so it can be resumed later\n", #> "on, in a context where the data-variables have been defined.\n", #> "\n", "Defusing prevents the evaluation of R code, but you can still force\n", #> "evaluation inside a defused expression with the ", #> list("forcing operators"), " ", list("!!"), #> " and ", list("!!!"), ".\n"), "\n", list(list( #> "Types of defused expressions"), list("\n", #> "\n", list("\n", list(), " ", list("Calls"), #> ", like ", list("f(1, 2, 3)"), " or ", list( #> "1 + 1"), " represent the action of\n", #> "calling a function to compute a new value, such as a vector.\n", #> list(), " ", list("Symbols"), ", like ", #> list("x"), " or ", list("df"), ", represent named objects. When the\n", #> "object pointed to by the symbol was defined in a function or in\n", #> "the global environment, we call it an environment-variable. When\n", #> "the object is a column in a data frame, we call it a\n", #> "data-variable.\n"), "\n", "\n", "You can create new call or symbol objects by using the defusing\n", #> "function ", list("expr()"), ":", list("# Create a symbol representing objects called `foo`\n", #> "expr(foo)\n", "\n", "# Create a call representing the computation of the mean of `foo`\n", #> "expr(mean(foo, na.rm = TRUE))\n"), "\n", #> "\n", "Defusing is not the only way to create defused expressions. You can\n", #> "also assemble them from data:", list("# Assemble a symbol from a string\n", #> "var <- \"foo\"\n", "sym(var)\n", "\n", "# Assemble a call from strings, symbols, and other objects\n", #> "call(\"mean\", sym(var), na.rm = TRUE)\n"), #> "\n")), "\n", "\n", list(list("Defusing function arguments"), #> list("\n", "\n", "\n", "There are two points of view when it comes to defusing an\n", #> "expression:\n", list("\n", list(), " You can defuse expressions that ", #> list("you"), " supply with ", list("expr()"), #> ". This\n", "is one way of creating symbols and calls (see previous section).\n", #> list(), " You can defuse the expressions supplied by ", #> list("the user"), " of your\n", "function with the operators starting with ", #> list("en"), " like ", list("ensym()"), #> ",\n", list("enquo()"), " and their plural variants. They defuse function\n", #> "arguments .\n"), "\n")), "\n", "\n", list( #> list("Defused arguments and quosures"), list( #> "\n", "\n", "\n", "If you inspect the return values of ", #> list("expr()"), " and ", list("enquo()"), #> ", you'll\n", "notice that the latter doesn't return a raw expression like the\n", #> "former. Instead it returns a ", list("quosure"), #> ", a wrapper containing an\n", "expression and an environment. R needs information about the\n", #> "environment to properly evaluate the argument expression because it\n", #> "comes from a different context than the current function.\n", #> "\n", "See the ", list("quosure"), " help topic about tools to work with quosures.\n")), #> "\n", "\n", list(list("Comparison to base R"), #> list("\n", "\n", list("\n", list(), " The defusing operator ", #> list("expr()"), " is similar to ", list(list( #> "quote()")), ". Like\n", list(list("bquote()")), #> ", it allows ", list("forcing"), " evaluation of parts\n", #> "of an expression.\n", list(), " The plural variant ", #> list("exprs()"), " is similar to ", list( #> list("alist()")), ".\n", list(), " The argument-defusing operator ", #> list("enquo()"), " is similar to\n", list( #> list("substitute()")), ".\n"), "\n")), #> "\n", "\n", list("\n", "# expr() and exprs() capture expressions that you supply:\n", #> "expr(symbol)\n", "exprs(several, such, symbols)\n", #> "\n", "# enexpr() and enexprs() capture expressions that your user supplied:\n", #> "expr_inputs <- function(arg, ...) {\n", " user_exprs <- enexprs(arg, ...)\n", #> " user_exprs\n", "}\n", "expr_inputs(hello)\n", #> "expr_inputs(hello, bonjour, ciao)\n", "\n", #> "# ensym() and ensyms() provide additional type checking to ensure\n", #> "# the user calling your function has supplied bare object names:\n", #> "sym_inputs <- function(...) {\n", " user_symbols <- ensyms(...)\n", #> " user_symbols\n", "}\n", "sym_inputs(hello, \"bonjour\")\n", #> "## sym_inputs(say(hello)) # Error: Must supply symbols or strings\n", #> "expr_inputs(say(hello))\n", "\n", "\n", "# All these quoting functions have quasiquotation support. This\n", #> "# means that you can unquote (evaluate and inline) part of the\n", #> "# captured expression:\n", "what <- sym(\"bonjour\")\n", #> "expr(say(what))\n", "expr(say(!!what))\n", #> "\n", "# This also applies to expressions supplied by the user. This is\n", #> "# like an escape hatch that allows control over the captured\n", #> "# expression:\n", "expr_inputs(say(!!what), !!what)\n", #> "\n", "\n", "# Finally, you can capture expressions as quosures. A quosure is an\n", #> "# object that contains both the expression and its environment:\n", #> "quo <- quo(letters)\n", "quo\n", "\n", "get_expr(quo)\n", #> "get_env(quo)\n", "\n", "# Quosures can be evaluated with eval_tidy():\n", #> "eval_tidy(quo)\n", "\n", "# They have the nice property that you can pass them around from\n", #> "# context to context (that is, from function to function) and they\n", #> "# still evaluate in their original environment:\n", #> "multiply_expr_by_10 <- function(expr) {\n", #> " # We capture the user expression and its environment:\n", #> " expr <- enquo(expr)\n", "\n", " # Then create an object that only exists in this function:\n", #> " local_ten <- 10\n", "\n", " # Now let's create a multiplication expression that (a) inlines\n", #> " # the user expression as LHS (still wrapped in its quosure) and\n", #> " # (b) refers to the local object in the RHS:\n", #> " quo(!!expr * local_ten)\n", "}\n", "quo <- multiply_expr_by_10(2 + 3)\n", #> "\n", "# The local parts of the quosure are printed in colour if your\n", #> "# terminal is capable of displaying colours:\n", #> "quo\n", "\n", "# All the quosures in the expression evaluate in their original\n", #> "# context. The local objects are looked up properly and we get the\n", #> "# expected result:\n", "eval_tidy(quo)\n"), #> "\n", list("\n", list(list("enquo0()")), " and ", #> list(list("enquos0()")), " for variants that do not\n", #> "perform automatic injection/unquotation.\n"), #> "\n"), `nse-force.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/nse-force.R", #> "\n", list("nse-force"), "\n", list("nse-force"), #> "\n", list("quasiquotation"), "\n", list("UQ"), #> "\n", list("UQS"), "\n", list("{{}}"), "\n", #> list("{{"), "\n", list("!!"), "\n", list("!!!"), #> "\n", list(":="), "\n", list("qq_show"), "\n", #> list("Force parts of an expression"), "\n", list( #> "\n", "qq_show(expr)\n"), "\n", list("\n", #> list(list("expr"), list("An expression to be quasiquoted.")), #> "\n"), "\n", list("\n", "It is sometimes useful to force early evaluation of part of an\n", #> "expression before it gets fully evaluated. The tidy eval framework\n", #> "provides several forcing operators for different use cases.\n", #> list("\n", list(), " The bang-bang operator ", #> list("!!"), " forces a ", list("single"), #> " object. One\n", "common case for ", list( #> "!!"), " is to substitute an environment-variable\n", #> "(created with ", list("<-"), ") with a data-variable (inside a data frame).", #> list("library(dplyr)\n", "\n", "# The environment variable `var` refers to the data-variable\n", #> "# `height`\n", "var <- sym(\"height\")\n", #> "\n", "# We force `var`, which substitutes it with `height`\n", #> "starwars %>%\n", " summarise(avg = mean(!!var, na.rm = TRUE))\n"), #> "\n", list(), " The big-bang operator ", #> list("!!!"), " forces-splice a ", list("list"), #> " of objects.\n", "The elements of the list are spliced in place, meaning that they\n", #> "each become one single argument.", list( #> "vars <- syms(c(\"height\", \"mass\"))\n", #> "\n", "# Force-splicing is equivalent to supplying the elements separately\n", #> "starwars %>% select(!!!vars)\n", "starwars %>% select(height, mass)\n"), #> "\n", list(), " The curly-curly operator ", #> list("{{ }}"), " for function arguments is a bit\n", #> "special because it forces the function argument and immediately\n", #> "defuses it. The defused expression is substituted in place, ready\n", #> "to be evaluated in another context, such as the data frame.\n", #> "\n", "In practice, this is useful when you have a data-variable in an\n", #> "env-variable (such as a function argument).", #> list("# Force-defuse all function arguments that might contain\n", #> "# data-variables by embracing them with {{ }}\n", #> "mean_by <- function(data, by, var) {\n", #> " data %>%\n", " group_by({{ by }}) %>%\n", #> " summarise(avg = mean({{ var }}, na.rm = TRUE))\n", #> "}\n", "\n", "# The env-variables `by` and `var` are forced but defused.\n", #> "# The data-variables they contain are evaluated by dplyr later on\n", #> "# in data context.\n", "iris %>% mean_by(by = Species, var = Sepal.Width)\n"), #> "\n"), "\n", "\n", "Use ", list("qq_show()"), #> " to experiment with forcing operators. ", #> list("qq_show()"), "\n", "defuses its input, processes all forcing operators, and prints the\n", #> "result with ", list(list("expr_print()")), #> " to reveal objects inlined in the\n", "expression by the forcing operators.\n"), #> "\n", list(list("Forcing names"), list("\n", #> "\n", "\n", "When a function takes multiple named arguments\n", #> "(e.g. ", list("dplyr::mutate()"), "), it is difficult to supply a variable as\n", #> "name. Since the LHS of ", list("="), " is ", #> list("defused"), ", giving the name\n", "of a variable results in the argument having the name of the\n", #> "variable rather than the name stored in that variable. This problem\n", #> "of forcing evaluation of names is exactly what the ", #> list("!!"), " operator is\n", "for.\n", "\n", #> "Unfortunately R is very strict about the kind of expressions\n", #> "supported on the LHS of ", list("="), ". This is why rlang interprets the\n", #> "walrus operator ", list(":="), " as an alias of ", #> list("="), ". You can use it to supply\n", #> "names, e.g. ", list("a := b"), " is equivalent to ", #> list("a = b"), ". Since its syntax is\n", "more flexible you can also force names on its LHS:", #> list("name <- \"Jane\"\n", "\n", "list2(!!name := 1 + 2)\n", #> "exprs(!!name := 1 + 2)\n"), "\n", "\n", #> "Like ", list("="), ", the ", list(":="), " operator expects strings or symbols on its LHS.\n", #> "\n", "Since unquoting names is related to interpolating within a string\n", #> "with the glue package, we have made the glue syntax available on\n", #> "the LHS of ", list(":="), ":", list("list2(\"{name}\" := 1)\n", #> "tibble(\"{name}\" := 1)\n"), "\n", "\n", #> "You can also interpolate defused function arguments with double\n", #> "braces ", list("{{"), ", similar to the curly-curly syntax:", #> list("wrapper <- function(data, var) {\n", #> " data %>% mutate(\"{{ var }}_foo\" := {{ var }} * 2)\n", #> "}\n"), "\n", "\n", "Currently, forcing names with ", #> list(":="), " only works in top level\n", "expressions. These are all valid:", #> list("exprs(\"{name}\" := x)\n", "tibble(\"{name}\" := x)\n"), #> "\n", "\n", "But deep-forcing names isn't supported:", #> list("exprs(this(is(deep(\"{name}\" := x))))\n"), #> "\n")), "\n", "\n", list(list("Theory"), list( #> "\n", "\n", "\n", "Formally, ", list("quo()"), #> " and ", list("expr()"), " are quasiquotation functions, ", #> list("!!"), "\n", "is the unquote operator, and ", #> list("!!!"), " is the unquote-splice operator.\n", #> "These terms have a rich history in Lisp languages, and live on in\n", #> "modern languages like\n", list(list("https://docs.julialang.org/en/v1/manual/metaprogramming/"), #> list("Julia")), "\n", "and\n", list(list( #> "https://docs.racket-lang.org/reference/quasiquote.html"), #> list("Racket")), ".\n")), "\n", "\n", list( #> list("Life cycle"), list("\n", "\n", list("\n", #> list(), " Calling ", list("UQ()"), " and ", #> list("UQS()"), " with the rlang namespace qualifier is\n", #> "deprecated as of rlang 0.3.0. Just use the unqualified forms\n", #> "instead:", list("# Bad\n", "rlang::expr(mean(rlang::UQ(var) * 100))\n", #> "\n", "# Ok\n", "rlang::expr(mean(UQ(var) * 100))\n", #> "\n", "# Good\n", "rlang::expr(mean(!!var * 100))\n"), #> "\n", "\n", "Supporting namespace qualifiers complicates the implementation of\n", #> "unquotation and is misleading as to the nature of unquoting\n", #> "operators (which are syntactic operators that operate at\n", #> "quotation-time rather than function calls at evaluation-time).\n", #> list(), " ", list("UQ()"), " and ", list( #> "UQS()"), " were soft-deprecated in rlang 0.2.0 in order\n", #> "to make the syntax of quasiquotation more consistent. The prefix\n", #> "forms are now ", list("`!!`()"), " and ", #> list("`!!!`()"), " which is\n", "consistent with other R operators (e.g. ", #> list("`+`(a, b)"), " is the\n", "prefix form of ", #> list("a + b"), ").\n", "\n", "Note that the prefix forms are not as relevant as before because\n", #> list("!!"), " now has the right operator precedence, i.e. the same as\n", #> "unary ", list("-"), " or ", list("+"), ". It is thus safe to mingle it with other\n", #> "operators, e.g. ", list("!!a + !!b"), " does the right thing. In addition the\n", #> "parser now strips one level of parentheses around unquoted\n", #> "expressions. This way ", list("(!!\"foo\")(...)"), #> " expands to ", list("foo(...)"), ".\n", #> "These changes make the prefix forms less useful.\n", #> "\n", "Finally, the named functional forms ", #> list("UQ()"), " and ", list("UQS()"), " were\n", #> "misleading because they suggested that existing knowledge about\n", #> "functions is applicable to quasiquotation. This was reinforced by\n", #> "the visible definitions of these functions exported by rlang and\n", #> "by the tidy eval parser interpreting ", #> list("rlang::UQ()"), " as ", list("!!"), #> ". In\n", "reality unquoting is ", list("not"), #> " a function call, it is a syntactic\n", #> "operation. The operator form makes it clearer that unquoting is\n", #> "special.\n"), "\n")), "\n", "\n", list("\n", #> "# Interpolation with {{ }} is the easiest way to forward\n", #> "# arguments to tidy eval functions:\n", "if (is_attached(\"package:dplyr\")) {\n", #> "\n", "# Forward all arguments involving data frame columns by\n", #> "# interpolating them within other data masked arguments.\n", #> "# Here we interpolate `arg` in a `summarise()` call:\n", #> "my_function <- function(data, arg) {\n", " summarise(data, avg = mean({{ arg }}, na.rm = TRUE))\n", #> "}\n", "\n", "my_function(mtcars, cyl)\n", #> "my_function(mtcars, cyl * 10)\n", "\n", "# The operator is just a shortcut for `!!enquo()`:\n", #> "my_function <- function(data, arg) {\n", " summarise(data, avg = mean(!!enquo(arg), na.rm = TRUE))\n", #> "}\n", "\n", "my_function(mtcars, cyl)\n", #> "\n", "}\n", "\n", "# Quasiquotation functions quote expressions like base::quote()\n", #> "quote(how_many(this))\n", "expr(how_many(this))\n", #> "quo(how_many(this))\n", "\n", "# In addition, they support unquoting. Let's store symbols\n", #> "# (i.e. object names) in variables:\n", "this <- sym(\"apples\")\n", #> "that <- sym(\"oranges\")\n", "\n", "# With unquotation you can insert the contents of these variables\n", #> "# inside the quoted expression:\n", "expr(how_many(!!this))\n", #> "expr(how_many(!!that))\n", "\n", "# You can also insert values:\n", #> "expr(how_many(!!(1 + 2)))\n", "quo(how_many(!!(1 + 2)))\n", #> "\n", "\n", "# Note that when you unquote complex objects into an expression,\n", #> "# the base R printer may be a bit misleading. For instance compare\n", #> "# the output of `expr()` and `quo()` (which uses a custom printer)\n", #> "# when we unquote an integer vector:\n", "expr(how_many(!!(1:10)))\n", #> "quo(how_many(!!(1:10)))\n", "\n", "# This is why it's often useful to use qq_show() to examine the\n", #> "# result of unquotation operators. It uses the same printer as\n", #> "# quosures but does not return anything:\n", #> "qq_show(how_many(!!(1:10)))\n", "\n", "\n", #> "# Use `!!!` to add multiple arguments to a function. Its argument\n", #> "# should evaluate to a list or vector:\n", #> "args <- list(1:3, na.rm = TRUE)\n", "quo(mean(!!!args))\n", #> "\n", "# You can combine the two\n", "var <- quote(xyz)\n", #> "extra_args <- list(trim = 0.9, na.rm = TRUE)\n", #> "quo(mean(!!var , !!!extra_args))\n", "\n", #> "\n", "# The plural versions have support for the `:=` operator.\n", #> "# Like `=`, `:=` creates named arguments:\n", #> "quos(mouse1 := bernard, mouse2 = bianca)\n", #> "\n", "# The `:=` is mainly useful to unquote names. Unlike `=` it\n", #> "# supports `!!` on its LHS:\n", "var <- \"unquote me!\"\n", #> "quos(!!var := bernard, mouse2 = bianca)\n", #> "\n", "\n", "# All these features apply to dots captured by enquos():\n", #> "fn <- function(...) enquos(...)\n", "fn(!!!args, !!var := penny)\n", #> "\n", "\n", "# Unquoting is especially useful for building an expression by\n", #> "# expanding around a variable part (the unquoted part):\n", #> "quo1 <- quo(toupper(foo))\n", "quo1\n", "\n", #> "quo2 <- quo(paste(!!quo1, bar))\n", "quo2\n", #> "\n", "quo3 <- quo(list(!!quo2, !!!syms(letters[1:5])))\n", #> "quo3\n"), "\n"), `op-definition.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/operators.R", #> "\n", list("op-definition"), "\n", list("op-definition"), #> "\n", list("is_definition"), "\n", list("new_definition"), #> "\n", list("is_formulaish"), "\n", list("Definition operator"), #> "\n", list("\n", "is_definition(x)\n", "\n", #> "new_definition(lhs, rhs, env = caller_env())\n", #> "\n", "is_formulaish(x, scoped = NULL, lhs = NULL)\n"), #> "\n", list("\n", list(list("x"), list("An object to test.")), #> "\n", "\n", list(list("lhs, rhs"), list("Expressions for the LHS and RHS of the definition.")), #> "\n", "\n", list(list("env"), list("The evaluation environment bundled with the definition.")), #> "\n"), "\n", list("\n", "The definition operator is typically used in DSL packages like\n", #> list("ggvis"), " and ", list("data.table"), #> ". It is also used in the tidyverse as a way\n", #> "of unquoting names (see ", list("nse-force"), #> ").\n", list("\n", list(), " ", list("is_definition()"), #> " returns ", list("TRUE"), " for calls to ", #> list(":="), ".\n", list(), " ", list("is_formulaish()"), #> " returns ", list("TRUE"), " for both formulas and\n", #> "colon-equals operators.\n"), "\n"), "\n", #> list("\n", "The recommended way to use it is to capture arguments as\n", #> "expressions or quosures. You can then give a special function\n", #> "definition for the ", list(":="), " symbol in an overscope. Note that if you\n", #> "capture dots with ", list(list("exprs()")), #> " or ", list(list("quos()")), ", you need to disable\n", #> "interpretation of ", list(":="), " by setting ", #> list(".unquote_names"), " to ", list("FALSE"), #> ".\n", "\n", "From rlang and data.table perspectives, this operator is not meant\n", #> "to be evaluated directly at top-level which is why the exported\n", #> "definitions issue an error.\n"), "\n", list( #> list("Life cycle"), list("\n", "\n", "\n", #> "These functions are experimental.\n")), #> "\n", "\n", list("\n", "\n", "# A predicate is provided to distinguish formulas from the\n", #> "# colon-equals operator:\n", "is_definition(quote(a := b))\n", #> "is_definition(a ~ b)\n", "\n", "\n", "# is_formulaish() tests for both definitions and formulas:\n", #> "is_formulaish(a ~ b)\n", "is_formulaish(quote(a := b))\n"), #> "\n", list("internal"), "\n"), `op-get-attr.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/operators.R", #> "\n", list("op-get-attr"), "\n", list("op-get-attr"), #> "\n", list("%@%"), "\n", list("%@%<-"), "\n", #> list("Infix attribute accessor and setter"), #> "\n", list("\n", "x %@% name\n", "\n", "x %@% name <- value\n"), #> "\n", list("\n", list(list("x"), list("Object")), #> "\n", "\n", list(list("name"), list("Attribute name")), #> "\n", "\n", list(list("value"), list("New value for attribute ", #> list("name"), ".")), "\n"), "\n", list("\n", #> "This operator extracts or sets attributes for regular objects and\n", #> "S4 fields for S4 objects.\n"), "\n", list( #> "\n", "# Unlike `@`, this operator extracts attributes for any kind of\n", #> "# objects:\n", "factor(1:3) %@% \"levels\"\n", #> "mtcars %@% class\n", "\n", "mtcars %@% class <- NULL\n", #> "mtcars\n", "\n", "# It also works on S4 objects:\n", #> ".Person <- setClass(\"Person\", slots = c(name = \"character\", species = \"character\"))\n", #> "fievel <- .Person(name = \"Fievel\", species = \"mouse\")\n", #> "fievel %@% name\n"), "\n"), `op-na-default.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/operators.R", #> "\n", list("op-na-default"), "\n", list("op-na-default"), #> "\n", list("%|%"), "\n", list("Replace missing values"), #> "\n", list("\n", "x %|% y\n"), "\n", list("\n", #> list(list("x"), list("The original values.")), #> "\n", "\n", list(list("y"), list("The replacement values. Must be of length 1 or the same length as ", #> list("x"), ".")), "\n"), "\n", list("\n", #> "This infix function is similar to ", list( #> "%||%"), " but is vectorised\n", "and provides a default value for missing elements. It is faster\n", #> "than using ", list(list("base::ifelse()")), #> " and does not perform type conversions.\n"), #> "\n", list("\n", "c(\"a\", \"b\", NA, \"c\") %|% \"default\"\n", #> "c(1L, NA, 3L, NA, NA) %|% (6L:10L)\n"), "\n", #> list("\n", list("op-null-default"), "\n"), "\n"), #> `op-null-default.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/operators.R", #> "\n", list("op-null-default"), "\n", list("op-null-default"), #> "\n", list("%||%"), "\n", list("Default value for ", #> list("NULL")), "\n", list("\n", "x %||% y\n"), #> "\n", list("\n", list(list("x, y"), list("If ", #> list("x"), " is NULL, will return ", list("y"), #> "; otherwise returns ", list("x"), ".")), "\n"), #> "\n", list("\n", "This infix function makes it easy to replace ", #> list("NULL"), "s with a default\n", "value. It's inspired by the way that Ruby's or operation (", #> list("||"), ")\n", "works.\n"), "\n", list( #> "\n", "1 %||% 2\n", "NULL %||% 2\n"), "\n"), #> overscope_eval_next.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("overscope_eval_next"), "\n", list( #> "overscope_eval_next"), "\n", list("Evaluate next quosure in a data mask"), #> "\n", list("\n", "overscope_eval_next(overscope, quo, env = base_env())\n"), #> "\n", list("\n", list(list("overscope"), list( #> "A valid overscope containing bindings for ", #> list("~"), ",\n", list(".top_env"), " and ", #> list("_F"), " and whose parents contain overscoped bindings\n", #> "for tidy evaluation.")), "\n", "\n", list( #> list("quo"), list("A quosure.")), "\n", "\n", #> list(list("env"), list("The lexical enclosure in case ", #> list("quo"), " is not a validly\n", "scoped quosure. This is the ", #> list("base environment"), " by\n", "default.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", list("overscope_eval_next()"), #> " is deprecated as of rlang 0.2.0. Please use\n", #> list("eval_tidy()"), " to which you can now supply an overscope.\n"), #> "\n", list("internal"), "\n"), pairlist2.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/call.R", #> "\n", list("pairlist2"), "\n", list("pairlist2"), #> "\n", list("Create pairlists with splicing support"), #> "\n", list("\n", "pairlist2(...)\n"), "\n", list( #> "\n", list(list("..."), list("<", list("dynamic"), #> "> Arguments stored in the\n", "pairlist. Empty arguments are preserved.")), #> "\n"), "\n", list("\n", "This pairlist constructor uses ", #> list("dynamic dots"), ". Use\n", "it to manually create argument lists for calls or parameter lists\n", #> "for functions.\n"), "\n", list("\n", "# Unlike `exprs()`, `pairlist2()` evaluates its arguments.\n", #> "new_function(pairlist2(x = 1, y = 3 * 6), quote(x * y))\n", #> "new_function(exprs(x = 1, y = 3 * 6), quote(x * y))\n", #> "\n", "# It preserves missing arguments, which is useful for creating\n", #> "# parameters without defaults:\n", "new_function(pairlist2(x = , y = 3 * 6), quote(x * y))\n"), #> "\n"), parse_expr.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/parse.R", #> "\n", list("parse_expr"), "\n", list("parse_expr"), #> "\n", list("parse_exprs"), "\n", list("parse_quo"), #> "\n", list("parse_quos"), "\n", list("Parse R code"), #> "\n", list("\n", "parse_expr(x)\n", "\n", "parse_exprs(x)\n", #> "\n", "parse_quo(x, env = global_env())\n", #> "\n", "parse_quos(x, env = global_env())\n"), #> "\n", list("\n", list(list("x"), list("Text containing expressions to parse_expr for\n", #> list("parse_expr()"), " and ", list("parse_exprs()"), #> ". Can also be an R connection,\n", "for instance to a file. If the supplied connection is not open,\n", #> "it will be automatically closed and destroyed.")), #> "\n", "\n", list(list("env"), list("The environment for the quosures. The ", #> list("global environment"), " (the default) may be the right choice\n", #> "when you are parsing external user inputs. You might also want to\n", #> "evaluate the R code in an isolated context (perhaps a child of\n", #> "the global environment or of the ", list( #> "base environment"), ").")), "\n"), "\n", #> list("\n", list("parse_expr()"), " returns an ", #> list("expression"), ",\n", list("parse_exprs()"), #> " returns a list of expressions. Note that for the\n", #> "plural variants the length of the output may be greater than the\n", #> "length of the input. This would happen is one of the strings\n", #> "contain several expressions (such as ", list( #> "\"foo; bar\""), "). The names of\n", list( #> "x"), " are preserved (and recycled in case of multiple expressions).\n", #> "The ", list("_quo"), " suffixed variants return quosures.\n"), #> "\n", list("\n", "These functions parse and transform text into R expressions. This\n", #> "is the first step to interpret or evaluate a piece of R code\n", #> "written by a programmer.\n", list("\n", list(), #> " ", list("parse_expr()"), " returns one expression. If the text contains more\n", #> "than one expression (separated by semicolons or new lines), an\n", #> "error is issued. On the other hand ", list( #> "parse_exprs()"), " can handle\n", "multiple expressions. It always returns a list of expressions\n", #> "(compare to ", list(list("base::parse()")), #> " which returns a base::expression\n", "vector). All functions also support R connections.\n", #> list(), " ", list("parse_quo()"), " and ", #> list("parse_quos()"), " are variants that create a\n", #> list("quosure"), " that inherits from the global environment by\n", #> "default. This is appropriate when you're parsing external user\n", #> "input to be evaluated in user context (rather than the private\n", #> "contexts of your functions).\n", "\n", "Unlike quosures created with ", #> list(list("enquo()")), ", ", list(list("enquos()")), #> ", or ", list("{{"), ", a\n", "parsed quosure never contains injected quosures. It is thus safe\n", #> "to evaluate them with ", list("eval()"), #> " instead of ", list(list("eval_tidy()")), #> ", though\n", "the latter is more convenient as you don't need to extract ", #> list("expr"), "\n", "and ", list("env"), #> ".\n"), "\n"), "\n", list("\n", "# parse_expr() can parse any R expression:\n", #> "parse_expr(\"mtcars %>% dplyr::mutate(cyl_prime = cyl / sd(cyl))\")\n", #> "\n", "# A string can contain several expressions separated by ; or \\n\n", #> "parse_exprs(\"NULL; list()\\n foo(bar)\")\n", #> "\n", "# Use names to figure out which input produced an expression:\n", #> "parse_exprs(c(foo = \"1; 2\", bar = \"3\"))\n", #> "\n", "# You can also parse source files by passing a R connection. Let's\n", #> "# create a file containing R code:\n", "path <- tempfile(\"my-file.R\")\n", #> "cat(\"1; 2; mtcars\", file = path)\n", "\n", #> "# We can now parse it by supplying a connection:\n", #> "parse_exprs(file(path))\n"), "\n", list("\n", #> list(list("base::parse()")), "\n"), "\n"), #> parse_quosure.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("parse_quosure"), "\n", list("parse_quosure"), #> "\n", list("parse_quosures"), "\n", list("Parse text into a quosure"), #> "\n", list("\n", "parse_quosure(x, env = caller_env())\n", #> "\n", "parse_quosures(x, env = caller_env())\n"), #> "\n", list("\n", list(list("x"), list("Text containing expressions to parse_expr for\n", #> list("parse_expr()"), " and ", list("parse_exprs()"), #> ". Can also be an R connection,\n", "for instance to a file. If the supplied connection is not open,\n", #> "it will be automatically closed and destroyed.")), #> "\n", "\n", list(list("env"), list("The environment for the quosures. The ", #> list("global environment"), " (the default) may be the right choice\n", #> "when you are parsing external user inputs. You might also want to\n", #> "evaluate the R code in an isolated context (perhaps a child of\n", #> "the global environment or of the ", list( #> "base environment"), ").")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions were deprecated and renamed to ", #> list(list("parse_quo()")), "\n", "and ", list( #> list("parse_quos()")), " in rlang 0.2.0. This is for consistency with the\n", #> "convention that suffixes indicating return types are not\n", #> "abbreviated.\n"), "\n", list("internal"), #> "\n"), prepend.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("prepend"), "\n", list("prepend"), #> "\n", list("modify"), "\n", list("Prepend a vector"), #> "\n", list("\n", "prepend(x, values, before = 1)\n", #> "\n", "modify(.x, ...)\n"), "\n", list("\n", #> list(list("x"), list("the vector to be modified.")), #> "\n", "\n", list(list("values"), list("to be included in the modified vector.")), #> "\n", "\n", list(list("before"), list("a subscript, before which the values are to be appended.")), #> "\n", "\n", list(list(".x"), list("A vector to modify.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> List of elements to merge into\n", #> list(".x"), ". Named elements already existing in ", #> list(".x"), " are used as\n", "replacements. Elements that have new or no names are inserted at\n", #> "the end.")), "\n"), "\n", list("\n", list( #> "rlang:::lifecycle(\"deprecated\")"), "\n", #> "\n", "Vector functions are now out of scope for rlang. They might be\n", #> "revived in the vctrs or funs packages.\n"), #> "\n", list("internal"), "\n"), prim_name.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/fn.R", #> "\n", list("prim_name"), "\n", list("prim_name"), #> "\n", list("Name of a primitive function"), "\n", #> list("\n", "prim_name(prim)\n"), "\n", list("\n", #> list(list("prim"), list("A primitive function such as ", #> list(list("base::c()")), ".")), "\n"), "\n", #> list("\n", "Name of a primitive function\n"), #> "\n", list("internal"), "\n"), quo_expr.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("quo_expr"), "\n", list("quo_expr"), #> "\n", list("Squash a quosure"), "\n", list("\n", #> "quo_expr(quo, warn = FALSE)\n"), "\n", list( #> "\n", list(list("quo"), list("A quosure or expression.")), #> "\n", "\n", list(list("warn"), list("Whether to warn if the quosure contains other quosures\n", #> "(those will be collapsed). This is useful when you use\n", #> list("quo_squash()"), " in order to make a non-tidyeval API compatible\n", #> "with quosures. In that case, getting rid of the nested quosures\n", #> "is likely to cause subtle bugs and it is good practice to warn\n", #> "the user about it.")), "\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "This function is deprecated, please use ", #> list(list("quo_squash()")), " instead.\n"), #> "\n", list("internal"), "\n"), quo_label.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/quo.R", #> "\n", list("quo_label"), "\n", list("quo_label"), #> "\n", list("quo_text"), "\n", list("quo_name"), #> "\n", list("Format quosures for printing or labelling"), #> "\n", list("\n", "quo_label(quo)\n", "\n", "quo_text(quo, width = 60L, nlines = Inf)\n", #> "\n", "quo_name(quo)\n"), "\n", list("\n", #> list(list("quo"), list("A quosure or expression.")), #> "\n", "\n", list(list("width"), list("Width of each line.")), #> "\n", "\n", list(list("nlines"), list("Maximum number of lines to extract.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", list("Note:"), " You should now use ", #> list(list("as_label()")), " or ", list(list( #> "as_name()")), " instead\n", "of ", list( #> "quo_name()"), ". See life cycle section below.\n", #> "\n", "These functions take an arbitrary R object, typically an\n", #> list("expression"), ", and represent it as a string.\n", #> list("\n", list(), " ", list("quo_name()"), #> " returns an abbreviated representation of the object\n", #> "as a single line string. It is suitable for default names.\n", #> list(), " ", list("quo_text()"), " returns a multiline string. For instance block\n", #> "expressions like ", list("{ foo; bar }"), #> " are represented on 4 lines (one\n", "for each symbol, and the curly braces on their own lines).\n"), #> "\n", "\n", "These deparsers are only suitable for creating default names or\n", #> "printing output at the console. The behaviour of your functions\n", #> "should not depend on deparsed objects. If you are looking for a way\n", #> "of transforming symbols to strings, use ", #> list(list("as_string()")), " instead of\n", #> list("quo_name()"), ". Unlike deparsing, the transformation between symbols\n", #> "and strings is non-lossy and well defined.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "These functions are in the questioning life cycle stage.\n", #> list("\n", list(), " ", list(list("as_label()")), #> " and ", list(list("as_name()")), " should be used instead of\n", #> list("quo_name()"), ". ", list("as_label()"), #> " transforms any R object to a string\n", #> "but should only be used to create a default name. Labelisation is\n", #> "not a well defined operation and no assumption should be made\n", #> "about the label. On the other hand, ", list( #> "as_name()"), " only works with\n", "(possibly quosured) symbols, but is a well defined and\n", #> "deterministic operation.\n", list(), " We don't have a good replacement for ", #> list("quo_text()"), " yet. See\n", list("https://github.com/r-lib/rlang/issues/636"), #> " to follow discussions\n", "about a new deparsing API.\n"), #> "\n")), "\n", "\n", list("\n", "# Quosures can contain nested quosures:\n", #> "quo <- quo(foo(!! quo(bar)))\n", "quo\n", #> "\n", "# quo_squash() unwraps all quosures and returns a raw expression:\n", #> "quo_squash(quo)\n", "\n", "# This is used by quo_text() and quo_label():\n", #> "quo_text(quo)\n", "\n", "# Compare to the unwrapped expression:\n", #> "expr_text(quo)\n", "\n", "# quo_name() is helpful when you need really short labels:\n", #> "quo_name(quo(sym))\n", "quo_name(quo(!! sym))\n"), #> "\n", list("\n", list(list("expr_label()")), #> ", ", list(list("f_label()")), "\n"), "\n"), #> quo_squash.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/quo.R", #> "\n", list("quo_squash"), "\n", list("quo_squash"), #> "\n", list("Squash a quosure"), "\n", list("\n", #> "quo_squash(quo, warn = FALSE)\n"), "\n", list( #> "\n", list(list("quo"), list("A quosure or expression.")), #> "\n", "\n", list(list("warn"), list("Whether to warn if the quosure contains other quosures\n", #> "(those will be collapsed). This is useful when you use\n", #> list("quo_squash()"), " in order to make a non-tidyeval API compatible\n", #> "with quosures. In that case, getting rid of the nested quosures\n", #> "is likely to cause subtle bugs and it is good practice to warn\n", #> "the user about it.")), "\n"), "\n", list( #> "\n", list("quo_squash()"), " flattens all nested quosures within an expression.\n", #> "For example it transforms ", list("^foo(^bar(), ^baz)"), #> " to the bare\n", "expression ", list("foo(bar(), baz)"), #> ".\n", "\n", "This operation is safe if the squashed quosure is used for\n", #> "labelling or printing (see ", list(list("quo_label()")), #> " or ", list(list("quo_name()")), "). However\n", #> "if the squashed quosure is evaluated, all expressions of the\n", #> "flattened quosures are resolved in a single environment. This is a\n", #> "source of bugs so it is good practice to set ", #> list("warn"), " to ", list("TRUE"), " to\n", #> "let the user know about the lossy squashing.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "This function replaces ", list("quo_expr()"), #> " which was deprecated in\n", "rlang 0.2.0. ", #> list("quo_expr()"), " was a misnomer because it implied that it\n", #> "was a mere expression acccessor for quosures whereas it was really\n", #> "a lossy operation that squashed all nested quosures.\n")), #> "\n", "\n", list("\n", "# Quosures can contain nested quosures:\n", #> "quo <- quo(wrapper(!!quo(wrappee)))\n", "quo\n", #> "\n", "# quo_squash() flattens all the quosures and returns a simple expression:\n", #> "quo_squash(quo)\n"), "\n"), quosure.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/quo.R", #> "\n", list("quosure"), "\n", list("quosure"), #> "\n", list("is_quosure"), "\n", list("quo_is_missing"), #> "\n", list("quo_is_symbol"), "\n", list("quo_is_call"), #> "\n", list("quo_is_symbolic"), "\n", list("quo_is_null"), #> "\n", list("quo_get_expr"), "\n", list("quo_get_env"), #> "\n", list("quo_set_expr"), "\n", list("quo_set_env"), #> "\n", list("Quosure getters, setters and testers"), #> "\n", list("\n", "is_quosure(x)\n", "\n", "quo_is_missing(quo)\n", #> "\n", "quo_is_symbol(quo, name = NULL)\n", #> "\n", "quo_is_call(quo, name = NULL, n = NULL, ns = NULL)\n", #> "\n", "quo_is_symbolic(quo)\n", "\n", "quo_is_null(quo)\n", #> "\n", "quo_get_expr(quo)\n", "\n", "quo_get_env(quo)\n", #> "\n", "quo_set_expr(quo, expr)\n", "\n", "quo_set_env(quo, env)\n"), #> "\n", list("\n", list(list("x"), list("An object to test.")), #> "\n", "\n", list(list("quo"), list("A quosure to test.")), #> "\n", "\n", list(list("name"), list("The name of the symbol or function call. If ", #> list("NULL"), " the\n", "name is not tested.")), #> "\n", "\n", list(list("n"), list("An optional number of arguments that the call should\n", #> "match.")), "\n", "\n", list(list("ns"), #> list("The namespace of the call. If ", list( #> "NULL"), ", the namespace\n", "doesn't participate in the pattern-matching. If an empty string\n", #> list("\"\""), " and ", list("x"), " is a namespaced call, ", #> list("is_call()"), " returns\n", list("FALSE"), #> ". If any other string, ", list("is_call()"), #> " checks that ", list("x"), " is\n", "namespaced within ", #> list("ns"), ".\n", "\n", "Can be a character vector of namespaces, in which case the call\n", #> "has to match at least one of them, otherwise ", #> list("is_call()"), " returns\n", list("FALSE"), #> ".")), "\n", "\n", list(list("expr"), list( #> "A new expression for the quosure.")), "\n", #> "\n", list(list("env"), list("A new environment for the quosure.")), #> "\n"), "\n", list("\n", "A quosure is a type of ", #> list("quoted expression"), " that includes\n", #> "a reference to the context where it was created. A quosure is thus\n", #> "guaranteed to evaluate in its original environment and can refer to\n", #> "local objects.\n", "\n", "You can access the quosure components (its expression and its\n", #> "environment) with:\n", list("\n", list(), #> " ", list(list("get_expr()")), " and ", list( #> list("get_env()")), ". These getters also support other\n", #> "kinds of objects such as formulas.\n", list(), #> " ", list("quo_get_expr()"), " and ", list( #> "quo_get_env()"), ". These getters only work\n", #> "with quosures and throw an error with other types of input.\n"), #> "\n", "\n", "Test if an object is a quosure with ", #> list("is_quosure()"), ". If you know an\n", #> "object is a quosure, use the ", list("quo_"), #> " prefixed predicates to check\n", "its contents, ", #> list("quo_is_missing()"), ", ", list("quo_is_symbol()"), #> ", etc.\n"), "\n", list(list("Quosured constants"), #> list("\n", "\n", "\n", "A quosure usually does not carry environments for ", #> list("constant objects"), " like strings or numbers. ", #> list(list("quo()")), " and\n", list(list( #> "enquo()")), " only capture an environment for ", #> list("symbolic expressions"), ". For instance, all of these return the\n", #> list("empty environment"), ":", list("quo_get_env(quo(\"constant\"))\n", #> "quo_get_env(quo(100))\n", "quo_get_env(quo(NA))\n"), #> "\n", "\n", "On the other hand, quosures capture the environment of symbolic\n", #> "expressions, i.e. expressions whose meaning depends on the\n", #> "environment in which they are evaluated and what objects are\n", #> "defined there:", list("quo_get_env(quo(some_object))\n", #> "quo_get_env(quo(some_function()))\n"), #> "\n")), "\n", "\n", list(list("Empty quosures"), #> list("\n", "\n", "\n", "When missing arguments are captured as quosures, either through\n", #> list(list("enquo()")), " or ", list(list( #> "quos()")), ", they are returned as an empty quosure. These\n", #> "quosures contain the ", list("missing argument"), #> " and typically\n", "have the ", list("empty environment"), #> " as enclosure.\n")), "\n", "\n", list(list( #> "Life cycle"), list("\n", "\n", list("\n", #> list(), " ", list("is_quosure()"), " is stable.\n", #> list(), " ", list("quo_get_expr()"), " and ", #> list("quo_get_env()"), " are stable.\n"), "\n")), #> "\n", "\n", list("\n", "quo <- quo(my_quosure)\n", #> "quo\n", "\n", "\n", "# Access and set the components of a quosure:\n", #> "quo_get_expr(quo)\n", "quo_get_env(quo)\n", #> "\n", "quo <- quo_set_expr(quo, quote(baz))\n", #> "quo <- quo_set_env(quo, empty_env())\n", "quo\n", #> "\n", "# Test wether an object is a quosure:\n", #> "is_quosure(quo)\n", "\n", "# If it is a quosure, you can use the specialised type predicates\n", #> "# to check what is inside it:\n", "quo_is_symbol(quo)\n", #> "quo_is_call(quo)\n", "quo_is_null(quo)\n", #> "\n", "# quo_is_missing() checks for a special kind of quosure, the one\n", #> "# that contains the missing argument:\n", #> "quo()\n", "quo_is_missing(quo())\n", "\n", #> "fn <- function(arg) enquo(arg)\n", "fn()\n", #> "quo_is_missing(fn())\n"), "\n", list("\n", #> list(list("quo()")), " for creating quosures by quotation; ", #> list(list("as_quosure()")), "\n", "and ", list( #> list("new_quosure()")), " for constructing quosures manually.\n"), #> "\n"), raw_deparse_str.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/raw.R", #> "\n", list("raw_deparse_str"), "\n", list("raw_deparse_str"), #> "\n", list("Serialize a raw vector to a string"), #> "\n", list("\n", "raw_deparse_str(x, prefix = NULL, suffix = NULL)\n"), #> "\n", list("\n", list(list("x"), list("A raw vector.")), #> "\n", "\n", list(list("prefix, suffix"), list( #> "Prefix and suffix strings, or `NULL.")), #> "\n"), "\n", list("\n", "A string.\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "This function converts a raw vector to a hexadecimal string,\n", #> "optionally adding a prefix and a suffix.\n", #> "It is roughly equivalent to\n", list("paste0(prefix, paste(format(x), collapse = \"\"), suffix)"), #> "\n", "and much faster.\n"), "\n", list("\n", #> "raw_deparse_str(raw())\n", "raw_deparse_str(charToRaw(\"string\"))\n", #> "raw_deparse_str(raw(10), prefix = \"'0x\", suffix = \"'\")\n"), #> "\n"), rep_along.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-new.R", #> "\n", list("rep_along"), "\n", list("rep_along"), #> "\n", list("rep_named"), "\n", list("Create vectors matching the length of a given vector"), #> "\n", list("\n", "rep_along(along, x)\n", "\n", #> "rep_named(names, x)\n"), "\n", list("\n", #> list(list("along"), list("Vector whose length determine how many times ", #> list("x"), "\n", "is repeated.")), "\n", #> "\n", list(list("x"), list("Values to repeat.")), #> "\n", "\n", list(list("names"), list("Names for the new vector. The length of ", #> list("names"), "\n", "determines how many times ", #> list("x"), " is repeated.")), "\n"), "\n", #> list("\n", "These functions take the idea of ", #> list(list("seq_along()")), " and apply it to\n", #> "repeating values.\n"), "\n", list("\n", "x <- 0:5\n", #> "rep_along(x, 1:2)\n", "rep_along(x, 1)\n", #> "\n", "# Create fresh vectors by repeating missing values:\n", #> "rep_along(x, na_int)\n", "rep_along(x, na_chr)\n", #> "\n", "# rep_named() repeats a value along a names vectors\n", #> "rep_named(c(\"foo\", \"bar\"), list(letters))\n"), #> "\n", list("\n", "new-vector\n"), "\n"), restarting.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-handlers.R", #> "\n", list("restarting"), "\n", list("restarting"), #> "\n", list("Create a restarting handler"), "\n", #> list("\n", "restarting(.restart, ..., .fields = NULL)\n"), #> "\n", list("\n", list(list(".restart"), list( #> "The name of a restart.")), "\n", "\n", list( #> list("..."), list("<", list("dynamic"), "> Additional arguments passed on\n", #> "the restart function. These arguments are evaluated only once\n", #> "and immediately, when creating the restarting handler.")), #> "\n", "\n", list(list(".fields"), list("A character vector specifying the fields of the\n", #> "condition that should be passed as arguments to the restart. If\n", #> "named, the names (except empty names ", #> list("\"\""), ") are used as\n", "argument names for calling the restart function. Otherwise the\n", #> "the fields themselves are used as argument names.")), #> "\n"), "\n", list("\n", "This constructor automates the common task of creating an\n", #> list(list("calling()")), " handler that invokes a restart.\n"), #> "\n", list("\n", "Jumping to a restart point from a calling handler has two\n", #> "effects. First, the control flow jumps to wherever the restart was\n", #> "established, and the restart function is called (with ", #> list("..."), ", or\n", list(".fields"), " as arguments). Execution resumes from the\n", #> list(list("with_restarts()")), " call. Secondly, the transfer of the control flow\n", #> "out of the function that signalled the condition means that the\n", #> "handler has dealt with the condition. Thus the condition will not\n", #> "be passed on to other potential handlers established on the stack.\n"), #> "\n", list("\n", "# This is a restart that takes a data frame and names as arguments\n", #> "rst_bar <- function(df, nms) {\n", " stats::setNames(df, nms)\n", #> "}\n", "\n", "# This restart is simpler and does not take arguments\n", #> "rst_baz <- function() \"baz\"\n", "\n", "# Signalling a condition parameterised with a data frame\n", #> "fn <- function() {\n", " with_restarts(signal(\"A foobar condition occurred\", \"foo\", foo_field = mtcars),\n", #> " rst_bar = rst_bar,\n", " rst_baz = rst_baz\n", #> " )\n", "}\n", "\n", "# Creating a restarting handler that passes arguments `nms` and\n", #> "# `df`, the latter taken from a data field of the condition object\n", #> "restart_bar <- restarting(\"rst_bar\",\n", #> " nms = LETTERS[1:11], .fields = c(df = \"foo_field\")\n", #> ")\n", "\n", "# The restarting handlers jumps to `rst_bar` when `foo` is signalled:\n", #> "with_handlers(fn(), foo = restart_bar)\n", #> "\n", "# The restarting() constructor is especially nice to use with\n", #> "# restarts that do not need arguments:\n", #> "with_handlers(fn(), foo = restarting(\"rst_baz\"))\n"), #> "\n", list("\n", list(list("calling()")), " and ", #> list(list("exiting()")), ".\n"), "\n", list( #> "internal"), "\n"), return_from.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/stack.R", #> "\n", list("return_from"), "\n", list("return_from"), #> "\n", list("return_to"), "\n", list("Jump to or from a frame"), #> "\n", list("\n", "return_from(frame, value = NULL)\n", #> "\n", "return_to(frame, value = NULL)\n"), #> "\n", list("\n", list(list("frame"), list("An environment, a frame object, or any object with an\n", #> list(list("get_env()")), " method. The environment should be an evaluation\n", #> "environment currently on the stack.")), "\n", #> "\n", list(list("value"), list("The return value.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "While ", list(list("base::return()")), #> " can only return from the current local\n", #> "frame, these two functions will return from any frame on the\n", #> "current evaluation stack, between the global and the currently\n", #> "active context. They provide a way of performing arbitrary\n", #> "non-local jumps out of the function currently under evaluation.\n"), #> "\n", list("\n", list("return_from()"), " will jump out of ", #> list("frame"), ". ", list("return_to()"), " is a bit\n", #> "trickier. It will jump out of the frame located just before ", #> list("frame"), "\n", "in the evaluation stack, so that control flow ends up in ", #> list("frame"), ",\n", "at the location where the previous frame was called from.\n", #> "\n", "These functions should only be used rarely. These sort of non-local\n", #> "gotos can be hard to reason about in casual code, though they can\n", #> "sometimes be useful. Also, consider to use the condition system to\n", #> "perform non-local jumps.\n"), "\n", list(list( #> "Life cycle"), list("\n", "\n", "\n", "The support for ", #> list("frame"), " object is soft-deprecated. Please pass\n", #> "simple environments to ", list("return_from()"), #> " and ", list("return_to()"), ".\n", "\n", #> "These functions are in the questioning lifecycle because we are\n", #> "considering simpler alternatives.\n")), "\n", #> "\n", list("\n", "# Passing fn() evaluation frame to g():\n", #> "fn <- function() {\n", " val <- g(current_env())\n", #> " cat(\"g returned:\", val, \"\\n\")\n", " \"normal return\"\n", #> "}\n", "g <- function(env) h(env)\n", "\n", #> "# Here we return from fn() with a new return value:\n", #> "h <- function(env) return_from(env, \"early return\")\n", #> "fn()\n", "\n", "# Here we return to fn(). The call stack unwinds until the last frame\n", #> "# called by fn(), which is g() in that case.\n", #> "h <- function(env) return_to(env, \"early return\")\n", #> "fn()\n"), "\n", list("internal"), "\n"), rlang_backtrace_on_error.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-abort.R", #> "\n", list("rlang_backtrace_on_error"), "\n", #> list("rlang_backtrace_on_error"), "\n", list( #> "add_backtrace"), "\n", list("Display backtrace on error"), #> "\n", list("\n", "Errors thrown with ", list( #> list("abort()")), " automatically save a backtrace that\n", #> "can be inspected by calling ", list(list("last_error()")), #> ". Optionally, you can\n", "also display the backtrace alongside the error message by setting\n", #> "the option ", list("rlang_backtrace_on_error"), #> " to one of the following\n", "values:\n", #> list("\n", list(), " ", list("\"reminder\""), #> ": Display a reminder that the backtrace can be\n", #> "inspected by calling ", list(list("last_error()")), #> ".\n", list(), " ", list("\"branch\""), ": Display a simplified backtrace.\n", #> list(), " ", list("\"collapse\""), ": Display a collapsed backtrace tree.\n", #> list(), " ", list("\"full\""), ": Display the full backtrace tree.\n"), #> "\n"), "\n", list(list("Promote base errors to rlang errors"), #> list("\n", "\n", "\n", "Call ", list("options(error = rlang::entrace)"), #> " to instrument base\n", "errors with rlang features. This handler does two things:\n", #> list("\n", list(), " It saves the base error as an rlang object. This allows you to\n", #> "call ", list(list("last_error()")), " to print the backtrace or inspect its data.\n", #> list(), " It prints the backtrace for the current error according to the\n", #> list("rlang_backtrace_on_error"), " option.\n"), #> "\n")), "\n", "\n", list("\n", "# Display a simplified backtrace on error for both base and rlang\n", #> "# errors:\n", "\n", "# options(\n", "# rlang_backtrace_on_error = \"branch\",\n", #> "# error = rlang::entrace\n", "# )\n", "# stop(\"foo\")\n"), #> "\n"), rst_abort.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-restarts.R", #> "\n", list("rst_abort"), "\n", list("rst_abort"), #> "\n", list("Jump to the abort restart"), "\n", #> list("\n", "rst_abort()\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "The abort restart is the only restart that is established at top\n", #> "level. It is used by R as a top-level target, most notably when an\n", #> "error is issued (see ", list(list("abort()")), #> ") that no handler is able\n", "to deal with (see ", #> list(list("with_handlers()")), ").\n"), "\n", #> list(list("Life cycle"), list("\n", "\n", "\n", #> "All the restart functions are in the questioning stage. It is not\n", #> "clear yet whether we want to recommend restarts as a style of\n", #> "programming in R.\n")), "\n", "\n", list("\n", #> "# The `abort` restart is a bit special in that it is always\n", #> "# registered in a R session. You will always find it on the restart\n", #> "# stack because it is established at top level:\n", #> "rst_list()\n", "\n", "# You can use the `above` restart to jump to top level without\n", #> "# signalling an error:\n", list("\n", "fn <- function() {\n", #> " cat(\"aborting...\\n\")\n", " rst_abort()\n", #> " cat(\"This is never called\\n\")\n", "}\n", #> "{\n", " fn()\n", " cat(\"This is never called\\n\")\n", #> "}\n"), "\n", "\n", "# The `above` restart is the target that R uses to jump to top\n", #> "# level when critical errors are signalled:\n", #> list("\n", "{\n", " abort(\"error\")\n", " cat(\"This is never called\\n\")\n", #> "}\n"), "\n", "\n", "# If another `abort` restart is specified, errors are signalled as\n", #> "# usual but then control flow resumes with from the new restart:\n", #> list("\n", "out <- NULL\n", "{\n", " out <- with_restarts(abort(\"error\"), abort = function() \"restart!\")\n", #> " cat(\"This is called\\n\")\n", "}\n", #> "cat(\"`out` has now become:\", out, \"\\n\")\n"), #> "\n"), "\n", list("\n", list(list("rst_jump()")), #> ", ", list(list("abort()")), "\n"), "\n", list( #> "internal"), "\n"), rst_list.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-restarts.R", #> "\n", list("rst_list"), "\n", list("rst_list"), #> "\n", list("rst_exists"), "\n", list("rst_jump"), #> "\n", list("rst_maybe_jump"), "\n", list("Restarts utilities"), #> "\n", list("\n", "rst_list()\n", "\n", "rst_exists(.restart)\n", #> "\n", "rst_jump(.restart, ...)\n", "\n", "rst_maybe_jump(.restart, ...)\n"), #> "\n", list("\n", list(list(".restart"), list( #> "The name of a restart.")), "\n", "\n", list( #> list("..."), list("<", list("dynamic"), "> Arguments passed on to the\n", #> "restart function.")), "\n"), "\n", list( #> "\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "Restarts are named jumping points established by ", #> list(list("with_restarts()")), ".\n", list( #> "rst_list()"), " returns the names of all restarts currently\n", #> "established. ", list("rst_exists()"), " checks if a given restart is\n", #> "established. ", list("rst_jump()"), " stops execution of the current function\n", #> "and jumps to a restart point. If the restart does not exist, an\n", #> "error is thrown. ", list("rst_maybe_jump()"), #> " first checks that a restart\n", "exists before jumping.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "All the restart functions are in the questioning stage. It is not\n", #> "clear yet whether we want to recommend restarts as a style of\n", #> "programming in R.\n")), "\n", "\n", list("\n", #> list(list("with_restarts()")), "\n"), "\n", #> list("internal"), "\n"), `scalar-type-predicates.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("scalar-type-predicates"), "\n", list( #> "scalar-type-predicates"), "\n", list("is_scalar_list"), #> "\n", list("is_scalar_atomic"), "\n", list("is_scalar_vector"), #> "\n", list("is_scalar_integer"), "\n", list("is_scalar_double"), #> "\n", list("is_scalar_character"), "\n", list( #> "is_scalar_logical"), "\n", list("is_scalar_raw"), #> "\n", list("is_string"), "\n", list("is_scalar_bytes"), #> "\n", list("is_bool"), "\n", list("Scalar type predicates"), #> "\n", list("\n", "is_scalar_list(x)\n", "\n", #> "is_scalar_atomic(x)\n", "\n", "is_scalar_vector(x)\n", #> "\n", "is_scalar_integer(x)\n", "\n", "is_scalar_double(x)\n", #> "\n", "is_scalar_character(x)\n", "\n", "is_scalar_logical(x)\n", #> "\n", "is_scalar_raw(x)\n", "\n", "is_string(x, string = NULL)\n", #> "\n", "is_scalar_bytes(x)\n", "\n", "is_bool(x)\n"), #> "\n", list("\n", list(list("x"), list("object to be tested.")), #> "\n", "\n", list(list("string"), list("A string to compare to ", #> list("x"), ". If a character vector,\n", #> "returns ", list("TRUE"), " if at least one element is equal to ", #> list("x"), ".")), "\n"), "\n", list("\n", #> "These predicates check for a given type and whether the vector is\n", #> "\"scalar\", that is, of length 1.\n", "\n", #> "In addition to the length check, ", list("is_string()"), #> " and ", list("is_bool()"), "\n", "return ", #> list("FALSE"), " if their input is missing. This is useful for\n", #> "type-checking arguments, when your function expects a single string\n", #> "or a single ", list("TRUE"), " or ", list( #> "FALSE"), ".\n"), "\n", list("\n", list("type-predicates"), #> ", ", list("bare-type-predicates"), "\n"), #> "\n"), scoped_env.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("scoped_env"), "\n", list("scoped_env"), #> "\n", list("is_scoped"), "\n", list("scoped_envs"), #> "\n", list("scoped_names"), "\n", list("Retired ", #> list("scoped"), " functions"), "\n", list("\n", #> "scoped_env(nm)\n", "\n", "is_scoped(nm)\n", #> "\n", "scoped_envs()\n", "\n", "scoped_names()\n"), #> "\n", list("\n", list(list("nm"), list("The name of an environment attached to the search\n", #> "path. Call ", list(list("base::search()")), #> " to see what is currently on the path.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions are deprecated as of rlang 0.3.0. They are replaced\n", #> "by ", list(list("is_attached()")), ", ...\n"), #> "\n", list("internal"), "\n"), scoped_interactive.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("scoped_interactive"), "\n", list( #> "scoped_interactive"), "\n", list("scoped_options"), #> "\n", list("scoped_bindings"), "\n", list("Questioning ", #> list("scoped_"), " functions"), "\n", list( #> "\n", "scoped_interactive(value = TRUE, frame = caller_env())\n", #> "\n", "scoped_options(..., .frame = caller_env())\n", #> "\n", "scoped_bindings(..., .env = .frame, .frame = caller_env())\n"), #> "\n", list("\n", list(list("value"), list("A single ", #> list("TRUE"), " or ", list("FALSE"), ". This overrides the return\n", #> "value of ", list("is_interactive()"), ".")), #> "\n", "\n", list(list("frame"), list("The environment of a running function which defines\n", #> "the scope of the temporary options. When the function returns,\n", #> "the options are reset to their original values.")), #> "\n", "\n", list(list("..."), list("For ", #> list("local_options()"), " and ", list("push_options()"), #> ", named\n", "values defining new option values. For ", #> list("peek_options()"), ", strings\n", "or character vectors of option names.")), #> "\n", "\n", list(list(".frame"), list("The environment of a running function which defines\n", #> "the scope of the temporary options. When the function returns,\n", #> "the options are reset to their original values.")), #> "\n", "\n", list(list(".env"), list("An environment.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "These functions have been renamed to use the conventional ", #> list("local_"), "\n", "prefix. They will be deprecated in the next minor version of rlang.\n"), #> "\n"), search_envs.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/env-special.R", #> "\n", list("search_envs"), "\n", list("search_envs"), #> "\n", list("search_env"), "\n", list("pkg_env"), #> "\n", list("pkg_env_name"), "\n", list("is_attached"), #> "\n", list("base_env"), "\n", list("global_env"), #> "\n", list("Search path environments"), "\n", #> list("\n", "search_envs()\n", "\n", "search_env(name)\n", #> "\n", "pkg_env(pkg)\n", "\n", "pkg_env_name(pkg)\n", #> "\n", "is_attached(x)\n", "\n", "base_env()\n", #> "\n", "global_env()\n"), "\n", list("\n", list( #> list("name"), list("The name of an environment attached to the search\n", #> "path. Call ", list(list("base::search()")), #> " to get the names of environments\n", "currently attached to the search path. Note that the search name\n", #> "of a package environment is prefixed with ", #> list("\"package:\""), ".")), "\n", "\n", #> list(list("pkg"), list("The name of a package.")), #> "\n", "\n", list(list("x"), list("An environment or a search name.")), #> "\n"), "\n", list("\n", "The search path is a chain of environments containing exported\n", #> "functions of attached packages.\n", "\n", #> "The API includes:\n", list("\n", list(), " ", #> list(list("base::search()")), " to get the names of environments attached to the\n", #> "search path.\n", list(), " ", list("search_envs()"), #> " returns the environments on the search path as a\n", #> "list.\n", list(), " ", list("pkg_env_name()"), #> " takes a bare package name and prefixes it with\n", #> list("\"package:\""), ". Attached package environments have search names of\n", #> "the form ", list("package:name"), ".\n", #> list(), " ", list("pkg_env()"), " takes a bare package name and returns the scoped\n", #> "environment of packages if they are attached to the search path,\n", #> "and throws an error otherwise. It is a shortcut for\n", #> list("search_env(pkg_env_name(\"pkgname\"))"), #> ".\n", list(), " ", list("global_env()"), #> " and ", list("base_env()"), " (simple aliases for ", #> list(list("globalenv()")), "\n", "and ", #> list(list("baseenv()")), "). These are respectively the first and last\n", #> "environments of the search path.\n", list(), #> " ", list("is_attached()"), " returns ", #> list("TRUE"), " when its argument (a search name\n", #> "or a package environment) is attached to the search path.\n"), #> "\n"), "\n", list(list("The search path"), #> list("\n", "\n", "\n", "This chain of environments determines what objects are visible from\n", #> "the global workspace. It contains the following elements:\n", #> list("\n", list(), " The chain always starts with ", #> list("global_env()"), " and finishes with\n", #> list("base_env()"), " which inherits from the terminal environment\n", #> list("empty_env()"), ".\n", list(), " Each ", #> list(list("base::library()")), " call attaches a new package environment to\n", #> "the search path. Attached packages are associated with a ", #> list("search name"), ".\n", list(), " In addition, any list, data frame, or environment can be attached\n", #> "to the search path with ", list(list("base::attach()")), #> ".\n"), "\n")), "\n", "\n", list("\n", #> "# List the search names of environments attached to the search path:\n", #> "search()\n", "\n", "# Get the corresponding environments:\n", #> "search_envs()\n", "\n", "# The global environment and the base package are always first and\n", #> "# last in the chain, respectively:\n", "envs <- search_envs()\n", #> "envs[[1]]\n", "envs[[length(envs)]]\n", "\n", #> "# These two environments have their own shortcuts:\n", #> "global_env()\n", "base_env()\n", "\n", "# Packages appear in the search path with a special name. Use\n", #> "# pkg_env_name() to create that name:\n", #> "pkg_env_name(\"rlang\")\n", "search_env(pkg_env_name(\"rlang\"))\n", #> "\n", "# Alternatively, get the scoped environment of a package with\n", #> "# pkg_env():\n", "pkg_env(\"utils\")\n"), #> "\n", list("internal"), "\n"), seq2.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec.R", #> "\n", list("seq2"), "\n", list("seq2"), "\n", #> list("seq2_along"), "\n", list("Increasing sequence of integers in an interval"), #> "\n", list("\n", "seq2(from, to)\n", "\n", "seq2_along(from, x)\n"), #> "\n", list("\n", list(list("from"), list("The starting point of the sequence.")), #> "\n", "\n", list(list("to"), list("The end point.")), #> "\n", "\n", list(list("x"), list("A vector whose length is the end point.")), #> "\n"), "\n", list("\n", "An integer vector containing a strictly increasing\n", #> "sequence.\n"), "\n", list("\n", "These helpers take two endpoints and return the sequence of all\n", #> "integers within that interval. For ", list( #> "seq2_along()"), ", the upper\n", "endpoint is taken from the length of a vector. Unlike\n", #> list("base::seq()"), ", they return an empty vector if the starting point is\n", #> "a larger integer than the end point.\n"), #> "\n", list("\n", "seq2(2, 10)\n", "seq2(10, 2)\n", #> "seq(10, 2)\n", "\n", "seq2_along(10, letters)\n"), #> "\n"), set_attrs.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("set_attrs"), "\n", list("set_attrs"), #> "\n", list("mut_attrs"), "\n", list("Add attributes to an object"), #> "\n", list("\n", "set_attrs(.x, ...)\n", "\n", #> "mut_attrs(.x, ...)\n"), "\n", list("\n", list( #> list(".x"), list("An object to decorate with attributes.")), #> "\n", "\n", list(list("..."), list("<", list( #> "dynamic"), "> A list of named attributes. Pass\n", #> "a single unnamed ", list("NULL"), " argument to zap all attributes from ", #> list(".x"), ".")), "\n"), "\n", list("\n", #> list("set_attrs()"), " returns a modified ", #> list("shallow copy"), "\n", "of ", list(".x"), #> ". ", list("mut_attrs()"), " invisibly returns the original ", #> list(".x"), "\n", "modified in place.\n"), #> "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", list("set_attrs()"), " adds, changes, or zaps attributes of objects. Pass a\n", #> "single unnamed ", list("NULL"), " argument to zap all attributes. For\n", #> list("uncopyable"), " types, use ", list("mut_attrs()"), #> ".\n"), "\n", list("\n", "Unlike ", list(list( #> "structure()")), ", these setters have no special handling of\n", #> "internal attributes names like ", list(".Dim"), #> ", ", list(".Dimnames"), " or ", list(".Names"), #> ".\n"), "\n", list(list("Life cycle"), list( #> "\n", "\n", "\n", "These functions are deprecated since rlang 0.3.0.\n")), #> "\n", "\n", list("\n", "set_attrs(letters, names = 1:26, class = \"my_chr\")\n", #> "\n", "# Splice a list of attributes:\n", "attrs <- list(attr = \"attr\", names = 1:26, class = \"my_chr\")\n", #> "obj <- set_attrs(letters, splice(attrs))\n", #> "obj\n", "\n", "# Zap attributes by passing a single unnamed NULL argument:\n", #> "set_attrs(obj, NULL)\n", "set_attrs(obj, !!! list(NULL))\n", #> "\n", "# Note that set_attrs() never modifies objects in place:\n", #> "obj\n", "\n", "# For uncopyable types, mut_attrs() lets you modify in place:\n", #> "env <- env()\n", "mut_attrs(env, foo = \"bar\")\n", #> "env\n"), "\n", list("internal"), "\n"), set_expr.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/expr.R", #> "\n", list("set_expr"), "\n", list("set_expr"), #> "\n", list("get_expr"), "\n", list("Set and get an expression"), #> "\n", list("\n", "set_expr(x, value)\n", "\n", #> "get_expr(x, default = x)\n"), "\n", list("\n", #> list(list("x"), list("An expression, closure, or one-sided formula. In addition,\n", #> list("set_expr()"), " accept frames.")), #> "\n", "\n", list(list("value"), list("An updated expression.")), #> "\n", "\n", list(list("default"), list("A default expression to return when ", #> list("x"), " is not an\n", "expression wrapper. Defaults to ", #> list("x"), " itself.")), "\n"), "\n", list( #> "\n", "The updated original input for ", list( #> "set_expr()"), ". A raw\n", "expression for ", #> list("get_expr()"), ".\n"), "\n", list("\n", #> "These helpers are useful to make your function work generically\n", #> "with quosures and raw expressions. First call ", #> list("get_expr()"), " to\n", "extract an expression. Once you're done processing the expression,\n", #> "call ", list("set_expr()"), " on the original object to update the expression.\n", #> "You can return the result of ", list("set_expr()"), #> ", either a formula or an\n", "expression depending on the input type. Note that ", #> list("set_expr()"), " does\n", "not change its input, it creates a new object.\n"), #> "\n", list("\n", "f <- ~foo(bar)\n", "e <- quote(foo(bar))\n", #> "frame <- identity(identity(ctxt_frame()))\n", #> "\n", "get_expr(f)\n", "get_expr(e)\n", "get_expr(frame)\n", #> "\n", "set_expr(f, quote(baz))\n", "set_expr(e, quote(baz))\n"), #> "\n", list("\n", list(list("quo_get_expr()")), #> " and ", list(list("quo_set_expr()")), " for versions of\n", #> list(list("get_expr()")), " and ", list(list( #> "set_expr()")), " that only work on quosures.\n"), #> "\n"), set_names.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("set_names"), "\n", list("set_names"), #> "\n", list("Set names of a vector"), "\n", list( #> "\n", "set_names(x, nm = x, ...)\n"), "\n", #> list("\n", list(list("x"), list("Vector to name.")), #> "\n", "\n", list(list("nm, ..."), list("Vector of names, the same length as ", #> list("x"), ".\n", "\n", "You can specify names in the following ways:\n", #> list("\n", list(), " If you do nothing, ", #> list("x"), " will be named with itself.\n", #> list(), " If ", list("x"), " already has names, you can provide a function or formula\n", #> "to transform the existing names. In that case, ", #> list("..."), " is passed\n", "to the function.\n", #> list(), " If ", list("nm"), " is ", list( #> "NULL"), ", the names are removed (if present).\n", #> list(), " In all other cases, ", list("nm"), #> " and ", list("..."), " are coerced to character.\n"))), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"stable\")"), #> "\n", "\n", "This is equivalent to ", list( #> list("stats::setNames()")), ", with more features and\n", #> "stricter argument checking.\n"), "\n", list( #> list("Life cycle"), list("\n", "\n", "\n", #> list("set_names()"), " is stable and exported in purrr.\n")), #> "\n", "\n", list("\n", "set_names(1:4, c(\"a\", \"b\", \"c\", \"d\"))\n", #> "set_names(1:4, letters[1:4])\n", "set_names(1:4, \"a\", \"b\", \"c\", \"d\")\n", #> "\n", "# If the second argument is ommitted a vector is named with itself\n", #> "set_names(letters[1:5])\n", "\n", "# Alternatively you can supply a function\n", #> "set_names(1:10, ~ letters[seq_along(.)])\n", #> "set_names(head(mtcars), toupper)\n", "\n", #> "# If the input vector is unnamed, it is first named after itself\n", #> "# before the function is applied:\n", "set_names(letters, toupper)\n", #> "\n", "# `...` is passed to the function:\n", #> "set_names(head(mtcars), paste0, \"_foo\")\n"), #> "\n"), splice.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/dots.R", #> "\n", list("splice"), "\n", list("splice"), "\n", #> list("is_spliced"), "\n", list("is_spliced_bare"), #> "\n", list("dots_splice"), "\n", list("Splice lists"), #> "\n", list("\n", "splice(x)\n", "\n", "is_spliced(x)\n", #> "\n", "is_spliced_bare(x)\n", "\n", "dots_splice(\n", #> " ...,\n", " .ignore_empty = c(\"trailing\", \"none\", \"all\"),\n", #> " .preserve_empty = FALSE,\n", " .homonyms = c(\"keep\", \"first\", \"last\", \"error\"),\n", #> " .check_assign = FALSE\n", ")\n"), "\n", #> list("\n", list(list("x"), list("A list to splice.")), #> "\n", "\n", list(list("..."), list("Arguments to collect in a list. These dots are\n", #> list("dynamic"), ".")), "\n", "\n", list( #> list(".ignore_empty"), list("Whether to ignore empty arguments. Can be one\n", #> "of ", list("\"trailing\""), ", ", list( #> "\"none\""), ", ", list("\"all\""), ". If ", #> list("\"trailing\""), ", only the\n", "last argument is ignored if it is empty.")), #> "\n", "\n", list(list(".preserve_empty"), list( #> "Whether to preserve the empty arguments that\n", #> "were not ignored. If ", list("TRUE"), ", empty arguments are stored with\n", #> list(list("missing_arg()")), " values. If ", #> list("FALSE"), " (the default) an error is\n", #> "thrown when an empty argument is detected.")), #> "\n", "\n", list(list(".homonyms"), list("How to treat arguments with the same name. The\n", #> "default, ", list("\"keep\""), ", preserves these arguments. Set ", #> list(".homonyms"), " to\n", list("\"first\""), #> " to only keep the first occurrences, to ", #> list("\"last\""), " to keep\n", "the last occurrences, and to ", #> list("\"error\""), " to raise an informative\n", #> "error and indicate what arguments have duplicated names.")), #> "\n", "\n", list(list(".check_assign"), list( #> "Whether to check for ", list("<-"), " calls passed in\n", #> "dots. When ", list("TRUE"), " and a ", list( #> "<-"), " call is detected, a warning is\n", #> "issued to advise users to use ", list("="), #> " if they meant to match a\n", "function parameter, or wrap the ", #> list("<-"), " call in braces otherwise.\n", #> "This ensures assignments are explicit.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", list("\n", list(), " ", list("splice"), #> " marks an object to be spliced. It is equivalent to using\n", #> list("!!!"), " in a function taking ", list( #> "dynamic dots"), ".\n", list(), " ", list( #> "dots_splice()"), " is like ", list(list( #> "dots_list()")), " but automatically splices\n", #> "list inputs.\n"), "\n"), "\n", list(list( #> "Standard splicing versus quoting splicing"), #> list("\n", "\n", "\n", "The ", list("!!!"), #> " operator works differently in ", list("standard"), #> " functions taking\n", "dots with ", list( #> "dots_list()"), " than in ", list("quoting"), #> " functions taking dots\n", "with ", list( #> list("enexprs()")), " or ", list(list("enquos()")), #> ".\n", list("\n", list(), " In quoting functions ", #> list("!!!"), " disaggregates its argument (let's call\n", #> "it ", list("x"), ") into as many objects as there are elements in\n", #> list("x"), ". E.g. ", list("quo(foo(!!! c(1, 2)))"), #> " is completely equivalent to\n", list( #> "quo(foo(1, 2))"), ". The creation of those separate objects has an\n", #> "overhead but is typically not important when manipulating calls\n", #> "because function calls typically take a small number of\n", #> "arguments.\n", list(), " In standard functions, disaggregating the spliced collection\n", #> "would have a negative performance impact in cases where\n", #> list("dots_list()"), " is used to build up data structures from user\n", #> "inputs. To avoid this spliced inputs are marked with ", #> list(list("splice()")), "\n", "and the final list is built with (the equivalent of)\n", #> list("flatten_if(dots, is_spliced)"), ".\n"), #> "\n", "\n", "Most of the time you should not care about the difference. However\n", #> "if you use a standard function taking tidy dots within a quoting\n", #> "function, the ", list("!!!"), " operator will disaggregate its argument because\n", #> "the behaviour of the quasiquoting function has priority. You might\n", #> "then observe some performance cost in edge cases. Here is one\n", #> "example where this would happen:", list( #> "purrr::rerun(10, dplyr::bind_rows(!!! x))\n"), #> "\n", "\n", list("purrr::rerun()"), " is a quoting function and ", #> list("dplyr::bind_rows()"), " is\n", "a standard function. Because ", #> list("bind_rows()"), " is called ", list( #> "inside"), "\n", list("rerun()"), ", the list ", #> list("x"), " will be disaggregated into a pairlist of\n", #> "arguments. To avoid this you can use ", #> list("splice()"), " instead:", list("purrr::rerun(10, dplyr::bind_rows(splice(x)))\n"), #> "\n")), "\n", "\n", list(list("Life cycle"), #> list("\n", "\n", list("\n", list(), " ", list( #> "dots_splice()"), " is in the questioning stage. It is part of our\n", #> "experiments with dots semantics. Compared to ", #> list("dots_list()"), ",\n", list("dots_splice()"), #> " automatically splices lists. We now lean towards\n", #> "adopting a single type of dots semantics (those of ", #> list("dots_list()"), ")\n", "where splicing is explicit.\n", #> list(), " ", list("splice()"), " is in the questioning stage. It is not clear whether it is\n", #> "really needed as there are other ways to avoid the performance\n", #> "issue discussed above.\n"), "\n")), "\n", #> "\n", list("internal"), "\n"), stack.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("stack"), "\n", list("stack"), "\n", #> list("global_frame"), "\n", list("current_frame"), #> "\n", list("ctxt_frame"), "\n", list("call_frame"), #> "\n", list("ctxt_depth"), "\n", list("call_depth"), #> "\n", list("ctxt_stack"), "\n", list("call_stack"), #> "\n", list("Call stack information"), "\n", list( #> "\n", "global_frame()\n", "\n", "current_frame()\n", #> "\n", "ctxt_frame(n = 1)\n", "\n", "call_frame(n = 1, clean = TRUE)\n", #> "\n", "ctxt_depth()\n", "\n", "call_depth()\n", #> "\n", "ctxt_stack(n = NULL, trim = 0)\n", "\n", #> "call_stack(n = NULL, clean = TRUE)\n"), "\n", #> list("\n", list(list("n"), list("The number of frames to go back in the stack.")), #> "\n", "\n", list(list("clean"), list("Whether to post-process the call stack to clean\n", #> "non-standard frames. If ", list("TRUE"), #> ", suboptimal call-stack entries by\n", list( #> list("base::eval()")), " will be cleaned up: the duplicate frame created by\n", #> list("eval()"), " is eliminated.")), "\n", #> "\n", list(list("trim"), list("The number of layers of intervening frames to trim off\n", #> "the stack. See ", list(list("stack_trim()")), #> " and examples.")), "\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "The ", list("eval_"), " and ", #> list("call_"), " families of functions provide a replacement\n", #> "for the base R functions prefixed with ", #> list("sys."), " (which are all about\n", "the context stack), as well as for ", #> list(list("parent.frame()")), " (which is the\n", #> "only base R function for querying the call stack). The context\n", #> "stack includes all R-level evaluation contexts. It is linear in\n", #> "terms of execution history but due to lazy evaluation it is\n", #> "potentially nonlinear in terms of call history. The call stack\n", #> "history, on the other hand, is homogenous.\n"), #> "\n", list("\n", list("ctxt_frame()"), " and ", #> list("call_frame()"), " return a ", list("frame"), #> " object\n", "containing the following fields: ", #> list("expr"), " and ", list("env"), " (call expression\n", #> "and evaluation environment), ", list("pos"), #> " and ", list("caller_pos"), " (position of\n", #> "current frame in the context stack and position of the caller), and\n", #> list("fun"), " (function of the current frame). ", #> list("ctxt_stack()"), " and\n", list("call_stack()"), #> " return a list of all context or call frames on the\n", #> "stack. Finally, ", list("ctxt_depth()"), " and ", #> list("call_depth()"), " report the\n", "current context position or the number of calling frames on the\n", #> "stack.\n", "\n", "The base R functions take two sorts of arguments to indicate which\n", #> "frame to query: ", list("which"), " and ", #> list("n"), ". The ", list("n"), " argument is\n", #> "straightforward: it's the number of frames to go down the stack,\n", #> "with ", list("n = 1"), " referring to the current context. The ", #> list("which"), " argument\n", "is more complicated and changes meaning for values lower than 1.\n", #> "For the sake of consistency, the rlang functions all take the\n", #> "same kind of argument ", list("n"), ". This argument has a single meaning (the\n", #> "number of frames to go down the stack) and cannot be lower than 1.\n", #> "\n", "Note finally that ", list("parent.frame(1)"), #> " corresponds to\n", list("call_frame(2)$env"), #> ", as ", list("n = 1"), " always refers to the current\n", #> "frame. This makes the ", list("_frame()"), #> " and ", list("_stack()"), " functions\n", #> "consistent: ", list("ctxt_frame(2)"), " is the same as ", #> list("ctxt_stack()[[2]]"), ".\n", "Also, ", #> list("ctxt_depth()"), " returns one more frame than\n", #> list(list("base::sys.nframe()")), " because it counts the global frame. That is\n", #> "consistent with the ", list("_stack()"), " functions which return the global\n", #> "frame as well. This way, ", list("call_stack(call_depth())"), #> " is the same as\n", list("global_frame()"), #> ".\n"), "\n", list(list("Life cycle"), list( #> "\n", "\n", "\n", "These functions are soft-deprecated and replaced by ", #> list(list("trace_back()")), ".\n")), "\n", #> "\n", list("\n", "# Expressions within arguments count as contexts\n", #> "identity(identity(ctxt_depth())) # returns 2\n", #> "\n", "# But they are not part of the call stack because arguments are\n", #> "# evaluated within the calling function (or the global environment\n", #> "# if called at top level)\n", "identity(identity(call_depth())) # returns 0\n", #> "\n", "# The context stacks includes all intervening execution frames. The\n", #> "# call stack doesn't:\n", "f <- function(x) identity(x)\n", #> "f(f(ctxt_stack()))\n", "f(f(call_stack()))\n", #> "\n", "g <- function(cmd) cmd()\n", "f(g(ctxt_stack))\n", #> "f(g(call_stack))\n", "\n", "# The rlang _stack() functions return a list of frame\n", #> "# objects. Use purrr::transpose() or index a field with\n", #> "# purrr::map()'s to extract a particular field from a stack:\n", #> "\n", "# stack <- f(f(call_stack()))\n", "# purrr::map(stack, \"env\")\n", #> "# purrr::transpose(stack)$expr\n", "\n", "# current_frame() is an alias for ctxt_frame(1)\n", #> "fn <- function() list(current = current_frame(), first = ctxt_frame(1))\n", #> "fn()\n", "\n", "# While current_frame() is the top of the stack, global_frame() is\n", #> "# the bottom:\n", "fn <- function() {\n", #> " n <- ctxt_depth()\n", " ctxt_frame(n)\n", #> "}\n", "identical(fn(), global_frame())\n", #> "\n", "\n", "# ctxt_stack() returns a stack with all intervening frames. You can\n", #> "# trim layers of intervening frames with the trim argument:\n", #> "identity(identity(ctxt_stack()))\n", "identity(identity(ctxt_stack(trim = 1)))\n", #> "\n", "# ctxt_stack() is called within fn() with intervening frames:\n", #> "fn <- function(trim) identity(identity(ctxt_stack(trim = trim)))\n", #> "fn(0)\n", "\n", "# We can trim the first layer of those:\n", #> "fn(1)\n", "\n", "# The outside intervening frames (at the fn() call site) are still\n", #> "# returned, but can be trimmed as well:\n", #> "identity(identity(fn(1)))\n", "identity(identity(fn(2)))\n", #> "\n", "g <- function(trim) identity(identity(fn(trim)))\n", #> "g(2)\n", "g(3)\n"), "\n", list("internal"), #> "\n"), stack_trim.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("stack_trim"), "\n", list("stack_trim"), #> "\n", list("Trim top call layers from the evaluation stack"), #> "\n", list("\n", "stack_trim(stack, n = 1)\n"), #> "\n", list("\n", list(list("stack"), list("An evaluation stack.")), #> "\n", "\n", list(list("n"), list("The number of call frames (not eval frames) to trim off\n", #> "the top of the stack. In other words, the number of layers of\n", #> "intervening frames to trim.")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", list(list("ctxt_stack()")), " can be tricky to use in real code because all\n", #> "intervening frames are returned with the stack, including those at\n", #> list("ctxt_stack()"), " own call site. ", list( #> "stack_trim()"), " makes it easy to\n", "remove layers of intervening calls.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "These functions are deprecated and replaced by ", #> list(list("trace_back()")), ".\n")), "\n", #> "\n", list("\n", "# Intervening frames appear on the evaluation stack:\n", #> "identity(identity(ctxt_stack()))\n", "\n", #> "# stack_trim() will trim the first n layers of calls:\n", #> "stack_trim(identity(identity(ctxt_stack())))\n", #> "\n", "# Note that it also takes care of calls intervening at its own call\n", #> "# site:\n", "identity(identity(\n", " stack_trim(identity(identity(ctxt_stack())))\n", #> "))\n", "\n", "# It is especially useful when used within a function that needs to\n", #> "# inspect the evaluation stack but should nonetheless be callable\n", #> "# within nested calls without side effects:\n", #> "stack_util <- function() {\n", " # n = 2 means that two layers of intervening calls should be\n", #> " # removed: The layer at ctxt_stack()'s call site (including the\n", #> " # stack_trim() call), and the layer at stack_util()'s call.\n", #> " stack <- stack_trim(ctxt_stack(), n = 2)\n", #> " stack\n", "}\n", "user_fn <- function() {\n", #> " # A user calls your stack utility with intervening frames:\n", #> " identity(identity(stack_util()))\n", "}\n", #> "# These intervening frames won't appear in the evaluation stack\n", #> "identity(user_fn())\n"), "\n", list("internal"), #> "\n"), string.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/utils-encoding.R", #> "\n", list("string"), "\n", list("string"), "\n", #> list("Create a string"), "\n", list("\n", "string(x, encoding = NULL)\n"), #> "\n", list("\n", list(list("x"), list("A character vector or a vector or list of string-like\n", #> "objects.")), "\n", "\n", list(list("encoding"), #> list("If non-null, set an encoding mark. This is only\n", #> "declarative, no encoding conversion is performed.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "These base-type constructors allow more control over the creation\n", #> "of strings in R. They take character vectors or string-like objects\n", #> "(integerish or raw vectors), and optionally set the encoding. The\n", #> "string version checks that the input contains a scalar string.\n"), #> "\n", list("\n", "# As everywhere in R, you can specify a string with Unicode\n", #> "# escapes. The characters corresponding to Unicode codepoints will\n", #> "# be encoded in UTF-8, and the string will be marked as UTF-8\n", #> "# automatically:\n", "cafe <- string(\"caf\\uE9\")\n", #> "Encoding(cafe)\n", "as_bytes(cafe)\n", "\n", #> "# In addition, string() provides useful conversions to let\n", #> "# programmers control how the string is represented in memory. For\n", #> "# encodings other than UTF-8, you'll need to supply the bytes in\n", #> "# hexadecimal form. If it is a latin1 encoding, you can mark the\n", #> "# string explicitly:\n", "cafe_latin1 <- string(c(0x63, 0x61, 0x66, 0xE9), \"latin1\")\n", #> "Encoding(cafe_latin1)\n", "as_bytes(cafe_latin1)\n"), #> "\n", list("internal"), "\n"), switch_type.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("switch_type"), "\n", list("switch_type"), #> "\n", list("coerce_type"), "\n", list("switch_class"), #> "\n", list("coerce_class"), "\n", list("Dispatch on base types"), #> "\n", list("\n", "switch_type(.x, ...)\n", "\n", #> "coerce_type(.x, .to, ...)\n", "\n", "switch_class(.x, ...)\n", #> "\n", "coerce_class(.x, .to, ...)\n"), "\n", #> list("\n", list(list(".x"), list("An object from which to dispatch.")), #> "\n", "\n", list(list("..."), list("Named clauses. The names should be types as returned by\n", #> list(list("type_of()")), ".")), "\n", "\n", #> list(list(".to"), list("This is useful when you switchpatch within a coercing\n", #> "function. If supplied, this should be a string indicating the\n", #> "target type. A catch-all clause is then added to signal an error\n", #> "stating the conversion failure. This type is prettified unless\n", #> list(".to"), " inherits from the S3 class ", #> list("\"AsIs\""), " (see ", list(list("base::I()")), #> ").")), "\n"), "\n", list("\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", list("switch_type()"), " is equivalent to\n", #> list(list("switch"), "(", list("type_of"), #> "(x, ...))"), ", while\n", list("switch_class()"), #> " switchpatches based on ", list("class(x)"), #> ". The ", list("coerce_"), "\n", "versions are intended for type conversion and provide a standard\n", #> "error message when conversion fails.\n"), #> "\n", list("\n", "switch_type(3L,\n", " double = \"foo\",\n", #> " integer = \"bar\",\n", " \"default\"\n", #> ")\n", "\n", "# Use the coerce_ version to get standardised error handling when no\n", #> "# type matches:\n", "to_chr <- function(x) {\n", #> " coerce_type(x, \"a chr\",\n", " integer = as.character(x),\n", #> " double = as.character(x)\n", " )\n", #> "}\n", "to_chr(3L)\n", "\n", "# Strings have their own type:\n", #> "switch_type(\"str\",\n", " character = \"foo\",\n", #> " string = \"bar\",\n", " \"default\"\n", #> ")\n", "\n", "# Use a fallthrough clause if you need to dispatch on all character\n", #> "# vectors, including strings:\n", "switch_type(\"str\",\n", #> " string = ,\n", " character = \"foo\",\n", #> " \"default\"\n", ")\n", "\n", "# special and builtin functions are treated as primitive, since\n", #> "# there is usually no reason to treat them differently:\n", #> "switch_type(base::list,\n", " primitive = \"foo\",\n", #> " \"default\"\n", ")\n", "switch_type(base::`$`,\n", #> " primitive = \"foo\",\n", " \"default\"\n", #> ")\n", "\n", "# closures are not primitives:\n", #> "switch_type(rlang::switch_type,\n", " primitive = \"foo\",\n", #> " \"default\"\n", ")\n"), "\n", list("internal"), #> "\n"), sym.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/sym.R", #> "\n", list("sym"), "\n", list("sym"), "\n", list( #> "syms"), "\n", list("Create a symbol or list of symbols"), #> "\n", list("\n", "sym(x)\n", "\n", "syms(x)\n"), #> "\n", list("\n", list(list("x"), list("A string or list of strings.")), #> "\n"), "\n", list("\n", "A symbol for ", list( #> "sym()"), " and a list of symbols for ", list( #> "syms()"), ".\n"), "\n", list("\n", "These functions take strings as input and turn them into symbols.\n"), #> "\n", list("\n", "# The empty string returns the missing argument:\n", #> "sym(\"\")\n", "\n", "# This way sym() and as_string() are inverse of each other:\n", #> "as_string(missing_arg())\n", "sym(as_string(missing_arg()))\n"), #> "\n"), `tidyeval-data.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval-tidy.R", #> "\n", list("data"), "\n", list("tidyeval-data"), #> "\n", list("tidyeval-data"), "\n", list(".data"), #> "\n", list(".env"), "\n", list("Data pronouns for tidy evaluation"), #> "\n", list("\n", ".data\n", "\n", ".env\n"), #> "\n", list("\n", "These pronouns allow you to be explicit about where to find objects\n", #> "when programming with data masked functions.", #> list("m <- 10\n", "mtcars %>% mutate(disp = .data$disp * .env$m)\n"), #> "\n", list("\n", list(), " ", list(".data"), #> " retrieves data-variables from the data frame.\n", #> list(), " ", list(".env"), " retrieves env-variables from the environment.\n"), #> "\n", "\n", "Because the lookup is explicit, there is no ambiguity between both\n", #> "kinds of variables. Compare:", list("disp <- 10\n", #> "mtcars %>% mutate(disp = .data$disp * .env$disp)\n", #> "mtcars %>% mutate(disp = disp * disp)\n"), #> "\n", "\n", "The ", list(".data"), " object exported from rlang is also useful to import in\n", #> "your package namespace to avoid a ", list( #> "R CMD check"), " note when referring\n", #> "to objects from the data mask.\n", "\n", "Note that ", #> list(".data"), " is only a pronoun, it is not a real data\n", #> "frame. This means that you can't take its names or map a function\n", #> "over the contents of ", list(".data"), ". Similarly, ", #> list(".env"), " is not an actual R\n", "environment. For instance, it doesn't have a parent and the\n", #> "subsetting operators behave differently.\n"), #> "\n", list("datasets"), "\n"), trace_back.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/trace.R", #> "\n", list("trace_back"), "\n", list("trace_back"), #> "\n", list("trace_length"), "\n", list("Capture a backtrace"), #> "\n", list("\n", "trace_back(top = NULL, bottom = NULL)\n", #> "\n", "trace_length(trace)\n"), "\n", list( #> "\n", list(list("top"), list("The first frame environment to be included in the\n", #> "backtrace. This becomes the top of the backtrace tree and\n", #> "represents the oldest call in the backtrace.\n", #> "\n", "This is needed in particular when you call ", #> list("trace_back()"), "\n", "indirectly or from a larger context, for example in tests or\n", #> "inside an RMarkdown document where you don't want all of the\n", #> "knitr evaluation mechanisms to appear in the backtrace.")), #> "\n", "\n", list(list("bottom"), list("The last frame environment to be included in the\n", #> "backtrace. This becomes the rightmost leaf of the backtrace tree\n", #> "and represents the youngest call in the backtrace.\n", #> "\n", "Set this when you would like to capture a backtrace without the\n", #> "capture context.\n", "\n", "Can also be an integer that will be passed to ", #> list(list("caller_env()")), ".")), "\n", #> "\n", list(list("trace"), list("A backtrace created by ", #> list("trace_back()"), ".")), "\n"), "\n", #> list("\n", "A backtrace captures the sequence of calls that lead to the current\n", #> "function, sometimes called the call stack. Because of lazy\n", #> "evaluation, the call stack in R is actually a tree, which the\n", #> list("summary()"), " method of this object will reveal.\n"), #> "\n", list("\n", list("trace_length()"), " returns the number of frames in a backtrace.\n"), #> "\n", list("\n", "# Trim backtraces automatically (this improves the generated\n", #> "# documentation for the rlang website and the same trick can be\n", #> "# useful within knitr documents):\n", "options(rlang_trace_top_env = current_env())\n", #> "\n", "f <- function() g()\n", "g <- function() h()\n", #> "h <- function() trace_back()\n", "\n", "# When no lazy evaluation is involved the backtrace is linear\n", #> "# (i.e. every call has only one child)\n", #> "f()\n", "\n", "# Lazy evaluation introduces a tree like structure\n", #> "identity(identity(f()))\n", "identity(try(f()))\n", #> "try(identity(f()))\n", "\n", "# When printing, you can request to simplify this tree to only show\n", #> "# the direct sequence of calls that lead to `trace_back()`\n", #> "x <- try(identity(f()))\n", "x\n", "print(x, simplify = \"branch\")\n", #> "\n", "# With a little cunning you can also use it to capture the\n", #> "# tree from within a base NSE function\n", #> "x <- NULL\n", "with(mtcars, {x <<- f(); 10})\n", #> "x\n", "\n", "\n", "# Restore default top env for next example\n", #> "options(rlang_trace_top_env = NULL)\n", "\n", #> "# When code is executed indirectly, i.e. via source or within an\n", #> "# RMarkdown document, you'll tend to get a lot of guff at the beginning\n", #> "# related to the execution environment:\n", #> "conn <- textConnection(\"summary(f())\")\n", #> "source(conn, echo = TRUE, local = TRUE)\n", #> "close(conn)\n", "\n", "# To automatically strip this off, specify which frame should be\n", #> "# the top of the backtrace. This will automatically trim off calls\n", #> "# prior to that frame:\n", "top <- current_env()\n", #> "h <- function() trace_back(top)\n", "\n", #> "conn <- textConnection(\"summary(f())\")\n", #> "source(conn, echo = TRUE, local = TRUE)\n", #> "close(conn)\n"), "\n"), `type-predicates.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/types.R", #> "\n", list("type-predicates"), "\n", list("type-predicates"), #> "\n", list("is_list"), "\n", list("is_atomic"), #> "\n", list("is_vector"), "\n", list("is_integer"), #> "\n", list("is_double"), "\n", list("is_character"), #> "\n", list("is_logical"), "\n", list("is_raw"), #> "\n", list("is_bytes"), "\n", list("is_null"), #> "\n", list("Type predicates"), "\n", list("\n", #> "is_list(x, n = NULL)\n", "\n", "is_atomic(x, n = NULL)\n", #> "\n", "is_vector(x, n = NULL)\n", "\n", "is_integer(x, n = NULL)\n", #> "\n", "is_double(x, n = NULL, finite = NULL)\n", #> "\n", "is_character(x, n = NULL)\n", "\n", #> "is_logical(x, n = NULL)\n", "\n", "is_raw(x, n = NULL)\n", #> "\n", "is_bytes(x, n = NULL)\n", "\n", "is_null(x)\n"), #> "\n", list("\n", list(list("x"), list("Object to be tested.")), #> "\n", "\n", list(list("n"), list("Expected length of a vector.")), #> "\n", "\n", list(list("finite"), list("Whether all values of the vector are finite. The\n", #> "non-finite values are ", list("NA"), ", ", #> list("Inf"), ", ", list("-Inf"), " and ", #> list("NaN"), ". Setting this\n", "to something other than ", #> list("NULL"), " can be expensive because the whole\n", #> "vector needs to be traversed and checked.")), #> "\n"), "\n", list("\n", "These type predicates aim to make type testing in R more\n", #> "consistent. They are wrappers around ", list( #> list("base::typeof()")), ", so operate\n", #> "at a level beneath S3/S4 etc.\n"), "\n", list( #> "\n", "Compared to base R functions:\n", list( #> "\n", list(), " The predicates for vectors include the ", #> list("n"), " argument for\n", "pattern-matching on the vector length.\n", #> list(), " Unlike ", list("is.atomic()"), #> ", ", list("is_atomic()"), " does not return ", #> list("TRUE"), " for\n", list("NULL"), ".\n", #> list(), " Unlike ", list("is.vector()"), #> ", ", list("is_vector()"), " tests if an object is an\n", #> "atomic vector or a list. ", list("is.vector"), #> " checks for the presence of\n", "attributes (other than name).\n"), #> "\n"), "\n", list("\n", list("bare-type-predicates"), #> " ", list("scalar-type-predicates"), "\n"), #> "\n"), type_of.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("type_of"), "\n", list("type_of"), #> "\n", list("Base type of an object"), "\n", list( #> "\n", "type_of(x)\n"), "\n", list("\n", list( #> list("x"), list("An R object.")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "This is equivalent to ", list( #> list("base::typeof()")), " with a few differences that\n", #> "make dispatching easier:\n", list("\n", list(), #> " The type of one-sided formulas is \"quote\".\n", #> list(), " The type of character vectors of length 1 is \"string\".\n", #> list(), " The type of special and builtin functions is \"primitive\".\n"), #> "\n"), "\n", list(list("Life cycle"), list( #> "\n", "\n", "\n", list("type_of()"), " is an experimental function. Expect API changes.\n")), #> "\n", "\n", list("\n", "type_of(10L)\n", "\n", #> "# Quosures are treated as a new base type but not formulas:\n", #> "type_of(quo(10L))\n", "type_of(~10L)\n", "\n", #> "# Compare to base::typeof():\n", "typeof(quo(10L))\n", #> "\n", "# Strings are treated as a new base type:\n", #> "type_of(letters)\n", "type_of(letters[[1]])\n", #> "\n", "# This is a bit inconsistent with the core language tenet that data\n", #> "# types are vectors. However, treating strings as a different\n", #> "# scalar type is quite helpful for switching on function inputs\n", #> "# since so many arguments expect strings:\n", #> "switch_type(\"foo\", character = abort(\"vector!\"), string = \"result\")\n", #> "\n", "# Special and builtin primitives are both treated as primitives.\n", #> "# That's because it is often irrelevant which type of primitive an\n", #> "# input is:\n", "typeof(list)\n", "typeof(`$`)\n", #> "type_of(list)\n", "type_of(`$`)\n"), "\n", #> list("internal"), "\n"), vec_poke_n.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec.R", #> "\n", list("vec_poke_n"), "\n", list("vec_poke_n"), #> "\n", list("vec_poke_range"), "\n", list("Poke values into a vector"), #> "\n", list("\n", "vec_poke_n(x, start, y, from = 1L, n = length(y))\n", #> "\n", "vec_poke_range(x, start, y, from = 1L, to = length(y) - from + 1L)\n"), #> "\n", list("\n", list(list("x"), list("The destination vector.")), #> "\n", "\n", list(list("start"), list("The index indicating where to start modifying ", #> list("x"), ".")), "\n", "\n", list(list("y"), #> list("The source vector.")), "\n", "\n", #> list(list("from"), list("The index indicating where to start copying from ", #> list("y"), ".")), "\n", "\n", list(list("n"), #> list("How many elements should be copied from ", #> list("y"), " to ", list("x"), ".")), "\n", #> "\n", list(list("to"), list("The index indicating the end of the range to copy from ", #> list("y"), ".")), "\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"experimental\")"), #> "\n", "\n", "These tools are for R experts only. They copy elements from ", #> list("y"), "\n", "into ", list("x"), " by mutation. You should only do this if you own ", #> list("x"), ",\n", "i.e. if you have created it or if you are certain that it doesn't\n", #> "exist in any other context. Otherwise you might create unintended\n", #> "side effects that have undefined consequences.\n"), #> "\n", list("internal"), "\n"), `vector-coercion.Rd` = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("vector-coercion"), "\n", list("vector-coercion"), #> "\n", list("as_logical"), "\n", list("as_integer"), #> "\n", list("as_double"), "\n", list("as_complex"), #> "\n", list("as_character"), "\n", list("as_list"), #> "\n", list("Coerce an object to a base type"), #> "\n", list("\n", "as_logical(x)\n", "\n", "as_integer(x)\n", #> "\n", "as_double(x)\n", "\n", "as_complex(x)\n", #> "\n", "as_character(x, encoding = NULL)\n", #> "\n", "as_list(x)\n"), "\n", list("\n", list( #> list("x"), list("An object to coerce to a base type.")), #> "\n", "\n", list(list("encoding"), list("If non-null, set an encoding mark. This is only\n", #> "declarative, no encoding conversion is performed.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"soft-deprecated\")"), #> "\n", "\n", "These are equivalent to the base functions (e.g. ", #> list(list("as.logical()")), ",\n", list(list( #> "as.list()")), ", etc), but perform coercion rather than conversion.\n", #> "This means they are not generic and will not call S3 conversion\n", #> "methods. They only attempt to coerce the base type of their\n", #> "input. In addition, they have stricter implicit coercion rules and\n", #> "will never attempt any kind of parsing. E.g. they will not try to\n", #> "figure out if a character vector represents integers or booleans.\n", #> "Finally, they treat attributes consistently, unlike the base R\n", #> "functions: all attributes except names are removed.\n"), #> "\n", list(list("Lifecycle"), list("\n", "\n", #> "\n", "These functions are deprecated in favour of ", #> list("vctrs::vec_cast()"), ".\n")), "\n", "\n", #> list(list("Coercion to logical and numeric atomic vectors"), #> list("\n", "\n", list("\n", list(), " To logical vectors: Integer and integerish double vectors. See\n", #> list(list("is_integerish()")), ".\n", list(), #> " To integer vectors: Logical and integerish double vectors.\n", #> list(), " To double vectors: Logical and integer vectors.\n", #> list(), " To complex vectors: Logical, integer and double vectors.\n"), #> "\n")), "\n", "\n", list(list("Coercion to character vectors"), #> list("\n", "\n", "\n", list("as_character()"), #> " and ", list("as_string()"), " have an optional ", #> list("encoding"), "\n", "argument to specify the encoding. R uses this information for\n", #> "internal handling of strings and character vectors. Note that this\n", #> "is only declarative, no encoding conversion is attempted.\n", #> "\n", "Note that only ", list("as_string()"), #> " can coerce symbols to a scalar\n", "character vector. This makes the code more explicit and adds an\n", #> "extra type check.\n")), "\n", "\n", list( #> list("Coercion to lists"), list("\n", "\n", #> "\n", list("as_list()"), " only coerces vector and dictionary types (environments\n", #> "are an example of dictionary type). Unlike ", #> list(list("base::as.list()")), ",\n", list( #> "as_list()"), " removes all attributes except names.\n")), #> "\n", "\n", list(list("Effects of removing attributes"), #> list("\n", "\n", "\n", "A technical side-effect of removing the attributes of the input is\n", #> "that the underlying objects has to be copied. This has no\n", #> "performance implications in the case of lists because this is a\n", #> "shallow copy: only the list structure is copied, not the contents\n", #> "(see ", list(list("duplicate()")), "). However, be aware that atomic vectors\n", #> "containing large amounts of data will have to be copied.\n", #> "\n", "In general, any attribute modification creates a copy, which is why\n", #> "it is better to avoid using attributes with heavy atomic vectors.\n", #> "Uncopyable objects like environments and symbols are an exception\n", #> "to this rule: in this case, attributes modification happens in\n", #> "place and has side-effects.\n")), "\n", #> "\n", list("\n", "# Coercing atomic vectors removes attributes with both base R and rlang:\n", #> "x <- structure(TRUE, class = \"foo\", bar = \"baz\")\n", #> "as.logical(x)\n", "\n", "# But coercing lists preserves attributes in base R but not rlang:\n", #> "l <- structure(list(TRUE), class = \"foo\", bar = \"baz\")\n", #> "as.list(l)\n", "as_list(l)\n", "\n", "# Implicit conversions are performed in base R but not rlang:\n", #> "as.logical(l)\n", list("\n", "as_logical(l)\n"), #> "\n", "\n", "# Conversion methods are bypassed, making the result of the\n", #> "# coercion more predictable:\n", "as.list.foo <- function(x) \"wrong\"\n", #> "as.list(l)\n", "as_list(l)\n", "\n", "# The input is never parsed. E.g. character vectors of numbers are\n", #> "# not converted to numeric types:\n", "as.integer(\"33\")\n", #> list("\n", "as_integer(\"33\")\n"), "\n", "\n", #> "\n", "# With base R tools there is no way to convert an environment to a\n", #> "# list without either triggering method dispatch, or changing the\n", #> "# original environment. as_list() makes it easy:\n", #> "x <- structure(as_environment(mtcars[1:2]), class = \"foobar\")\n", #> "as.list.foobar <- function(x) abort(\"dont call me\")\n", #> "as_list(x)\n"), "\n", list("internal"), "\n"), #> `vector-construction.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/vec-new.R", #> "\n", list("vector-construction"), "\n", list( #> "vector-construction"), "\n", list("lgl"), #> "\n", list("int"), "\n", list("dbl"), "\n", list( #> "cpl"), "\n", list("chr"), "\n", list("bytes"), #> "\n", list("Create vectors"), "\n", list("\n", #> "lgl(...)\n", "\n", "int(...)\n", "\n", "dbl(...)\n", #> "\n", "cpl(...)\n", "\n", "chr(...)\n", "\n", #> "bytes(...)\n"), "\n", list("\n", list(list( #> "..."), list("Components of the new vector. Bare lists and explicitly\n", #> "spliced lists are spliced.")), "\n"), "\n", #> list("\n", list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "The atomic vector constructors are equivalent to ", #> list(list("c()")), " but:\n", list("\n", list(), #> " They allow you to be more explicit about the output\n", #> "type. Implicit coercions (e.g. from integer to logical) follow\n", #> "the rules described in ", list("vector-coercion"), #> ".\n", list(), " They use ", list("dynamic dots"), #> ".\n"), "\n"), "\n", list(list("Life cycle"), #> list("\n", "\n", list("\n", list(), " All the abbreviated constructors such as ", #> list("lgl()"), " will probably be\n", "moved to the vctrs package at some point. This is why they are\n", #> "marked as questioning.\n", list(), " Automatic splicing is soft-deprecated and will trigger a warning\n", #> "in a future version. Please splice explicitly with ", #> list("!!!"), ".\n"), "\n")), "\n", "\n", #> list("\n", "# These constructors are like a typed version of c():\n", #> "c(TRUE, FALSE)\n", "lgl(TRUE, FALSE)\n", "\n", #> "# They follow a restricted set of coercion rules:\n", #> "int(TRUE, FALSE, 20)\n", "\n", "# Lists can be spliced:\n", #> "dbl(10, !!! list(1, 2L), TRUE)\n", "\n", "\n", #> "# They splice names a bit differently than c(). The latter\n", #> "# automatically composes inner and outer names:\n", #> "c(a = c(A = 10), b = c(B = 20, C = 30))\n", #> "\n", "# On the other hand, rlang's ctors use the inner names and issue a\n", #> "# warning to inform the user that the outer names are ignored:\n", #> "dbl(a = c(A = 10), b = c(B = 20, C = 30))\n", #> "dbl(a = c(1, 2))\n", "\n", "# As an exception, it is allowed to provide an outer name when the\n", #> "# inner vector is an unnamed scalar atomic:\n", #> "dbl(a = 1)\n", "\n", "# Spliced lists behave the same way:\n", #> "dbl(!!! list(a = 1))\n", "dbl(!!! list(a = c(A = 1)))\n", #> "\n", "# bytes() accepts integerish inputs\n", #> "bytes(1:10)\n", "bytes(0x01, 0xff, c(0x03, 0x05), list(10, 20, 30L))\n"), #> "\n"), `vector-old-ctors.Rd` = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/lifecycle-retired.R", #> "\n", list("node"), "\n", list("node"), "\n", #> list("vector-old-ctors"), "\n", list("lgl_len"), #> "\n", list("int_len"), "\n", list("dbl_len"), #> "\n", list("chr_len"), "\n", list("cpl_len"), #> "\n", list("raw_len"), "\n", list("bytes_len"), #> "\n", list("list_len"), "\n", list("lgl_along"), #> "\n", list("int_along"), "\n", list("dbl_along"), #> "\n", list("chr_along"), "\n", list("cpl_along"), #> "\n", list("raw_along"), "\n", list("bytes_along"), #> "\n", list("list_along"), "\n", list("Retired vector construction by length"), #> "\n", list("\n", "node(car, cdr = NULL)\n", "\n", #> "lgl_len(.n)\n", "\n", "int_len(.n)\n", "\n", #> "dbl_len(.n)\n", "\n", "chr_len(.n)\n", "\n", #> "cpl_len(.n)\n", "\n", "raw_len(.n)\n", "\n", #> "bytes_len(.n)\n", "\n", "list_len(.n)\n", #> "\n", "lgl_along(.x)\n", "\n", "int_along(.x)\n", #> "\n", "dbl_along(.x)\n", "\n", "chr_along(.x)\n", #> "\n", "cpl_along(.x)\n", "\n", "raw_along(.x)\n", #> "\n", "bytes_along(.x)\n", "\n", "list_along(.x)\n"), #> "\n", list("\n", list(list(".n"), list("The vector length.")), #> "\n", "\n", list(list(".x"), list("A vector.")), #> "\n"), "\n", list("\n", list("rlang:::lifecycle(\"deprecated\")"), #> "\n", "\n", "These functions were deprecated and renamed with ", #> list("new_"), " prefix in\n", "rlang 0.2.0. This is for consistency with other non-variadic object\n", #> "constructors.\n"), "\n", list("internal"), #> "\n"), with_abort.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-entrace.R", #> "\n", list("with_abort"), "\n", list("with_abort"), #> "\n", list("Promote all errors to rlang errors"), #> "\n", list("\n", "with_abort(expr, classes = \"error\")\n"), #> "\n", list("\n", list(list("expr"), list("An expression run in a context where errors are\n", #> "promoted to rlang errors.")), "\n", "\n", #> list(list("classes"), list("Character vector of condition classes that should be\n", #> "promoted to rlang errors.")), "\n"), "\n", #> list("\n", list("with_abort()"), " promotes conditions as if they were thrown with\n", #> list(list("abort()")), ". These errors embed a ", #> list("backtrace"), ". They are\n", "particularly suitable to be set as ", #> list("parent errors"), " (see ", list("parent"), #> "\n", "argument of ", list(list("abort()")), #> ").\n"), "\n", list("\n", list("with_abort()"), #> " installs a ", list("calling handler"), " for errors and\n", #> "rethrows non-rlang errors with ", list(list( #> "abort()")), ". However, error handlers\n", #> "installed ", list("within"), " ", list("with_abort()"), #> " have priority. For this reason,\n", "you should use ", #> list(list("tryCatch()")), " and ", list("exiting"), #> " handlers outside\n", list("with_abort()"), #> " rather than inside.\n"), "\n", list("\n", #> "# with_abort() automatically casts simple errors thrown by stop()\n", #> "# to rlang errors. It is is handy for rethrowing low level\n", #> "# errors. The backtraces are then segmented between the low level\n", #> "# and high level contexts.\n", "f <- function() g()\n", #> "g <- function() stop(\"Low level error\")\n", #> "\n", "high_level <- function() {\n", " with_handlers(\n", #> " with_abort(f()),\n", " error = ~ abort(\"High level error\", parent = .)\n", #> " )\n", "}\n"), "\n"), with_env.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/eval.R", #> "\n", list("with_env"), "\n", list("with_env"), #> "\n", list("locally"), "\n", list("Evaluate an expression within a given environment"), #> "\n", list("\n", "with_env(env, expr)\n", "\n", #> "locally(expr)\n"), "\n", list("\n", list(list( #> "env"), list("An environment within which to evaluate ", #> list("expr"), ". Can be\n", "an object with a ", #> list(list("get_env()")), " method.")), "\n", #> "\n", list(list("expr"), list("An expression to evaluate.")), #> "\n"), "\n", list("\n", "These functions evaluate ", #> list("expr"), " within a given environment (", #> list("env"), "\n", "for ", list("with_env()"), #> ", or the child of the current environment for\n", #> list("locally"), "). They rely on ", list(list( #> "eval_bare()")), " which features a lighter\n", #> "evaluation mechanism than base R ", list(list( #> "base::eval()")), ", and which also has\n", #> "some subtle implications when evaluting stack sensitive functions\n", #> "(see help for ", list(list("eval_bare()")), #> ").\n"), "\n", list("\n", list("locally()"), #> " is equivalent to the base function\n", list( #> list("base::local()")), " but it produces a much cleaner\n", #> "evaluation stack, and has stack-consistent semantics. It is thus\n", #> "more suited for experimenting with the R language.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "These functions are experimental. Expect API changes.\n")), #> "\n", "\n", list("\n", "# with_env() is handy to create formulas with a given environment:\n", #> "env <- child_env(\"rlang\")\n", "f <- with_env(env, ~new_formula())\n", #> "identical(f_env(f), env)\n", "\n", "# Or functions with a given enclosure:\n", #> "fn <- with_env(env, function() NULL)\n", "identical(get_env(fn), env)\n", #> "\n", "\n", "# Unlike eval() it doesn't create duplicates on the evaluation\n", #> "# stack. You can thus use it e.g. to create non-local returns:\n", #> "fn <- function() {\n", " g(current_env())\n", #> " \"normal return\"\n", "}\n", "g <- function(env) {\n", #> " with_env(env, return(\"early return\"))\n", #> "}\n", "fn()\n", "\n", "\n", "# Since env is passed to as_environment(), it can be any object with an\n", #> "# as_environment() method. For strings, the pkg_env() is returned:\n", #> "with_env(\"base\", ~mtcars)\n", "\n", "# This can be handy to put dictionaries in scope:\n", #> "with_env(mtcars, cyl)\n"), "\n", list("internal"), #> "\n"), with_handlers.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-handlers.R", #> "\n", list("with_handlers"), "\n", list("with_handlers"), #> "\n", list("calling"), "\n", list("Establish handlers on the stack"), #> "\n", list("\n", "with_handlers(.expr, ...)\n", #> "\n", "calling(handler)\n"), "\n", list("\n", #> list(list(".expr"), list("An expression to execute in a context where new\n", #> "handlers are established. The underscored version takes a quoted\n", #> "expression or a quoted formula.")), "\n", #> "\n", list(list("..."), list("<", list("dynamic"), #> "> Named handlers. These should be\n", "functions of one argument, or ", #> list("formula functions"), ".\n", "The handlers are considered exiting by default, use ", #> list(list("calling()")), "\n", "to specify a calling handler.")), #> "\n", "\n", list(list("handler"), list("A handler function that takes a condition as\n", #> "argument. This is passed to ", list(list( #> "as_function()")), " and can thus be a\n", #> "formula describing a lambda function.")), #> "\n"), "\n", list("\n", "Condition handlers are functions established on the evaluation\n", #> "stack (see ", list(list("ctxt_stack()")), #> ") that are called by R when a condition is\n", #> "signalled (see ", list(list("cnd_signal()")), #> " and ", list(list("abort()")), " for two common signal\n", #> "functions). They come in two types:\n", list( #> "\n", list(), " Exiting handlers aborts all code currently run between\n", #> list("with_handlers()"), " and the point where the condition has been\n", #> "raised. ", list("with_handlers()"), " passes the return value of the handler\n", #> "to its caller.\n", list(), " Calling handlers, which are executed from inside the signalling\n", #> "functions. Their return values are ignored, only their side\n", #> "effects matters. Valid side effects are writing a log message, or\n", #> "jumping out of the signalling context by ", #> list("invoking a restart"), " or using ", #> list(list("return_from()")), ". If the raised\n", #> "condition was an error, this interrupts the aborting process.\n", #> "\n", "If a calling handler returns normally, it effectively declines to\n", #> "handle the condition and other handlers on the stack (calling or\n", #> "exiting) are given a chance to handle the condition.\n"), #> "\n", "\n", "Handlers are exiting by default, use ", #> list(list("calling()")), " to create a\n", #> "calling handler.\n"), "\n", list(list("Life cycle"), #> list("\n", " ", list("exiting()"), " is soft-deprecated as of rlang\n", #> "0.4.0 because ", list(list("with_handlers()")), #> " now treats handlers as exiting by\n", "default.\n")), #> "\n", "\n", list("\n", "# Signal a condition with signal():\n", #> "fn <- function() {\n", " g()\n", " cat(\"called?\\n\")\n", #> " \"fn() return value\"\n", "}\n", "g <- function() {\n", #> " h()\n", " cat(\"called?\\n\")\n", "}\n", #> "h <- function() {\n", " signal(\"A foobar condition occurred\", \"foo\")\n", #> " cat(\"called?\\n\")\n", "}\n", "\n", "# Exiting handlers jump to with_handlers() before being\n", #> "# executed. Their return value is handed over:\n", #> "handler <- function(c) \"handler return value\"\n", #> "with_handlers(fn(), foo = handler)\n", "\n", #> "# Calling handlers are called in turn and their return value is\n", #> "# ignored. Returning just means they are declining to take charge of\n", #> "# the condition. However, they can produce side-effects such as\n", #> "# displaying a message:\n", "some_handler <- function(c) cat(\"some handler!\\n\")\n", #> "other_handler <- function(c) cat(\"other handler!\\n\")\n", #> "with_handlers(fn(), foo = calling(some_handler), foo = calling(other_handler))\n", #> "\n", "# If a calling handler jumps to an earlier context, it takes\n", #> "# charge of the condition and no other handler gets a chance to\n", #> "# deal with it. The canonical way of transferring control is by\n", #> "# jumping to a restart. See with_restarts() and restarting()\n", #> "# documentation for more on this:\n", "exiting_handler <- function(c) rst_jump(\"rst_foo\")\n", #> "fn2 <- function() {\n", " with_restarts(g(), rst_foo = function() \"restart value\")\n", #> "}\n", "with_handlers(fn2(), foo = calling(exiting_handler), foo = calling(other_handler))\n"), #> "\n"), with_restarts.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/cnd-restarts.R", #> "\n", list("with_restarts"), "\n", list("with_restarts"), #> "\n", list("Establish a restart point on the stack"), #> "\n", list("\n", "with_restarts(.expr, ...)\n"), #> "\n", list("\n", list(list(".expr"), list("An expression to execute with new restarts established\n", #> "on the stack. This argument is passed by expression and supports\n", #> list("unquoting"), ". It is evaluated in a context where\n", #> "restarts are established.")), "\n", "\n", #> list(list("..."), list("<", list("dynamic"), #> "> Named restart functions. The\n", "name is taken as the restart name and the function is executed\n", #> "after the jump.")), "\n"), "\n", list("\n", #> list("rlang:::lifecycle(\"questioning\")"), #> "\n", "\n", "Restart points are named functions that are established with\n", #> list("with_restarts()"), ". Once established, you can interrupt the normal\n", #> "execution of R code, jump to the restart, and resume execution from\n", #> "there. Each restart is established along with a restart function\n", #> "that is executed after the jump and that provides a return value\n", #> "from the establishing point (i.e., a return value for\n", #> list("with_restarts()"), ").\n"), "\n", list( #> "\n", "Restarts are not the only way of jumping to a previous call frame\n", #> "(see ", list(list("return_from()")), " or ", #> list(list("return_to()")), "). However, they have the\n", #> "advantage of being callable by name once established.\n"), #> "\n", list(list("Life cycle"), list("\n", "\n", #> "\n", "All the restart functions are in the questioning stage. It is not\n", #> "clear yet whether we want to recommend restarts as a style of\n", #> "programming in R.\n")), "\n", "\n", list("\n", #> "# Restarts are not the only way to jump to a previous frame, but\n", #> "# they have the advantage of being callable by name:\n", #> "fn <- function() with_restarts(g(), my_restart = function() \"returned\")\n", #> "g <- function() h()\n", "h <- function() { rst_jump(\"my_restart\"); \"not returned\" }\n", #> "fn()\n", "\n", "# Whereas a non-local return requires to manually pass the calling\n", #> "# frame to the return function:\n", "fn <- function() g(current_env())\n", #> "g <- function(env) h(env)\n", "h <- function(env) { return_from(env, \"returned\"); \"not returned\" }\n", #> "fn()\n", "\n", "\n", "# rst_maybe_jump() checks that a restart exists before trying to jump:\n", #> "fn <- function() {\n", " g()\n", " cat(\"will this be called?\\n\")\n", #> "}\n", "g <- function() {\n", " rst_maybe_jump(\"my_restart\")\n", #> " cat(\"will this be called?\\n\")\n", "}\n", #> "\n", "# Here no restart are on the stack:\n", #> "fn()\n", "\n", "# If a restart point called `my_restart` was established on the\n", #> "# stack before calling fn(), the control flow will jump there:\n", #> "rst <- function() {\n", " cat(\"restarting...\\n\")\n", #> " \"return value\"\n", "}\n", "with_restarts(fn(), my_restart = rst)\n", #> "\n", "\n", "# Restarts are particularly useful to provide alternative default\n", #> "# values when the normal output cannot be computed:\n", #> "\n", "fn <- function(valid_input) {\n", " if (valid_input) {\n", #> " return(\"normal value\")\n", " }\n", #> "\n", " # We decide to return the empty string \"\" as default value. An\n", #> " # altenative strategy would be to signal an error. In any case,\n", #> " # we want to provide a way for the caller to get a different\n", #> " # output. For this purpose, we provide two restart functions that\n", #> " # returns alternative defaults:\n", " restarts <- list(\n", #> " rst_empty_chr = function() character(0),\n", #> " rst_null = function() NULL\n", " )\n", #> "\n", " with_restarts(splice(restarts), .expr = {\n", #> "\n", " # Signal a typed condition to let the caller know that we are\n", #> " # about to return an empty string as default value:\n", #> " cnd_signal(\"default_empty_string\")\n", #> "\n", " # If no jump to with_restarts, return default value:\n", #> " \"\"\n", " })\n", "}\n", "\n", "# Normal value for valid input:\n", #> "fn(TRUE)\n", "\n", "# Default value for bad input:\n", #> "fn(FALSE)\n", "\n", "# Change the default value if you need an empty character vector by\n", #> "# defining a calling handler that jumps to the restart. It has to\n", #> "# be calling because exiting handlers jump to the place where they\n", #> "# are established before being executed, and the restart is not\n", #> "# defined anymore at that point:\n", "rst_handler <- calling(function(c) rst_jump(\"rst_empty_chr\"))\n", #> "with_handlers(fn(FALSE), default_empty_string = rst_handler)\n", #> "\n", "# You can use restarting() to create restarting handlers easily:\n", #> "with_handlers(fn(FALSE), default_empty_string = restarting(\"rst_null\"))\n"), #> "\n", list("\n", list(list("return_from()")), #> " and ", list(list("return_to()")), " for a more flexible way\n", #> "of performing a non-local jump to an arbitrary call frame.\n"), #> "\n", list("internal"), "\n"), wref_key.Rd = list( #> "% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/weakref.R", #> "\n", list("wref_key"), "\n", list("wref_key"), #> "\n", list("wref_value"), "\n", list("Get key/value from a weak reference object"), #> "\n", list("\n", "wref_key(x)\n", "\n", "wref_value(x)\n"), #> "\n", list("\n", list(list("x"), list("A weak reference object.")), #> "\n"), "\n", list("\n", "Get key/value from a weak reference object\n"), #> "\n", list("\n", list(list("is_weakref()")), #> " and ", list(list("new_weakref()")), ".\n"), #> "\n"), zap.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/s3.R", #> "\n", list("zap"), "\n", list("zap"), "\n", list( #> "is_zap"), "\n", list("Create zap objects"), #> "\n", list("\n", "zap()\n", "\n", "is_zap(x)\n"), #> "\n", list("\n", list(list("x"), list("An object to test.")), #> "\n"), "\n", list("\n", list("zap()"), " creates a sentinel object that indicates that an object\n", #> "should be removed. For instance, named zaps instruct ", #> list(list("env_bind()")), "\n", "and ", list( #> list("call_modify()")), " to remove those objects from the environment or\n", #> "the call.\n", "\n", "The advantage of zap objects is that they unambiguously signal the\n", #> "intent of removing an object. Sentinels like ", #> list("NULL"), " or\n", list(list("missing_arg()")), #> " are ambiguous because they represent valid R\n", #> "objects.\n"), "\n", list("\n", "# Create one zap object:\n", #> "zap()\n", "\n", "# Create a list of zaps:\n", #> "rep(list(zap()), 3)\n", "rep_named(c(\"foo\", \"bar\"), list(zap()))\n"), #> "\n"), zap_srcref.Rd = list("% Generated by roxygen2: do not edit by hand", #> "\n", "% Please edit documentation in R/attr.R", #> "\n", list("zap_srcref"), "\n", list("zap_srcref"), #> "\n", list("Zap source references"), "\n", list( #> "\n", "zap_srcref(x)\n"), "\n", list("\n", #> list(list("x"), list("An R object. Functions and calls are walked recursively.")), #> "\n"), "\n", list("\n", "There are a number of situations where R creates source references:\n", #> list("\n", list(), " Reading R code from a file with ", #> list("source()"), " and ", list("parse()"), #> " might save\n", "source references inside calls to ", #> list("function"), " and ", list("{"), ".\n", #> list(), " ", list(list("sys.call()")), " includes a source reference if possible.\n", #> list(), " Creating a closure stores the source reference from the call to\n", #> list("function"), ", if any.\n"), "\n", "\n", #> "These source references take up space and might cause a number of\n", #> "issues. ", list("zap_srcref()"), " recursively walks through expressions and\n", #> "functions to remove all source references.\n"), #> "\n")), source = list(abort.Rd = c("R/cnd-abort.R", #> "R/cnd-signal.R"), are_na.Rd = "R/vec-na.R", arg_match.Rd = "R/arg.R", #> as_box.Rd = "R/s3.R", as_bytes.Rd = "R/utils-encoding.R", #> as_data_mask.Rd = "R/eval-tidy.R", as_env.Rd = "R/lifecycle-retired.R", #> as_environment.Rd = "R/env.R", as_function.Rd = "R/fn.R", #> as_label.Rd = "R/deparse.R", as_name.Rd = "R/deparse.R", #> as_overscope.Rd = "R/lifecycle-retired.R", as_pairlist.Rd = "R/node.R", #> as_quosure.Rd = "R/quo.R", as_string.Rd = "R/sym.R", #> as_utf8_character.Rd = "R/utils-encoding.R", `bare-type-predicates.Rd` = "R/types.R", #> box.Rd = "R/s3.R", call2.Rd = "R/call.R", call_args.Rd = "R/call.R", #> call_fn.Rd = "R/call.R", call_inspect.Rd = "R/stack.R", #> call_modify.Rd = "R/call.R", call_name.Rd = "R/call.R", #> call_parse_type.Rd = "R/call.R", call_standardise.Rd = "R/call.R", #> caller_env.Rd = "R/env-special.R", caller_fn.Rd = "R/stack.R", #> caller_frame.Rd = "R/lifecycle-retired.R", catch_cnd.Rd = "R/cnd-handlers.R", #> chr_unserialise_unicode.Rd = "R/utils-encoding.R", #> cnd.Rd = c("R/cnd-error.R", "R/cnd.R"), cnd_message.Rd = "R/cnd-message.R", #> cnd_muffle.Rd = "R/cnd-handlers.R", cnd_signal.Rd = "R/cnd-signal.R", #> cnd_type.Rd = "R/cnd.R", done.Rd = "R/s3.R", dots_definitions.Rd = "R/dots.R", #> dots_n.Rd = "R/dots.R", dots_values.Rd = "R/dots.R", #> duplicate.Rd = "R/sexp.R", `dyn-dots.Rd` = "R/dots.R", #> empty_env.Rd = "R/env-special.R", enquo0.Rd = "R/nse-defuse.R", #> entrace.Rd = "R/cnd-entrace.R", env.Rd = "R/env.R", #> env_bind.Rd = "R/env-binding.R", env_bind_exprs.Rd = "R/lifecycle-retired.R", #> env_binding_are_active.Rd = "R/env-binding.R", env_binding_lock.Rd = "R/env-binding.R", #> env_browse.Rd = "R/env.R", env_bury.Rd = "R/lifecycle-retired.R", #> env_clone.Rd = "R/env.R", env_depth.Rd = "R/env.R", #> env_get.Rd = "R/env-binding.R", env_has.Rd = "R/env-binding.R", #> env_inherits.Rd = "R/env.R", env_lock.Rd = "R/env.R", #> env_name.Rd = "R/env-special.R", env_names.Rd = "R/env-binding.R", #> env_parent.Rd = "R/env.R", env_poke.Rd = "R/env-binding.R", #> env_print.Rd = "R/env.R", env_unbind.Rd = "R/env-binding.R", #> env_unlock.Rd = "R/env.R", eval_bare.Rd = "R/eval.R", #> eval_tidy.Rd = "R/eval-tidy.R", exec.Rd = "R/eval.R", #> exiting.Rd = "R/lifecycle-retired.R", expr_interp.Rd = "R/nse-force.R", #> expr_label.Rd = "R/expr.R", expr_print.Rd = "R/expr.R", #> exprs_auto_name.Rd = "R/nse-defuse.R", f_rhs.Rd = "R/formula.R", #> f_text.Rd = "R/formula.R", `faq-options.Rd` = "R/faq.R", #> flatten.Rd = "R/vec-squash.R", fn_body.Rd = "R/fn.R", #> fn_env.Rd = "R/fn.R", fn_fmls.Rd = "R/fn.R", format_error_bullets.Rd = "R/cnd-message.R", #> frame_position.Rd = "R/lifecycle-retired.R", friendly_type.Rd = "R/types.R", #> get_env.Rd = "R/env.R", has_length.Rd = "R/attr.R", #> has_name.Rd = "R/attr.R", hash.Rd = "R/hash.R", inherits_any.Rd = "R/s3.R", #> inject.Rd = "R/eval.R", invoke.Rd = "R/eval.R", is_call.Rd = "R/call.R", #> is_callable.Rd = "R/call.R", is_condition.Rd = "R/cnd.R", #> is_copyable.Rd = "R/types.R", is_empty.Rd = "R/types.R", #> is_env.Rd = "R/lifecycle-retired.R", is_environment.Rd = "R/types.R", #> is_expr.Rd = "R/lifecycle-retired.R", is_expression.Rd = "R/expr.R", #> is_formula.Rd = "R/formula.R", is_frame.Rd = "R/lifecycle-retired.R", #> is_function.Rd = "R/fn.R", is_installed.Rd = "R/env-special.R", #> is_integerish.Rd = "R/types.R", is_interactive.Rd = "R/state.R", #> is_lang.Rd = "R/lifecycle-retired.R", is_named.Rd = "R/attr.R", #> is_namespace.Rd = "R/env-special.R", is_pairlist.Rd = "R/node.R", #> is_reference.Rd = "R/types.R", is_stack.Rd = "R/lifecycle-retired.R", #> is_symbol.Rd = "R/sym.R", is_true.Rd = "R/types.R", #> is_weakref.Rd = "R/weakref.R", lang.Rd = "R/lifecycle-retired.R", #> lang_head.Rd = "R/lifecycle-retired.R", lang_modify.Rd = "R/lifecycle-retired.R", #> last_error.Rd = "R/cnd-abort.R", lifecycle.Rd = "R/lifecycle.R", #> list2.Rd = "R/dots.R", local_bindings.Rd = "R/env-binding.R", #> local_options.Rd = "R/state.R", missing.Rd = "R/vec-na.R", #> missing_arg.Rd = "R/arg.R", mut_node_car.Rd = "R/lifecycle-retired.R", #> names2.Rd = "R/attr.R", `new-vector-along-retired.Rd` = "R/lifecycle-retired.R", #> `new-vector.Rd` = "R/vec-new.R", new_call.Rd = "R/node.R", #> new_formula.Rd = "R/formula.R", new_function.Rd = "R/fn.R", #> new_node.Rd = "R/node.R", new_quosures.Rd = "R/quo.R", #> new_weakref.Rd = "R/weakref.R", ns_env.Rd = "R/env-special.R", #> `nse-defuse.Rd` = "R/nse-defuse.R", `nse-force.Rd` = "R/nse-force.R", #> `op-definition.Rd` = "R/operators.R", `op-get-attr.Rd` = "R/operators.R", #> `op-na-default.Rd` = "R/operators.R", `op-null-default.Rd` = "R/operators.R", #> overscope_eval_next.Rd = "R/lifecycle-retired.R", #> pairlist2.Rd = "R/call.R", parse_expr.Rd = "R/parse.R", #> parse_quosure.Rd = "R/lifecycle-retired.R", prepend.Rd = "R/lifecycle-retired.R", #> prim_name.Rd = "R/fn.R", quo_expr.Rd = "R/lifecycle-retired.R", #> quo_label.Rd = "R/quo.R", quo_squash.Rd = "R/quo.R", #> quosure.Rd = "R/quo.R", raw_deparse_str.Rd = "R/raw.R", #> rep_along.Rd = "R/vec-new.R", restarting.Rd = "R/cnd-handlers.R", #> return_from.Rd = "R/stack.R", rlang_backtrace_on_error.Rd = "R/cnd-abort.R", #> rst_abort.Rd = "R/cnd-restarts.R", rst_list.Rd = "R/cnd-restarts.R", #> `scalar-type-predicates.Rd` = "R/types.R", scoped_env.Rd = "R/lifecycle-retired.R", #> scoped_interactive.Rd = "R/lifecycle-retired.R", #> search_envs.Rd = "R/env-special.R", seq2.Rd = "R/vec.R", #> set_attrs.Rd = "R/lifecycle-retired.R", set_expr.Rd = "R/expr.R", #> set_names.Rd = "R/attr.R", splice.Rd = "R/dots.R", #> stack.Rd = "R/lifecycle-retired.R", stack_trim.Rd = "R/lifecycle-retired.R", #> string.Rd = "R/utils-encoding.R", switch_type.Rd = "R/lifecycle-retired.R", #> sym.Rd = "R/sym.R", `tidyeval-data.Rd` = "R/eval-tidy.R", #> trace_back.Rd = "R/trace.R", `type-predicates.Rd` = "R/types.R", #> type_of.Rd = "R/lifecycle-retired.R", vec_poke_n.Rd = "R/vec.R", #> `vector-coercion.Rd` = "R/lifecycle-retired.R", `vector-construction.Rd` = "R/vec-new.R", #> `vector-old-ctors.Rd` = "R/lifecycle-retired.R", #> with_abort.Rd = "R/cnd-entrace.R", with_env.Rd = "R/eval.R", #> with_handlers.Rd = "R/cnd-handlers.R", with_restarts.Rd = "R/cnd-restarts.R", #> wref_key.Rd = "R/weakref.R", zap.Rd = "R/s3.R", zap_srcref.Rd = "R/attr.R"), #> keywords = list(character(0), "internal", character(0), #> character(0), "internal", character(0), "internal", #> character(0), character(0), character(0), character(0), #> "internal", "internal", character(0), character(0), #> "internal", character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), "internal", character(0), character(0), #> "internal", "internal", character(0), "internal", #> "internal", character(0), "internal", character(0), #> "internal", character(0), "internal", "internal", #> "internal", "internal", character(0), character(0), #> character(0), character(0), character(0), character(0), #> "internal", "internal", "internal", character(0), #> "internal", character(0), character(0), character(0), #> character(0), character(0), "internal", character(0), #> character(0), character(0), character(0), character(0), #> character(0), "internal", character(0), character(0), #> character(0), "internal", character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), "internal", character(0), character(0), #> character(0), character(0), "internal", "internal", #> character(0), "internal", character(0), character(0), #> character(0), character(0), "internal", character(0), #> "internal", "internal", "internal", character(0), #> "internal", character(0), "internal", character(0), #> character(0), "internal", character(0), character(0), #> character(0), character(0), "internal", character(0), #> character(0), "internal", "internal", "internal", #> character(0), character(0), character(0), "internal", #> "internal", "internal", character(0), "internal", #> character(0), character(0), "experimental", c("datasets", #> "internal"), character(0), "internal", character(0), #> "internal", "internal", "internal", character(0), #> character(0), "internal", character(0), "experimental", #> "internal", character(0), character(0), "internal", #> character(0), character(0), character(0), "internal", #> character(0), character(0), "internal", "internal", #> "internal", "internal", character(0), character(0), #> character(0), character(0), character(0), "internal", #> "internal", character(0), "internal", "internal", #> character(0), "internal", character(0), "internal", #> character(0), "internal", character(0), character(0), #> "internal", "internal", "internal", "internal", "internal", #> character(0), "datasets", character(0), character(0), #> "internal", "internal", "internal", character(0), #> "internal", character(0), "internal", character(0), #> "internal", character(0), character(0), character(0)), #> concepts = list(character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0), #> character(0), character(0), character(0), character(0)), #> internal = c(FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, #> TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, #> FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, #> FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, #> TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, #> TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, #> TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, #> FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, #> TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, #> FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, #> FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, #> FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, #> TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, #> TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, #> TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, #> FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, #> FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, #> FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, #> FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, #> TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, #> TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, #> TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, #> FALSE, FALSE, FALSE)), tutorials = list(name = character(0), #> file_out = character(0), title = character(0), pagetitle = character(0), #> url = character(0)), vignettes = list(name = character(0), #> file_in = character(0), file_out = character(0), title = character(0), #> description = character(0)))), examples = base::quote(TRUE), #> run_dont_run = base::quote(FALSE), seed = base::quote(1014), #> lazy = base::quote(FALSE), override = base::quote(list()), #> install = base::quote(FALSE), preview = base::quote(FALSE), #> new_process = base::quote(FALSE), devel = base::quote(FALSE), #> crayon_enabled = base::quote(TRUE), crayon_colors = base::quote(256L), #> pkgdown_internet = base::quote(TRUE)) #> #> [[13]] #> pkgdown::build_site(...) #> #> [[14]] #> build_site_local( #> pkg = pkg, #> examples = examples, #> run_dont_run = run_dont_run, #> seed = seed, #> lazy = lazy, #> override = override, #> preview = preview, #> devel = devel #> ) #> #> [[15]] #> build_reference(pkg, #> lazy = lazy, #> examples = examples, #> run_dont_run = run_dont_run, #> seed = seed, #> override = override, #> preview = FALSE, #> devel = devel #> ) #> #> [[16]] #> purrr::map(topics, #> build_reference_topic, #> pkg = pkg, #> lazy = lazy, #> examples = examples, #> run_dont_run = run_dont_run #> ) #> #> [[17]] #> .Call(map_impl, environment(), ".x", ".f", "list") #> #> [[18]] #> data <- withCallingHandlers( #> data_reference_topic( #> topic, #> pkg, #> examples = examples, #> run_dont_run = run_dont_run #> ), #> error = function(err) { #> msg <- c( #> paste0("Failed to parse Rd in ", topic$file_in), #> i = err$message #> ) #> abort(msg, parent = err) #> } #> ) #> #> [[19]] #> data <- withCallingHandlers( #> data_reference_topic( #> topic, #> pkg, #> examples = examples, #> run_dont_run = run_dont_run #> ), #> error = function(err) { #> msg <- c( #> paste0("Failed to parse Rd in ", topic$file_in), #> i = err$message #> ) #> abort(msg, parent = err) #> } #> ) #> #> [[20]] #> out$examples <- run_examples( #> tags$tag_examples[[1]], #> env = new.env(parent = globalenv()), #> topic = tools::file_path_sans_ext(topic$file_in), #> run_examples = examples, #> run_dont_run = run_dont_run #> ) #> #> [[21]] #> highlight_examples(code, topic, env = env) #> #> [[22]] #> downlit::evaluate_and_highlight( #> code, #> fig_save = fig_save_topic, #> env = child_env(env) #> ) #> #> [[23]] #> expr <- evaluate::evaluate(code, child_env(env), new_device = TRUE, #> output_handler = output_handler) #> #> [[24]] #> out[[i]] <- evaluate_call( #> expr, parsed$src[[i]], #> envir = envir, enclos = enclos, debug = debug, last = i == length(out), #> use_try = stop_on_error != 2L, #> keep_warning = keep_warning, keep_message = keep_message, #> output_handler = output_handler, #> include_timing = include_timing) #> #> [[25]] #> time <- timing_fn(handle(ev <- withCallingHandlers( #> withVisible(eval(expr, envir, enclos)), #> warning = wHandler, error = eHandler, message = mHandler))) #> #> [[26]] #> time <- timing_fn(handle(ev <- withCallingHandlers( #> withVisible(eval(expr, envir, enclos)), #> warning = wHandler, error = eHandler, message = mHandler))) #> #> [[27]] #> handle <- function(f) try(f, silent = TRUE) #> #> [[28]] #> tryCatch(expr, error = function(e) { #> call <- conditionCall(e) #> if (!is.null(call)) { #> if (identical(call[[1L]], quote(doTryCatch))) #> call <- sys.call(-4L) #> dcall <- deparse(call)[1L] #> prefix <- paste("Error in", dcall, ": ") #> LONG <- 75L #> sm <- strsplit(conditionMessage(e), "\n")[[1L]] #> w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") #> if (is.na(w)) #> w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], #> type = "b") #> if (w > LONG) #> prefix <- paste0(prefix, "\n ") #> } #> else prefix <- "Error : " #> msg <- paste0(prefix, conditionMessage(e), "\n") #> .Internal(seterrmessage(msg[1L])) #> if (!silent && isTRUE(getOption("show.error.messages"))) { #> cat(msg, file = outFile) #> .Internal(printDeferredWarnings()) #> } #> invisible(structure(msg, class = "try-error", condition = e)) #> }) #> #> [[29]] #> tryCatchList(expr, classes, parentenv, handlers) #> #> [[30]] #> tryCatchOne(expr, names, parentenv, handlers[[1L]]) #> #> [[31]] #> doTryCatch(return(expr), name, parentenv, handler) #> #> [[32]] #> time <- timing_fn(handle(ev <- withCallingHandlers( #> withVisible(eval(expr, envir, enclos)), #> warning = wHandler, error = eHandler, message = mHandler))) #> #> [[33]] #> time <- timing_fn(handle(ev <- withCallingHandlers( #> withVisible(eval(expr, envir, enclos)), #> warning = wHandler, error = eHandler, message = mHandler))) #> #> [[34]] #> time <- timing_fn(handle(ev <- withCallingHandlers( #> withVisible(eval(expr, envir, enclos)), #> warning = wHandler, error = eHandler, message = mHandler))) #> #> [[35]] #> eval(expr, envir, enclos) #> #> [[36]] #> do.call(fn, list(mtcars)) #> #> [[37]] #> (function(...) sys.calls())(list(mpg = c(21, 21, 22.8, 21.4, #> 18.7, 18.1, 14.3, 24.4, 22.8, 19.2, 17.8, 16.4, 17.3, 15.2, 10.4, #> 10.4, 14.7, 32.4, 30.4, 33.9, 21.5, 15.5, 15.2, 13.3, 19.2, 27.3, #> 26, 30.4, 15.8, 19.7, 15, 21.4), cyl = c(6, 6, 4, 6, 8, 6, 8, #> 4, 4, 6, 6, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 8, 8, 8, 8, 4, 4, 4, #> 8, 6, 8, 4), disp = c(160, 160, 108, 258, 360, 225, 360, 146.7, #> 140.8, 167.6, 167.6, 275.8, 275.8, 275.8, 472, 460, 440, 78.7, #> 75.7, 71.1, 120.1, 318, 304, 350, 400, 79, 120.3, 95.1, 351, #> 145, 301, 121), hp = c(110, 110, 93, 110, 175, 105, 245, 62, #> 95, 123, 123, 180, 180, 180, 205, 215, 230, 66, 52, 65, 97, 150, #> 150, 245, 175, 66, 91, 113, 264, 175, 335, 109), drat = c(3.9, #> 3.9, 3.85, 3.08, 3.15, 2.76, 3.21, 3.69, 3.92, 3.92, 3.92, 3.07, #> 3.07, 3.07, 2.93, 3, 3.23, 4.08, 4.93, 4.22, 3.7, 2.76, 3.15, #> 3.73, 3.08, 4.08, 4.43, 3.77, 4.22, 3.62, 3.54, 4.11), wt = c(2.62, #> 2.875, 2.32, 3.215, 3.44, 3.46, 3.57, 3.19, 3.15, 3.44, 3.44, #> 4.07, 3.73, 3.78, 5.25, 5.424, 5.345, 2.2, 1.615, 1.835, 2.465, #> 3.52, 3.435, 3.84, 3.845, 1.935, 2.14, 1.513, 3.17, 2.77, 3.57, #> 2.78), qsec = c(16.46, 17.02, 18.61, 19.44, 17.02, 20.22, 15.84, #> 20, 22.9, 18.3, 18.9, 17.4, 17.6, 18, 17.98, 17.82, 17.42, 19.47, #> 18.52, 19.9, 20.01, 16.87, 17.3, 15.41, 17.05, 18.9, 16.7, 16.9, #> 14.5, 15.5, 14.6, 18.6), vs = c(0, 0, 1, 1, 0, 1, 0, 1, 1, 1, #> 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, #> 1), am = c(1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, #> 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1), gear = c(4, 4, #> 4, 3, 3, 3, 3, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 4, 4, 4, 3, 3, 3, #> 3, 3, 4, 5, 5, 5, 5, 5, 4), carb = c(4, 4, 1, 1, 2, 1, 4, 2, #> 2, 4, 4, 3, 3, 3, 4, 4, 4, 1, 2, 1, 1, 2, 2, 4, 2, 1, 2, 2, 4, #> 6, 8, 2))) #> # Specify the function name either by supplying a string # identifying the function (it should be visible in .env): invoke("call_inspect", letters) #> call_inspect(`1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, #> `11`, `12`, `13`, `14`, `15`, `16`, `17`, `18`, `19`, `20`, #> `21`, `22`, `23`, `24`, `25`, `26`) # Or by changing the .bury argument, with which you can also change # the argument prefix: invoke(call_inspect, mtcars, .bury = c("inspect!", "col")) #> `inspect!`(mpg = col1, cyl = col2, disp = col3, hp = col4, drat = col5, #> wt = col6, qsec = col7, vs = col8, am = col9, gear = col10, #> carb = col11)