diff --git a/.github/workflows/test-actions.yaml b/.github/workflows/test-actions.yaml index 0bfb9f69..0300128b 100644 --- a/.github/workflows/test-actions.yaml +++ b/.github/workflows/test-actions.yaml @@ -35,8 +35,10 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: - "local::." + needs: | + shinytest2-testing + extra-packages: | + local::. # ## Suggested usage # - name: Test app diff --git a/DESCRIPTION b/DESCRIPTION index c3bed56e..9c49be5c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -35,6 +35,7 @@ Imports: rlang (>= 1.0.0), rmarkdown, shiny, + pkgload, withr, lifecycle Suggests: @@ -52,6 +53,8 @@ Suggests: usethis, vdiffr (>= 1.0.0), spelling +Config/Needs/shinytest2-testing: + decor Config/Needs/check: rstudio/shiny, bslib diff --git a/R/app-driver-start.R b/R/app-driver-start.R index f17f374b..9120832b 100644 --- a/R/app-driver-start.R +++ b/R/app-driver-start.R @@ -1,6 +1,11 @@ +# Do not delete +# Paired with tests/testthat/apps/test-env/ 's tests on `.internal_value_used_by_shinytest2_test` +.internal_value_used_by_shinytest2_test <- TRUE # nolint app_start_shiny <- function( - self, private, + self, + private, + ..., seed = NULL, load_timeout = 10000, shiny_args = list(), @@ -14,6 +19,18 @@ app_start_shiny <- function( # the RNG kind should inherit from the parent process rng_kind <- RNGkind() + package_path <- tryCatch(pkgload::pkg_path(), error = function(e) NULL) + package_name <- tryCatch(pkgload::pkg_name(), error = function(e) NULL) + + # `testthat::is_checking()` is TRUE inside `testthat::test_check()`, typically + # called in `R CMD check`. + # If we're doing R CMD check, we only want to use installed packages. + # Therefore, disable the local package sourcing + if (testthat::is_checking()) { + package_path <- NULL + package_name <- NULL + } + p <- local({ # https://github.com/r-lib/testthat/issues/603 withr::local_envvar(c("R_TESTS" = NA)) @@ -25,46 +42,77 @@ app_start_shiny <- function( stderr = sprintf(tempfile_format, "shiny-stderr"), supervise = TRUE, args = list( - app_dir = self$get_dir(), - shiny_args = shiny_args, - has_rmd = app_dir_has_rmd(self, private), - seed = seed, - rng_kind = rng_kind, - render_args = render_args, - options = options + .app_dir = self$get_dir(), + .shiny_args = shiny_args, + .has_rmd = app_dir_has_rmd(self, private), + .seed = seed, + .rng_kind = rng_kind, + .render_args = render_args, + .options = options, + .package_name = package_name, + .package_path = package_path ), - function(app_dir, shiny_args, has_rmd, seed, rng_kind, render_args, options) { - - if (!is.null(seed)) { + function( + .app_dir, + .shiny_args, + .has_rmd, + .seed, + .rng_kind, + .render_args, + .options, + .package_name, + .package_path + ) { + if (!is.null(.seed)) { # Prior to R 3.6, RNGkind has 2 args, otherwise it has 3 - do.call(RNGkind, as.list(rng_kind)) - set.seed(seed) - getNamespace("shiny")$withPrivateSeed(set.seed(seed + 11)) + do.call(RNGkind, as.list(.rng_kind)) + set.seed(.seed) + getNamespace("shiny")$withPrivateSeed(set.seed(.seed + 11)) } - options <- as.list(options) - options[["shiny.testmode"]] <- TRUE + .options <- as.list(.options) + .options[["shiny.testmode"]] <- TRUE # TODO-future; Adjust shiny to add htmldeps to the list of the rendered page # options[["shiny-testmode-html-dep"]] <- getTracerDep() - do.call(base::options, options) - - # Return value is important for `AppDriver$stop()` - # Do not add code after this if else block - if (has_rmd) { - # Shiny document - rmarkdown::run( - file = NULL, # Do not open anything in browser - dir = app_dir, - default_file = NULL, # Let rmarkdown find the default file - # DO NOT ENABLE! Makes things like `app$wait_for_idle()` not work as expected. - auto_reload = FALSE, # Do not constantly poll for file changes. Drastically reduces `app$get_logs()` - shiny_args = shiny_args, - render_args = render_args + do.call(base::options, .options) + + # Taken inspiration from `testthat:::test_files_setup`. + # Motivation: + # * Shiny will only have access to the installed package namepace after + # a library call, so during testing we should try to mimic this + # behavior to avoid surprises + # * Whereas testthat wants to have already `library()`ed {testthat} and + # the package by the time the test file is sourced + if (!is.null(.package_path)) { + pkgload::load_all( + .package_path, + # Be sure to add the local package to the search path, + # but do not "library()" the local package. + # (Typically) Shiny will not have access to the local package + # until the package is loaded. We should mimic this behavior! + attach = FALSE, ) - } else { - # Normal shiny app - do.call(shiny::runApp, c(app_dir, shiny_args)) } + + ret <- + if (.has_rmd) { + # Shiny document + rmarkdown::run( + file = NULL, # Do not open anything in browser + dir = .app_dir, + default_file = NULL, # Let rmarkdown find the default file + # DO NOT ENABLE! Makes things like `app$wait_for_idle()` not work as expected. + auto_reload = FALSE, # Do not constantly poll for file changes. Drastically reduces `app$get_logs()` + shiny_args = .shiny_args, + render_args = .render_args + ) + } else { + # Normal shiny app + do.call(shiny::runApp, c(.app_dir, .shiny_args)) + } + + # Return value is important for `AppDriver$stop()` + return(ret) } ) }) @@ -72,11 +120,15 @@ app_start_shiny <- function( private$shiny_process <- p # nolint "!DEBUG waiting for shiny to start" - if (! p$is_alive()) { - app_abort(self, private, paste0( - "Failed to start shiny. Error:\n", - strwrap(readLines(p$get_error_file())) - )) + if (!p$is_alive()) { + app_abort( + self, + private, + paste0( + "Failed to start shiny. Error:\n", + strwrap(readLines(p$get_error_file())) + ) + ) } "!DEBUG finding shiny port" @@ -87,27 +139,35 @@ app_start_shiny <- function( err_lines <- readLines(p$get_error_file()) if (!p$is_alive()) { - app_abort(self, private, paste0( - "Error starting shiny application:\n", - paste(err_lines, collapse = "\n") - )) + app_abort( + self, + private, + paste0( + "Error starting shiny application:\n", + paste(err_lines, collapse = "\n") + ) + ) } if (any(grepl("Listening on http", err_lines, fixed = TRUE))) break Sys.sleep(0.2) if (i == max_i) { - app_abort(self, private, sprintf( - paste( - "The Shiny app failed to start up within %s second%s.", - "To increase the loading timeout, consult the documentation in `?AppDriver`", - "for the `load_timeout` argument of `AppDriver$new()`.", - "The app printed the following lines to stderr during start up:\n%s" - ), - load_timeout / 1000, - if (load_timeout == 1000) "" else "s", - paste(err_lines, collapse = "\n") - )) + app_abort( + self, + private, + sprintf( + paste( + "The Shiny app failed to start up within %s second%s.", + "To increase the loading timeout, consult the documentation in `?AppDriver`", + "for the `load_timeout` argument of `AppDriver$new()`.", + "The app printed the following lines to stderr during start up:\n%s" + ), + load_timeout / 1000, + if (load_timeout == 1000) "" else "s", + paste(err_lines, collapse = "\n") + ) + ) } } diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/DESCRIPTION new file mode 100644 index 00000000..1f4902a4 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/DESCRIPTION @@ -0,0 +1,29 @@ +Package: R6 +Title: Encapsulated Classes with Reference Semantics +Version: 2.5.1 +Authors@R: person("Winston", "Chang", role = c("aut", "cre"), email = "winston@stdout.org") +Description: Creates classes with reference semantics, similar to R's built-in + reference classes. Compared to reference classes, R6 classes are simpler + and lighter-weight, and they are not built on S4 classes so they do not + require the methods package. These classes allow public and private + members, and they support inheritance, even when the classes are defined in + different packages. +Depends: R (>= 3.0) +Suggests: testthat, pryr +License: MIT + file LICENSE +URL: https://r6.r-lib.org, https://github.com/r-lib/R6/ +BugReports: https://github.com/r-lib/R6/issues +RoxygenNote: 7.1.1 +NeedsCompilation: no +Packaged: 2021-08-06 20:18:46 UTC; winston +Author: Winston Chang [aut, cre] +Maintainer: Winston Chang +Repository: CRAN +Date/Publication: 2021-08-19 14:00:05 UTC +Built: R 4.4.1; ; 2025-02-01 04:45:16 UTC; unix +RemoteType: standard +RemotePkgRef: R6 +RemoteRef: R6 +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 2.5.1 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/INDEX new file mode 100644 index 00000000..2699e806 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/INDEX @@ -0,0 +1,3 @@ +R6Class Create an R6 reference object generator +as.list.R6 Create a list from an R6 object +is.R6 Is an object an R6 Class Generator or Object? diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/LICENSE new file mode 100644 index 00000000..9b8dd6ae --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2015 +COPYRIGHT HOLDER: RStudio diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/Meta/Rd.rds new file mode 100644 index 00000000..c0a6da4c Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/Meta/hsearch.rds new file mode 100644 index 00000000..b74d51e5 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/Meta/links.rds new file mode 100644 index 00000000..90c7e83c Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/Meta/nsInfo.rds new file mode 100644 index 00000000..fc1a940d Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/Meta/package.rds new file mode 100644 index 00000000..fbdf7dd4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/NAMESPACE new file mode 100644 index 00000000..b2524316 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/NAMESPACE @@ -0,0 +1,11 @@ +# Generated by roxygen2: do not edit by hand + +S3method(as.list,R6) +S3method(format,R6) +S3method(format,R6ClassGenerator) +S3method(plot,R6) +S3method(print,R6) +S3method(print,R6ClassGenerator) +export(R6Class) +export(is.R6) +export(is.R6Class) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/NEWS.md new file mode 100644 index 00000000..893156d3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/NEWS.md @@ -0,0 +1,145 @@ +R6 2.5.1 +======== + +* Removed unused packages from `Suggests` section in DESCRIPTION. + +R6 2.5.0 +======== + +* Resolved #195: Slightly clearer message when there is an error in the `initialize()` method. + +* Fixed #214: When a non-portable object inheritance was cloned, methods that were inherited (and not overridden) had the wrong environment. (#215, #217) + +* Printing R6 objects, no longer includes `.__active__`. + +R6 2.4.1 +======== + +* Cloning active bindings previously relied on buggy behavior in `as.list.environment()`, which would return the active binding's function definition rather than the value from invoking the function. In R 4.0, the behavior will chang so that it returns the value. R6 now no longer relies on this buggy behavior. (#192) + +R6 2.4.0 +======== + +* Fixed #146: Finalizers can now be private methods. (#181) + +* Fixed #167: Finalizers now run on cloned objects. (#180) + +R6 2.3.0 +======== + +* Vignettes are no longer included as part of the source package because of their large size. Documentation is now at https://r6.r-lib.org/. + +* Fixed #125: The `print.R6` method now always returns the object that was passed to it. + +* Fixed #155: In some cases, a cloned object's methods could refer to the wrong `super` object. (#156) + +* Fixed #94, #133: When cloning an object which contained a function that is *not* a method, the corresponding function in the new object would have its environment changed, as though it were a method. Now it no longer has a changed environment. (#156) + +* Fixed #121: If a `finalize` method was present, it would prevent objects passed to `initialize` from getting GC'd. + +* Fixed #158: If a `$set` method of an R6 generator object is given the value `NULL`, it previously removed the named item. Now it adds the named item with the value `NULL`. + +* Fixed #159: Printing an R6 object containing a large vector was slow. + + +R6 2.2.2 +======== + +* Fixed #108: When an object with a `super` object and an active binding in the `super` object was cloned, the new object's `super` object did not get the active binding -- it was a normal function. + +* Fixed #119: When a class had two levels of inheritance, an instance of that class's `super` object could contain methods that had an incorrect enclosing environment. + + +R6 2.2.1 +======== + +* Vignettes now only try use the microbenchmark package if it is present. This is so that the package builds properly on platforms where microbenchmark is not present, like Solaris. + +* Fixed ending position for `trim()`. + +R6 2.2.0 +======== + +* Classes can define finalizers explicitly, by defining a public `finalize` method. (#92, #93) + +* Added function `is.R6()` and `is.R6Class()`. (#95) + +* Fixed #96: R6 now avoids using `$` and `[[` after the class has been assigned to the object. This allows the user to provide their own methods for `$` and `[[` without causing problems to R6's operation. + +R6 2.1.3 +======== + +* The `plot` S3 method for R6 objects will call `$plot` on the object if present. (#77) + +* Fixed printing of members that are R6 objects. (#88) + +* Fixed deep cloning for non-portable classes. (#85) + +* Added `as.list.R6` method. (#91) + +R6 2.1.2 +======== + +* Implemented `format.R6()` and `format.R6ClassGenerator`, the former calls a public `format` method if defined. This might change the functionality of existing classes that define a public `format` method intended for other purposes (#73. Thanks to Kirill Müller) + +* Functions are shown with their interface in `print` and `format`, limited to one line (#76. Thanks to Kirill Müller) + +* R6 objects and generators print out which class they inherit from. (#67) + +R6 2.1.1 +======== + +* Fixed a bug with printing R6 objects when a `[[` method is defined for the class. (#70) + +* Fixed cloning of objects that call a `super` method which accesses `private`. (#72) + +R6 2.1.0 +======== + +* Added support for making clones of R6 objects with a `clone()` method on R6 objects. The `deep=TRUE` option allows for making clones that have copies of fields with reference semantics (like other R6 objects). (#27) + +* Allow adding public or private members when there were no public or private members to begin with. (#51) + +* Previously, when an R6 object was printed, it accessed (and called) active bindings. Now it simply reports that a field is an active binding. (#37, #38. Thanks to Oscar de Lama) + +* Printing private members now works correctly for portable R6 objects. (#26) + +* The 'lock' argument has been renamed to 'lock_objects'. Also, there is a new argument, 'lock_class', which can prevent changes to the class. (#52) + +* Fixed printing of NULL fields. + +R6 2.0.1 +======== + +* A superclass is validated on object instantation, not on class creation. + +* Added `debug` and `undebug` methods to generator object. + +R6 2.0 +======== + +* [BREAKING CHANGE] Added `portable` option, which allows inheritance across different package namespaces, and made it the default. + +* Added `set()` method on class generator object, so new fields and methods can be added after the generator has been created. + +* All of the functions involved in instantiating objects are encapsulated in an environment separate from the R6 namespace. This means that if a generator is created with one version of R6, saved, then restored in a new R session that has a different version of R6, there shouldn't be any problems with compatibility. + +* Methods are locked so that they can't be changed. (Fixes #19) + +* Inheritance of superclasses is dynamic; instead of reading in the superclass when a class is created, this happens each time an object is instantiated. (Fixes #12) + +* Added trailing newline when printing R6 objects. (Thanks to Gabor Csardi) + +* The `print` method of R6 objects can be redefined. (Thanks to Gabor Csardi) + +R6 1.0.1 +======== + +* First release on CRAN. + +* Removed pryr from suggested packages. + +R6 1.0 +======== + +* First release diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/R/R6 b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/R/R6 new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/R/R6 @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/R/R6.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/R/R6.rdb new file mode 100644 index 00000000..6139954f Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/R/R6.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/R/R6.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/R/R6.rdx new file mode 100644 index 00000000..310f2fae Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/R/R6.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/help/AnIndex new file mode 100644 index 00000000..05d6e1a7 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/help/AnIndex @@ -0,0 +1,5 @@ +as.list.R6 as.list.R6 +is.R6 is.R6 +is.R6Class is.R6 +R6 R6Class +R6Class R6Class diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/help/R6.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/help/R6.rdb new file mode 100644 index 00000000..555f80bb Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/help/R6.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/help/R6.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/help/R6.rdx new file mode 100644 index 00000000..ddbf185a Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/help/R6.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/help/aliases.rds new file mode 100644 index 00000000..2028f0fc Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/help/figures/logo.png b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/help/figures/logo.png new file mode 100644 index 00000000..c8abfbf7 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/help/figures/logo.png differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/help/figures/logo.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/help/figures/logo.svg new file mode 100644 index 00000000..452a52c5 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/help/figures/logo.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/help/paths.rds new file mode 100644 index 00000000..eb9c901a Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/html/00Index.html new file mode 100644 index 00000000..663d234e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/html/00Index.html @@ -0,0 +1,36 @@ + + +R: Encapsulated Classes with Reference Semantics + + + +
+

Encapsulated Classes with Reference Semantics + +

+
+
+[Up] +[Top] +

Documentation for package ‘R6’ version 2.5.1

+ + + +

Help Pages

+ + + + + + + + + + + + + +
as.list.R6Create a list from an R6 object
is.R6Is an object an R6 Class Generator or Object?
is.R6ClassIs an object an R6 Class Generator or Object?
R6Create an R6 reference object generator
R6ClassCreate an R6 reference object generator
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/R6/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/R6.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/R6.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/brew.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/brew.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/callr.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/callr.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/cli.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/cli.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/commonmark.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/commonmark.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/desc.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/desc.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/evaluate.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/evaluate.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/fs.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/fs.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/glue.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/glue.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/highr.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/highr.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/knitr.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/knitr.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/lifecycle.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/lifecycle.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/magrittr.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/magrittr.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/pkgbuild.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/pkgbuild.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/pkgload.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/pkgload.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/processx.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/processx.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/ps.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/ps.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/purrr.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/purrr.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/rlang.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/rlang.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/roxygen2.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/roxygen2.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/rprojroot.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/rprojroot.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/rstudioapi.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/rstudioapi.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/stringi.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/stringi.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/stringr.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/stringr.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/vctrs.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/vctrs.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/whisker.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/whisker.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/withr.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/withr.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/xfun.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/xfun.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/xml2.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/xml2.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/yaml.lock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/_cache/yaml.lock new file mode 100644 index 00000000..e69de29b diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/DESCRIPTION new file mode 100644 index 00000000..dc48976f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/DESCRIPTION @@ -0,0 +1,31 @@ +Type: Package +Package: brew +Title: Templating Framework for Report Generation +Version: 1.0-10 +Authors@R: c( + person("Jeffrey", "Horner", role = c("aut", "cph")), + person("Greg", "Hunt", , "greg@firmansyah.com", role = c("aut", "cre", "cph")) + ) +Description: Implements a templating framework for mixing text and R code + for report generation. brew template syntax is similar to PHP, Ruby's + erb module, Java Server Pages, and Python's psp module. +License: GPL (>= 2) +URL: https://github.com/gregfrog/brew +BugReports: https://github.com/gregfrog/brew/issues +Suggests: testthat (>= 3.0.0) +Config/testthat/edition: 3 +Encoding: UTF-8 +Repository: CRAN +NeedsCompilation: no +Packaged: 2023-12-16 07:21:30 UTC; greg +Author: Jeffrey Horner [aut, cph], + Greg Hunt [aut, cre, cph] +Maintainer: Greg Hunt +Date/Publication: 2023-12-16 08:30:02 UTC +Built: R 4.4.1; ; 2025-01-24 20:23:04 UTC; unix +RemoteType: standard +RemotePkgRef: brew +RemoteRef: brew +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 1.0-10 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/INDEX new file mode 100644 index 00000000..ea4eb95e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/INDEX @@ -0,0 +1,2 @@ +brew Report Brewing For Text and R Output +brewCache Caching Brew Templates diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Meta/Rd.rds new file mode 100644 index 00000000..333e9045 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Meta/hsearch.rds new file mode 100644 index 00000000..60a0f116 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Meta/links.rds new file mode 100644 index 00000000..ff3e124e Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Meta/nsInfo.rds new file mode 100644 index 00000000..c78a376d Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Meta/package.rds new file mode 100644 index 00000000..04d11d61 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/NAMESPACE new file mode 100644 index 00000000..7ce85565 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/NAMESPACE @@ -0,0 +1,7 @@ +export(setBufLen) +export(brewCache) +export(brewCacheOn) +export(brewCacheOff) +export(brew) +importFrom("utils", "head") +importFrom("utils", "tail") \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/R/brew b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/R/brew new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/R/brew @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/R/brew.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/R/brew.rdb new file mode 100644 index 00000000..91abe0f5 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/R/brew.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/R/brew.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/R/brew.rdx new file mode 100644 index 00000000..b354d87b Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/R/brew.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Sweave-test-1-006.pdf b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Sweave-test-1-006.pdf new file mode 100644 index 00000000..3926a503 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Sweave-test-1-006.pdf differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Sweave-test-1-007.pdf b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Sweave-test-1-007.pdf new file mode 100644 index 00000000..8e1d93e3 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Sweave-test-1-007.pdf differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Sweave-test-1.tex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Sweave-test-1.tex new file mode 100644 index 00000000..757a5c43 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/Sweave-test-1.tex @@ -0,0 +1,127 @@ +% -*- mode: noweb; noweb-default-code-mode: R-mode; -*- +\documentclass[a4paper]{article} + +\title{A Test File} +\author{Friedrich Leisch} + + +\usepackage{a4wide} + +\usepackage{/usr/share/R/share/texmf/Sweave} +\begin{document} + +\maketitle + +A simple example that will run in any S engine: The integers from 1 to +10 are +\begin{Verbatim} + [1] 1 2 3 4 5 6 7 8 9 10 +\end{Verbatim} + +We can also emulate a simple calculator: +\begin{Schunk} +\begin{Sinput} +> 1 + 1 +\end{Sinput} +\begin{Soutput} +[1] 2 +\end{Soutput} +\begin{Sinput} +> 1 + pi +\end{Sinput} +\begin{Soutput} +[1] 4.141593 +\end{Soutput} +\begin{Sinput} +> sin(pi/2) +\end{Sinput} +\begin{Soutput} +[1] 1 +\end{Soutput} +\end{Schunk} + +Now we look at Gaussian data: + +\begin{Schunk} +\begin{Soutput} + [1] 1.975020082 -0.596560482 0.379859890 1.279714455 -0.305434367 + [6] 0.001238350 -0.434984359 -0.316102851 -0.050375397 0.541407408 +[11] -0.559675652 -0.269072911 1.352853069 -1.826236281 -0.021364586 +[16] 0.201180022 0.744513870 1.080508219 0.524392703 0.226922429 +\end{Soutput} +\begin{Soutput} + One Sample t-test + +data: x +t = 1.0387, df = 19, p-value = 0.312 +alternative hypothesis: true mean is not equal to 0 +95 percent confidence interval: + -0.1993585 0.5921388 +sample estimates: +mean of x +0.1963902 +\end{Soutput} +\end{Schunk} +Note that we can easily integrate some numbers into standard text: The +third element of vector \texttt{x} is 0.379859889601437, the +$p$-value of the test is 0.312. % $ + +Now we look at a summary of the famous iris data set, and we want to +see the commands in the code chunks: + + + +% the following code is R-specific, as data(iris) will not run in Splus. +% Hence, we mark it as R code. +\begin{Schunk} +\begin{Sinput} +> data(iris) +> summary(iris) +\end{Sinput} +\begin{Soutput} + Sepal.Length Sepal.Width Petal.Length Petal.Width + Min. :4.300 Min. :2.000 Min. :1.000 Min. :0.100 + 1st Qu.:5.100 1st Qu.:2.800 1st Qu.:1.600 1st Qu.:0.300 + Median :5.800 Median :3.000 Median :4.350 Median :1.300 + Mean :5.843 Mean :3.057 Mean :3.758 Mean :1.199 + 3rd Qu.:6.400 3rd Qu.:3.300 3rd Qu.:5.100 3rd Qu.:1.800 + Max. :7.900 Max. :4.400 Max. :6.900 Max. :2.500 + Species + setosa :50 + versicolor:50 + virginica :50 +\end{Soutput} +\end{Schunk} + + +\begin{figure}[htbp] + \begin{center} +\begin{Schunk} +\begin{Sinput} +> library(graphics) +> pairs(iris) +\end{Sinput} +\end{Schunk} +\includegraphics{Sweave-test-1-006} + \caption{Pairs plot of the iris data.} + \end{center} +\end{figure} + +\begin{figure}[htbp] + \begin{center} +\begin{Schunk} +\begin{Sinput} +> boxplot(Sepal.Length ~ Species, data = iris) +\end{Sinput} +\end{Schunk} +\includegraphics{Sweave-test-1-007} + \caption{Boxplot of sepal length grouped by species.} + \end{center} +\end{figure} + + +% R is not S-PLUS, hence this chunk will be ignored: + +\end{document} + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-1-1.pdf b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-1-1.pdf new file mode 100644 index 00000000..dc9ef2a6 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-1-1.pdf differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-1.brew b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-1.brew new file mode 100644 index 00000000..4570456a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-1.brew @@ -0,0 +1,83 @@ +\documentclass[a4paper]{article} + +\title{A \emph{brew} Test File} +\author{\emph{Jeffrey Horner}} + +\usepackage{a4wide,graphicx} + +\begin{document} + +\maketitle + +A simple example that will run in any \emph{R} engine \emph{(brew may work with S, but this is untested)}: The integers from 1 to +10 are +\begin{verbatim} +<%=format(1:10)%> +\end{verbatim} + +We can also emulate a simple calculator \emph{(although the syntax is not as elegant as Sweave)}: +\begin{verbatim} +<% for (i in c('1+1','1+pi','1+pi','sin(pi/2)')) { -%> +> <%=i%> +<% print(eval(parse(text=i))) %> +<% } -%> +\end{verbatim} + +Now we look at Gaussian data: + +\begin{verbatim} +<% +library(stats) +x <- rnorm(20) +print(x) +print(t1 <- t.test(x)) +%> +\end{verbatim} + +Note that we can easily integrate some numbers into standard text: The +third element of vector \texttt{x} is <%=x[3]%>, the +$p$-value of the test is <%=format.pval(t1$p.value)%>. % $ + +Now we look at a summary of the famous iris data set, and we want to +see the commands in the code chunks \emph{(brew can't show you the code, so +don't look for it)}: + +\begin{verbatim} +<% + library(datasets) + data(iris) + print(summary(iris)) +%> +\end{verbatim} + +<% + library(grDevices) + library(graphics) + postscript(file='brew-test-1-1.eps', + width=5,height=5,paper='special',horizontal=FALSE) + pairs(iris) + dev.off() +%> +\begin{figure}[htbp] + \begin{center} +\includegraphics{brew-test-1-1} + \caption{Pairs plot of the iris data.} + \end{center} +\end{figure} + +<% + postscript(file='brew-test-1-2.eps', + width=5,height=5,paper='special',horizontal=FALSE) + boxplot(Sepal.Length~Species, data=iris) + dev.off() +%> +\begin{figure}[htbp] + \begin{center} +\includegraphics{brew-test-1-2} + \caption{Boxplot of sepal length grouped by species.} + \end{center} +\end{figure} + +\end{document} + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-1.tex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-1.tex new file mode 100644 index 00000000..09fea1a0 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-1.tex @@ -0,0 +1,100 @@ +\documentclass[a4paper]{article} + +\title{A \emph{brew} Test File} +\author{\emph{Jeffrey Horner}} + +\usepackage{a4wide,graphicx} + +\begin{document} + +\maketitle + +A simple example that will run in any \emph{R} engine \emph{(brew may work with S, but this is untested)}: The integers from 1 to +10 are +\begin{verbatim} + 1 2 3 4 5 6 7 8 9 10 +\end{verbatim} + +We can also emulate a simple calculator \emph{(although the syntax is not as elegant as Sweave)}: +\begin{verbatim} +> 1+1 +[1] 2 + +> 1+pi +[1] 4.141593 + +> 1+pi +[1] 4.141593 + +> sin(pi/2) +[1] 1 + +\end{verbatim} + +Now we look at Gaussian data: + +\begin{verbatim} + [1] 0.4850072 0.5299571 -0.1913293 -1.4806540 0.3611630 0.6089846 + [7] -0.6045145 -1.5165037 0.3995648 -0.7620245 -0.2342828 0.0914568 +[13] -0.6350603 1.4255549 1.4350150 -2.0392190 0.8070093 1.5085753 +[19] 0.9188515 1.4485650 + + One Sample t-test + +data: x +t = 0.5448, df = 19, p-value = 0.5922 +alternative hypothesis: true mean is not equal to 0 +95 percent confidence interval: + -0.3631849 0.6187965 +sample estimates: +mean of x +0.1278058 + + +\end{verbatim} + +Note that we can easily integrate some numbers into standard text: The +third element of vector \texttt{x} is -0.1913293, the +$p$-value of the test is 0.59222. % $ + +Now we look at a summary of the famous iris data set, and we want to +see the commands in the code chunks \emph{(brew can't show you the code, so +don't try to find them)}: + +\begin{verbatim} + Sepal.Length Sepal.Width Petal.Length Petal.Width + Min. :4.300 Min. :2.000 Min. :1.000 Min. :0.100 + 1st Qu.:5.100 1st Qu.:2.800 1st Qu.:1.600 1st Qu.:0.300 + Median :5.800 Median :3.000 Median :4.350 Median :1.300 + Mean :5.843 Mean :3.057 Mean :3.758 Mean :1.199 + 3rd Qu.:6.400 3rd Qu.:3.300 3rd Qu.:5.100 3rd Qu.:1.800 + Max. :7.900 Max. :4.400 Max. :6.900 Max. :2.500 + Species + setosa :50 + versicolor:50 + virginica :50 + + + + +\end{verbatim} + + +\begin{figure}[htbp] + \begin{center} +\includegraphics{brew-test-1-1} + \caption{Pairs plot of the iris data.} + \end{center} +\end{figure} + + +\begin{figure}[htbp] + \begin{center} +\includegraphics{brew-test-1-2} + \caption{Boxplot of sepal length grouped by species.} + \end{center} +\end{figure} + +\end{document} + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-2-table.brew b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-2-table.brew new file mode 100644 index 00000000..776d473f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-2-table.brew @@ -0,0 +1,9 @@ +\begin{tabular} {ll} + & \\ +<%=caption%> & \\ +\hline +<% for (n in names(l)) { -%> +<%=n%> & <%=unlist(l[[n]])%> \\ +<% } %> +\hline +\end{tabular} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-2.brew b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-2.brew new file mode 100644 index 00000000..99b5c37e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-2.brew @@ -0,0 +1,89 @@ +<% +hrefify <- function(title) gsub('[\\.()]','_',title,perl=TRUE) +scrub <- function(obj){ + if (is.null(obj)) return('NULL') + if (length(obj) == 0) return ('length 0 objing') + if (typeof(obj) == 'closure') + obj <- paste(deparse(obj),collapse='\n') + else + obj <- as.character(obj) + obj <- gsub('&','&',obj); obj <- gsub('@','_at_',obj); + obj <- gsub('<','<',obj); obj <- gsub('>','>',obj); + if (length(obj) == 0 || is.null(obj) || obj == '') + obj <- ' ' + obj +} +cl<-'e' +zebelem <- function(n,v) { + cl <<- ifelse(cl=='e','o','e') + cat('') + if(!is.na(n)) cat('',n,'') + cat(''); + if (length(v)>1) zebra(NULL,v) + else cat(scrub(v)) + cat('\n'); +} +zebra <- function(title,l){ + if (!is.null(title)) cat('

',title,'

',sep='') + cat('',sep='') + n <- names(l) + mapply(zebelem,if(is.null(n)) rep(NA,length(l)) else n, l) + cat('
\n') +} +zebrifyPackage <-function(package){ + zebra(package,unclass(packageDescription(package))) + cat('

\n') +} +-%> + + + + +Everything You Wanted To Know About Your R Session + + + +R Language Home Page +
Everything You Wanted To Know About Your R Session
+ +<% zebra('R.version',R.version) %>

+<% zebra('search()',search()) %>

+<% zebra('.libPaths()',.libPaths()) %>

+<% zebra('options()',options()) %>

+<% zebra('Sys.getenv()',as.list(Sys.getenv())) %>

+<% zebra('Sys.info()',as.list(Sys.info())) %>

+<% zebra('.Machine',.Machine) %>

+<% zebra('.Platform',.Platform) %>

+

Attached Packages

+<% lapply(sub('package:','',search()[grep('package:',search())]),zebrifyPackage) %> +

Installed Packages

+<% lapply(attr(installed.packages(),'dimnames')[[1]],zebrifyPackage) %> + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-2.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-2.html new file mode 100644 index 00000000..7cf1ec61 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-2.html @@ -0,0 +1,688 @@ + + + + +Everything You Wanted To Know About Your R Session + + + +R Language Home Page +
Everything You Wanted To Know About Your R Session
+ +

R.version

+ + + + + + + + + + + + +
platform i486-pc-linux-gnu
arch i486
os linux-gnu
system i486, linux-gnu
status  
major 2
minor 5.1
year 2007
month 06
day 27
svn rev 42083
language R
version.string R version 2.5.1 (2007-06-27)
+

+

search()

+ + + + + + + + + +
.GlobalEnv
package:graphics
package:grDevices
package:datasets
package:stats
package:brew
package:utils
package:methods
Autoloads
package:base
+

+

.libPaths()

+ + +
/usr/local/lib/R/site-library
/usr/lib/R/site-library
/usr/lib/R/library
+

+

options()

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
add.smooth TRUE
browser firefox
check.bounds FALSE
continue +
contrasts + +
unordered contr.treatment
ordered contr.poly
+
device X11
digits 7
dvipscmd /usr/bin/dvips
echo TRUE
editor vi
encoding native.enc
example.ask default
expressions 5000
help.try.all.packages FALSE
HTTPUserAgent R (2.5.1 i486-pc-linux-gnu i486 linux-gnu)
internet.info 2
keep.source TRUE
keep.source.pkgs FALSE
latexcmd /usr/bin/latex
locatorBell TRUE
mailer mailx
max.print 99999
menu.graphics TRUE
na.action na.omit
OutDec .
pager /usr/lib/R/bin/pager
papersize a4
par.ask.default FALSE
pdfviewer /usr/bin/open
pkgType source
printcmd /usr/bin/lpr
prompt >
repos _at_CRAN_at_
rl_word_breaks +"\'`><=%;,|&{()}
scipen 0
show.coef.Pvalues TRUE
show.error.messages TRUE
show.signif.stars TRUE
str + + +
strict.width no
digits.d 3
vec.len 4
+
stringsAsFactors TRUE
timeout 60
ts.eps 1e-05
ts.S.compat FALSE
unzip /usr/bin/unzip
verbose FALSE
warn 0
warnings.length 1000
width 80
X11colortype true
X11fonts + +
-adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*
-adobe-symbol-medium-r-*-*-%d-*-*-*-*-*-*-*
+
+

+

Sys.getenv()

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
_ /usr/bin/R
AWK /usr/bin/awk
COLORTERM  
COLUMNS 109
DBUS_SESSION_BUS_ADDRESS unix:abstract=/tmp/dbus-a5GuEcBU6j,guid=2e4415081a439b1a0b19d20046c07833
DESKTOP_SESSION kde
DISPLAY :0.0
DM_CONTROL /var/run/xdmctl
EDITOR vi
EGREP /bin/grep -E
GS_LIB /home/hornerj/.fonts
GTK2_RC_FILES /home/hornerj/.gtkrc-2.0-kde:/home/hornerj/.kde/share/config/gtkrc-2.0
GTK_RC_FILES /etc/gtk/gtkrc:/home/hornerj/.gtkrc:/home/hornerj/.kde/share/config/gtkrc
HOME /home/hornerj
INPUTRC /home/hornerj/.inputrc
KDE_FULL_SESSION true
KDE_MULTIHEAD false
KONSOLE_DCOP DCOPRef(konsole-25719,konsole)
KONSOLE_DCOP_SESSION DCOPRef(konsole-25719,session-1)
LANG en_US.UTF-8
LD_LIBRARY_PATH /usr/lib/R/lib::/usr/lib/j2se/1.4/jre/lib/i386/client:/usr/lib/j2se/1.4/jre/lib/i386:/usr/lib/j2se/1.4/jre/../lib/i386::/usr/lib:/lib:/usr/lib/j2se/i386:/usr/lib/jni
LINES 77
LN_S ln -s
LOGNAME hornerj
LS_COLORS no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.flac=01;35:*.mp3=01;35:*.mpc=01;35:*.ogg=01;35:*.wav=01;35:
MAKE make
OLDPWD /home/hornerj/DISCHARGE/PROJECTA
PAGER /usr/bin/pager
PATH /home/hornerj/bin:/home/hornerj/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games
PERL /usr/bin/perl
PWD /home/hornerj/brew_rforge/trunk/inst
R_ARCH  
R_BROWSER sensible-browser
R_DOC_DIR /usr/share/R/doc
R_DVIPSCMD /usr/bin/dvips
R_HISTFILE /home/hornerj/.Rhistory
R_HOME /usr/lib/R
R_INCLUDE_DIR /usr/share/R/include
R_LATEXCMD /usr/bin/latex
R_LIBS_SITE /usr/local/lib/R/site-library:/usr/lib/R/site-library:/usr/lib/R/library
R_LIBS_USER ~/R/i486-pc-linux-gnu-library/2.5
R_MAKEINDEXCMD /usr/bin/makeindex
R_PAPERSIZE letter
R_PAPERSIZE_USER a4
R_PDFVIEWER /usr/bin/open
R_PLATFORM i486-pc-linux-gnu
R_PRINTCMD /usr/bin/lpr
R_RD4DVI ae
R_RD4PDF times,hyper
R_SESSION_TMPDIR /tmp/RtmpEI2P1C
R_SHARE_DIR /usr/share/R/share
R_UNZIPCMD /usr/bin/unzip
R_USE_AQUA_SUBDIRS no
R_ZIPCMD /usr/bin/zip
SESSION_MANAGER local/biostat028:/tmp/.ICE-unix/30462
SHELL /bin/bash
SHLVL 1
SSH_AGENT_PID 30393
SSH_AUTH_SOCK /tmp/ssh-qqVJQ30347/agent.30347
TAR tar
TERM xterm
USER hornerj
WINDOWID 33554439
XCURSOR_THEME kubuntu
XDM_MANAGED /var/run/xdmctl/xdmctl-:0,maysd,mayfn,sched,rsvd,method=classic
+

+

Sys.info()

+ + + + + + +
sysname Linux
release 2.6.20-16-generic
version #2 SMP Thu Jun 7 20:19:32 UTC 2007
nodename biostat028
machine i686
login unknown
user hornerj
+

+

.Machine

+ + + + + + + + + + + + + + + + + +
double.eps 2.22044604925031e-16
double.neg.eps 1.11022302462516e-16
double.xmin 2.2250738585072e-308
double.xmax 1.79769313486232e+308
double.base 2
double.digits 53
double.rounding 5
double.guard 0
double.ulp.digits -52
double.neg.ulp.digits -53
double.exponent 11
double.min.exp -1022
double.max.exp 1024
integer.max 2147483647
sizeof.long 4
sizeof.longlong 8
sizeof.longdouble 12
sizeof.pointer 4
+

+

.Platform

+ + + + + + + +
OS.type unix
file.sep /
dynlib.ext .so
GUI X11
endian little
pkgType source
path.sep :
r_arch  
+

+

Attached Packages

+

graphics

+ + + + + + + + + +
Package graphics
Version 2.5.1
Priority base
Title The R Graphics Package
Author R Development Core Team and contributors worldwide
Maintainer R Core Team <R-core_at_r-project.org>
Description R functions for base graphics
Imports grDevices
License GPL Version 2 or later.
Built R 2.5.1; ; 2007-07-19 14:31:16; unix
+

+

grDevices

+ + + + + + + + +
Package grDevices
Version 2.5.1
Priority base
Title The R Graphics Devices and Support for Colours and Fonts
Author R Development Core Team and contributors worldwide
Maintainer R Core Team <R-core_at_r-project.org>
Description Graphics devices and support for base and grid graphics
License GPL Version 2 or later.
Built R 2.5.1; i486-pc-linux-gnu; 2007-07-19 14:31:15; unix
+

+

datasets

+ + + + + + + + +
Package datasets
Version 2.5.1
Priority base
Title The R Datasets Package
Author R Development Core Team and contributors worldwide
Maintainer R Core Team <R-core_at_r-project.org>
Description Base R datasets
License GPL Version 2 or later.
Built R 2.5.1; ; 2007-07-19 14:31:18; unix
+

+

stats

+ + + + + + + + +
Package stats
Version 2.5.1
Priority base
Title The R Stats Package
Author R Development Core Team and contributors worldwide
Maintainer R Core Team <R-core_at_r-project.org>
Description R statistical functions
License GPL Version 2 or later.
Built R 2.5.1; i486-pc-linux-gnu; 2007-07-19 14:31:17; unix
+

+

brew

+ + + + + + + + + +
Package brew
Type Package
Title Templating Framework for Report Generation
Version 0.1-2
Date 2007-04-16
Author Jeffrey Horner
Maintainer Jeffrey Horner <jeff.horner_at_vanderbilt.edu>
Description brew implements a templating framework for mixing text and +R code for report generation. brew template syntax is similar +to PHP, Ruby's erb module, Java Server Pages, and Python's psp +module.
License GPL 2.0
Built R 2.5.1; ; 2007-08-20 15:33:15; unix
+

+

utils

+ + + + + + + + +
Package utils
Version 2.5.1
Priority base
Title The R Utils Package
Author R Development Core Team and contributors worldwide
Maintainer R Core Team <R-core_at_r-project.org>
Description R utility functions
License GPL Version 2 or later.
Built R 2.5.1; ; 2007-07-19 14:31:15; unix
+

+

methods

+ + + + + + + + + + +
Package methods
Version 2.5.1
Priority base
Imports utils
Title Formal Methods and Classes
Author R Development Core Team
Maintainer R Core Team <R-core_at_r-project.org>
Description Formally defined methods and classes for R objects, plus +other programming tools, as described in the reference
References ``Programming with Data'' (1998), John M. Chambers, +Springer NY. http://www.omegahat.org/RSMethods/Intro.ps and +.../Intro.pdf
License GPL Version 2 or later.
Built R 2.5.1; i486-pc-linux-gnu; 2007-07-19 14:31:21; unix
+

+

base

+ + + + + + + + +
Package base
Version 2.5.1
Priority base
Title The R Base Package
Author R Development Core Team and contributors worldwide
Maintainer R Core Team <R-core_at_r-project.org>
Description Base R functions
License GPL Version 2 or later.
Built R 2.5.1; ; Thu Jul 19 14:31:13 EDT 2007; unix
+

+ +

Installed Packages

+

brew

+ + + + + + + + + +
Package brew
Type Package
Title Templating Framework for Report Generation
Version 0.1-2
Date 2007-04-16
Author Jeffrey Horner
Maintainer Jeffrey Horner <jeff.horner_at_vanderbilt.edu>
Description brew implements a templating framework for mixing text and +R code for report generation. brew template syntax is similar +to PHP, Ruby's erb module, Java Server Pages, and Python's psp +module.
License GPL 2.0
Built R 2.5.1; ; 2007-08-20 15:33:15; unix
+

+

Cairo

+ + + + + + + + + + +
Package Cairo
Version 1.3-5
Title R graphics device using cairo graphics library for creating +high-quality bitmap (PNG, JPEG, TIFF), vector (PDF, SVG, +PostScript) and display (X11 and Win32) output.
Author Simon Urbanek <Simon.Urbanek_at_r-project.org>, Jeffrey Horner +<jeff.horner_at_vanderbilt.edu>
Maintainer Simon Urbanek <Simon.Urbanek_at_r-project.org>
Depends R (>= 1.9.0)
Description This package provides a Cairo graphics device that can be +use to create high-quality vector (PDF, PostScript and SVG) and +bitmap output (PNG,JPEG,TIFF), and high-quality rendering in +displays (X11 and Win32). Since it uses the same back-end for +all output, copying across formats is WYSIWYG. Files are +created without the dependence on X11 or other external +programs. This device supports alpha channel (semi-transparent +drawing) and resulting images can contain transparent and +semi-transparent regions. It is ideal for use in server +environemnts (file output) and as a replacement for other +devices that don't have Cairo's capabilities such as alpha +support or anti-aliasing. Backends are modular such that any +subset of backends is supported.
License GPL version 2
SystemRequirements cairo (>= 1.2 http://www.cairographics.org/)
URL http://www.rforge.net/Cairo/
Built R 2.5.0; i486-pc-linux-gnu; 2007-06-26 16:04:52; unix
+

+

Hmisc

+ + + + + + + + + + + + + +
Package Hmisc
Version 3.4-2
Date 2007-5-02
Title Harrell Miscellaneous
Author Frank E Harrell Jr <f.harrell_at_vanderbilt.edu>, with +contributions from many other users.
Maintainer Charles Dupont <charles.dupont_at_vanderbilt.edu>
Depends R (>= 2.4.0), methods
Imports lattice, cluster
Suggests lattice, grid, nnet, foreign, survival, chron, acepack, +TeachingDemos, Design, cluster
Description The Hmisc library contains many functions useful for data +analysis, high-level graphics, utility operations, functions +for computing sample size and power, importing datasets, +imputing missing values, advanced table making, variable +clustering, character string manipulation, conversion of S +objects to LaTeX code, and recoding variables. Please submit +bug reports to 'http://biostat.mc.vanderbilt.edu/trac/Hmisc'.
License GPL version 2 or newer
URL http://biostat.mc.vanderbilt.edu/s/Hmisc, +http://biostat.mc.vanderbilt.edu/twiki/pub/Main/RS/sintro.pdf, +http://biostat.mc.vanderbilt.edu/twiki/pub/Main/StatReport/summary.pdf, +http://biostat.mc.vanderbilt.edu/trac/Hmisc
Packaged Tue Jul 3 10:20:33 2007; dupontct
Built R 2.5.1; i486-pc-linux-gnu; 2007-08-06 14:10:50; unix
+

+

lattice

+ + + + + + + + + + + + + + + + +
Package lattice
Version 0.16-2
Date 2007/07/19
Priority recommended
Title Lattice Graphics
Author Deepayan Sarkar <deepayan.sarkar_at_r-project.org>
Maintainer Deepayan Sarkar <deepayan.sarkar_at_r-project.org>
Description Implementation of Trellis Graphics. See ?Lattice for a +brief introduction
Depends R (>= 2.5.0)
Suggests grid
Imports grid, grDevices, graphics, stats, utils
Enhances chron
LazyLoad yes
LazyData yes
License GPL version 2 or later
Packaged Thu Jul 19 16:59:51 2007; dsarkar
Built R 2.5.1; i486-pc-linux-gnu; 2007-08-06 14:09:52; unix
+

+

RColorBrewer

+ + + + + + + + + + +
Package RColorBrewer
Version 0.2-3
Date 2005-04-16
Title ColorBrewer palettes
Author Erich Neuwirth <erich.neuwirth_at_univie.ac.at>
Maintainer Erich Neuwirth <erich.neuwirth_at_univie.ac.at>
Depends R (>= 1.7.0)
Description The packages provides palettes for drawing nice maps +shaded according to a variable.
License Apache-Style Software License
Packaged Sun Apr 17 11:31:50 2005; neuwirth
Built R 2.5.0; ; 2007-06-25 16:56:52; unix
+

+

xtable

+ + + + + + + + + + +
Package xtable
Version 1.4-6
Date 2007/05/21
Title Export tables to LaTeX or HTML
Author David B. Dahl <dahl_at_stat.tamu.edu> with contributions from many +others
Maintainer David B. Dahl <dahl_at_stat.tamu.edu>
Description Coerce data to LaTeX and HTML tables
Depends  
License GPL version 2 or later
Packaged Mon May 21 10:51:03 2007; dahl
Built R 2.5.1; ; 2007-07-24 10:50:18; unix
+

+

brew

+ + + + + + + + + +
Package brew
Type Package
Title Templating Framework for Report Generation
Version 0.1-2
Date 2007-04-16
Author Jeffrey Horner
Maintainer Jeffrey Horner <jeff.horner_at_vanderbilt.edu>
Description brew implements a templating framework for mixing text and +R code for report generation. brew template syntax is similar +to PHP, Ruby's erb module, Java Server Pages, and Python's psp +module.
License GPL 2.0
Built R 2.5.1; ; 2007-08-20 15:33:15; unix
+

+

mapdata

+ + + + + + + + + + +
Package mapdata
Title Extra Map Databases
Version 2.0-17
Date 2005-12-20
Author Original S code by Richard A. Becker and Allan R. Wilks. R +version by Ray Brownrigg <Ray.Brownrigg_at_mcs.vuw.ac.nz>
Depends R (>= 1.7.0), maps (>= 2.0-7)
Description Supplement to maps package, providing the larger and/or +higher-resolution databases.
License GPL2
Maintainer Ray Brownrigg <Ray.Brownrigg_at_mcs.vuw.ac.nz>
Packaged Tue Dec 20 22:29:07 2005; ray
Built R 2.2.1; i486-pc-linux-gnu; 2006-01-12 03:10:12; unix
+

+

mapproj

+ + + + + + + + + + +
Package mapproj
Title Map Projections
Version 1.1-7.1
Date 2005-04-26
Author Doug McIlroy. Packaged for R by Ray Brownrigg and Thomas P +Minka.
Description Converts latitude/longitude into projected coordinates.
Depends maps
License Distribution and use for non-commercial purposes only.
Maintainer Thomas P Minka <tpminka_at_media.mit.edu>
Packaged Tue Apr 26 11:03:59 2005; hornik
Built R 2.1.0; i386-pc-linux-gnu; 2005-06-02 17:18:58; unix
+

+

maps

+ + + + + + + + + + + +
Package maps
Title Draw Geographical Maps
Version 2.0-32
Date 2006-09-26
Author Original S code by Richard A. Becker and Allan R. Wilks. R +version by Ray Brownrigg <Ray.Brownrigg_at_mcs.vuw.ac.nz> +Enhancements by Thomas P Minka <surname_at_stat.cmu.edu>
Description Display of maps. Projection code and larger maps are in +separate packages (mapproj and mapdata).
Depends R (>= 1.7.0)
Suggests mapproj
License GPL2
Maintainer Ray Brownrigg <Ray.Brownrigg_at_mcs.vuw.ac.nz>
Packaged Tue Sep 26 15:24:36 2006; ray
Built R 2.3.1; i486-pc-linux-gnu; 2006-11-10 03:07:02; unix
+

+

base

+ + + + + + + + +
Package base
Version 2.5.1
Priority base
Title The R Base Package
Author R Development Core Team and contributors worldwide
Maintainer R Core Team <R-core_at_r-project.org>
Description Base R functions
License GPL Version 2 or later.
Built R 2.5.1; ; Thu Jul 19 14:31:13 EDT 2007; unix
+

+

cluster

+ + + + + + + + + + + + + +
Package cluster
Version 1.11.7
Date 2007-06-05
Priority recommended
Author Martin Maechler, based on S original by Peter Rousseeuw +<rousse_at_uia.ua.ac.be>, Anja.Struyf_at_uia.ua.ac.be and +Mia.Hubert_at_uia.ua.ac.be, and initial R port by +Kurt.Hornik_at_R-project.org
Maintainer Martin Maechler <maechler_at_stat.math.ethz.ch>
Title Cluster Analysis Extended Rousseeuw et al.
Description Cluster Analysis, extended original from Peter Rousseeuw, +Anja Struyf and Mia Hubert.
Depends R (>= 2.2.1), stats, graphics, utils
LazyLoad yes
LazyData yes
License GPL version 2 or later
Packaged Tue Jun 5 14:44:06 2007; maechler
Built R 2.5.0; i486-pc-linux-gnu; 2007-06-06 12:10:01; unix
+

+

datasets

+ + + + + + + + +
Package datasets
Version 2.5.1
Priority base
Title The R Datasets Package
Author R Development Core Team and contributors worldwide
Maintainer R Core Team <R-core_at_r-project.org>
Description Base R datasets
License GPL Version 2 or later.
Built R 2.5.1; ; 2007-07-19 14:31:18; unix
+

+

graphics

+ + + + + + + + + +
Package graphics
Version 2.5.1
Priority base
Title The R Graphics Package
Author R Development Core Team and contributors worldwide
Maintainer R Core Team <R-core_at_r-project.org>
Description R functions for base graphics
Imports grDevices
License GPL Version 2 or later.
Built R 2.5.1; ; 2007-07-19 14:31:16; unix
+

+

grDevices

+ + + + + + + + +
Package grDevices
Version 2.5.1
Priority base
Title The R Graphics Devices and Support for Colours and Fonts
Author R Development Core Team and contributors worldwide
Maintainer R Core Team <R-core_at_r-project.org>
Description Graphics devices and support for base and grid graphics
License GPL Version 2 or later.
Built R 2.5.1; i486-pc-linux-gnu; 2007-07-19 14:31:15; unix
+

+

grid

+ + + + + + + + + + +
Package grid
Version 2.5.1
Priority base
Title The Grid Graphics Package
Author Paul Murrell <paul_at_stat.auckland.ac.nz>
Maintainer R Core Team <R-core_at_r-project.org>
Description A rewrite of the graphics layout capabilities, plus some +support for interaction
Imports grDevices
Suggests lattice
License GPL Version 2 or later.
Built R 2.5.1; i486-pc-linux-gnu; 2007-07-19 14:31:21; unix
+

+

methods

+ + + + + + + + + + +
Package methods
Version 2.5.1
Priority base
Imports utils
Title Formal Methods and Classes
Author R Development Core Team
Maintainer R Core Team <R-core_at_r-project.org>
Description Formally defined methods and classes for R objects, plus +other programming tools, as described in the reference
References ``Programming with Data'' (1998), John M. Chambers, +Springer NY. http://www.omegahat.org/RSMethods/Intro.ps and +.../Intro.pdf
License GPL Version 2 or later.
Built R 2.5.1; i486-pc-linux-gnu; 2007-07-19 14:31:21; unix
+

+

splines

+ + + + + + + + + +
Package splines
Version 2.5.1
Priority base
Imports graphics, stats
Title Regression Spline Functions and Classes
Author Douglas M. Bates <bates_at_stat.wisc.edu> and William N. Venables +<Bill.Venables_at_cmis.csiro.au>
Maintainer R Core Team <R-core_at_r-project.org>
Description Regression spline functions and classes
License GPL Version 2 or later.
Built R 2.5.1; i486-pc-linux-gnu; 2007-07-19 14:31:22; unix
+

+

stats

+ + + + + + + + +
Package stats
Version 2.5.1
Priority base
Title The R Stats Package
Author R Development Core Team and contributors worldwide
Maintainer R Core Team <R-core_at_r-project.org>
Description R statistical functions
License GPL Version 2 or later.
Built R 2.5.1; i486-pc-linux-gnu; 2007-07-19 14:31:17; unix
+

+

stats4

+ + + + + + + + + + +
Package stats4
Title Statistical Functions using S4 Classes
Version 2.5.1
Priority base
Author R Development Core Team and contributors worldwide
Description Statistical Functions using S4 classes
Maintainer R Core Team <R-core_at_r-project.org>
Depends graphics, stats, methods
SaveImage yes
License GPL Version 2 or later.
Built R 2.5.1; ; 2007-07-19 14:31:23; unix
+

+

tcltk

+ + + + + + + + +
Package tcltk
Version 2.5.1
Priority base
Title Tcl/Tk Interface
Author R Development Core Team
Maintainer R Core Team <R-core_at_r-project.org>
Description Interface and language bindings to Tcl/Tk GUI elements
License GPL Version 2 or later.
Built R 2.5.1; i486-pc-linux-gnu; 2007-07-19 14:31:23; unix
+

+

tools

+ + + + + + + + +
Package tools
Version 2.5.1
Priority base
Title Tools for Package Development
Author Kurt Hornik and Friedrich Leisch
Maintainer R Core Team <R-core_at_r-project.org>
Description Tools for package development, administration and +documentation
License GPL Version 2 or later.
Built R 2.5.1; i486-pc-linux-gnu; 2007-07-19 14:31:14; unix
+

+

utils

+ + + + + + + + +
Package utils
Version 2.5.1
Priority base
Title The R Utils Package
Author R Development Core Team and contributors worldwide
Maintainer R Core Team <R-core_at_r-project.org>
Description R utility functions
License GPL Version 2 or later.
Built R 2.5.1; ; 2007-07-19 14:31:15; unix
+

+ + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-2.tex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-2.tex new file mode 100644 index 00000000..62f3e7f5 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-2.tex @@ -0,0 +1,125 @@ + +\documentclass[a4paper]{article} + +\title{Everything you wanted to know about your R session.} +\author{\emph{Jeffrey Horner}} + +\begin{document} + +\maketitle + + +\begin{tabular} {ll} + & \\ +R.version & \\ +\hline +platform & i486-pc-linux-gnu \\ +arch & i486 \\ +os & linux-gnu \\ +system & i486, linux-gnu \\ +status & \\ +major & 2 \\ +minor & 5.1 \\ +year & 2007 \\ +month & 06 \\ +day & 27 \\ +svn rev & 42083 \\ +language & R \\ +version.string & R version 2.5.1 (2007-06-27) \\ + +\hline +\end{tabular} + +\begin{tabular} {ll} + & \\ +search() & \\ +\hline +1 & .GlobalEnv \\ +2 & package:graphics \\ +3 & package:grDevices \\ +4 & package:datasets \\ +5 & package:stats \\ +6 & package:brew \\ +7 & package:utils \\ +8 & package:methods \\ +9 & Autoloads \\ +10 & package:base \\ + +\hline +\end{tabular} + +\begin{tabular} {ll} + & \\ +.libPaths() & \\ +\hline +1 & /usr/local/lib/R/site-library \\ +2 & /usr/lib/R/site-library \\ +3 & /usr/lib/R/library \\ + +\hline +\end{tabular} + +\begin{tabular} {ll} + & \\ +options() & \\ +\hline +add.smooth & TRUE \\ +browser & firefox \\ +check.bounds & FALSE \\ +continue & + \\ +contrasts & contr.treatment contr.poly \\ +device & X11 \\ +digits & 7 \\ +dvipscmd & /usr/bin/dvips \\ +echo & TRUE \\ +editor & vi \\ +encoding & native.enc \\ +example.ask & default \\ +expressions & 5000 \\ +help.try.all.packages & FALSE \\ +HTTPUserAgent & R (2.5.1 i486-pc-linux-gnu i486 linux-gnu) \\ +internet.info & 2 \\ +keep.source & TRUE \\ +keep.source.pkgs & FALSE \\ +latexcmd & /usr/bin/latex \\ +locatorBell & TRUE \\ +mailer & mailx \\ +max.print & 99999 \\ +menu.graphics & TRUE \\ +na.action & na.omit \\ +OutDec & . \\ +pager & /usr/lib/R/bin/pager \\ +papersize & a4 \\ +par.ask.default & FALSE \\ +pdfviewer & /usr/bin/open \\ +pkgType & source \\ +printcmd & /usr/bin/lpr \\ +prompt & > \\ +repos & @CRAN@ \\ +rl_word_breaks & +"\'`><=%;,|&{()} \\ +scipen & 0 \\ +show.coef.Pvalues & TRUE \\ +show.error.messages & TRUE \\ +show.signif.stars & TRUE \\ +str & no 3 4 \\ +stringsAsFactors & TRUE \\ +timeout & 60 \\ +ts.eps & 1e-05 \\ +ts.S.compat & FALSE \\ +unzip & /usr/bin/unzip \\ +verbose & FALSE \\ +warn & 0 \\ +warnings.length & 1000 \\ +width & 80 \\ +X11colortype & true \\ +X11fonts & -adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-* -adobe-symbol-medium-r-*-*-%d-*-*-*-*-*-*-* \\ + +\hline +\end{tabular} + + + +\end{document} + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-3.brew b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-3.brew new file mode 100644 index 00000000..aa23f06e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/brew-test-3.brew @@ -0,0 +1,6 @@ +This is a test of "brew". +<% +library(RODBC) +library(stats) +%> +End of test. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/broken.brew b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/broken.brew new file mode 100644 index 00000000..af42cc53 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/broken.brew @@ -0,0 +1,8 @@ +<% + foo <- 'bar' +%> +hello <%=foo +<% + baz <- 5 +%> +bye <%=baz%> diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/catprint.brew b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/catprint.brew new file mode 100644 index 00000000..316ff8a1 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/catprint.brew @@ -0,0 +1,35 @@ +DATA FRAME OUTPUT (LISTS TOO) + +Let's run this: <%% data(iris) %%> +<% data(iris) %> +Let's look at some R output: + +If we say this: <%% head(iris) %%> +the output is this: +<% head(iris) %> +nothing right? + +if we say this: <%%= head(iris) %%> +it's an error because cat() cannot handle lists. + +But if we say this: <%% print(head(iris)) %%> +the output is this: +<% print(head(iris)) %> + +VECTOR OUTPUT + +We'll work with v: <%% v <- head(iris)$Sepal.Length %%> +<% v <- head(iris)$Sepal.Length %> + +If we say this: <%%= v %%> +the output is this: +<%= v %> +because 'cat()' coerces v to a character vector + +How about <%%= v > 5 %%> +<%= v > 5 %> +So cat() can deal with any vector + +And if we say this: <%% print(v) %%> +the output is: +<% print(v) %> diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/example1.brew b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/example1.brew new file mode 100644 index 00000000..3b688777 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/example1.brew @@ -0,0 +1,9 @@ +Title: brew test +<% foo<-'bar' -%> +current time: <%= format(Sys.time()) %> +value of foo: <%=foo%> +<% for (i in 1:10) { -%> +i is <%=i%> +<% foo <- paste(foo,i,sep='') + brew((system.file("example2.brew",package='brew'))) -%> +<% } -%> diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/example2.brew b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/example2.brew new file mode 100644 index 00000000..e04aa768 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/example2.brew @@ -0,0 +1 @@ +from example2.brew, foo is: <%=foo%> diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/featurefull.brew b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/featurefull.brew new file mode 100644 index 00000000..787848f4 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/featurefull.brew @@ -0,0 +1,14 @@ +You won't see this R output, but it will run. <% foo <- 'bar' %> +Now foo is <%=foo%> and today is <%=format(Sys.time(),'%B %d, %Y')%>. +<%# Comment -- ignored -- useful in testing. + Also notice the dash-percent-gt. + It chops off the trailing newline. + You can add it to any percent-gt. -%> +How about generating a template from a template? +<%% + foo <- 'fee fi fo fum' + brew <- 'haha' +%%> +foo is still <%=foo%>. +Contents of current directory: +<% print(dir()) %> diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/help/AnIndex new file mode 100644 index 00000000..4a51b97f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/help/AnIndex @@ -0,0 +1,5 @@ +brew brew +brewCache brewCache +brewCacheOff brewCache +brewCacheOn brewCache +setBufLen brewCache diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/help/aliases.rds new file mode 100644 index 00000000..e4e74337 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/help/brew.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/help/brew.rdb new file mode 100644 index 00000000..30e3fa2e Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/help/brew.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/help/brew.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/help/brew.rdx new file mode 100644 index 00000000..a6b8057e Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/help/brew.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/help/paths.rds new file mode 100644 index 00000000..4850c118 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/html/00Index.html new file mode 100644 index 00000000..1f1abbca --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/html/00Index.html @@ -0,0 +1,35 @@ + + +R: Templating Framework for Report Generation + + + +
+

Templating Framework for Report Generation + +

+
+
+[Up] +[Top] +

Documentation for package ‘brew’ version 1.0-10

+ + + +

Help Pages

+ + + + + + + + + + + + + +
brewReport Brewing For Text and R Output
brewCacheCaching Brew Templates
brewCacheOffCaching Brew Templates
brewCacheOnCaching Brew Templates
setBufLenCaching Brew Templates
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/brew/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/COPYRIGHTS b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/COPYRIGHTS new file mode 100644 index 00000000..322f3d55 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/COPYRIGHTS @@ -0,0 +1,3 @@ +(c) 2015-2016 Ascent Digital Services (formerly Mango Solutions) +(c) 2017 Gábor Csárdi +(c) 2017-2024 Posit Software, PBC (formerly RStudio) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/DESCRIPTION new file mode 100644 index 00000000..2b7c951b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/DESCRIPTION @@ -0,0 +1,42 @@ +Package: callr +Title: Call R from R +Version: 3.7.6 +Authors@R: c( + person("Gábor", "Csárdi", , "csardi.gabor@gmail.com", role = c("aut", "cre", "cph"), + comment = c(ORCID = "0000-0001-7098-9676")), + person("Winston", "Chang", role = "aut"), + person("Posit Software, PBC", role = c("cph", "fnd")), + person("Ascent Digital Services", role = c("cph", "fnd")) + ) +Description: It is sometimes useful to perform a computation in a separate + R process, without affecting the current R process at all. This + packages does exactly that. +License: MIT + file LICENSE +URL: https://callr.r-lib.org, https://github.com/r-lib/callr +BugReports: https://github.com/r-lib/callr/issues +Depends: R (>= 3.4) +Imports: processx (>= 3.6.1), R6, utils +Suggests: asciicast (>= 2.3.1), cli (>= 1.1.0), mockery, ps, rprojroot, + spelling, testthat (>= 3.2.0), withr (>= 2.3.0) +Config/Needs/website: r-lib/asciicast, glue, htmlwidgets, igraph, + tibble, tidyverse/tidytemplate +Config/testthat/edition: 3 +Encoding: UTF-8 +Language: en-US +RoxygenNote: 7.3.1.9000 +NeedsCompilation: no +Packaged: 2024-03-25 12:10:25 UTC; gaborcsardi +Author: Gábor Csárdi [aut, cre, cph] (), + Winston Chang [aut], + Posit Software, PBC [cph, fnd], + Ascent Digital Services [cph, fnd] +Maintainer: Gábor Csárdi +Repository: CRAN +Date/Publication: 2024-03-25 13:30:06 UTC +Built: R 4.4.0; ; 2024-04-06 02:54:18 UTC; unix +RemoteType: standard +RemotePkgRef: callr +RemoteRef: callr +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 3.7.6 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/INDEX new file mode 100644 index 00000000..7ab15835 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/INDEX @@ -0,0 +1,33 @@ +add_hook Add a user hook to be executed before launching + an R subprocess +default_repos Default value for the 'repos' option in callr + subprocesses +r Evaluate an expression in another R session +r_bg Evaluate an expression in another R session, in + the background +r_copycat Run an R process that mimics the current R + process +r_process External R Process +r_process_options Create options for an r_process object +r_session External R Session +r_session_debug Interactive debugging of persistent R sessions +r_session_options Create options for an r_session object +r_vanilla Run an R child process, with no configuration +rcmd Run an R CMD command +rcmd_bg Run an R CMD command in the background +rcmd_copycat Call and R CMD command, while mimicking the + current R session +rcmd_process External R CMD Process +rcmd_process_options Create options for an rcmd_process object +rcmd_safe_env 'rcmd_safe_env' returns a set of environment + variables that are more appropriate for + 'rcmd_safe()'. It is exported to allow + manipulating these variables (e.g. add an extra + one), before passing them to the 'rcmd()' + functions. +rscript Run an R script +rscript_process External 'Rscript' process +rscript_process_options + Create options for an rscript_process object +supported_archs Find supported sub-architectures for the + current R installation diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/LICENSE new file mode 100644 index 00000000..6ddf2d02 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2024 +COPYRIGHT HOLDER: see COPYRIGHTS file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/Meta/Rd.rds new file mode 100644 index 00000000..341ece4a Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/Meta/features.rds new file mode 100644 index 00000000..ded31532 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/Meta/hsearch.rds new file mode 100644 index 00000000..abbecfb4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/Meta/links.rds new file mode 100644 index 00000000..27ceab22 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/Meta/nsInfo.rds new file mode 100644 index 00000000..cfce0e09 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/Meta/package.rds new file mode 100644 index 00000000..ab91d54f Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/NAMESPACE new file mode 100644 index 00000000..6c8bb055 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/NAMESPACE @@ -0,0 +1,32 @@ +# Generated by roxygen2: do not edit by hand + +S3method(format,callr_status_error) +S3method(print,callr_status_error) +export(add_hook) +export(default_repos) +export(poll) +export(process) +export(r) +export(r_bg) +export(r_copycat) +export(r_process) +export(r_process_options) +export(r_safe) +export(r_session) +export(r_session_options) +export(r_vanilla) +export(rcmd) +export(rcmd_bg) +export(rcmd_copycat) +export(rcmd_process) +export(rcmd_process_options) +export(rcmd_safe) +export(rcmd_safe_env) +export(rscript) +export(rscript_process) +export(rscript_process_options) +export(run) +export(supported_archs) +importFrom(processx,poll) +importFrom(processx,process) +importFrom(processx,run) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/NEWS.md new file mode 100644 index 00000000..02189a54 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/NEWS.md @@ -0,0 +1,272 @@ +# callr 3.7.6 + +* If the `CALLR_NO_TEMP_DLLS=true` env var is set then callr does not + copy the dll the client DLL files from, in the subprocess. By + default callr copies the DLL file that drives the callr subprocess into + a temporary directory and loads it from there (#273). + +# callr 3.7.5 + +* No changes. + +# callr 3.7.4 + +* The `r_session$get_running_time()` method now returns the correct + values, as documented (#241, @djnavarro). + +* callr now uses fully qualified function calls in the subprocess to + avoid interference with functions defined in the global environment. + I.e. `base::stderr()` instead of `stderr()`. Closes #246. + +# callr 3.7.3 + +* Errors from callr now include the standard output (in `$stdout`) and + standard error (in `stderr`) again. The standard output and error are also + printed on error in non-interactive sessions, and a note is printed about + them in interactive sessions. + +# callr 3.7.2 + +* New function `add_hook()` to hook into the callr process startup and + options. This is for experts and it is also currently experimental + (#203, @klmr). + +# callr 3.7.1 + +* When copying existing startup files, an additional newline is appended to + protect against a missing newline at the end of the file. This would + cause R ignore that line (#205). + +* Serialization of objects passed between sessions now uses `compress=FALSE` + by default. The default can be changed by setting the + `callr.compress_transport` option (#223, @dfalbel). + +* We have revamped callr's error objects, with lots of improvements to the + output. + +# callr 3.7.0 + +* Reporting errors is much faster now (#185). + +* The `user_profile` option of `r_vanilla()` defaults to `FALSE` now (#194). + +* It is now possible to set R environment variables (`R_ENVIRON_USER`, + `R_PROFILE_USER`, etc.) via the `env` argument (#193). + +# callr 3.6.0 + +* callr now supports starting an R process with a different architecture, + so on Windows 64-bit R can start a 32-bit R background process, and + vice-versa (#95). + +* callr now handles symbolic arguments properly, and does not evaluate them. + E.g. `callr::r(function(x) x, list(quote(foobar)))` works now (#175). + +* `callr::r_session` does not leak file descriptors now in the sub-process + (#184). + +# callr 3.5.1 + +* `callr::r_session` now handles large messages from the subprocess + well (#168). + +# callr 3.5.0 + +* callr can now pass the environment of the function to the subprocess, + optionally. This makes it easier to call an internal function of a + package in a subprocess. See the `package` argument of `r()`, `r_bg()`, + `r_session$run()`, etc. (#147). + +# callr 3.4.4 + +* An `r_session` now exits if the load hook errors. This generates an error + if the session is started with `wait = TRUE`. For `wait = FALSE` the + first `$read()` operation will return with an error (#162). + +# callr 3.4.3 + +* `default_repos()` now returns a list if `getOption("repos")` is a list, + and a vector otherwise, on R 4.x.y as well. + +# callr 3.4.2 + +* Improved error messages. Error messages are now fully printed after + an error. In non-interactive sessions, the stack trace is printed as well. + +# callr 3.4.1 + +* callr is now more careful when loading the local `.Rprofile` in the + subprocess. This fixes issues with packrat and renv that use `.Rprofile` + for setup (#139). + +* callr functions fail early if environment file is missing (#123, @jdblischak) + +# callr 3.4.0 + +* All callr functions and background processes properly clean up + temporary files now (#104). + +* callr now uses a more principled setup for the library path, and + restores the related environment variables in the child process. + This is a **breaking change** if you relied on having the library set + in a `system()` subprocess of the callr subprocess (#114). + +* Better printing of `rlang_error`s that happened in the subprocess. + +* The stacking of error objects is slightly different now, as we keep the + unmodified error from the subprocess in `$parent$error`. + +* callr now loads `.Rprofile` files from the current working directory + by default. This works better with packrat, renv, and other software + that relies on a local profile for initialization (#131). + +# callr 3.3.2 + +No user visible changes in this version. + +# callr 3.3.1 + +* `r_session` now avoids creating `data` and `env` objects in the global + environment of the subprocess. + +* New `$debug()` method for `r_session` to inspect the dumped frames + in the subprocess, after an error. + +# callr 3.3.0 + +* callr now sets the `.Last.error` variable for every uncaught callr + error to the error condition, and also sets `.Last.error.trace` to its + stack trace. If the error originates in the subprocess, then `.Last.error` + is a hierarchical error object, and `.Last.error.trace` merges the + traces from the two processes. See the `README.md` for an example. + +* New `$traceback()` method for `r_session`, to run `traceback()` in the + subprocess, after an error. + +* A callr subprocess now does not load any R packages by default. + +* New vignette, that showcases `r_session`. + +# callr 3.2.0 + +* `r()`, `rcmd()` and `rscript()` can now redirect the standard error of + the subprocess its standard output. This allows to keep them correctly + interleaved. For this, you need to either set the `stderr` argument to + the special string `"2>&1"`, or to the same output file as specified + for `stdout`. + +* `r()`, `rcmd()` and `rscript()` now pass `...` arguments to + `processx::run()`. `r_bg()` and `rcmd_bg()` pass `...` arguments to + the `processx::process` constructor. For `r_process`, `rcmd_process` + and `rscript_process` extra arguments can be specified as `options$extra`, + these are also passed to the `processx::process` constructor (#100). + +# callr 3.1.1 + +* `r()`, `r_bg()`, etc. now handle messages from the cliapp package + properly. They used to make the R session exit. + +* Better default for the `repos` option in callr subprocesses. callr no + longer creates duplicate "CRAN" entries. By default the new + `default_repos()` function is used to set `repos` in the subprocess. + +# callr 3.1.0 + +* New `rscript()` function and `rscript_process` class to execute + R scripts via `Rscript` (#40, #81). + +* Library paths are now correctly set up for `system()` (and similar) + calls from the callr subprocesses (#83, #84). + +* Pass `options("repos")` to the child process as is, without checking. + Closes #82. + +* `r_session$run_with_output()` now returns an S3 object with class + `callr_session_result`. + +* `r_session$run*()` handle interrupts properly. It tries to interrupt + the background process fist, kills it if it is not interruptible, + and then re-throws the interrupt condition, going back to the top level + prompt if the re-thrown condition is uncaught. + +# callr 3.0.0 + +* New `r_session` class: a background R session you can send commands to + (#56). + +* Rewrote passing the library path to the subprocess (#73, #75) + +* Retain names of the `repos` option (#67, @jennybc) + +# callr 2.0.4 + +* pkgdown web site at https://callr.r-lib.org (#52, #53). + +* callr users `.Renviron` files now (and `R_ENVIRON_USER` as well), + but overrides the library path, as requested in `r()`, etc. (#30). + +* callr now handles the case when the subprocess calls `quit()`. + +* callr now uses the processx package, instead of embedded code, + to create and control processes. + +# callr 2.0.3 + +* The default behavior on error can be set now with the `callr.error` +option. + +* Better error message if the child R process crashes or gets killed. (#41) + +* `r_bg` and `rcmd_bg` now have the `supervise` option (#45). + +# callr 2.0.2 + +* Fix a bug with R-devel, caused by the change on 2018-02-08: + https://github.com/wch/r-source/commit/924582943706100e88a11d6bb0585d25779c91f5 + #37, #38 + +* Fix a race condition on Windows, when creating named pipes for `stdout` + or `stderr`. The client sometimes didn't wait for the server, and callr + failed with ERROR_PIPE_BUSY (231, All pipe instances are busy). + +# callr 2.0.1 + +* Fix compilation issues on Solaris + +* Fix a test failure on macOS + +# callr 2.0.0 + +* Run R or `R CMD` in the background, see `r_bg()`, `rcmd_bg()`, + and also `r_process` and `rcmd_process` + +* The defaults for `r()` are safer now, the match the defaults of + `r_safe()`. `r_safe()` is kept for compatibility. `r_copycat()` has the + old `r()` defaults. + +* The defaults for `rcmd()` are safer now, the match the defaults of +`rcmd_safe()`. `rcmd_safe()` is kept for compatibility. `rcmd_copycat()` + has the old `rcmd()` defaults. + +* Support block callbacks, in addition to line callbacks. Block callbacks + are called for arbitrary chunks of output, even without a newline + +* Add `spinner` argument to show a spinner in `r()` or `rcmd()` + +* Support timeouts, via the `timeout` argument + +* Fix bug when `stdout` and `stderr` are redirected to the same file + +* `rcmd_safe_env()` to allow extending the environment variables set in + safe mode + +* `rcmd()` gets a `fail_on_status` argument + +* `rcmd()` gets an `echo` argument to potentially show the command to be + run on the screen (#15) + +* `rcmd()` gets a `wd` argument to set the working directory + +# callr 1.0.0 + +First public release. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/R/callr b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/R/callr new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/R/callr @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/R/callr.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/R/callr.rdb new file mode 100644 index 00000000..8eb49442 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/R/callr.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/R/callr.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/R/callr.rdx new file mode 100644 index 00000000..aab0f3fe Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/R/callr.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/WORDLIST b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/WORDLIST new file mode 100644 index 00000000..c85e6b25 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/WORDLIST @@ -0,0 +1,34 @@ +CMD +CTRL +Codecov +ESC +Eval +Finalizer +ORCID +PBC +REPL +callr's +cli +cliapp +cloneable +dll +env +eval +finalizer +funder +github +https +igraph +interruptible +keyring +lifecycle +macOS +packrat +pkgdown +processx +renv +stderr +stdout +subcommand +subprocess +subprocesses diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/developer-notes.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/developer-notes.md new file mode 100644 index 00000000..4e2ad1ac --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/developer-notes.md @@ -0,0 +1,92 @@ + + +## Design of the internals + +There are a lot of possible ways to implement this package, to minimize +duplication. This is the API we want: + +```r +r(fun, args, ...) +r_safe(fun, args, ...) + +r_bg(fun, args, ...) +r_bg_safe(fun, args, ...) + +rcmd(cmd, cmdargs, ...) +rcmd_safe(cmd, cmdargs, ...) + +rcmd_bg(cmd, cmdargs, ...) +rcmd_bg_safe(cmd, cmdargs ...) +``` + +The `_safe` versions are easy to deal with, they just call the non-`_safe` +versions with different arguments. + +For the other versions, this is what they need to do: + +### `r` + + 1. convert / check arguments + 2. save function to a file + 3. create script file + 4. set up profiles + 5. set up library path + 6. set up LIB and PROFILE env vars + 7. set up callbacks (combine show and callbacks) + 8. run the R process + 9. write stdout & stderr to file, if needed +10. fail on status, if requested +11. get the result + +### `r_bg` + + 1. convert / check arguments + 2. save function to a file + 3. create script file + 4. set up profiles + 5. set up library path + 7. set up LIB and PROFILE env vars + 8. start the R process in the bg + +### `rcmd` + + 1. convert / check arguments + 2. get the R binary and its arguments + 3. set specified wd + 4. set up profiles + 5. set up library path + 6. set up callbacks (combine show and callbacks) + 7. set up LIB and PROFILE env vars + 8. run the R process + 9. write stdout & stderr to file, if needed +10. fail on status, if requested + +### `rcmd_bg` + + 1. convert/check arguments + 2. get the R binary and its arguments + 3. set specified wd + 4. set up profiles + 5. set up library path + 7. set up LIB and PROFILE env vars + 8. run the R process in the bg + +### Building blocks + +#### Always run, `check_my_args`: + +1. convert / check arguments + +#### Run by `r` and `r_bg`, `setup_script_files`: + +1. save function to a file +2. create script file + +#### Always run, `setup_context`: + +This is run with `.` as the working directory for `r` and `r_bg`. + +1. set specified wd +2. set up profiles +3. set up library path +4. set up LIB and PROFILE env vars diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/AnIndex new file mode 100644 index 00000000..94fadca8 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/AnIndex @@ -0,0 +1,32 @@ +callr-package callr-package +add_hook add_hook +callr callr-package +convert_and_check_my_args convert_and_check_my_args +default_repos default_repos +get_result get_result +new_callr_crash_error new_callr_crash_error +poll reexports +process reexports +r r +rcmd rcmd +rcmd_bg rcmd_bg +rcmd_copycat rcmd_copycat +rcmd_process rcmd_process +rcmd_process_options rcmd_process_options +rcmd_safe rcmd +rcmd_safe_env rcmd_safe_env +reexports reexports +rscript rscript +rscript_process rscript_process +rscript_process_options rscript_process_options +run reexports +r_bg r_bg +r_copycat r_copycat +r_process r_process +r_process_options r_process_options +r_safe r +r_session r_session +r_session_debug r_session_debug +r_session_options r_session_options +r_vanilla r_vanilla +supported_archs supported_archs diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/aliases.rds new file mode 100644 index 00000000..d4ad616b Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/callr.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/callr.rdb new file mode 100644 index 00000000..4b059f5f Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/callr.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/callr.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/callr.rdx new file mode 100644 index 00000000..a9a6c53b Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/callr.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/bg-dark.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/bg-dark.svg new file mode 100644 index 00000000..a1bf753a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/bg-dark.svg @@ -0,0 +1 @@ +PROCESS'R',running,pid98048. \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/bg-methods-dark.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/bg-methods-dark.svg new file mode 100644 index 00000000..803af70d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/bg-methods-dark.svg @@ -0,0 +1 @@ +[1]"as_ps_handle""clone""finalize"[4]"format""get_cmdline""get_cpu_times"[7]"get_error_connection""get_error_file""get_exe"[10]"get_exit_status""get_input_connection""get_input_file"[13]"get_memory_info""get_name""get_output_connection"[16]"get_output_file""get_pid""get_poll_connection"[19]"get_result""get_start_time""get_status"[22]"get_username""get_wd""has_error_connection"[25]"has_input_connection""has_output_connection""has_poll_connection"[28]"initialize""interrupt""is_alive"[31]"is_incomplete_error""is_incomplete_output""is_supervised"[34]"kill""kill_tree""poll_io"[37]"print""read_all_error""read_all_error_lines"[40]"read_all_output""read_all_output_lines""read_error"[43]"read_error_lines""read_output""read_output_lines"[46]"resume""signal""supervise"[49]"suspend""wait""write_input" \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/bg-methods.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/bg-methods.svg new file mode 100644 index 00000000..b07de2a6 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/bg-methods.svg @@ -0,0 +1 @@ +[1]"as_ps_handle""clone""finalize"[4]"format""get_cmdline""get_cpu_times"[7]"get_error_connection""get_error_file""get_exe"[10]"get_exit_status""get_input_connection""get_input_file"[13]"get_memory_info""get_name""get_output_connection"[16]"get_output_file""get_pid""get_poll_connection"[19]"get_result""get_start_time""get_status"[22]"get_username""get_wd""has_error_connection"[25]"has_input_connection""has_output_connection""has_poll_connection"[28]"initialize""interrupt""is_alive"[31]"is_incomplete_error""is_incomplete_output""is_supervised"[34]"kill""kill_tree""poll_io"[37]"print""read_all_error""read_all_error_lines"[40]"read_all_output""read_all_output_lines""read_error"[43]"read_error_lines""read_output""read_output_lines"[46]"resume""signal""supervise"[49]"suspend""wait""write_input" \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/bg.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/bg.svg new file mode 100644 index 00000000..ab322b95 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/bg.svg @@ -0,0 +1 @@ +PROCESS'R',running,pid98048. \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/error1-dark.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/error1-dark.svg new file mode 100644 index 00000000..0321715c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/error1-dark.svg @@ -0,0 +1 @@ +Error:!incallrsubprocess.Causedbyerrorin`1+"A"`:!non-numericargumenttobinaryoperatorType.Last.errortoseethemoredetails. \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/error1.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/error1.svg new file mode 100644 index 00000000..23a4a871 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/error1.svg @@ -0,0 +1 @@ +Error:!incallrsubprocess.Causedbyerrorin`1+"A"`:!non-numericargumenttobinaryoperatorType.Last.errortoseethemoredetails. \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/error2-2-dark.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/error2-2-dark.svg new file mode 100644 index 00000000..56cd336c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/error2-2-dark.svg @@ -0,0 +1 @@ +---Error:!incallrsubprocess.Causedbyerrorin`1+"A"`:!non-numericargumenttobinaryoperatorBacktrace:1.callr::r(function()1+"A")2.callr:::get_result(output=out,options)ateval.R:193:33.callr:::throw(callr_remote_error(remerr,output),parent=fix_msg(remerr[[3]]))atresult.R:87:5Subprocessbacktrace:1.base::.handleSimpleError(function(e)2.globalh(simpleError(msg,call)) \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/error2-2.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/error2-2.svg new file mode 100644 index 00000000..af67edb5 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/error2-2.svg @@ -0,0 +1 @@ +---Error:!incallrsubprocess.Causedbyerrorin`1+"A"`:!non-numericargumenttobinaryoperatorBacktrace:1.callr::r(function()1+"A")2.callr:::get_result(output=out,options)ateval.R:193:33.callr:::throw(callr_remote_error(remerr,output),parent=fix_msg(remerr[[3]]))atresult.R:87:5Subprocessbacktrace:1.base::.handleSimpleError(function(e)2.globalh(simpleError(msg,call)) \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/io-2-dark.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/io-2-dark.svg new file mode 100644 index 00000000..2a9d9acf --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/io-2-dark.svg @@ -0,0 +1 @@ +[1]"helloagain!" \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/io-2.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/io-2.svg new file mode 100644 index 00000000..56ee9edd --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/io-2.svg @@ -0,0 +1 @@ +[1]"helloagain!" \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/io-dark.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/io-dark.svg new file mode 100644 index 00000000..4d0b9b4e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/io-dark.svg @@ -0,0 +1 @@ +[1]"[1]\"helloworld!\"" \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/io.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/io.svg new file mode 100644 index 00000000..f30f2fda --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/io.svg @@ -0,0 +1 @@ +[1]"[1]\"helloworld!\"" \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/packages-dark.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/packages-dark.svg new file mode 100644 index 00000000..2fa0dce4 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/packages-dark.svg @@ -0,0 +1 @@ +[1]12 \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/packages.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/packages.svg new file mode 100644 index 00000000..05f5f79c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/packages.svg @@ -0,0 +1 @@ +[1]12 \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/passargsfail-dark.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/passargsfail-dark.svg new file mode 100644 index 00000000..68ed7f0a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/passargsfail-dark.svg @@ -0,0 +1 @@ +Error:!incallrsubprocess.Causedbyerrorin`summary(mycars)`:!object'mycars'notfoundType.Last.errortoseethemoredetails. \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/passargsfail.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/passargsfail.svg new file mode 100644 index 00000000..b7f7eb68 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/passargsfail.svg @@ -0,0 +1 @@ +Error:!incallrsubprocess.Causedbyerrorin`summary(mycars)`:!object'mycars'notfoundType.Last.errortoseethemoredetails. \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/passargsok-dark.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/passargsok-dark.svg new file mode 100644 index 00000000..ec03fa4c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/passargsok-dark.svg @@ -0,0 +1 @@ +speeddistMin.:4.0Min.:2.001stQu.:12.01stQu.:26.00Median:15.0Median:36.00Mean:15.4Mean:42.983rdQu.:19.03rdQu.:56.00Max.:25.0Max.:120.00 \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/passargsok.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/passargsok.svg new file mode 100644 index 00000000..09105e99 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/passargsok.svg @@ -0,0 +1 @@ +speeddistMin.:4.0Min.:2.001stQu.:12.01stQu.:26.00Median:15.0Median:36.00Mean:15.4Mean:42.983rdQu.:19.03rdQu.:56.00Max.:25.0Max.:120.00 \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll-2-dark.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll-2-dark.svg new file mode 100644 index 00000000..60766ca6 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll-2-dark.svg @@ -0,0 +1 @@ +[1]"2done" \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll-2.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll-2.svg new file mode 100644 index 00000000..02761001 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll-2.svg @@ -0,0 +1 @@ +[1]"2done" \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll-3-dark.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll-3-dark.svg new file mode 100644 index 00000000..8a79ad47 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll-3-dark.svg @@ -0,0 +1 @@ +[[1]]outputerrorprocess"ready""ready""ready" \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll-3.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll-3.svg new file mode 100644 index 00000000..67449ad1 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll-3.svg @@ -0,0 +1 @@ +[[1]]outputerrorprocess"ready""ready""ready" \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll-4-dark.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll-4-dark.svg new file mode 100644 index 00000000..18f15064 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll-4-dark.svg @@ -0,0 +1 @@ +[1]"1done" \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll-4.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll-4.svg new file mode 100644 index 00000000..1c948456 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll-4.svg @@ -0,0 +1 @@ +[1]"1done" \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll-dark.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll-dark.svg new file mode 100644 index 00000000..da41b95f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll-dark.svg @@ -0,0 +1 @@ +[[1]]outputerrorprocess"silent""silent""silent"[[2]]outputerrorprocess"ready""ready""ready" \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll.svg new file mode 100644 index 00000000..90202579 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/poll.svg @@ -0,0 +1 @@ +[[1]]outputerrorprocess"silent""silent""silent"[[2]]outputerrorprocess"ready""ready""ready" \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rcmd-dark.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rcmd-dark.svg new file mode 100644 index 00000000..442694a3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rcmd-dark.svg @@ -0,0 +1 @@ +$status[1]0$stdout[1]"clang-archarm64\n"$stderr[1]""$timeout[1]FALSE$command[1]"/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/bin/R"[2]"CMD"[3]"config"[4]"CC" \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rcmd.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rcmd.svg new file mode 100644 index 00000000..6f014de7 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rcmd.svg @@ -0,0 +1 @@ +$status[1]0$stdout[1]"clang-archarm64\n"$stderr[1]""$timeout[1]FALSE$command[1]"/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/bin/R"[2]"CMD"[3]"config"[4]"CC" \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession-4-dark.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession-4-dark.svg new file mode 100644 index 00000000..c83ef7c2 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession-4-dark.svg @@ -0,0 +1 @@ +[1]"ready" \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession-4.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession-4.svg new file mode 100644 index 00000000..35741d84 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession-4.svg @@ -0,0 +1 @@ +[1]"ready" \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession-5-dark.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession-5-dark.svg new file mode 100644 index 00000000..5d13eeef --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession-5-dark.svg @@ -0,0 +1 @@ +[1]""$code[1]200$message[1]"donecallr-rs-result-17eb55fb39cd4"$result[1]-0.043703461.18261173-0.329021950.144230131.935970941.19500910[7]0.238762750.85456492-1.740516321.42462027$stdout$stderr$errorNULLattr(,"class")[1]"callr_session_result" \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession-5.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession-5.svg new file mode 100644 index 00000000..3296a5b9 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession-5.svg @@ -0,0 +1 @@ +[1]""$code[1]200$message[1]"donecallr-rs-result-17eb55fb39cd4"$result[1]-0.043703461.18261173-0.329021950.144230131.935970941.19500910[7]0.238762750.85456492-1.740516321.42462027$stdout$stderr$errorNULLattr(,"class")[1]"callr_session_result" \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession-dark.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession-dark.svg new file mode 100644 index 00000000..e6178d7f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession-dark.svg @@ -0,0 +1 @@ +RSESSION,alive,idle,pid98086. \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession.svg new file mode 100644 index 00000000..19170ee2 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession.svg @@ -0,0 +1 @@ +RSESSION,alive,idle,pid98086. \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession2-2-dark.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession2-2-dark.svg new file mode 100644 index 00000000..9cac3ee1 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession2-2-dark.svg @@ -0,0 +1 @@ +RSESSION,alive,busy,pid98090. \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession2-2.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession2-2.svg new file mode 100644 index 00000000..027ba722 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession2-2.svg @@ -0,0 +1 @@ +RSESSION,alive,busy,pid98090. \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession2-dark.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession2-dark.svg new file mode 100644 index 00000000..2df35dc2 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession2-dark.svg @@ -0,0 +1 @@ +[1]0.93875370.43054120.12512460.98262260.40328680.81394150.9970173[8]0.87883710.29427240.9011616 \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession2.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession2.svg new file mode 100644 index 00000000..8cdee576 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/rsession2.svg @@ -0,0 +1 @@ +[1]0.93875370.43054120.12512460.98262260.40328680.81394150.9970173[8]0.87883710.29427240.9011616 \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/simple-dark.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/simple-dark.svg new file mode 100644 index 00000000..ac211b2b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/simple-dark.svg @@ -0,0 +1 @@ +Sepal.LengthSepal.WidthPetal.LengthPetal.WidthSepal.Length0.6856935-0.04243401.27431540.5162707Sepal.Width-0.04243400.1899794-0.3296564-0.1216394Petal.Length1.2743154-0.32965643.11627791.2956094Petal.Width0.5162707-0.12163941.29560940.5810063 \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/simple.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/simple.svg new file mode 100644 index 00000000..bafebee2 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/figures/simple.svg @@ -0,0 +1 @@ +Sepal.LengthSepal.WidthPetal.LengthPetal.WidthSepal.Length0.6856935-0.04243401.27431540.5162707Sepal.Width-0.04243400.1899794-0.3296564-0.1216394Petal.Length1.2743154-0.32965643.11627791.2956094Petal.Width0.5162707-0.12163941.29560940.5810063 \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/paths.rds new file mode 100644 index 00000000..138320de Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/html/00Index.html new file mode 100644 index 00000000..3077e1a2 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/html/00Index.html @@ -0,0 +1,72 @@ + + +R: Call R from R + + + +
+

Call R from R + +

+
+
+[Up] +[Top] +

Documentation for package ‘callr’ version 3.7.6

+ + + +

Help Pages

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
add_hookAdd a user hook to be executed before launching an R subprocess
default_reposDefault value for the 'repos' option in callr subprocesses
rEvaluate an expression in another R session
rcmdRun an R CMD command
rcmd_bgRun an R CMD command in the background
rcmd_copycatCall and R CMD command, while mimicking the current R session
rcmd_processExternal R CMD Process
rcmd_process_optionsCreate options for an rcmd_process object
rcmd_safeRun an R CMD command
rcmd_safe_env'rcmd_safe_env' returns a set of environment variables that are more appropriate for 'rcmd_safe()'. It is exported to allow manipulating these variables (e.g. add an extra one), before passing them to the 'rcmd()' functions.
rscriptRun an R script
rscript_processExternal 'Rscript' process
rscript_process_optionsCreate options for an rscript_process object
r_bgEvaluate an expression in another R session, in the background
r_copycatRun an R process that mimics the current R process
r_processExternal R Process
r_process_optionsCreate options for an r_process object
r_safeEvaluate an expression in another R session
r_sessionExternal R Session
r_session_debugInteractive debugging of persistent R sessions
r_session_optionsCreate options for an r_session object
r_vanillaRun an R child process, with no configuration
supported_archsFind supported sub-architectures for the current R installation
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/callr/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/DESCRIPTION new file mode 100644 index 00000000..d554cf4d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/DESCRIPTION @@ -0,0 +1,50 @@ +Package: cli +Title: Helpers for Developing Command Line Interfaces +Version: 3.6.3 +Authors@R: c( + person("Gábor", "Csárdi", , "csardi.gabor@gmail.com", role = c("aut", "cre")), + person("Hadley", "Wickham", role = "ctb"), + person("Kirill", "Müller", role = "ctb"), + person("Salim", "Brüggemann", , "salim-b@pm.me", role = "ctb", + comment = c(ORCID = "0000-0002-5329-5987")), + person("Posit Software, PBC", role = c("cph", "fnd")) + ) +Description: A suite of tools to build attractive command line interfaces + ('CLIs'), from semantic elements: headings, lists, alerts, paragraphs, + etc. Supports custom themes via a 'CSS'-like language. It also + contains a number of lower level 'CLI' elements: rules, boxes, trees, + and 'Unicode' symbols with 'ASCII' alternatives. It support ANSI + colors and text styles as well. +License: MIT + file LICENSE +URL: https://cli.r-lib.org, https://github.com/r-lib/cli +BugReports: https://github.com/r-lib/cli/issues +Depends: R (>= 3.4) +Imports: utils +Suggests: callr, covr, crayon, digest, glue (>= 1.6.0), grDevices, + htmltools, htmlwidgets, knitr, methods, mockery, processx, ps + (>= 1.3.4.9000), rlang (>= 1.0.2.9003), rmarkdown, rprojroot, + rstudioapi, testthat, tibble, whoami, withr +Config/Needs/website: r-lib/asciicast, bench, brio, cpp11, decor, desc, + fansi, prettyunits, sessioninfo, tidyverse/tidytemplate, + usethis, vctrs +Config/testthat/edition: 3 +Encoding: UTF-8 +RoxygenNote: 7.2.3 +NeedsCompilation: yes +Packaged: 2024-06-21 17:24:00 UTC; gaborcsardi +Author: Gábor Csárdi [aut, cre], + Hadley Wickham [ctb], + Kirill Müller [ctb], + Salim Brüggemann [ctb] (), + Posit Software, PBC [cph, fnd] +Maintainer: Gábor Csárdi +Repository: CRAN +Date/Publication: 2024-06-21 21:00:07 UTC +Built: R 4.4.1; aarch64-apple-darwin20; 2025-02-01 04:45:30 UTC; unix +Archs: cli.so.dSYM +RemoteType: standard +RemotePkgRef: cli +RemoteRef: cli +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 3.6.3 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/INDEX new file mode 100644 index 00000000..89dd55e1 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/INDEX @@ -0,0 +1,136 @@ +ansi-styles ANSI colored text +ansi_align Align an ANSI colored string +ansi_collapse Collapse a vector into a string scalar +ansi_columns Format a character vector in multiple columns +ansi_grep Like 'base::grep()' and 'base::grepl()', but + for ANSI strings +ansi_has_any Check if a string has some ANSI styling +ansi_hide_cursor Hide/show cursor in a terminal +ansi_html Convert ANSI styled text to HTML +ansi_html_style CSS styles for the output of 'ansi_html()' +ansi_nchar Count number of characters in an ANSI colored + string +ansi_nzchar Like 'base::nzchar()', but for ANSI strings +ansi_regex Perl compatible regular expression that matches + ANSI escape sequences +ansi_simplify Simplify ANSI styling tags +ansi_string Labels a character vector as containing ANSI + control codes. +ansi_strip Remove ANSI escape sequences from a string +ansi_strsplit Split an ANSI colored string +ansi_strtrim Truncate an ANSI string +ansi_strwrap Wrap an ANSI styled string to a certain width +ansi_substr Substring(s) of an ANSI colored string +ansi_substring Substring(s) of an ANSI colored string +ansi_toupper ANSI character translation and case folding +ansi_trimws Remove leading and/or trailing whitespace from + an ANSI string +builtin_theme The built-in CLI theme +cat_line 'cat()' helpers +cli Compose multiple cli functions +cli-config cli environment variables and options +cli_abort Signal an error, warning or message with a cli + formatted message +cli_alert CLI alerts +cli_blockquote CLI block quote +cli_bullets List of items +cli_bullets_raw List of verbatim items +cli_code A block of code +cli_debug_doc Debug cli internals +cli_div Generic CLI container +cli_dl Definition list +cli_end Close a CLI container +cli_fmt Capture the output of cli functions instead of + printing it +cli_format Format a value for printing +cli_format_method Create a format method for an object using cli + tools +cli_h1 CLI headings +cli_li CLI list item(s) +cli_list_themes List the currently active themes +cli_ol Ordered CLI list +cli_output_connection The connection option that cli would use +cli_par CLI paragraph +cli_process_start Indicate the start and termination of some + computation in the status bar (superseded) +cli_progress_along Add a progress bar to a mapping function or for + loop +cli_progress_bar cli progress bars +cli_progress_builtin_handlers + cli progress handlers +cli_progress_demo cli progress bar demo +cli_progress_message Simplified cli progress messages +cli_progress_num Progress bar utility functions. +cli_progress_output Add text output to a progress bar +cli_progress_step Simplified cli progress messages, with styling +cli_progress_styles List of built-in cli progress styles +cli_rule CLI horizontal rule +cli_sitrep cli situation report +cli_status Update the status bar (superseded) +cli_status_clear Clear the status bar (superseded) +cli_status_update Update the status bar (superseded) +cli_text CLI text +cli_ul Unordered CLI list +cli_vec Add custom cli style to a vector +cli_verbatim CLI verbatim text +code_highlight Syntax highlight R code +code_theme_list Syntax highlighting themes +combine_ansi_styles Combine two or more ANSI styles +console_width Determine the width of the console +containers About cli containers +demo_spinners Show a demo of some (by default all) spinners +diff_chr Compare two character vectors elementwise +diff_str Compare two character strings, character by + character +faq Frequently Asked Questions +format_error Format an error, warning or diagnostic message +format_inline Format and returns a line of text +get_spinner Character vector to put a spinner on the screen +has_keypress_support Check if the current platform/terminal supports + reading single keys. +hash_animal Adjective-animal hash +hash_emoji Emoji hash +hash_md5 MD5 hash +hash_sha1 SHA-1 hash +hash_sha256 SHA-256 hash +inline-markup About inline markup in the semantic cli +is_ansi_tty Detect if a stream support ANSI escape + characters +is_dynamic_tty Detect whether a stream supports \\r (Carriage + return) +is_utf8_output Whether cli is emitting UTF-8 characters +keypress Read a single keypress at the terminal +links cli hyperlinks +list_border_styles Draw a banner-like box in the console +list_spinners List all available spinners +make_ansi_style Create a new ANSI style +make_spinner Create a spinner +no Pluralization helper functions +num_ansi_colors Detect the number of ANSI colors to use +pluralization About cli pluralization +pluralize String templating with pluralization +pretty_print_code Turn on pretty-printing functions at the R + console +progress-c The cli progress C API +progress-variables Progress bar variables +rule Make a rule with one or two text labels +ruler Print the helpful ruler to the screen +simple_theme A simple CLI theme +spark_bar Draw a sparkline bar graph with unicode block + characters +spark_line Draw a sparkline line graph with Braille + characters. +start_app Start, stop, query the default cli application +style_hyperlink Terminal Hyperlinks +symbol Various handy symbols to use in a command line + UI +test_that_cli Test cli output with testthat +themes About cli themes +tree Draw a tree +truecolor ANSI colors palettes +utf8_graphemes Break an UTF-8 character vector into grapheme + clusters +utf8_nchar Count the number of characters in a character + vector +utf8_substr Substring of an UTF-8 string +vt_output Simulate (a subset of) a VT-5xx ANSI terminal diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/LICENSE new file mode 100644 index 00000000..f71f9392 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2023 +COPYRIGHT HOLDER: cli authors diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/Meta/Rd.rds new file mode 100644 index 00000000..e3078453 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/Meta/hsearch.rds new file mode 100644 index 00000000..e841f33f Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/Meta/links.rds new file mode 100644 index 00000000..36314508 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/Meta/nsInfo.rds new file mode 100644 index 00000000..51b53243 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/Meta/package.rds new file mode 100644 index 00000000..4a55d2fc Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/NAMESPACE new file mode 100644 index 00000000..ebea8ae8 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/NAMESPACE @@ -0,0 +1,263 @@ +# Generated by roxygen2: do not edit by hand + +S3method("[",cli_doc) +S3method(as.character,cli_no) +S3method(as.character,cli_noprint) +S3method(as.character,cli_sitrep) +S3method(cli_format,character) +S3method(cli_format,default) +S3method(cli_format,numeric) +S3method(format,cli_ansi_html_style) +S3method(format,cli_diff_chr) +S3method(format,cli_diff_str) +S3method(format,cli_doc) +S3method(format,cli_progress_demo) +S3method(format,cli_sitrep) +S3method(format,cli_spark) +S3method(print,cli_ansi_html_style) +S3method(print,cli_ansi_string) +S3method(print,cli_ansi_style) +S3method(print,cli_boxx) +S3method(print,cli_diff_chr) +S3method(print,cli_doc) +S3method(print,cli_progress_demo) +S3method(print,cli_rule) +S3method(print,cli_sitrep) +S3method(print,cli_spark) +S3method(print,cli_spinner) +S3method(print,cli_tree) +export("__cli_update_due") +export(ansi_align) +export(ansi_chartr) +export(ansi_collapse) +export(ansi_columns) +export(ansi_grep) +export(ansi_grepl) +export(ansi_has_any) +export(ansi_has_hyperlink_support) +export(ansi_hide_cursor) +export(ansi_html) +export(ansi_html_style) +export(ansi_hyperlink_types) +export(ansi_nchar) +export(ansi_nzchar) +export(ansi_palette_show) +export(ansi_palettes) +export(ansi_regex) +export(ansi_show_cursor) +export(ansi_simplify) +export(ansi_string) +export(ansi_strip) +export(ansi_strsplit) +export(ansi_strtrim) +export(ansi_strwrap) +export(ansi_substr) +export(ansi_substring) +export(ansi_tolower) +export(ansi_toupper) +export(ansi_trimws) +export(ansi_with_hidden_cursor) +export(bg_black) +export(bg_blue) +export(bg_br_black) +export(bg_br_blue) +export(bg_br_cyan) +export(bg_br_green) +export(bg_br_magenta) +export(bg_br_red) +export(bg_br_white) +export(bg_br_yellow) +export(bg_cyan) +export(bg_green) +export(bg_magenta) +export(bg_none) +export(bg_red) +export(bg_white) +export(bg_yellow) +export(boxx) +export(builtin_theme) +export(cat_boxx) +export(cat_bullet) +export(cat_line) +export(cat_print) +export(cat_rule) +export(ccli_tick_reset) +export(cli) +export(cli_abort) +export(cli_alert) +export(cli_alert_danger) +export(cli_alert_info) +export(cli_alert_success) +export(cli_alert_warning) +export(cli_blockquote) +export(cli_bullets) +export(cli_bullets_raw) +export(cli_code) +export(cli_div) +export(cli_dl) +export(cli_end) +export(cli_fmt) +export(cli_format) +export(cli_format_method) +export(cli_h1) +export(cli_h2) +export(cli_h3) +export(cli_inform) +export(cli_li) +export(cli_list_themes) +export(cli_ol) +export(cli_output_connection) +export(cli_par) +export(cli_process_done) +export(cli_process_failed) +export(cli_process_start) +export(cli_progress_along) +export(cli_progress_bar) +export(cli_progress_builtin_handlers) +export(cli_progress_cleanup) +export(cli_progress_demo) +export(cli_progress_done) +export(cli_progress_message) +export(cli_progress_num) +export(cli_progress_output) +export(cli_progress_step) +export(cli_progress_styles) +export(cli_progress_update) +export(cli_rule) +export(cli_sitrep) +export(cli_status) +export(cli_status_clear) +export(cli_status_update) +export(cli_text) +export(cli_tick_reset) +export(cli_ul) +export(cli_vec) +export(cli_verbatim) +export(cli_warn) +export(code_highlight) +export(code_theme_list) +export(col_black) +export(col_blue) +export(col_br_black) +export(col_br_blue) +export(col_br_cyan) +export(col_br_green) +export(col_br_magenta) +export(col_br_red) +export(col_br_white) +export(col_br_yellow) +export(col_cyan) +export(col_green) +export(col_grey) +export(col_magenta) +export(col_none) +export(col_red) +export(col_silver) +export(col_white) +export(col_yellow) +export(combine_ansi_styles) +export(console_width) +export(default_app) +export(demo_spinners) +export(diff_chr) +export(diff_str) +export(format_bullets_raw) +export(format_error) +export(format_inline) +export(format_message) +export(format_warning) +export(get_spinner) +export(has_keypress_support) +export(hash_animal) +export(hash_emoji) +export(hash_file_md5) +export(hash_file_sha1) +export(hash_file_sha256) +export(hash_md5) +export(hash_obj_animal) +export(hash_obj_emoji) +export(hash_obj_md5) +export(hash_obj_sha1) +export(hash_obj_sha256) +export(hash_raw_animal) +export(hash_raw_emoji) +export(hash_raw_md5) +export(hash_raw_sha1) +export(hash_raw_sha256) +export(hash_sha1) +export(hash_sha256) +export(is_ansi_tty) +export(is_dynamic_tty) +export(is_utf8_output) +export(keypress) +export(list_border_styles) +export(list_spinners) +export(list_symbols) +export(make_ansi_style) +export(make_spinner) +export(no) +export(num_ansi_colors) +export(pb_bar) +export(pb_current) +export(pb_current_bytes) +export(pb_elapsed) +export(pb_elapsed_clock) +export(pb_elapsed_raw) +export(pb_eta) +export(pb_eta_raw) +export(pb_eta_str) +export(pb_extra) +export(pb_id) +export(pb_name) +export(pb_percent) +export(pb_pid) +export(pb_rate) +export(pb_rate_bytes) +export(pb_rate_raw) +export(pb_spin) +export(pb_status) +export(pb_timestamp) +export(pb_total) +export(pb_total_bytes) +export(pluralize) +export(pretty_print_code) +export(qty) +export(rule) +export(ruler) +export(simple_theme) +export(spark_bar) +export(spark_line) +export(start_app) +export(stop_app) +export(style_blurred) +export(style_bold) +export(style_dim) +export(style_hidden) +export(style_hyperlink) +export(style_inverse) +export(style_italic) +export(style_no_bg_color) +export(style_no_blurred) +export(style_no_bold) +export(style_no_color) +export(style_no_dim) +export(style_no_hidden) +export(style_no_inverse) +export(style_no_italic) +export(style_no_strikethrough) +export(style_no_underline) +export(style_reset) +export(style_strikethrough) +export(style_underline) +export(symbol) +export(test_that_cli) +export(ticking) +export(tree) +export(truecolor) +export(utf8_graphemes) +export(utf8_nchar) +export(utf8_substr) +export(vt_output) +importFrom(utils,getParseData) +importFrom(utils,getSrcref) +useDynLib(cli, .registration=TRUE) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/NEWS.md new file mode 100644 index 00000000..4483a2b3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/NEWS.md @@ -0,0 +1,497 @@ +# cli 3.6.3 + +* cli now builds on ARM Windows. + +* "Solarized Dark" is now the default syntax highlighting theme in + terminals. + +* The `{.obj_type_friendly}` inline style now only shows the first class + name (#669 @olivroy). + +* Syntax highlighting now does not fail in RStudio if the rstudioapi + package is not installed (#697). + +# cli 3.6.2 + +* `ansi_collapse(x, trunc = 1, style = "head")` now indeed shows one + element if `length(x) == 2`, as documented (@salim-b, #572). + +* `ansi_collapse()` gains a `sep2` argument to specify a seperate separator + for length-two inputs. It defaults to `" and "` which, in conjunction with + the other defaults, produces a collapsed string that fully adheres to the + [serial comma](https://en.wikipedia.org/wiki/Serial_comma) rules. + (@salim-b, #569) + +* `ansi_string()` is now an exported function (@multimeric, #573). + +# cli 3.6.1 + +* ANSI hyperlinks are now turned off on the RStudio render plane (#581). + +# cli 3.6.0 + +* The progressr progress handler now reports progress correctly + (@HenrikBengtsson, #558). + +* New `hash_*sha1()` functions to calculate the SHA-1 hash of strings, + objects, files. + +* cli now shows progress bars after one second by default, if they + are less than half way at the point. (Or after two seconds, + unconditionally, as before.) See the the `cli.progress_show_after` + option in `?cli-config` for details (#542). + +* `format_inline()` now has a new argument `keep_whitespace`, and it keeps + whitespace, including newline and form feed characters by default. + +# cli 3.5.0 + +* New `keypress()` function to read a single key press from a terminal. + +* New function `pretty_print_code()` to print function objects with syntax + highlighting at the R console. + +* `col_*` and `bg_*` functions how handle zero-length input correctly (#532). + +* New function `ansi_collapse()` to collapse character vectors into a single + string. + +* `ansi_strtrim()` now handles some edge cases better, when `ellipsis` has + length zero, and when it is wider than `width`. + +* New `hash_file_md5()` function to calculate the MD5 hash of one or more + files. + +# cli 3.4.1 + +* cli has better error messages now. + +* New `format_inline()` argument: `collapse`, to collapse multi-line output, + potentially because of `\f` characters. + +# cli 3.4.0 + +* New experimental styles to create ANSI hyperlinks in RStudio and + terminals that support them. See `?cli::links` for details (#513). + +* Expressions that start and end with a `{}` substitution are now styled + correctly. E.g. `{.code {var1} + {var2}}` (#517). + +* New `{.obj_type_friendly}` inline style to format the type of an R object + in a user friendly way (#463). + +* Improved vector collapsing behavior. cli now shows both the beginning + and end of the collapsed vector, by default (#419). + +* Nested `cli()` calls work now (#497). + +* Return values now work as they should within `cli()` calls (#496). + +* Style attributes with underscores have new names with dashes instead: + `vec_sep`, `vec_last`, `vec_trunc`, `string-quote`. The old names still + work, but the new ones take precedence (#483). + +* cli now does not crash at the end of the R session on Arm Windows + (#494; @kevinushey) + +* Vectors are truncated at 20 elements now by default, instead of 100 (#430). + +* 20 new spinners from the awesome + [cli-spinners](https://github.com/sindresorhus/cli-spinners) package, + and from @HenrikBengtsson in #469. + Run this to demo them, some need UTF-8 and emoji support: + + ```r + new <- c("dots13", "dots8Bit", "sand", "material", "weather", "christmas", + "grenade", "point", "layer", "betaWave", "fingerDance", "fistBump", + "soccerHeader", "mindblown", "speaker", "orangePulse", "bluePulse", + "orangeBluePulse", "timeTravel", "aesthetic", "growVeriticalDotsLR", + "growVeriticalDotsRL", "growVeriticalDotsLL", "growVeriticalDotsRR") + demo_spinners(new) + ``` + +* cli exit handlers are now compatible again with the withr package (#437). + +* cli functions now keep trailing `\f` characters as newlines. + They also keep multiple consecutive `\f` as multiple newlinees (#491). + +* `{}` substitutions within inline styles are now formatted correctly. + E.g. `{.code download({url})}` will not add backticks to `url`, and + `{.val pre-{x}-post}` will format the whole value instead of `x`. + (#422, #474). + +* cli now replaces newline characters within `{.class ... }` inline styles + with spaces. If the `cli.warn_inline_newlines` option is set to TRUE, then + it also throws a warning. (#417). + +* `code_highlight` now falls back to the default theme (instead of no theme) + for unknown RStudio themes (#482, @rossellhayes). + +* `cli_abort()` now supplies `.frame` to `abort()`. This fixes an + issue with the `.internal = TRUE` argument (r-lib/rlang#1386). + +* cli now does a better job at detecting the RStudio build pane, job pane + and render pane, and their capabilities w.r.t. ANSI colors and hyperlinks. + Note that this requires a daily build of RStudio (#465). + +* New functions for ANSI strings: `ansi_grep()`, `ansi_grepl()`, + `ansi_nzchar()`. They work like the corresponding base R functions, but + handle ANSI markup. + +* `style_hyperlink()` (really) no longer breaks if the env variable `VTE_VERSION` + is of the form `\d{4}`, i.e., 4 consecutive numbers (#441, @michaelchirico) + +* `cli_dl()` and its corresponding `cli_li()` can now style the labels. + +* The behavior cli's inline styling expressions is now more predictable. + cli does not try to evaluate a styled string as an R expression any more. + E.g. the meaning of `"{.emph +1}"` is now always the "+1", with style + `.emph`, even if an `.emph` variable is available and the `.emph + 1` + expression can be evaluated. + +* Functions that apply bright background colors (e.g. `bg_br_yellow()`) now + close themselves. They no longer format text after the end of the function + (#484, @rossellhayes). + +# cli 3.3.0 + +* `style_hyperlink()` no longer breaks if the env variable `VTE_VERSION` + is of the form `\d{4}`, i.e., 4 consecutive numbers (#441, @michaelchirico) + +* `ansi_*()` functions support ANSI hyperlinks again (#444). + +* Turning off ANSI colors via the `cli.num_colors` option or the + `R_CLI_NUM_COLORS` or the `NO_COLOR` environment variable now also turns off + ANSI hyperlinks (#447). + +* `symbol` now only has two variants: UTF-8 and ASCII. There are no special + variants for RStudio and Windows RGui any more (#424). + +# cli 3.2.0 + +## Breaking change + +* The `cli_theme_dark` option is now known as `cli.theme_dark`, to be + consistent with all other cli option names (#380). + +## Other changes + +* The preferred names of the S3 classes `ansi_string`, `ansi_style`, `boxx`, + `rule` and `tree` now have `cli_` prefix: `cli_ansi_string`, etc. This will + help avoiding name conflicts with other packages eventually, but for now + the old names are kept as well, for compatibility. + +* `cli_abort()` has been updated to work nicely with rlang 1.0. The + default `call` and backtrace soft-truncation are set to `.envir` + (which itself is set to the immediate caller of `cli_abort()` by + default). + + Line formatting now happens lazily at display time via + `rlang::cnd_message()` (which is called by the `conditionMessage()` + method for rlang errors). + +* New `hash_sha256()` function to calculate SHA-256 hashes. New + `hash_raw_*()`, `hash_obj_*()` and `hash_file_*()` functions to calculate + various hashes of raw vectors, R objects and files. + +* You can use the new `cli.default_num_colors` option to set the default + number of ANSI colors, only if ANSI support is otherwise detected. + See the details in the manual of `num_ansi_colors()`. + +* You can set the new `ESS_BACKGROUND_MODE` environment variable to + `dark` to indicate dark mode. + +* cli now handles quotes and comment characters better in the semantion + `cli_*()` functions that perform glue string interpolation (#370). + +# cli 3.1.1 + +* `style_hyperlink()` gains a `params=` argument (#384). + +# cli 3.1.0 + +## Breaking changes + +* The C progress bar API now uses `double` instead of `int` as the data + type of the progress units (#335). + +## New features + +* Several improvements and changes in the `ansi_*()` functions: + - most `ansi_*()` functions are now implemented in C and they are + much faster (#316). + - they handle `NA` values better. + - many functions now use UTF-8 graphemes by default instead of code + points. E.g. `ansi_nchar()` counts graphemes, etc. + - they convert their input to UTF-8 and always return UTF-8 + encoded strings. + - new function `ansi_simplify()` to remove superfluous ANSI tags. + - new function `ansi_html()` to convert ANSI-highlighted strings + to HTML. + - `ansi_has_any()` and `ansi_strip()` now have `sgr` and `csi` + arguments to look for SGR tags, CSI tags, or both. + +* New functions that handle UTF-8 encoded strings correctly: + `utf8_graphemes()`, `utf8_nchar()`, `utf8_substr()`. + +* Support for palettes, including a colorblind friendly palette. + See `?ansi_palettes` for details. + +* True color support: `num_ansi_colors()` now detects terminals with + 24 bit color support, and `make_ansi_style()` uses the exact RGB colors + on these terminals (#208). + +* The new `col_br_*()` and `bg_br_()` functions create bright versions of + eight base ANSI colors (#327). + +* New function `code_highlight()` to syntax highlight R code. It supports + several themes out of the box, see `code_theme_list()` (#348). + +* New functions for hashing: `hash_animal()`, `hash_emoji()` and + `hash_md5()`. + +* New `diff_chr()` and `diff_str()` functions to calculate the difference + of character vectors and letters of strings. + +## Smaller improvements + +* Progress bars with `clear = FALSE` now print the last, completed, state + properly. + +* The progress bar for Shiny apps now handles output from + `cli_progress_output()`. + +* Progress variables in C `format_done` strings work correctly now (#337). + +* `cli_dl()` now works with an empty description, and gives a better + error for invalid input (#347). + +* `rule()` is now works better if the labels have ANSI markup. + +* `cli_spark` objects now have `format()` and `print()` methods. + +* `cli_process_done()` now does not error without a process (#351). + +* ANSI markup is now supported in RStudio jobs (#353). + +* The lack of ANSI support is now again correctly detected if there is an + active `sink()` (#366). + +# cli 3.0.1 + +* `ansi_strtrim()` now correctly keeps `NA` values (#309). + +* `format_inline()` now uses the correct environment (@rundel, #314). + +# cli 3.0.0 + +* New functions for progress bars, please see the new articles at + https://cli.r-lib.org/articles/ for details. + +* New `cli_abort()`, `cli_warn()` and `cli_inform()` functions, to throw + errors with cli pluralization and styling. + +* New `format_inline()` function to format a cli string without emitting + it (#278). + +# cli 2.5.0 + +* New `style_no_*()` functions to locally undo styling. + New `col_none()` and `bg_none()` functions to locally undo text color + and background color. + +* It is now possible to undo text and background color in a theme, by + setting them to `NULL` or `"none"`. + +* `cli_memo()` was renamed to `cli_bullets()`, as it is by default + formatted as a bullet list (#250). + +* New `ansi_toupper()`, `ansi_tolower` and `ansi_chartr()` functions, + the ANSI styling aware variants of `toupper()`, `tolower()` and + `chartr()` (#248). + +* New `test_that_cli()` helper function to write testthat tests for + cli output. + +* `tree()` now does not produce warnings for tibbles (#238). + +* New inline style: `.cls` to format class names, e.g. + `"{.var fit} must be an {.cls lm} object"`. + +# cli 2.4.0 + +* New `cli_memo()` function to create a list of items or tasks. + +* New `cli::cli()` function to create a single cli message from multiple + cli calls (#170). + +* cli now highlights weird names, e.g. path names with leading or + trailing space (#227). + +* Styling is fixed at several places. In particular, nested lists should + be now formatted better (#221). + +* New `spark_bar()` and `spark_line()` functions to draw small bar or + line charts. + +# cli 2.3.1 + +* ANSI color support detection works correctly now in older RStudio, + and also on older R versions. + +* `cli_h1()`, `cli_h2()` and `cli_h3()` now work with multiple glue + substitutions (#218). + +# cli 2.3.0 + +* `boxx()` now correctly calculates the width of the box for non-ASCII + characters. + +* New `ansi_trimws()` and `ansi_strwrap()` functions, they are similar + to `trimws()` and `strwrap()` but work on ANSI strings. + +* New `ansi_columns()` function to format ANSI strings in multiple columns. + +* `ansi_substr()`, `ansi_substring()`, `ansi_strsplit()`, `ansi_align()` + now always return `cli_ansi_string` objects. + +* `ansi_nchar()`, `ansi_align()`, `ansi_strtrim()` and the new + `ansi_strwrap()` as well handle wide Unicode correctly, according to + their display width. + +* `boxx()` can now add headers and footers to boxes. + +# cli 2.2.0 + +* New `style_hyperlink()` function to add hyperlinks, on terminals that + support them. + +* `cli_format_method()` now works properly in knitr, and other environments + that catch message conditions (#159). + +* ANSI strings created by `col_*`, `bg_*` and `style_*` now also add the + `character` class to the result. This fixes issues with code that + expect `character` objects. + +* New functions to manipulate ANSI strings: `ansi_aling()`, + `ansi_has_any()`, `ansi_nchar()`, `ansi_regex()`, `ansi_strip()`, + `ansi_strsplit()`, `ansi_substr()`, `ansi_substring()`. + +# cli 2.1.0 + +* New `cli_vec()` function to allow easier formatting of collapsed + vectors. It is now also possible to use styling to set the collapsing + parameters (#129). + +* New `pluralize()` function to perform pluralization without generating + cli output (#155). + +* `console_width()` works better now in RStudio, and also in terminals. + +* Styling of verbatim text work properly now (#147, @tzakharko). + +* Messages (i.e. `message` conditions) coming from cli now have the + `cliMessage` class, so you can easily suppress them without suppressing + other messages (#156). + +* cli prints the output to `stderr()` now, if there is an output or + message sink. This is to make interactive and non-interactive sessions + consistent (#153). + +* Pluralization works correctly now if the last alternative is the + empty string (#158). + +* cli now caches the result of the dark background detection in iTerm on + macOS. Reload cli to delete the cache (#131). + +* The `is_dynamic_tty()`, `is_ansi_tty()` and `ansi_hide_cursor()` and + related functions now default to the `"auto"` stream, which is + automatically selected to be either `stdout()` or `stderr()`. + See the manual for details (#144). + +* The default theme now quotes file names, paths, email addresses if they + don't start or end with an alphanumeric character or a slash. This is + to make it easier to spot names that start or end with a space (#167). + +* `make_spinner()` clears the line properly now (@tzakharko, #164). + +* Semantic cli functions now automatically replace Unicode non-breaking + space characters (`\u00a0`) with regular space characters, right before + output. They are still used to calculate the line breaks, but not + outputted (#161). +* Progress bars now respect `is_dynamic_tty()` and do not output `\r` when this + is false (@jimhester, #177) + +# cli 2.0.2 + +* The status bar now does not simplify multiple spaces by a single space. + +* cli now does not crash if it fails to detect whether the RStudio theme + is a dark theme (#138). + +* cli now works better with wide Unicode characters, for example emojis. + In particular, a status bar containing emojis is cleared properly (#133). + +* The status bar now does not flicker when updated, in terminals (#135). + +# cli 2.0.1 + +* Symbols (`symbol$*`) are now correctly printed in RStudio on Windows (#124). + +* The default theme for `cli_code()` output looks better now, especially + in RStudio (#123). + +* Remove spurious newline after a `cli_process_start()` was cleared + manually, and also at the end of the function. + +* Use Oxford comma when listing 3 or more items (@jonocarroll, #128). + +# cli 2.0.0 + +## Semantic command line interface tools + +cli 2.0.0 has a new set of functions that help creating a CLI using a set +of higher level elements: headings, paragraphs, lists, alerts, code blocks, +etc. The formatting of all elements can be customized via themes. +See the "Building a semantic CLI" article on the package web site: +https://cli.r-lib.org + +## Bug fixes: + +* Fix a bug in `is_dynamic_tty()`, setting `R_CLI_DYNAMIC="FALSE"` now + properly turns dynamic tty off (#70). + +# cli 1.1.0 + +* cli has now functions to add ANSI styles to text. These use the crayon + package internally, and provide a simpler interface. See the `col_*`, + `bg_*`, `style_*` and also the `make_ansi_style()` and + `combine_ansi_styles()` functions (#51). + +* New `is_dynamic_tty()` function detects if `\r` should be used for a + stream (#62). + +* New `is_ansi_tty()` function detects if ANSI control sequences can be + used for a stream. + +* New `ansi_hide_cursor()`, `ansi_show_cursor()` and + `ansi_with_hidden_cursor()` functions to hide and show the cursor in + terminals. + +* New `make_spinner()` function helps integrating spinners into your + functions. + +* Now `symbol` always uses ASCII symbols when the `cli.unicode` option is + set to `FALSE`. + +# 1.0.1 + +* New `cli_sitrep()` function, situation report about UTF-8 and ANSI + color support (#53). + +* Fall back to ASCII only characters on non-Windows platforms without + UTF-8 support, and also in LaTeX when running knitr (#34). + +# cli 1.0.0 + +First public release. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/R/cli b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/R/cli new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/R/cli @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/R/cli.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/R/cli.rdb new file mode 100644 index 00000000..7fa928b0 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/R/cli.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/R/cli.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/R/cli.rdx new file mode 100644 index 00000000..45da3328 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/R/cli.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/R/sysdata.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/R/sysdata.rdb new file mode 100644 index 00000000..69972cba Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/R/sysdata.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/R/sysdata.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/R/sysdata.rdx new file mode 100644 index 00000000..d4639de1 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/R/sysdata.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/examples/apps/news.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/examples/apps/news.R new file mode 100755 index 00000000..99c15573 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/examples/apps/news.R @@ -0,0 +1,122 @@ +#! /usr/bin/env Rscript + +setup_app <- function() { + theme <- list( + "url" = list(color = "blue"), + ".pkg" = list(color = "orange"), + "it" = list("margin-bottom" = 1)) + start_app(theme = theme, output = "stdout") +} + +load_packages <- function() { + tryCatch({ + library(cli) + library(httr) + library(jsonlite) + library(prettyunits) + library(glue) + library(parsedate) + library(docopt) }, + error = function(e) { + cli_alert_danger( + "The {.pkg glue}, {.pkg httr}, {.pkg jsonlite}, {.pkg prettyunits},", + " {.pkg parsedate} and {.pkg docopt} packages are needed!") + q(save = "no", status = 1) + }) +} + +news <- function(n = 10, day = FALSE, week = FALSE, since = NULL, + reverse = FALSE) { + + load_packages() + setup_app() + + result <- if (day) + news_day() + else if (week) + news_week() + else if (!is.null(since)) + news_since(since) + else + news_n(as.numeric(n)) + + if (reverse) result <- rev(result) + + format_results(result) + invisible() +} + +news_day <- function() { + date <- format_iso_8601(Sys.time() - as.difftime(1, units="days")) + ep <- glue("/-/pkgreleases?descending=true&endkey=%22{date}%22") + do_query(ep) +} + +news_week <- function() { + date <- format_iso_8601(Sys.time() - as.difftime(7, units="days")) + ep <- glue("/-/pkgreleases?descending=true&endkey=%22{date}%22") + do_query(ep) +} + +news_since <- function(since) { + date <- format_iso_8601(parse_date(since)) + ep <- glue("/-/pkgreleases?descending=true&endkey=%22{date}%22") + do_query(ep) +} + +news_n <- function(n) { + ep <- glue("/-/pkgreleases?limit={n}&descending=true") + do_query(ep) +} + +do_query <- function(ep) { + base <- "https://crandb.r-pkg.org" + url <- glue("{base}{ep}") + response <- GET(url) + stop_for_status(response) + fromJSON(content(response, as = "text"), simplifyVector = FALSE) +} + +format_results <- function(results) { + cli_div(theme = list(ul = list("list-style-type" = ""))) + cli_ol() + lapply(results, format_result) +} + +parse_arguments <- function() { + + "Usage: + news.R [-r | --reverse] [-n num ] + news.R [-r | --reverse] --day | --week | --since date + news.R [-h | --help] + +Options: + -n num Show the last 'n' releases [default: 10]. + --day Show releases in the last 24 hours + --week Show relaases in the last 7 * 24 hours + --since date Show releases since 'date' + -r --reverse Reverse the order, show older on top + -h --help Print this help message + +New package releases on CRAN +" -> doc + + docopt(doc) +} + +format_result <- function(result) { + pkg <- result$package + ago <- vague_dt(Sys.time() - parse_iso_8601(result$date)) + url <- paste0("https://r-pkg.org/pkg/", pkg$Package) + cli_li() + cli_text("{.pkg {pkg$Package}} {pkg$Version} -- + {ago} by {.emph {pkg$Maintainer}}") + cli_text("{pkg$Title}") + cli_text("{.url {url}}") +} + +if (is.null(sys.calls())) { + load_packages() + opts <- parse_arguments() + news(opts$n, opts$day, opts$week, opts$since, opts$reverse) +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/examples/apps/outdated.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/examples/apps/outdated.R new file mode 100755 index 00000000..542c5c67 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/examples/apps/outdated.R @@ -0,0 +1,79 @@ +#! /usr/bin/env Rscript + +## To get the pkgcache package: +## source("https://install-github.me/r-lib/pkgcache") + +setup_app <- function() { + theme <- list( + "url" = list(color = "blue"), + ".pkg" = list(color = "orange")) + start_app(theme = theme, output = "stdout") +} + +load_packages <- function() { + tryCatch(suppressPackageStartupMessages({ + library(cli) + library(pkgcache) + library(docopt) }), + error = function(e) { + cli_alert_danger("The {.pkg pkgcache} and {.pkg docopt} packages are needed!") + q(save = "no", status = 1) + }) +} + +outdated <- function(lib = NULL, notcran = FALSE) { + load_packages() + setup_app() + if (is.null(lib)) lib <- .libPaths()[1] + inst <- utils::installed.packages(lib = lib) + cli_alert_info("Getting repository metadata") + repo <- meta_cache_list(rownames(inst)) + + if (!notcran) inst <- inst[inst[, "Package"] %in% repo$package, ] + + for (i in seq_len(nrow(inst))) { + pkg <- inst[i, "Package"] + iver <- inst[i, "Version"] + + if (! pkg %in% repo$package) { + cli_alert_info("{.pkg {pkg}}: \tnot a CRAN/BioC package") + next + } + + rpkg <- repo[repo$package == pkg, ] + newer <- rpkg[package_version(rpkg$version) > iver, ] + if (!nrow(newer)) next + + nver <- package_version(newer$version) + mnver <- max(nver) + newest <- newer[mnver == nver, ] + bin <- if (any(newest$platform != "source")) "bin" else "" + src <- if (any(newest$platform == "source")) "src" else "" + + cli_alert_danger("{.emph {pkg}}") + cli_alert_danger( + "{.pkg {pkg}} \t{iver} {symbol$arrow_right} {mnver} {.emph ({bin} {src})}") + } +} + +parse_arguments <- function() { + "Usage: + outdated.R [-l lib] [-x] + outdated.R -h | --help + +Options: + -x Print not CRAN/BioC packages as well + -l lib Library directory, default is first directory in the lib path + -h --help Print this help message + +Check for outdated packages in a package library. + " -> doc + + docopt(doc) +} + +if (is.null(sys.calls())) { + load_packages() + opts <- parse_arguments() + outdated(opts$l, opts$x) +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/examples/apps/search.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/examples/apps/search.R new file mode 100755 index 00000000..51e6501a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/examples/apps/search.R @@ -0,0 +1,85 @@ +#! /usr/bin/env Rscript + +setup_app <- function() { + theme <- list( + "url" = list(color = "blue"), + ".pkg" = list(color = "orange")) + start_app(theme = theme, output = "stdout") +} + +load_packages <- function() { + tryCatch({ + library(cliapp) + library(pkgsearch) + library(docopt) + library(prettyunits) + error = function(e) { + cli_alert_danger( + "The {.pkg pkgsearch}, {.pkg prettyunits} and {.pkg docopt} packages are needed!") + q(save = "no", status = 1) + } + }) +} + +search <- function(terms, from = 1, size = 5) { + load_packages() + setup_app() + term <- paste(encodeString(quote = '"', terms), collapse = " ") + result <- do_query(term, from = from, size = size) + format_result(result, from = from, size = size) + invisible() +} + +`%||%` <- function(l, r) if (is.null(l)) r else l + +do_query <- function(query, from, size) { + cli_alert_info("Searching...") + pkg_search(query, from = from, size = size) +} + +format_result <- function(obj, from, size) { + meta <- attr(obj, "metadata") + if (!meta$total) { + cli_alert_danger("No results :(") + return() + } + + cli_alert_success("Found {meta$total} packages in {pretty_ms(meta$took)}") + cli_text() + cli_div(theme = list(ul = list("list-style-type" = ""))) + cli_ol() + + lapply(seq_len(nrow(obj)), function(i) format_hit(obj[i,])) +} + +format_hit <- function(hit) { + ago <- vague_dt(Sys.time() - hit$date) + cli_li() + cli_text("{.pkg {hit$package}} {hit$version} -- + {.emph {hit$title}}") + cli_par() + cli_text(hit$description) + cli_text("{.emph {ago} by {hit$maintainer_name}}") +} + +parse_arguments <- function() { + "Usage: + cransearch.R [-h | --help] [ -f from ] [ -n size ] ... + +Options: + -h --help Print this help message + -f first First hit to include + -n size Number of hits to include + +Seach for CRAN packages on r-pkg.org + " -> doc + docopt(doc) +} + +if (is.null(sys.calls())) { + load_packages() + opts <- parse_arguments() + search(opts$term, + from = as.numeric(opts$f %||% 1), + size = as.numeric(opts$n %||% 5)) +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/examples/apps/up.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/examples/apps/up.R new file mode 100755 index 00000000..b87ac498 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/examples/apps/up.R @@ -0,0 +1,65 @@ +#! /usr/bin/env Rscript + +## To get the async package: +## source("https://install-github.me/r-lib/async") + +setup_app <- function() { + theme <- list("url" = list(color = "blue")) + app <- cliapp::start_app(theme = theme, output = "stdout") +} + +load_packages <- function() { + tryCatch({ + library(cliapp) + library(async) + library(docopt) }, + error = function(e) { + cli_alert_danger("The {.pkg async} and {.pkg docopt} packages are needed!") + q(save = "no", status = 1) + }) +} + +up <- function(urls, timeout = 5) { + load_packages() + setup_app() + chk_url <- async(function(url, ...) { + http_head(url, ...)$ + then(function(res) { + if (res$status_code < 300) { + cli_alert_success("{.url {url}} ({res$times[['total']]}s)") + } else { + cli_alert_danger("{.url {url}} (HTTP {res$status_code})") + } + })$ + catch(error = function(err) { + e <- if (grepl("timed out", err$message)) "timed out" else "error" + cli_alert_danger("{.url {url}} ({e})") + }) + }) + + invisible(synchronise( + async_map(urls, chk_url, options = list(timeout = timeout)) + )) +} + +parse_arguments <- function() { + + "Usage: + up.R [-t timeout] [URLS ...] + up.R -h | --help + +Options: + -t timeout Timeout for giving up on a site, in seconds [default: 5]. + -h --help Print this help message + +Check if web sites are up. +" -> doc + + docopt(doc) +} + +if (is.null(sys.calls())) { + load_packages() + opts <- parse_arguments() + up(opts$URLS, timeout = as.numeric(opts$t)) +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/exec/news.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/exec/news.R new file mode 100755 index 00000000..99c15573 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/exec/news.R @@ -0,0 +1,122 @@ +#! /usr/bin/env Rscript + +setup_app <- function() { + theme <- list( + "url" = list(color = "blue"), + ".pkg" = list(color = "orange"), + "it" = list("margin-bottom" = 1)) + start_app(theme = theme, output = "stdout") +} + +load_packages <- function() { + tryCatch({ + library(cli) + library(httr) + library(jsonlite) + library(prettyunits) + library(glue) + library(parsedate) + library(docopt) }, + error = function(e) { + cli_alert_danger( + "The {.pkg glue}, {.pkg httr}, {.pkg jsonlite}, {.pkg prettyunits},", + " {.pkg parsedate} and {.pkg docopt} packages are needed!") + q(save = "no", status = 1) + }) +} + +news <- function(n = 10, day = FALSE, week = FALSE, since = NULL, + reverse = FALSE) { + + load_packages() + setup_app() + + result <- if (day) + news_day() + else if (week) + news_week() + else if (!is.null(since)) + news_since(since) + else + news_n(as.numeric(n)) + + if (reverse) result <- rev(result) + + format_results(result) + invisible() +} + +news_day <- function() { + date <- format_iso_8601(Sys.time() - as.difftime(1, units="days")) + ep <- glue("/-/pkgreleases?descending=true&endkey=%22{date}%22") + do_query(ep) +} + +news_week <- function() { + date <- format_iso_8601(Sys.time() - as.difftime(7, units="days")) + ep <- glue("/-/pkgreleases?descending=true&endkey=%22{date}%22") + do_query(ep) +} + +news_since <- function(since) { + date <- format_iso_8601(parse_date(since)) + ep <- glue("/-/pkgreleases?descending=true&endkey=%22{date}%22") + do_query(ep) +} + +news_n <- function(n) { + ep <- glue("/-/pkgreleases?limit={n}&descending=true") + do_query(ep) +} + +do_query <- function(ep) { + base <- "https://crandb.r-pkg.org" + url <- glue("{base}{ep}") + response <- GET(url) + stop_for_status(response) + fromJSON(content(response, as = "text"), simplifyVector = FALSE) +} + +format_results <- function(results) { + cli_div(theme = list(ul = list("list-style-type" = ""))) + cli_ol() + lapply(results, format_result) +} + +parse_arguments <- function() { + + "Usage: + news.R [-r | --reverse] [-n num ] + news.R [-r | --reverse] --day | --week | --since date + news.R [-h | --help] + +Options: + -n num Show the last 'n' releases [default: 10]. + --day Show releases in the last 24 hours + --week Show relaases in the last 7 * 24 hours + --since date Show releases since 'date' + -r --reverse Reverse the order, show older on top + -h --help Print this help message + +New package releases on CRAN +" -> doc + + docopt(doc) +} + +format_result <- function(result) { + pkg <- result$package + ago <- vague_dt(Sys.time() - parse_iso_8601(result$date)) + url <- paste0("https://r-pkg.org/pkg/", pkg$Package) + cli_li() + cli_text("{.pkg {pkg$Package}} {pkg$Version} -- + {ago} by {.emph {pkg$Maintainer}}") + cli_text("{pkg$Title}") + cli_text("{.url {url}}") +} + +if (is.null(sys.calls())) { + load_packages() + opts <- parse_arguments() + news(opts$n, opts$day, opts$week, opts$since, opts$reverse) +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/exec/outdated.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/exec/outdated.R new file mode 100755 index 00000000..38872677 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/exec/outdated.R @@ -0,0 +1,78 @@ +#! /usr/bin/env Rscript + +## To get the pkgcache package: +## source("https://install-github.me/r-lib/pkgcache") + +setup_app <- function() { + theme <- list( + "url" = list(color = "blue"), + ".pkg" = list(color = "orange")) + start_app(theme = theme, output = "stdout") +} + +load_packages <- function() { + tryCatch(suppressPackageStartupMessages({ + library(cli) + library(pkgcache) + library(docopt) }), + error = function(e) { + cli_alert_danger("The {.pkg pkgcache} and {.pkg docopt} packages are needed!") + q(save = "no", status = 1) + }) +} + +outdated <- function(lib = NULL, notcran = FALSE) { + load_packages() + setup_app() + if (is.null(lib)) lib <- .libPaths()[1] + inst <- utils::installed.packages(lib = lib) + cli_alert_info("Getting repository metadata") + repo <- meta_cache_list(rownames(inst)) + + if (!notcran) inst <- inst[inst[, "Package"] %in% repo$package, ] + + for (i in seq_len(nrow(inst))) { + pkg <- inst[i, "Package"] + iver <- inst[i, "Version"] + + if (! pkg %in% repo$package) { + cli_alert_info("{.pkg {pkg}}: \tnot a CRAN/BioC package") + next + } + + rpkg <- repo[repo$package == pkg, ] + newer <- rpkg[package_version(rpkg$version) > iver, ] + if (!nrow(newer)) next + + nver <- package_version(newer$version) + mnver <- max(nver) + newest <- newer[mnver == nver, ] + bin <- if (any(newest$platform != "source")) "bin" else "" + src <- if (any(newest$platform == "source")) "src" else "" + + cli_alert_danger( + "{.pkg {pkg}} \t{iver} {symbol$arrow_right} {mnver} {emph ({bin} {src})}") + } +} + +parse_arguments <- function() { + "Usage: + outdated.R [-l lib] [-x] + outdated.R -h | --help + +Options: + -x Print not CRAN/BioC packages as well + -l lib Library directory, default is first directory in the lib path + -h --help Print this help message + +Check for outdated packages in a package library. + " -> doc + + docopt(doc) +} + +if (is.null(sys.calls())) { + load_packages() + opts <- parse_arguments() + outdated(opts$l, opts$x) +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/exec/search.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/exec/search.R new file mode 100755 index 00000000..f635b938 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/exec/search.R @@ -0,0 +1,85 @@ +#! /usr/bin/env Rscript + +setup_app <- function() { + theme <- list( + "url" = list(color = "blue"), + ".pkg" = list(color = "orange")) + start_app(theme = theme, output = "stdout") +} + +load_packages <- function() { + tryCatch({ + library(cli) + library(pkgsearch) + library(docopt) + library(prettyunits) + error = function(e) { + cli_alert_danger( + "The {.pkg pkgsearch}, {.pkg prettyunits} and {.pkg docopt} packages are needed!") + q(save = "no", status = 1) + } + }) +} + +search <- function(terms, from = 1, size = 5) { + load_packages() + setup_app() + term <- paste(encodeString(quote = '"', terms), collapse = " ") + result <- do_query(term, from = from, size = size) + format_result(result, from = from, size = size) + invisible() +} + +`%||%` <- function(l, r) if (is.null(l)) r else l + +do_query <- function(query, from, size) { + cli_alert_info("Searching...") + pkg_search(query, from = from, size = size) +} + +format_result <- function(obj, from, size) { + meta <- attr(obj, "metadata") + if (!meta$total) { + cli_alert_danger("No results :(") + return() + } + + cli_alert_success("Found {meta$total} packages in {pretty_ms(meta$took)}") + cli_text() + cli_div(theme = list(ul = list("list-style-type" = ""))) + cli_ol() + + lapply(seq_len(nrow(obj)), function(i) format_hit(obj[i,])) +} + +format_hit <- function(hit) { + ago <- vague_dt(Sys.time() - hit$date) + cli_li() + cli_text("{.pkg {hit$package}} {hit$version} -- + {.emph {hit$title}}") + cli_par() + cli_text(hit$description) + cli_text("{.emph {ago} by {hit$maintainer_name}}") +} + +parse_arguments <- function() { + "Usage: + cransearch.R [-h | --help] [ -f from ] [ -n size ] ... + +Options: + -h --help Print this help message + -f first First hit to include + -n size Number of hits to include + +Seach for CRAN packages on r-pkg.org + " -> doc + docopt(doc) +} + +if (is.null(sys.calls())) { + load_packages() + opts <- parse_arguments() + search(opts$term, + from = as.numeric(opts$f %||% 1), + size = as.numeric(opts$n %||% 5)) +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/exec/up.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/exec/up.R new file mode 100755 index 00000000..4a532154 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/exec/up.R @@ -0,0 +1,65 @@ +#! /usr/bin/env Rscript + +## To get the async package: +## source("https://install-github.me/r-lib/async") + +setup_app <- function() { + theme <- list("url" = list(color = "blue")) + app <- cli::start_app(theme = theme, output = "stdout") +} + +load_packages <- function() { + tryCatch({ + library(cli) + library(async) + library(docopt) }, + error = function(e) { + cli_alert_danger("The {.pkg async} and {.pkg docopt} packages are needed!") + q(save = "no", status = 1) + }) +} + +up <- function(urls, timeout = 5) { + load_packages() + setup_app() + chk_url <- async(function(url, ...) { + http_head(url, ...)$ + then(function(res) { + if (res$status_code < 300) { + cli_alert_success("{.url {url}} ({res$times[['total']]}s)") + } else { + cli_alert_danger("{.url {url}} (HTTP {res$status_code})") + } + })$ + catch(error = function(err) { + e <- if (grepl("timed out", err$message)) "timed out" else "error" + cli_alert_danger("{.url {url}} ({e})") + }) + }) + + invisible(synchronise( + async_map(urls, chk_url, options = list(timeout = timeout)) + )) +} + +parse_arguments <- function() { + + "Usage: + up.R [-t timeout] [URLS ...] + up.R -h | --help + +Options: + -t timeout Timeout for giving up on a site, in seconds [default: 5]. + -h --help Print this help message + +Check if web sites are up. +" -> doc + + docopt(doc) +} + +if (is.null(sys.calls())) { + load_packages() + opts <- parse_arguments() + up(opts$URLS, timeout = as.numeric(opts$t)) +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/AnIndex new file mode 100644 index 00000000..3d6493e2 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/AnIndex @@ -0,0 +1,274 @@ +cli-package cli-package +ansi-styles ansi-styles +ansi_align ansi_align +ansi_chartr ansi_toupper +ansi_collapse ansi_collapse +ansi_columns ansi_columns +ansi_grep ansi_grep +ansi_grepl ansi_grep +ansi_has_any ansi_has_any +ansi_has_hyperlink_support style_hyperlink +ansi_hide_cursor ansi_hide_cursor +ansi_html ansi_html +ansi_html_style ansi_html_style +ansi_hyperlink_types style_hyperlink +ansi_nchar ansi_nchar +ansi_nzchar ansi_nzchar +ansi_palettes ansi_palettes +ansi_palette_show ansi_palettes +ansi_regex ansi_regex +ansi_show_cursor ansi_hide_cursor +ansi_simplify ansi_simplify +ansi_string ansi_string +ansi_strip ansi_strip +ansi_strsplit ansi_strsplit +ansi_strtrim ansi_strtrim +ansi_strwrap ansi_strwrap +ansi_substr ansi_substr +ansi_substring ansi_substring +ansi_tolower ansi_toupper +ansi_toupper ansi_toupper +ansi_trimws ansi_trimws +ansi_with_hidden_cursor ansi_hide_cursor +bg_black ansi-styles +bg_blue ansi-styles +bg_br_black ansi-styles +bg_br_blue ansi-styles +bg_br_cyan ansi-styles +bg_br_green ansi-styles +bg_br_magenta ansi-styles +bg_br_red ansi-styles +bg_br_white ansi-styles +bg_br_yellow ansi-styles +bg_cyan ansi-styles +bg_green ansi-styles +bg_magenta ansi-styles +bg_none ansi-styles +bg_red ansi-styles +bg_white ansi-styles +bg_yellow ansi-styles +boxx boxx +builtin_theme builtin_theme +cat_boxx cat_line +cat_bullet cat_line +cat_line cat_line +cat_print cat_line +cat_rule cat_line +ccli_tick_reset cli_progress_bar +cli cli +cli-config cli-config +cli_abort cli_abort +cli_alert cli_alert +cli_alert_danger cli_alert +cli_alert_info cli_alert +cli_alert_success cli_alert +cli_alert_warning cli_alert +cli_blockquote cli_blockquote +cli_bullets cli_bullets +cli_bullets_raw cli_bullets_raw +cli_code cli_code +cli_debug_doc cli_debug_doc +cli_div cli_div +cli_dl cli_dl +cli_end cli_end +cli_fmt cli_fmt +cli_format cli_format +cli_format.character cli_format +cli_format.default cli_format +cli_format.numeric cli_format +cli_format_method cli_format_method +cli_h1 cli_h1 +cli_h2 cli_h1 +cli_h3 cli_h1 +cli_inform cli_abort +cli_li cli_li +cli_list_themes cli_list_themes +cli_ol cli_ol +cli_output_connection cli_output_connection +cli_par cli_par +cli_process_done cli_process_start +cli_process_failed cli_process_start +cli_process_start cli_process_start +cli_progress_along cli_progress_along +cli_progress_bar cli_progress_bar +cli_progress_builtin_handlers cli_progress_builtin_handlers +cli_progress_cleanup progress-utils +cli_progress_demo cli_progress_demo +cli_progress_done cli_progress_bar +cli_progress_message cli_progress_message +cli_progress_num progress-utils +cli_progress_output cli_progress_output +cli_progress_step cli_progress_step +cli_progress_styles cli_progress_styles +cli_progress_update cli_progress_bar +cli_rule cli_rule +cli_sitrep cli_sitrep +cli_status cli_status +cli_status_clear cli_status_clear +cli_status_update cli_status_update +cli_text cli_text +cli_tick_reset cli_progress_bar +cli_ul cli_ul +cli_vec cli_vec +cli_verbatim cli_verbatim +cli_warn cli_abort +cli__pb_bar progress-variables +cli__pb_current progress-variables +cli__pb_current_bytes progress-variables +cli__pb_elapsed progress-variables +cli__pb_elapsed_clock progress-variables +cli__pb_elapsed_raw progress-variables +cli__pb_eta progress-variables +cli__pb_eta_raw progress-variables +cli__pb_eta_str progress-variables +cli__pb_extra progress-variables +cli__pb_id progress-variables +cli__pb_name progress-variables +cli__pb_percent progress-variables +cli__pb_pid progress-variables +cli__pb_rate progress-variables +cli__pb_rate_bytes progress-variables +cli__pb_rate_raw progress-variables +cli__pb_spin progress-variables +cli__pb_status progress-variables +cli__pb_timestamp progress-variables +cli__pb_total progress-variables +cli__pb_total_bytes progress-variables +code_highlight code_highlight +code_theme_list code_theme_list +col_black ansi-styles +col_blue ansi-styles +col_br_black ansi-styles +col_br_blue ansi-styles +col_br_cyan ansi-styles +col_br_green ansi-styles +col_br_magenta ansi-styles +col_br_red ansi-styles +col_br_white ansi-styles +col_br_yellow ansi-styles +col_cyan ansi-styles +col_green ansi-styles +col_grey ansi-styles +col_magenta ansi-styles +col_none ansi-styles +col_red ansi-styles +col_silver ansi-styles +col_white ansi-styles +col_yellow ansi-styles +combine_ansi_styles combine_ansi_styles +console_width console_width +containers containers +default_app start_app +demo_spinners demo_spinners +detect_tty_colors num_ansi_colors +diff_chr diff_chr +diff_str diff_str +faq faq +format_bullets_raw cli_bullets_raw +format_error format_error +format_inline format_inline +format_message format_error +format_warning format_error +get_spinner get_spinner +hash_animal hash_animal +hash_emoji hash_emoji +hash_file_md5 hash_md5 +hash_file_sha1 hash_sha1 +hash_file_sha256 hash_sha256 +hash_md5 hash_md5 +hash_obj_animal hash_animal +hash_obj_emoji hash_emoji +hash_obj_md5 hash_md5 +hash_obj_sha1 hash_sha1 +hash_obj_sha256 hash_sha256 +hash_raw_animal hash_animal +hash_raw_emoji hash_emoji +hash_raw_md5 hash_md5 +hash_raw_sha1 hash_sha1 +hash_raw_sha256 hash_sha256 +hash_sha1 hash_sha1 +hash_sha256 hash_sha256 +has_keypress_support has_keypress_support +inline-markup inline-markup +is_ansi_tty is_ansi_tty +is_dynamic_tty is_dynamic_tty +is_utf8_output is_utf8_output +keypress keypress +links links +list_border_styles boxx +list_spinners list_spinners +list_symbols symbol +make_ansi_style make_ansi_style +make_spinner make_spinner +match_selector match_selector +match_selector_node match_selector_node +no pluralization-helpers +num_ansi_colors num_ansi_colors +parse_selector parse_selector +pb_bar progress-variables +pb_current progress-variables +pb_current_bytes progress-variables +pb_elapsed progress-variables +pb_elapsed_clock progress-variables +pb_elapsed_raw progress-variables +pb_eta progress-variables +pb_eta_raw progress-variables +pb_eta_str progress-variables +pb_extra progress-variables +pb_id progress-variables +pb_name progress-variables +pb_percent progress-variables +pb_pid progress-variables +pb_rate progress-variables +pb_rate_bytes progress-variables +pb_rate_raw progress-variables +pb_spin progress-variables +pb_status progress-variables +pb_timestamp progress-variables +pb_total progress-variables +pb_total_bytes progress-variables +pluralization pluralization +pluralize pluralize +pretty_print_code pretty_print_code +progress-c progress-c +progress-variables progress-variables +qty pluralization-helpers +rule rule +ruler ruler +simple_theme simple_theme +spark_bar spark_bar +spark_line spark_line +start_app start_app +stop_app start_app +style_blurred ansi-styles +style_bold ansi-styles +style_dim ansi-styles +style_hidden ansi-styles +style_hyperlink style_hyperlink +style_inverse ansi-styles +style_italic ansi-styles +style_no_bg_color ansi-styles +style_no_blurred ansi-styles +style_no_bold ansi-styles +style_no_color ansi-styles +style_no_dim ansi-styles +style_no_hidden ansi-styles +style_no_inverse ansi-styles +style_no_italic ansi-styles +style_no_strikethrough ansi-styles +style_no_underline ansi-styles +style_reset ansi-styles +style_strikethrough ansi-styles +style_underline ansi-styles +symbol symbol +test_that_cli test_that_cli +themes themes +ticking cli_progress_bar +tree tree +truecolor ansi_palettes +unicode-width-workaround unicode-width-workaround +utf8_graphemes utf8_graphemes +utf8_nchar utf8_nchar +utf8_substr utf8_substr +vt_output vt_output +__cli_update_due cli_progress_bar diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/aliases.rds new file mode 100644 index 00000000..7c54c8de Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/cli.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/cli.rdb new file mode 100644 index 00000000..33e48cac Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/cli.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/cli.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/cli.rdx new file mode 100644 index 00000000..2e6a1cd6 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/cli.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/demo-spinners.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/demo-spinners.svg new file mode 100644 index 00000000..cb2dffd8 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/demo-spinners.svg @@ -0,0 +1 @@ +🕛🕛clock🕐clock🕑clock🕒clock🕓clock🕔clock🕕clock🕖clock🕗clock🕘clock🕙clock🕚clock \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/get-spinner.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/get-spinner.svg new file mode 100644 index 00000000..7c1ecccc --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/get-spinner.svg @@ -0,0 +1 @@ +❤️Spinning100done(21/s)|4.8s💙Spinning1done(22/s)|46ms💜Spinning2done(21/s)|94ms💚Spinning7done(22/s)|324ms❤️Spinning11done(21/s)|521ms💛Spinning15done(21/s)|721ms💙Spinning19done(21/s)|920ms💜Spinning24done(21/s)|1.2s💚Spinning28done(21/s)|1.3s❤️Spinning32done(21/s)|1.5s💛Spinning36done(21/s)|1.7s💙Spinning41done(21/s)|2s💜Spinning45done(21/s)|2.2s💚Spinning49done(21/s)|2.3s❤️Spinning54done(21/s)|2.6s💛Spinning58done(21/s)|2.8s💙Spinning62done(21/s)|3s💜Spinning67done(21/s)|3.2s💚Spinning71done(21/s)|3.4s❤️Spinning75done(21/s)|3.6s💛Spinning79done(21/s)|3.8s💙Spinning84done(21/s)|4s💜Spinning88done(21/s)|4.2s💚Spinning92done(21/s)|4.4s❤️Spinning96done(21/s)|4.6s \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/make-spinner-custom.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/make-spinner-custom.svg new file mode 100644 index 00000000..bb5cc839 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/make-spinner-custom.svg @@ -0,0 +1 @@ +Downloading.Downloading..Downloading...Downloading..Downloading.Downloading \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/make-spinner-default.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/make-spinner-default.svg new file mode 100644 index 00000000..1dbc62bb --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/make-spinner-default.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/make-spinner-template.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/make-spinner-template.svg new file mode 100644 index 00000000..3ec97ebc --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/make-spinner-template.svg @@ -0,0 +1 @@ +ComputingComputingComputingComputingComputingComputingComputingComputingComputingComputing \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-1.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-1.svg new file mode 100644 index 00000000..84ee4c06 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-1.svg @@ -0,0 +1 @@ +Cleaningdata███████████████████████████████100%|ETA:0sCleaningdata███████████████████████████████3%|ETA:5sCleaningdata███████████████████████████████7%|ETA:5sCleaningdata███████████████████████████████10%|ETA:5sCleaningdata███████████████████████████████14%|ETA:5sCleaningdata███████████████████████████████17%|ETA:5sCleaningdata███████████████████████████████20%|ETA:5sCleaningdata███████████████████████████████24%|ETA:4sCleaningdata███████████████████████████████27%|ETA:4sCleaningdata███████████████████████████████31%|ETA:4sCleaningdata███████████████████████████████34%|ETA:4sCleaningdata███████████████████████████████38%|ETA:4sCleaningdata███████████████████████████████41%|ETA:3sCleaningdata███████████████████████████████45%|ETA:3sCleaningdata███████████████████████████████48%|ETA:3sCleaningdata███████████████████████████████51%|ETA:3sCleaningdata███████████████████████████████55%|ETA:3sCleaningdata███████████████████████████████58%|ETA:2sCleaningdata███████████████████████████████62%|ETA:2sCleaningdata███████████████████████████████65%|ETA:2sCleaningdata███████████████████████████████69%|ETA:2sCleaningdata███████████████████████████████72%|ETA:2sCleaningdata███████████████████████████████76%|ETA:1sCleaningdata███████████████████████████████79%|ETA:1sCleaningdata███████████████████████████████83%|ETA:1sCleaningdata███████████████████████████████87%|ETA:1sCleaningdata███████████████████████████████90%|ETA:1sCleaningdata███████████████████████████████94%|ETA:0sCleaningdata██████████████████████████████97%|ETA:0s \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-after.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-after.svg new file mode 100644 index 00000000..c60cffda --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-after.svg @@ -0,0 +1 @@ +Startingnow,at2022-09-0711:26:44███████████████████████████████100%@2022-09-0711:26:49███████████████████████████████47%@2022-09-0711:26:46███████████████████████████████49%@2022-09-0711:26:46███████████████████████████████53%@2022-09-0711:26:46███████████████████████████████58%@2022-09-0711:26:47███████████████████████████████62%@2022-09-0711:26:47███████████████████████████████67%@2022-09-0711:26:47███████████████████████████████71%@2022-09-0711:26:47███████████████████████████████75%@2022-09-0711:26:48███████████████████████████████80%@2022-09-0711:26:48███████████████████████████████84%@2022-09-0711:26:48███████████████████████████████88%@2022-09-0711:26:48███████████████████████████████92%@2022-09-0711:26:48██████████████████████████████97%@2022-09-0711:26:49 \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-along-1.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-along-1.svg new file mode 100644 index 00000000..24d0fbea --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-along-1.svg @@ -0,0 +1 @@ +Downloading■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■100%|ETA:0sDownloading0%|ETA:?Downloading■■■6%|ETA:4sDownloading■■■■11%|ETA:4sDownloading■■■■■15%|ETA:4sDownloading■■■■■■■19%|ETA:4sDownloading■■■■■■■■24%|ETA:4sDownloading■■■■■■■■■28%|ETA:3sDownloading■■■■■■■■■■■32%|ETA:3sDownloading■■■■■■■■■■■■37%|ETA:3sDownloading■■■■■■■■■■■■■■42%|ETA:3sDownloading■■■■■■■■■■■■■■■46%|ETA:2sDownloading■■■■■■■■■■■■■■■■50%|ETA:2sDownloading■■■■■■■■■■■■■■■■■55%|ETA:2sDownloading■■■■■■■■■■■■■■■■■■■59%|ETA:2sDownloading■■■■■■■■■■■■■■■■■■■■64%|ETA:2sDownloading■■■■■■■■■■■■■■■■■■■■■68%|ETA:1sDownloading■■■■■■■■■■■■■■■■■■■■■■■72%|ETA:1sDownloading■■■■■■■■■■■■■■■■■■■■■■■■77%|ETA:1sDownloading■■■■■■■■■■■■■■■■■■■■■■■■■81%|ETA:1sDownloading■■■■■■■■■■■■■■■■■■■■■■■■■■■85%|ETA:1sDownloading■■■■■■■■■■■■■■■■■■■■■■■■■■■■90%|ETA:0sDownloading■■■■■■■■■■■■■■■■■■■■■■■■■■■■■94%|ETA:0sDownloading■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■98%|ETA:0s \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-along-2.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-along-2.svg new file mode 100644 index 00000000..89ee14ea --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-along-2.svg @@ -0,0 +1 @@ +Downloading■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■100%|ETA:0sDownloading0%|ETA:?Downloading■■■6%|ETA:4sDownloading■■■■10%|ETA:4sDownloading■■■■■15%|ETA:4sDownloading■■■■■■■19%|ETA:4sDownloading■■■■■■■■23%|ETA:4sDownloading■■■■■■■■■28%|ETA:3sDownloading■■■■■■■■■■■32%|ETA:3sDownloading■■■■■■■■■■■■36%|ETA:3sDownloading■■■■■■■■■■■■■41%|ETA:3sDownloading■■■■■■■■■■■■■■■45%|ETA:3sDownloading■■■■■■■■■■■■■■■■49%|ETA:2sDownloading■■■■■■■■■■■■■■■■■54%|ETA:2sDownloading■■■■■■■■■■■■■■■■■■58%|ETA:2sDownloading■■■■■■■■■■■■■■■■■■■■62%|ETA:2sDownloading■■■■■■■■■■■■■■■■■■■■■67%|ETA:2sDownloading■■■■■■■■■■■■■■■■■■■■■■71%|ETA:1sDownloading■■■■■■■■■■■■■■■■■■■■■■■■76%|ETA:1sDownloading■■■■■■■■■■■■■■■■■■■■■■■■■80%|ETA:1sDownloading■■■■■■■■■■■■■■■■■■■■■■■■■■84%|ETA:1sDownloading■■■■■■■■■■■■■■■■■■■■■■■■■■■■89%|ETA:1sDownloading■■■■■■■■■■■■■■■■■■■■■■■■■■■■■93%|ETA:0sDownloading■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■97%|ETA:0s \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-along-3.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-along-3.svg new file mode 100644 index 00000000..f8586dfd --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-along-3.svg @@ -0,0 +1 @@ +Downloadingdatafile100Downloadingdatafile0Downloadingdatafile7Downloadingdatafile11Downloadingdatafile16Downloadingdatafile21Downloadingdatafile25Downloadingdatafile30Downloadingdatafile35Downloadingdatafile39Downloadingdatafile44Downloadingdatafile48Downloadingdatafile53Downloadingdatafile57Downloadingdatafile62Downloadingdatafile66Downloadingdatafile71Downloadingdatafile76Downloadingdatafile81Downloadingdatafile85Downloadingdatafile90Downloadingdatafile95Downloadingdatafile99 \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-clear.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-clear.svg new file mode 100644 index 00000000..c3b4ac31 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-clear.svg @@ -0,0 +1 @@ +Parametertuning███████████████████████████████100%|ETA:0sDatacleaning██████████████████████████████1%|ETA:3sDatacleaning███████████████████████████████6%|ETA:3sDatacleaning███████████████████████████████11%|ETA:3sDatacleaning███████████████████████████████17%|ETA:3sDatacleaning███████████████████████████████22%|ETA:3sDatacleaning███████████████████████████████28%|ETA:3sDatacleaning███████████████████████████████33%|ETA:2sDatacleaning███████████████████████████████38%|ETA:2sDatacleaning███████████████████████████████44%|ETA:2sDatacleaning███████████████████████████████49%|ETA:2sDatacleaning███████████████████████████████55%|ETA:2sDatacleaning███████████████████████████████60%|ETA:1sDatacleaning███████████████████████████████66%|ETA:1sDatacleaning███████████████████████████████71%|ETA:1sDatacleaning███████████████████████████████77%|ETA:1sDatacleaning███████████████████████████████82%|ETA:1sDatacleaning███████████████████████████████88%|ETA:0sDatacleaning███████████████████████████████94%|ETA:0sDatacleaning███████████████████████████████99%|ETA:0sParametertuning███████████████████████████████4%|ETA:3sParametertuning███████████████████████████████10%|ETA:3sParametertuning███████████████████████████████15%|ETA:3sParametertuning███████████████████████████████21%|ETA:3sParametertuning███████████████████████████████26%|ETA:3sParametertuning███████████████████████████████32%|ETA:2sParametertuning███████████████████████████████38%|ETA:2sParametertuning███████████████████████████████43%|ETA:2sParametertuning███████████████████████████████48%|ETA:2sParametertuning███████████████████████████████54%|ETA:2sParametertuning███████████████████████████████59%|ETA:1sParametertuning███████████████████████████████65%|ETA:1sParametertuning███████████████████████████████70%|ETA:1sParametertuning███████████████████████████████76%|ETA:1sParametertuning███████████████████████████████81%|ETA:1sParametertuning███████████████████████████████87%|ETA:0sParametertuning███████████████████████████████93%|ETA:0sParametertuning██████████████████████████████98%|ETA:0s \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-current.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-current.svg new file mode 100644 index 00000000..612af564 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-current.svg @@ -0,0 +1 @@ +Firststep███████████████████████████████100%|ETA:0sSecondstep███████████████████████████████100%|ETA:0sFirststep██████████████████████████████1%|ETA:3sFirststep███████████████████████████████2%|ETA:3sFirststep███████████████████████████████11%|ETA:2sFirststep███████████████████████████████18%|ETA:2sFirststep███████████████████████████████26%|ETA:2sFirststep███████████████████████████████33%|ETA:2sFirststep███████████████████████████████40%|ETA:2sFirststep███████████████████████████████48%|ETA:1sFirststep███████████████████████████████55%|ETA:1sFirststep███████████████████████████████63%|ETA:1sFirststep███████████████████████████████70%|ETA:1sFirststep███████████████████████████████78%|ETA:1sFirststep███████████████████████████████85%|ETA:0sFirststep███████████████████████████████93%|ETA:0sSecondstep███████████████████████████████7%|ETA:2sSecondstep███████████████████████████████15%|ETA:2sSecondstep███████████████████████████████22%|ETA:2sSecondstep███████████████████████████████30%|ETA:2sSecondstep███████████████████████████████37%|ETA:2sSecondstep███████████████████████████████45%|ETA:1sSecondstep███████████████████████████████53%|ETA:1sSecondstep███████████████████████████████60%|ETA:1sSecondstep███████████████████████████████67%|ETA:1sSecondstep███████████████████████████████74%|ETA:1sSecondstep███████████████████████████████82%|ETA:0sSecondstep███████████████████████████████89%|ETA:0sSecondstep██████████████████████████████97%|ETA:0s \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-format.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-format.svg new file mode 100644 index 00000000..963e71af --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-format.svg @@ -0,0 +1 @@ +Downloaded10filesin4.7s.Downloadingdata-1.zip[1/10]ETA:0sDownloadingdata-2.zip[2/10]ETA:2sDownloadingdata-3.zip[3/10]ETA:2sDownloadingdata-4.zip[4/10]ETA:2sDownloadingdata-5.zip[5/10]ETA:2sDownloadingdata-6.zip[6/10]ETA:2sDownloadingdata-7.zip[7/10]ETA:1sDownloadingdata-8.zip[8/10]ETA:1sDownloadingdata-9.zip[9/10]ETA:0s \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-message.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-message.svg new file mode 100644 index 00000000..2b046f21 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-message.svg @@ -0,0 +1 @@ +Taskthreeisunderway:step1Taskoneisrunning...Tasktwoisrunning...Taskthreeisunderway:step2Taskthreeisunderway:step3Taskthreeisunderway:step4Taskthreeisunderway:step5 \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-natotal.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-natotal.svg new file mode 100644 index 00000000..5d3f9d63 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-natotal.svg @@ -0,0 +1 @@ +Parametertuning100done(27/s)|3.7sParametertuning1done(28/s)|36msParametertuning4done(28/s)|146msParametertuning9done(27/s)|328msParametertuning15done(28/s)|535msParametertuning21done(28/s)|752msParametertuning27done(28/s)|968msParametertuning32done(28/s)|1.2sParametertuning38done(28/s)|1.4sParametertuning43done(28/s)|1.6sParametertuning49done(28/s)|1.8sParametertuning55done(28/s)|2sParametertuning60done(28/s)|2.2sParametertuning66done(28/s)|2.4sParametertuning72done(28/s)|2.6sParametertuning77done(28/s)|2.8sParametertuning82done(28/s)|3sParametertuning88done(28/s)|3.2sParametertuning93done(27/s)|3.4sParametertuning99done(27/s)|3.6s \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-output.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-output.svg new file mode 100644 index 00000000..d29cb891 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-output.svg @@ -0,0 +1 @@ +BeforetheprogressbarCalculating███████████████████████████████48%|ETA:2sAlreadyhalfway!Calculating███████████████████████████████100%|ETA:0sAlldoneCalculating██████████████████████████████1%|ETA:5sCalculating███████████████████████████████2%|ETA:5sCalculating███████████████████████████████6%|ETA:4sCalculating███████████████████████████████10%|ETA:4sCalculating███████████████████████████████15%|ETA:4sCalculating███████████████████████████████19%|ETA:4sCalculating███████████████████████████████23%|ETA:4sCalculating███████████████████████████████28%|ETA:3sCalculating███████████████████████████████32%|ETA:3sCalculating███████████████████████████████36%|ETA:3sCalculating███████████████████████████████40%|ETA:3sCalculating███████████████████████████████45%|ETA:3sCalculating███████████████████████████████53%|ETA:2sCalculating███████████████████████████████57%|ETA:2sCalculating███████████████████████████████61%|ETA:2sCalculating███████████████████████████████65%|ETA:2sCalculating███████████████████████████████70%|ETA:1sCalculating███████████████████████████████74%|ETA:1sCalculating███████████████████████████████78%|ETA:1sCalculating███████████████████████████████83%|ETA:1sCalculating███████████████████████████████87%|ETA:1sCalculating███████████████████████████████91%|ETA:0sCalculating███████████████████████████████95%|ETA:0s \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-output2.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-output2.svg new file mode 100644 index 00000000..a19eeb72 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-output2.svg @@ -0,0 +1 @@ +BeforetheprogressbarCalculating███████████████████████████████50%|ETA:2sAlreadyhalfway!Calculating███████████████████████████████100%|ETA:0sAlldoneCalculating██████████████████████████████1%|ETA:5sCalculating███████████████████████████████2%|ETA:5sCalculating███████████████████████████████6%|ETA:4sCalculating███████████████████████████████11%|ETA:4sCalculating███████████████████████████████15%|ETA:4sCalculating███████████████████████████████19%|ETA:4sCalculating███████████████████████████████24%|ETA:4sCalculating███████████████████████████████28%|ETA:3sCalculating███████████████████████████████32%|ETA:3sCalculating███████████████████████████████37%|ETA:3sCalculating███████████████████████████████41%|ETA:3sCalculating███████████████████████████████46%|ETA:3sCalculating███████████████████████████████55%|ETA:2sCalculating███████████████████████████████59%|ETA:2sCalculating███████████████████████████████64%|ETA:2sCalculating███████████████████████████████68%|ETA:1sCalculating███████████████████████████████72%|ETA:1sCalculating███████████████████████████████76%|ETA:1sCalculating███████████████████████████████81%|ETA:1sCalculating███████████████████████████████85%|ETA:1sCalculating███████████████████████████████89%|ETA:1sCalculating███████████████████████████████93%|ETA:0sCalculating██████████████████████████████98%|ETA:0s \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-step-dynamic.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-step-dynamic.svg new file mode 100644 index 00000000..813f6ba7 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-step-dynamic.svg @@ -0,0 +1 @@ +Downloadingdata,gotfile100/100[2.6s]Importingdata[1s]Cleaningdata[2s]FittingmodelFittingmodelFittingmodelFittingmodelFittingmodelFittingmodelFittingmodelFittingmodelFittingmodel[3.5s]DownloadingdataDownloadingdata,gotfile7/100Downloadingdata,gotfile15/100Downloadingdata,gotfile22/100Downloadingdata,gotfile30/100Downloadingdata,gotfile38/100Downloadingdata,gotfile46/100Downloadingdata,gotfile54/100Downloadingdata,gotfile62/100Downloadingdata,gotfile69/100Downloadingdata,gotfile76/100Downloadingdata,gotfile84/100Downloadingdata,gotfile92/100Downloadingdata,gotfile100/100ImportingdataCleaningdataFittingmodelFittingmodel \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-step-msg.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-step-msg.svg new file mode 100644 index 00000000..66449e2f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-step-msg.svg @@ -0,0 +1 @@ +Downloadingdata.Downloadingdata.Downloadingdata.Downloadingdata.Downloadingdata.Downloadingdata.Downloadingdata.Downloadingdata.Downloaded819.20kB.[3.5s]Downloadingdata.Downloadingdata. \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-step-spin.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-step-spin.svg new file mode 100644 index 00000000..019e2b2c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-step-spin.svg @@ -0,0 +1 @@ +DownloadingdataDownloadingdataDownloadingdataDownloadingdata[2.5s]Importingdata[1s]Cleaningdata[2s]FittingmodelFittingmodelFittingmodelFittingmodelFittingmodelFittingmodelFittingmodelFittingmodelFittingmodel[3.4s]DownloadingdataDownloadingdataDownloadingdataDownloadingdataDownloadingdataDownloadingdataDownloadingdataImportingdataCleaningdataFittingmodelFittingmodel \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-step.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-step.svg new file mode 100644 index 00000000..77bcce08 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-step.svg @@ -0,0 +1 @@ +Downloadingdata[2s]Importingdata[1s]Cleaningdata[2s]Fittingmodel[3s]DownloadingdataImportingdataCleaningdataFittingmodel \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-tasks.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-tasks.svg new file mode 100644 index 00000000..0afb100f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/figures/progress-tasks.svg @@ -0,0 +1 @@ +3/3ETA:0s|Tasks1/3ETA:2s|Tasks2/3ETA:1s|Tasks \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/paths.rds new file mode 100644 index 00000000..60207a37 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/html/00Index.html new file mode 100644 index 00000000..798fba41 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/html/00Index.html @@ -0,0 +1,685 @@ + + +R: Helpers for Developing Command Line Interfaces + + + +
+

Helpers for Developing Command Line Interfaces + +

+
+
+[Up] +[Top] +

Documentation for package ‘cli’ version 3.6.3

+ + + +

Help Pages

+ + +

+A +B +C +D +F +G +H +I +K +L +M +N +P +Q +R +S +T +U +V +misc +

+ + +

-- A --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ansi-stylesANSI colored text
ansi_alignAlign an ANSI colored string
ansi_chartrANSI character translation and case folding
ansi_collapseCollapse a vector into a string scalar
ansi_columnsFormat a character vector in multiple columns
ansi_grepLike 'base::grep()' and 'base::grepl()', but for ANSI strings
ansi_greplLike 'base::grep()' and 'base::grepl()', but for ANSI strings
ansi_has_anyCheck if a string has some ANSI styling
ansi_has_hyperlink_supportTerminal Hyperlinks
ansi_hide_cursorHide/show cursor in a terminal
ansi_htmlConvert ANSI styled text to HTML
ansi_html_styleCSS styles for the output of 'ansi_html()'
ansi_hyperlink_typesTerminal Hyperlinks
ansi_ncharCount number of characters in an ANSI colored string
ansi_nzcharLike 'base::nzchar()', but for ANSI strings
ansi_palettesANSI colors palettes
ansi_palette_showANSI colors palettes
ansi_regexPerl compatible regular expression that matches ANSI escape sequences
ansi_show_cursorHide/show cursor in a terminal
ansi_simplifySimplify ANSI styling tags
ansi_stringLabels a character vector as containing ANSI control codes.
ansi_stripRemove ANSI escape sequences from a string
ansi_strsplitSplit an ANSI colored string
ansi_strtrimTruncate an ANSI string
ansi_strwrapWrap an ANSI styled string to a certain width
ansi_substrSubstring(s) of an ANSI colored string
ansi_substringSubstring(s) of an ANSI colored string
ansi_tolowerANSI character translation and case folding
ansi_toupperANSI character translation and case folding
ansi_trimwsRemove leading and/or trailing whitespace from an ANSI string
ansi_with_hidden_cursorHide/show cursor in a terminal
+ +

-- B --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bg_blackANSI colored text
bg_blueANSI colored text
bg_br_blackANSI colored text
bg_br_blueANSI colored text
bg_br_cyanANSI colored text
bg_br_greenANSI colored text
bg_br_magentaANSI colored text
bg_br_redANSI colored text
bg_br_whiteANSI colored text
bg_br_yellowANSI colored text
bg_cyanANSI colored text
bg_greenANSI colored text
bg_magentaANSI colored text
bg_noneANSI colored text
bg_redANSI colored text
bg_whiteANSI colored text
bg_yellowANSI colored text
boxxDraw a banner-like box in the console
builtin_themeThe built-in CLI theme
+ +

-- C --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
cat_boxx'cat()' helpers
cat_bullet'cat()' helpers
cat_line'cat()' helpers
cat_print'cat()' helpers
cat_rule'cat()' helpers
ccli_tick_resetcli progress bars
cliCompose multiple cli functions
cli-configcli environment variables and options
cli_abortSignal an error, warning or message with a cli formatted message
cli_alertCLI alerts
cli_alert_dangerCLI alerts
cli_alert_infoCLI alerts
cli_alert_successCLI alerts
cli_alert_warningCLI alerts
cli_blockquoteCLI block quote
cli_bulletsList of items
cli_bullets_rawList of verbatim items
cli_codeA block of code
cli_debug_docDebug cli internals
cli_divGeneric CLI container
cli_dlDefinition list
cli_endClose a CLI container
cli_fmtCapture the output of cli functions instead of printing it
cli_formatFormat a value for printing
cli_format.characterFormat a value for printing
cli_format.defaultFormat a value for printing
cli_format.numericFormat a value for printing
cli_format_methodCreate a format method for an object using cli tools
cli_h1CLI headings
cli_h2CLI headings
cli_h3CLI headings
cli_informSignal an error, warning or message with a cli formatted message
cli_liCLI list item(s)
cli_list_themesList the currently active themes
cli_olOrdered CLI list
cli_output_connectionThe connection option that cli would use
cli_parCLI paragraph
cli_process_doneIndicate the start and termination of some computation in the status bar (superseded)
cli_process_failedIndicate the start and termination of some computation in the status bar (superseded)
cli_process_startIndicate the start and termination of some computation in the status bar (superseded)
cli_progress_alongAdd a progress bar to a mapping function or for loop
cli_progress_barcli progress bars
cli_progress_builtin_handlerscli progress handlers
cli_progress_cleanupProgress bar utility functions.
cli_progress_democli progress bar demo
cli_progress_donecli progress bars
cli_progress_messageSimplified cli progress messages
cli_progress_numProgress bar utility functions.
cli_progress_outputAdd text output to a progress bar
cli_progress_stepSimplified cli progress messages, with styling
cli_progress_stylesList of built-in cli progress styles
cli_progress_updatecli progress bars
cli_ruleCLI horizontal rule
cli_sitrepcli situation report
cli_statusUpdate the status bar (superseded)
cli_status_clearClear the status bar (superseded)
cli_status_updateUpdate the status bar (superseded)
cli_textCLI text
cli_tick_resetcli progress bars
cli_ulUnordered CLI list
cli_vecAdd custom cli style to a vector
cli_verbatimCLI verbatim text
cli_warnSignal an error, warning or message with a cli formatted message
cli__pb_barProgress bar variables
cli__pb_currentProgress bar variables
cli__pb_current_bytesProgress bar variables
cli__pb_elapsedProgress bar variables
cli__pb_elapsed_clockProgress bar variables
cli__pb_elapsed_rawProgress bar variables
cli__pb_etaProgress bar variables
cli__pb_eta_rawProgress bar variables
cli__pb_eta_strProgress bar variables
cli__pb_extraProgress bar variables
cli__pb_idProgress bar variables
cli__pb_nameProgress bar variables
cli__pb_percentProgress bar variables
cli__pb_pidProgress bar variables
cli__pb_rateProgress bar variables
cli__pb_rate_bytesProgress bar variables
cli__pb_rate_rawProgress bar variables
cli__pb_spinProgress bar variables
cli__pb_statusProgress bar variables
cli__pb_timestampProgress bar variables
cli__pb_totalProgress bar variables
cli__pb_total_bytesProgress bar variables
code_highlightSyntax highlight R code
code_theme_listSyntax highlighting themes
col_blackANSI colored text
col_blueANSI colored text
col_br_blackANSI colored text
col_br_blueANSI colored text
col_br_cyanANSI colored text
col_br_greenANSI colored text
col_br_magentaANSI colored text
col_br_redANSI colored text
col_br_whiteANSI colored text
col_br_yellowANSI colored text
col_cyanANSI colored text
col_greenANSI colored text
col_greyANSI colored text
col_magentaANSI colored text
col_noneANSI colored text
col_redANSI colored text
col_silverANSI colored text
col_whiteANSI colored text
col_yellowANSI colored text
combine_ansi_stylesCombine two or more ANSI styles
console_widthDetermine the width of the console
containersAbout cli containers
+ +

-- D --

+ + + + + + + + + + + + +
default_appStart, stop, query the default cli application
demo_spinnersShow a demo of some (by default all) spinners
detect_tty_colorsDetect the number of ANSI colors to use
diff_chrCompare two character vectors elementwise
diff_strCompare two character strings, character by character
+ +

-- F --

+ + + + + + + + + + + + + + +
faqFrequently Asked Questions
format_bullets_rawList of verbatim items
format_errorFormat an error, warning or diagnostic message
format_inlineFormat and returns a line of text
format_messageFormat an error, warning or diagnostic message
format_warningFormat an error, warning or diagnostic message
+ +

-- G --

+ + + + +
get_spinnerCharacter vector to put a spinner on the screen
+ +

-- H --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
hash_animalAdjective-animal hash
hash_emojiEmoji hash
hash_file_md5MD5 hash
hash_file_sha1SHA-1 hash
hash_file_sha256SHA-256 hash
hash_md5MD5 hash
hash_obj_animalAdjective-animal hash
hash_obj_emojiEmoji hash
hash_obj_md5MD5 hash
hash_obj_sha1SHA-1 hash
hash_obj_sha256SHA-256 hash
hash_raw_animalAdjective-animal hash
hash_raw_emojiEmoji hash
hash_raw_md5MD5 hash
hash_raw_sha1SHA-1 hash
hash_raw_sha256SHA-256 hash
hash_sha1SHA-1 hash
hash_sha256SHA-256 hash
has_keypress_supportCheck if the current platform/terminal supports reading single keys.
+ +

-- I --

+ + + + + + + + + + +
inline-markupAbout inline markup in the semantic cli
is_ansi_ttyDetect if a stream support ANSI escape characters
is_dynamic_ttyDetect whether a stream supports \\r (Carriage return)
is_utf8_outputWhether cli is emitting UTF-8 characters
+ +

-- K --

+ + + + +
keypressRead a single keypress at the terminal
+ +

-- L --

+ + + + + + + + + + +
linkscli hyperlinks
list_border_stylesDraw a banner-like box in the console
list_spinnersList all available spinners
list_symbolsVarious handy symbols to use in a command line UI
+ +

-- M --

+ + + + + + +
make_ansi_styleCreate a new ANSI style
make_spinnerCreate a spinner
+ +

-- N --

+ + + + + + +
noPluralization helper functions
num_ansi_colorsDetect the number of ANSI colors to use
+ +

-- P --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
pb_barProgress bar variables
pb_currentProgress bar variables
pb_current_bytesProgress bar variables
pb_elapsedProgress bar variables
pb_elapsed_clockProgress bar variables
pb_elapsed_rawProgress bar variables
pb_etaProgress bar variables
pb_eta_rawProgress bar variables
pb_eta_strProgress bar variables
pb_extraProgress bar variables
pb_idProgress bar variables
pb_nameProgress bar variables
pb_percentProgress bar variables
pb_pidProgress bar variables
pb_rateProgress bar variables
pb_rate_bytesProgress bar variables
pb_rate_rawProgress bar variables
pb_spinProgress bar variables
pb_statusProgress bar variables
pb_timestampProgress bar variables
pb_totalProgress bar variables
pb_total_bytesProgress bar variables
pluralizationAbout cli pluralization
pluralizeString templating with pluralization
pretty_print_codeTurn on pretty-printing functions at the R console
progress-cThe cli progress C API
progress-variablesProgress bar variables
+ +

-- Q --

+ + + + +
qtyPluralization helper functions
+ +

-- R --

+ + + + + + +
ruleMake a rule with one or two text labels
rulerPrint the helpful ruler to the screen
+ +

-- S --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
simple_themeA simple CLI theme
spark_barDraw a sparkline bar graph with unicode block characters
spark_lineDraw a sparkline line graph with Braille characters.
start_appStart, stop, query the default cli application
stop_appStart, stop, query the default cli application
style_blurredANSI colored text
style_boldANSI colored text
style_dimANSI colored text
style_hiddenANSI colored text
style_hyperlinkTerminal Hyperlinks
style_inverseANSI colored text
style_italicANSI colored text
style_no_bg_colorANSI colored text
style_no_blurredANSI colored text
style_no_boldANSI colored text
style_no_colorANSI colored text
style_no_dimANSI colored text
style_no_hiddenANSI colored text
style_no_inverseANSI colored text
style_no_italicANSI colored text
style_no_strikethroughANSI colored text
style_no_underlineANSI colored text
style_resetANSI colored text
style_strikethroughANSI colored text
style_underlineANSI colored text
symbolVarious handy symbols to use in a command line UI
+ +

-- T --

+ + + + + + + + + + + + +
test_that_cliTest cli output with testthat
themesAbout cli themes
tickingcli progress bars
treeDraw a tree
truecolorANSI colors palettes
+ +

-- U --

+ + + + + + + + +
utf8_graphemesBreak an UTF-8 character vector into grapheme clusters
utf8_ncharCount the number of characters in a character vector
utf8_substrSubstring of an UTF-8 string
+ +

-- V --

+ + + + +
vt_outputSimulate (a subset of) a VT-5xx ANSI terminal
+ +

-- misc --

+ + + + +
__cli_update_duecli progress bars
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/include/cli/progress.h b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/include/cli/progress.h new file mode 100644 index 00000000..809fad8a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/include/cli/progress.h @@ -0,0 +1,413 @@ +#ifndef R_CLI_PROGRESS_H +#define R_CLI_PROGRESS_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// ---------------------------------------------------------------------- +// Public API +// ---------------------------------------------------------------------- + +//' ### `CLI_SHOULD_TICK` +//' +//' A macro that evaluates to (int) 1 if a cli progress bar update is due, +//' and to (int) 0 otherwise. If the timer hasn't been initialized in this +//' compilation unit yet, then it is always 0. To initialize the timer, +//' call `cli_progress_init_timer()` or create a progress bar with +//' `cli_progress_bar()`. + +#define CLI_SHOULD_TICK + +//' ### `cli_progress_add()` +//' +//' ```c +//' void cli_progress_add(SEXP bar, double inc); +//' ``` +//' +//' Add a number of progress units to the progress bar. It will also +//' trigger an update if an update is due. +//' +//' * `bar`: progress bar object. +//' * `inc`: progress increment. + +static R_INLINE void cli_progress_add(SEXP bar, double inc); + +//' ### `cli_progress_bar()` +//' +//' ```c +//' SEXP cli_progress_bar(double total, SEXP config); +//' ``` +//' +//' Create a new progress bar object. The returned progress bar object +//' must be `PROTECT()`-ed. +//' +//' * `total`: Total number of progress units. Use `NA_REAL` if it is not +//' known. +//' * `config`: R named list object of additional parameters. May be `NULL` +//' (the C `NULL~) or `R_NilValue` (the R `NULL`) for the defaults. +//' +//' `config` may contain the following entries: +//' +//' * `name`: progress bar name. +//' * `status`: (initial) progress bar status. +//' * `type`: progress bar type. +//' * `total`: total number of progress units. +//' * `show_after`: show the progress bar after the specified number of +//' seconds. This overrides the global `show_after` option. +//' * `format`: format string, must be specified for custom progress bars. +//' * `format_done`: format string for successful termination. +//' * `format_failed`: format string for unsuccessful termination. +//' * `clear`: whether to remove the progress bar from the screen after +//' termination. +//' * `auto_terminate`: whether to terminate the progress bar when the +//' number of current units equals the number of total progress units. +//' +//' #### Example +//' +//' ```c +//' #include +//' SEXP progress_test1() { +//' int i; +//' SEXP bar = PROTECT(cli_progress_bar(1000, NULL)); +//' for (i = 0; i < 1000; i++) { +//' cli_progress_sleep(0, 4 * 1000 * 1000); +//' if (CLI_SHOULD_TICK) cli_progress_set(bar, i); +//' } +//' cli_progress_done(bar); +//' UNPROTECT(1); +//' return Rf_ScalarInteger(i); +//' } +//' ``` + +static R_INLINE SEXP cli_progress_bar(double total, SEXP config); + +//' ### `cli_progress_done()` +//' +//' ```c +//' void cli_progress_done(SEXP bar); +//' ``` +//' +//' Terminate the progress bar. +//' +//' * `bar`: progress bar object. + +static R_INLINE void cli_progress_done(SEXP bar); + +//' ### `cli_progress_init_timer()` +//' +//' ```c +//' void cli_progress_init_timer(); +//' ``` +//' +//' Initialize the cli timer without creating a progress bar. + +static R_INLINE void cli_progress_init_timer(void); + +//' ### `cli_progress_num()` +//' +//' ```c +//' int cli_progress_num(); +//' ``` +//' +//' Returns the number of currently active progress bars. + +static R_INLINE int cli_progress_num(void); + +//' ### `cli_progress_set()` +//' +//' ```c +//' void cli_progress_set(SEXP bar, double set); +//' ``` +//' +//' Set the progress bar to the specified number of progress units. +//' +//' * `bar`: progress bar object. +//' * `set`: number of current progress progress units. + +static R_INLINE void cli_progress_set(SEXP bar, double set); + +//' ### `cli_progress_set_clear()` +//' +//' ```c +//' void cli_progress_set_clear(SEXP bar, int clear); +//' ``` +//' +//' Set whether to remove the progress bar from the screen. You can call +//' this any time before `cli_progress_done()` is called. +//' +//' * `bar`: progress bar object. +//' * `clear`: whether to remove the progress bar from the screen, zero or +//' one. + +static R_INLINE void cli_progress_set_clear(SEXP bar, int clear); + +//' ### `cli_progress_set_format()` +//' +//' ```c +//' void cli_progress_set_format(SEXP bar, const char *format, ...); +//' ``` +//' +//' Set a custom format string for the progress bar. This call does not +//' try to update the progress bar. If you want to request an update, +//' call `cli_progress_add()`, `cli_progress_set()` or +//' `cli_progress_update()`. +//' +//' * `bar`: progress bar object. +//' * `format`: format string. +//' * `...`: values to substitute into `format`. +//' +//' `format` and `...` are passed to `vsnprintf()` to create a format +//' string. +//' +//' Format strings may contain glue substitutions, referring to +//' [progress variables][progress-variables], pluralization, and cli +//' styling. +//' +//' [progress-variables]: https://cli.r-lib.org/dev/reference/progress-variables.html + +static R_INLINE void cli_progress_set_format(SEXP bar, const char *format, ...); + +//' ### `cli_progress_set_name()` +//' +//' ```c +//' void cli_progress_set_name(SEXP bar, const char *name); +//' ``` +//' +//' Set the name of the progress bar. +//' +//' * `bar`; progress bar object. +//' * `name`: progress bar name. + +static R_INLINE void cli_progress_set_name(SEXP bar, const char *name); + +//' ### `cli_progress_set_status()` +//' +//' ```c +//' void cli_progress_set_status(SEXP bar, const char *status); +//' ``` +//' +//' Set the status of the progress bar. +//' +//' * `bar`: progress bar object. +//' * `status `: progress bar status. + +static R_INLINE void cli_progress_set_status(SEXP bar, const char *status); + +//' ### `cli_progress_set_type()` +//' +//' ```c +//' void cli_progress_set_type(SEXP bar, const char *type); +//' ``` +//' +//' Set the progress bar type. Call this function right after creating +//' the progress bar with `cli_progress_bar()`. Otherwise the behavior is +//' undefined. +//' +//' * `bar`: progress bar object. +//' * `type`: progress bar type. Possible progress bar types: +//' `iterator`, `tasks`, `download` and `custom`. + +static R_INLINE void cli_progress_set_type(SEXP bar, const char *type); + +//' ### `cli_progress_update()` +//' +//' ```c +//' void cli_progress_update(SEXP bar, double set, double inc, int force); +//' ``` +//' +//' Update the progress bar. Unlike the simpler `cli_progress_add()` and +//' `cli_progress_set()` function, it can force an update if `force` is +//' set to 1. +//' +//' * `bar`: progress bar object. +//' * `set`: the number of current progress units. It is ignored if +//' negative. +//' * `inc`: increment to add to the current number of progress units. +//' It is ignored if `set` is not negative. +//' * `force`: whether to force an update, even if no update is due. +//' +//' To force an update without changing the current number of progress units, +//' supply `set = -1`, `inc = 0` and `force = 1`. + +static R_INLINE void cli_progress_update(SEXP bar, double set, double inc, int force); + +// ---------------------------------------------------------------------- +// Internals +// ---------------------------------------------------------------------- + +typedef volatile int vint; + +static vint cli__false = 0; +static vint *cli__should_tick = &cli__false; + +#ifndef __has_builtin // Optional of course. + #define __has_builtin(x) 0 // Compatibility with non-clang compilers. +#endif + +#if __has_builtin (__builtin_expect) +# define CLI_UNLIKELY(a) __builtin_expect((a), 0) +# define CLI_LIKELY(a) __builtin_expect((a), 1) +# else +# define CLI_UNLIKELY(a) a +# define CLI_LIKELY(a) a +#endif + +#undef CLI_SHOULD_TICK +#define CLI_SHOULD_TICK (CLI_UNLIKELY(*cli__should_tick)) + +static R_INLINE void cli_progress_done(SEXP bar) { + if (Rf_isNull(bar)) return; + static void (*ptr)(SEXP) = NULL; + if (ptr == NULL) { + ptr = (void (*)(SEXP)) R_GetCCallable("cli", "cli_progress_done"); + } + ptr(bar); +} + +#ifdef R_CLEANCALL_SUPPORT +static void cli_progress_done2(SEXP bar) { + if (Rf_isNull(bar)) return; + static void (*ptr)(SEXP) = NULL; + if (ptr == NULL) { + ptr = (void (*)(SEXP)) R_GetCCallable("cli", "cli_progress_done"); + } + ptr(bar); +} +#endif + +static R_INLINE void cli_progress_init_timer(void) { + static void (*ptr)(vint **) = NULL; + if (ptr == NULL) { + ptr = (void (*)(vint **)) R_GetCCallable("cli", "cli_progress_init_timer"); + } + ptr(&cli__should_tick); +} + +static R_INLINE SEXP cli_progress_bar(double total, SEXP config) { + static SEXP (*ptr)(vint **, double, SEXP) = NULL; + if (ptr == NULL) { + ptr = (SEXP (*)(vint **, double, SEXP)) R_GetCCallable("cli", "cli_progress_bar"); + } + + SEXP bar = PROTECT(ptr(&cli__should_tick, total, config)); + +#ifdef R_CLEANCALL_SUPPORT + if (r_cleancall_is_active()) { + r_call_on_early_exit((void (*)(void *)) cli_progress_done2, (void*) bar); + } +#endif + + UNPROTECT(1); + return bar; +} + +static R_INLINE void cli_progress_set_name(SEXP bar, const char *name) { + if (Rf_isNull(bar)) return; + static void (*ptr)(SEXP, const char*) = NULL; + if (ptr == NULL) { + ptr = (void (*)(SEXP, const char*)) + R_GetCCallable("cli", "cli_progress_set_name"); + } + ptr(bar, name); +} + +static R_INLINE void cli_progress_set_status(SEXP bar, const char *status) { + if (Rf_isNull(bar)) return; + static void (*ptr)(SEXP, const char*) = NULL; + if (ptr == NULL) { + ptr = (void (*)(SEXP, const char*)) + R_GetCCallable("cli", "cli_progress_set_status"); + } + ptr(bar, status); +} + +static R_INLINE void cli_progress_set_type(SEXP bar, const char *type) { + if (Rf_isNull(bar)) return; + static void (*ptr)(SEXP, const char*) = NULL; + if (ptr == NULL) { + ptr = (void (*)(SEXP, const char*)) + R_GetCCallable("cli", "cli_progress_set_type"); + } + ptr(bar, type); +} + +static R_INLINE void cli_progress_set_clear(SEXP bar, int clear) { + if (Rf_isNull(bar)) return; + static void (*ptr)(SEXP, int) = NULL; + if (ptr == NULL) { + ptr = (void (*)(SEXP, int)) + R_GetCCallable("cli", "cli_progress_set_clear"); + } + ptr(bar, clear); +} + +static R_INLINE void cli_progress_set(SEXP bar, double set) { + if (Rf_isNull(bar)) return; + static void (*ptr)(SEXP, double) = NULL; + if (ptr == NULL) { + ptr = (void (*)(SEXP, double)) R_GetCCallable("cli", "cli_progress_set"); + } + ptr(bar, set); +} + +static R_INLINE void cli_progress_set_format(SEXP bar, const char *format, ...) { + if (Rf_isNull(bar)) return; + static void (*ptr)(SEXP, const char*) = NULL; + static char str[1024]; + if (ptr == NULL) { + ptr = (void (*)(SEXP, const char*)) + R_GetCCallable("cli", "cli_progress_set_format"); + } + + va_list ap; + va_start(ap, format); + vsnprintf(str, sizeof(str) / sizeof(char), format, ap); + + ptr(bar, str); +} + +static R_INLINE void cli_progress_add(SEXP bar, double inc) { + if (Rf_isNull(bar)) return; + static void (*ptr)(SEXP, double) = NULL; + if (ptr == NULL) { + ptr = (void (*)(SEXP, double)) R_GetCCallable("cli", "cli_progress_add"); + } + ptr(bar, inc); +} + +static R_INLINE int cli_progress_num(void) { + static int (*ptr)(void) = NULL; + if (ptr == NULL) { + ptr = (int (*)(void)) R_GetCCallable("cli", "cli_progress_num"); + } + return ptr(); +} + +static R_INLINE void cli_progress_sleep(int s, long ns) { + static void (*ptr)(int, long) = NULL; + if (ptr == NULL) { + ptr = (void (*)(int, long)) R_GetCCallable("cli", "cli_progress_sleep"); + } + ptr(s, ns); +} + +static R_INLINE void cli_progress_update(SEXP bar, + double set, + double inc, + int force) { + static void (*ptr)(SEXP, double, double, int) = NULL; + if (ptr == NULL) { + ptr = (void (*)(SEXP, double, double, int)) R_GetCCallable("cli", "cli_progress_update"); + } + ptr(bar, set, inc, force); +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/libs/cli.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/libs/cli.so new file mode 100755 index 00000000..483794db Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/libs/cli.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/libs/cli.so.dSYM/Contents/Info.plist b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/libs/cli.so.dSYM/Contents/Info.plist new file mode 100644 index 00000000..649f4292 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/libs/cli.so.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.cli.so + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/libs/cli.so.dSYM/Contents/Resources/DWARF/cli.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/libs/cli.so.dSYM/Contents/Resources/DWARF/cli.so new file mode 100644 index 00000000..88aa6fb7 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/libs/cli.so.dSYM/Contents/Resources/DWARF/cli.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/logo.txt b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/logo.txt new file mode 100644 index 00000000..73a01363 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/logo.txt @@ -0,0 +1,7 @@ +                     oooo    o8o +Yb                   `888    `"' + `Yb       .ooooo.    888   oooo +   `Yb    d88' `"Y8   888   `888 +   .dP    888         888    888 + .dP      888   .o8   888    888 +dP        `Y8bod8P'  o888o  o888o diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/shiny/along/app.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/shiny/along/app.R new file mode 100644 index 00000000..7300de1d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/shiny/along/app.R @@ -0,0 +1,45 @@ +# modified from https://shiny.rstudio.com/articles/progress.html + +# This example uses `cli_progress_along()`. + +library(cli) + +# !!! You don't need these in real code. +# cli.progress_show_after makes sure that we see the progress bar from +# the beginning, not only after a delay. +options(cli.progress_show_after = 0) + +# !!! You don't need these in real code. +# This also requests logging the progress bar to the standard output, +# in the console. +options(cli.progress_handlers_only = c("shiny", "logger")) + +server <- function(input, output) { + output$plot <- renderPlot({ + input$goPlot # Re-run when button is clicked + + # Create 0-row data frame which will be used to store data + dat <- data.frame(x = numeric(0), y = numeric(0)) + + # Number of times we'll go through the loop + n <- 10 + + for (i in cli_progress_along(1:n, "Rendering", format = "At {i}")) { + # Each time through the loop, add another row of data. This is + # a stand-in for a long-running computation. + dat <- rbind(dat, data.frame(x = rnorm(1), y = rnorm(1))) + + # Pause for 0.1 seconds to simulate a long computation. + Sys.sleep(0.5) + } + + plot(dat$x, dat$y) + }) +} + +ui <- shinyUI(basicPage( + plotOutput('plot', width = "300px", height = "300px"), + actionButton('goPlot', 'Go plot') +)) + +shinyApp(ui = ui, server = server) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/shiny/format/app.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/shiny/format/app.R new file mode 100644 index 00000000..f134c97a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/shiny/format/app.R @@ -0,0 +1,48 @@ +# modified from https://shiny.rstudio.com/articles/progress.html + +# This app has a custom format string + +library(cli) + +# !!! You don't need these in real code. +# cli.progress_show_after makes sure that we see the progress bar from +# the beginning, not only after a delay. +options(cli.progress_show_after = 0) + +# !!! You don't need these in real code. +# This also requests logging the progress bar to the standard output, +# in the console. +options(cli.progress_handlers_only = c("shiny", "logger")) + +server <- function(input, output) { + output$plot <- renderPlot({ + input$goPlot # Re-run when button is clicked + + # Create 0-row data frame which will be used to store data + dat <- data.frame(x = numeric(0), y = numeric(0)) + + # Number of times we'll go through the loop + n <- 10 + + cli_progress_bar(total = n, "Rendering plot", format = "Starting part {i}") + for (i in 1:n) { + # Each time through the loop, add another row of data. This is + # a stand-in for a long-running computation. + dat <- rbind(dat, data.frame(x = rnorm(1), y = rnorm(1))) + + cli_progress_update() + + # Pause for 0.1 seconds to simulate a long computation. + Sys.sleep(0.5) + } + + plot(dat$x, dat$y) + }) +} + +ui <- shinyUI(basicPage( + plotOutput('plot', width = "300px", height = "300px"), + actionButton('goPlot', 'Go plot') +)) + +shinyApp(ui = ui, server = server) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/shiny/nested/app.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/shiny/nested/app.R new file mode 100644 index 00000000..db839566 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/shiny/nested/app.R @@ -0,0 +1,60 @@ +# modified from https://shiny.rstudio.com/articles/progress.html + +# Nested progress bars + +library(cli) + +# !!! You don't need these in real code. +# cli.progress_show_after makes sure that we see the progress bar from +# the beginning, not only after a delay. +options(cli.progress_show_after = 0) + +# !!! You don't need these in real code. +# This also requests logging the progress bar to the standard output, +# in the console. +options(cli.progress_handlers_only = c("shiny", "logger")) + +server <- function(input, output) { + output$plot <- renderPlot({ + input$goPlot # Re-run when button is clicked + + # Create 0-row data frame which will be used to store data + dat <- data.frame(x = numeric(0), y = numeric(0)) + + # Number of times we'll go through the loop + n <- 10 + + # Set auto-terminate to FALSE, as we do not want the progress bar + # terminated when we reach step 10, as at that point we are only at + # the beginning of the iteration + cli_progress_bar( + "Rendering plot", + total = n, + format = "Starting {i}" + ) + for (i in 1:n) { + cli_progress_update(set = i - 1) + # Each time through the loop, add another row of data. This is + # a stand-in for a long-running computation. + dat <- rbind(dat, data.frame(x = rnorm(1), y = rnorm(1))) + render_plot_detail(i) + } + + plot(dat$x, dat$y) + }) +} + +ui <- shinyUI(basicPage( + plotOutput('plot', width = "300px", height = "300px"), + actionButton('goPlot', 'Go plot') +)) + +render_plot_detail <- function(i) { + cli_progress_bar(total = 10, paste("Detailing", i)) + for (i in 1:10) { + cli_progress_update() + Sys.sleep(0.1) + } +} + +shinyApp(ui = ui, server = server) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/shiny/output/app.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/shiny/output/app.R new file mode 100644 index 00000000..8df95bdb --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/shiny/output/app.R @@ -0,0 +1,48 @@ +# modified from https://shiny.rstudio.com/articles/progress.html + +library(cli) + +# !!! You don't need these in real code. +# cli.progress_show_after makes sure that we see the progress bar from +# the beginning, not only after a delay. +options(cli.progress_show_after = 0) + +# !!! You don't need this in real code. +options(cli.progress_handlers_only = "shiny") + +server <- function(input, output) { + output$plot <- renderPlot({ + input$goPlot # Re-run when button is clicked + + # Create 0-row data frame which will be used to store data + dat <- data.frame(x = numeric(0), y = numeric(0)) + + # Number of times we'll go through the loop + n <- 10 + + cli_progress_bar(total = n, "Rendering plot") + for (i in 1:n) { + # Each time through the loop, add another row of data. This is + # a stand-in for a long-running computation. + dat <- rbind(dat, data.frame(x = rnorm(1), y = rnorm(1))) + + cli_progress_update(status = paste("Doing part", i)) + + # Pause for 0.5 seconds to simulate a long computation. + # Produce some extra output + Sys.sleep(0.5) + msg <- paste(strwrap(cli:::lorem_ipsum(1, 1)), collapse = "\n") + if (i != n) cli_progress_output(msg) + Sys.sleep(0.5) + } + + plot(dat$x, dat$y) + }) +} + +ui <- shinyUI(basicPage( + plotOutput('plot', width = "300px", height = "300px"), + actionButton('goPlot', 'Go plot') +)) + +shinyApp(ui = ui, server = server) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/shiny/simple/app.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/shiny/simple/app.R new file mode 100644 index 00000000..c87e431e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/cli/shiny/simple/app.R @@ -0,0 +1,46 @@ +# modified from https://shiny.rstudio.com/articles/progress.html + +library(cli) + +# !!! You don't need these in real code. +# cli.progress_show_after makes sure that we see the progress bar from +# the beginning, not only after a delay. +options(cli.progress_show_after = 0) + +# !!! You don't need these in real code. +# This also requests logging the progress bar to the standard output, +# in the console. +options(cli.progress_handlers_only = c("shiny", "logger")) + +server <- function(input, output) { + output$plot <- renderPlot({ + input$goPlot # Re-run when button is clicked + + # Create 0-row data frame which will be used to store data + dat <- data.frame(x = numeric(0), y = numeric(0)) + + # Number of times we'll go through the loop + n <- 10 + + cli_progress_bar(total = n, "Rendering plot") + for (i in 1:n) { + # Each time through the loop, add another row of data. This is + # a stand-in for a long-running computation. + dat <- rbind(dat, data.frame(x = rnorm(1), y = rnorm(1))) + + cli_progress_update(status = paste("Doing part", i)) + + # Pause for 0.1 seconds to simulate a long computation. + Sys.sleep(0.5) + } + + plot(dat$x, dat$y) + }) +} + +ui <- shinyUI(basicPage( + plotOutput('plot', width = "300px", height = "300px"), + actionButton('goPlot', 'Go plot') +)) + +shinyApp(ui = ui, server = server) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/DESCRIPTION new file mode 100644 index 00000000..86fcdf50 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/DESCRIPTION @@ -0,0 +1,37 @@ +Package: commonmark +Type: Package +Title: High Performance CommonMark and Github Markdown Rendering in R +Version: 1.9.2 +Authors@R: c( + person("Jeroen", "Ooms", ,"jeroenooms@gmail.com", role = c("aut", "cre"), + comment = c(ORCID = "0000-0002-4035-0289")), + person("John MacFarlane", role = "cph", comment = "Author of cmark")) +Description: The CommonMark specification defines + a rationalized version of markdown syntax. This package uses the 'cmark' + reference implementation for converting markdown text into various formats + including html, latex and groff man. In addition it exposes the markdown + parse tree in xml format. Also includes opt-in support for GFM extensions + including tables, autolinks, and strikethrough text. +License: BSD_2_clause + file LICENSE +URL: https://docs.ropensci.org/commonmark/ + https://ropensci.r-universe.dev/commonmark +BugReports: https://github.com/r-lib/commonmark/issues +Suggests: curl, testthat, xml2 +RoxygenNote: 7.2.3 +Language: en-US +Encoding: UTF-8 +NeedsCompilation: yes +Packaged: 2024-10-03 14:12:30 UTC; jeroen +Author: Jeroen Ooms [aut, cre] (), + John MacFarlane [cph] (Author of cmark) +Maintainer: Jeroen Ooms +Repository: CRAN +Date/Publication: 2024-10-04 12:40:06 UTC +Built: R 4.4.1; aarch64-apple-darwin20; 2025-02-01 04:46:10 UTC; unix +Archs: commonmark.so.dSYM +RemoteType: standard +RemotePkgRef: commonmark +RemoteRef: commonmark +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 1.9.2 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/INDEX new file mode 100644 index 00000000..d2d9bc33 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/INDEX @@ -0,0 +1,2 @@ +commonmark Parse and render markdown text +extensions Github CommonMark Extensions diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/LICENSE new file mode 100644 index 00000000..15eaccbe --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2021 +COPYRIGHT HOLDER: Jeroen Ooms; John MacFarlane; Vicent Martí; Github, Inc; Karl Dubost; Mathieu Duponchelle diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/Meta/Rd.rds new file mode 100644 index 00000000..898042b0 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/Meta/hsearch.rds new file mode 100644 index 00000000..beb8b6bd Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/Meta/links.rds new file mode 100644 index 00000000..6e95dd61 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/Meta/nsInfo.rds new file mode 100644 index 00000000..413ba521 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/Meta/package.rds new file mode 100644 index 00000000..96c4d75a Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/NAMESPACE new file mode 100644 index 00000000..62b108a9 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/NAMESPACE @@ -0,0 +1,11 @@ +# Generated by roxygen2: do not edit by hand + +export(list_extensions) +export(markdown_commonmark) +export(markdown_html) +export(markdown_latex) +export(markdown_man) +export(markdown_text) +export(markdown_xml) +useDynLib(commonmark,R_list_extensions) +useDynLib(commonmark,R_render_markdown) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/NEWS b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/NEWS new file mode 100644 index 00000000..775c89a4 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/NEWS @@ -0,0 +1,56 @@ +1.9.1 + - Update libcmark-gfm to 0.29.0.gfm.13 + +1.9.0 + - Add parameter 'footnotes' to enable footnote parsing + - Update libcmark-gfm to 0.29.0.gfm.9 + +1.8.1 + - Update libcmark-gfm to 0.29.0.gfm.6 + - Fix strict-prototypes warnings + +1.8.0 + - Update libcmark-gfm to 0.29.0.gfm.3 + +1.7 + - Update libcmark-gfm to 0.28.3.gfm.19 + - Hide internal symbols, fixes crash on rstudio in centos (#12) + +1.6 + - Update libcmark-gfm to 0.28.3.gfm.16 + +1.5 + - Update libcmark-gfm to 0.28.3.gfm.12 + +1.4 + - Update libcmark-gfm to 0.28.0.gfm.8 + - Add new output markdown_text() + - Hide symbols from dll on supported platforms + +1.2 + - Update upstream libcmark (github/cmark@14874d3) + - Add R_init_commonmark to please CMD check + +1.1 + - Update upstream libcmark (github/cmark@57ca6e2) + +1.0 + - Switch to Github fork of cmark library (master@0e197aa) + - Add bindings for enabling extensions + - Switch to roxygen2 markdown format for manual pages + +0.9 + - Update libcmark to 0.26.1 + +0.8 + - Update libcmark to 0.25.2 + +0.7 + - Update libcmark to 0.24.1 + +0.6 + - Update libcmark to 0.23 + +0.5 + - Update libcmark to 0.22 + - Added markdown_latex() function diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/R/commonmark b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/R/commonmark new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/R/commonmark @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/R/commonmark.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/R/commonmark.rdb new file mode 100644 index 00000000..631d2821 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/R/commonmark.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/R/commonmark.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/R/commonmark.rdx new file mode 100644 index 00000000..d6318af7 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/R/commonmark.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/help/AnIndex new file mode 100644 index 00000000..c6c8c764 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/help/AnIndex @@ -0,0 +1,10 @@ +commonmark commonmark +extensions extensions +list_extensions extensions +markdown commonmark +markdown_commonmark commonmark +markdown_html commonmark +markdown_latex commonmark +markdown_man commonmark +markdown_text commonmark +markdown_xml commonmark diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/help/aliases.rds new file mode 100644 index 00000000..706e3b34 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/help/commonmark.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/help/commonmark.rdb new file mode 100644 index 00000000..b8dca289 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/help/commonmark.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/help/commonmark.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/help/commonmark.rdx new file mode 100644 index 00000000..05008d08 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/help/commonmark.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/help/paths.rds new file mode 100644 index 00000000..88dcbbee Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/html/00Index.html new file mode 100644 index 00000000..1e89ffe7 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/html/00Index.html @@ -0,0 +1,46 @@ + + +R: High Performance CommonMark and Github Markdown Rendering in R + + + +
+

High Performance CommonMark and Github Markdown Rendering in R + +

+
+
+[Up] +[Top] +

Documentation for package ‘commonmark’ version 1.9.2

+ + + +

Help Pages

+ + + + + + + + + + + + + + + + + + + + + + + +
commonmarkParse and render markdown text
extensionsGithub CommonMark Extensions
list_extensionsGithub CommonMark Extensions
markdownParse and render markdown text
markdown_commonmarkParse and render markdown text
markdown_htmlParse and render markdown text
markdown_latexParse and render markdown text
markdown_manParse and render markdown text
markdown_textParse and render markdown text
markdown_xmlParse and render markdown text
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/libs/commonmark.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/libs/commonmark.so new file mode 100755 index 00000000..1de70c0a Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/libs/commonmark.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/libs/commonmark.so.dSYM/Contents/Info.plist b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/libs/commonmark.so.dSYM/Contents/Info.plist new file mode 100644 index 00000000..71d11eb4 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/libs/commonmark.so.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.commonmark.so + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/libs/commonmark.so.dSYM/Contents/Resources/DWARF/commonmark.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/libs/commonmark.so.dSYM/Contents/Resources/DWARF/commonmark.so new file mode 100644 index 00000000..55ab0aeb Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/commonmark/libs/commonmark.so.dSYM/Contents/Resources/DWARF/commonmark.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/DESCRIPTION new file mode 100644 index 00000000..4027ffc2 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/DESCRIPTION @@ -0,0 +1,48 @@ +Package: desc +Title: Manipulate DESCRIPTION Files +Version: 1.4.3 +Authors@R: c( + person("Gábor", "Csárdi", , "csardi.gabor@gmail.com", role = c("aut", "cre")), + person("Kirill", "Müller", role = "aut"), + person("Jim", "Hester", , "james.f.hester@gmail.com", role = "aut"), + person("Maëlle", "Salmon", role = "ctb", + comment = c(ORCID = "0000-0002-2815-0399")), + person("Posit Software, PBC", role = c("cph", "fnd")) + ) +Maintainer: Gábor Csárdi +Description: Tools to read, write, create, and manipulate DESCRIPTION + files. It is intended for packages that create or manipulate other + packages. +License: MIT + file LICENSE +URL: https://desc.r-lib.org/, https://github.com/r-lib/desc +BugReports: https://github.com/r-lib/desc/issues +Depends: R (>= 3.4) +Imports: cli, R6, utils +Suggests: callr, covr, gh, spelling, testthat, whoami, withr +Config/Needs/website: tidyverse/tidytemplate +Config/testthat/edition: 3 +Encoding: UTF-8 +Language: en-US +RoxygenNote: 7.2.3 +Collate: 'assertions.R' 'authors-at-r.R' 'built.R' 'classes.R' + 'collate.R' 'constants.R' 'deps.R' 'desc-package.R' + 'description.R' 'encoding.R' 'find-package-root.R' 'latex.R' + 'non-oo-api.R' 'package-archives.R' 'read.R' 'remotes.R' + 'str.R' 'syntax_checks.R' 'urls.R' 'utils.R' 'validate.R' + 'version.R' +NeedsCompilation: no +Packaged: 2023-12-10 11:07:50 UTC; gaborcsardi +Author: Gábor Csárdi [aut, cre], + Kirill Müller [aut], + Jim Hester [aut], + Maëlle Salmon [ctb] (), + Posit Software, PBC [cph, fnd] +Repository: CRAN +Date/Publication: 2023-12-10 11:40:08 UTC +Built: R 4.4.1; ; 2025-02-01 04:47:18 UTC; unix +RemoteType: standard +RemotePkgRef: desc +RemoteRef: desc +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 1.4.3 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/INDEX new file mode 100644 index 00000000..d15757bf --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/INDEX @@ -0,0 +1,77 @@ +check_field Syntactical check of a DESCRIPTION field +cran_ascii_fields The DESCRIPTION fields that are supposed to be + in plain ASCII encoding +cran_valid_fields A list of DESCRIPTION fields that are valid + according to the CRAN checks +dep_types DESCRIPTION fields that denote package + dependencies +desc Read a DESCRIPTION file +desc_add_author Add an author to Authors@R in DESCRIPTION +desc_add_author_gh Add a GitHub user as an author to DESCRIPTION +desc_add_me Add the current user as an author to + DESCRIPTION +desc_add_orcid Add an ORCID to one or more authors in + Authors@R, in DESCRIPTION +desc_add_remotes Add locations in the Remotes field in + DESCRIPTION +desc_add_role Add a role to one or more authors in Authors@R, + in DESCRIPTION +desc_add_to_collate Add one or more files to the Collate field, in + DESCRIPTION +desc_add_urls Add URLs to the URL field in DESCRIPTION +desc_bump_version Increase the version number in DESCRIPTION +desc_change_maintainer + Change maintainer of the package, in + DESCRIPTION +desc_clear_remotes Remove all locations from the Remotes field of + DESCRIPTION +desc_clear_urls Remove all URLs from the URL field of + DESCRIPTION +desc_coerce_authors_at_r + Coerce Author and Maintainer Fields to + Authors@R +desc_del Remove fields from a DESCRIPTION file +desc_del_author Remove one or more authors from DESCRIPTION. +desc_del_collate Delete the Collate field from DESCRIPTION +desc_del_dep Remove a package dependency from DESCRIPTION +desc_del_deps Remove all dependencies from DESCRIPTION +desc_del_from_collate Remove files from the Collate field. +desc_del_remotes Delete locations from the Remotes field in + DESCRIPTION +desc_del_role Delete a role of an author, in DESCRIPTION +desc_del_urls Delete URLs from the URL field in DESCRIPTION +desc_fields List all fields in a DESCRIPTION file +desc_get Get a field from a DESCRIPTION file +desc_get_author Query authors by role in Authors@R, in + DESCRIPTION +desc_get_authors Query all authors in Authors@R, in DESCRIPTION +desc_get_built Query the built field in DESCRIPTION +desc_get_collate Query the Collate field in DESCRIPTION +desc_get_deps List all package dependencies from a + DESCRIPTION file +desc_get_field Get a single field from a DESCRIPTION file, + fail if not found +desc_get_maintainer Query the package maintainer in DESCRIPTION +desc_get_remotes List the locations in the Remotes field in + DESCRIPTION +desc_get_urls Query the URL field in DESCRIPTION +desc_get_version Query the package version in DESCRIPTION +desc_has_dep Check for a dependency +desc_has_fields Check if some fields are present in a + DESCRIPTION file +desc_normalize Normalize a DESCRIPTION file +desc_print Print the contents of a DESCRIPTION file to the + screen +desc_reformat_fields Reformat fields in a DESCRIPTION file +desc_reorder_fields Reorder fields in a DESCRIPTION file +desc_set Set one or more fields in a DESCRIPTION file +desc_set_authors Set authors in Authors@R, in DESCRIPTION +desc_set_collate Set the Collate field in DESCRIPTION +desc_set_dep Add a package dependency to a DESCRIPTION file +desc_set_deps Set all package dependencies in DESCRIPTION +desc_set_remotes Set the Remotes field in DESCRIPTION +desc_set_urls Set the URL field in DESCRIPTION +desc_set_version Set the package version in DESCRIPTION +desc_to_latex Converts a DESCRIPTION file to LaTeX +desc_validate Validate a DESCRIPTION file +description Read, write, update, validate DESCRIPTION files diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/LICENSE new file mode 100644 index 00000000..ec45397b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2023 +COPYRIGHT HOLDER: desc authors diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/Meta/Rd.rds new file mode 100644 index 00000000..b0bcad33 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/Meta/hsearch.rds new file mode 100644 index 00000000..b1042463 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/Meta/links.rds new file mode 100644 index 00000000..bfff93a7 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/Meta/nsInfo.rds new file mode 100644 index 00000000..390902a2 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/Meta/package.rds new file mode 100644 index 00000000..58efac49 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/NAMESPACE new file mode 100644 index 00000000..3d4464ad --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/NAMESPACE @@ -0,0 +1,109 @@ +# Generated by roxygen2: do not edit by hand + +S3method(check_field,DescriptionAddedByRCMD) +S3method(check_field,DescriptionAuthorsAtR) +S3method(check_field,DescriptionClassification) +S3method(check_field,DescriptionCollate) +S3method(check_field,DescriptionCompression) +S3method(check_field,DescriptionDate) +S3method(check_field,DescriptionDependencyList) +S3method(check_field,DescriptionDescription) +S3method(check_field,DescriptionEncoding) +S3method(check_field,DescriptionField) +S3method(check_field,DescriptionFreeForm) +S3method(check_field,DescriptionLanguage) +S3method(check_field,DescriptionLicense) +S3method(check_field,DescriptionLogical) +S3method(check_field,DescriptionMaintainer) +S3method(check_field,DescriptionOSType) +S3method(check_field,DescriptionPackage) +S3method(check_field,DescriptionPackageList) +S3method(check_field,DescriptionPriority) +S3method(check_field,DescriptionRemotes) +S3method(check_field,DescriptionRepoList) +S3method(check_field,DescriptionRepository) +S3method(check_field,DescriptionTitle) +S3method(check_field,DescriptionType) +S3method(check_field,DescriptionURL) +S3method(check_field,DescriptionURLList) +S3method(check_field,DescriptionVersion) +S3method(format,DescriptionAuthorsAtR) +S3method(format,DescriptionCollate) +S3method(format,DescriptionDependencyList) +S3method(format,DescriptionField) +S3method(format,DescriptionPackageList) +S3method(format,DescriptionRemotes) +S3method(toLatex,DescriptionAuthorsAtR) +S3method(toLatex,DescriptionCollate) +S3method(toLatex,DescriptionField) +S3method(toLatex,DescriptionURL) +S3method(toLatex,DescriptionURLList) +S3method(toLatex,character) +S3method(toLatex,person) +export(check_field) +export(cran_ascii_fields) +export(cran_valid_fields) +export(dep_types) +export(desc) +export(desc_add_author) +export(desc_add_author_gh) +export(desc_add_me) +export(desc_add_orcid) +export(desc_add_remotes) +export(desc_add_role) +export(desc_add_to_collate) +export(desc_add_urls) +export(desc_bump_version) +export(desc_change_maintainer) +export(desc_clear_remotes) +export(desc_clear_urls) +export(desc_coerce_authors_at_r) +export(desc_del) +export(desc_del_author) +export(desc_del_collate) +export(desc_del_dep) +export(desc_del_deps) +export(desc_del_from_collate) +export(desc_del_remotes) +export(desc_del_role) +export(desc_del_urls) +export(desc_fields) +export(desc_get) +export(desc_get_author) +export(desc_get_authors) +export(desc_get_built) +export(desc_get_collate) +export(desc_get_deps) +export(desc_get_field) +export(desc_get_list) +export(desc_get_maintainer) +export(desc_get_or_fail) +export(desc_get_remotes) +export(desc_get_urls) +export(desc_get_version) +export(desc_has_dep) +export(desc_has_fields) +export(desc_normalize) +export(desc_print) +export(desc_reformat_fields) +export(desc_reorder_fields) +export(desc_set) +export(desc_set_authors) +export(desc_set_collate) +export(desc_set_dep) +export(desc_set_deps) +export(desc_set_list) +export(desc_set_remotes) +export(desc_set_urls) +export(desc_set_version) +export(desc_to_latex) +export(desc_validate) +export(description) +importFrom(R6,R6Class) +importFrom(utils,as.person) +importFrom(utils,packageName) +importFrom(utils,person) +importFrom(utils,tail) +importFrom(utils,toLatex) +importFrom(utils,untar) +importFrom(utils,unzip) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/NEWS.md new file mode 100644 index 00000000..23bdd6e3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/NEWS.md @@ -0,0 +1,154 @@ +# desc 1.4.3 + +* `$set()` and `desc_set()` now can omit checks if `check = FALSE` + is set. + +# desc 1.4.2 + +* The `description$write()` method, and thus all `desc_*()` functions work + correctly now on R 4.3.x for packages that declare a non-UTF-8 encoding. + +# desc 1.4.1 + +* The `$coerce_authors_at_r()` method now does a much better job at setting + the authors' roles (#114, @dpprdan). + +# desc 1.4.0 + +* DESCRIPTION objects created with the `!new` command now omit `LazyData: true` + to match new CRAN checks (#105, @malcolmbarrett) + +* `description$write()` now writes out the file in the correct encoding + (#109). + +* `Authors@R` fields are now formatted differently when normalizing a + DESCRIPTION file (#78). + +* New `description$get_list()`, `description$set_list()` and + corresponding `desc_get_list()` and `desc_set_list()` values to query + and create comma separated fields (#86). + +## Breaking change + +* `desc_get_field()` gains a boolean `squish_ws` parameter to normalize + whitespace within the retrieved value. It defaults to the value of `trim_ws` + (`TRUE` by default). Example with desc's current DESCRIPTION: + + Old behaviour: + + ```r + > desc::desc_get_field("Description") + [1] "... DESCRIPTION files.\n It is intended for packages ..." + ``` + + New behaviour: + + ```r + > desc::desc_get_field("Description") + [1] "... DESCRIPTION files. It is intended for packages ..." + ``` + + If you want the old behaviour, just set `squish_ws = FALSE`. + +# 1.3.0 + +* Adding authors with long names or other fields (`comment`, typically) + works well now (#91). + +* `get_deps()` now removes unneeded whitespace from version requirements + (#84). + +* `normalize()` now does not drop `Authors@R` on non-UTF-8 systems + when it has non-ASCII characters (#80). + +* `has_dep()` now works well with dependencies listed multiple times + (#97, @richfitz). + +* Add `coerce_authors_at_r()` method to convert `Author` to + `Authors@R` (#44, @muschellij2). + +* `add_author()` and similar functions now allow a character vector of + multiple roles (@niceume, #89). + +* `desc_set_deps()` now inserts new packages in (case-insensitive) + alphabetical order, if the existing packages are already in alphabetical + order. + +* New `add_author_gh()` method and `desc_add_author_gh()` function to add + an author using the information available from GitHub V3 API. This method + and function depend on `gh` and are limited when the GitHub user full + name is incomplete or not well parsed by `as.person()` and when their + email address isn't available (@maelle, #71). + +* When using `desc_normalize()` the package dependencies are now + alphabetically sorted (#66, @llrs). + +* New `add_orcid()` method and `desc_add_orcid()` functions make it + possible to add ORCID IDs to authors directly instead of via the + `comment` argument (@maelle, #70). + +* All functions and methods managing authors (`add_me`, `add_author()`, + `del_author()`, `add_role()`, `del_role()`, `change_maintainer()`, + `search_for_author()`, `add_me()`, etc.) gain an `orcid` argument + (@maelle, #70). + +* In `person()` within the `Authors@R` field, `comment` can now be a + named character vector (@maelle, #69; @gvegayon, #65). + +* When using `desc(text=)` parameter, set `textConnection(encoding = + "bytes")` to handle cases when the input text is in a different marked + encoding than the default encoding, such as UTF-8 input on Windows. + +# 1.2.0 + +* Add `get_field()` method, with easier to use failure and fallback + semantics (#62) + +* Use the `Encoding` field to read and write DESCRIPTION with the + correct encoding. UTF-8 is always used internally by desc. (#52, #53) + +* Add `get_built()` function to parse the Built field used in package + binaries. (#48, @jimhester) + +* `get_deps()` (and `desc_get_deps()`) return a zero-row data frame + instead of `NULL` for packages without any dependencies, for consistency. + +* Empty `DESCRIPTION` files are handled more gracefully, as are querying + no fields with `desc_get()` + +* `Remotes`, `VignetteBuilder` and `RdMacros` fields are syntax checked. + (#59, @krlmlr) + +* Account for non-URL content in the `URL` field (#57, @jennybc) + +* Allow for IETF region subtag in `Language` field (#55, @jeroen) + +* Fix continuation lines in output + +* `get_deps()` returns empty data frame if no dependencies, instead of + `NULL` + +# 1.1.1 + +* Relax the R >= 3.2.0 dependency, R 3.1.0 is enough now. + +# 1.1.0 + +* Fix bug when adding authors and there is no `Authors@R` field + +* Get `DESCRIPTION` from package archives (#40) + +* Fix but in `del_dep()` and `has_dep()`, they only worked if the package + was attached. + +# 1.0.1 + +* Fix formatting of `Collate` fields, they always start at a new line now. + +* Fix formatting of `Authors@R` fields, when changed. + +* Keep trailing space after the `:` character, see #14 + +# 1.0.0 + +First public release. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/R/desc b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/R/desc new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/R/desc @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/R/desc.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/R/desc.rdb new file mode 100644 index 00000000..db91ced8 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/R/desc.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/R/desc.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/R/desc.rdx new file mode 100644 index 00000000..6b6f2d95 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/R/desc.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/WORDLIST b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/WORDLIST new file mode 100644 index 00000000..c99ed0a5 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/WORDLIST @@ -0,0 +1,17 @@ +BitBucket +CMD +Codecov +IETF +Lifecycle +LinkingTo +ORCID +PBC +RStudio +Renviron +behaviour +dep +desc's +env +funder +orcid +subtag diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/help/AnIndex new file mode 100644 index 00000000..8aef6f41 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/help/AnIndex @@ -0,0 +1,62 @@ +desc-package desc-package +check_encoding check_encoding +check_field check_field +cran_ascii_fields cran_ascii_fields +cran_valid_fields cran_valid_fields +dep_types dep_types +desc desc +description description +desc_add_author desc_add_author +desc_add_author_gh desc_add_author_gh +desc_add_me desc_add_me +desc_add_orcid desc_add_orcid +desc_add_remotes desc_add_remotes +desc_add_role desc_add_role +desc_add_to_collate desc_add_to_collate +desc_add_urls desc_add_urls +desc_bump_version desc_bump_version +desc_change_maintainer desc_change_maintainer +desc_clear_remotes desc_clear_remotes +desc_clear_urls desc_clear_urls +desc_coerce_authors_at_r desc_coerce_authors_at_r +desc_del desc_del +desc_del_author desc_del_author +desc_del_collate desc_del_collate +desc_del_dep desc_del_dep +desc_del_deps desc_del_deps +desc_del_from_collate desc_del_from_collate +desc_del_remotes desc_del_remotes +desc_del_role desc_del_role +desc_del_urls desc_del_urls +desc_fields desc_fields +desc_get desc_get +desc_get_author desc_get_author +desc_get_authors desc_get_authors +desc_get_built desc_get_built +desc_get_collate desc_get_collate +desc_get_deps desc_get_deps +desc_get_field desc_get_field +desc_get_list desc_get_field +desc_get_maintainer desc_get_maintainer +desc_get_or_fail desc_get_field +desc_get_remotes desc_get_remotes +desc_get_urls desc_get_urls +desc_get_version desc_get_version +desc_has_dep desc_has_dep +desc_has_fields desc_has_fields +desc_normalize desc_normalize +desc_print desc_print +desc_reformat_fields desc_reformat_fields +desc_reorder_fields desc_reorder_fields +desc_set desc_set +desc_set_authors desc_set_authors +desc_set_collate desc_set_collate +desc_set_dep desc_set_dep +desc_set_deps desc_set_deps +desc_set_list desc_set +desc_set_remotes desc_set_remotes +desc_set_urls desc_set_urls +desc_set_version desc_set_version +desc_to_latex desc_to_latex +desc_validate desc_validate +_PACKAGE desc-package diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/help/aliases.rds new file mode 100644 index 00000000..f7337fa3 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/help/desc.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/help/desc.rdb new file mode 100644 index 00000000..9048ab49 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/help/desc.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/help/desc.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/help/desc.rdx new file mode 100644 index 00000000..64ce5821 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/help/desc.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/help/paths.rds new file mode 100644 index 00000000..007ddc2c Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/html/00Index.html new file mode 100644 index 00000000..7c414ca4 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/html/00Index.html @@ -0,0 +1,144 @@ + + +R: Manipulate DESCRIPTION Files + + + +
+

Manipulate DESCRIPTION Files + +

+
+
+[Up] +[Top] +

Documentation for package ‘desc’ version 1.4.3

+ + + +

Help Pages

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
check_fieldSyntactical check of a DESCRIPTION field
cran_ascii_fieldsThe DESCRIPTION fields that are supposed to be in plain ASCII encoding
cran_valid_fieldsA list of DESCRIPTION fields that are valid according to the CRAN checks
dep_typesDESCRIPTION fields that denote package dependencies
descRead a DESCRIPTION file
descriptionRead, write, update, validate DESCRIPTION files
desc_add_authorAdd an author to Authors@R in DESCRIPTION
desc_add_author_ghAdd a GitHub user as an author to DESCRIPTION
desc_add_meAdd the current user as an author to DESCRIPTION
desc_add_orcidAdd an ORCID to one or more authors in Authors@R, in DESCRIPTION
desc_add_remotesAdd locations in the Remotes field in DESCRIPTION
desc_add_roleAdd a role to one or more authors in Authors@R, in DESCRIPTION
desc_add_to_collateAdd one or more files to the Collate field, in DESCRIPTION
desc_add_urlsAdd URLs to the URL field in DESCRIPTION
desc_bump_versionIncrease the version number in DESCRIPTION
desc_change_maintainerChange maintainer of the package, in DESCRIPTION
desc_clear_remotesRemove all locations from the Remotes field of DESCRIPTION
desc_clear_urlsRemove all URLs from the URL field of DESCRIPTION
desc_coerce_authors_at_rCoerce Author and Maintainer Fields to Authors@R
desc_delRemove fields from a DESCRIPTION file
desc_del_authorRemove one or more authors from DESCRIPTION.
desc_del_collateDelete the Collate field from DESCRIPTION
desc_del_depRemove a package dependency from DESCRIPTION
desc_del_depsRemove all dependencies from DESCRIPTION
desc_del_from_collateRemove files from the Collate field.
desc_del_remotesDelete locations from the Remotes field in DESCRIPTION
desc_del_roleDelete a role of an author, in DESCRIPTION
desc_del_urlsDelete URLs from the URL field in DESCRIPTION
desc_fieldsList all fields in a DESCRIPTION file
desc_getGet a field from a DESCRIPTION file
desc_get_authorQuery authors by role in Authors@R, in DESCRIPTION
desc_get_authorsQuery all authors in Authors@R, in DESCRIPTION
desc_get_builtQuery the built field in DESCRIPTION
desc_get_collateQuery the Collate field in DESCRIPTION
desc_get_depsList all package dependencies from a DESCRIPTION file
desc_get_fieldGet a single field from a DESCRIPTION file, fail if not found
desc_get_listGet a single field from a DESCRIPTION file, fail if not found
desc_get_maintainerQuery the package maintainer in DESCRIPTION
desc_get_or_failGet a single field from a DESCRIPTION file, fail if not found
desc_get_remotesList the locations in the Remotes field in DESCRIPTION
desc_get_urlsQuery the URL field in DESCRIPTION
desc_get_versionQuery the package version in DESCRIPTION
desc_has_depCheck for a dependency
desc_has_fieldsCheck if some fields are present in a DESCRIPTION file
desc_normalizeNormalize a DESCRIPTION file
desc_printPrint the contents of a DESCRIPTION file to the screen
desc_reformat_fieldsReformat fields in a DESCRIPTION file
desc_reorder_fieldsReorder fields in a DESCRIPTION file
desc_setSet one or more fields in a DESCRIPTION file
desc_set_authorsSet authors in Authors@R, in DESCRIPTION
desc_set_collateSet the Collate field in DESCRIPTION
desc_set_depAdd a package dependency to a DESCRIPTION file
desc_set_depsSet all package dependencies in DESCRIPTION
desc_set_listSet one or more fields in a DESCRIPTION file
desc_set_remotesSet the Remotes field in DESCRIPTION
desc_set_urlsSet the URL field in DESCRIPTION
desc_set_versionSet the package version in DESCRIPTION
desc_to_latexConverts a DESCRIPTION file to LaTeX
desc_validateValidate a DESCRIPTION file
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/desc/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/DESCRIPTION new file mode 100644 index 00000000..e8c2a28a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/DESCRIPTION @@ -0,0 +1,54 @@ +Type: Package +Package: evaluate +Title: Parsing and Evaluation Tools that Provide More Details than the + Default +Version: 1.0.3 +Authors@R: c( + person("Hadley", "Wickham", , "hadley@posit.co", role = c("aut", "cre")), + person("Yihui", "Xie", role = "aut", + comment = c(ORCID = "0000-0003-0645-5666")), + person("Michael", "Lawrence", role = "ctb"), + person("Thomas", "Kluyver", role = "ctb"), + person("Jeroen", "Ooms", role = "ctb"), + person("Barret", "Schloerke", role = "ctb"), + person("Adam", "Ryczkowski", role = "ctb"), + person("Hiroaki", "Yutani", role = "ctb"), + person("Michel", "Lang", role = "ctb"), + person("Karolis", "Koncevičius", role = "ctb"), + person("Posit Software, PBC", role = c("cph", "fnd")) + ) +Description: Parsing and evaluation tools that make it easy to recreate + the command line behaviour of R. +License: MIT + file LICENSE +URL: https://evaluate.r-lib.org/, https://github.com/r-lib/evaluate +BugReports: https://github.com/r-lib/evaluate/issues +Depends: R (>= 3.6.0) +Suggests: callr, covr, ggplot2 (>= 3.3.6), lattice, methods, pkgload, + rlang, knitr, testthat (>= 3.0.0), withr +Config/Needs/website: tidyverse/tidytemplate +Config/testthat/edition: 3 +Encoding: UTF-8 +RoxygenNote: 7.3.2 +NeedsCompilation: no +Packaged: 2025-01-10 22:27:28 UTC; hadleywickham +Author: Hadley Wickham [aut, cre], + Yihui Xie [aut] (), + Michael Lawrence [ctb], + Thomas Kluyver [ctb], + Jeroen Ooms [ctb], + Barret Schloerke [ctb], + Adam Ryczkowski [ctb], + Hiroaki Yutani [ctb], + Michel Lang [ctb], + Karolis Koncevičius [ctb], + Posit Software, PBC [cph, fnd] +Maintainer: Hadley Wickham +Repository: CRAN +Date/Publication: 2025-01-10 23:00:02 UTC +Built: R 4.4.1; ; 2025-02-01 04:44:25 UTC; unix +RemoteType: standard +RemotePkgRef: evaluate +RemoteRef: evaluate +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 1.0.3 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/INDEX new file mode 100644 index 00000000..19c1d8d0 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/INDEX @@ -0,0 +1,11 @@ +evaluate Evaluate input and return all details of + evaluation +flush_console An emulation of 'flush.console()' in + 'evaluate()' +local_reproducible_output + Control common output options +new_output_handler Custom output handlers +parse_all Parse, retaining comments +replay Replay a list of evaluated results +trim_intermediate_plots + Trim away intermediate plots diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/LICENSE new file mode 100644 index 00000000..24fa4d1a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2023 +COPYRIGHT HOLDER: evaluate authors diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/Meta/Rd.rds new file mode 100644 index 00000000..afa875fd Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/Meta/hsearch.rds new file mode 100644 index 00000000..cf01fd20 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/Meta/links.rds new file mode 100644 index 00000000..968cf178 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/Meta/nsInfo.rds new file mode 100644 index 00000000..a51a6093 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/Meta/package.rds new file mode 100644 index 00000000..cbe07b1c Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/NAMESPACE new file mode 100644 index 00000000..ae072e2d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/NAMESPACE @@ -0,0 +1,34 @@ +# Generated by roxygen2: do not edit by hand + +S3method("[",evaluate_evaluation) +S3method(parse_all,"function") +S3method(parse_all,call) +S3method(parse_all,character) +S3method(parse_all,connection) +S3method(print,evaluate_evaluation) +S3method(replay,character) +S3method(replay,condition) +S3method(replay,default) +S3method(replay,list) +S3method(replay,recordedplot) +S3method(replay,source) +export(create_traceback) +export(evaluate) +export(flush_console) +export(inject_funs) +export(is.error) +export(is.message) +export(is.recordedplot) +export(is.source) +export(is.warning) +export(local_reproducible_output) +export(new_output_handler) +export(parse_all) +export(remove_hooks) +export(replay) +export(set_hooks) +export(trim_intermediate_plots) +export(try_capture_stack) +import(grDevices) +import(graphics) +import(utils) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/NEWS.md new file mode 100644 index 00000000..f9364a2c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/NEWS.md @@ -0,0 +1,279 @@ +# evaluate 1.0.3 + +# evaluate 1.0.2 + +* Restore correct traceback behaviour (#232). + +# evaluate 1.0.1 + +* Fix buglet revealed when using `rlang::abort()` inside of `evaluate()`. + +# evaluate 1.0.0 + +* Setting `ACTIONS_STEP_DEBUG=1` (as in a failing GHA workflow) will + automatically set `log_echo` and `log_warning` to `TRUE` (#175). + +* evaluate works on R 3.6.0 once again. + +* `evaluate()` improvements: + + * Now terminates on the first error in a multi-expression input, i.e. + `1;stop('2');3` will no longer evaluate the third component. This + matches console behaviour more closely. + + * Calls from conditions emitted by top-level code are automatically stripped + (#150). + + * Result has a class (`evaluate_evaluation`/`list`) with a basic print method. + + * Plots created before messages/warnings/errors are correctly captured (#28). + +* Handler improvements: + + * The default `value` handler now evaluates `print()` in a child of the + evaluation environment. This largely makes evaluate easier to test, but + should make defining S3 methods for print a little easier (#192). + + * The `source` output handler is now passed the entire complete input + expression, not just the first component. + +* `evalute(include_timing)` has been deprecated. I can't find any use of it on + GitHub, and it adds substantial code complexity for little gain. + +* `is.value()` has been removed since it tests for an object that evaluate + never creates. + +* New `local_reproducible_output()` helper that sets various options and env + vars to help ensure consistency of output across environments. + +* `parse_all()` adds a `\n` to the end of every line, even the last one if it + didn't have one in the input. Additionally, it no longer has a default + method, which will generate better errors if you pass in something unexpected. + +* New `trim_intermediate_plots()` drops intermediate plots to reveal the + complete/final plot (#206). + +* `watchout()` is no longer exported; it's really an implementation detail that + should never have been leaked to the public interface. + +# evaluate 0.24.0 + +* The `source` output handler can now take two arguments (the unparsed `src` + and the parsed `call`) and choose to affect the displayed source. +* The package now depends on R 4.0.0 in order to decrease our maintenance burden. + +# Version 0.23 + +- Prevent existing plots from leaking into `evaluate()` results (thanks, @dmurdoch, yihui/knitr#2297). + +- If the environment variable `R_EVALUATE_BYPASS_MESSAGES` is set to true, the arguments `keep_message` and `keep_warning` of `evaluate()` will be set to `NA`, regardless of user input, which means messages and warnings will not be captured by `evaluate()`. This provides a possibility to force logging messages and warnings (thanks, @slodge, yihui/yihui.org#1458). + +# Version 0.22 + +- Fixed a problem in the internal function `plot_calls()` that made the examples of `recordGraphics` fail to run on its help page (thanks, Kurt Hornik). + +# Version 0.21 + +- `evaluate()` gains `log_echo` and `log_warning` arguments. When set to `TRUE` + these cause code and warnings (respectively) to be immediately emitted to + `stderr()`. This is useful for logging in unattended environments (#118). + +- Improved the error message when users accidentally called `closeAllConnections()` (thanks, @guslipkin, quarto-dev/quarto-cli#5214). + +# Version 0.20 + +- The arguments `keep_message` and `keep_warning` of `evaluate()` can take the value `NA` now, which means `evaluate()` will not capture the messages and they will be sent to the console. This is equivalent to the `FALSE` value before v0.19 (thanks, @gadenbuie, https://github.com/yihui/yihui.org/discussions/1458). + +# Version 0.19 + +- In `evaluate()`, `keep_message` and `keep_warning` will completely drop messages and warnings, respectively, when their values are `FALSE`. Previously messages would still be emitted (to the console) even if they take `FALSE` values. + +- Fixed the bug that `parse_all()` fails with line directives (thanks, @ArcadeAntics, #114). + +# Version 0.18 + +- Fixed tests that were still using the deprecated `ggplot2::qplot()`. + +# Version 0.17 + +- Adapted a unit test to the next version of **ggplot2** (thanks, @thomasp85, #113). + +# Version 0.16 + +- Fixed a bug that an empty **ggplot2** plot could be recorded and incorrectly saved (thanks, @sjspielman, rstudio/rmarkdown#2363). + +# Version 0.15 + +- `new_output_handler()` gains a `calling_handlers` argument. These are passed to `withCallingHandlers()` before `evaluate()` captures any conditions. + +- Fixed #106: do not assume that `is.atomic(NULL)` returns `TRUE` (thanks, @mmaechler). + +# Version 0.14 + +- The hooks `persp`, `before.plot.new`, and `before.grid.newpage` set by users will be respected throughout the R session (thanks, @KKPMW, #96). + +# Version 0.13 + +- Errors generated by try() are now part of the output (for R >= 3.4). To achieve this, the try.outFile option is set for the duration of all evaluations (thanks, @krlmlr, #91) + +# Version 0.12 + +- Removed the stringr dependency (thanks, @mllg, #90). + +# Version 0.11 + +- Fix for regression introduced in 0.10.1 in parse_all.call() (fixes #77) + +- evaluate() now respects options(warn >= 2); all warnings are turned into errors (#81) + +# Version 0.10.1 + +- Added parse_all.call() method to use the original source for evaluating call objects (because base::deparse() breaks non-ascii source code) (fixes #74) + +# Version 0.10 + +- Added option for the evaluate function to include timing information of ran commands. This information will be subsequently rendered by the replay. Example usage: evaluate::replay(evaluate::evaluate('Sys.sleep(1)', include_timing = TRUE)) + +- Added a new function `flush_console()` to emulate `flush.console()` in `evaluate()` (#61). + +- Added a `inject_funs()` function to create functions in the environment passed to the `envir` argument of `evaluate()`. + +# Version 0.9 + +- Added an argument `allow_error` to `parse_all()` to allow syntactical errors in R source code when `allow_error = TRUE`; this means `evaluate(stop_on_error = 0 or 1)` will no longer stop on syntactical errors but returns a list of source code and the error object instead. This can be useful to show syntactical errors for pedagogical purposes. + +# Version 0.8.3 + +- Added an argument `filename` to evaluate() and parse_all() (thanks, @flying-sheep, #58). + +# Version 0.8 + +- Changed package license to MIT. + +# Version 0.7.2 + +- replay() fails to replay certain objects such as NULL (#53). + +# Version 0.7 + +- R 3.0.2 is the minimal required version for this package now. + +# Version 0.6 + +- Plots are no longer recorded when the current graphical device has been changed, which may introduce issues like yihui/knitr#824. + +- `parse_all()` can parse R code that contains multibyte characters correctly now (#49, yihui/knitr#988) + +# Version 0.5.5 + +- Actually use the `text` and `graphics` in `new_output_handler` + +- Multiple expressions separated by `;` on the same line can be printed as expected when the result returned is visible, e.g. both `x` and `y` will be printed when the source code is `x; y`. In previous versions, only `y` is printed. (thanks, Bill Venables) + +# Version 0.5.3 + +## BUG FIXES + +- fixed the bug reported at https://github.com/yihui/knitr/issues/722 (repeatedly knitting the same code results in plots being omitted randomly) (thanks, Simon Urbanek) + +# Version 0.5.1 + +## BUG FIXES + +- under R 2.15.x, evaluate() was unable to filter out the plots triggered by clip() (thanks, Uwe Ligges) + +# Version 0.5 + +## NEW FEATURES + +- evaluate() is better at telling if a new plot should render a new page due to the new par('page') in R 3.0.2 + +## BUG FIXES + +- fixed yihui/knitr#600: when the last expression in the code is a comment, the previous incomplete plot was not captured + +- the empty plots produced by strwidth(), strheight(), and clip() are no longer recorded + +## MAJOR CHANGES + +- evaluate() no longer records warnings in case of options(warn = -1); see yihui/knitr#610 + +- for 'output_handler' in evaluate(), visible values from the 'value' handler will be saved to the output list; this makes it possible for users to save the original values instead of their printed side effects; this change will not affect those who use the default output handlers (#40, thanks, Gabriel Becker) + +- the 'value' handler in new_output_handler() may take an additional argument that means if the value is visible or not; this makes it possible to save the invisible values as well (#41, thanks, Joroen Ooms) + +# Version 0.4.7 + +## NEW FEATURES + +- added two arguments keep_warning and keep_message in evaluate() so that it is possible not to capture warnings or messages now + +## BUG FIXES + +- fixed #25: plots can be correctly recorded under a complex layout now (#25, thanks, Jack Tanner and Andy Barbour) + +- fixed yihui/knitr#582: evaluate() misclassified some plot changes as "par changes" and removed some plots when it should not; now it is better at identifying plot changes dur to par() (thanks, Keith Twombley) + +# Version 0.4.4 + +## BUG FIXES + +- Perspective plots from `persp()` are captured now (thanks to Harvey Lime and Yihui Xie) + +- If an error occurs during printing a visible value, evaluate will halt on a cryptic error "operator is invalid for atomic vectors" (#26, fixed by Yihui Xie) + +- If the internal connection was accidentally closed by the user, a more informative message will show up (#23) + +- Now the graphical device will always try to record graphics by default (when new_device = TRUE) (#34) + +- Some empty and incomplete plots caused by par() or layout() will be filtered out correctly for R 3.0 (#35) + +## MAINTAINENCE + +- Yihui Xie is the new maintainer of this package now + +# Version 0.4.3 + +## NEW FEATURES + +- Added `output_handler` argument to `evaluate`. Should be a `output_handler` object, which is a list of functions for handling each type of result, prior to printing of visible return values. This allows clients to override the console-like printing of values, while still processing them in the correct temporal context. The other handlers are necessary to convey the correct ordering of the output. This essentially provides stream-based processing, as an alternative to the existing deferred processing. + +- New option, `stop_on_error` which controls behaviour when errors occur. The default value, `0`, acts like you've copied and pasted the code into the console, and continues to execute all code. `1` will stop the code execution and return the results of evaluation up to that point, and `2` will raise an error. + +## BUG FIXES + +- Compound expressions like `x <- 10; x` are now evaluated completely. + +- Chinese characters on windows now work correctly (thanks to Yihui Xie) + +- Graphics and output interleaved correctly when generated from a loop or other compound statements + +- By default, `evaluate` will now open a new graphics device and clean it up afterwards. To suppress that behaviour use `new_device = FALSE` + +- use `show` to display S4 objects. + +# Version 0.4.2 + +- replace deprecated `.Internal(eval.with.vis)` with correct `withVisible` + +- `evaluate` gains `debug` argument + +# Version 0.4.1 + +- use `test_package` to avoid problems with latest version of `testthat` + +# Version 0.4 + +- Use plot hooks to capture multiple plots created in a loop or within a function. (Contributed by Yihui Xie) + +# Version 0.3 + +- Import `stringr` instead of depending on it. + +- Test plot recording only in the presence of interactive devices. + +# Version 0.2 + +- try_capture_stack and create_traceback do a much better job of removing infrastructure calls from the captured traceback + +- visible results are automatically evaluated and their outputs are captured. This is particularly important for lattice and ggplot graphics, which otherwise require special handling. It also correctly captures warnings, errors and messages raised by the print method. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/R/evaluate b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/R/evaluate new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/R/evaluate @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/R/evaluate.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/R/evaluate.rdb new file mode 100644 index 00000000..7c9984e6 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/R/evaluate.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/R/evaluate.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/R/evaluate.rdx new file mode 100644 index 00000000..cb5266f0 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/R/evaluate.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/help/AnIndex new file mode 100644 index 00000000..384454ca --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/help/AnIndex @@ -0,0 +1,20 @@ +evaluate-package evaluate-package +create_traceback create_traceback +evaluate evaluate +flush_console flush_console +inject_funs inject_funs +is.error is.message +is.message is.message +is.recordedplot is.message +is.source is.message +is.warning is.message +line_prompt line_prompt +local_reproducible_output local_reproducible_output +new_output_handler new_output_handler +output_handler new_output_handler +parse_all parse_all +remove_hooks set_hooks +replay replay +set_hooks set_hooks +trim_intermediate_plots trim_intermediate_plots +try_capture_stack try_capture_stack diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/help/aliases.rds new file mode 100644 index 00000000..ecc9396d Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/help/evaluate.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/help/evaluate.rdb new file mode 100644 index 00000000..894deef6 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/help/evaluate.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/help/evaluate.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/help/evaluate.rdx new file mode 100644 index 00000000..8305b606 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/help/evaluate.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/help/paths.rds new file mode 100644 index 00000000..a9a0ddb6 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/html/00Index.html new file mode 100644 index 00000000..78d2a0ef --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/html/00Index.html @@ -0,0 +1,44 @@ + + +R: Parsing and Evaluation Tools that Provide More Details than the +Default + + + +
+

Parsing and Evaluation Tools that Provide More Details than the +Default + +

+
+
+[Up] +[Top] +

Documentation for package ‘evaluate’ version 1.0.3

+ + + +

Help Pages

+ + + + + + + + + + + + + + + + + + + +
evaluateEvaluate input and return all details of evaluation
flush_consoleAn emulation of 'flush.console()' in 'evaluate()'
local_reproducible_outputControl common output options
new_output_handlerCustom output handlers
output_handlerCustom output handlers
parse_allParse, retaining comments
replayReplay a list of evaluated results
trim_intermediate_plotsTrim away intermediate plots
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/evaluate/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/COPYRIGHTS b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/COPYRIGHTS new file mode 100644 index 00000000..912533e3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/COPYRIGHTS @@ -0,0 +1,517 @@ +This package is provided you under the terms of the GNU General Public License +version 3. + +Included below is license and copyright information for externally maintained +libraries used by fs. All other code in fs is copyright RStudio, Inc. + +libuv is licensed for use as follows: + +==== +Copyright (c) 2015-present libuv project contributors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +==== + +This license applies to parts of libuv originating from the +https://github.com/joyent/libuv repository: + +==== + +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. + +==== + +This license applies to all parts of libuv that are not externally +maintained libraries. + +The externally maintained libraries used by libuv are: + + - tree.h (from FreeBSD), copyright Niels Provos. Two clause BSD license. + + - inet_pton and inet_ntop implementations, contained in src/inet.c, are + copyright the Internet Systems Consortium, Inc., and licensed under the ISC + license. + + - stdint-msvc2008.h (from msinttypes), copyright Alexander Chemeris. Three + clause BSD license. + + - pthread-fixes.c, copyright Google Inc. and Sony Mobile Communications AB. + Three clause BSD license. + + - android-ifaddrs.h, android-ifaddrs.c, copyright Berkeley Software Design + Inc, Kenneth MacKay and Emergya (Cloud4all, FP7/2007-2013, grant agreement + n° 289016). Three clause BSD license. + +Additional copyrights in libuv which do not appear above: + +Copyright Fedor Indutny. All rights reserved. +Copyright (c) 2015 Saúl Ibarra Corretgé . +Copyright (c) 2013, Ben Noordhuis +Copyright StrongLoop, Inc. +Copyright (c) 2016, Kari Tristan Helgason + +The files in src/bsd are from libbsd (https://cgit.freedesktop.org/libbsd) and +use one of the following licenses: + +The rest of the licenses apply to code and/or man pages. + + + Copyright © 2004-2006, 2008-2013 Guillem Jover + Copyright © 2005 Hector Garcia Alvarez + Copyright © 2005 Aurelien Jarno + Copyright © 2006 Robert Millan + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + -- + + Copyright © 1980, 1982, 1986, 1989-1994 + The Regents of the University of California. All rights reserved. + Copyright © 2001 Mike Barcroft + + Some code is derived from software contributed to Berkeley by + the American National Standards Committee X3, on Information + Processing Systems. + + Some code is derived from software contributed to Berkeley by + Peter McIlroy. + + Some code is derived from software contributed to Berkeley by + Ronnie Kon at Mindcraft Inc., Kevin Lew and Elmer Yglesias. + + Some code is derived from software contributed to Berkeley by + Dave Borman at Cray Research, Inc. + + Some code is derived from software contributed to Berkeley by + Paul Vixie. + + Some code is derived from software contributed to Berkeley by + Chris Torek. + + © UNIX System Laboratories, Inc. + All or some portions of this file are derived from material licensed + to the University of California by American Telephone and Telegraph + Co. or Unix System Laboratories, Inc. and are reproduced herein with + the permission of UNIX System Laboratories, Inc. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + -- + + Copyright © 1996 Peter Wemm . + All rights reserved. + Copyright © 2002 Networks Associates Technology, Inc. + All rights reserved. + + Portions of this software were developed for the FreeBSD Project by + ThinkSec AS and NAI Labs, the Security Research Division of Network + Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 + ("CBOSS"), as part of the DARPA CHATS research program. + + Redistribution and use in source and binary forms, with or without + modification, is permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + -- + + Copyright © 1995 Peter Wemm + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, is permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice immediately at the beginning of the file, without modification, + this list of conditions, and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. This work was done expressly for inclusion into FreeBSD. Other use + is permitted provided this notation is included. + 4. Absolutely no warranty of function or purpose is made by the author + Peter Wemm. + 5. Modifications may be freely made to this file providing the above + conditions are met. + + -- + + Copyright © 1994, 1997-2000, 2002, 2008 The NetBSD Foundation, Inc. + All rights reserved. + + Some code was contributed to The NetBSD Foundation by Allen Briggs. + + Some code was contributed to The NetBSD Foundation by Luke Mewburn. + + Some code is derived from software contributed to The NetBSD Foundation + by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, + NASA Ames Research Center, by Luke Mewburn and by Tomas Svensson. + + Some code is derived from software contributed to The NetBSD Foundation + by Julio M. Merino Vidal, developed as part of Google's Summer of Code + 2005 program. + + Some code is derived from software contributed to The NetBSD Foundation + by Christos Zoulas. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + -- + + Copyright © 1998, M. Warner Losh + All rights reserved. + + Copyright © 2001 Dima Dorfman. + All rights reserved. + + Copyright © 2001 FreeBSD Inc. + All rights reserved. + + Copyright © 2002 Thomas Moestl + All rights reserved. + + Copyright © 2005 Pawel Jakub Dawidek + All rights reserved. + + Copyright © 2007 Eric Anderson + Copyright © 2007 Pawel Jakub Dawidek + All rights reserved. + + Copyright © 2007 Dag-Erling Coïdan Smørgrav + All rights reserved. + + Copyright © 2009 Advanced Computing Technologies LLC + Written by: John H. Baldwin + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + -- + + Copyright © 1997 Christos Zoulas. + All rights reserved. + + Copyright © 2002 Niels Provos + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + -- + + Copyright © 2007 Dag-Erling Coïdan Smørgrav + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer + in this position and unchanged. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + -- + + Copyright © 1998, 2000 Todd C. Miller + Copyright © 2004 Ted Unangst + + Copyright © 2004 Ted Unangst and Todd Miller + All rights reserved. + + Copyright © 2008 Otto Moerbeek + + Permission to use, copy, modify, and distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + -- + + Copyright © 2000-2002, 2004-2005, 2007, 2010 + Todd C. Miller + + Permission to use, copy, modify, and distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + Sponsored in part by the Defense Advanced Research Projects + Agency (DARPA) and Air Force Research Laboratory, Air Force + Materiel Command, USAF, under agreement number F39502-99-1-0512 + + -- + + Copyright © 1996 by Internet Software Consortium. + + Permission to use, copy, modify, and distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + SOFTWARE. + + -- + + Copyright © 1996, David Mazieres + Copyright © 2008, Damien Miller + + Permission to use, copy, modify, and distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + Modification and redistribution in source and binary forms is + permitted provided that due credit is given to the author and the + OpenBSD project (for instance by leaving this copyright notice + intact). + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + This code is derived from section 17.1 of Applied Cryptography, + second edition, which describes a stream cipher allegedly + compatible with RSA Labs "RC4" cipher (the actual description of + which is a trade secret). The same algorithm is used as a stream + cipher called "arcfour" in Tatu Ylonen's ssh package. + + Here the stream cipher has been modified always to include the time + when initializing the state. That makes it impossible to + regenerate the same random sequence twice, so this can't be used + for encryption, but will generate good random numbers. + + RC4 is a registered trademark of RSA Laboratories. + + -- + + Copyright © 2010 William Ahern + Copyright © 2012 Guillem Jover + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. + + -- + + This code implements the MD5 message-digest algorithm. + The algorithm is due to Ron Rivest. This code was + written by Colin Plumb in 1993, no copyright is claimed. + This code is in the public domain; do with it what you wish. + + Equivalent code is available from RSA Data Security, Inc. + This code has been tested against that, and is equivalent, + except that you don't need to include two pages of legalese + with every copy. + + To compute the message digest of a chunk of bytes, declare an + MD5Context structure, pass it to MD5Init, call MD5Update as + needed on buffers full of bytes, and then call MD5Final, which + will fill a supplied 16-byte array with the digest. + + -- + + "THE BEER-WARE LICENSE" (Revision 42): + wrote this file. As long as you retain this notice you + can do whatever you want with this stuff. If we meet some day, and you think + this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/DESCRIPTION new file mode 100644 index 00000000..45936cd1 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/DESCRIPTION @@ -0,0 +1,50 @@ +Package: fs +Title: Cross-Platform File System Operations Based on 'libuv' +Version: 1.6.5 +Authors@R: c( + person("Jim", "Hester", role = "aut"), + person("Hadley", "Wickham", , "hadley@posit.co", role = "aut"), + person("Gábor", "Csárdi", , "csardi.gabor@gmail.com", role = c("aut", "cre")), + person("libuv project contributors", role = "cph", + comment = "libuv library"), + person("Joyent, Inc. and other Node contributors", role = "cph", + comment = "libuv library"), + person("Posit Software, PBC", role = c("cph", "fnd")) + ) +Description: A cross-platform interface to file system operations, built + on top of the 'libuv' C library. +License: MIT + file LICENSE +URL: https://fs.r-lib.org, https://github.com/r-lib/fs +BugReports: https://github.com/r-lib/fs/issues +Depends: R (>= 3.6) +Imports: methods +Suggests: covr, crayon, knitr, pillar (>= 1.0.0), rmarkdown, spelling, + testthat (>= 3.0.0), tibble (>= 1.1.0), vctrs (>= 0.3.0), withr +VignetteBuilder: knitr +ByteCompile: true +Config/Needs/website: tidyverse/tidytemplate +Config/testthat/edition: 3 +Copyright: file COPYRIGHTS +Encoding: UTF-8 +Language: en-US +RoxygenNote: 7.2.3 +SystemRequirements: GNU make +NeedsCompilation: yes +Packaged: 2024-10-28 22:30:40 UTC; gaborcsardi +Author: Jim Hester [aut], + Hadley Wickham [aut], + Gábor Csárdi [aut, cre], + libuv project contributors [cph] (libuv library), + Joyent, Inc. and other Node contributors [cph] (libuv library), + Posit Software, PBC [cph, fnd] +Maintainer: Gábor Csárdi +Repository: CRAN +Date/Publication: 2024-10-30 08:40:02 UTC +Built: R 4.4.1; aarch64-apple-darwin20; 2025-01-25 21:01:57 UTC; unix +Archs: fs.so.dSYM +RemoteType: standard +RemotePkgRef: fs +RemoteRef: fs +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 1.6.5 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/INDEX new file mode 100644 index 00000000..64fe8bde --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/INDEX @@ -0,0 +1,31 @@ +copy Copy files, directories or links +create Create files, directories, or links +delete Delete files, directories, or links +dir_ls List files +dir_tree Print contents of directories in a tree-like + format +file_access Query for existence and access permissions +file_chmod Change file permissions +file_chown Change owner or group of a file +file_info Query file metadata +file_move Move or rename files +file_show Open files or directories +file_temp Create names for temporary files +file_touch Change file access and modification times +fs_bytes Human readable file sizes +fs_path File paths +fs_perms Create, modify and view file permissions +id Lookup Users and Groups on a system +is_absolute_path Test if a path is an absolute path +is_file Functions to test for file types +link_path Read the value of a symbolic link +path Construct path to a file or directory +path_expand Finding the User Home Directory +path_file Manipulate file paths +path_filter Filter paths +path_math Path computations +path_package Construct a path to a location within an + installed or development package +path_sanitize Sanitize a filename by removing directory paths + and invalid characters +path_tidy Tidy paths diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/LICENSE new file mode 100644 index 00000000..f8954bd0 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2023 +COPYRIGHT HOLDER: fs authors diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/Meta/Rd.rds new file mode 100644 index 00000000..4f7a54d9 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/Meta/hsearch.rds new file mode 100644 index 00000000..06399977 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/Meta/links.rds new file mode 100644 index 00000000..52614787 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/Meta/nsInfo.rds new file mode 100644 index 00000000..b0895cd3 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/Meta/package.rds new file mode 100644 index 00000000..eee8a596 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/Meta/vignette.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/Meta/vignette.rds new file mode 100644 index 00000000..2256e151 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/Meta/vignette.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/NAMESPACE new file mode 100644 index 00000000..0977860b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/NAMESPACE @@ -0,0 +1,109 @@ +# Generated by roxygen2: do not edit by hand + +S3method("!",fs_perms) +S3method("&",fs_perms) +S3method("+",fs_path) +S3method("/",fs_path) +S3method("==",fs_perms) +S3method("[",fs_bytes) +S3method("[",fs_path) +S3method("[",fs_perms) +S3method("[[",fs_bytes) +S3method("[[",fs_path) +S3method("[[",fs_perms) +S3method("|",fs_perms) +S3method(Ops,fs_bytes) +S3method(as.character,fs_bytes) +S3method(as.character,fs_perms) +S3method(as_fs_bytes,default) +S3method(as_fs_bytes,fs_bytes) +S3method(as_fs_bytes,numeric) +S3method(as_fs_path,"NULL") +S3method(as_fs_path,character) +S3method(as_fs_perms,"NULL") +S3method(as_fs_perms,character) +S3method(as_fs_perms,fs_perms) +S3method(as_fs_perms,integer) +S3method(as_fs_perms,numeric) +S3method(as_fs_perms,octmode) +S3method(format,fs_bytes) +S3method(format,fs_perms) +S3method(max,fs_bytes) +S3method(min,fs_bytes) +S3method(print,fs_bytes) +S3method(print,fs_path) +S3method(print,fs_perms) +S3method(sum,fs_bytes) +S3method(xtfrm,fs_path) +export("path_ext<-") +export(as_fs_bytes) +export(as_fs_path) +export(as_fs_perms) +export(dir_copy) +export(dir_create) +export(dir_delete) +export(dir_exists) +export(dir_info) +export(dir_ls) +export(dir_map) +export(dir_tree) +export(dir_walk) +export(file_access) +export(file_chmod) +export(file_chown) +export(file_copy) +export(file_create) +export(file_delete) +export(file_exists) +export(file_info) +export(file_move) +export(file_show) +export(file_size) +export(file_temp) +export(file_temp_pop) +export(file_temp_push) +export(file_touch) +export(fs_bytes) +export(fs_path) +export(fs_perms) +export(group_ids) +export(is_absolute_path) +export(is_dir) +export(is_file) +export(is_file_empty) +export(is_link) +export(link_copy) +export(link_create) +export(link_delete) +export(link_exists) +export(link_path) +export(path) +export(path_abs) +export(path_common) +export(path_dir) +export(path_expand) +export(path_expand_r) +export(path_ext) +export(path_ext_remove) +export(path_ext_set) +export(path_file) +export(path_filter) +export(path_has_parent) +export(path_home) +export(path_home_r) +export(path_join) +export(path_norm) +export(path_package) +export(path_real) +export(path_rel) +export(path_sanitize) +export(path_split) +export(path_temp) +export(path_tidy) +export(path_wd) +export(user_ids) +importFrom(methods,setOldClass) +importFrom(stats,na.omit) +importFrom(stats,setNames) +importFrom(utils,browseURL) +useDynLib(fs, .registration = TRUE) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/NEWS.md new file mode 100644 index 00000000..fe6d37d8 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/NEWS.md @@ -0,0 +1,349 @@ +# fs 1.6.5 + +* `path_ext()` and `path_ext_remove()` return correct extension and path, respectively, when multiple dots are present in file name (@IndrajeetPatil, #452, #453). + +* `path_rel()` provides an informative error message when multiple starting directory paths are specified (@IndrajeetPatil, #454). + +# fs 1.6.4 + +* No changes. + +# fs 1.6.3 + +* No user visible changes. + +# fs 1.6.2 + +* `path_ext_set()` can now handle extensions that contain a `.`, e.g. `csv.gz` (@mgirlich, #415). + +# fs 1.6.1 + +No user visible changes. + +# fs 1.6.0 + +* inputs to `path_real()` and `path_join()` are coerced to character for consistency with other functions (@raymondben, #370) + +* fs uses libuv 1.44.2 now. + +# fs 1.5.2 + +* `file_create()` and `dir_create()` now return the correct path when `...` arguments are used (@davidchall, #333). + +* `dir_create(recurse = FALSE)` now correctly handles `...` arguments (@davidchall, #333). + +* `file_exists()` now expands `~` again (#325). + +* `dir_copy()` works when `path` has length >1 (#360). + +# fs 1.5.1 + +* Gábor Csárdi is now the maintainer. + +* fs is now licensed as MIT (#301). + +* `dir_create()` now restores the previous umask (#293) + +* `file_exists()` is now much faster (#295) + +* `options(fs.fs_path.shorten)` can now be used to control how paths are shortened in tibbles. + The default value is "front", valid alternatives are "back", "middle" and "abbreviate". (#335) + +* `options(fs.use_tibble = FALSE)` can now be used to disable use of tibbles (#295). + +* `path_tidy()` now works with non-UTF8 encoded paths (@shrektan, #321). + +# fs 1.5.0 + +* The libuv release used by fs was updated to 1.38.1 + +* `dir_create()` now consults the process umask so the mode during directory creation works like `mkdir` does (#284). + +* `fs_path`, `fs_bytes` and `fs_perms` objects are now compatible with vctrs 0.3.0 (#266) + +* `fs_path` objects now sort properly when there is a mix of ASCII and unicode elements (#279) + + +# fs 1.4.2 + +* `file_info(..., follow = TRUE)`, `is_dir()`, and `is_file()` + follow relative symlinks in non-current directories (@heavywatal, #280) + +* `dir_map()` now grows its internal list safely, the 1.4.0 release introduced an unsafe regression (#268) + +* `file_info()` returns a tibble if the tibble package is installed, and subsets work when it is a `data.frame` (#265) + +* `path_real()` always fails if the file does not exist. Thus it can no longer +be used to resolve symlinks further up the path hierarchy for files that do not +yet exist. This reverts the feature introduced in 1.2.7 (#144, #221, #231) + +# fs 1.4.1 + +* Fix compilation on Solaris. + +# fs 1.4.0 + +* `[[.fs_path`, `[[.fs_bytes` and `[[.fs_perms` now preserve their classes after subsetting (#254). + +* `path_has_parent()` now recycles both the `path` and `parent` arguments (#253). + +* `path_ext_set()` now recycles both the `path` and `ext` arguments (#250). + +* Internally fs no longer depends on Rcpp + +# fs 1.3.2 + +* fs now passes along `CPPFLAGS` during compilation of libuv, fixing an issue that could + prevent compilation from source on macOS Catalina. (@kevinushey, #229) + +* fs now compiles on alpine linux (#210) + +* `dir_create()` now works with absolute paths and `recurse = FALSE` (#204). + +* `dir_tree()` now works with paths that need tilde expansion (@dmurdoch, @jennybc, #203). + +* `file_info()` now returns file sizes with the proper classes ("fs_bytes" and "numeric"), rather than just "fs_bytes" (#239) + +* `get_dirent_type()` gains a `fail` argument (@bellma-lilly, #219) + +* `is_dir()`, `is_file()`, `is_file_empty()` and `file_info()` gain a `follow` argument, to follow links and return information about the linked file rather than the link itself (#198) + +* `path()` now follows "tidy" recycling rules, namely only consistent or length 1 inputs are recycled. (#238) + +* `path()` now errors if the path given or constructed will exceed `PATH_MAX` (#233). + +* `path_ext_set()` now works with multiple paths (@maurolepore, #208). + +# fs 1.3.1 + +* Fix missed test with UTF-8 characters, which now passes on a strict Latin-1 locale. + +* Fix undefined behavior when casting -1 to `size_t`. + +# fs 1.3.0 + +## Breaking changes + +* `dir_ls()`, `dir_map()`, `dir_walk()`, `dir_info()` and `dir_tree()` gain a + `recurse` argument, which can be either a `TRUE` or `FALSE` (as was supported + previously) _or_ a number of levels to recurse. The previous argument + `recursive` has been deprecated. + +## New features + +* `dir_copy()` gains a `overwrite` argument, to overwrite a given directory + (@pasipasi123, #193) + +## Minor improvements and fixes + +* `dir_create()` now throws a more accurate error message when you try to + create a directory in a non-writeable location (#196). + +* `fs_path` objects now always show 10 characters by default when printed in + tibbles (#191). + +* `path_file()`, `path_dir()` and `path_ext()` now return normal character + vectors rather than tidy paths (#194). + +* `path_package()` now works with paths in development packages automatically + (#175). + +* tests now pass successfully when run in strict Latin-1 locale + +# fs 1.2.7 + +## New features + +* `file_size()` function added as a helper for `file_info("file")$size` (#171) + +* `is_file_empty()` function added to test for empty files` (#171) + +* `dir_tree()` function added to print a command line representation of a + directory tree, analogous to the unix `tree` program (#82). + +* Add a comparison vignette to quickly compare base R, fs and shell + alternatives (@xvrdm, #168). + +## Minor improvements and fixes + +* `path_ext_set()` and `file_temp()` now treat extensions with a leading `.` + and those without equally. e.g. `path_ext_set("foo", ext = "bar")` and + `path_ext_set("foo", ext = ".bar")` both result in "foo.bar" + +* Tidy paths are now always returned with uppercase drive letters on Windows (#174). + +* `format.bench_bytes()` now works with `str()` in R 3.5.1+ (#155). + +* `path_ext()`, `path_ext_remove()`, and `path_ext_set()` now work on paths + with no extension, and `file_temp()` now prepends a `.` to the file extension + (#153). + +* Link with -pthread by default and fix on BSD systems (#128, #145, #146). + +* `file_chown()` can now take a `group_id` parameter as character (@cderv, #162). + +* Parameter `browser` in `file_show()` now works as described in the documentation (@GegznaV, #154). + +* `path_real()` now works even if the file does not exist, but there are + symlinks further up the path hierarchy (#144). + +* `colourise_fs_path()` now returns paths uncolored if the colors argument / + `LS_COLORS` is malformed (#135). + +# fs 1.2.6 + +* This is a small bugfix only release. + +* `file_move()` now fall back to copying, then removing files when moving files + between devices (which would otherwise fail) (#131, https://github.com/r-lib/usethis/issues/438). + +* Fix for a double free when using `warn = TRUE` (#132) + +# fs 1.2.5 + +* Patch release to fix tests which left files in the R session directory + +# fs 1.2.4 + +## New Features + +* New `path_wd()` generates paths from the current working directory (#122). + +* New `path_has_parent()` determines if a path has a given parent (#116). + +* New `file_touch()` used to change access and modification times for a file (#98). + +* `dir_ls()`, `dir_map()`, `dir_walk()`, `dir_info()` and `file_info()` gain a + `fail` parameter, to signal warnings rather than errors if they are called on + a path which is unavailable due to permissions or locked resources (#105). + +## Minor improvements and fixes + +* `path_tidy()` now always includes a trailing slash for the windows root + directory, e.g. `C:/` (#124). + +* `path_ext()`, `path_ext_set()` and `path_ext_remove()` now handle paths with + non-ASCII characters (#120). + +* `fs_path` objects now print (without colors) even if the user does not have + permission to stat them (#121). + +* compatibility with upcoming gcc 8 based Windows toolchain (#119) + +# fs 1.2.3 + +## Features + +* Experimental support for `/` and `+` methods for `fs_path` objects (#110). + +* `file_create()` and `dir_create()` now take `...`, which is passed to + `path()` to make construction a little nicer (#80). + +## Bugfixes + +* `path_ext()`, `path_ext_set()` and `path_ext_remove()` now handle paths with + directories including hidden files without extensions (#92). + +* `file_copy()` now copies files into the directory if the target is a + directory (#102). + +# fs 1.2.2 + +## Features + +* fs no longer needs a C++11 compiler, it now works with compilers which + support only C++03 (#90). + +## Bugfixes + +* `fs_path` `fs_bytes` and `fs_perm` objects now use `methods::setOldClass()` + so that S4 dispatch to their base classes works as intended (#91). + +* Fix allocation bug in `path_exists()` using `delete []` when we should have + used `free()`. + +# fs 1.2.1 + +## Features + +* `path_abs()` gains a `start` argument, to specify where the absolute path + should be calculated from (#87). + +## Bugfixes + +* `path_ext()` now returns `character()` if given 0 length inputs (#89) + +* Fix for a memory issue reported by ASAN and valgrind. + +# fs 1.2.0 + +## Breaking changes + +* `path_expand()` and `path_home()` now use `USERPROFILE` or + `HOMEDRIVE`/`HOMEPATH` as the user home directory on Windows. This differs + from the definition used in `path.expand()` but is consistent with + definitions from other programming environments such as python and rust. This + is also more compatible with external tools such as git and ssh, both of + which put user-level files in `USERPROFILE` by default. To mimic R's (and + previous) behavior there are functions `path_expand_r()` and `path_home_r()`. + +* Handling missing values are more consistent. In general `is_*` functions + always return `FALSE` for missing values, `path_*` functions always propagate + NA values (NA inputs become NA outputs) and `dir_*` `file_*` and `link_*` + functions error with NA inputs. + +* fs functions now preserve tildes in their outputs. Previously paths were + always returned with tildes expanded. Users can use `path_expand()` to expand + tildes if desired. + +## Bugfixes + +* Fix crash when a files user or group id did not exist in the respective + database (#84, #58) +* Fix home expansion on systems without readline (#60). +* Fix propagation of NA values in `path_norm()` (#63). + +## Features + +* `file_chmod()` is now vectorized over both of its arguments (#71). +* `link_create()` now fails silently if an identical link already exists (#77). +* `path_package()` function created as an analog to `system.file()` which + always fails if the package or file does not exist (#75) + +# fs 1.1.0 + +## Breaking changes + +* Tidy paths no longer expand `~`. + +* Filesystem modification functions now error for NA inputs. (#48) + +* `path()` now returns 0 length output if given any 0 length inputs (#54). + +## New features + +* Removed the autotool system dependency on non-windows systems. + +## Bugfixes + +* `dir_delete()` now correctly expands paths (#47). + +* `dir_delete()` now correctly deletes hidden files and directories (#46). + +* `link_path()` now checks for an error before trying to make a string, + avoiding a crash (#43). + +* libuv return paths now marked as UTF-8 strings in C code, fixing encoding + issues on windows. (#42) + +* `dir_copy()` now copies the directory inside the target if the target is a + directory (#51). + +* `dir_copy()` now works correctly with absolute paths and no longer removes + files when `overwrite = TRUE`. + +# fs 1.0.0 + +* Removed the libbsd system dependency on linux +* Initial release +* Added a `NEWS.md` file to track changes to the package. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/R/fs b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/R/fs new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/R/fs @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/R/fs.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/R/fs.rdb new file mode 100644 index 00000000..d0646a9f Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/R/fs.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/R/fs.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/R/fs.rdx new file mode 100644 index 00000000..f2902563 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/R/fs.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/WORDLIST b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/WORDLIST new file mode 100644 index 00000000..8763ae6a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/WORDLIST @@ -0,0 +1,56 @@ +ASAN +Bugfixes +CMD +Codecov +Colouring +Filesystem +GETGRENT +GETPWENT +ISVTX +Joyent +LPT +PBC +Rcpp +Vectorization +autotool +bugfix +colour +coloured +colouring +colourised +datetime +devtools +dircolors +dplyr +filesystem +funder +gcc +globbing +hexidecimal +inode +libbsd +libuv +lifecycle +linux +macOS +magrittr +nodejs +pthread +purrr +readline +recurse +reproducibility +signalling +symlink +symlinks +tibble +tibbles +tidyverse +tidy’ +toolchain +umask +unicode +valgrind +vctrs +vectorized +writeable diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/doc/function-comparisons.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/doc/function-comparisons.R new file mode 100644 index 00000000..56009b41 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/doc/function-comparisons.R @@ -0,0 +1,6 @@ +## ----setup, include = FALSE--------------------------------------------------- +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/doc/function-comparisons.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/doc/function-comparisons.Rmd new file mode 100644 index 00000000..9ba8a6de --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/doc/function-comparisons.Rmd @@ -0,0 +1,94 @@ +--- +title: "Comparison of fs functions, base R, and shell commands" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{base vs fs} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r setup, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + +Most of the functionality is **fs** can be approximated with functions in **base R** +or in a command line shell. The table at the end of this vignette can be used +as a translation aid between these three methods. + +**fs** functions smooth over some of the idiosyncrasies of file handling with +base R functions: + +* Vectorization. All **fs** functions are vectorized, accepting multiple paths + as input. Base functions are inconsistently vectorized. + +* Predictable return values that always convey a path. All **fs** functions + return a character vector of paths, a named integer or a logical vector, where + the names give the paths. Base return values are more varied: they are often + logical or contain error codes which require downstream processing. + +* Explicit failure. If **fs** operations fail, they throw an error. Base + functions tend to generate a warning and a system dependent error code. This + makes it easy to miss a failure. + +* UTF-8 all the things. **fs** functions always convert input paths to UTF-8 and + return results as UTF-8. This gives you path encoding consistency across OSes. + Base functions rely on the native system encoding. + +* Naming convention. **fs** functions use a consistent naming convention. + Because base R's functions were gradually added over time there are a number + of different conventions used (e.g. `path.expand()` vs `normalizePath()`; + `Sys.chmod()` vs `file.access()`). + +## Directory functions + +| fs | base | shell | +| --- | --- | --- | +| `dir_ls("path")` | `list.files("path")` | `ls path` | +| `dir_info("path")` | `do.call(rbind, lapply(list.files("path"), file.info))` | `ls -al path` | +| `dir_copy("path", "new-path")` | `dir.create("new-path"); file.copy("path", "new-path", recursive=TRUE)` | `cp path new-path` | +| `dir_create("path")` | `dir.create("path")` | `mkdir path` | +| `dir_delete("path")` | `unlink("path", recursive = TRUE)` | `rm -rf path` | +| `dir_exists("path")` | `dir.exists("path")` | `if [ -d "path" ]; then ... ; fi` | +| ~~`dir_move()`~~ (see `file_move`) | `file.rename("path", "new-path")` | `mv path new-path` | +| `dir_map("path", fun)` | *No direct equivalent* | `for file in $(ls path); do ...; done` | +| `dir_tree("path")` | *No direct equivalent* | `tree path` | + + +## File functions + +| fs | base | shell | +| --- | --- | --- | +| `file_chmod("path", "mode")` | `Sys.chmod("path", "mode")` | `chmod mode path` | +| `file_chown("path", "user_id", "group_id")` | *No direct equivalent* | `chown options path ` | +| `file_copy("path", "new-path")` | `file.copy("path", "new-path")` | `cp path new-path` | +| `file_create("new-path")` | `file.create("new-path")` | `touch new-path` | +| `file_delete("path")` | `unlink("path")` | `rm path` | +| `file_exists("path")` | `file.exists("path")` | `if [ -f "path" ]; then ... ; fi` | +| `file_info("path")` | `file.info("path")` | `ls -al path` | +| `file_move("path", "new-path")` | `file.rename("path", "new-path")` | `mv path new-path` | +| `file_show("path")` | `browseURL("path")` | `open path` | +| `file_touch()` | *No direct equivalent* | `touch path` | +| `file_temp()` | `tempfile()` | `mktemp` | +| `file_test()` | *No direct equivalent* | `if [ -d "path" ]; then ...; fi` | + +## Path functions + +| fs | base | shell | +| --- | --- | --- | +| `path("top_dir", "nested_dir", "file", ext = "ext")` | `file.path("top_dir", "nested_dir", "file.ext")` | `top_dir/nested_dir/file.ext` | +| `path_temp()`, `path_temp("path")` | `tempdir()`, `file.path(tempdir(), "path")` | `mktemp -d` | +| `path_expand("~/path")` | `path.expand()` | `realpath -m -s ~/path` | +| `path_dir("path")` | `dirname("path")` | `dirname path` | +| `path_file("path")` | `basename("path")` | `basename path` | +| `path_home()` | `path.expand("~")` | `$HOME` | +| `path_package("pkgname", "dir", "file")` | `system.file("dir", "file", package = "pkgname")` | *No direct equivalent* | +| `path_norm("path")` | `normalizePath()` | `realpath` | +| `path_real("path")` | `normalizePath(mustWork = TRUE)` | `realpath` | +| `path_rel("path/foo", "path/bar")` | *No direct equivalent* | *No direct equivalent* | +| `path_common(c("path/foo", "path/bar", "path/baz"))` | *No direct equivalent* | *No direct equivalent* | +| `path_ext_remove("path")` | `sub("\\.[a-zA-Z0-9]*$", "", "path")` | *No direct equivalent* | +| `path_ext_set("path", "new_ext")` | `sub("\\.[a-zA-Z0-9]*$", "new_ext", "path")` | *No direct equivalent* | +| `path_sanitize("path")` | *No direct equivalent* | *No direct equivalent* | diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/doc/function-comparisons.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/doc/function-comparisons.html new file mode 100644 index 00000000..0c8e255c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/doc/function-comparisons.html @@ -0,0 +1,521 @@ + + + + + + + + + + + + + + +Comparison of fs functions, base R, and shell commands + + + + + + + + + + + + + + + + + + + + + + + +

Comparison of fs functions, base R, and +shell commands

+ + + +

Most of the functionality is fs can be approximated +with functions in base R or in a command line shell. +The table at the end of this vignette can be used as a translation aid +between these three methods.

+

fs functions smooth over some of the idiosyncrasies +of file handling with base R functions:

+
    +
  • Vectorization. All fs functions are vectorized, +accepting multiple paths as input. Base functions are inconsistently +vectorized.

  • +
  • Predictable return values that always convey a path. All +fs functions return a character vector of paths, a +named integer or a logical vector, where the names give the paths. Base +return values are more varied: they are often logical or contain error +codes which require downstream processing.

  • +
  • Explicit failure. If fs operations fail, they +throw an error. Base functions tend to generate a warning and a system +dependent error code. This makes it easy to miss a failure.

  • +
  • UTF-8 all the things. fs functions always +convert input paths to UTF-8 and return results as UTF-8. This gives you +path encoding consistency across OSes. Base functions rely on the native +system encoding.

  • +
  • Naming convention. fs functions use a consistent +naming convention. Because base R’s functions were gradually added over +time there are a number of different conventions used +(e.g. path.expand() vs normalizePath(); +Sys.chmod() vs file.access()).

  • +
+
+

Directory functions

+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
fsbaseshell
dir_ls("path")list.files("path")ls path
dir_info("path")do.call(rbind, lapply(list.files("path"), file.info))ls -al path
dir_copy("path", "new-path")dir.create("new-path"); file.copy("path", "new-path", recursive=TRUE)cp path new-path
dir_create("path")dir.create("path")mkdir path
dir_delete("path")unlink("path", recursive = TRUE)rm -rf path
dir_exists("path")dir.exists("path")if [ -d "path" ]; then ... ; fi
dir_move() (see file_move)file.rename("path", "new-path")mv path new-path
dir_map("path", fun)No direct equivalentfor file in $(ls path); do ...; done
dir_tree("path")No direct equivalenttree path
+
+
+

File functions

+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
fsbaseshell
file_chmod("path", "mode")Sys.chmod("path", "mode")chmod mode path
file_chown("path", "user_id", "group_id")No direct equivalentchown options path
file_copy("path", "new-path")file.copy("path", "new-path")cp path new-path
file_create("new-path")file.create("new-path")touch new-path
file_delete("path")unlink("path")rm path
file_exists("path")file.exists("path")if [ -f "path" ]; then ... ; fi
file_info("path")file.info("path")ls -al path
file_move("path", "new-path")file.rename("path", "new-path")mv path new-path
file_show("path")browseURL("path")open path
file_touch()No direct equivalenttouch path
file_temp()tempfile()mktemp
file_test()No direct equivalentif [ -d "path" ]; then ...; fi
+
+
+

Path functions

+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
fsbaseshell
path("top_dir", "nested_dir", "file", ext = "ext")file.path("top_dir", "nested_dir", "file.ext")top_dir/nested_dir/file.ext
path_temp(), path_temp("path")tempdir(), +file.path(tempdir(), "path")mktemp -d
path_expand("~/path")path.expand()realpath -m -s ~/path
path_dir("path")dirname("path")dirname path
path_file("path")basename("path")basename path
path_home()path.expand("~")$HOME
path_package("pkgname", "dir", "file")system.file("dir", "file", package = "pkgname")No direct equivalent
path_norm("path")normalizePath()realpath
path_real("path")normalizePath(mustWork = TRUE)realpath
path_rel("path/foo", "path/bar")No direct equivalentNo direct equivalent
path_common(c("path/foo", "path/bar", "path/baz"))No direct equivalentNo direct equivalent
path_ext_remove("path")sub("\\.[a-zA-Z0-9]*$", "", "path")No direct equivalent
path_ext_set("path", "new_ext")sub("\\.[a-zA-Z0-9]*$", "new_ext", "path")No direct equivalent
path_sanitize("path")No direct equivalentNo direct equivalent
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/doc/index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/doc/index.html new file mode 100644 index 00000000..1f3d9931 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/doc/index.html @@ -0,0 +1,29 @@ + + +R: Vignettes and other documentation + + + +
+

Vignettes and other documentation + +

+
+
+[Top] +
+

Vignettes from package 'fs'

+ +++++++ + + + + +
fs::function-comparisonsbase vs fsHTMLsourceR code
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/help/AnIndex new file mode 100644 index 00000000..ac2a1051 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/help/AnIndex @@ -0,0 +1,74 @@ +fs-package fs-package +as_fs_bytes fs_bytes +as_fs_path fs_path +as_fs_perms fs_perms +copy copy +create create +delete delete +dir_copy copy +dir_create create +dir_delete delete +dir_exists file_access +dir_info dir_ls +dir_ls dir_ls +dir_map dir_ls +dir_tree dir_tree +dir_walk dir_ls +file_access file_access +file_chmod file_chmod +file_chown file_chown +file_copy copy +file_create create +file_delete delete +file_exists file_access +file_info file_info +file_move file_move +file_show file_show +file_size file_info +file_temp file_temp +file_temp_pop file_temp +file_temp_push file_temp +file_touch file_touch +fs fs-package +fs_bytes fs_bytes +fs_path fs_path +fs_perms fs_perms +group_ids id +id id +is_absolute_path is_absolute_path +is_dir is_file +is_file is_file +is_file_empty is_file +is_link is_file +link_copy copy +link_create create +link_delete delete +link_exists file_access +link_path link_path +path path +path_abs path_math +path_common path_math +path_dir path_file +path_expand path_expand +path_expand_r path_expand +path_ext path_file +path_ext<- path_file +path_ext_remove path_file +path_ext_set path_file +path_file path_file +path_filter path_filter +path_has_parent path_math +path_home path_expand +path_home_r path_expand +path_join path_math +path_math path_math +path_norm path_math +path_package path_package +path_real path_math +path_rel path_math +path_sanitize path_sanitize +path_split path_math +path_temp file_temp +path_tidy path_tidy +path_wd path +user_ids id diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/help/aliases.rds new file mode 100644 index 00000000..dc92e119 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/help/figures/logo.png b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/help/figures/logo.png new file mode 100644 index 00000000..c9f381f2 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/help/figures/logo.png differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/help/fs.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/help/fs.rdb new file mode 100644 index 00000000..b631e211 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/help/fs.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/help/fs.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/help/fs.rdx new file mode 100644 index 00000000..10caf641 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/help/fs.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/help/paths.rds new file mode 100644 index 00000000..6354d060 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/html/00Index.html new file mode 100644 index 00000000..635c1135 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/html/00Index.html @@ -0,0 +1,171 @@ + + +R: Cross-Platform File System Operations Based on 'libuv' + + + +
+

Cross-Platform File System Operations Based on 'libuv' + +

+
+
+[Up] +[Top] +

Documentation for package ‘fs’ version 1.6.5

+ + + +

Help Pages

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
as_fs_bytesHuman readable file sizes
as_fs_pathFile paths
as_fs_permsCreate, modify and view file permissions
copyCopy files, directories or links
createCreate files, directories, or links
deleteDelete files, directories, or links
dir_copyCopy files, directories or links
dir_createCreate files, directories, or links
dir_deleteDelete files, directories, or links
dir_existsQuery for existence and access permissions
dir_infoList files
dir_lsList files
dir_mapList files
dir_treePrint contents of directories in a tree-like format
dir_walkList files
file_accessQuery for existence and access permissions
file_chmodChange file permissions
file_chownChange owner or group of a file
file_copyCopy files, directories or links
file_createCreate files, directories, or links
file_deleteDelete files, directories, or links
file_existsQuery for existence and access permissions
file_infoQuery file metadata
file_moveMove or rename files
file_showOpen files or directories
file_sizeQuery file metadata
file_tempCreate names for temporary files
file_temp_popCreate names for temporary files
file_temp_pushCreate names for temporary files
file_touchChange file access and modification times
fs_bytesHuman readable file sizes
fs_pathFile paths
fs_permsCreate, modify and view file permissions
group_idsLookup Users and Groups on a system
idLookup Users and Groups on a system
is_absolute_pathTest if a path is an absolute path
is_dirFunctions to test for file types
is_fileFunctions to test for file types
is_file_emptyFunctions to test for file types
is_linkFunctions to test for file types
link_copyCopy files, directories or links
link_createCreate files, directories, or links
link_deleteDelete files, directories, or links
link_existsQuery for existence and access permissions
link_pathRead the value of a symbolic link
pathConstruct path to a file or directory
path_absPath computations
path_commonPath computations
path_dirManipulate file paths
path_expandFinding the User Home Directory
path_expand_rFinding the User Home Directory
path_extManipulate file paths
path_ext<-Manipulate file paths
path_ext_removeManipulate file paths
path_ext_setManipulate file paths
path_fileManipulate file paths
path_filterFilter paths
path_has_parentPath computations
path_homeFinding the User Home Directory
path_home_rFinding the User Home Directory
path_joinPath computations
path_mathPath computations
path_normPath computations
path_packageConstruct a path to a location within an installed or development package
path_realPath computations
path_relPath computations
path_sanitizeSanitize a filename by removing directory paths and invalid characters
path_splitPath computations
path_tempCreate names for temporary files
path_tidyTidy paths
path_wdConstruct path to a file or directory
user_idsLookup Users and Groups on a system
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/libs/fs.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/libs/fs.so new file mode 100755 index 00000000..c032e931 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/libs/fs.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/libs/fs.so.dSYM/Contents/Info.plist b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/libs/fs.so.dSYM/Contents/Info.plist new file mode 100644 index 00000000..f705d77f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/libs/fs.so.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.fs.so + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/libs/fs.so.dSYM/Contents/Resources/DWARF/fs.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/libs/fs.so.dSYM/Contents/Resources/DWARF/fs.so new file mode 100644 index 00000000..85d0d369 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/fs/libs/fs.so.dSYM/Contents/Resources/DWARF/fs.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/DESCRIPTION new file mode 100644 index 00000000..3b9a96c8 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/DESCRIPTION @@ -0,0 +1,47 @@ +Package: glue +Title: Interpreted String Literals +Version: 1.8.0 +Authors@R: c( + person("Jim", "Hester", role = "aut", + comment = c(ORCID = "0000-0002-2739-7082")), + person("Jennifer", "Bryan", , "jenny@posit.co", role = c("aut", "cre"), + comment = c(ORCID = "0000-0002-6983-2759")), + person("Posit Software, PBC", role = c("cph", "fnd")) + ) +Description: An implementation of interpreted string literals, inspired by + Python's Literal String Interpolation + and Docstrings + and Julia's Triple-Quoted + String Literals + . +License: MIT + file LICENSE +URL: https://glue.tidyverse.org/, https://github.com/tidyverse/glue +BugReports: https://github.com/tidyverse/glue/issues +Depends: R (>= 3.6) +Imports: methods +Suggests: crayon, DBI (>= 1.2.0), dplyr, knitr, magrittr, rlang, + rmarkdown, RSQLite, testthat (>= 3.2.0), vctrs (>= 0.3.0), + waldo (>= 0.5.3), withr +VignetteBuilder: knitr +ByteCompile: true +Config/Needs/website: bench, forcats, ggbeeswarm, ggplot2, R.utils, + rprintf, tidyr, tidyverse/tidytemplate +Config/testthat/edition: 3 +Encoding: UTF-8 +RoxygenNote: 7.3.2 +NeedsCompilation: yes +Packaged: 2024-09-27 16:00:45 UTC; jenny +Author: Jim Hester [aut] (), + Jennifer Bryan [aut, cre] (), + Posit Software, PBC [cph, fnd] +Maintainer: Jennifer Bryan +Repository: CRAN +Date/Publication: 2024-09-30 22:30:01 UTC +Built: R 4.4.1; aarch64-apple-darwin20; 2025-02-01 04:45:00 UTC; unix +Archs: glue.so.dSYM +RemoteType: standard +RemotePkgRef: glue +RemoteRef: glue +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 1.8.0 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/INDEX new file mode 100644 index 00000000..fa2913b0 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/INDEX @@ -0,0 +1,9 @@ +as_glue Coerce object to glue +glue Format and interpolate a string +glue_col Construct strings with color +glue_collapse Collapse a character vector +glue_safe Safely interpolate strings +glue_sql Interpolate strings with SQL escaping +identity_transformer Parse and Evaluate R code +quoting Quoting operators +trim Trim a character vector diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/LICENSE new file mode 100644 index 00000000..74e0162e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2023 +COPYRIGHT HOLDER: glue authors diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/Meta/Rd.rds new file mode 100644 index 00000000..3795c9b4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/Meta/hsearch.rds new file mode 100644 index 00000000..a8a7efbf Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/Meta/links.rds new file mode 100644 index 00000000..7d45050b Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/Meta/nsInfo.rds new file mode 100644 index 00000000..e5544c11 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/Meta/package.rds new file mode 100644 index 00000000..1fa54f08 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/Meta/vignette.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/Meta/vignette.rds new file mode 100644 index 00000000..1e11cfa3 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/Meta/vignette.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/NAMESPACE new file mode 100644 index 00000000..0ee7a78c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/NAMESPACE @@ -0,0 +1,37 @@ +# Generated by roxygen2: do not edit by hand + +S3method("+",glue) +S3method("[",glue) +S3method("[[",glue) +S3method(as.character,glue) +S3method(as_glue,character) +S3method(as_glue,default) +S3method(as_glue,glue) +S3method(print,glue) +S3method(testthat::compare,glue) +S3method(vctrs::vec_cast,character.glue) +S3method(vctrs::vec_cast,glue.character) +S3method(vctrs::vec_cast,glue.glue) +S3method(vctrs::vec_ptype2,character.glue) +S3method(vctrs::vec_ptype2,glue.character) +S3method(vctrs::vec_ptype2,glue.glue) +S3method(waldo::compare_proxy,glue) +export(as_glue) +export(backtick) +export(double_quote) +export(glue) +export(glue_col) +export(glue_collapse) +export(glue_data) +export(glue_data_col) +export(glue_data_safe) +export(glue_data_sql) +export(glue_safe) +export(glue_sql) +export(glue_sql_collapse) +export(identity_transformer) +export(single_quote) +export(trim) +importFrom(methods,setOldClass) +useDynLib(glue,glue_) +useDynLib(glue,trim_) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/NEWS.md new file mode 100644 index 00000000..ffd1c380 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/NEWS.md @@ -0,0 +1,236 @@ +# glue 1.8.0 + +* glue has a two new articles: + - "Get started", with contributions from @stephhazlitt and @BrennanAntone + (#137, #170, #332). + - How to write a function that wraps glue (#281). + +* If the last argument of `glue()` is empty, it is dropped (#320). This makes + it easy to structure `glue()` calls with one argument per line, and to anticipate adding arguments: + + ``` r + glue( + "here's some text, ", + "and maybe more text will be added in the future?", + ) + ``` + +* `glue_sql("{var*}")` once again generates `NULL` if var is empty. + This reverts #292. (#318). + +* The `.envir` argument to `glue()` and `glue_data()` really must be an + environment now, as documented. Previously a list-ish object worked in + some cases (by accident, not really by design). When you need to lookup + values in a list-ish object, use `glue_data(.x =)` (#308, #317). + Ditto for `glue_sql()` and `glue_data_sql()`. + +# glue 1.7.0 + +* If rlang is installed, glue will generate more informative errors if an + interpolated expression either can't be parsed or fails to evaluate (#229). + +* `+` now works in more situations, and gives errors when one side isn't a + character vector. It no longer automatically applies glue interpolation to + a non-glue input, if there is one. You'll need to do that yourself (#286). + +* `glue_collapse(character())` (and hence `glue_sql_collapse(character())`) now + return `""`, so that they always return a single string (#88). + +* `glue_sql()` now collapses an empty vector to `""` not `"NULL"` (#272). + +* `glue_sql()` now uses `DBI::dbQuoteLiteral()` for all object types. This + should increase fidelity of escaping for different object types (#279). + +* The "Speed of glue" vignette has been converted to an article, which allows + several package to be removed from `Suggests` (and re-located to + `Config/Needs/website`). The code got a light refresh, including a switch + from microbenchmark to bench and more modern use of ggplot2. + +* Add `$(C_VISIBILITY)` to compiler flags to hide internal symbols from the dll (#284 @lionel-). + +# glue 1.6.2 + +* Modify a test for better forward compatibility with R. + +# glue 1.6.1 + +* glue now registers its custom knitr engines in a way that is more robust to namespace-loading edge cases that can arise during package installation (#254). + +# glue 1.6.0 + +* `glue()`, `glue_data()`, `glue_col()`, and `glue_data_col()` gain a new `.literal` argument, which controls how quotes and the comment character are treated when parsing the expression string (#235). This is mostly useful when using a custom transformer. + +* Trailing whitespace-only lines don't interfere with indentation (#247). + +# glue 1.5.1 + +* Jennifer Bryan is now the maintainer. + +* The existing custom language engines for knitr, `glue` and `glue_sql`, are documented in a new vignette (#71). *Detail added after release: glue now sets up registration of these engines in `.onLoad()`.* + +* `glue_col()` gives special treatment to styling functions from the crayon package, e.g. `glue_col("{blue foo}")` "just works" now, even if crayon is not attached (but is installed) (#241). + +* Unterminated backticks trigger the same error as unterminated single or double quotes (#237). + +* `glue_sql()` collapses zero-length `DBI::SQL` object into `DBI::SQL("NULL")` (#244 @shrektan). + +# glue 1.5.0 + +## Breaking changes + +* Long deprecated function `collapse()` has been removed (#213) + +## New functions and arguments + +* New `glue_sql_collapse()` function to collapse inputs and return a `DBI::SQL()` object (#103). + +* `glue()` gains a new `.comment` argument, to control the comment character (#193). +* `glue()` gains a new `.null` argument, to control the value to replace `NULL` values with (#217, @echasnovski). + +## Bugfixes and minor changes + +* `sql_quote_transformer()` is now allows whitespace after the trailing `*` (#218). +* `compare_proxy.glue()` method defined so glue objects can be compared to strings in testthat 3e without errors (#212) +* `print.glue()` no longer prints an empty newline for 0 length inputs (#214) +* Unterminated comments in glue expression now throw an error (#227, @gaborcsardi) +* Unterminated quotes in glue expressions now throw an error (#226, @gaborcsardi) + + +# glue 1.4.2 + +* `glue_safe()` gives a slightly nicer error message +* The required version of R is now 3.2 (#189) +* `glue_sql()` now collapses `DBI::SQL()` elements correctly (#192 @shrektan) +* The internal `compare()` method gains a `...` argument, for compatibility with testthat 3.0.0 + +# glue 1.4.1 + +* Internal changes for compatibility with vctrs 0.3.0 (#187). +* `glue_sql()` now replaces missing values correctly when collapsing values (#185). +* `glue_sql()` now always preserves the type of the column even in the presence of missing values (#130) + +# glue 1.4.0 + +* `.envir = NULL` is now supported and is equivalent to passing `.envir = emptyenv()` (#140) + +* New `glue_safe()` and `glue_data_safe()` functions, safer versions of + `glue()` that do not execute code, only look up values (using `get()`). These + alternatives are useful for things like shiny applications where you do not + have control of the input for your glue expressions. (#140) + +* Fixed memory access issue and memory leaks found by valgrind. + +# glue 1.3.2 + +* glue now implements vctrs methods. This ensures that vectors of glue + strings are compatible with tidyverse packages like tidyr + (r-lib/tidyselect#170, tidyverse/tidyr#773, @lionel-). + +* Fix a LTO type mismatch warning (#146) + +* `glue_sql()` now quotes lists of values appropriate to their type, rather + than coercing all values to characters (#153) + +* `glue_data()` now implicitly coerces `.x` to a list. + +* `glue()` gains the `.trim` argument, like `glue_data()`. + +* `single_quote()` `double_quote()` and `backtick()` all return `NA` for `NA` + inputs (#135). + +* Improve `trim()`'s handling of lines containing only indentation (#162, #163, @alandipert) + +# glue 1.3.1 + +## Features + +* `glue()` now has a `+` method to combine strings. +* `glue_sql()` now collapses zero-length vector into `DBI::SQL("NULL")` (#134 @shrektan). + +## Bugfixes and minor changes + +* `glue_sql()` now supports unquoting lists of Id objects. +* `glue_sql()` now quotes characters with NAs appropriately (#115). +* `glue_sql()` now quotes Dates appropriately (#98). +* A potential protection error reported by rchk was fixed. + +# glue 1.3.0 + +## Breaking changes + +* The `evaluate()` function has been removed. Changes elsewhere in glue made + the implementation trivial so it was removed for the sake of clarity. + Previous uses can be replaced by `eval(parse(text = text), envir)`. + +* `collapse()` has been renamed to `glue_collapse()` to avoid namespace + collisions with `dplyr::collapse()`. + +## Features + +* `compare.glue()` was added, to make it easier to use glue objects in + `testthat::expect_equal()` statements. + +* `glue_col()` and `glue_data_col()` functions added to display strings with + color. + +## Bugfixes and minor changes + +* Glue now throws an informative error message when it cannot interpolate a + function into a string (#114, @haleyjeppson & @ijlyttle). + +* Glue now evaluates unnamed arguments lazily with `delayedAssign()`, so there + is no performance cost if an argument is not used. (#83, @egnha). + +* Fixed a bug where names in the assigned expression of an interpolation + variable would conflict with the name of the variable itself (#89, @egnha). + +* Do not drop the `glue` class when subsetting (#66). + +* Fix `glue()` and `collapse()` always return UTF-8 encoded strings (#81, @dpprdan) + +# glue 1.2.0 + +* The implementation has been tweaked to be slightly faster in most cases. + +* `glue()` now has a `.transformer` argument, which allows you to use custom + logic on how to evaluate the code within glue blocks. See + `vignette("transformers")` for more details and example transformer + functions. + +* `glue()` now returns `NA` if any of the results are `NA` and `.na` is `NULL`. + Otherwise `NA` values are replaced by the value of `.na`. + +* `trim()` to use the trimming logic from glue is now exported. + +* `glue_sql()` and `glue_data_sql()` functions added to make constructing SQL + statements with glue safer and easier. + +* `glue()` is now easier to use when used within helper functions such as + `lapply`. + +* Fix when last expression in `glue()` is NULL. + +# glue 1.1.1 + +* Another fix for PROTECT / REPROTECT found by the rchk static analyzer. + +# glue 1.1.0 + +* Fix for PROTECT errors when resizing output strings. + +* `glue()` always returns 'UTF-8' strings, converting inputs if in other +encodings if needed. + +* `to()` and `to_data()` have been removed. + +* `glue()` and `glue_data()` can now take alternative delimiters to `{` and `}`. +This is useful if you are writing to a format that uses a lot of braces, such +as LaTeX. (#23) + +* `collapse()` now returns 0 length output if given 0 length input (#28). + +# glue 0.0.0.9000 + +* Fix `glue()` to admit `.` as an embedded expression in a string (#15, @egnha). + +* Added a `NEWS.md` file to track changes to the package. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/R/glue b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/R/glue new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/R/glue @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/R/glue.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/R/glue.rdb new file mode 100644 index 00000000..1abd51f3 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/R/glue.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/R/glue.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/R/glue.rdx new file mode 100644 index 00000000..90dde0b9 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/R/glue.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/engines.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/engines.R new file mode 100644 index 00000000..7d9224a5 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/engines.R @@ -0,0 +1,14 @@ +## ----setup, include=FALSE----------------------------------------------------- +knitr::opts_chunk$set(echo = TRUE) +library(glue) + +## ----------------------------------------------------------------------------- +con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:") +mtcars$model <- rownames(mtcars) +DBI::dbWriteTable(con, "mtcars", mtcars) + +## ----------------------------------------------------------------------------- +var <- "mpg" +tbl <- "mtcars" +num <- 150 + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/engines.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/engines.Rmd new file mode 100644 index 00000000..cf1073c2 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/engines.Rmd @@ -0,0 +1,85 @@ +--- +title: "Custom knitr language engines" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Custom knitr language engines} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = TRUE) +library(glue) +``` + +Glue provides a few [custom language engines](https://bookdown.org/yihui/rmarkdown-cookbook/custom-engine.html#custom-engine) for knitr, which allows you to use glue directly in knitr chunks. + +## `glue` engine + +The first engine is the `glue` engine, which evaluates the chunk contents as a glue template. + +```{glue} +1 + 1 = {1 + 1} +``` + +Maybe the most useful use of the `glue` engine is to set the knitr option `results = 'asis'` and output markdown or HTML directly into the document. + +````markdown +`r '' ````{glue, results = 'asis', echo = FALSE} +#### mtcars has **{nrow(mtcars)} rows** and _{ncol(mtcars)} columns_. +``` +```` + +```{glue, results = 'asis', echo = FALSE} +#### mtcars has **{nrow(mtcars)} rows** and _{ncol(mtcars)} columns_. +``` + +If you want to pass additional arguments into the glue call, simply include them as chunk options. + +````markdown +`r '' ````{glue, .open = "<<", .close = ">>", results = 'asis', echo = FALSE} +The **median waiting time** between eruptions is <>. +``` +```` + +```{glue, .open = "<<", .close = ">>", results = 'asis', echo = FALSE} +The **median waiting time** between eruptions is <>. +``` + +## `glue_sql` engine + +The second engine is `glue_sql`, which will use `glue::glue_sql()` to generate a SQL query and then run the query using the [sql engine](https://bookdown.org/yihui/rmarkdown/language-engines.html#sql). + +First we create a new connection to an in-memory SQLite database, and write a new table to it. +```{r} +con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:") +mtcars$model <- rownames(mtcars) +DBI::dbWriteTable(con, "mtcars", mtcars) +``` + +Next define some variables we that we can use with glue to interpolate. +```{r} +var <- "mpg" +tbl <- "mtcars" +num <- 150 +``` + +Then we can use `glue_sql` to construct and run a query using those variables into that database. *Note* you need to provide the connection object as a `connection` chunk option. + +In this example there are two type of quotes. The first is a bare backtick, these are passed directly to the SQL engine unchanged. +The second is backticks inside of braces, which are specially interpreted to do the proper quoting for the given SQL engine by glue. +In this example we use the `sqlite` engine, which uses backticks for quoting, but you would use the same backticks inside brace syntax for postgreSQL, and `glue_sql()` would automatically use double quotes for quoting instead. + +````markdown +`r '' ````{glue_sql, connection = con} +SELECT `model`, `hp`, {`var`} +FROM {`tbl`} +WHERE {`tbl`}.`hp` > {num} +``` +```` + +```{glue_sql, connection = con} +SELECT `model`, `hp`, {`var`} + FROM {`tbl`} + WHERE {`tbl`}.`hp` > {num} +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/engines.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/engines.html new file mode 100644 index 00000000..11016664 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/engines.html @@ -0,0 +1,486 @@ + + + + + + + + + + + + + + +Custom knitr language engines + + + + + + + + + + + + + + + + + + + + + + + + + + +

Custom knitr language engines

+ + + +

Glue provides a few custom +language engines for knitr, which allows you to use glue directly in +knitr chunks.

+
+

glue engine

+

The first engine is the glue engine, which evaluates the +chunk contents as a glue template.

+
1 + 1 = {1 + 1}
+
## 1 + 1 = 2
+

Maybe the most useful use of the glue engine is to set +the knitr option results = 'asis' and output markdown or +HTML directly into the document.

+
```{glue, results = 'asis', echo = FALSE}
+#### mtcars has **{nrow(mtcars)} rows** and _{ncol(mtcars)} columns_.
+```
+
+

mtcars has 32 rows and 11 columns.

+

If you want to pass additional arguments into the glue call, simply +include them as chunk options.

+
```{glue, .open = "<<", .close = ">>", results = 'asis', echo = FALSE}
+The **median waiting time** between eruptions is <<median(faithful$waiting)>>.
+```
+

The median waiting time between eruptions is 76.

+
+
+
+

glue_sql engine

+

The second engine is glue_sql, which will use +glue::glue_sql() to generate a SQL query and then run the +query using the sql +engine.

+

First we create a new connection to an in-memory SQLite database, and +write a new table to it.

+
con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
+mtcars$model <- rownames(mtcars)
+DBI::dbWriteTable(con, "mtcars", mtcars)
+

Next define some variables we that we can use with glue to +interpolate.

+
var <- "mpg"
+tbl <- "mtcars"
+num <- 150
+

Then we can use glue_sql to construct and run a query +using those variables into that database. Note you need to +provide the connection object as a connection chunk +option.

+

In this example there are two type of quotes. The first is a bare +backtick, these are passed directly to the SQL engine unchanged. The +second is backticks inside of braces, which are specially interpreted to +do the proper quoting for the given SQL engine by glue. In this example +we use the sqlite engine, which uses backticks for quoting, +but you would use the same backticks inside brace syntax for postgreSQL, +and glue_sql() would automatically use double quotes for +quoting instead.

+
```{glue_sql, connection = con}
+SELECT `model`, `hp`, {`var`}
+FROM {`tbl`}
+WHERE {`tbl`}.`hp` > {num}
+```
+
SELECT `model`, `hp`, `mpg`
+FROM `mtcars`
+WHERE `mtcars`.`hp` > 150
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Displaying records 1 - 10
modelhpmpg
Hornet Sportabout17518.7
Duster 36024514.3
Merc 450SE18016.4
Merc 450SL18017.3
Merc 450SLC18015.2
Cadillac Fleetwood20510.4
Lincoln Continental21510.4
Chrysler Imperial23014.7
Camaro Z2824513.3
Pontiac Firebird17519.2
+
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/glue.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/glue.R new file mode 100644 index 00000000..668001d8 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/glue.R @@ -0,0 +1,157 @@ +## ----include = FALSE---------------------------------------------------------- +knitr::opts_chunk$set(collapse = TRUE, comment = "#>") + +## ----------------------------------------------------------------------------- +library(glue) + +## ----------------------------------------------------------------------------- +glue("glue ", "some ", "text ", "together") + +## ----------------------------------------------------------------------------- +name <- "glue" +glue("We are learning how to use the {name} R package.") + +## ----------------------------------------------------------------------------- +release_date <- as.Date("2017-06-13") +glue("Release was on a {format(release_date, '%A')}.") + +## ----------------------------------------------------------------------------- +glue(" + A formatted string + Can have multiple lines + with additional indention preserved + " +) + +## ----------------------------------------------------------------------------- +foo <- function() { + glue(" + A formatted string + Can have multiple lines + with additional indention preserved") +} +foo() + +## ----------------------------------------------------------------------------- +release_date <- as.Date("2017-06-13") +glue(" + The first version of the glue package was released on \\ + a {format(release_date, '%A')}.") + +## ----------------------------------------------------------------------------- +glue( + "The first version of the glue package was released on ", + "a {format(release_date, '%A')}." +) + +## ----------------------------------------------------------------------------- +# no leading or trailing newline +x <- glue(" + blah + ") +unclass(x) + +# both a leading and trailing newline +y <- glue(" + + blah + + ") +unclass(y) + +## ----------------------------------------------------------------------------- +x <- glue(' + abc + " } + + xyz') +class(x) + +x +unclass(x) +as.character(x) + +## ----------------------------------------------------------------------------- +glue("The name of the package is {name}, not {{name}}.") + +## ----------------------------------------------------------------------------- +fn_def <- " + <> <- function(x) { + # imagine a function body here + }" +glue(fn_def, NAME = "my_function", .open = "<<", .close = ">>") + +## ----eval = FALSE------------------------------------------------------------- +# glue(..., .envir = parent.frame()) + +## ----------------------------------------------------------------------------- +x <- "the caller environment" +glue("By default, `glue()` evaluates code in {x}.") + +## ----------------------------------------------------------------------------- +x <- "the local environment" +glue( + "`glue()` can access values from {x} or from {y}. {z}", + y = "named arguments", + z = "Woo!" +) + +## ----------------------------------------------------------------------------- +mini_mtcars <- head(cbind(model = rownames(mtcars), mtcars)) +rownames(mini_mtcars) <- NULL +glue_data(mini_mtcars, "{model} has {hp} hp.") + +## ----eval = getRversion() >= "4.1.0"------------------------------------------ +mini_mtcars |> + glue_data("{model} gets {mpg} miles per gallon.") + +## ----------------------------------------------------------------------------- +con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:") +colnames(iris) <- gsub("[.]", "_", tolower(colnames(iris))) +DBI::dbWriteTable(con, "iris", iris) +var <- "sepal_width" +tbl <- "iris" +num <- 2 +val <- "setosa" +glue_sql(" + SELECT {`var`} + FROM {`tbl`} + WHERE {`tbl`}.sepal_length > {num} + AND {`tbl`}.species = {val} + ", .con = con) + +## ----------------------------------------------------------------------------- +sql <- glue_sql(" + SELECT {`var`} + FROM {`tbl`} + WHERE {`tbl`}.sepal_length > ? +", .con = con) +query <- DBI::dbSendQuery(con, sql) +DBI::dbBind(query, list(num)) +DBI::dbFetch(query, n = 4) +DBI::dbClearResult(query) + +## ----------------------------------------------------------------------------- +sub_query <- glue_sql(" + SELECT * + FROM {`tbl`} + ", .con = con) + +glue_sql(" + SELECT s.{`var`} + FROM ({sub_query}) AS s + ", .con = con) + +## ----------------------------------------------------------------------------- +glue_sql("SELECT * FROM {`tbl`} WHERE sepal_length IN ({vals*})", + vals = 1, .con = con) + +glue_sql("SELECT * FROM {`tbl`} WHERE sepal_length IN ({vals*})", + vals = 1:5, .con = con) + +glue_sql("SELECT * FROM {`tbl`} WHERE species IN ({vals*})", + vals = "setosa", .con = con) + +glue_sql("SELECT * FROM {`tbl`} WHERE species IN ({vals*})", + vals = c("setosa", "versicolor"), .con = con) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/glue.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/glue.Rmd new file mode 100644 index 00000000..73e07582 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/glue.Rmd @@ -0,0 +1,286 @@ +--- +title: "Introduction to glue" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Introduction to glue} + %\VignetteEncoding{UTF-8} + %\VignetteEngine{knitr::rmarkdown} +editor_options: + markdown: + wrap: sentence +--- + +```{r, include = FALSE} +knitr::opts_chunk$set(collapse = TRUE, comment = "#>") +``` + +The glue package contains functions for string interpolation: gluing together character strings and R code. + +```{r} +library(glue) +``` + +## Gluing and interpolating + +`glue()` can be used to glue together pieces of text: + +```{r} +glue("glue ", "some ", "text ", "together") +``` + +But glue's real power comes with `{}`: anything inside of `{}` is evaluated and pasted into the string. +This makes it easy to interpolate variables: + +```{r} +name <- "glue" +glue("We are learning how to use the {name} R package.") +``` + +As well as more complex expressions: + +```{r} +release_date <- as.Date("2017-06-13") +glue("Release was on a {format(release_date, '%A')}.") +``` + +## Control of line breaks + +`glue()` honors the line breaks in its input: + +```{r} +glue(" + A formatted string + Can have multiple lines + with additional indention preserved + " +) +``` + +The example above demonstrates some other important facts about the pre-processing of the template string: + +- An empty first or last line is automatically trimmed. +- Leading whitespace that is common across all lines is trimmed. + +The elimination of common leading whitespace is advantageous, because you aren't forced to choose between indenting your code normally and getting the output you actually want. +This is easier to appreciate when you have `glue()` inside a function body (this example also shows an alternative way of styling the end of a `glue()` call): + +```{r} +foo <- function() { + glue(" + A formatted string + Can have multiple lines + with additional indention preserved") +} +foo() +``` + +On the other hand, what if you don't want a line break in the output, but you also like to limit the length of lines in your source code to, e.g., 80 characters? +The first option is to use `\\` to break the template string into multiple lines, without getting line breaks in the output: + +```{r} +release_date <- as.Date("2017-06-13") +glue(" + The first version of the glue package was released on \\ + a {format(release_date, '%A')}.") +``` + +This comes up fairly often when an expression to evaluate inside `{}` takes up more characters than its result, i.e. `format(release_date, '%A')` versus `Tuesday`. +A second way to achieve the same result is to break the template into individual pieces, which are then concatenated. + +```{r} +glue( + "The first version of the glue package was released on ", + "a {format(release_date, '%A')}." +) +``` + +If you want an explicit newline at the start or end, include an extra empty line. + +```{r} +# no leading or trailing newline +x <- glue(" + blah + ") +unclass(x) + +# both a leading and trailing newline +y <- glue(" + + blah + + ") +unclass(y) +``` + +We use `unclass()` above to make it easier to see the absence and presence of the newlines, i.e. to reveal the literal `\n` escape sequences. +`glue()` and friends generally return a glue object, which is a character vector with the S3 class `"glue"`. +The `"glue"` class exists primarily for the sake of a print method, which displays the natural formatted result of a glue string. +Most of the time this is *exactly* what the user wants to see. +The example above happens to be an exception, where we really do want to see the underlying string representation. + +Here's another example to drive home the difference between printing a glue object and looking at its string representation. +`as.character()` is a another way to do this that is arguably more expressive. + +```{r} +x <- glue(' + abc + " } + + xyz') +class(x) + +x +unclass(x) +as.character(x) +``` + +## Delimiters + +By default, code to be evaluated goes inside `{}` in a glue string. +If want a literal curly brace in your string, double it: + +```{r} +glue("The name of the package is {name}, not {{name}}.") +``` + +Sometimes it's just more convenient to use different delimiters altogether, especially if the template text comes from elsewhere or is subject to external requirements. +Consider this example where we want to interpolate the function name into a code snippet that defines a function: + +```{r} +fn_def <- " + <> <- function(x) { + # imagine a function body here + }" +glue(fn_def, NAME = "my_function", .open = "<<", .close = ">>") +``` + +In this glue string, `{` and `}` have very special meaning. +If we forced ourselves to double them, suddenly it doesn't look like normal R code anymore. +Using alternative delimiters is a nice option in cases like this. + +## Where glue looks for values + +By default, `glue()` evaluates the code inside `{}` in the caller environment: + +```{r, eval = FALSE} +glue(..., .envir = parent.frame()) +``` + +So, for a top-level `glue()` call, that means the global environment. + +```{r} +x <- "the caller environment" +glue("By default, `glue()` evaluates code in {x}.") +``` + +But you can provide more narrowly scoped values by passing them to `glue()` in `name = value` form: + +```{r} +x <- "the local environment" +glue( + "`glue()` can access values from {x} or from {y}. {z}", + y = "named arguments", + z = "Woo!" +) +``` + +If the relevant data lives in a data frame (or list or environment), use `glue_data()` instead: + +```{r} +mini_mtcars <- head(cbind(model = rownames(mtcars), mtcars)) +rownames(mini_mtcars) <- NULL +glue_data(mini_mtcars, "{model} has {hp} hp.") +``` + +`glue_data()` is very natural to use with the pipe: + +```{r, eval = getRversion() >= "4.1.0"} +mini_mtcars |> + glue_data("{model} gets {mpg} miles per gallon.") +``` + +Returning to `glue()`, recall that it defaults to evaluation in the caller environment. +This has happy implications inside a `dplyr::mutate()` pipeline. +The data-masking feature of `mutate()` means the columns of the target data frame are "in scope" for a `glue()` call: + +```r +library(dplyr) + +mini_mtcars |> + mutate(note = glue("{model} gets {mpg} miles per gallon.")) |> + select(note, cyl, disp) +#> note cyl disp +#> 1 Mazda RX4 gets 21 miles per gallon. 6 160 +#> 2 Mazda RX4 Wag gets 21 miles per gallon. 6 160 +#> 3 Datsun 710 gets 22.8 miles per gallon. 4 108 +#> 4 Hornet 4 Drive gets 21.4 miles per gallon. 6 258 +#> 5 Hornet Sportabout gets 18.7 miles per gallon. 8 360 +#> 6 Valiant gets 18.1 miles per gallon. 6 225 +``` + +## SQL + +glue has explicit support for constructing SQL statements. +Use backticks to quote identifiers. +Normal strings and numbers are quoted appropriately for your backend. + +```{r} +con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:") +colnames(iris) <- gsub("[.]", "_", tolower(colnames(iris))) +DBI::dbWriteTable(con, "iris", iris) +var <- "sepal_width" +tbl <- "iris" +num <- 2 +val <- "setosa" +glue_sql(" + SELECT {`var`} + FROM {`tbl`} + WHERE {`tbl`}.sepal_length > {num} + AND {`tbl`}.species = {val} + ", .con = con) +``` + +`glue_sql()` can be used in conjunction with parameterized queries using `DBI::dbBind()` to provide protection for SQL Injection attacks. + +```{r} +sql <- glue_sql(" + SELECT {`var`} + FROM {`tbl`} + WHERE {`tbl`}.sepal_length > ? +", .con = con) +query <- DBI::dbSendQuery(con, sql) +DBI::dbBind(query, list(num)) +DBI::dbFetch(query, n = 4) +DBI::dbClearResult(query) +``` + +`glue_sql()` can be used to build up more complex queries with interchangeable sub queries. +It returns `DBI::SQL()` objects which are properly protected from quoting. + +```{r} +sub_query <- glue_sql(" + SELECT * + FROM {`tbl`} + ", .con = con) + +glue_sql(" + SELECT s.{`var`} + FROM ({sub_query}) AS s + ", .con = con) +``` + +If you want to input multiple values for use in SQL IN statements put `*` at the end of the value and the values will be collapsed and quoted appropriately. + +```{r} +glue_sql("SELECT * FROM {`tbl`} WHERE sepal_length IN ({vals*})", + vals = 1, .con = con) + +glue_sql("SELECT * FROM {`tbl`} WHERE sepal_length IN ({vals*})", + vals = 1:5, .con = con) + +glue_sql("SELECT * FROM {`tbl`} WHERE species IN ({vals*})", + vals = "setosa", .con = con) + +glue_sql("SELECT * FROM {`tbl`} WHERE species IN ({vals*})", + vals = c("setosa", "versicolor"), .con = con) +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/glue.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/glue.html new file mode 100644 index 00000000..bc27baf3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/glue.html @@ -0,0 +1,638 @@ + + + + + + + + + + + + + + +Introduction to glue + + + + + + + + + + + + + + + + + + + + + + + + + + +

Introduction to glue

+ + + +

The glue package contains functions for string interpolation: gluing +together character strings and R code.

+
library(glue)
+
+

Gluing and interpolating

+

glue() can be used to glue together pieces of text:

+
glue("glue ", "some ", "text ", "together")
+#> glue some text together
+

But glue’s real power comes with {}: anything inside of +{} is evaluated and pasted into the string. This makes it +easy to interpolate variables:

+
name <- "glue"
+glue("We are learning how to use the {name} R package.")
+#> We are learning how to use the glue R package.
+

As well as more complex expressions:

+
release_date <- as.Date("2017-06-13")
+glue("Release was on a {format(release_date, '%A')}.")
+#> Release was on a Tuesday.
+
+
+

Control of line breaks

+

glue() honors the line breaks in its input:

+
glue("
+  A formatted string
+  Can have multiple lines
+    with additional indention preserved
+  "
+)
+#> A formatted string
+#> Can have multiple lines
+#>   with additional indention preserved
+

The example above demonstrates some other important facts about the +pre-processing of the template string:

+
    +
  • An empty first or last line is automatically trimmed.
  • +
  • Leading whitespace that is common across all lines is trimmed.
  • +
+

The elimination of common leading whitespace is advantageous, because +you aren’t forced to choose between indenting your code normally and +getting the output you actually want. This is easier to appreciate when +you have glue() inside a function body (this example also +shows an alternative way of styling the end of a glue() +call):

+
foo <- function() {
+  glue("
+    A formatted string
+    Can have multiple lines
+      with additional indention preserved")
+}
+foo()
+#> A formatted string
+#> Can have multiple lines
+#>   with additional indention preserved
+

On the other hand, what if you don’t want a line break in the output, +but you also like to limit the length of lines in your source code to, +e.g., 80 characters? The first option is to use \\ to break +the template string into multiple lines, without getting line breaks in +the output:

+
release_date <- as.Date("2017-06-13")
+glue("
+  The first version of the glue package was released on \\
+  a {format(release_date, '%A')}.")
+#> The first version of the glue package was released on a Tuesday.
+

This comes up fairly often when an expression to evaluate inside +{} takes up more characters than its result, +i.e. format(release_date, '%A') versus +Tuesday. A second way to achieve the same result is to +break the template into individual pieces, which are then +concatenated.

+
glue(
+  "The first version of the glue package was released on ",
+  "a {format(release_date, '%A')}."
+)
+#> The first version of the glue package was released on a Tuesday.
+

If you want an explicit newline at the start or end, include an extra +empty line.

+
# no leading or trailing newline
+x <- glue("
+  blah
+  ")
+unclass(x)
+#> [1] "blah"
+
+# both a leading and trailing newline
+y <- glue("
+
+  blah
+
+  ")
+unclass(y)
+#> [1] "\nblah\n"
+

We use unclass() above to make it easier to see the +absence and presence of the newlines, i.e. to reveal the literal +\n escape sequences. glue() and friends +generally return a glue object, which is a character vector with the S3 +class "glue". The "glue" class exists +primarily for the sake of a print method, which displays the natural +formatted result of a glue string. Most of the time this is +exactly what the user wants to see. The example above happens +to be an exception, where we really do want to see the underlying string +representation.

+

Here’s another example to drive home the difference between printing +a glue object and looking at its string representation. +as.character() is a another way to do this that is arguably +more expressive.

+
x <- glue('
+  abc
+  " }
+
+  xyz')
+class(x)
+#> [1] "glue"      "character"
+
+x
+#> abc
+#> "    }
+#> 
+#> xyz
+unclass(x)
+#> [1] "abc\n\"\t}\n\nxyz"
+as.character(x)
+#> [1] "abc\n\"\t}\n\nxyz"
+
+
+

Delimiters

+

By default, code to be evaluated goes inside {} in a +glue string. If want a literal curly brace in your string, double +it:

+
glue("The name of the package is {name}, not {{name}}.")
+#> The name of the package is glue, not {name}.
+

Sometimes it’s just more convenient to use different delimiters +altogether, especially if the template text comes from elsewhere or is +subject to external requirements. Consider this example where we want to +interpolate the function name into a code snippet that defines a +function:

+
fn_def <- "
+  <<NAME>> <- function(x) {
+    # imagine a function body here
+  }"
+glue(fn_def, NAME = "my_function", .open = "<<", .close = ">>")
+#> my_function <- function(x) {
+#>   # imagine a function body here
+#> }
+

In this glue string, { and } have very +special meaning. If we forced ourselves to double them, suddenly it +doesn’t look like normal R code anymore. Using alternative delimiters is +a nice option in cases like this.

+
+
+

Where glue looks for values

+

By default, glue() evaluates the code inside +{} in the caller environment:

+
glue(..., .envir = parent.frame())
+

So, for a top-level glue() call, that means the global +environment.

+
x <- "the caller environment"
+glue("By default, `glue()` evaluates code in {x}.")
+#> By default, `glue()` evaluates code in the caller environment.
+

But you can provide more narrowly scoped values by passing them to +glue() in name = value form:

+
x <- "the local environment"
+glue(
+  "`glue()` can access values from {x} or from {y}. {z}",
+  y = "named arguments",
+  z = "Woo!"
+)
+#> `glue()` can access values from the local environment or from named arguments. Woo!
+

If the relevant data lives in a data frame (or list or environment), +use glue_data() instead:

+
mini_mtcars <- head(cbind(model = rownames(mtcars), mtcars))
+rownames(mini_mtcars) <- NULL
+glue_data(mini_mtcars, "{model} has {hp} hp.")
+#> Mazda RX4 has 110 hp.
+#> Mazda RX4 Wag has 110 hp.
+#> Datsun 710 has 93 hp.
+#> Hornet 4 Drive has 110 hp.
+#> Hornet Sportabout has 175 hp.
+#> Valiant has 105 hp.
+

glue_data() is very natural to use with the pipe:

+
mini_mtcars |>
+  glue_data("{model} gets {mpg} miles per gallon.")
+#> Mazda RX4 gets 21 miles per gallon.
+#> Mazda RX4 Wag gets 21 miles per gallon.
+#> Datsun 710 gets 22.8 miles per gallon.
+#> Hornet 4 Drive gets 21.4 miles per gallon.
+#> Hornet Sportabout gets 18.7 miles per gallon.
+#> Valiant gets 18.1 miles per gallon.
+

Returning to glue(), recall that it defaults to +evaluation in the caller environment. This has happy implications inside +a dplyr::mutate() pipeline. The data-masking feature of +mutate() means the columns of the target data frame are “in +scope” for a glue() call:

+
library(dplyr)
+
+mini_mtcars |>
+  mutate(note = glue("{model} gets {mpg} miles per gallon.")) |>
+  select(note, cyl, disp)
+#>                                            note cyl disp
+#> 1           Mazda RX4 gets 21 miles per gallon.   6  160
+#> 2       Mazda RX4 Wag gets 21 miles per gallon.   6  160
+#> 3        Datsun 710 gets 22.8 miles per gallon.   4  108
+#> 4    Hornet 4 Drive gets 21.4 miles per gallon.   6  258
+#> 5 Hornet Sportabout gets 18.7 miles per gallon.   8  360
+#> 6           Valiant gets 18.1 miles per gallon.   6  225
+
+
+

SQL

+

glue has explicit support for constructing SQL statements. Use +backticks to quote identifiers. Normal strings and numbers are quoted +appropriately for your backend.

+
con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
+colnames(iris) <- gsub("[.]", "_", tolower(colnames(iris)))
+DBI::dbWriteTable(con, "iris", iris)
+var <- "sepal_width"
+tbl <- "iris"
+num <- 2
+val <- "setosa"
+glue_sql("
+  SELECT {`var`}
+  FROM {`tbl`}
+  WHERE {`tbl`}.sepal_length > {num}
+    AND {`tbl`}.species = {val}
+  ", .con = con)
+#> <SQL> SELECT `sepal_width`
+#> FROM `iris`
+#> WHERE `iris`.sepal_length > 2
+#>   AND `iris`.species = 'setosa'
+

glue_sql() can be used in conjunction with parameterized +queries using DBI::dbBind() to provide protection for SQL +Injection attacks.

+
sql <- glue_sql("
+  SELECT {`var`}
+  FROM {`tbl`}
+  WHERE {`tbl`}.sepal_length > ?
+", .con = con)
+query <- DBI::dbSendQuery(con, sql)
+DBI::dbBind(query, list(num))
+DBI::dbFetch(query, n = 4)
+#>   sepal_width
+#> 1         3.5
+#> 2         3.0
+#> 3         3.2
+#> 4         3.1
+DBI::dbClearResult(query)
+

glue_sql() can be used to build up more complex queries +with interchangeable sub queries. It returns DBI::SQL() +objects which are properly protected from quoting.

+
sub_query <- glue_sql("
+  SELECT *
+  FROM {`tbl`}
+  ", .con = con)
+
+glue_sql("
+  SELECT s.{`var`}
+  FROM ({sub_query}) AS s
+  ", .con = con)
+#> <SQL> SELECT s.`sepal_width`
+#> FROM (SELECT *
+#> FROM `iris`) AS s
+

If you want to input multiple values for use in SQL IN statements put +* at the end of the value and the values will be collapsed +and quoted appropriately.

+
glue_sql("SELECT * FROM {`tbl`} WHERE sepal_length IN ({vals*})",
+  vals = 1, .con = con)
+#> <SQL> SELECT * FROM `iris` WHERE sepal_length IN (1)
+
+glue_sql("SELECT * FROM {`tbl`} WHERE sepal_length IN ({vals*})",
+  vals = 1:5, .con = con)
+#> <SQL> SELECT * FROM `iris` WHERE sepal_length IN (1, 2, 3, 4, 5)
+
+glue_sql("SELECT * FROM {`tbl`} WHERE species IN ({vals*})",
+  vals = "setosa", .con = con)
+#> <SQL> SELECT * FROM `iris` WHERE species IN ('setosa')
+
+glue_sql("SELECT * FROM {`tbl`} WHERE species IN ({vals*})",
+  vals = c("setosa", "versicolor"), .con = con)
+#> <SQL> SELECT * FROM `iris` WHERE species IN ('setosa', 'versicolor')
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/index.html new file mode 100644 index 00000000..e3298089 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/index.html @@ -0,0 +1,44 @@ + + +R: Vignettes and other documentation + + + +
+

Vignettes and other documentation + +

+
+
+[Top] +
+

Vignettes from package 'glue'

+ +++++++ + + + + + + + + + + + + + + + + + + + +
glue::enginesCustom knitr language enginesHTMLsourceR code
glue::glueIntroduction to glueHTMLsourceR code
glue::transformersTransformersHTMLsourceR code
glue::wrappersHow to write a function that wraps glueHTMLsourceR code
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/transformers.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/transformers.R new file mode 100644 index 00000000..6f3b54e8 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/transformers.R @@ -0,0 +1,161 @@ +## ----include = FALSE---------------------------------------------------------- +knitr::opts_chunk$set(collapse = TRUE, comment = "#>") + +## ----------------------------------------------------------------------------- +library(glue) + +## ----------------------------------------------------------------------------- +collapse_transformer <- function(regex = "[*]$", ...) { + function(text, envir) { + collapse <- grepl(regex, text) + if (collapse) { + text <- sub(regex, "", text) + } + res <- identity_transformer(text, envir) + if (collapse) { + glue_collapse(res, ...) + } else { + res + } + } +} + +glue("{1:5*}\n{letters[1:5]*}", .transformer = collapse_transformer(sep = ", ")) + +glue("{1:5*}\n{letters[1:5]*}", .transformer = collapse_transformer(sep = ", ", last = " and ")) + +x <- c("one", "two") +glue("{x}: {1:5*}", .transformer = collapse_transformer(sep = ", ")) + +## ----------------------------------------------------------------------------- +shell_transformer <- function(type = c("sh", "csh", "cmd", "cmd2")) { + type <- match.arg(type) + function(text, envir) { + res <- identity_transformer(text, envir) + shQuote(res) + } +} + +glue_sh <- function(..., .envir = parent.frame(), .type = c("sh", "csh", "cmd", "cmd2")) { + .type <- match.arg(.type) + glue(..., .envir = .envir, .transformer = shell_transformer(.type)) + +} + +filename <- "test" +writeLines(con = filename, "hello!") + +command <- glue_sh("cat {filename}") +command +system(command) + +## ----include = FALSE---------------------------------------------------------- +if (file.exists("test")) { + unlink("test") +} + +## ----eval = require("emo")---------------------------------------------------- +# emoji_transformer <- function(text, envir) { +# if (grepl("[*]$", text)) { +# text <- sub("[*]$", "", text) +# glue_collapse(ji_find(text)$emoji) +# } else { +# ji(text) +# } +# } +# +# glue_ji <- function(..., .envir = parent.frame()) { +# glue(..., .open = ":", .close = ":", .envir = .envir, .transformer = emoji_transformer) +# } +# glue_ji("one :heart:") +# glue_ji("many :heart*:") + +## ----------------------------------------------------------------------------- +sprintf_transformer <- function(text, envir) { + m <- regexpr(":.+$", text) + if (m != -1) { + format <- substring(regmatches(text, m), 2) + regmatches(text, m) <- "" + res <- identity_transformer(text, envir) + do.call(sprintf, list(glue("%{format}"), res)) + } else { + identity_transformer(text, envir) + } +} + +glue_fmt <- function(..., .envir = parent.frame()) { + glue(..., .transformer = sprintf_transformer, .envir = .envir) +} +glue_fmt("π = {pi:.3f}") + +## ----------------------------------------------------------------------------- +signif_transformer <- function(digits = 3) { + force(digits) + function(text, envir) { + x <- identity_transformer(text, envir) + if (is.numeric(x)) { + signif(x, digits = digits) + } else { + x + } + } +} +glue_signif <- function(..., .envir = parent.frame()) { + glue(..., .transformer = signif_transformer(3), .envir = .envir) +} + +glue_signif("π = {pi}; 10π = {10*pi}; 100π = {100*pi}") + +## ----------------------------------------------------------------------------- +safely_transformer <- function(otherwise = NA) { + function(text, envir) { + tryCatch( + identity_transformer(text, envir), + error = function(e) if (is.language(otherwise)) eval(otherwise) else otherwise) + } +} + +glue_safely <- function(..., .otherwise = NA, .envir = parent.frame()) { + glue(..., .transformer = safely_transformer(.otherwise), .envir = .envir) +} + +# Default returns missing if there is an error +glue_safely("foo: {xyz}") + +# Or an empty string +glue_safely("foo: {xyz}", .otherwise = "Error") + +# Or output the error message in red +library(crayon) +glue_safely("foo: {xyz}", .otherwise = quote(glue("{red}Error: {conditionMessage(e)}{reset}"))) + +## ----------------------------------------------------------------------------- +vv_transformer <- function(text, envir) { + regex <- "=$" + if (!grepl(regex, text)) { + return(identity_transformer(text, envir)) + } + + text <- sub(regex, "", text) + res <- identity_transformer(text, envir) + n <- length(res) + res <- glue_collapse(res, sep = ", ") + if (n > 1) { + res <- c("[", res, "]") + } + glue_collapse(c(text, " = ", res)) +} + +## ----------------------------------------------------------------------------- +set.seed(1234) +description <- "some random" +numbers <- sample(100, 4) +average <- mean(numbers) +sum <- sum(numbers) + +glue("For {description} {numbers=}, {average=}, {sum=}.", .transformer = vv_transformer) + +a <- 3 +b <- 5.6 +glue("{a=}\n{b=}\n{a * 9 + b * 2=}", .transformer = vv_transformer) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/transformers.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/transformers.Rmd new file mode 100644 index 00000000..5c3dd68e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/transformers.Rmd @@ -0,0 +1,236 @@ +--- +title: "Transformers" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Transformers} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +Transformers allow you to apply functions to the glue input and output, before +and after evaluation. This allows you to write things like `glue_sql()`, which +automatically quotes variables for you or add a syntax for automatically +collapsing outputs. + +The transformer functions simply take two arguments `text` and `envir`, where +`text` is the unparsed string inside the glue block and `envir` is the +execution environment. Most transformers will then call `eval(parse(text = text, +keep.source = FALSE), envir)` which parses and evaluates the code. + +You can then supply the transformer function to glue with the `.transformer` +argument. In this way users can manipulate the text before parsing and +change the output after evaluation. + +It is often useful to write a `glue()` wrapper function which supplies a +`.transformer` to `glue()` or `glue_data()` and potentially has additional +arguments. One important consideration when doing this is to include +`.envir = parent.frame()` in the wrapper to ensure the evaluation environment +is correct. + +Some example implementations of potentially useful transformers follow. The +aim right now is not to include most of these custom functions within the +`glue` package. Rather, users are encouraged to create custom functions using +transformers to fit their individual needs. + +```{r, include = FALSE} +knitr::opts_chunk$set(collapse = TRUE, comment = "#>") +``` + +```{r} +library(glue) +``` + +### collapse transformer + +A transformer which automatically collapses any glue block ending with `*`. + +```{r} +collapse_transformer <- function(regex = "[*]$", ...) { + function(text, envir) { + collapse <- grepl(regex, text) + if (collapse) { + text <- sub(regex, "", text) + } + res <- identity_transformer(text, envir) + if (collapse) { + glue_collapse(res, ...) + } else { + res + } + } +} + +glue("{1:5*}\n{letters[1:5]*}", .transformer = collapse_transformer(sep = ", ")) + +glue("{1:5*}\n{letters[1:5]*}", .transformer = collapse_transformer(sep = ", ", last = " and ")) + +x <- c("one", "two") +glue("{x}: {1:5*}", .transformer = collapse_transformer(sep = ", ")) +``` + +### Shell quoting transformer + +A transformer which automatically quotes variables for use in shell commands, +e.g. via `system()` or `system2()`. + +```{r} +shell_transformer <- function(type = c("sh", "csh", "cmd", "cmd2")) { + type <- match.arg(type) + function(text, envir) { + res <- identity_transformer(text, envir) + shQuote(res) + } +} + +glue_sh <- function(..., .envir = parent.frame(), .type = c("sh", "csh", "cmd", "cmd2")) { + .type <- match.arg(.type) + glue(..., .envir = .envir, .transformer = shell_transformer(.type)) + +} + +filename <- "test" +writeLines(con = filename, "hello!") + +command <- glue_sh("cat {filename}") +command +system(command) +``` + +```{r include = FALSE} +if (file.exists("test")) { + unlink("test") +} +``` + +### emoji transformer + +A transformer which converts the text to the equivalent emoji. + +```{r, eval = require("emo")} +emoji_transformer <- function(text, envir) { + if (grepl("[*]$", text)) { + text <- sub("[*]$", "", text) + glue_collapse(ji_find(text)$emoji) + } else { + ji(text) + } +} + +glue_ji <- function(..., .envir = parent.frame()) { + glue(..., .open = ":", .close = ":", .envir = .envir, .transformer = emoji_transformer) +} +glue_ji("one :heart:") +glue_ji("many :heart*:") +``` + +### sprintf transformer + +A transformer which allows succinct `sprintf` format strings. + +```{r} +sprintf_transformer <- function(text, envir) { + m <- regexpr(":.+$", text) + if (m != -1) { + format <- substring(regmatches(text, m), 2) + regmatches(text, m) <- "" + res <- identity_transformer(text, envir) + do.call(sprintf, list(glue("%{format}"), res)) + } else { + identity_transformer(text, envir) + } +} + +glue_fmt <- function(..., .envir = parent.frame()) { + glue(..., .transformer = sprintf_transformer, .envir = .envir) +} +glue_fmt("π = {pi:.3f}") +``` + +### signif transformer + +A transformer generator that represents numbers with a given number of significant digits. +This is useful if we want to represent all numbers using the same significant digits + +```{r} +signif_transformer <- function(digits = 3) { + force(digits) + function(text, envir) { + x <- identity_transformer(text, envir) + if (is.numeric(x)) { + signif(x, digits = digits) + } else { + x + } + } +} +glue_signif <- function(..., .envir = parent.frame()) { + glue(..., .transformer = signif_transformer(3), .envir = .envir) +} + +glue_signif("π = {pi}; 10π = {10*pi}; 100π = {100*pi}") +``` + + +### safely transformer + +A transformer that acts like `purrr::safely()`, which returns a value instead of an error. + +```{r} +safely_transformer <- function(otherwise = NA) { + function(text, envir) { + tryCatch( + identity_transformer(text, envir), + error = function(e) if (is.language(otherwise)) eval(otherwise) else otherwise) + } +} + +glue_safely <- function(..., .otherwise = NA, .envir = parent.frame()) { + glue(..., .transformer = safely_transformer(.otherwise), .envir = .envir) +} + +# Default returns missing if there is an error +glue_safely("foo: {xyz}") + +# Or an empty string +glue_safely("foo: {xyz}", .otherwise = "Error") + +# Or output the error message in red +library(crayon) +glue_safely("foo: {xyz}", .otherwise = quote(glue("{red}Error: {conditionMessage(e)}{reset}"))) +``` + +### "Variables and Values" transformer + +A transformer that expands input of the form `{var_name=}` into `var_name = var_value`, i.e. a shorthand for exposing variable names with their values. This is inspired by an [f-strings feature coming in Python 3.8](https://docs.python.org/3.8/whatsnew/3.8.html#f-strings-now-support-for-quick-and-easy-debugging). It's actually more general: you can use it with an expression input such as `{expr=}`. + +```{r} +vv_transformer <- function(text, envir) { + regex <- "=$" + if (!grepl(regex, text)) { + return(identity_transformer(text, envir)) + } + + text <- sub(regex, "", text) + res <- identity_transformer(text, envir) + n <- length(res) + res <- glue_collapse(res, sep = ", ") + if (n > 1) { + res <- c("[", res, "]") + } + glue_collapse(c(text, " = ", res)) +} +``` + +```{r} +set.seed(1234) +description <- "some random" +numbers <- sample(100, 4) +average <- mean(numbers) +sum <- sum(numbers) + +glue("For {description} {numbers=}, {average=}, {sum=}.", .transformer = vv_transformer) + +a <- 3 +b <- 5.6 +glue("{a=}\n{b=}\n{a * 9 + b * 2=}", .transformer = vv_transformer) +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/transformers.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/transformers.html new file mode 100644 index 00000000..73ba3097 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/transformers.html @@ -0,0 +1,575 @@ + + + + + + + + + + + + + + +Transformers + + + + + + + + + + + + + + + + + + + + + + + + + + +

Transformers

+ + + +

Transformers allow you to apply functions to the glue input and +output, before and after evaluation. This allows you to write things +like glue_sql(), which automatically quotes variables for +you or add a syntax for automatically collapsing outputs.

+

The transformer functions simply take two arguments text +and envir, where text is the unparsed string +inside the glue block and envir is the execution +environment. Most transformers will then call +eval(parse(text = text, keep.source = FALSE), envir) which +parses and evaluates the code.

+

You can then supply the transformer function to glue with the +.transformer argument. In this way users can manipulate the +text before parsing and change the output after evaluation.

+

It is often useful to write a glue() wrapper function +which supplies a .transformer to glue() or +glue_data() and potentially has additional arguments. One +important consideration when doing this is to include +.envir = parent.frame() in the wrapper to ensure the +evaluation environment is correct.

+

Some example implementations of potentially useful transformers +follow. The aim right now is not to include most of these custom +functions within the glue package. Rather, users are +encouraged to create custom functions using transformers to fit their +individual needs.

+
library(glue)
+
+

collapse transformer

+

A transformer which automatically collapses any glue block ending +with *.

+
collapse_transformer <- function(regex = "[*]$", ...) {
+  function(text, envir) {
+    collapse <- grepl(regex, text)
+    if (collapse) {
+      text <- sub(regex, "", text)
+    }
+    res <- identity_transformer(text, envir)
+    if (collapse) {
+      glue_collapse(res, ...)  
+    } else {
+      res
+    }
+  }
+}
+
+glue("{1:5*}\n{letters[1:5]*}", .transformer = collapse_transformer(sep = ", "))
+#> 1, 2, 3, 4, 5
+#> a, b, c, d, e
+
+glue("{1:5*}\n{letters[1:5]*}", .transformer = collapse_transformer(sep = ", ", last = " and "))
+#> 1, 2, 3, 4 and 5
+#> a, b, c, d and e
+
+x <- c("one", "two")
+glue("{x}: {1:5*}", .transformer = collapse_transformer(sep = ", "))
+#> one: 1, 2, 3, 4, 5
+#> two: 1, 2, 3, 4, 5
+
+
+

Shell quoting transformer

+

A transformer which automatically quotes variables for use in shell +commands, e.g. via system() or system2().

+
shell_transformer <- function(type = c("sh", "csh", "cmd", "cmd2")) {
+  type <- match.arg(type)
+  function(text, envir) {
+    res <- identity_transformer(text, envir)
+    shQuote(res)
+  }
+}
+
+glue_sh <- function(..., .envir = parent.frame(), .type = c("sh", "csh", "cmd", "cmd2")) {
+  .type <- match.arg(.type)
+  glue(..., .envir = .envir, .transformer = shell_transformer(.type))
+
+}
+
+filename <- "test"
+writeLines(con = filename, "hello!")
+
+command <- glue_sh("cat {filename}")
+command
+#> cat 'test'
+system(command)
+
+
+

emoji transformer

+

A transformer which converts the text to the equivalent emoji.

+
emoji_transformer <- function(text, envir) {
+  if (grepl("[*]$", text)) {
+    text <- sub("[*]$", "", text)
+    glue_collapse(ji_find(text)$emoji)
+  } else {
+    ji(text)
+  }
+}
+
+glue_ji <- function(..., .envir = parent.frame()) {
+  glue(..., .open = ":", .close = ":", .envir = .envir, .transformer = emoji_transformer)
+}
+glue_ji("one :heart:")
+glue_ji("many :heart*:")
+
+
+

sprintf transformer

+

A transformer which allows succinct sprintf format +strings.

+
sprintf_transformer <- function(text, envir) {
+  m <- regexpr(":.+$", text)
+  if (m != -1) {
+    format <- substring(regmatches(text, m), 2)
+    regmatches(text, m) <- ""
+    res <- identity_transformer(text, envir)
+    do.call(sprintf, list(glue("%{format}"), res))
+  } else {
+    identity_transformer(text, envir)
+  }
+}
+
+glue_fmt <- function(..., .envir = parent.frame()) {
+  glue(..., .transformer = sprintf_transformer, .envir = .envir)
+}
+glue_fmt("π = {pi:.3f}")
+#> π = 3.142
+
+
+

signif transformer

+

A transformer generator that represents numbers with a given number +of significant digits. This is useful if we want to represent all +numbers using the same significant digits

+
signif_transformer <- function(digits = 3) {
+    force(digits)
+    function(text, envir) {
+        x <- identity_transformer(text, envir)
+        if (is.numeric(x)) {
+            signif(x, digits = digits)
+        } else {
+            x
+        }
+    }
+}
+glue_signif <- function(..., .envir = parent.frame()) {
+  glue(..., .transformer = signif_transformer(3), .envir = .envir)
+}
+
+glue_signif("π = {pi}; 10π = {10*pi}; 100π = {100*pi}")
+#> π = 3.14; 10π = 31.4; 100π = 314
+
+
+

safely transformer

+

A transformer that acts like purrr::safely(), which +returns a value instead of an error.

+
safely_transformer <- function(otherwise = NA) {
+  function(text, envir) {
+    tryCatch(
+      identity_transformer(text, envir),
+      error = function(e) if (is.language(otherwise)) eval(otherwise) else otherwise)
+  }
+}
+
+glue_safely <- function(..., .otherwise = NA, .envir = parent.frame()) {
+  glue(..., .transformer = safely_transformer(.otherwise), .envir = .envir)
+}
+
+# Default returns missing if there is an error
+glue_safely("foo: {xyz}")
+#> foo: NA
+
+# Or an empty string
+glue_safely("foo: {xyz}", .otherwise = "Error")
+#> foo: Error
+
+# Or output the error message in red
+library(crayon)
+glue_safely("foo: {xyz}", .otherwise = quote(glue("{red}Error: {conditionMessage(e)}{reset}")))
+#> foo: Error: Failed to evaluate glue component {xyz}
+#> Caused by error:
+#> ! object 'xyz' not found
+
+
+

“Variables and Values” transformer

+

A transformer that expands input of the form {var_name=} +into var_name = var_value, i.e. a shorthand for exposing +variable names with their values. This is inspired by an f-strings +feature coming in Python 3.8. It’s actually more general: you can +use it with an expression input such as {expr=}.

+
vv_transformer <- function(text, envir) {
+  regex <- "=$"
+  if (!grepl(regex, text)) {
+    return(identity_transformer(text, envir))
+  }
+
+  text <- sub(regex, "", text)
+  res <- identity_transformer(text, envir)
+  n <- length(res)
+  res <- glue_collapse(res, sep = ", ")
+  if (n > 1) {
+    res <- c("[", res, "]")
+  }
+  glue_collapse(c(text, " = ", res))
+}
+
set.seed(1234)
+description <- "some random"
+numbers <- sample(100, 4)
+average <- mean(numbers)
+sum <- sum(numbers)
+
+glue("For {description} {numbers=}, {average=}, {sum=}.", .transformer = vv_transformer)
+#> For some random numbers = [28, 80, 22, 9], average = 34.75, sum = 139.
+
+a <- 3
+b <- 5.6
+glue("{a=}\n{b=}\n{a * 9 + b * 2=}", .transformer = vv_transformer)
+#> a = 3
+#> b = 5.6
+#> a * 9 + b * 2 = 38.2
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/wrappers.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/wrappers.R new file mode 100644 index 00000000..e50f365e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/wrappers.R @@ -0,0 +1,89 @@ +## ----include = FALSE---------------------------------------------------------- +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) + +## ----setup-------------------------------------------------------------------- +library(glue) + +## ----------------------------------------------------------------------------- +my_glue <- function(..., .envir = parent.frame()) { + glue(..., .open = "<<", .close = ">>", .envir = .envir) +} + +## ----------------------------------------------------------------------------- +sw_meta <- list( + name = "Name of the character", + height = "Height (cm)", + mass = "Weight (kg)", + species = "Name of species", + films = "List of films the character appeared in" +) + +## ----------------------------------------------------------------------------- +my_glue = function(...) { + glue(..., .open = "<<", .close = ">>", .envir = parent.frame()) +} + +named_list_to_items <- function(x) { + my_glue("\\item{<>}{<>}") +} + +## ----------------------------------------------------------------------------- +named_list_to_items(sw_meta) + +## ----error = TRUE------------------------------------------------------------- +my_glue_WRONG <- function(...) { + glue(..., .open = "<<", .close = ">>") +} + +named_list_to_items_WRONG <- function(x) { + my_glue_WRONG("\\item{<>}{<>}") +} + +named_list_to_items_WRONG(sw_meta) + +## ----eval = FALSE------------------------------------------------------------- +# glue(..., .envir = parent.frame(), ...) + +## ----------------------------------------------------------------------------- +x <- 0 +y <- 0 +z <- 0 + +glue("{x} {y} {z}") + +## ----------------------------------------------------------------------------- +my_glue1 <- function(...) { + x <- 1 + glue(...) +} + +my_glue1("{x} {y} {z}") + +## ----------------------------------------------------------------------------- +my_glue2 <- function(...) { + x <- 2 + y <- 2 + my_glue1(...) +} + +my_glue2("{x} {y} {z}") + +## ----------------------------------------------------------------------------- +my_glue3 <- function(..., .envir = parent.frame()) { + x <- 3 + glue(..., .envir = .envir) +} + +my_glue3("{x} {y} {z}") + +my_glue4 <- function(...) { + x <- 4 + y <- 4 + my_glue3(...) +} + +my_glue4("{x} {y} {z}") + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/wrappers.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/wrappers.Rmd new file mode 100644 index 00000000..b7aebafc --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/wrappers.Rmd @@ -0,0 +1,178 @@ +--- +title: "How to write a function that wraps glue" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{How to write a function that wraps glue} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + +```{r setup} +library(glue) +``` + +Imagine that you want to call `glue()` repeatedly inside your own code (e.g. in your own package) with a non-default value for one or more arguments. +For example, maybe you anticipate producing R code where `{` and `}` have specific syntactic meaning. +Therefore, you'd prefer to use `<<` and `>>` as the opening and closing delimiters for expressions in `glue()`. + +Spoiler alert: here's the correct way to write such a wrapper: + +```{r} +my_glue <- function(..., .envir = parent.frame()) { + glue(..., .open = "<<", .close = ">>", .envir = .envir) +} +``` + +This is the key move: + +> Include `.envir = parent.frame()` as an argument of the wrapper function and pass this `.envir` to the `.envir` argument of `glue()`. + +If you'd like to know why this is the way, keep reading. +It pays off to understand this, because the technique applies more broadly than glue. +Once you recognize this setup, you'll see it in many functions in the withr, cli, and rlang packages (e.g. `withr::defer()`, `cli::cli_abort()`, `rlang::abort()`). + +## Working example + +Here's an abbreviated excerpt of the roxygen comment that generates the documentation for the starwars dataset in dplyr (`?dplyr::starwars`): + +```r +#' \describe{ +#' \item{name}{Name of the character} +#' \item{height}{Height (cm)} +#' \item{mass}{Weight (kg)} +#' \item{species}{Name of species} +#' \item{films}{List of films the character appeared in} +#' } +``` + +To produce such text programmatically, the first step might be to generate the `\item{}{}` lines from a named list of column names and descriptions. +Notice that `{` and `}` are important to the `\describe{...}` and `\item{}{}` syntax, so this is an example where it is nice for glue to use different delimiters for expressions. + +Put the metadata in a suitable list: + +```{r} +sw_meta <- list( + name = "Name of the character", + height = "Height (cm)", + mass = "Weight (kg)", + species = "Name of species", + films = "List of films the character appeared in" +) +``` + +Define a custom glue wrapper and use it inside another helper that generates `\item` entries[^1]: + +[^1]: Note that delimiters `<<` and `>>` have special meaning in knitr (they are used for a templating feature in knitr itself). So in code chunks inside RMarkdown or Quarto documents, you may need to use different delimiters. + +```{r} +my_glue = function(...) { + glue(..., .open = "<<", .close = ">>", .envir = parent.frame()) +} + +named_list_to_items <- function(x) { + my_glue("\\item{<>}{<>}") +} +``` + +Apply `named_list_to_items()` to starwars metadata: + +```{r} +named_list_to_items(sw_meta) +``` + +Here's how this would fail if we did *not* handle `.envir` correctly in our wrapper function: + +```{r, error = TRUE} +my_glue_WRONG <- function(...) { + glue(..., .open = "<<", .close = ">>") +} + +named_list_to_items_WRONG <- function(x) { + my_glue_WRONG("\\item{<>}{<>}") +} + +named_list_to_items_WRONG(sw_meta) +``` + +It can be hard to understand why `x` can't be found, when it is clearly available inside `named_list_to_items_WRONG()`. +Why isn't `x` available to `my_glue_WRONG()`? + +## Where does `glue()` evaluate code? + +What's going on? +It's time to look at the (redacted) signature of `glue()`: + +```{r, eval = FALSE} +glue(..., .envir = parent.frame(), ...) +``` + +The expressions inside a glue string are evaluated with respect to `.envir`, which defaults to the environment where `glue()` is called from. + +Everything is simple when evaluating `glue()` in the global environment: + +```{r} +x <- 0 +y <- 0 +z <- 0 + +glue("{x} {y} {z}") +``` + +Now we wrap `glue()` in our own simple function, `my_glue1()`. +Notice that `my_glue1()` does not capture its caller environment and pass that along. + +When we execute `my_glue1()` in the global environment, there's no obvious problem. + +```{r} +my_glue1 <- function(...) { + x <- 1 + glue(...) +} + +my_glue1("{x} {y} {z}") +``` + +The value of `x` is found in the execution environment of `my_glue1()`. +The values of `y` and `z` are found in the global environment. +Importantly, this is because that is the environment where `my_glue1()` is defined, not because that is where `my_glue1()` is called. + +However, if we call our `my_glue1()` inside another function, we see that all is not well. + +```{r} +my_glue2 <- function(...) { + x <- 2 + y <- 2 + my_glue1(...) +} + +my_glue2("{x} {y} {z}") +``` + +Why do `x` and `y` not have the value 2? +Because `my_glue1()` and its eventual call to `glue()` have no access to the execution environment of `my_glue2()`, which is the caller environment of `my_glue1()`. + +If you want your glue wrapper to behave like `glue()` itself and to work as expected inside other functions, make sure it captures its caller environment and passes that along to `glue()`. + +```{r} +my_glue3 <- function(..., .envir = parent.frame()) { + x <- 3 + glue(..., .envir = .envir) +} + +my_glue3("{x} {y} {z}") + +my_glue4 <- function(...) { + x <- 4 + y <- 4 + my_glue3(...) +} + +my_glue4("{x} {y} {z}") +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/wrappers.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/wrappers.html new file mode 100644 index 00000000..643ddea0 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/doc/wrappers.html @@ -0,0 +1,519 @@ + + + + + + + + + + + + + + +How to write a function that wraps glue + + + + + + + + + + + + + + + + + + + + + + + + + + +

How to write a function that wraps +glue

+ + + +
library(glue)
+

Imagine that you want to call glue() repeatedly inside +your own code (e.g. in your own package) with a non-default value for +one or more arguments. For example, maybe you anticipate producing R +code where { and } have specific syntactic +meaning. Therefore, you’d prefer to use << and +>> as the opening and closing delimiters for +expressions in glue().

+

Spoiler alert: here’s the correct way to write such a wrapper:

+
my_glue <- function(..., .envir = parent.frame()) {
+  glue(..., .open = "<<", .close = ">>", .envir = .envir)
+}
+

This is the key move:

+
+

Include .envir = parent.frame() as an argument of the +wrapper function and pass this .envir to the +.envir argument of glue().

+
+

If you’d like to know why this is the way, keep reading. It pays off +to understand this, because the technique applies more broadly than +glue. Once you recognize this setup, you’ll see it in many functions in +the withr, cli, and rlang packages (e.g. withr::defer(), +cli::cli_abort(), rlang::abort()).

+
+

Working example

+

Here’s an abbreviated excerpt of the roxygen comment that generates +the documentation for the starwars dataset in dplyr +(?dplyr::starwars):

+
#' \describe{
+#' \item{name}{Name of the character}
+#' \item{height}{Height (cm)}
+#' \item{mass}{Weight (kg)}
+#' \item{species}{Name of species}
+#' \item{films}{List of films the character appeared in}
+#' }
+

To produce such text programmatically, the first step might be to +generate the \item{}{} lines from a named list of column +names and descriptions. Notice that { and } +are important to the \describe{...} and +\item{}{} syntax, so this is an example where it is nice +for glue to use different delimiters for expressions.

+

Put the metadata in a suitable list:

+
sw_meta <- list(
+  name    = "Name of the character",
+  height  = "Height (cm)",
+  mass    = "Weight (kg)",
+  species = "Name of species",
+  films   = "List of films the character appeared in"
+)
+

Define a custom glue wrapper and use it inside another helper that +generates \item entries1:

+
my_glue = function(...) {
+  glue(..., .open = "<<", .close = ">>", .envir = parent.frame())
+}
+
+named_list_to_items <- function(x) {
+  my_glue("\\item{<<names(x)>>}{<<x>>}")
+}
+

Apply named_list_to_items() to starwars metadata:

+
named_list_to_items(sw_meta)
+#> \item{name}{Name of the character}
+#> \item{height}{Height (cm)}
+#> \item{mass}{Weight (kg)}
+#> \item{species}{Name of species}
+#> \item{films}{List of films the character appeared in}
+

Here’s how this would fail if we did not handle +.envir correctly in our wrapper function:

+
my_glue_WRONG <- function(...) {
+  glue(..., .open = "<<", .close = ">>")
+}
+
+named_list_to_items_WRONG <- function(x) {
+  my_glue_WRONG("\\item{<<names(x)>>}{<<x>>}")
+}
+
+named_list_to_items_WRONG(sw_meta)
+

It can be hard to understand why x can’t be found, when +it is clearly available inside named_list_to_items_WRONG(). +Why isn’t x available to my_glue_WRONG()?

+
+
+

Where does glue() evaluate code?

+

What’s going on? It’s time to look at the (redacted) signature of +glue():

+
glue(..., .envir = parent.frame(), ...)
+

The expressions inside a glue string are evaluated with respect to +.envir, which defaults to the environment where +glue() is called from.

+

Everything is simple when evaluating glue() in the +global environment:

+
x <- 0
+y <- 0
+z <- 0
+
+glue("{x} {y} {z}")
+#> 0 0 0
+

Now we wrap glue() in our own simple function, +my_glue1(). Notice that my_glue1() does not +capture its caller environment and pass that along.

+

When we execute my_glue1() in the global environment, +there’s no obvious problem.

+
my_glue1 <- function(...) {
+  x <- 1
+  glue(...)
+}
+
+my_glue1("{x} {y} {z}")
+#> 1 0 0
+

The value of x is found in the execution environment of +my_glue1(). The values of y and z +are found in the global environment. Importantly, this is because that +is the environment where my_glue1() is defined, not because +that is where my_glue1() is called.

+

However, if we call our my_glue1() inside another +function, we see that all is not well.

+
my_glue2 <- function(...) {
+  x <- 2
+  y <- 2
+  my_glue1(...)
+}
+
+my_glue2("{x} {y} {z}")
+#> 1 0 0
+

Why do x and y not have the value 2? +Because my_glue1() and its eventual call to +glue() have no access to the execution environment of +my_glue2(), which is the caller environment of +my_glue1().

+

If you want your glue wrapper to behave like glue() +itself and to work as expected inside other functions, make sure it +captures its caller environment and passes that along to +glue().

+
my_glue3 <- function(..., .envir = parent.frame()) {
+  x <- 3
+  glue(..., .envir = .envir)
+}
+
+my_glue3("{x} {y} {z}")
+#> 0 0 0
+
+my_glue4 <- function(...) {
+  x <- 4
+  y <- 4
+  my_glue3(...)
+}
+
+my_glue4("{x} {y} {z}")
+#> 4 4 0
+
+
+
+
    +
  1. Note that delimiters << and +>> have special meaning in knitr (they are used for a +templating feature in knitr itself). So in code chunks inside RMarkdown +or Quarto documents, you may need to use different delimiters.↩︎

  2. +
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/help/AnIndex new file mode 100644 index 00000000..3fa834ac --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/help/AnIndex @@ -0,0 +1,18 @@ +glue-package glue-package +as_glue as_glue +backtick quoting +double_quote quoting +glue glue +glue_col glue_col +glue_collapse glue_collapse +glue_data glue +glue_data_col glue_col +glue_data_safe glue_safe +glue_data_sql glue_sql +glue_safe glue_safe +glue_sql glue_sql +glue_sql_collapse glue_collapse +identity_transformer identity_transformer +quoting quoting +single_quote quoting +trim trim diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/help/aliases.rds new file mode 100644 index 00000000..4568ff9d Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/help/figures/logo.png b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/help/figures/logo.png new file mode 100644 index 00000000..b9ba3c66 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/help/figures/logo.png differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/help/glue.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/help/glue.rdb new file mode 100644 index 00000000..b154c6da Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/help/glue.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/help/glue.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/help/glue.rdx new file mode 100644 index 00000000..dabfa933 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/help/glue.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/help/paths.rds new file mode 100644 index 00000000..183b4fa0 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/html/00Index.html new file mode 100644 index 00000000..9872ecc9 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/html/00Index.html @@ -0,0 +1,61 @@ + + +R: Interpreted String Literals + + + +
+

Interpreted String Literals + +

+
+
+[Up] +[Top] +

Documentation for package ‘glue’ version 1.8.0

+ + + +

Help Pages

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
as_glueCoerce object to glue
backtickQuoting operators
double_quoteQuoting operators
glueFormat and interpolate a string
glue_colConstruct strings with color
glue_collapseCollapse a character vector
glue_dataFormat and interpolate a string
glue_data_colConstruct strings with color
glue_data_safeSafely interpolate strings
glue_data_sqlInterpolate strings with SQL escaping
glue_safeSafely interpolate strings
glue_sqlInterpolate strings with SQL escaping
glue_sql_collapseCollapse a character vector
identity_transformerParse and Evaluate R code
quotingQuoting operators
single_quoteQuoting operators
trimTrim a character vector
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/libs/glue.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/libs/glue.so new file mode 100755 index 00000000..fc4c7466 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/libs/glue.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/libs/glue.so.dSYM/Contents/Info.plist b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/libs/glue.so.dSYM/Contents/Info.plist new file mode 100644 index 00000000..311bb53c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/libs/glue.so.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.glue.so + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/libs/glue.so.dSYM/Contents/Resources/DWARF/glue.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/libs/glue.so.dSYM/Contents/Resources/DWARF/glue.so new file mode 100644 index 00000000..e8615b33 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/glue/libs/glue.so.dSYM/Contents/Resources/DWARF/glue.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/DESCRIPTION new file mode 100644 index 00000000..93d7e84c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/DESCRIPTION @@ -0,0 +1,38 @@ +Package: highr +Type: Package +Title: Syntax Highlighting for R Source Code +Version: 0.11 +Authors@R: c( + person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")), + person("Yixuan", "Qiu", role = "aut"), + person("Christopher", "Gandrud", role = "ctb"), + person("Qiang", "Li", role = "ctb") + ) +Description: Provides syntax highlighting for R source code. Currently it + supports LaTeX and HTML output. Source code of other languages is supported + via Andre Simon's highlight package (). +Depends: R (>= 3.3.0) +Imports: xfun (>= 0.18) +Suggests: knitr, markdown, testit +License: GPL +URL: https://github.com/yihui/highr +BugReports: https://github.com/yihui/highr/issues +VignetteBuilder: knitr +Encoding: UTF-8 +RoxygenNote: 7.3.1 +NeedsCompilation: no +Packaged: 2024-05-26 19:27:21 UTC; yihui +Author: Yihui Xie [aut, cre] (), + Yixuan Qiu [aut], + Christopher Gandrud [ctb], + Qiang Li [ctb] +Maintainer: Yihui Xie +Repository: CRAN +Date/Publication: 2024-05-26 20:00:03 UTC +Built: R 4.4.1; ; 2025-02-01 04:51:47 UTC; unix +RemoteType: standard +RemotePkgRef: highr +RemoteRef: highr +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 0.11 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/INDEX new file mode 100644 index 00000000..6bd66712 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/INDEX @@ -0,0 +1,2 @@ +hi_andre A wrapper to Andre Simon's Highlight +hilight Syntax highlight an R code fragment diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/Meta/Rd.rds new file mode 100644 index 00000000..f07610c3 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/Meta/hsearch.rds new file mode 100644 index 00000000..5502c22e Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/Meta/links.rds new file mode 100644 index 00000000..1f58de41 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/Meta/nsInfo.rds new file mode 100644 index 00000000..5b78e06d Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/Meta/package.rds new file mode 100644 index 00000000..8b79fb3e Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/Meta/vignette.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/Meta/vignette.rds new file mode 100644 index 00000000..8e07e3de Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/Meta/vignette.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/NAMESPACE new file mode 100644 index 00000000..ac3acc5c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/NAMESPACE @@ -0,0 +1,7 @@ +# Generated by roxygen2: do not edit by hand + +export(hi_andre) +export(hi_html) +export(hi_latex) +export(hilight) +import(utils) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/NEWS.Rd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/NEWS.Rd new file mode 100644 index 00000000..ec99d563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/NEWS.Rd @@ -0,0 +1,9 @@ +\name{NEWS} +\title{News for Package 'highr'} + +\section{CHANGES IN highr VERSION 999.999}{ + \itemize{ + \item This NEWS file is only a placeholder. The version 999.999 does not really + exist. Please read the NEWS on Github: \url{https://github.com/yihui/highr/releases} + } +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/R/highr b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/R/highr new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/R/highr @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/R/highr.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/R/highr.rdb new file mode 100644 index 00000000..63196ffe Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/R/highr.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/R/highr.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/R/highr.rdx new file mode 100644 index 00000000..8d583a50 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/R/highr.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/doc/highr-custom.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/doc/highr-custom.R new file mode 100644 index 00000000..83707371 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/doc/highr-custom.R @@ -0,0 +1,13 @@ +## ----------------------------------------------------------------------------- +library(highr) +highr:::cmd_latex + +## ----------------------------------------------------------------------------- +m = highr:::cmd_latex +m[, 1] = sub('\\hl', '\\my', m[, 1], fixed = TRUE) +head(m) + +## ----------------------------------------------------------------------------- +hilight("x = 1+1 # a comment") # default markup +hilight("x = 1+1 # a comment", markup = m) # custom markup + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/doc/highr-custom.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/doc/highr-custom.Rmd new file mode 100644 index 00000000..f1e2aa4c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/doc/highr-custom.Rmd @@ -0,0 +1,39 @@ + + +# Customization of the `highr` package + +If you are not satisfied with the default syntax highlighting commands in +the **highr** package, you can just use your own tags/commands. In this +vignette, we show a brief example. + +The default highlighting commands are stored in two internal data frames +`cmd_latex` and `cmd_html`: + +```{r} +library(highr) +highr:::cmd_latex +``` + +This data frame is passed to the `markup` argument in `hilight()`, so we are +free to pass a modified version there. Suppose I want to use the command +`\my<*>` instead of `\hl<*>`: + +```{r} +m = highr:::cmd_latex +m[, 1] = sub('\\hl', '\\my', m[, 1], fixed = TRUE) +head(m) +``` + +Then + +```{r} +hilight("x = 1+1 # a comment") # default markup +hilight("x = 1+1 # a comment", markup = m) # custom markup +``` + +This allows one to use arbitrary commands around the text symbols in the R +code. See for how +`cmd_latex` and `cmd_html` were generated in **highr**. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/doc/highr-custom.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/doc/highr-custom.html new file mode 100644 index 00000000..88a3e73a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/doc/highr-custom.html @@ -0,0 +1,111 @@ + + + + + +Customization of the <code>highr</code> package + + + + +
+

Customization of the highr package

+

+

+
+
+ +

Customization of the highr package

+

If you are not satisfied with the default syntax highlighting commands in +the highr package, you can just use your own tags/commands. In this +vignette, we show a brief example.

+

The default highlighting commands are stored in two internal data frames +cmd_latex and cmd_html:

+
library(highr)
+highr:::cmd_latex
+
+
##                          cmd1 cmd2
+## COMMENT              \\hlcom{    }
+## DEFAULT              \\hldef{    }
+## FUNCTION             \\hlkwa{    }
+## IF                   \\hlkwa{    }
+## ELSE                 \\hlkwa{    }
+## WHILE                \\hlkwa{    }
+## FOR                  \\hlkwa{    }
+## IN                   \\hlkwa{    }
+## BREAK                \\hlkwa{    }
+## REPEAT               \\hlkwa{    }
+## NEXT                 \\hlkwa{    }
+## NULL_CONST           \\hlkwa{    }
+## LEFT_ASSIGN          \\hlkwb{    }
+## EQ_ASSIGN            \\hlkwb{    }
+## RIGHT_ASSIGN         \\hlkwb{    }
+## SYMBOL_FORMALS       \\hlkwc{    }
+## SYMBOL_SUB           \\hlkwc{    }
+## SLOT                 \\hlkwc{    }
+## SYMBOL_FUNCTION_CALL \\hlkwd{    }
+## NUM_CONST            \\hlnum{    }
+## '+'                  \\hlopt{    }
+## '-'                  \\hlopt{    }
+## '*'                  \\hlopt{    }
+## '/'                  \\hlopt{    }
+## '^'                  \\hlopt{    }
+## '$'                  \\hlopt{    }
+## '@'                  \\hlopt{    }
+## ':'                  \\hlopt{    }
+## '?'                  \\hlopt{    }
+## '~'                  \\hlopt{    }
+## '!'                  \\hlopt{    }
+## SPECIAL              \\hlopt{    }
+## GT                   \\hlopt{    }
+## GE                   \\hlopt{    }
+## LT                   \\hlopt{    }
+## LE                   \\hlopt{    }
+## EQ                   \\hlopt{    }
+## NE                   \\hlopt{    }
+## AND                  \\hlopt{    }
+## AND2                 \\hlopt{    }
+## OR                   \\hlopt{    }
+## OR2                  \\hlopt{    }
+## NS_GET               \\hlopt{    }
+## NS_GET_INT           \\hlopt{    }
+## STR_CONST            \\hlsng{    }
+
+

This data frame is passed to the markup argument in hilight(), so we are +free to pass a modified version there. Suppose I want to use the command +\my<*> instead of \hl<*>:

+
m = highr:::cmd_latex
+m[, 1] = sub('\\hl', '\\my', m[, 1], fixed = TRUE)
+head(m)
+
+
##              cmd1 cmd2
+## COMMENT  \\mycom{    }
+## DEFAULT  \\mydef{    }
+## FUNCTION \\mykwa{    }
+## IF       \\mykwa{    }
+## ELSE     \\mykwa{    }
+## WHILE    \\mykwa{    }
+
+

Then

+
hilight("x = 1+1  # a comment")  # default markup
+
+
## [1] "\\hldef{x} \\hlkwb{=} \\hlnum{1}\\hlopt{+}\\hlnum{1}  \\hlcom{# a comment}"
+
+
hilight("x = 1+1  # a comment", markup = m)  # custom markup
+
+
## [1] "\\mydef{x} \\mykwb{=} \\mynum{1}\\myopt{+}\\mynum{1}  \\mycom{# a comment}"
+
+

This allows one to use arbitrary commands around the text symbols in the R +code. See https://github.com/yihui/highr/blob/master/R/highlight.R for how +cmd_latex and cmd_html were generated in highr.

+
+ + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/doc/highr-internals.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/doc/highr-internals.R new file mode 100644 index 00000000..80a074e8 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/doc/highr-internals.R @@ -0,0 +1,42 @@ +## ----------------------------------------------------------------------------- +p = parse(text = " xx = 1 + 1 # a comment", keep.source = TRUE) +(d = getParseData(p)) + +## ----------------------------------------------------------------------------- +(d = d[d$terminal, ]) + +## ----------------------------------------------------------------------------- +head(highr:::cmd_latex) +tail(highr:::cmd_html) + +## ----------------------------------------------------------------------------- +d$token +rownames(highr:::cmd_latex) + +## ----------------------------------------------------------------------------- +(z = d[, c('col1', 'col2')]) # take out the column positions +(z = t(z)) # transpose the matrix +(z = c(z)) # turn it into a vector +(z = c(0, head(z, -1))) # append 0 in the beginning, and remove the last element +(z = matrix(z, ncol = 2, byrow = TRUE)) + +## ----------------------------------------------------------------------------- +(s = z[, 2] - z[, 1] - 1) +(s = strrep(' ', s)) +paste(s, d$text, sep = '') + +## ----------------------------------------------------------------------------- +m = highr:::cmd_latex[d$token, ] +cbind(d, m) +# use standard markup if tokens do not exist in the table +m[is.na(m[, 1]), ] = highr:::cmd_latex['DEFAULT', ] +paste(s, m[, 1], d$text, m[, 2], sep = '', collapse = '') + +## ----------------------------------------------------------------------------- +d = getParseData(parse(text = "x = \"a character\nstring\" #hi", keep.source = TRUE)) +(d = d[d$terminal, ]) + +## ----------------------------------------------------------------------------- +d$line1[d$line1 == 1] = 2 +d + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/doc/highr-internals.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/doc/highr-internals.Rmd new file mode 100644 index 00000000..3c6d126d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/doc/highr-internals.Rmd @@ -0,0 +1,101 @@ + + +# Internals of the `highr` package + +The **highr** package is based on the function `getParseData()`, which was +introduced in R 3.0.0. This function gives detailed information of the +symbols in a code fragment. A simple example: + +```{r} +p = parse(text = " xx = 1 + 1 # a comment", keep.source = TRUE) +(d = getParseData(p)) +``` + +The first step is to filter out the rows that we do not need: + +```{r} +(d = d[d$terminal, ]) +``` + +There is a column `token` in the data frame, and we will wrap this column +with markup commands, e.g. `\hlnum{1}` for the numeric constant `1`. We +defined the markup commands in `cmd_latex` and `cmd_html`: + +```{r} +head(highr:::cmd_latex) +tail(highr:::cmd_html) +``` + +These command data frames are connected to the tokens in the R code via +their row names: + +```{r} +d$token +rownames(highr:::cmd_latex) +``` + +Now we know how to wrap up the R tokens. The next big question is how to +restore the white spaces in the source code, since they were not directly +available in the parsed data, but the parsed data contains column numbers, +and we can derive the positions of white spaces from them. For example, +`col2 = 5` for the first row, and `col1 = 7` for the next row, and that +indicates there must be one space after the token in the first row, otherwise +the next row will start at the position `6` instead of `7`. + +A small trick is used to fill in the gaps of white spaces: + +```{r} +(z = d[, c('col1', 'col2')]) # take out the column positions +(z = t(z)) # transpose the matrix +(z = c(z)) # turn it into a vector +(z = c(0, head(z, -1))) # append 0 in the beginning, and remove the last element +(z = matrix(z, ncol = 2, byrow = TRUE)) +``` + +Now the two columns indicate the starting and ending positions of spaces, +and we can easily figure out how many white spaces are needed for each row: + +```{r} +(s = z[, 2] - z[, 1] - 1) +(s = strrep(' ', s)) +paste(s, d$text, sep = '') +``` + +So we have successfully restored the white spaces in the source code. Let's +paste all pieces together (suppose we highlight for LaTeX): + +```{r} +m = highr:::cmd_latex[d$token, ] +cbind(d, m) +# use standard markup if tokens do not exist in the table +m[is.na(m[, 1]), ] = highr:::cmd_latex['DEFAULT', ] +paste(s, m[, 1], d$text, m[, 2], sep = '', collapse = '') +``` + +So far so simple. That is one line of code, after all. A next challenge +comes when there are multiple lines, and a token spans across multiple lines: + +```{r} +d = getParseData(parse(text = "x = \"a character\nstring\" #hi", keep.source = TRUE)) +(d = d[d$terminal, ]) +``` + +Take a look at the third row. It says that the character string starts from +line 1, and ends on line 2. In this case, we just pretend as if everything +on line 1 were on line 2. Then for each line, we append the missing spaces +and apply markup commands to text symbols. + +```{r} +d$line1[d$line1 == 1] = 2 +d +``` + +Do not worry about the column `line2`. It does not matter. Only `line1` is +needed to indicate the line number here. + +Why do we need to highlight line by line instead of applying highlighting +commands to all text symbols (a.k.a vectorization)? Well, the margin of this +paper is too small to write down the answer. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/doc/highr-internals.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/doc/highr-internals.html new file mode 100644 index 00000000..43ddcb9f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/doc/highr-internals.html @@ -0,0 +1,211 @@ + + + + + +Internals of the <code>highr</code> package + + + + +
+

Internals of the highr package

+

+

+
+
+ +

Internals of the highr package

+

The highr package is based on the function getParseData(), which was +introduced in R 3.0.0. This function gives detailed information of the +symbols in a code fragment. A simple example:

+
p = parse(text = "   xx = 1 + 1  # a comment", keep.source = TRUE)
+(d = getParseData(p))
+
+
##    line1 col1 line2 col2 id parent                  token terminal        text
+## 14     1    4     1   13 14      0 expr_or_assign_or_help    FALSE            
+## 1      1    4     1    5  1      3                 SYMBOL     TRUE          xx
+## 3      1    4     1    5  3     14                   expr    FALSE            
+## 2      1    7     1    7  2     14              EQ_ASSIGN     TRUE           =
+## 12     1    9     1   13 12     14                   expr    FALSE            
+## 5      1    9     1    9  5      6              NUM_CONST     TRUE           1
+## 6      1    9     1    9  6     12                   expr    FALSE            
+## 7      1   11     1   11  7     12                    '+'     TRUE           +
+## 8      1   13     1   13  8      9              NUM_CONST     TRUE           1
+## 9      1   13     1   13  9     12                   expr    FALSE            
+## 10     1   16     1   26 10    -14                COMMENT     TRUE # a comment
+
+

The first step is to filter out the rows that we do not need:

+
(d = d[d$terminal, ])
+
+
##    line1 col1 line2 col2 id parent     token terminal        text
+## 1      1    4     1    5  1      3    SYMBOL     TRUE          xx
+## 2      1    7     1    7  2     14 EQ_ASSIGN     TRUE           =
+## 5      1    9     1    9  5      6 NUM_CONST     TRUE           1
+## 7      1   11     1   11  7     12       '+'     TRUE           +
+## 8      1   13     1   13  8      9 NUM_CONST     TRUE           1
+## 10     1   16     1   26 10    -14   COMMENT     TRUE # a comment
+
+

There is a column token in the data frame, and we will wrap this column +with markup commands, e.g. \hlnum{1} for the numeric constant 1. We +defined the markup commands in cmd_latex and cmd_html:

+
head(highr:::cmd_latex)
+
+
##              cmd1 cmd2
+## COMMENT  \\hlcom{    }
+## DEFAULT  \\hldef{    }
+## FUNCTION \\hlkwa{    }
+## IF       \\hlkwa{    }
+## ELSE     \\hlkwa{    }
+## WHILE    \\hlkwa{    }
+
+
tail(highr:::cmd_html)
+
+
##                             cmd1    cmd2
+## AND2       <span class="hl opt"> </span>
+## OR         <span class="hl opt"> </span>
+## OR2        <span class="hl opt"> </span>
+## NS_GET     <span class="hl opt"> </span>
+## NS_GET_INT <span class="hl opt"> </span>
+## STR_CONST  <span class="hl sng"> </span>
+
+

These command data frames are connected to the tokens in the R code via +their row names:

+
d$token
+
+
## [1] "SYMBOL"    "EQ_ASSIGN" "NUM_CONST" "'+'"       "NUM_CONST" "COMMENT"
+
+
rownames(highr:::cmd_latex)
+
+
##  [1] "COMMENT"              "DEFAULT"              "FUNCTION"            
+##  [4] "IF"                   "ELSE"                 "WHILE"               
+##  [7] "FOR"                  "IN"                   "BREAK"               
+## [10] "REPEAT"               "NEXT"                 "NULL_CONST"          
+## [13] "LEFT_ASSIGN"          "EQ_ASSIGN"            "RIGHT_ASSIGN"        
+## [16] "SYMBOL_FORMALS"       "SYMBOL_SUB"           "SLOT"                
+## [19] "SYMBOL_FUNCTION_CALL" "NUM_CONST"            "'+'"                 
+## [22] "'-'"                  "'*'"                  "'/'"                 
+## [25] "'^'"                  "'$'"                  "'@'"                 
+## [28] "':'"                  "'?'"                  "'~'"                 
+## [31] "'!'"                  "SPECIAL"              "GT"                  
+## [34] "GE"                   "LT"                   "LE"                  
+## [37] "EQ"                   "NE"                   "AND"                 
+## [40] "AND2"                 "OR"                   "OR2"                 
+## [43] "NS_GET"               "NS_GET_INT"           "STR_CONST"
+
+

Now we know how to wrap up the R tokens. The next big question is how to +restore the white spaces in the source code, since they were not directly +available in the parsed data, but the parsed data contains column numbers, +and we can derive the positions of white spaces from them. For example, +col2 = 5 for the first row, and col1 = 7 for the next row, and that +indicates there must be one space after the token in the first row, otherwise +the next row will start at the position 6 instead of 7.

+

A small trick is used to fill in the gaps of white spaces:

+
(z = d[, c('col1', 'col2')])  # take out the column positions
+
+
##    col1 col2
+## 1     4    5
+## 2     7    7
+## 5     9    9
+## 7    11   11
+## 8    13   13
+## 10   16   26
+
+
(z = t(z)) # transpose the matrix
+
+
##      1 2 5  7  8 10
+## col1 4 7 9 11 13 16
+## col2 5 7 9 11 13 26
+
+
(z = c(z)) # turn it into a vector
+
+
##  [1]  4  5  7  7  9  9 11 11 13 13 16 26
+
+
(z = c(0, head(z, -1))) # append 0 in the beginning, and remove the last element
+
+
##  [1]  0  4  5  7  7  9  9 11 11 13 13 16
+
+
(z = matrix(z, ncol = 2, byrow = TRUE))
+
+
##      [,1] [,2]
+## [1,]    0    4
+## [2,]    5    7
+## [3,]    7    9
+## [4,]    9   11
+## [5,]   11   13
+## [6,]   13   16
+
+

Now the two columns indicate the starting and ending positions of spaces, +and we can easily figure out how many white spaces are needed for each row:

+
(s = z[, 2] - z[, 1] - 1)
+
+
## [1] 3 1 1 1 1 2
+
+
(s = strrep(' ', s))
+
+
## [1] "   " " "   " "   " "   " "   "  "
+
+
paste(s, d$text, sep = '')
+
+
## [1] "   xx"         " ="            " 1"            " +"           
+## [5] " 1"            "  # a comment"
+
+

So we have successfully restored the white spaces in the source code. Let’s +paste all pieces together (suppose we highlight for LaTeX):

+
m = highr:::cmd_latex[d$token, ]
+cbind(d, m)
+
+
##    line1 col1 line2 col2 id parent     token terminal        text     cmd1 cmd2
+## 1      1    4     1    5  1      3    SYMBOL     TRUE          xx     <NA> <NA>
+## 2      1    7     1    7  2     14 EQ_ASSIGN     TRUE           = \\hlkwb{    }
+## 5      1    9     1    9  5      6 NUM_CONST     TRUE           1 \\hlnum{    }
+## 7      1   11     1   11  7     12       '+'     TRUE           + \\hlopt{    }
+## 8      1   13     1   13  8      9 NUM_CONST     TRUE           1 \\hlnum{    }
+## 10     1   16     1   26 10    -14   COMMENT     TRUE # a comment \\hlcom{    }
+
+
# use standard markup if tokens do not exist in the table
+m[is.na(m[, 1]), ] = highr:::cmd_latex['DEFAULT', ]
+paste(s, m[, 1], d$text, m[, 2], sep = '', collapse = '')
+
+
## [1] "   \\hldef{xx} \\hlkwb{=} \\hlnum{1} \\hlopt{+} \\hlnum{1}  \\hlcom{# a comment}"
+
+

So far so simple. That is one line of code, after all. A next challenge +comes when there are multiple lines, and a token spans across multiple lines:

+
d = getParseData(parse(text = "x = \"a character\nstring\" #hi", keep.source = TRUE))
+(d = d[d$terminal, ])
+
+
##   line1 col1 line2 col2 id parent     token terminal                  text
+## 1     1    1     1    1  1      3    SYMBOL     TRUE                     x
+## 2     1    3     1    3  2     10 EQ_ASSIGN     TRUE                     =
+## 5     1    5     2    7  5      8 STR_CONST     TRUE "a character\nstring"
+## 6     2    9     2   11  6    -10   COMMENT     TRUE                   #hi
+
+

Take a look at the third row. It says that the character string starts from +line 1, and ends on line 2. In this case, we just pretend as if everything +on line 1 were on line 2. Then for each line, we append the missing spaces +and apply markup commands to text symbols.

+
d$line1[d$line1 == 1] = 2
+d
+
+
##   line1 col1 line2 col2 id parent     token terminal                  text
+## 1     2    1     1    1  1      3    SYMBOL     TRUE                     x
+## 2     2    3     1    3  2     10 EQ_ASSIGN     TRUE                     =
+## 5     2    5     2    7  5      8 STR_CONST     TRUE "a character\nstring"
+## 6     2    9     2   11  6    -10   COMMENT     TRUE                   #hi
+
+

Do not worry about the column line2. It does not matter. Only line1 is +needed to indicate the line number here.

+

Why do we need to highlight line by line instead of applying highlighting +commands to all text symbols (a.k.a vectorization)? Well, the margin of this +paper is too small to write down the answer.

+
+ + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/doc/index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/doc/index.html new file mode 100644 index 00000000..45f1bedc --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/doc/index.html @@ -0,0 +1,34 @@ + + +R: Vignettes and other documentation + + + +
+

Vignettes and other documentation + +

+
+
+[Top] +
+

Vignettes from package 'highr'

+ +++++++ + + + + + + + + + +
highr::highr-customCustomization of the highr packageHTMLsourceR code
highr::highr-internalsInternals of the highr packageHTMLsourceR code
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/help/AnIndex new file mode 100644 index 00000000..e43214d6 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/help/AnIndex @@ -0,0 +1,4 @@ +hilight hilight +hi_andre hi_andre +hi_html hilight +hi_latex hilight diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/help/aliases.rds new file mode 100644 index 00000000..74764382 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/help/highr.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/help/highr.rdb new file mode 100644 index 00000000..70e49713 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/help/highr.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/help/highr.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/help/highr.rdx new file mode 100644 index 00000000..76b760f0 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/help/highr.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/help/paths.rds new file mode 100644 index 00000000..331339f9 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/html/00Index.html new file mode 100644 index 00000000..e5116e71 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/html/00Index.html @@ -0,0 +1,35 @@ + + +R: Syntax Highlighting for R Source Code + + + +
+

Syntax Highlighting for R Source Code + +

+
+
+[Up] +[Top] +

Documentation for package ‘highr’ version 0.11

+ + + +

Help Pages

+ + + + + + + + + + + +
hilightSyntax highlight an R code fragment
hi_andreA wrapper to Andre Simon's Highlight
hi_htmlSyntax highlight an R code fragment
hi_latexSyntax highlight an R code fragment
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/highr/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/CITATION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/CITATION new file mode 100644 index 00000000..0d15e9ab --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/CITATION @@ -0,0 +1,42 @@ +year = sub('.*(2[[:digit:]]{3})-.*', '\\1', meta[['Date/Publication']], perl = TRUE) +vers = paste('R package version', meta$Version) +if (length(year) == 0) year = format(Sys.Date(), '%Y') + +bibentry( + 'manual', + title = paste('knitr:', meta$Title), + author = Filter(function(p) 'aut' %in% p$role, as.person(meta$Author)), + year = year, + note = vers, + url = meta$URL +) + +bibentry( + 'book', + title = 'Dynamic Documents with {R} and knitr', + author = 'Yihui Xie', + publisher = 'Chapman and Hall/CRC', + address = 'Boca Raton, Florida', + year = '2015', + edition = '2nd', + note = 'ISBN 978-1498716963', + url = meta$URL, + textVersion = paste('Yihui Xie (2015)', 'Dynamic Documents with R and knitr.', + '2nd edition. Chapman and Hall/CRC. ISBN 978-1498716963') +) + +bibentry( + 'incollection', + booktitle = 'Implementing Reproducible Computational Research', + editor = 'Victoria Stodden and Friedrich Leisch and Roger D. Peng', + title = 'knitr: A Comprehensive Tool for Reproducible Research in {R}', + author = 'Yihui Xie', + publisher = 'Chapman and Hall/CRC', + year = '2014', + note = 'ISBN 978-1466561595', + textVersion = paste('Yihui Xie (2014)', + 'knitr: A Comprehensive Tool for Reproducible Research in R.', + 'In Victoria Stodden, Friedrich Leisch and Roger D. Peng, editors,', + 'Implementing Reproducible Computational Research.', + 'Chapman and Hall/CRC. ISBN 978-1466561595') +) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/DESCRIPTION new file mode 100644 index 00000000..eae11cef --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/DESCRIPTION @@ -0,0 +1,265 @@ +Package: knitr +Type: Package +Title: A General-Purpose Package for Dynamic Report Generation in R +Version: 1.49 +Authors@R: c( + person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")), + person("Abhraneel", "Sarma", role = "ctb"), + person("Adam", "Vogt", role = "ctb"), + person("Alastair", "Andrew", role = "ctb"), + person("Alex", "Zvoleff", role = "ctb"), + person("Amar", "Al-Zubaidi", role = "ctb"), + person("Andre", "Simon", role = "ctb", comment = "the CSS files under inst/themes/ were derived from the Highlight package http://www.andre-simon.de"), + person("Aron", "Atkins", role = "ctb"), + person("Aaron", "Wolen", role = "ctb"), + person("Ashley", "Manton", role = "ctb"), + person("Atsushi", "Yasumoto", role = "ctb", comment = c(ORCID = "0000-0002-8335-495X")), + person("Ben", "Baumer", role = "ctb"), + person("Brian", "Diggs", role = "ctb"), + person("Brian", "Zhang", role = "ctb"), + person("Bulat", "Yapparov", role = "ctb"), + person("Cassio", "Pereira", role = "ctb"), + person("Christophe", "Dervieux", role = "ctb"), + person("David", "Hall", role = "ctb"), + person("David", "Hugh-Jones", role = "ctb"), + person("David", "Robinson", role = "ctb"), + person("Doug", "Hemken", role = "ctb"), + person("Duncan", "Murdoch", role = "ctb"), + person("Elio", "Campitelli", role = "ctb"), + person("Ellis", "Hughes", role = "ctb"), + person("Emily", "Riederer", role = "ctb"), + person("Fabian", "Hirschmann", role = "ctb"), + person("Fitch", "Simeon", role = "ctb"), + person("Forest", "Fang", role = "ctb"), + person(c("Frank", "E", "Harrell", "Jr"), role = "ctb", comment = "the Sweavel package at inst/misc/Sweavel.sty"), + person("Garrick", "Aden-Buie", role = "ctb"), + person("Gregoire", "Detrez", role = "ctb"), + person("Hadley", "Wickham", role = "ctb"), + person("Hao", "Zhu", role = "ctb"), + person("Heewon", "Jeon", role = "ctb"), + person("Henrik", "Bengtsson", role = "ctb"), + person("Hiroaki", "Yutani", role = "ctb"), + person("Ian", "Lyttle", role = "ctb"), + person("Hodges", "Daniel", role = "ctb"), + person("Jacob", "Bien", role = "ctb"), + person("Jake", "Burkhead", role = "ctb"), + person("James", "Manton", role = "ctb"), + person("Jared", "Lander", role = "ctb"), + person("Jason", "Punyon", role = "ctb"), + person("Javier", "Luraschi", role = "ctb"), + person("Jeff", "Arnold", role = "ctb"), + person("Jenny", "Bryan", role = "ctb"), + person("Jeremy", "Ashkenas", role = c("ctb", "cph"), comment = "the CSS file at inst/misc/docco-classic.css"), + person("Jeremy", "Stephens", role = "ctb"), + person("Jim", "Hester", role = "ctb"), + person("Joe", "Cheng", role = "ctb"), + person("Johannes", "Ranke", role = "ctb"), + person("John", "Honaker", role = "ctb"), + person("John", "Muschelli", role = "ctb"), + person("Jonathan", "Keane", role = "ctb"), + person("JJ", "Allaire", role = "ctb"), + person("Johan", "Toloe", role = "ctb"), + person("Jonathan", "Sidi", role = "ctb"), + person("Joseph", "Larmarange", role = "ctb"), + person("Julien", "Barnier", role = "ctb"), + person("Kaiyin", "Zhong", role = "ctb"), + person("Kamil", "Slowikowski", role = "ctb"), + person("Karl", "Forner", role = "ctb"), + person(c("Kevin", "K."), "Smith", role = "ctb"), + person("Kirill", "Mueller", role = "ctb"), + person("Kohske", "Takahashi", role = "ctb"), + person("Lorenz", "Walthert", role = "ctb"), + person("Lucas", "Gallindo", role = "ctb"), + person("Marius", "Hofert", role = "ctb"), + person("Martin", "Modrák", role = "ctb"), + person("Michael", "Chirico", role = "ctb"), + person("Michael", "Friendly", role = "ctb"), + person("Michal", "Bojanowski", role = "ctb"), + person("Michel", "Kuhlmann", role = "ctb"), + person("Miller", "Patrick", role = "ctb"), + person("Nacho", "Caballero", role = "ctb"), + person("Nick", "Salkowski", role = "ctb"), + person("Niels Richard", "Hansen", role = "ctb"), + person("Noam", "Ross", role = "ctb"), + person("Obada", "Mahdi", role = "ctb"), + person("Pavel N.", "Krivitsky", role = "ctb", comment=c(ORCID = "0000-0002-9101-3362")), + person("Pedro", "Faria", role = "ctb"), + person("Qiang", "Li", role = "ctb"), + person("Ramnath", "Vaidyanathan", role = "ctb"), + person("Richard", "Cotton", role = "ctb"), + person("Robert", "Krzyzanowski", role = "ctb"), + person("Rodrigo", "Copetti", role = "ctb"), + person("Romain", "Francois", role = "ctb"), + person("Ruaridh", "Williamson", role = "ctb"), + person("Sagiru", "Mati", role = "ctb", comment = c(ORCID = "0000-0003-1413-3974")), + person("Scott", "Kostyshak", role = "ctb"), + person("Sebastian", "Meyer", role = "ctb"), + person("Sietse", "Brouwer", role = "ctb"), + person(c("Simon", "de"), "Bernard", role = "ctb"), + person("Sylvain", "Rousseau", role = "ctb"), + person("Taiyun", "Wei", role = "ctb"), + person("Thibaut", "Assus", role = "ctb"), + person("Thibaut", "Lamadon", role = "ctb"), + person("Thomas", "Leeper", role = "ctb"), + person("Tim", "Mastny", role = "ctb"), + person("Tom", "Torsney-Weir", role = "ctb"), + person("Trevor", "Davis", role = "ctb"), + person("Viktoras", "Veitas", role = "ctb"), + person("Weicheng", "Zhu", role = "ctb"), + person("Wush", "Wu", role = "ctb"), + person("Zachary", "Foster", role = "ctb"), + person("Zhian N.", "Kamvar", role = "ctb", comment = c(ORCID = "0000-0003-1458-7108")), + person(given = "Posit Software, PBC", role = c("cph", "fnd")) + ) +Description: Provides a general-purpose tool for dynamic report generation in R + using Literate Programming techniques. +Depends: R (>= 3.6.0) +Imports: evaluate (>= 0.15), highr (>= 0.11), methods, tools, xfun (>= + 0.48), yaml (>= 2.1.19) +Suggests: bslib, codetools, DBI (>= 0.4-1), digest, formatR, gifski, + gridSVG, htmlwidgets (>= 0.7), jpeg, JuliaCall (>= 0.11.1), + magick, litedown, markdown (>= 1.3), png, ragg, reticulate (>= + 1.4), rgl (>= 0.95.1201), rlang, rmarkdown, sass, showtext, + styler (>= 1.2.0), targets (>= 0.6.0), testit, tibble, + tikzDevice (>= 0.10), tinytex (>= 0.46), webshot, rstudioapi, + svglite +License: GPL +URL: https://yihui.org/knitr/ +BugReports: https://github.com/yihui/knitr/issues +Encoding: UTF-8 +VignetteBuilder: litedown, knitr +SystemRequirements: Package vignettes based on R Markdown v2 or + reStructuredText require Pandoc (http://pandoc.org). The + function rst2pdf() requires rst2pdf + (https://github.com/rst2pdf/rst2pdf). +Collate: 'block.R' 'cache.R' 'utils.R' 'citation.R' 'hooks-html.R' + 'plot.R' 'defaults.R' 'concordance.R' 'engine.R' 'highlight.R' + 'themes.R' 'header.R' 'hooks-asciidoc.R' 'hooks-chunk.R' + 'hooks-extra.R' 'hooks-latex.R' 'hooks-md.R' 'hooks-rst.R' + 'hooks-textile.R' 'hooks.R' 'output.R' 'package.R' 'pandoc.R' + 'params.R' 'parser.R' 'pattern.R' 'rocco.R' 'spin.R' 'table.R' + 'template.R' 'utils-conversion.R' 'utils-rd2html.R' + 'utils-string.R' 'utils-sweave.R' 'utils-upload.R' + 'utils-vignettes.R' 'zzz.R' +RoxygenNote: 7.3.2 +NeedsCompilation: no +Packaged: 2024-11-06 23:10:53 UTC; runner +Author: Yihui Xie [aut, cre] (), + Abhraneel Sarma [ctb], + Adam Vogt [ctb], + Alastair Andrew [ctb], + Alex Zvoleff [ctb], + Amar Al-Zubaidi [ctb], + Andre Simon [ctb] (the CSS files under inst/themes/ were derived from + the Highlight package http://www.andre-simon.de), + Aron Atkins [ctb], + Aaron Wolen [ctb], + Ashley Manton [ctb], + Atsushi Yasumoto [ctb] (), + Ben Baumer [ctb], + Brian Diggs [ctb], + Brian Zhang [ctb], + Bulat Yapparov [ctb], + Cassio Pereira [ctb], + Christophe Dervieux [ctb], + David Hall [ctb], + David Hugh-Jones [ctb], + David Robinson [ctb], + Doug Hemken [ctb], + Duncan Murdoch [ctb], + Elio Campitelli [ctb], + Ellis Hughes [ctb], + Emily Riederer [ctb], + Fabian Hirschmann [ctb], + Fitch Simeon [ctb], + Forest Fang [ctb], + Frank E Harrell Jr [ctb] (the Sweavel package at inst/misc/Sweavel.sty), + Garrick Aden-Buie [ctb], + Gregoire Detrez [ctb], + Hadley Wickham [ctb], + Hao Zhu [ctb], + Heewon Jeon [ctb], + Henrik Bengtsson [ctb], + Hiroaki Yutani [ctb], + Ian Lyttle [ctb], + Hodges Daniel [ctb], + Jacob Bien [ctb], + Jake Burkhead [ctb], + James Manton [ctb], + Jared Lander [ctb], + Jason Punyon [ctb], + Javier Luraschi [ctb], + Jeff Arnold [ctb], + Jenny Bryan [ctb], + Jeremy Ashkenas [ctb, cph] (the CSS file at + inst/misc/docco-classic.css), + Jeremy Stephens [ctb], + Jim Hester [ctb], + Joe Cheng [ctb], + Johannes Ranke [ctb], + John Honaker [ctb], + John Muschelli [ctb], + Jonathan Keane [ctb], + JJ Allaire [ctb], + Johan Toloe [ctb], + Jonathan Sidi [ctb], + Joseph Larmarange [ctb], + Julien Barnier [ctb], + Kaiyin Zhong [ctb], + Kamil Slowikowski [ctb], + Karl Forner [ctb], + Kevin K. Smith [ctb], + Kirill Mueller [ctb], + Kohske Takahashi [ctb], + Lorenz Walthert [ctb], + Lucas Gallindo [ctb], + Marius Hofert [ctb], + Martin Modrák [ctb], + Michael Chirico [ctb], + Michael Friendly [ctb], + Michal Bojanowski [ctb], + Michel Kuhlmann [ctb], + Miller Patrick [ctb], + Nacho Caballero [ctb], + Nick Salkowski [ctb], + Niels Richard Hansen [ctb], + Noam Ross [ctb], + Obada Mahdi [ctb], + Pavel N. Krivitsky [ctb] (), + Pedro Faria [ctb], + Qiang Li [ctb], + Ramnath Vaidyanathan [ctb], + Richard Cotton [ctb], + Robert Krzyzanowski [ctb], + Rodrigo Copetti [ctb], + Romain Francois [ctb], + Ruaridh Williamson [ctb], + Sagiru Mati [ctb] (), + Scott Kostyshak [ctb], + Sebastian Meyer [ctb], + Sietse Brouwer [ctb], + Simon de Bernard [ctb], + Sylvain Rousseau [ctb], + Taiyun Wei [ctb], + Thibaut Assus [ctb], + Thibaut Lamadon [ctb], + Thomas Leeper [ctb], + Tim Mastny [ctb], + Tom Torsney-Weir [ctb], + Trevor Davis [ctb], + Viktoras Veitas [ctb], + Weicheng Zhu [ctb], + Wush Wu [ctb], + Zachary Foster [ctb], + Zhian N. Kamvar [ctb] (), + Posit Software, PBC [cph, fnd] +Maintainer: Yihui Xie +Repository: CRAN +Date/Publication: 2024-11-08 09:30:02 UTC +Built: R 4.4.1; ; 2024-11-08 10:08:25 UTC; unix +RemoteType: standard +RemotePkgRef: knitr +RemoteRef: knitr +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 1.49 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/INDEX new file mode 100644 index 00000000..a336ea3b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/INDEX @@ -0,0 +1,96 @@ +Sweave2knitr Convert Sweave to knitr documents +all_labels Get all chunk labels in a document +all_patterns All built-in patterns +asis_output Mark an R object with a special class +cache_engines Cache engines of other languages +clean_cache Clean cache files that are probably no longer + needed +combine_words Combine multiple words into a single string +convert_chunk_header Convert the in-header chunk option syntax to + the in-body syntax +current_input Query the current input filename +dep_auto Build automatic dependencies among chunks +dep_prev Make later chunks depend on previous chunks +download_image Download an image from the web and include it + in a document +engine_output An output wrapper for language engine output +extract_raw_output Mark character strings as raw output that + should not be converted +fig_chunk Obtain the figure filenames for a chunk +fig_path Path for figure files +hook_ffmpeg_html Hooks to create animations in HTML output +hook_movecode Some potentially useful document hooks +hook_pdfcrop Built-in chunk hooks to extend knitr +hook_plot_html Default plot hooks for different output formats +image_uri Encode an image file to a data URI +include_graphics Embed external images in 'knitr' documents +include_url Embed a URL as an HTML iframe or a screenshot + in 'knitr' documents +inline_expr Wrap code using the inline R expression syntax +is_latex_output Check the current input and output type +is_low_change Compare two recorded plots +kable Create tables in LaTeX, HTML, Markdown and + reStructuredText +knit Knit a document +knit2html Convert markdown to HTML using knit() and + mark_html() +knit2pandoc Convert various input files to various output + files using 'knit()' and Pandoc +knit2pdf Convert Rnw or Rrst files to PDF +knit2wp Knit an R Markdown document and post it to + WordPress +knit_child Knit a child document +knit_code The code manager to manage code in all chunks +knit_engines Engines of other languages +knit_exit Exit knitting early +knit_expand A simple macro preprocessor for templating + purposes +knit_filter Spell check filter for source documents +knit_global The global environment for evaluating code +knit_hooks Hooks for R code chunks, inline R code and + output +knit_meta Metadata about objects to be printed +knit_params Extract knit parameters from a document +knit_params_yaml Extract knit parameters from YAML text +knit_patterns Patterns to match and extract R code in a + document +knit_print A custom printing function +knit_rd Knit package documentation +knit_theme Syntax highlighting themes +knit_watch Watch an input file continuously and knit it + when it is updated +knitr-package A general-purpose tool for dynamic report + generation in R +load_cache Load the cache database of a code chunk +opts_chunk Default and current chunk options +opts_hooks Hooks for code chunk options +opts_knit Options for the knitr package +opts_template Template for creating reusable chunk options +pandoc A Pandoc wrapper to convert documents to other + formats +pat_rnw Set regular expressions to read input documents +plot_crop Crop a plot (remove the edges) using PDFCrop or + ImageMagick +rand_seed An unevaluated expression to return + .Random.seed if exists +raw_block Mark character strings as raw blocks in R + Markdown +read_chunk Read chunks from an external script +read_rforge Read source code from R-Forge +render_html Set or get output hooks for different output + formats +rnw2pdf Convert an 'Rnw' document to PDF +rocco Knit R Markdown using the classic Docco style +rst2pdf A wrapper for rst2pdf +set_alias Set aliases for chunk options +set_header Set the header information +set_parent Specify the parent document of child documents +sew Wrap evaluated results for output +spin Spin goat's hair into wool +spin_child Spin a child R script +stitch Automatically create a report based on an R + script and a template +vignette_engines Package vignette engines +wrap_rmd Wrap long lines in Rmd files +write_bib Generate BibTeX bibliography databases for R + packages diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/Rd.rds new file mode 100644 index 00000000..ff8641a6 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/demo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/demo.rds new file mode 100644 index 00000000..a7fd07ca Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/demo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/hsearch.rds new file mode 100644 index 00000000..ee5e9569 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/links.rds new file mode 100644 index 00000000..c84dd3ee Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/nsInfo.rds new file mode 100644 index 00000000..254698b2 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/package.rds new file mode 100644 index 00000000..a20cc057 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/vignette.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/vignette.rds new file mode 100644 index 00000000..5512fd41 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/Meta/vignette.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/NAMESPACE new file mode 100644 index 00000000..8765fa06 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/NAMESPACE @@ -0,0 +1,169 @@ +# Generated by roxygen2: do not edit by hand + +S3method("$",knitr_strict_list) +S3method(is_low_change,default) +S3method(knit_print,default) +S3method(knit_print,knit_asis) +S3method(knit_print,knit_asis_url) +S3method(knit_print,knitr_kable) +S3method(print,knitr_kable) +S3method(sew,character) +S3method(sew,default) +S3method(sew,error) +S3method(sew,html_screenshot) +S3method(sew,knit_asis) +S3method(sew,knit_embed_url) +S3method(sew,knit_image_paths) +S3method(sew,list) +S3method(sew,message) +S3method(sew,recordedplot) +S3method(sew,source) +S3method(sew,warning) +export(Sweave2knitr) +export(all_labels) +export(all_patterns) +export(all_rcpp_labels) +export(asis_output) +export(cache_engines) +export(clean_cache) +export(combine_words) +export(convert_chunk_header) +export(current_input) +export(dep_auto) +export(dep_prev) +export(download_image) +export(engine_output) +export(extract_raw_output) +export(fig_chunk) +export(fig_path) +export(hook_ffmpeg_html) +export(hook_gifski) +export(hook_mogrify) +export(hook_movecode) +export(hook_optipng) +export(hook_pdfcrop) +export(hook_plot_asciidoc) +export(hook_plot_custom) +export(hook_plot_html) +export(hook_plot_md) +export(hook_plot_rst) +export(hook_plot_tex) +export(hook_plot_textile) +export(hook_pngquant) +export(hook_purl) +export(hook_r2swf) +export(hook_scianimator) +export(hooks_asciidoc) +export(hooks_html) +export(hooks_jekyll) +export(hooks_latex) +export(hooks_listings) +export(hooks_markdown) +export(hooks_rst) +export(hooks_sweave) +export(hooks_textile) +export(image_uri) +export(imgur_upload) +export(include_app) +export(include_graphics) +export(include_url) +export(inline_expr) +export(is_html_output) +export(is_latex_output) +export(is_low_change) +export(kable) +export(kables) +export(knit) +export(knit2html) +export(knit2pandoc) +export(knit2pdf) +export(knit2wp) +export(knit_child) +export(knit_code) +export(knit_engines) +export(knit_exit) +export(knit_expand) +export(knit_filter) +export(knit_global) +export(knit_hooks) +export(knit_meta) +export(knit_meta_add) +export(knit_params) +export(knit_params_yaml) +export(knit_patterns) +export(knit_print) +export(knit_rd) +export(knit_rd_all) +export(knit_theme) +export(knit_watch) +export(load_cache) +export(normal_print) +export(opts_chunk) +export(opts_current) +export(opts_hooks) +export(opts_knit) +export(opts_template) +export(pandoc) +export(pandoc_from) +export(pandoc_to) +export(partition_chunk) +export(pat_asciidoc) +export(pat_brew) +export(pat_html) +export(pat_md) +export(pat_rnw) +export(pat_rst) +export(pat_tex) +export(pat_textile) +export(plot_crop) +export(purl) +export(rand_seed) +export(raw_block) +export(raw_html) +export(raw_latex) +export(raw_output) +export(read_chunk) +export(read_demo) +export(read_rforge) +export(render_asciidoc) +export(render_html) +export(render_jekyll) +export(render_latex) +export(render_listings) +export(render_markdown) +export(render_rst) +export(render_sweave) +export(render_textile) +export(restore_raw_output) +export(rnw2pdf) +export(rocco) +export(rst2pdf) +export(set_alias) +export(set_header) +export(set_parent) +export(sew) +export(spin) +export(spin_child) +export(stitch) +export(stitch_rhtml) +export(stitch_rmd) +export(wrap_rmd) +export(write_bib) +import(grDevices) +import(graphics) +import(stats) +import(utils) +importFrom(xfun,attr) +importFrom(xfun,file_ext) +importFrom(xfun,file_string) +importFrom(xfun,html_escape) +importFrom(xfun,is_R_CMD_check) +importFrom(xfun,is_abs_path) +importFrom(xfun,is_windows) +importFrom(xfun,loadable) +importFrom(xfun,parse_only) +importFrom(xfun,read_utf8) +importFrom(xfun,sans_ext) +importFrom(xfun,try_silent) +importFrom(xfun,with_ext) +importFrom(xfun,write_utf8) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/NEWS.Rd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/NEWS.Rd new file mode 100644 index 00000000..ba134ead --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/NEWS.Rd @@ -0,0 +1,9 @@ +\name{NEWS} +\title{News for Package 'knitr'} + +\section{CHANGES IN knitr VERSION 999.999}{ + \itemize{ + \item This NEWS file is only a placeholder. The version 999.999 does not really + exist. Please read the NEWS on Github: \url{https://github.com/yihui/knitr/releases} + } +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/R/knitr b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/R/knitr new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/R/knitr @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/R/knitr.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/R/knitr.rdb new file mode 100644 index 00000000..e7cf7d17 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/R/knitr.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/R/knitr.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/R/knitr.rdx new file mode 100644 index 00000000..fc581af4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/R/knitr.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/bin/knit b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/bin/knit new file mode 100755 index 00000000..b53f0586 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/bin/knit @@ -0,0 +1,33 @@ +#!/usr/bin/env Rscript + +local({ + p = commandArgs(TRUE) + if (length(p) == 0L || any(c('-h', '--help') %in% p)) { + message('usage: knit input [input2 input3] [-n] [-o output output2 output3] + -h, --help to print help messages + -n, --no-convert do not convert tex to pdf, markdown to html, etc + -o output filename(s) for knit()') + q('no') + } + + library(knitr) + o = match('-o', p) + if (is.na(o)) output = NA else { + output = tail(p, length(p) - o) + p = head(p, o - 1L) + } + nc = c('-n', '--no-convert') + knit_fun = if (any(nc %in% p)) { + p = setdiff(p, nc) + knit + } else { + if (length(p) == 0L) stop('no input file provided') + if (grepl('\\.(R|S)(nw|tex)$', p[1])) { + function(x, ...) knit2pdf(x, ..., clean = TRUE) + } else { + if (grepl('\\.R(md|markdown)$', p[1])) knit2html else knit + } + } + + mapply(knit_fun, p, output = output, MoreArgs = list(envir = globalenv())) +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/demo/gwidgets.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/demo/gwidgets.R new file mode 100644 index 00000000..16f17235 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/demo/gwidgets.R @@ -0,0 +1,4 @@ +# for installation, see https://github.com/jverzani/gWidgetsWWW2 +library(gWidgetsWWW2) +options(device.ask.default = FALSE) +load_app(system.file('misc', 'gWidgetsWWW2-knitr.R', package = 'knitr')) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/demo/notebook.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/demo/notebook.R new file mode 100644 index 00000000..67aa553c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/demo/notebook.R @@ -0,0 +1,3 @@ +# for installation, see https://github.com/rstudio/shiny +library(shiny) +runApp(system.file('shiny', package = 'knitr')) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/datatables.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/datatables.R new file mode 100644 index 00000000..4cdd9040 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/datatables.R @@ -0,0 +1,4 @@ +mtcars + +mtcars + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/datatables.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/datatables.Rmd new file mode 100644 index 00000000..ec1c345e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/datatables.Rmd @@ -0,0 +1,41 @@ +--- +title: Display Tables with the JavaScript Library DataTables +author: Yihui Xie +date: "`{r} Sys.Date()`" +output: + litedown::html_format: + meta: + css: ["@default", "https://cdn.datatables.net/1.13.7/css/jquery.dataTables.min.css"] + js: ["@npm/jquery@3.7.1/dist/jquery.min.js", "https://cdn.datatables.net/1.13.7/js/jquery.dataTables.min.js"] +--- + + + +## jQuery DataTables + +We can use the JavaScript library [**DataTables**](https://datatables.net) to generate enhanced tables in HTML. In the example below, we create a table for the `mtcars` data: + +::: {#mtcars-table} +```{r cool, print.args=list(data.frame=list(limit=NULL))} +mtcars +``` +::: + +Note we assigned an `id` to the table, and next we use the **DataTables** library to initialize the table and you will get an interactive table. + +```{js} +window.addEventListener('load', () => { + $('#mtcars-table > table').DataTable(); +}); +``` + +By comparison, below is an ordinary table: + +```{r boring} +mtcars +``` + +This vignette is only a toy example. I'd recommend you to use the **DT** package instead: https://github.com/rstudio/DT diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/datatables.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/datatables.html new file mode 100644 index 00000000..b0b23638 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/datatables.html @@ -0,0 +1,691 @@ + + + + + + +Display Tables with the JavaScript Library DataTables + + + + + +
+

Display Tables with the JavaScript Library DataTables

+

Yihui Xie

+

2024-11-06

+
+
+ +

jQuery DataTables

+

We can use the JavaScript library DataTables to generate enhanced tables in HTML. In the example below, we create a table for the mtcars data:

+
+
mtcars
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
mpgcyldisphpdratwtqsecvsamgearcarb
Mazda RX421.06160.01103.902.62016.460144
Mazda RX4 Wag21.06160.01103.902.87517.020144
Datsun 71022.84108.0933.852.32018.611141
Hornet 4 Drive21.46258.01103.083.21519.441031
Hornet Sportabout18.78360.01753.153.44017.020032
Valiant18.16225.01052.763.46020.221031
Duster 36014.38360.02453.213.57015.840034
Merc 240D24.44146.7623.693.19020.001042
Merc 23022.84140.8953.923.15022.901042
Merc 28019.26167.61233.923.44018.301044
Merc 280C17.86167.61233.923.44018.901044
Merc 450SE16.48275.81803.074.07017.400033
Merc 450SL17.38275.81803.073.73017.600033
Merc 450SLC15.28275.81803.073.78018.000033
Cadillac Fleetwood10.48472.02052.935.25017.980034
Lincoln Continental10.48460.02153.005.42417.820034
Chrysler Imperial14.78440.02303.235.34517.420034
Fiat 12832.4478.7664.082.20019.471141
Honda Civic30.4475.7524.931.61518.521142
Toyota Corolla33.9471.1654.221.83519.901141
Toyota Corona21.54120.1973.702.46520.011031
Dodge Challenger15.58318.01502.763.52016.870032
AMC Javelin15.28304.01503.153.43517.300032
Camaro Z2813.38350.02453.733.84015.410034
Pontiac Firebird19.28400.01753.083.84517.050032
Fiat X1-927.3479.0664.081.93518.901141
Porsche 914-226.04120.3914.432.14016.700152
Lotus Europa30.4495.11133.771.51316.901152
Ford Pantera L15.88351.02644.223.17014.500154
Ferrari Dino19.76145.01753.622.77015.500156
Maserati Bora15.08301.03353.543.57014.600158
Volvo 142E21.44121.01094.112.78018.601142
+
+

Note we assigned an id to the table, and next we use the DataTables library to initialize the table and you will get an interactive table.

+
window.addEventListener('load', () => {
+  $('#mtcars-table > table').DataTable();
+});
+
+ +

By comparison, below is an ordinary table:

+
mtcars
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
mpgcyldisphpdratwtqsecvsamgearcarb
Mazda RX421.06160.01103.902.62016.460144
Mazda RX4 Wag21.06160.01103.902.87517.020144
Datsun 71022.84108.0933.852.32018.611141
Hornet 4 Drive21.46258.01103.083.21519.441031
Hornet Sportabout18.78360.01753.153.44017.020032
Lotus Europa30.4495.11133.771.51316.901152
Ford Pantera L15.88351.02644.223.17014.500154
Ferrari Dino19.76145.01753.622.77015.500156
Maserati Bora15.08301.03353.543.57014.600158
Volvo 142E21.44121.01094.112.78018.601142
+

This vignette is only a toy example. I’d recommend you to use the DT package instead: https://github.com/rstudio/DT

+
+ + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/docco-classic.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/docco-classic.Rmd new file mode 100644 index 00000000..0c0a4ce9 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/docco-classic.Rmd @@ -0,0 +1,24 @@ +--- +title: R Markdown with the Docco Classic Style +author: Yihui Xie +date: "`r Sys.Date()`" +--- + + + +```{r setup, echo=FALSE, results='asis'} +x = readLines('docco-linear.Rmd')[-(1:11)] +x = gsub('linear', 'classic', x) +i = grep('^knitr:::docco_classic', x) +x[i - 1] = '```{r}' +x[i] = 'knitr::rocco' +library(knitr) +cat(knit_child(text = x, quiet = TRUE), sep = '\n') +``` + +You probably have noticed that you can adjust the widths of the two columns +using your cursor. What is more, press `T` on your keyboard, and see what +happens. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/docco-classic.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/docco-classic.html new file mode 100644 index 00000000..994eff35 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/docco-classic.html @@ -0,0 +1,88 @@ + + + + + +R Markdown with the Docco Classic Style + + + + + +
+

R Markdown with the Docco Classic Style

+

Yihui Xie

+

2024-11-06

+
+
+ +

Docco

+

To use the Docco style for Markdown vignettes in an R package, you need to

+
    +
  • add *.Rmd files under the vignettes directory
  • +
  • add Suggests: knitr and VignetteBuilder: knitr to the DESCRIPTION file
  • +
  • specify the vignette engine \VignetteEngine{knitr::docco_classic} in the Rmd files (inside HTML comments)
  • +
+

After building and installing the package, you can view vignettes via

+
browseVignettes(package = 'Your_Package')
+
+

Examples

+

Below are some code chunks as examples.

+
cat('_hello_ **markdown**!', '\n')
+
+

hello markdown!

+

Normally you do not need any chunk options.

+
1+1
+
+
## [1] 2
+
+
10:1
+
+
##  [1] 10  9  8  7  6  5  4  3  2  1
+
+
rnorm(5)^2
+
+
## [1] 0.93675 1.62965 0.05061 0.10361 2.21366
+
+
strsplit('hello, markdown vignettes', '')
+
+
## [[1]]
+##  [1] "h" "e" "l" "l" "o" "," " " "m" "a" "r" "k" "d" "o" "w" "n" " " "v" "i" "g"
+## [20] "n" "e" "t" "t" "e" "s"
+
+

Feel free to draw beautiful plots and write math \(P(X>x)=\alpha/2\).

+
n=300; set.seed(123)
+par(mar=c(4,4,.1,.1))
+plot(rnorm(n), rnorm(n), pch=21, cex=5*runif(n), col='white', bg='gray')
+
+

plot of chunk unnamed-chunk-3

+

How does it work

+

Custom CSS and JS files are passed to markdown::mark_html() to style the HTML page:

+
knitr::rocco
+
+
## function (input, ...) 
+## {
+##     knit2html(input, ..., meta = list(css = c("@npm/@xiee/utils/css/docco-classic.min.css", 
+##         "@prism-xcode"), js = c("@npm/jquery@3.7.1/dist/jquery.min.js", 
+##         "@npm/@xiee/utils/js/docco-classic.min.js,docco-resize.js", 
+##         "@npm/@xiee/utils/js/center-img.min.js")))
+## }
+## <bytecode: 0x13663e990>
+## <environment: namespace:knitr>
+
+

That is it.

+

You probably have noticed that you can adjust the widths of the two columns +using your cursor. What is more, press T on your keyboard, and see what +happens.

+
+ + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/docco-linear.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/docco-linear.Rmd new file mode 100644 index 00000000..5c7c6a1e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/docco-linear.Rmd @@ -0,0 +1,59 @@ +--- +title: R Markdown with the Docco Linear Style +--- + + + +This is an example of Markdown vignettes using the [Docco style](http://ashkenas.com/docco/). + +## Docco + +To use the Docco style for Markdown vignettes in an R package, you need to + +- add `*.Rmd` files under the `vignettes` directory +- add `Suggests: knitr` and `VignetteBuilder: knitr` to the `DESCRIPTION` file +- specify the vignette engine `\VignetteEngine{knitr::docco_linear}` in the `Rmd` files (inside HTML comments) + +After building and installing the package, you can view vignettes via + +```r +browseVignettes(package = 'Your_Package') +``` + +## Examples + +Below are some code chunks as examples. + +```{r hello, results='asis'} +cat('_hello_ **markdown**!', '\n') +``` + +Normally you do not need any chunk options. + +```{r} +1+1 +10:1 +rnorm(5)^2 +strsplit('hello, markdown vignettes', '') +``` + +Feel free to draw beautiful plots and write math $P(X>x)=\alpha/2$. + +```{r} +n=300; set.seed(123) +par(mar=c(4,4,.1,.1)) +plot(rnorm(n), rnorm(n), pch=21, cex=5*runif(n), col='white', bg='gray') +``` + +## How does it work + +Custom CSS and JS files are passed to `markdown::mark_html()` to style the HTML page: + +```r +knitr:::docco_linear +``` + +That is it. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/docco-linear.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/docco-linear.html new file mode 100644 index 00000000..4a97a5f4 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/docco-linear.html @@ -0,0 +1,78 @@ + + + + + +R Markdown with the Docco Linear Style + + + + + + + +
+
+

R Markdown with the Docco Linear Style

+

+

+
+
+ +

This is an example of Markdown vignettes using the Docco style.

+

Docco

+

To use the Docco style for Markdown vignettes in an R package, you need to

+
    +
  • add *.Rmd files under the vignettes directory
  • +
  • add Suggests: knitr and VignetteBuilder: knitr to the DESCRIPTION file
  • +
  • specify the vignette engine \VignetteEngine{knitr::docco_linear} in the Rmd files (inside HTML comments)
  • +
+

After building and installing the package, you can view vignettes via

+
browseVignettes(package = 'Your_Package')
+
+

Examples

+

Below are some code chunks as examples.

+
cat('_hello_ **markdown**!', '\n')
+
+

hello markdown!

+

Normally you do not need any chunk options.

+
1+1
+
+
## [1] 2
+
+
10:1
+
+
##  [1] 10  9  8  7  6  5  4  3  2  1
+
+
rnorm(5)^2
+
+
## [1] 0.02793 0.06013 2.93306 0.58198 0.04078
+
+
strsplit('hello, markdown vignettes', '')
+
+
## [[1]]
+##  [1] "h" "e" "l" "l" "o" "," " " "m" "a" "r" "k" "d" "o" "w" "n" " " "v" "i" "g"
+## [20] "n" "e" "t" "t" "e" "s"
+
+

Feel free to draw beautiful plots and write math \(P(X>x)=\alpha/2\).

+
n=300; set.seed(123)
+par(mar=c(4,4,.1,.1))
+plot(rnorm(n), rnorm(n), pch=21, cex=5*runif(n), col='white', bg='gray')
+
+

plot of chunk unnamed-chunk-2

+

How does it work

+

Custom CSS and JS files are passed to markdown::mark_html() to style the HTML page:

+
knitr:::docco_linear
+
+

That is it.

+
+
h
+ + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/index.html new file mode 100644 index 00000000..7c824434 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/index.html @@ -0,0 +1,69 @@ + + +R: Vignettes and other documentation + + + +
+

Vignettes and other documentation + +

+
+
+[Top] +
+

Vignettes from package 'knitr'

+ +++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
knitr::datatablesDisplay Tables with the JavaScript Library DataTablesHTMLsourceR code
knitr::knit_expandTemplating with knit_expand()HTMLsourceR code
knitr::knitr-introNot an Introduction to knitrHTMLsourceR code
knitr::knitr-markdownAn R Markdown Vignette with knitrHTMLsourceR code
knitr::knitr-refcardknitr Reference CardHTMLsource
knitr::docco-classicR Markdown with the Docco Classic StyleHTMLsource
knitr::docco-linearR Markdown with the Docco Linear StyleHTMLsource
knitr::knit_printCustom Print MethodsHTMLsource
knitr::knitr-htmlAn R HTML Vignette with knitrHTMLsource
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knit_expand.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knit_expand.R new file mode 100644 index 00000000..d8968b7e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knit_expand.R @@ -0,0 +1,25 @@ +library(knitr) +knit_expand(text = 'The value of pi is {{pi}}.') +knit_expand(text = 'The value of a is {{a}}, so a + 1 is {{a+1}}.', a = rnorm(1)) +knit_expand(text = 'The area of a circle with radius {{r}} is {{pi*r^2}}', r = 5) + +knit_expand(text = 'a is {{a}} and b is {{b}}, with my own pi being {{pi}} instead of {{base::pi}}', a=1, b=2, pi=3) + +knit_expand(text = 'I do not like curly braces, so use % with <> instead: a is <% a %>.', a = 8, delim = c("<%", "%>")) + +knit_expand(text = 'hello $(LETTERS[24]) and $(pi)!', delim = c("$(", ")")) + +knit_expand(text = 'you cannot see the value of x {{x=rnorm(1)}}but it is indeed created: x = {{x}}') +res = knit_expand(text = c(' x | x^2', '{{x=1:5;paste(sprintf("%2d | %3d", x, x^2), collapse = "\n")}}')) +cat(res) + +res = knit_expand(text = c('{{i=0;h2=function(x){i<<-i+1;sprintf("

%d. %s

", i, x)} }}', +'{{h2("First Section")}}', '{{h2("Second Section")}}', '{{h2("Conclusion")}}', '')) +cat(res) + +src = lapply(names(mtcars)[2:5], function(i) { +knit_expand(text=c("# Regression on {{i}}", '```{r lm-{{i}}}', 'lm(mpg~{{i}}, data=mtcars)', '```', '')) +}) +# knit the source +litedown::fuse(unlist(src), 'markdown') + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knit_expand.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knit_expand.Rmd new file mode 100644 index 00000000..05a896dc --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knit_expand.Rmd @@ -0,0 +1,67 @@ +--- +title: Templating with knit_expand() +author: Yihui Xie +date: "`{r} Sys.Date()`" +output: + litedown::html_format: + meta: + css: ["@default"] +--- + + + +A few simple examples: + +```{r} +library(knitr) +knit_expand(text = 'The value of pi is {{pi}}.') +knit_expand(text = 'The value of a is {{a}}, so a + 1 is {{a+1}}.', a = rnorm(1)) +knit_expand(text = 'The area of a circle with radius {{r}} is {{pi*r^2}}', r = 5) +``` + +Any number of variables: + +```{r} +knit_expand(text = 'a is {{a}} and b is {{b}}, with my own pi being {{pi}} instead of {{base::pi}}', a=1, b=2, pi=3) +``` + +Custom delimiter `<% %>`: + +```{r} +knit_expand(text = 'I do not like curly braces, so use % with <> instead: a is <% a %>.', a = 8, delim = c("<%", "%>")) +``` + +The pyexpander delimiter: + +```{r} +knit_expand(text = 'hello $(LETTERS[24]) and $(pi)!', delim = c("$(", ")")) +``` + +Arbitrary R code: + +```{r} +knit_expand(text = 'you cannot see the value of x {{x=rnorm(1)}}but it is indeed created: x = {{x}}') +res = knit_expand(text = c(' x | x^2', '{{x=1:5;paste(sprintf("%2d | %3d", x, x^2), collapse = "\n")}}')) +cat(res) +``` + +The m4 example: + +```{r} +res = knit_expand(text = c('{{i=0;h2=function(x){i<<-i+1;sprintf("

%d. %s

", i, x)} }}', +'{{h2("First Section")}}', '{{h2("Second Section")}}', '{{h2("Conclusion")}}', '')) +cat(res) +``` + +Build regression models based on a template; loop through some variables in `mtcars`: + +```{r, comment=''} +src = lapply(names(mtcars)[2:5], function(i) { +knit_expand(text=c("# Regression on {{i}}", '```{r lm-{{i}}}', 'lm(mpg~{{i}}, data=mtcars)', '```', '')) +}) +# knit the source +litedown::fuse(unlist(src), 'markdown') +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knit_expand.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knit_expand.html new file mode 100644 index 00000000..7479c409 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knit_expand.html @@ -0,0 +1,157 @@ + + + + + + +Templating with knit_expand() + + + + +
+

Templating with knit_expand()

+

Yihui Xie

+

2024-11-06

+
+
+ +

A few simple examples:

+
library(knitr)
+knit_expand(text = 'The value of pi is {{pi}}.')
+
+
#> [1] "The value of pi is 3.14159265358979."
+
+
knit_expand(text = 'The value of a is {{a}}, so a + 1 is {{a+1}}.', a = rnorm(1))
+
+
#> [1] "The value of a is 0.676489790550228, so a + 1 is 1.67648979055023."
+
+
knit_expand(text = 'The area of a circle with radius {{r}} is {{pi*r^2}}', r = 5)
+
+
#> [1] "The area of a circle with radius 5 is 78.5398163397448"
+
+

Any number of variables:

+
knit_expand(text = 'a is {{a}} and b is {{b}}, with my own pi being {{pi}} instead of {{base::pi}}', a=1, b=2, pi=3)
+
+
#> [1] "a is 1 and b is 2, with my own pi being 3 instead of 3.14159265358979"
+
+

Custom delimiter <% %>:

+
knit_expand(text = 'I do not like curly braces, so use % with <> instead: a is <% a %>.', a = 8, delim = c("<%", "%>"))
+
+
#> [1] "I do not like curly braces, so use % with <> instead: a is 8."
+
+

The pyexpander delimiter:

+
knit_expand(text = 'hello $(LETTERS[24]) and $(pi)!', delim = c("$(", ")"))
+
+
#> [1] "hello X and 3.14159265358979!"
+
+

Arbitrary R code:

+
knit_expand(text = 'you cannot see the value of x {{x=rnorm(1)}}but it is indeed created: x = {{x}}')
+
+
#> [1] "you cannot see the value of x but it is indeed created: x = -0.320718473271458"
+
+
res = knit_expand(text = c(' x | x^2', '{{x=1:5;paste(sprintf("%2d | %3d", x, x^2), collapse = "\n")}}'))
+cat(res)
+
+
#>  x | x^2
+#>  1 |   1
+#>  2 |   4
+#>  3 |   9
+#>  4 |  16
+#>  5 |  25
+
+

The m4 example: https://en.wikipedia.org/wiki/M4_(computer_language)

+
res = knit_expand(text = c('{{i=0;h2=function(x){i<<-i+1;sprintf("<h2>%d. %s</h2>", i, x)} }}<html>',
+'{{h2("First Section")}}', '{{h2("Second Section")}}', '{{h2("Conclusion")}}', '</html>'))
+cat(res)
+
+
#> <html>
+#> <h2>1. First Section</h2>
+#> <h2>2. Second Section</h2>
+#> <h2>3. Conclusion</h2>
+#> </html>
+
+

Build regression models based on a template; loop through some variables in mtcars:

+
src = lapply(names(mtcars)[2:5], function(i) {
+knit_expand(text=c("# Regression on {{i}}", '```{r lm-{{i}}}', 'lm(mpg~{{i}}, data=mtcars)', '```', ''))
+})
+# knit the source
+litedown::fuse(unlist(src), 'markdown')
+
+
# Regression on cyl
+
+``` {.r}
+lm(mpg~cyl, data=mtcars)
+```
+
+```
+
+Call:
+lm(formula = mpg ~ cyl, data = mtcars)
+
+Coefficients:
+(Intercept)          cyl  
+     37.885       -2.876  
+
+```
+
+# Regression on disp
+
+``` {.r}
+lm(mpg~disp, data=mtcars)
+```
+
+```
+
+Call:
+lm(formula = mpg ~ disp, data = mtcars)
+
+Coefficients:
+(Intercept)         disp  
+   29.59985     -0.04122  
+
+```
+
+# Regression on hp
+
+``` {.r}
+lm(mpg~hp, data=mtcars)
+```
+
+```
+
+Call:
+lm(formula = mpg ~ hp, data = mtcars)
+
+Coefficients:
+(Intercept)           hp  
+   30.09886     -0.06823  
+
+```
+
+# Regression on drat
+
+``` {.r}
+lm(mpg~drat, data=mtcars)
+```
+
+```
+
+Call:
+lm(formula = mpg ~ drat, data = mtcars)
+
+Coefficients:
+(Intercept)         drat  
+     -7.525        7.678  
+
+```
+
+
+
+ + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knit_print.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knit_print.Rmd new file mode 100644 index 00000000..890f483b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knit_print.Rmd @@ -0,0 +1,234 @@ +--- +title: "Custom Print Methods" +author: "Yihui Xie" +date: '`r Sys.Date()`' +output: + litedown::html_format: + options: + toc: true + meta: + css: ["@default"] +vignette: > + %\VignetteEngine{knitr::knitr_notangle} + %\VignetteIndexEntry{Custom Print Methods} +--- + +Before **knitr** v1.6, printing objects in R code chunks basically emulates the R console. For example, a data frame is printed like this^[Note R prints an object without an explicit `print()` call when it is _visible_; see `?invisible`]: + +```{r normal-print, comment=''} +head(mtcars) +``` + +The text representation of the data frame above may look very familiar with most R users, but for reporting purposes, it may not be satisfactory -- often times we want to see a table representation instead. That is the problem that the chunk option `render` and the S3 generic function `knit_print()` try to solve. + +## Customize Printing + +After we evaluate each R expression in a code chunk, there is an object returned. For example, `1 + 1` returns `2`. This object is passed to the chunk option `render`, which is a function with two arguments, `x` and `options`, or `x` and `...`. The default value for the `render` option is `knit_print`, an S3 function in **knitr**: + +```{r} +library(knitr) +knit_print # an S3 generic function +methods(knit_print) +getS3method('knit_print', 'default') # the default method +normal_print +``` + +As we can see, `knit_print()` has a `default` method, which is basically `print()` or `show()`, depending on whether the object is an S4 object. This means it does nothing special when printing R objects: + +```{r collapse=TRUE} +knit_print(1:10) +knit_print(head(mtcars)) +``` + +S3 generic functions are extensible in the sense that we can define custom methods for them. A method `knit_print.foo()` will be applied to the object that has the class `foo`. Here is quick example of how we can print data frames as tables: + +```{r} +library(knitr) +# define a method for objects of the class data.frame +knit_print.data.frame = function(x, ...) { + res = paste(c('', '', kable(x)), collapse = '\n') + asis_output(res) +} +# register the method +registerS3method("knit_print", "data.frame", knit_print.data.frame) +``` + +If you define a method in a code chunk in a **knitr** document, the call to `registerS3method()` will be necessary for R >= 3.5.0, because the S3 dispatch mechanism has changed since R 3.5.0. If you are developing an R package, see the section [For package authors] below. + +We expect the print method to return a character vector, or an object that can be coerced into a character vector. In the example above, the `kable()` function returns a character vector, which we pass to the `asis_output()` function so that later **knitr** knows that this result needs no special treatment (just write it as is), otherwise it depends on the chunk option `results` (`= 'asis'` / `'markup'` / `'hide'`) how a normal character vector should be written. The function `asis_output()` has the same effect as `results = 'asis'`, but saves us the effort to provide this chunk option explicitly. Now we check how the printing behavior is changed. We print a number, a character vector, a list, a data frame, and write a character value using `cat()` in the chunk below: + +```{r knit-print} +1 + 1 +head(letters) +list(a = 1, b = 9:4) +head(mtcars) +cat('This is cool.') +``` + +We see all objects except the data frame were printed "normally"^[The two hashes `##` were from the chunk option `comment`; you can turn them off by `comment = ''`.]. The data frame was printed as a real table. Note you do not have to use `kable()` to create tables -- there are many other options such as **xtable**. Just make sure the print method returns a character string. + +The [**printr**](https://github.com/yihui/printr) package is a companion to **knitr** containing printing methods for some common objects like matrices and data frames. Users only need to load this package to get attractive printed results. A major factor to consider (which has been considered in **printr**) when defining a printing method is the output format. For example, the table syntax can be entirely different when the output is LaTeX vs when it is Markdown. + +It is strongly recommended that your S3 method has a `...` argument, so that your method can safely ignore arguments that are passed to `knit_print()` but not defined in your method. At the moment, a `knit_print()` method can have two optional arguments: + +- the `options` argument takes a list of the current chunk options; +- the `inline` argument indicates if the method is called in code chunks or inline R code; + +Depending on your application, you may optionally use these arguments. Here are some examples: + +```{r eval=FALSE, tidy=FALSE} +knit_print.classA = function(x, ...) { + # ignore options and inline +} +knit_print.classB = function(x, options, ...) { + # use the chunk option out.height + asis_output(paste0( + '', + )) +} +knit_print.classC = function(x, inline = FALSE, ...) { + # different output according to inline=TRUE/FALSE + if (inline) { + 'inline output for classC' + } else { + 'chunk output for classC' + } +} +knit_print.classD = function(x, options, inline = FALSE, ...) { + # use both options and inline +} +``` + +Note that when *using* your (or another) `knit_print()` method *inline* (if it supports that), you must not call `knit_print()` on the object, but just have it return. For example, your inline code should read `` `r +c("foo")` `` and *not* `` `r +knit_print(c("foo"))` ``. The latter inline code would yield the methods' result for *in-chunk* (not inline), because, as set up in the above, `knit_print()` methods default to `inline = FALSE`. This default gets overwritten depending on the context in which `knit_print()` is called (inline or in-chunk), only when `knit_print()` is called by **knitr** (not you) via the `render` option (see below). You can, of course, always manually set the inline option `` `r +knit_print(c("foo"), inline = TRUE)` ``, but that's a lot of typing. + +## A Low-level Explanation + +You can skip this section if you do not care about the low-level implementation details. + +### The `render` option + +As mentioned before, the chunk option `render` is a function that defaults to `knit_print()`. We can certainly use other render functions. For example, we create a dummy function that always says "I do not know what to print" no matter what objects it receives: + +```{r} +dummy_print = function(x, ...) { + cat("I do not know what to print!") + # this function implicitly returns an invisible NULL +} +``` + +Now we use the chunk option `render = dummy_print`: + +```{r knit-print, render=dummy_print, collapse=TRUE} +``` + +Note the `render` function is only applied to visible objects. There are cases in which the objects returned are invisible, e.g. those wrapped in `invisible()`. + +```{r} +1 + 1 +invisible(1 + 1) +invisible(head(mtcars)) +x = 1:10 # invisibly returns 1:10 +``` + +### Metadata + +The print function can have a side effect of passing "metadata" about objects to **knitr**, and **knitr** will collect this information as it prints objects. The motivation of collecting metadata is to store external dependencies of the objects to be printed. Normally we print an object only to obtain a text representation, but there are cases that can be more complicated. For example, a [**ggvis** ](https://ggvis.rstudio.com/) graph requires external JavaScript and CSS dependencies such as `ggvis.js`. The graph itself is basically a fragment of JavaScript code, which will not work unless the required libraries are loaded (in the HTML header). Therefore we need to collect the dependencies of an object beside printing the object itself. + +One way to specify the dependencies is through the `meta` argument of `asis_output()`. Here is a pseudo example: + +```{r eval=FALSE, tidy=FALSE} +# pseudo code +knit_print.ggvis = function(x, ...) { + res = ggvis::print_this_object(x) + knitr::asis_output(res, meta = list( + ggvis = list( + version = '0.1.0', + js = system.file('www', 'js', 'ggvis.js', package = 'ggvis'), + css = system.file('www', 'www', 'ggvis.css', package = 'ggvis') + ) + )) +} +``` + +Then when **knitr** prints a **ggvis** object, the `meta` information will be collected and stored. After knitting is done, we can obtain a list of all the dependencies via `knit_meta()`. It is very likely that there are duplicate entries in the list, and it is up to the package authors to clean them up, and process the metadata list in their own way (e.g. write the dependencies into the HTML header). We give a few more quick and dirty examples below to see how `knit_meta()` works. + +Now we define a print method for `foo` objects: + +```{r tidy=FALSE} +library(knitr) +knit_print.foo = function(x, ...) { + res = paste('> **This is a `foo` object**:', x) + asis_output(res, meta = list( + js = system.file('www', 'shared', 'shiny.js', package = 'shiny'), + css = system.file('www', 'shared', 'shiny.css', package = 'shiny') + )) +} +``` + +See what happens when we print `foo` objects: + +```{r} +new_foo = function(x) structure(x, class = 'foo') +new_foo('hello') +``` + +Check the metadata now: + +```{r} +str(knit_meta(clean = FALSE)) +``` + +Another `foo` object: + +```{r} +new_foo('world') +``` + +Similarly for `bar` objects: + +```{r} +knit_print.bar = function(x, ...) { + asis_output(x, meta = list(head = '')) +} +new_bar = function(x) structure(x, class = 'bar') +new_bar('> **hello** world!') +new_bar('> hello **world**!') +``` + +The final version of the metadata, and clean it up: + +```{r} +str(knit_meta()) +str(knit_meta()) # empty now, because clean = TRUE by default +``` + +### For package authors + +If you are implementing a custom print method in your own package, here are two tips: + +1. With R >= 3.6.0 (2019-04-26), you can declare the S3 method in the package `NAMESPACE` with `S3method(knitr::knit_print, class)`. If you use **roxygen2** package, that means a roxygen comment like this: + + ```r + #' @exportS3Method knitr::knit_print + knit_print.class <- + ``` + + With this method, you do not need to import **knitr** to your package, i.e., **knitr** can be listed in `Suggests` and not necessarily `Imports` in the package `DESCRIPTION`. The S3 methods will be automatically registered when **knitr** is actually loaded. + + For R < 3.6.0, you need to import `knit_print` in your package namespace via `importFrom(knitr, knit_print)` (or roxygen: `#' @importFrom knitr knit_print`) (see [the **printr** package](https://github.com/yihui/printr) for an example). + +1. `asis_output()` is simply a function that marks an object with the class `knit_asis`, and you do not have to import this function to your package, either---just let your print method return `structure(x, class = 'knit_asis')`, and if there are additional metadata, just put it in the `knit_meta` attribute; here is the source code of this function: + + ```{r} + knitr::asis_output + ``` + + You may put **knitr** in the `Suggests` field in `DESCRIPTION`, and use `knitr::asis_output()`, so that you can avoid the "hard" dependency on **knitr**. + +```{r clean-up, include=FALSE} +# R compiles all vignettes in the same session, which can be bad +rm(list = ls(all = TRUE)) +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knit_print.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knit_print.html new file mode 100644 index 00000000..6d1b2468 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knit_print.html @@ -0,0 +1,522 @@ + + + + + +Custom Print Methods + + + + +
+

Custom Print Methods

+

Yihui Xie

+

2024-11-06

+
+
+

Before knitr v1.6, printing objects in R code chunks basically emulates the R console. For example, a data frame is printed like this^[Note R prints an object without an explicit print() call when it is visible; see ?invisible]:

+
head(mtcars)
+
+
                   mpg cyl disp  hp drat    wt  qsec vs am gear carb
+Mazda RX4         21.0   6  160 110 3.90 2.620 16.46  0  1    4    4
+Mazda RX4 Wag     21.0   6  160 110 3.90 2.875 17.02  0  1    4    4
+Datsun 710        22.8   4  108  93 3.85 2.320 18.61  1  1    4    1
+Hornet 4 Drive    21.4   6  258 110 3.08 3.215 19.44  1  0    3    1
+Hornet Sportabout 18.7   8  360 175 3.15 3.440 17.02  0  0    3    2
+Valiant           18.1   6  225 105 2.76 3.460 20.22  1  0    3    1
+
+

The text representation of the data frame above may look very familiar with most R users, but for reporting purposes, it may not be satisfactory – often times we want to see a table representation instead. That is the problem that the chunk option render and the S3 generic function knit_print() try to solve.

+

Customize Printing

+

After we evaluate each R expression in a code chunk, there is an object returned. For example, 1 + 1 returns 2. This object is passed to the chunk option render, which is a function with two arguments, x and options, or x and .... The default value for the render option is knit_print, an S3 function in knitr:

+
library(knitr)
+knit_print  # an S3 generic function
+
+
## function (x, ...) 
+## {
+##     if (need_screenshot(x, ...)) {
+##         html_screenshot(x)
+##     }
+##     else {
+##         UseMethod("knit_print")
+##     }
+## }
+## <bytecode: 0x1371ace70>
+## <environment: namespace:knitr>
+
+
methods(knit_print)
+
+
## [1] knit_print.default*       knit_print.knit_asis*    
+## [3] knit_print.knit_asis_url* knit_print.knitr_kable*  
+## see '?methods' for accessing help and source code
+
+
getS3method('knit_print', 'default')  # the default method
+
+
## function (x, ..., inline = FALSE) 
+## {
+##     if (inline) 
+##         x
+##     else normal_print(x)
+## }
+## <bytecode: 0x1369490e0>
+## <environment: namespace:knitr>
+
+
normal_print
+
+
## function (x, ...) 
+## {
+##     if (isS4(x)) 
+##         methods::show(x)
+##     else print(x)
+## }
+## <bytecode: 0x136074468>
+## <environment: namespace:knitr>
+
+

As we can see, knit_print() has a default method, which is basically print() or show(), depending on whether the object is an S4 object. This means it does nothing special when printing R objects:

+
knit_print(1:10)
+##  [1]  1  2  3  4  5  6  7  8  9 10
+knit_print(head(mtcars))
+##                    mpg cyl disp  hp drat    wt  qsec vs am gear carb
+## Mazda RX4         21.0   6  160 110 3.90 2.620 16.46  0  1    4    4
+## Mazda RX4 Wag     21.0   6  160 110 3.90 2.875 17.02  0  1    4    4
+## Datsun 710        22.8   4  108  93 3.85 2.320 18.61  1  1    4    1
+## Hornet 4 Drive    21.4   6  258 110 3.08 3.215 19.44  1  0    3    1
+## Hornet Sportabout 18.7   8  360 175 3.15 3.440 17.02  0  0    3    2
+## Valiant           18.1   6  225 105 2.76 3.460 20.22  1  0    3    1
+
+

S3 generic functions are extensible in the sense that we can define custom methods for them. A method knit_print.foo() will be applied to the object that has the class foo. Here is quick example of how we can print data frames as tables:

+
library(knitr)
+# define a method for objects of the class data.frame
+knit_print.data.frame = function(x, ...) {
+  res = paste(c('', '', kable(x)), collapse = '\n')
+  asis_output(res)
+}
+# register the method
+registerS3method("knit_print", "data.frame", knit_print.data.frame)
+
+

If you define a method in a code chunk in a knitr document, the call to registerS3method() will be necessary for R >= 3.5.0, because the S3 dispatch mechanism has changed since R 3.5.0. If you are developing an R package, see the section [For package authors] below.

+

We expect the print method to return a character vector, or an object that can be coerced into a character vector. In the example above, the kable() function returns a character vector, which we pass to the asis_output() function so that later knitr knows that this result needs no special treatment (just write it as is), otherwise it depends on the chunk option results (= 'asis' / 'markup' / 'hide') how a normal character vector should be written. The function asis_output() has the same effect as results = 'asis', but saves us the effort to provide this chunk option explicitly. Now we check how the printing behavior is changed. We print a number, a character vector, a list, a data frame, and write a character value using cat() in the chunk below:

+
1 + 1
+
+
## [1] 2
+
+
head(letters)
+
+
## [1] "a" "b" "c" "d" "e" "f"
+
+
list(a = 1, b = 9:4)
+
+
## $a
+## [1] 1
+## 
+## $b
+## [1] 9 8 7 6 5 4
+
+
head(mtcars)
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
mpgcyldisphpdratwtqsecvsamgearcarb
Mazda RX421.061601103.902.62016.460144
Mazda RX4 Wag21.061601103.902.87517.020144
Datsun 71022.84108933.852.32018.611141
Hornet 4 Drive21.462581103.083.21519.441031
Hornet Sportabout18.783601753.153.44017.020032
Valiant18.162251052.763.46020.221031
+
cat('This is cool.')
+
+
## This is cool.
+
+

We see all objects except the data frame were printed “normally”^[The two hashes ## were from the chunk option comment; you can turn them off by comment = ''.]. The data frame was printed as a real table. Note you do not have to use kable() to create tables – there are many other options such as xtable. Just make sure the print method returns a character string.

+

The printr package is a companion to knitr containing printing methods for some common objects like matrices and data frames. Users only need to load this package to get attractive printed results. A major factor to consider (which has been considered in printr) when defining a printing method is the output format. For example, the table syntax can be entirely different when the output is LaTeX vs when it is Markdown.

+

It is strongly recommended that your S3 method has a ... argument, so that your method can safely ignore arguments that are passed to knit_print() but not defined in your method. At the moment, a knit_print() method can have two optional arguments:

+
    +
  • the options argument takes a list of the current chunk options;
  • +
  • the inline argument indicates if the method is called in code chunks or inline R code;
  • +
+

Depending on your application, you may optionally use these arguments. Here are some examples:

+
knit_print.classA = function(x, ...) {
+  # ignore options and inline
+}
+knit_print.classB = function(x, options, ...) {
+  # use the chunk option out.height
+  asis_output(paste0(
+    '<iframe src="https://yihui.org" height="', options$out.height, '"></iframe>',
+  ))
+}
+knit_print.classC = function(x, inline = FALSE, ...) {
+  # different output according to inline=TRUE/FALSE
+  if (inline) {
+    'inline output for classC'
+  } else {
+    'chunk output for classC'
+  }
+}
+knit_print.classD = function(x, options, inline = FALSE, ...) {
+  # use both options and inline
+}
+
+

Note that when using your (or another) knit_print() method inline (if it supports that), you must not call knit_print() on the object, but just have it return. For example, your inline code should read `r c("foo")` and not `r knit_print(c("foo"))`. The latter inline code would yield the methods’ result for in-chunk (not inline), because, as set up in the above, knit_print() methods default to inline = FALSE. This default gets overwritten depending on the context in which knit_print() is called (inline or in-chunk), only when knit_print() is called by knitr (not you) via the render option (see below). You can, of course, always manually set the inline option `r knit_print(c("foo"), inline = TRUE)`, but that’s a lot of typing.

+

A Low-level Explanation

+

You can skip this section if you do not care about the low-level implementation details.

+

The render option

+

As mentioned before, the chunk option render is a function that defaults to knit_print(). We can certainly use other render functions. For example, we create a dummy function that always says “I do not know what to print” no matter what objects it receives:

+
dummy_print = function(x, ...) {
+  cat("I do not know what to print!")
+  # this function implicitly returns an invisible NULL
+}
+
+

Now we use the chunk option render = dummy_print:

+
1 + 1
+## I do not know what to print!
+head(letters)
+## I do not know what to print!
+list(a = 1, b = 9:4)
+## I do not know what to print!
+head(mtcars)
+## I do not know what to print!
+cat('This is cool.')
+## This is cool.
+
+

Note the render function is only applied to visible objects. There are cases in which the objects returned are invisible, e.g. those wrapped in invisible().

+
1 + 1
+
+
## [1] 2
+
+
invisible(1 + 1)
+invisible(head(mtcars))
+x = 1:10  # invisibly returns 1:10
+
+

Metadata

+

The print function can have a side effect of passing “metadata” about objects to knitr, and knitr will collect this information as it prints objects. The motivation of collecting metadata is to store external dependencies of the objects to be printed. Normally we print an object only to obtain a text representation, but there are cases that can be more complicated. For example, a ggvis graph requires external JavaScript and CSS dependencies such as ggvis.js. The graph itself is basically a fragment of JavaScript code, which will not work unless the required libraries are loaded (in the HTML header). Therefore we need to collect the dependencies of an object beside printing the object itself.

+

One way to specify the dependencies is through the meta argument of asis_output(). Here is a pseudo example:

+
# pseudo code
+knit_print.ggvis = function(x, ...) {
+  res = ggvis::print_this_object(x)
+  knitr::asis_output(res, meta = list(
+    ggvis = list(
+      version = '0.1.0',
+      js  = system.file('www', 'js',  'ggvis.js',  package = 'ggvis'),
+      css = system.file('www', 'www', 'ggvis.css', package = 'ggvis')
+    )
+  ))
+}
+
+

Then when knitr prints a ggvis object, the meta information will be collected and stored. After knitting is done, we can obtain a list of all the dependencies via knit_meta(). It is very likely that there are duplicate entries in the list, and it is up to the package authors to clean them up, and process the metadata list in their own way (e.g. write the dependencies into the HTML header). We give a few more quick and dirty examples below to see how knit_meta() works.

+

Now we define a print method for foo objects:

+
library(knitr)
+knit_print.foo = function(x, ...) {
+  res = paste('> **This is a `foo` object**:', x)
+  asis_output(res, meta = list(
+    js  = system.file('www', 'shared', 'shiny.js',  package = 'shiny'),
+    css = system.file('www', 'shared', 'shiny.css', package = 'shiny')
+  ))
+}
+
+

See what happens when we print foo objects:

+
new_foo = function(x) structure(x, class = 'foo')
+new_foo('hello')
+
+
+

This is a foo object: hello

+
+

Check the metadata now:

+
str(knit_meta(clean = FALSE))
+
+
## List of 2
+##  $ js : chr ""
+##  $ css: chr ""
+##  - attr(*, "knit_meta_id")= chr [1:2] "unnamed-chunk-9" "unnamed-chunk-9"
+
+

Another foo object:

+
new_foo('world')
+
+
+

This is a foo object: world

+
+

Similarly for bar objects:

+
knit_print.bar = function(x, ...) {
+  asis_output(x, meta = list(head = '<script>console.log("bar!")</script>'))
+}
+new_bar = function(x) structure(x, class = 'bar')
+new_bar('> **hello** world!')
+
+
+

hello world!

+
+
new_bar('> hello **world**!')
+
+
+

hello world!

+
+

The final version of the metadata, and clean it up:

+
str(knit_meta())
+
+
## List of 6
+##  $ js  : chr ""
+##  $ css : chr ""
+##  $ js  : chr ""
+##  $ css : chr ""
+##  $ head: chr "<script>console.log(\"bar!\")</script>"
+##  $ head: chr "<script>console.log(\"bar!\")</script>"
+##  - attr(*, "knit_meta_id")= chr [1:6] "unnamed-chunk-9" "unnamed-chunk-9" "unnamed-chunk-11" "unnamed-chunk-11" ...
+
+
str(knit_meta()) # empty now, because clean = TRUE by default
+
+
##  list()
+
+

For package authors

+

If you are implementing a custom print method in your own package, here are two tips:

+
    +
  1. +

    With R >= 3.6.0 (2019-04-26), you can declare the S3 method in the package NAMESPACE with S3method(knitr::knit_print, class). If you use roxygen2 package, that means a roxygen comment like this:

    +
    #' @exportS3Method knitr::knit_print
    +knit_print.class <- 
    +
    +

    With this method, you do not need to import knitr to your package, i.e., knitr can be listed in Suggests and not necessarily Imports in the package DESCRIPTION. The S3 methods will be automatically registered when knitr is actually loaded.

    +

    For R < 3.6.0, you need to import knit_print in your package namespace via importFrom(knitr, knit_print) (or roxygen: #' @importFrom knitr knit_print) (see the printr package for an example).

    +
  2. +
  3. +

    asis_output() is simply a function that marks an object with the class knit_asis, and you do not have to import this function to your package, either—just let your print method return structure(x, class = 'knit_asis'), and if there are additional metadata, just put it in the knit_meta attribute; here is the source code of this function:

    +
    knitr::asis_output
    +
    +
    ## function (x, meta = NULL, cacheable = NA) 
    +## {
    +##     structure(x, class = "knit_asis", knit_meta = meta, knit_cacheable = cacheable)
    +## }
    +## <bytecode: 0x13710f1f0>
    +## <environment: namespace:knitr>
    +
    +

    You may put knitr in the Suggests field in DESCRIPTION, and use knitr::asis_output(), so that you can avoid the “hard” dependency on knitr.

    +
  4. +
+
+ + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-html.Rhtml b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-html.Rhtml new file mode 100644 index 00000000..3233ea8f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-html.Rhtml @@ -0,0 +1,57 @@ + + + + + + + + An R HTML vignette with knitr + + + + + +

This is an R HTML vignette. The file extension is *.Rhtml, and +it has to include a special comment to tell R that this file needs to be +compiled by knitr:

+ +
<!--
+%\VignetteEngine{knitr::knitr}
+%\VignetteIndexEntry{The Title of Your Vignette}
+-->
+
+ +

Now you can write R code chunks:

+ + + +

You can also embed plots, for example:

+ + + +

For package vignettes, you need to encode images in base64 strings using the +knitr::image_uri() function so that the image files are no longer +needed after the vignette is compiled. For example, you can add this chunk in +the beginning of a vignette:

+ + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-html.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-html.html new file mode 100644 index 00000000..f24bb8ac --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-html.html @@ -0,0 +1,146 @@ + + + + + + + + + An R HTML vignette with knitr + + + + + +

This is an R HTML vignette. The file extension is *.Rhtml, and +it has to include a special comment to tell R that this file needs to be +compiled by knitr:

+ +
<!--
+%\VignetteEngine{knitr::knitr}
+%\VignetteIndexEntry{The Title of Your Vignette}
+-->
+
+ +

Now you can write R code chunks:

+ +
summary(cars)
+
+
##      speed           dist    
+##  Min.   : 4.0   Min.   :  2  
+##  1st Qu.:12.0   1st Qu.: 26  
+##  Median :15.0   Median : 36  
+##  Mean   :15.4   Mean   : 43  
+##  3rd Qu.:19.0   3rd Qu.: 56  
+##  Max.   :25.0   Max.   :120
+
+
fit=lm(dist~speed, data=cars)
+summary(fit)
+
+
## 
+## Call:
+## lm(formula = dist ~ speed, data = cars)
+## 
+## Residuals:
+##    Min     1Q Median     3Q    Max 
+## -29.07  -9.53  -2.27   9.21  43.20 
+## 
+## Coefficients:
+##             Estimate Std. Error t value Pr(>|t|)    
+## (Intercept)  -17.579      6.758   -2.60    0.012 *  
+## speed          3.932      0.416    9.46  1.5e-12 ***
+## ---
+## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
+## 
+## Residual standard error: 15.4 on 48 degrees of freedom
+## Multiple R-squared:  0.651,	Adjusted R-squared:  0.644 
+## F-statistic: 89.6 on 1 and 48 DF,  p-value: 1.49e-12
+
+
+ +

You can also embed plots, for example:

+ +
par(mar=c(4,4,.1,.1))
+plot(cars, pch=19)
+
+
plot of chunk cars-plot
+ +

For package vignettes, you need to encode images in base64 strings using the +knitr::image_uri() function so that the image files are no longer +needed after the vignette is compiled. For example, you can add this chunk in +the beginning of a vignette:

+ +
library(knitr)
+# to base64 encode images
+opts_knit$set(upload.fun = image_uri)
+
+
+ + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-intro.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-intro.R new file mode 100644 index 00000000..34c0da9a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-intro.R @@ -0,0 +1,13 @@ +options(digits = 4) +rnorm(20) +fit = lm(dist ~ speed, data = cars) +b = coef(fit) + +summary(fit)$coefficients + +par(mar=c(4, 4, 1, .1)) +plot(cars, pch = 20) +abline(fit, col = 'red') + +print(citation('knitr'), style = 'html') + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-intro.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-intro.Rmd new file mode 100644 index 00000000..73ba96ed --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-intro.Rmd @@ -0,0 +1,49 @@ +--- +title: "Not An Introduction to knitr" +author: "Yihui Xie" +date: "`{r} Sys.Date()`" +output: + litedown::html_format: + meta: + css: ["@default"] +vignette: > + %\VignetteEngine{litedown::vignette} + %\VignetteIndexEntry{Not an Introduction to knitr} +--- + +The **knitr** package is an alternative tool to Sweave based on a different +design with more features. This document is not an introduction, but only serves +as a placeholder to guide you to the real manuals, which are available on the +package website (e.g. the [main +manual](https://yihui.org/knitr/demo/manual/) and the [graphics +manual](https://yihui.org/knitr/demo/graphics/) ), and remember to read the help +pages of functions in this package. There is a book "Dynamic Docuemnts with R +and knitr" for this package, too. + +Anyway, here is a code chunk that shows you can compile vignettes with **knitr** +as well using R 3.0.x, which supports non-Sweave vignettes: + +```{r show-off} +options(digits = 4) +rnorm(20) +fit = lm(dist ~ speed, data = cars) +b = coef(fit) +``` + +```{r echo=FALSE} +summary(fit)$coefficients +``` + +The fitted regression equation is $Y=`{r} b[1]`+`{r} b[2]`x$. + +```{r graphics, fig.cap='A scatterplot with a regression line.'} +par(mar=c(4, 4, 1, .1)) +plot(cars, pch = 20) +abline(fit, col = 'red') +``` + +## References + +```{r, echo=FALSE, results='asis', warning=FALSE} +print(citation('knitr'), style = 'html') +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-intro.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-intro.html new file mode 100644 index 00000000..21a7ea89 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-intro.html @@ -0,0 +1,100 @@ + + + + + + +Not An Introduction to knitr + + + + + +
+

Not An Introduction to knitr

+

Yihui Xie

+

2024-11-06

+
+
+

The knitr package is an alternative tool to Sweave based on a different +design with more features. This document is not an introduction, but only serves +as a placeholder to guide you to the real manuals, which are available on the +package website https://yihui.org/knitr/ (e.g. the main +manual and the graphics +manual ), and remember to read the help +pages of functions in this package. There is a book “Dynamic Docuemnts with R +and knitr” for this package, too.

+

Anyway, here is a code chunk that shows you can compile vignettes with knitr +as well using R 3.0.x, which supports non-Sweave vignettes:

+
options(digits = 4)
+rnorm(20)
+
+
#>  [1] -0.53125 -1.10327  0.77924 -1.64279  2.12976  0.14292 -0.61442 -0.83602
+#>  [9]  0.55669 -3.08241 -1.60739 -0.51008  1.40616  0.10845  2.56358 -0.66988
+#> [17] -1.49418 -0.19985 -0.07476 -0.43768
+
+
fit = lm(dist ~ speed, data = cars)
+b = coef(fit)
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
EstimateStd. Errort valuePr(>|t|)
(Intercept)-17.5796.758-2.6010.012
speed3.9320.4169.4640.000
+

The fitted regression equation is \(Y=-17.6+3.93x\).

+
par(mar=c(4, 4, 1, .1))
+plot(cars, pch = 20)
+abline(fit, col = 'red')
+
+
+

A scatterplot with a regression line.

+
+

1 +A scatterplot with a regression line.

+
+
+

References

+

Xie Y (2024). +knitr: A General-Purpose Package for Dynamic Report Generation in R. +R package version 1.49, https://yihui.org/knitr/. +

+

Xie Y (2015). +Dynamic Documents with R and knitr, 2nd edition. +Chapman and Hall/CRC, Boca Raton, Florida. +ISBN 978-1498716963, https://yihui.org/knitr/. +

+

Xie Y (2014). +“knitr: A Comprehensive Tool for Reproducible Research in R.” +In Stodden V, Leisch F, Peng RD (eds.), Implementing Reproducible Computational Research. +Chapman and Hall/CRC. +ISBN 978-1466561595. +

+
+ + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-markdown.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-markdown.R new file mode 100644 index 00000000..c494e17d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-markdown.R @@ -0,0 +1,15 @@ +help(package = 'YourPackage', help_type = 'html') +# or see a standalone list of vignettes +browseVignettes('YourPackage') + +if (TRUE) cat('_hello_ **markdown**!', '\n') + +1+1 +10:1 +rnorm(5)^2 +strsplit('hello, markdown vignettes', '') + +n=300; set.seed(123) +par(mar=c(4,4,.1,.1)) +plot(rnorm(n), rnorm(n), pch=21, cex=5*runif(n), col='white', bg='gray') + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-markdown.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-markdown.Rmd new file mode 100644 index 00000000..cbda8bcf --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-markdown.Rmd @@ -0,0 +1,61 @@ +--- +title: R Markdown (v1) Vignettes with knitr +author: Yihui Xie +date: "`{r} Sys.Date()`" +output: + litedown::html_format: + meta: + css: ["@default"] +--- + + + +Before R 3.0.0, only Sweave/PDF vignettes were supported in R. Markdown is gaining popularity over the years due to its simplicity, and R 3.0.0 starts to support package vignettes written in R Markdown. + +> Please note this example is for [R Markdown v1](https://cran.r-project.org/package=markdown) only. If you use [R Markdown v2](https://rmarkdown.rstudio.com), you should use the vignette engine `knitr::rmarkdown` instead of `knitr::knitr`. + +## Package vignettes + +To enable Markdown vignettes in an R package, you need to + +- add `*.Rmd` files under the `vignettes` directory +- add `VignetteBuilder: knitr` to the `DESCRIPTION` file +- specify the vignette engine `\VignetteEngine{knitr::knitr}` in the `Rmd` files (inside HTML comments) + +## View vignettes + +And R will load the **knitr** package to build these vignettes to HTML files, and you can see them when you open the HTML help: + +```{r eval=FALSE} +help(package = 'YourPackage', help_type = 'html') +# or see a standalone list of vignettes +browseVignettes('YourPackage') +``` + +## Examples + +Below are some code chunks as examples. + +```{r hello, results='asis'} +if (TRUE) cat('_hello_ **markdown**!', '\n') +``` + +Normally you do not need any chunk options. + +```{r test, collapse=TRUE} +1+1 +10:1 +rnorm(5)^2 +strsplit('hello, markdown vignettes', '') +``` + +Feel free to draw beautiful plots and write math $P(X>x)=\alpha/2$. + +```{r} +n=300; set.seed(123) +par(mar=c(4,4,.1,.1)) +plot(rnorm(n), rnorm(n), pch=21, cex=5*runif(n), col='white', bg='gray') +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-markdown.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-markdown.html new file mode 100644 index 00000000..5bbe2aef --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-markdown.html @@ -0,0 +1,77 @@ + + + + + + +R Markdown (v1) Vignettes with knitr + + + + + +
+

R Markdown (v1) Vignettes with knitr

+

Yihui Xie

+

2024-11-06

+
+
+ +

Before R 3.0.0, only Sweave/PDF vignettes were supported in R. Markdown is gaining popularity over the years due to its simplicity, and R 3.0.0 starts to support package vignettes written in R Markdown.

+
+

Please note this example is for R Markdown v1 only. If you use R Markdown v2, you should use the vignette engine knitr::rmarkdown instead of knitr::knitr.

+
+

Package vignettes

+

To enable Markdown vignettes in an R package, you need to

+
    +
  • add *.Rmd files under the vignettes directory
  • +
  • add VignetteBuilder: knitr to the DESCRIPTION file
  • +
  • specify the vignette engine \VignetteEngine{knitr::knitr} in the Rmd files (inside HTML comments)
  • +
+

View vignettes

+

And R will load the knitr package to build these vignettes to HTML files, and you can see them when you open the HTML help:

+
help(package = 'YourPackage', help_type = 'html')
+# or see a standalone list of vignettes
+browseVignettes('YourPackage')
+
+

Examples

+

Below are some code chunks as examples.

+
if (TRUE) cat('_hello_ **markdown**!', '\n')
+
+

hello markdown!

+

Normally you do not need any chunk options.

+
1+1
+
+
#> [1] 2
+
+
10:1
+
+
#>  [1] 10  9  8  7  6  5  4  3  2  1
+
+
rnorm(5)^2
+
+
#> [1] 3.98959 0.01359 0.84722 6.17346 0.04204
+
+
strsplit('hello, markdown vignettes', '')
+
+
#> [[1]]
+#>  [1] "h" "e" "l" "l" "o" "," " " "m" "a" "r" "k" "d" "o" "w" "n" " " "v" "i" "g"
+#> [20] "n" "e" "t" "t" "e" "s"
+#> 
+
+

Feel free to draw beautiful plots and write math \(P(X>x)=\alpha/2\).

+
n=300; set.seed(123)
+par(mar=c(4,4,.1,.1))
+plot(rnorm(n), rnorm(n), pch=21, cex=5*runif(n), col='white', bg='gray')
+
+

+
+ + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-refcard.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-refcard.Rmd new file mode 100644 index 00000000..97f57a89 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-refcard.Rmd @@ -0,0 +1,127 @@ +--- +title: "knitr Reference Card" +author: "Yihui Xie" +date: "`{r} Sys.Date()`" +output: + litedown::html_format: + meta: + css: ["@default"] + options: + number_sections: true +--- + +```{=html} + +``` +## Syntax + +| format | start | end | inline | output | +|-----------|---------------------|-----------------|--------------------|----------| +| Rnw | `<<*>>=` | `@` | `\Sexpr{x}` | TeX | +| Rmd | ```` ```{r *} ```` | ```` ``` ```` | `` `r x` `` | Markdown | +| Rhtml | `` | `` | HTML | +| Rrst | `.. {r *}` | `.. ..` | `` :r:`x` `` | reST | +| Rtex | `% begin.rcode *` | `% end.rcode` | `\rinline{x}` | TeX | +| Rasciidoc | `// begin.rcode *` | `// end.rcode` | `+r x+` | AsciiDoc | +| Rtextile | `### begin.rcode *` | `### end.rcode` | `@r x@` | Textile | +| brew | | | `<% x %>` | text | + +`*` denotes local chunk options, e.g., `<>=`; `x` denotes +inline R code, e.g., `` `r 1+2` ``. + +## Minimal Examples + +::: col-2 +### Sweave (\*.Rnw) + +``` tex +\documentclass{article} +\begin{document} + +Below is a code chunk. + +<>= +z = 1 + 1 +plot(cars) +@ + +The value of z is \Sexpr{z}. +\end{document} +``` + +### R Markdown (\*.Rmd) + +```` md +--- +title: "An R Markdown document" +--- + +Hi _Markdown_! + +```{r foo, echo=TRUE} +z = 1 + 1 +plot(cars) +``` + +The value of z is `r z`. +```` +::: + +## Chunk Options + +`opts_chunk` controls global chunk options, e.g., +`knitr::opts_chunk$set(tidy = FALSE)`, which can be overridden by local chunk +options. See all options at . Some frequently +used options are: + +- `eval`: whether to evaluate the chunk +- `echo`: whether to echo source code +- `results`: `'markup'`, `'asis'`, `'hold'`, `'hide'` +- `tidy`: whether to reformat R code +- `cache`: whether to cache results +- `fig.width`, `fig.height`, `out.width`, `out.height`: device and output size + of figures +- `include`: whether to include the chunk results in output +- `child`: path to child documents +- `engine`: language name (R, python, ...) + +## Functions + +- `knit()`: the main function in this package; knit input document and write + output +- `purl()`: extract R code from an input document +- `spin()`: spin goat's hair (an R script with roxygen comments) into wool (a + literate programming document to be passed to `knit()`) +- `stitch()`: insert an R script into a template and compile the document +- `knit_hooks$set()`: set or reset chunk and output + [hooks](https://yihui.org/knitr/hooks/) + +## Resources + +- Homepage: +- Github: + ([CRAN](https://cran.r-project.org/package=knitr)) +- Examples: +- Stack Overflow: + +```{css, echo=FALSE} +body { + max-width: none; +} +table { + width: 100%; +} +.body h2 { + border-bottom: none; + font-size: 1.3em; +} +.body, .col-2 { + columns: 2; + & > :first-child { + margin-top: 0; + } +} +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-refcard.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-refcard.html new file mode 100644 index 00000000..0fc98a83 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/doc/knitr-refcard.html @@ -0,0 +1,183 @@ + + + + + + +knitr Reference Card + + + + +
+

knitr Reference Card

+

Yihui Xie

+

2024-11-06

+
+
+ +

1 Syntax

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
formatstartendinlineoutput
Rnw<<*>>=@\Sexpr{x}TeX
Rmd```{r *}````r x`Markdown
Rhtml<!--begin.rcode *end.rcode--><!--rinline x-->HTML
Rrst.. {r *}.. ..:r:`x`reST
Rtex% begin.rcode *% end.rcode\rinline{x}TeX
Rasciidoc// begin.rcode *// end.rcode+r x+AsciiDoc
Rtextile### begin.rcode *### end.rcode@r x@Textile
brew<% x %>text
+

* denotes local chunk options, e.g., <<label, eval=FALSE>>=; x denotes +inline R code, e.g., `r 1+2`.

+

2 Minimal Examples

+
+

2.1 Sweave (*.Rnw)

+
\documentclass{article}
+\begin{document}
+
+Below is a code chunk.
+
+<<foo, echo=TRUE>>=
+z = 1 + 1
+plot(cars)
+@
+
+The value of z is \Sexpr{z}.
+\end{document}
+
+

2.2 R Markdown (*.Rmd)

+
---
+title: "An R Markdown document"
+---
+
+Hi _Markdown_!
+
+```{r foo, echo=TRUE}
+z = 1 + 1
+plot(cars)
+```
+
+The value of z is `r z`.
+
+
+

3 Chunk Options

+

opts_chunk controls global chunk options, e.g., +knitr::opts_chunk$set(tidy = FALSE), which can be overridden by local chunk +options. See all options at https://yihui.org/knitr/options/. Some frequently +used options are:

+
    +
  • eval: whether to evaluate the chunk
  • +
  • echo: whether to echo source code
  • +
  • results: 'markup', 'asis', 'hold', 'hide'
  • +
  • tidy: whether to reformat R code
  • +
  • cache: whether to cache results
  • +
  • fig.width, fig.height, out.width, out.height: device and output size +of figures
  • +
  • include: whether to include the chunk results in output
  • +
  • child: path to child documents
  • +
  • engine: language name (R, python, …)
  • +
+

4 Functions

+
    +
  • knit(): the main function in this package; knit input document and write +output
  • +
  • purl(): extract R code from an input document
  • +
  • spin(): spin goat’s hair (an R script with roxygen comments) into wool (a +literate programming document to be passed to knit())
  • +
  • stitch(): insert an R script into a template and compile the document
  • +
  • knit_hooks$set(): set or reset chunk and output +hooks
  • +
+

5 Resources

+ + +
+ + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/README.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/README.md new file mode 100644 index 00000000..00265a48 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/README.md @@ -0,0 +1,4 @@ +# knitr-examples + +To compile the `knitr-graphics` example, look at the bottom of the file +[`knitr-graphics.lyx`](knitr-graphics.lyx) for its dependencies. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/knitr-child-a.Rnw b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/knitr-child-a.Rnw new file mode 100644 index 00000000..3960b100 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/knitr-child-a.Rnw @@ -0,0 +1,7 @@ +\section{Child via the \texttt{child} option} + +This chunk below is from the chunk option \texttt{child}. + +<>= +1+1 # child a +@ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/knitr-child-b.Rnw b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/knitr-child-b.Rnw new file mode 100644 index 00000000..230b25d8 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/knitr-child-b.Rnw @@ -0,0 +1,5 @@ +\section{Another child via the \texttt{child} option} + +<>= +1+1 # child b +@ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/knitr-child.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/knitr-child.Rmd new file mode 100644 index 00000000..84804297 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/knitr-child.Rmd @@ -0,0 +1,7 @@ +Hi, there. I'm a child. + +```{r test-child} +options(digits = 4) +1+1 +dnorm(0) +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/knitr-child2.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/knitr-child2.Rmd new file mode 100644 index 00000000..2ccf42da --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/knitr-child2.Rmd @@ -0,0 +1,6 @@ +Hi, there. I'm another child. + +```{r test-child2} +x <- rnorm(n = 3) +x +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/knitr-main.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/knitr-main.Rmd new file mode 100644 index 00000000..ac30df10 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/knitr-main.Rmd @@ -0,0 +1,22 @@ +You can also use the `child` option to include child documents in markdown. + +```{r test-main, child='knitr-child.Rmd'} +``` + +You can continue your main document below, of course. + +```{r test-another} +pmax(1:10, 5) +``` + +If you refer to a child document in a chunk, only the child document will be evaluated. +Other code in the chunk will not be evaluated when you `render` the document. + +```{r test-warning-option, include=FALSE} +options(knitr.child.warning = FALSE) +``` + +```{r test-warning, child='knitr-child2.Rmd'} +x <- "this code is not evaluated" +x +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/knitr-main.Rnw b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/knitr-main.Rnw new file mode 100644 index 00000000..0255ae35 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/knitr-main.Rnw @@ -0,0 +1,15 @@ +\documentclass{article} +\usepackage{mathpazo} +\begin{document} +This main document has several children. + +<>= +1+1 +@ +<>= +@ + +<>= +@ + +\end{document} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/knitr-parent.Rnw b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/knitr-parent.Rnw new file mode 100644 index 00000000..2db3a851 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/knitr-parent.Rnw @@ -0,0 +1,15 @@ +\section{Child can specify its parents} + +<>= +set_parent('knitr-main.Rnw') +@ + +My parent is \textsf{knitr-main.Rnw}. + +<>= +1+1 +@ + +I'm not a complete LaTeX document, but you can compile me nonetheless. I'll +borrow the preamble from my parent. + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/sub/knitr-child-c.Rnw b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/sub/knitr-child-c.Rnw new file mode 100644 index 00000000..69ef8368 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/child/sub/knitr-child-c.Rnw @@ -0,0 +1,5 @@ +\section{Child in a sub directory} + +<>= +1+1 # child d +@ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knit-all.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knit-all.R new file mode 100755 index 00000000..fd01795b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knit-all.R @@ -0,0 +1,45 @@ +#!/usr/bin/env Rscript + +if (!nzchar(Sys.which('lyx')) || system('lyx -version') != 0L) q() + +call_lyx = function(file) { + res = sapply(sprintf('lyx -e %s %s', c('knitr', 'r', 'pdf2'), file), + system, ignore.stdout = TRUE, USE.NAMES = FALSE) + unlink(sub('\\.lyx$', '.R', file)) + stopifnot(identical(res, integer(3L))) +} + +for (i in list.files(pattern = '\\.lyx$')) { + message(i) + call_lyx(i) + flush.console() +} + +knit_script = normalizePath('../bin/knit', mustWork = TRUE) +knit_cmd = function(file) { + paste('Rscript', shQuote(knit_script), shQuote(file)) +} +test_cmd = function(cmd) { + stopifnot(identical(system(cmd, ignore.stdout = TRUE), 0L)) +} + +for (i in list.files(pattern = '\\.Rmd')) { + message(i) + cmd = if (i == 'knitr-minimal.Rmd') { + sprintf("Rscript -e 'library(knitr);opts_knit$set(base.url=\"http://animation.r-forge.r-project.org/ideas/\");knit(\"%s\")'", i) + } else knit_cmd(i) + test_cmd(cmd) + flush.console() +} + +test_cmd(sprintf("Rscript -e 'library(knitr);spin(\"knitr-spin.R\", precious=TRUE)'")) + +setwd('child') +for (i in c('knitr-main.Rnw', 'knitr-parent.Rnw')) { + test_cmd(knit_cmd(i)) +} +unlink('*.tex') +test_cmd(knit_cmd('knitr-main.Rmd')) +setwd('..') + +file.remove('child/knitr-main.html') diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-beamer.Rnw b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-beamer.Rnw new file mode 100644 index 00000000..cb948117 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-beamer.Rnw @@ -0,0 +1,120 @@ +%% LyX 2.2.1 created this file. For more info, see http://www.lyx.org/. +%% Do not edit unless you really know what you are doing. +\documentclass[10pt]{beamer} +\usepackage[T1]{fontenc} +\setcounter{secnumdepth}{3} +\setcounter{tocdepth}{3} +\usepackage{url} +\ifx\hypersetup\undefined + \AtBeginDocument{% + \hypersetup{unicode=true,pdfusetitle, + bookmarks=true,bookmarksnumbered=false,bookmarksopen=false, + breaklinks=false,pdfborder={0 0 0},pdfborderstyle={},backref=false,colorlinks=false} + } +\else + \hypersetup{unicode=true,pdfusetitle, + bookmarks=true,bookmarksnumbered=false,bookmarksopen=false, + breaklinks=false,pdfborder={0 0 0},pdfborderstyle={},backref=false,colorlinks=false} +\fi +\usepackage{breakurl} + +\makeatletter + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands. +\providecommand{\LyX}{\texorpdfstring% + {L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@} + {LyX}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands. + % this default might be overridden by plain title style + \newcommand\makebeamertitle{\frame{\maketitle}}% + % (ERT) argument for the TOC + \AtBeginDocument{% + \let\origtableofcontents=\tableofcontents + \def\tableofcontents{\@ifnextchar[{\origtableofcontents}{\gobbletableofcontents}} + \def\gobbletableofcontents#1{\origtableofcontents} + } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands. +\usetheme{PaloAlto} + +\makeatother + +\begin{document} +<>= +library(knitr) +opts_chunk$set(fig.path='figure/beamer-',fig.align='center',fig.show='hold',size='footnotesize') +@ + +\title[knitr, Beamer, and FragileFrame]{A Minimal Demo of knitr with Beamer and Fragile Frames} + +\author{Yihui Xie\thanks{I thank Richard E. Goldberg for providing this demo.}} +\makebeamertitle +\begin{frame}{Background} + +\begin{itemize} +\item The \textbf{knitr}\textbf{\emph{ }}package allows you to embed R code +and figures in \LaTeX{} documents + +\begin{itemize} +\item It has functionality similar to Sweave but looks nicer and gives you +more control +\end{itemize} +\item If you already have Sweave working in \LyX{}, getting \textbf{knitr} +to work is trivial + +\begin{enumerate} +\item Install the \textbf{knitr} package in \emph{R} +\item Read \url{https://yihui.org/knitr/demo/lyx/} +\end{enumerate} +\item If you use Sweave or \textbf{knitr} with Beamer in \LyX{}, you must +use the\emph{ FragileFrame} environment for the frames that contain +R code chunks. Let's see if \textbf{knitr} works with Beamer in this +small demo. +\end{itemize} +\end{frame} + +\section{First Test} +\begin{frame}[fragile]{First Test} + +OK, let's get started with just some text: + +<>= +# some setup +options(width=60) # make the printing fit on the page +set.seed(1121) # make the results repeatable +@ + +<<>>= +# create some random numbers +(x=rnorm(20)) +mean(x);var(x) +@ + +BTW, the first element of \texttt{x} is \Sexpr{x[1]}. (Did you notice +the use of\texttt{ \textbackslash{}Sexpr\{\}}?) +\end{frame} + +\section{Second Test} +\begin{frame}[fragile]{Second Test} + +Text is nice but let's see what happens if we make a couple of plots +in our chunk: + +<>= +par(las=1,mar=c(4,4,.1,.1)) # tick labels direction +boxplot(x) +hist(x,main='',col="blue",probability=TRUE) +lines(density(x),col="red") +@ +\end{frame} + +\section{The Big Question} +\begin{frame}{The Big Question} + +Do the above chunks work? You should be able to compile the \LyX{} +document and get a nice-looking PDF slide presentation. If not, time +to double-check everything... +\end{frame} + +\end{document} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-beamer.lyx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-beamer.lyx new file mode 100644 index 00000000..ae00a878 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-beamer.lyx @@ -0,0 +1,438 @@ +#LyX 2.1 created this file. For more info see http://www.lyx.org/ +\lyxformat 474 +\begin_document +\begin_header +\textclass beamer +\begin_preamble +\usetheme{PaloAlto} +\end_preamble +\use_default_options true +\begin_modules +knitr +\end_modules +\maintain_unincluded_children false +\language english +\language_package none +\inputencoding default +\fontencoding global +\font_roman default +\font_sans default +\font_typewriter default +\font_math auto +\font_default_family default +\use_non_tex_fonts false +\font_sc false +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 +\graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\paperfontsize 10 +\spacing single +\use_hyperref true +\pdf_bookmarks true +\pdf_bookmarksnumbered false +\pdf_bookmarksopen false +\pdf_bookmarksopenlevel 1 +\pdf_breaklinks false +\pdf_pdfborder true +\pdf_colorlinks false +\pdf_backref false +\pdf_pdfusetitle true +\papersize default +\use_geometry true +\use_package amsmath 1 +\use_package amssymb 1 +\use_package cancel 1 +\use_package esint 1 +\use_package mathdots 1 +\use_package mathtools 1 +\use_package mhchem 1 +\use_package stackrel 1 +\use_package stmaryrd 1 +\use_package undertilde 1 +\cite_engine basic +\cite_engine_type default +\biblio_style plain +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\justification true +\use_refstyle 1 +\index Index +\shortcut idx +\color #008000 +\end_index +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\paragraph_indentation default +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\end_header + +\begin_body + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +library(knitr) +\end_layout + +\begin_layout Plain Layout + +opts_chunk$set(fig.path='figure/beamer-',fig.align='center',fig.show='hold',size='f +ootnotesize') +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Title +\begin_inset Argument 1 +status collapsed + +\begin_layout Plain Layout +knitr, Beamer, and FragileFrame +\end_layout + +\end_inset + +A Minimal Demo of knitr with Beamer and Fragile Frames +\end_layout + +\begin_layout Author +Yihui Xie +\begin_inset Foot +status open + +\begin_layout Plain Layout +I thank Richard E. + Goldberg for providing this demo. +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Frame +\begin_inset Argument 4 +status open + +\begin_layout Plain Layout +Background +\end_layout + +\end_inset + + +\end_layout + +\begin_deeper +\begin_layout Itemize +The +\series bold +knitr +\emph on + +\series default +\emph default +package allows you to embed R code and figures in LaTeX documents +\end_layout + +\begin_deeper +\begin_layout Itemize +It has functionality similar to Sweave but looks nicer and gives you more + control +\end_layout + +\end_deeper +\begin_layout Itemize +If you already have Sweave working in LyX, getting +\series bold +knitr +\series default + to work is trivial +\end_layout + +\begin_deeper +\begin_layout Enumerate +Install the +\series bold +knitr +\series default + package in +\emph on +R +\end_layout + +\begin_layout Enumerate +Read +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://yihui.org/knitr/demo/lyx/ +\end_layout + +\end_inset + + +\end_layout + +\end_deeper +\begin_layout Itemize +If you use Sweave or +\series bold +knitr +\series default + with Beamer in LyX, you must use the +\emph on + FragileFrame +\emph default + environment for the frames that contain R code chunks. + Let's see if +\series bold +knitr +\series default + works with Beamer in this small demo. + +\end_layout + +\end_deeper +\begin_layout Section +First Test +\end_layout + +\begin_layout FragileFrame +\begin_inset Argument 4 +status open + +\begin_layout Plain Layout +First Test +\end_layout + +\end_inset + + +\end_layout + +\begin_deeper +\begin_layout Standard +OK, let's get started with just some text: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +# some setup +\end_layout + +\begin_layout Plain Layout + +options(width=60) # make the printing fit on the page +\end_layout + +\begin_layout Plain Layout + +set.seed(1121) # make the results repeatable +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + +<<>>= +\end_layout + +\begin_layout Plain Layout + +# create some random numbers +\end_layout + +\begin_layout Plain Layout + +(x=rnorm(20)) +\end_layout + +\begin_layout Plain Layout + +mean(x);var(x) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +BTW, the first element of +\family typewriter +x +\family default + is +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +Sexpr{x[1]} +\end_layout + +\end_inset + +. + (Did you notice the use of +\family typewriter + +\backslash +Sexpr{} +\family default +?) +\end_layout + +\end_deeper +\begin_layout Section +Second Test +\end_layout + +\begin_layout FragileFrame +\begin_inset Argument 4 +status open + +\begin_layout Plain Layout +Second Test +\end_layout + +\end_inset + + +\end_layout + +\begin_deeper +\begin_layout Standard +Text is nice but let's see what happens if we make a couple of plots in + our chunk: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +par(las=1,mar=c(4,4,.1,.1)) # tick labels direction +\end_layout + +\begin_layout Plain Layout + +boxplot(x) +\end_layout + +\begin_layout Plain Layout + +hist(x,main='',col="blue",probability=TRUE) +\end_layout + +\begin_layout Plain Layout + +lines(density(x),col="red") +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\end_deeper +\begin_layout Section +The Big Question +\end_layout + +\begin_layout Frame +\begin_inset Argument 4 +status open + +\begin_layout Plain Layout +The Big Question +\end_layout + +\end_inset + + +\end_layout + +\begin_deeper +\begin_layout Standard +Do the above chunks work? You should be able to compile the LyX document + and get a nice-looking PDF slide presentation. + If not, time to double-check everything... +\end_layout + +\end_deeper +\end_body +\end_document diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-graphics.Rnw b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-graphics.Rnw new file mode 100644 index 00000000..3790c118 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-graphics.Rnw @@ -0,0 +1,403 @@ +%% LyX 2.2.1 created this file. For more info, see http://www.lyx.org/. +%% Do not edit unless you really know what you are doing. +\documentclass[nohyper,justified]{tufte-handout} +\usepackage[T1]{fontenc} +\usepackage{url} +\usepackage[unicode=true,pdfusetitle, + bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=2, + breaklinks=true,pdfborder={0 0 1},backref=false,colorlinks=false] + {hyperref} +\hypersetup{ + pdfstartview=FitH} +\usepackage{breakurl} + +\makeatletter + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands. + +\title{knitr Graphics Manual} +\author{Yihui Xie} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands. +\renewcommand{\textfraction}{0.05} +\renewcommand{\topfraction}{0.8} +\renewcommand{\bottomfraction}{0.8} +\renewcommand{\floatpagefraction}{0.75} + +\usepackage[buttonsize=1em]{animate} + +\makeatother + +\begin{document} +<>= +library(knitr) +options(formatR.arrow=TRUE,width=50) +opts_chunk$set(fig.path='figure/graphics-', cache.path='cache/graphics-', fig.align='center', dev='tikz', fig.width=5, fig.height=5, fig.show='hold', cache=TRUE, par=TRUE) +knit_hooks$set(par=function(before, options, envir){ +if (before && options$fig.show!='none') par(mar=c(4,4,.1,.1),cex.lab=.95,cex.axis=.9,mgp=c(2,.7,0),tcl=-.3) +}, crop=hook_pdfcrop) +@ +\maketitle +\begin{abstract} +This manual shows features of graphics in the \textbf{knitr} package +(version \Sexpr{packageVersion('knitr')}) in detail, including the +graphical devices, plot recording, plot rearrangement, control of +plot sizes, the tikz device, figure captions, animations and other +types of plots such as \textbf{rgl} or GGobi plots. +\end{abstract} +Before reading this specific manual\footnote{\url{http://bit.ly/knitr-graphics-src} (Rnw source)}, +you must have finished the main manual\footnote{\url{http://bit.ly/knitr-main}}. + +\section{Graphical Devices} + +The \textbf{knitr} package comes with more than 20 built-in graphical +devices, and you can specify them through the \texttt{dev} option. +This document uses the global option \texttt{dev='tikz'}, i.e., the +plots are recorded by the tikz device by default, but we can change +the device locally. Since tikz will be used extensively throughout +this manual and you will see plenty of tikz graphics later, now we +first show a few other devices. + +<>= +with(trees, symbols(Height, Volume, circles = Girth/16, inches = FALSE, bg = 'deeppink', fg = 'gray30')) +@ + +\begin{marginfigure} +<>= +@ + +\caption{The default PDF device.\label{mar:pdf-dev}} +\end{marginfigure} + +\begin{marginfigure} +<>= +@ + +\caption{The PNG device.\label{mar:png-dev}} +\end{marginfigure} + +Figure \ref{mar:pdf-dev} and \ref{mar:png-dev} show two standard +devices in the \textbf{grDevices} package. We can also use devices +in the \textbf{Cairo} or \textbf{cairoDevice} package, e.g., the chunk +below uses the \emph{CairoPNG()} device in the \textbf{Cairo} package. + +<>= +@ + +\section{Plot Recording} + +As mentioned in the main manual, \textbf{knitr} uses the \textbf{evaluate} +package to record plots. There are two sources of plots: first, whenever +\emph{plot.new()} or \emph{grid.newpage()} is called, \textbf{evaluate} +will try to save a snapshot of the current plot\footnote{For technical details, see \texttt{?setHook} and \texttt{?recordPlot}}; +second, after each complete expression is evaluated, a snapshot is +also saved. To speed up recording, the null graphical device \texttt{pdf(file += NULL)} is used. Figure \ref{fig:two-high} shows two expressions +producing two high-level plots. + +\begin{figure} +<>= +plot(cars) +boxplot(cars$dist,xlab='dist') +@ + +\caption{Two high-level plots are captured. The key to arrange two plots side +by side is to specify the \texttt{out.width} option so that each plot +takes less than half of the line width. We do not have to use the +\texttt{par(mfrow)} trick, and it may not work in some cases (e.g. +to put base graphics and \textbf{ggplot2} side by side; recall Figure +1 in the main manual).\label{fig:two-high}} +\end{figure} + +Figure \ref{fig:low-plot-loop} shows another example of two R expressions, +but the second expression only involves with low-level plotting changes. +By default, low-level plot changes are discarded, but you can retain +them with the option \texttt{fig.keep='all'}. + +\begin{figure} +<>= +plot(0,0,type='n',ann=FALSE) +for(i in seq(0, 2*pi,length=20)) {points(cos(i),sin(i))} +@ + +\caption{Two complete R expressions will produce at most two plots, as long +as there are not multiple high-level plotting calls in each expression; +option \texttt{fig.keep='all'} here.\label{fig:low-plot-loop}} +\end{figure} + +Together with \texttt{fig.show='asis'}, we can show the process of +plotting step by step like Figure \ref{fig:high-with-low}. + +\begin{figure} +<>= +plot(cars) +abline(lm(dist~speed, data=cars)) # a regression line +@ + +\caption{Low-level plot changes in base graphics can be recorded separately, +and plots can be put in the places where they were produced.\label{fig:high-with-low}} +\end{figure} + +A further note on plot recording: \textbf{knitr} examines all recorded +plots (as R objects) and compares them sequentially; if the previous +plot is a ``subset'' of the next plot (= previous plot + low-level +changes), the previous plot will be removed when \texttt{fig.keep='high'}. +If two successive plots are identical, the second one will be removed +by default, so it might be a little bit surprising that the following +chunk will only produce one plot by default\footnote{adapted from \url{https://github.com/yihui/knitr/issues/41}}: + +<>= +m = matrix(1:100, ncol = 10) +image(m) +image(m*2) # exactly the same as previous plot +@ + +\section{Plot Rearrangement} + +We can rearrange the plots in chunks in several ways. They can be +inserted right after the line(s) of R code which produced them, or +accumulated till the end of the chunk. There is an example in the +main manual demonstrating \texttt{fig.show='asis'} for two high-level +plots, and Figure \ref{fig:high-with-low} in this manual also demonstrates +this option for a high-level plot followed by a low-level change. + +Here is an example demonstrating the option \texttt{fig.keep='last'} +(only the last plot is kept): + +\begin{figure} +<>= +library(ggplot2) +pie <- ggplot(diamonds, aes(x = factor(1), fill = cut)) + xlab('cut') + geom_bar(width = 1) +pie + coord_polar(theta = "y") # a pie chart +pie + coord_polar() # the bullseye chart +@ + +\caption{Two plots were produced in this chunk, but only the last one is kept. +This can be useful when we experiment with many plots, but only want +the last result. (Adapted from the \textbf{ggplot2} website)} +\end{figure} + +When multiple plots are produced by a code chunk, we may want to show +them as an animation with the option \texttt{fig.show='animate'}. +Figure \ref{fig:clock-animation} shows a simple clock animation; +you may compare the code to Figure \ref{fig:high-with-low} to understand +that high-level plots are always recorded, regardless of where they +appeared. + +\begin{figure} +<>= +par(mar = rep(3, 4)) +for (i in seq(pi/2, -4/3 * pi, length = 12)) { + plot(0, 0, pch = 20, ann = FALSE, axes = FALSE) + arrows(0, 0, cos(i), sin(i)) + axis(1, 0, "VI"); axis(2, 0, "IX") + axis(3, 0, "XII"); axis(4, 0, "III"); box() +} +@ + +\caption{A clock animation. You have to view it in Adobe Reader: click to play/pause; +there are also buttons to speed up or slow down the animation.\label{fig:clock-animation}} +\end{figure} + +We can also set the alignment of plots easily with the \texttt{fig.align} +option; this document uses \texttt{fig.align='center'} as a global +option, and we can also set plots to be left/right-aligned. Figure +\ref{fig:maruko-plot} is an example of a left-aligned plot. + +\begin{figure} +<>= +stars(cbind(1:16,10*(16:1)),draw.segments=TRUE) +@ + +\caption{A left-aligned plot adapted from \texttt{?stars} (I call this the +``Maruko'' plot, and it is one of my favorites; see \protect\url{http://en.wikipedia.org/wiki/Chibi_Maruko-chan}).\label{fig:maruko-plot}} +\end{figure} + + +\section{Plot Size} + +We have seen several examples in which two or more plots can be put +side by side, and this is because the plots were resized in the output +document; with the chunk option \texttt{out.width} less than half +of the line width, \LaTeX{} will arrange two plots in one line; if +it is less than $1/3$ of the line width, three plots can be put in +one line. Of course we can also set it to be an absolute width like +\texttt{3in} (3 inches). This option is used extensively in this document +to control the size of plots in the output document. + +\section{The tikz Device} + +The main advantage of using tikz graphics is the consistency of styles +between texts in plots and those in the main document. Since we can +use native \LaTeX{} commands in plots, the styles of texts in plots +can be very sophisticated (see Figure \ref{fig:math-formula-tt} for +an example). + +\begin{figure} +<>= +plot(0:1,0:1,type='n', ylab='origin of statistics', xlab='statistical presentation rocks with \\LaTeX{}') +text(.5,c(.8,.5,.2), c('\\texttt{lm(y \\textasciitilde{} x)}', '$\\hat{\\beta}=(X^{\\prime}X)^{-1}X^{\\prime}y$', '$(\\Omega,\\mathcal{F},\\mu)$')) +@ + +\caption{A plot created by \textbf{tikzDevice} with math expressions and typewriter +fonts. Note the font style consistency \textendash{} we write the +same expressions in \protect\LaTeX{} here: $\hat{\beta}=(X^{\prime}X)^{-1}X^{\prime}y$ +and $(\Omega,\mathcal{F},\mu)$; also \texttt{lm(y \textasciitilde{} +x)}.\label{fig:math-formula-tt}} +\end{figure} + +When using Xe\LaTeX{} instead of PDF\LaTeX{} to compile the document, +we need to tell the \textbf{tikzDevice} package by setting the \texttt{tikzDefaultEngine} +option before all plot chunks (preferably in the first chunk): + +<>= +options(tikzDefaultEngine='xetex') +@ + +This is useful and often necessary to compile tikz plots which contain +(UTF8) multi-byte characters. + +\section{Figure Caption} + +If the chunk option \texttt{fig.cap} is not \texttt{NULL} or \texttt{NA}, +the plots will be put in a \texttt{figure} environment when the output +format is \LaTeX{}, and this option is used to write a caption in +this environment using \texttt{\textbackslash{}caption\{\}}. The other +two related options are \texttt{fig.scap} and \texttt{fig.lp} which +set the short caption and a prefix string for the figure label. The +default short caption is extracted from the caption by truncating +it at the first period or colon or semi-colon. The label is a combination +of \texttt{fig.lp} and the chunk label. Because \texttt{figure} is +a float environment, it can float away from the chunk output to other +places such as the top or bottom of a page when the \TeX{} document +is compiled. + +\section{Other Features} + +The \textbf{knitr} package can be extended with hook functions, and +here I give a few examples illustrating the flexibility. + +\subsection{Cropping PDF Graphics} + +Some R users may have been suffering from the extra margins in R plots, +especially in base graphics (\textbf{ggplot2} is much better in this +aspect). The default graphical option \texttt{mar} is about \texttt{c(5, +4, 4, 2)} (see \texttt{?par}), which is often too big. Instead of +endlessly setting \texttt{par(mar)}, you may consider the program +\texttt{pdfcrop}, which can crop the white margin automatically\footnote{\url{http://www.ctan.org/pkg/pdfcrop}}. +In \textbf{knitr}, we can set up the hook \emph{hook\_pdfcrop()} to +work with a chunk option, say, \texttt{crop}. + +<>= +knit_hooks$set(crop=hook_pdfcrop) +@ + +Now we compare two plots below. The first one is not cropped (Figure +\ref{fig:pdf-nocrop}); then the same plot is produced but with a +chunk option \texttt{crop=TRUE} which will call the cropping hook +(Figure \ref{fig:pdf-crop}). + +\begin{figure} +\begin{kframe} +<>= +par(mar=c(5,4,4,2),bg='white') # large margin +plot(lat~long,data=quakes,pch=20,col=rgb(0,0,0,.2)) +@ +\end{kframe} + +\caption{The original plot produced in R, with a large margin.\label{fig:pdf-nocrop}} +\end{figure} + +\begin{figure} +\begin{kframe} +<>= +@ +\end{kframe} + +\caption{The cropped plot; it fits better in the document.\label{fig:pdf-crop}} +\end{figure} + +As we can see, the white margins are gone. If we use \emph{par()}, +it might be hard and tedious to figure out a reasonable amount of +margin in order that neither is any label cropped nor do we get a +too large margin. My experience is that \texttt{pdfcrop} works well +with base graphics, but barely works with \textbf{grid} graphics (therefore +\textbf{lattice} and \textbf{ggplot2} are ruled out). + +\subsection{Manually Saved Plots} + +We have explained how R plots are recorded before. In some cases, +it is not possible to capture plots by \emph{recordPlot()} (such as +\textbf{rgl} plots), but we can save them using other functions. To +insert these plots into the output, we need to set up a hook first +like this (see \texttt{?hook\_plot\_custom} for details): + +<>= +knit_hooks$set(custom.plot = hook_plot_custom) +@ + +Then we set the chunk option \texttt{custom.plot=TRUE}, and manually +write plot files in the chunk. Here we show an example of capturing +GGobi plots using the function \emph{ggobi\_display\_save\_picture()} +in the \textbf{rggobi} package: + +<>= +library(rggobi) +ggobi(ggobi_find_file('data', 'flea.csv')) +Sys.sleep(1) # wait for snapshot +ggobi_display_save_picture(path=fig_path('.png')) +@ + +One thing to note here is we have to make sure the plot filename is +from \emph{fig\_path()}, which is a convenience function to return +the figure path for the current chunk. + +We can do whatever normal R plots can do with this hook, and we give +another example below to show how to work with animations. + +<>= +library(animation) # adapted from demo('rgl_animation') +data(pollen) +uM = matrix(c(-0.37, -0.51, -0.77, 0, -0.73, 0.67, -0.1, 0, 0.57, 0.53, -0.63, 0, 0, 0, 0, 1), 4, 4) +library(rgl) +open3d(userMatrix = uM, windowRect = c(0, 0, 400, 400)) +plot3d(pollen[, 1:3]) +zm = seq(1, 0.05, length = 20) +par3d(zoom = 1) # change the zoom factor gradually later +for (i in 1:length(zm)) { + par3d(zoom = zm[i]); Sys.sleep(.05) + rgl.snapshot(fig_path('png', number = i)) +} +@ + +\subsection{rgl Plots} + +With the hook \emph{hook\_rgl()}, we can easily save snapshots from +the \textbf{rgl} package. We have shown an example in the main manual, +and here we add some details. The rgl hook is a good example of taking +care of details by carefully using the \texttt{options} argument in +the hook; for example, we cannot directly set the width and height +of rgl plots in \emph{rgl.snapshot()} or \emph{rgl.postscript()}, +so we make use of the options \texttt{fig.width}, \texttt{fig.height} +and \texttt{dpi} to calculate the expected size of the window, then +resize the current window by \emph{par3d()}, and finally save the +plot. + +This hook is actually built upon \emph{hook\_plot\_custom()} \textendash{} +first it saves the \textbf{rgl} snapshot, then it calls \emph{hook\_plot\_custom()} +to write the output code. + +\appendix + +\section{How to Compile This Manual} + +This manual has a long chain of dependencies, so it may not be easy +to compile. These packages are required (all of them are free software): +\begin{description} +\item [{R}] Cairo, ggplot2, tikzDevice, rgl, rggobi, animation (all available +on CRAN except tikzDevice which is on R-Forge for the time being) +\item [{\LaTeX{}}] animate, hyperref and the tufte-handout class +\item [{Other}] GGobi, pdfcrop +\end{description} + +\end{document} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-graphics.lyx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-graphics.lyx new file mode 100644 index 00000000..bc8b9039 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-graphics.lyx @@ -0,0 +1,1997 @@ +#LyX 2.1 created this file. For more info see http://www.lyx.org/ +\lyxformat 474 +\begin_document +\begin_header +\textclass tufte-handout +\begin_preamble +\renewcommand{\textfraction}{0.05} +\renewcommand{\topfraction}{0.8} +\renewcommand{\bottomfraction}{0.8} +\renewcommand{\floatpagefraction}{0.75} + +\usepackage[buttonsize=1em]{animate} +\end_preamble +\options justified +\use_default_options true +\begin_modules +knitr +\end_modules +\maintain_unincluded_children false +\language english +\language_package none +\inputencoding default +\fontencoding global +\font_roman default +\font_sans default +\font_typewriter default +\font_math auto +\font_default_family default +\use_non_tex_fonts false +\font_sc false +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 +\graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\paperfontsize default +\spacing single +\use_hyperref true +\pdf_bookmarks true +\pdf_bookmarksnumbered true +\pdf_bookmarksopen true +\pdf_bookmarksopenlevel 2 +\pdf_breaklinks true +\pdf_pdfborder false +\pdf_colorlinks false +\pdf_backref false +\pdf_pdfusetitle true +\pdf_quoted_options "pdfstartview=FitH" +\papersize default +\use_geometry true +\use_package amsmath 1 +\use_package amssymb 1 +\use_package cancel 1 +\use_package esint 1 +\use_package mathdots 1 +\use_package mathtools 1 +\use_package mhchem 1 +\use_package stackrel 1 +\use_package stmaryrd 1 +\use_package undertilde 1 +\cite_engine basic +\cite_engine_type default +\biblio_style plain +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\justification true +\use_refstyle 1 +\index Index +\shortcut idx +\color #008000 +\end_index +\secnumdepth 2 +\tocdepth 2 +\paragraph_separation indent +\paragraph_indentation default +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\end_header + +\begin_body + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +library(knitr) +\end_layout + +\begin_layout Plain Layout + +options(formatR.arrow=TRUE,width=50) +\end_layout + +\begin_layout Plain Layout + +opts_chunk$set(fig.path='figure/graphics-', cache.path='cache/graphics-', + fig.align='center', dev='tikz', fig.width=5, fig.height=5, fig.show='hold', + cache=TRUE, par=TRUE) +\end_layout + +\begin_layout Plain Layout + +knit_hooks$set(par=function(before, options, envir){ +\end_layout + +\begin_layout Plain Layout + +if (before && options$fig.show!='none') par(mar=c(4,4,.1,.1),cex.lab=.95,cex.axis=.9,mg +p=c(2,.7,0),tcl=-.3) +\end_layout + +\begin_layout Plain Layout + +}, crop=hook_pdfcrop) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Title +knitr Graphics Manual +\end_layout + +\begin_layout Author +Yihui Xie +\end_layout + +\begin_layout Abstract +This manual shows features of graphics in the +\series bold +knitr +\series default + package (version +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + + +\backslash +Sexpr{packageVersion('knitr')} +\end_layout + +\end_inset + +) in detail, including the graphical devices, plot recording, plot rearrangement +, control of plot sizes, the tikz device, figure captions, animations and + other types of plots such as +\series bold +rgl +\series default + or GGobi plots. +\end_layout + +\begin_layout Standard +Before reading this specific manual +\begin_inset Foot +status open + +\begin_layout Plain Layout +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +http://bit.ly/knitr-graphics-src +\end_layout + +\end_inset + + (Rnw source) +\end_layout + +\end_inset + +, you must have finished the main manual +\begin_inset Foot +status open + +\begin_layout Plain Layout +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +http://bit.ly/knitr-main +\end_layout + +\end_inset + + +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Section +Graphical Devices +\end_layout + +\begin_layout Standard +The +\series bold +knitr +\series default + package comes with more than 20 built-in graphical devices, and you can + specify them through the +\family typewriter +dev +\family default + option. + This document uses the global option +\family typewriter +dev='tikz' +\family default +, i.e., the plots are recorded by the tikz device by default, but we can change + the device locally. + Since tikz will be used extensively throughout this manual and you will + see plenty of tikz graphics later, now we first show a few other devices. +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +with(trees, symbols(Height, Volume, circles = Girth/16, inches = FALSE, + bg = 'deeppink', fg = 'gray30')) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Float marginfigure +wide false +sideways false +status open + +\begin_layout Plain Layout +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Plain Layout +\begin_inset Caption Standard + +\begin_layout Plain Layout +The default PDF device. +\begin_inset CommandInset label +LatexCommand label +name "mar:pdf-dev" + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Float marginfigure +wide false +sideways false +status open + +\begin_layout Plain Layout +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Plain Layout +\begin_inset Caption Standard + +\begin_layout Plain Layout +The PNG device. +\begin_inset CommandInset label +LatexCommand label +name "mar:png-dev" + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Figure +\begin_inset CommandInset ref +LatexCommand ref +reference "mar:pdf-dev" + +\end_inset + + and +\begin_inset CommandInset ref +LatexCommand ref +reference "mar:png-dev" + +\end_inset + + show two standard devices in the +\series bold +grDevices +\series default + package. + We can also use devices in the +\series bold +Cairo +\series default + or +\series bold +cairoDevice +\series default + package, e.g., the chunk below uses the +\emph on +CairoPNG() +\emph default + device in the +\series bold +Cairo +\series default + package. +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Section +Plot Recording +\end_layout + +\begin_layout Standard +As mentioned in the main manual, +\series bold +knitr +\series default + uses the +\series bold +evaluate +\series default + package to record plots. + There are two sources of plots: first, whenever +\emph on +plot.new() +\emph default + or +\emph on +grid.newpage() +\emph default + is called, +\series bold +evaluate +\series default + will try to save a snapshot of the current plot +\begin_inset Foot +status open + +\begin_layout Plain Layout +For technical details, see +\family typewriter +?setHook +\family default + and +\family typewriter +?recordPlot +\end_layout + +\end_inset + +; second, after each complete expression is evaluated, a snapshot is also + saved. + To speed up recording, the null graphical device +\family typewriter +pdf(file = NULL) +\family default + is used. + Figure +\begin_inset CommandInset ref +LatexCommand ref +reference "fig:two-high" + +\end_inset + + shows two expressions producing two high-level plots. +\end_layout + +\begin_layout Standard +\begin_inset Float figure +wide false +sideways false +status open + +\begin_layout Plain Layout +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +plot(cars) +\end_layout + +\begin_layout Plain Layout + +boxplot(cars$dist,xlab='dist') +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Plain Layout +\begin_inset Caption Standard + +\begin_layout Plain Layout +Two high-level plots are captured. + The key to arrange two plots side by side is to specify the +\family typewriter +out.width +\family default + option so that each plot takes less than half of the line width. + We do not have to use the +\family typewriter +par(mfrow) +\family default + trick, and it may not work in some cases (e.g. + to put base graphics and +\series bold +ggplot2 +\series default + side by side; recall Figure 1 in the main manual). +\begin_inset CommandInset label +LatexCommand label +name "fig:two-high" + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Figure +\begin_inset CommandInset ref +LatexCommand ref +reference "fig:low-plot-loop" + +\end_inset + + shows another example of two R expressions, but the second expression only + involves with low-level plotting changes. + By default, low-level plot changes are discarded, but you can retain them + with the option +\family typewriter +fig.keep='all' +\family default +. +\end_layout + +\begin_layout Standard +\begin_inset Float figure +wide false +sideways false +status open + +\begin_layout Plain Layout +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +plot(0,0,type='n',ann=FALSE) +\end_layout + +\begin_layout Plain Layout + +for(i in seq(0, 2*pi,length=20)) {points(cos(i),sin(i))} +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Plain Layout +\begin_inset Caption Standard + +\begin_layout Plain Layout +Two complete R expressions will produce at most two plots, as long as there + are not multiple high-level plotting calls in each expression; option +\family typewriter +fig.keep='all' +\family default + here. +\begin_inset CommandInset label +LatexCommand label +name "fig:low-plot-loop" + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Together with +\family typewriter +fig.show='asis' +\family default +, we can show the process of plotting step by step like Figure +\begin_inset CommandInset ref +LatexCommand ref +reference "fig:high-with-low" + +\end_inset + +. +\end_layout + +\begin_layout Standard +\begin_inset Float figure +wide false +sideways false +status open + +\begin_layout Plain Layout +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +plot(cars) +\end_layout + +\begin_layout Plain Layout + +abline(lm(dist~speed, data=cars)) # a regression line +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Plain Layout +\begin_inset Caption Standard + +\begin_layout Plain Layout +Low-level plot changes in base graphics can be recorded separately, and + plots can be put in the places where they were produced. +\begin_inset CommandInset label +LatexCommand label +name "fig:high-with-low" + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +A further note on plot recording: +\series bold +knitr +\series default + examines all recorded plots (as R objects) and compares them sequentially; + if the previous plot is a +\begin_inset Quotes eld +\end_inset + +subset +\begin_inset Quotes erd +\end_inset + + of the next plot (= previous plot + low-level changes), the previous plot + will be removed when +\family typewriter +fig.keep='high' +\family default +. + If two successive plots are identical, the second one will be removed by + default, so it might be a little bit surprising that the following chunk + will only produce one plot by default +\begin_inset Foot +status open + +\begin_layout Plain Layout +adapted from +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://github.com/yihui/knitr/issues/41 +\end_layout + +\end_inset + + +\end_layout + +\end_inset + +: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +m = matrix(1:100, ncol = 10) +\end_layout + +\begin_layout Plain Layout + +image(m) +\end_layout + +\begin_layout Plain Layout + +image(m*2) # exactly the same as previous plot +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Section +Plot Rearrangement +\end_layout + +\begin_layout Standard +We can rearrange the plots in chunks in several ways. + They can be inserted right after the line(s) of R code which produced them, + or accumulated till the end of the chunk. + There is an example in the main manual demonstrating +\family typewriter +fig.show='asis' +\family default + for two high-level plots, and Figure +\begin_inset CommandInset ref +LatexCommand ref +reference "fig:high-with-low" + +\end_inset + + in this manual also demonstrates this option for a high-level plot followed + by a low-level change. +\end_layout + +\begin_layout Standard +Here is an example demonstrating the option +\family typewriter +fig.keep='last' +\family default + (only the last plot is kept): +\end_layout + +\begin_layout Standard +\begin_inset Float figure +wide false +sideways false +status open + +\begin_layout Plain Layout +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +library(ggplot2) +\end_layout + +\begin_layout Plain Layout + +pie <- ggplot(diamonds, aes(x = factor(1), fill = cut)) + xlab('cut') + + geom_bar(width = 1) +\end_layout + +\begin_layout Plain Layout + +pie + coord_polar(theta = "y") # a pie chart +\end_layout + +\begin_layout Plain Layout + +pie + coord_polar() # the bullseye chart +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Plain Layout +\begin_inset Caption Standard + +\begin_layout Plain Layout +Two plots were produced in this chunk, but only the last one is kept. + This can be useful when we experiment with many plots, but only want the + last result. + (Adapted from the +\series bold +ggplot2 +\series default + website) +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +When multiple plots are produced by a code chunk, we may want to show them + as an animation with the option +\family typewriter +fig.show='animate' +\family default +. + Figure +\begin_inset CommandInset ref +LatexCommand ref +reference "fig:clock-animation" + +\end_inset + + shows a simple clock animation; you may compare the code to Figure +\begin_inset CommandInset ref +LatexCommand ref +reference "fig:high-with-low" + +\end_inset + + to understand that high-level plots are always recorded, regardless of + where they appeared. +\end_layout + +\begin_layout Standard +\begin_inset Float figure +wide false +sideways false +status open + +\begin_layout Plain Layout +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +par(mar = rep(3, 4)) +\end_layout + +\begin_layout Plain Layout + +for (i in seq(pi/2, -4/3 * pi, length = 12)) { +\end_layout + +\begin_layout Plain Layout + + plot(0, 0, pch = 20, ann = FALSE, axes = FALSE) +\end_layout + +\begin_layout Plain Layout + + arrows(0, 0, cos(i), sin(i)) +\end_layout + +\begin_layout Plain Layout + + axis(1, 0, "VI"); axis(2, 0, "IX") +\end_layout + +\begin_layout Plain Layout + + axis(3, 0, "XII"); axis(4, 0, "III"); box() +\end_layout + +\begin_layout Plain Layout + +} +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Plain Layout +\begin_inset Caption Standard + +\begin_layout Plain Layout +A clock animation. + You have to view it in Adobe Reader: click to play/pause; there are also + buttons to speed up or slow down the animation. +\begin_inset CommandInset label +LatexCommand label +name "fig:clock-animation" + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +We can also set the alignment of plots easily with the +\family typewriter +fig.align +\family default + option; this document uses +\family typewriter +fig.align='center' +\family default + as a global option, and we can also set plots to be left/right-aligned. + Figure +\begin_inset CommandInset ref +LatexCommand ref +reference "fig:maruko-plot" + +\end_inset + + is an example of a left-aligned plot. +\end_layout + +\begin_layout Standard +\begin_inset Float figure +wide false +sideways false +status open + +\begin_layout Plain Layout +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +stars(cbind(1:16,10*(16:1)),draw.segments=TRUE) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Plain Layout +\begin_inset Caption Standard + +\begin_layout Plain Layout +A left-aligned plot adapted from +\family typewriter +?stars +\family default + (I call this the +\begin_inset Quotes eld +\end_inset + +Maruko +\begin_inset Quotes erd +\end_inset + + plot, and it is one of my favorites; see +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +http://en.wikipedia.org/wiki/Chibi_Maruko-chan +\end_layout + +\end_inset + +). +\begin_inset CommandInset label +LatexCommand label +name "fig:maruko-plot" + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Section +Plot Size +\end_layout + +\begin_layout Standard +We have seen several examples in which two or more plots can be put side + by side, and this is because the plots were resized in the output document; + with the chunk option +\family typewriter +out.width +\family default + less than half of the line width, LaTeX will arrange two plots in one line; + if it is less than +\begin_inset Formula $1/3$ +\end_inset + + of the line width, three plots can be put in one line. + Of course we can also set it to be an absolute width like +\family typewriter +3in +\family default + (3 inches). + This option is used extensively in this document to control the size of + plots in the output document. +\end_layout + +\begin_layout Section +The tikz Device +\end_layout + +\begin_layout Standard +The main advantage of using tikz graphics is the consistency of styles between + texts in plots and those in the main document. + Since we can use native LaTeX commands in plots, the styles of texts in + plots can be very sophisticated (see Figure +\begin_inset CommandInset ref +LatexCommand ref +reference "fig:math-formula-tt" + +\end_inset + + for an example). +\end_layout + +\begin_layout Standard +\begin_inset Float figure +wide false +sideways false +status open + +\begin_layout Plain Layout +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +plot(0:1,0:1,type='n', ylab='origin of statistics', xlab='statistical presentati +on rocks with +\backslash + +\backslash +LaTeX{}') +\end_layout + +\begin_layout Plain Layout + +text(.5,c(.8,.5,.2), c(' +\backslash + +\backslash +texttt{lm(y +\backslash + +\backslash +textasciitilde{} x)}', '$ +\backslash + +\backslash +hat{ +\backslash + +\backslash +beta}=(X^{ +\backslash + +\backslash +prime}X)^{-1}X^{ +\backslash + +\backslash +prime}y$', '$( +\backslash + +\backslash +Omega, +\backslash + +\backslash +mathcal{F}, +\backslash + +\backslash +mu)$')) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Plain Layout +\begin_inset Caption Standard + +\begin_layout Plain Layout +A plot created by +\series bold +tikzDevice +\series default + with math expressions and typewriter fonts. + Note the font style consistency -- we write the same expressions in LaTeX + here: +\begin_inset Formula $\hat{\beta}=(X^{\prime}X)^{-1}X^{\prime}y$ +\end_inset + + and +\begin_inset Formula $(\Omega,\mathcal{F},\mu)$ +\end_inset + +; also +\family typewriter +lm(y ~ x) +\family default +. +\begin_inset CommandInset label +LatexCommand label +name "fig:math-formula-tt" + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +When using XeLaTeX instead of PDFLaTeX to compile the document, we need + to tell the +\series bold +tikzDevice +\series default + package by setting the +\family typewriter +tikzDefaultEngine +\family default + option before all plot chunks (preferably in the first chunk): +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +options(tikzDefaultEngine='xetex') +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +This is useful and often necessary to compile tikz plots which contain (UTF8) + multi-byte characters. +\end_layout + +\begin_layout Section +Figure Caption +\end_layout + +\begin_layout Standard +If the chunk option +\family typewriter +fig.cap +\family default + is not +\family typewriter +NULL +\family default + or +\family typewriter +NA +\family default +, the plots will be put in a +\family typewriter +figure +\family default + environment when the output format is LaTeX, and this option is used to + write a caption in this environment using +\family typewriter + +\backslash +caption{} +\family default +. + The other two related options are +\family typewriter +fig.scap +\family default + and +\family typewriter +fig.lp +\family default + which set the short caption and a prefix string for the figure label. + The default short caption is extracted from the caption by truncating it + at the first period or colon or semi-colon. + The label is a combination of +\family typewriter +fig.lp +\family default + and the chunk label. + Because +\family typewriter +figure +\family default + is a float environment, it can float away from the chunk output to other + places such as the top or bottom of a page when the TeX document is compiled. +\end_layout + +\begin_layout Section +Other Features +\end_layout + +\begin_layout Standard +The +\series bold +knitr +\series default + package can be extended with hook functions, and here I give a few examples + illustrating the flexibility. +\end_layout + +\begin_layout Subsection +Cropping PDF Graphics +\end_layout + +\begin_layout Standard +Some R users may have been suffering from the extra margins in R plots, + especially in base graphics ( +\series bold +ggplot2 +\series default + is much better in this aspect). + The default graphical option +\family typewriter +mar +\family default + is about +\family typewriter +c(5, 4, 4, 2) +\family default + (see +\family typewriter +?par +\family default +), which is often too big. + Instead of endlessly setting +\family typewriter +par(mar) +\family default +, you may consider the program +\family typewriter +pdfcrop +\family default +, which can crop the white margin automatically +\begin_inset Foot +status open + +\begin_layout Plain Layout +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +http://www.ctan.org/pkg/pdfcrop +\end_layout + +\end_inset + + +\end_layout + +\end_inset + +. + In +\series bold +knitr +\series default +, we can set up the hook +\emph on +hook_pdfcrop() +\emph default + to work with a chunk option, say, +\family typewriter +crop +\family default +. +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +knit_hooks$set(crop=hook_pdfcrop) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Now we compare two plots below. + The first one is not cropped (Figure +\begin_inset CommandInset ref +LatexCommand ref +reference "fig:pdf-nocrop" + +\end_inset + +); then the same plot is produced but with a chunk option +\family typewriter +crop=TRUE +\family default + which will call the cropping hook (Figure +\begin_inset CommandInset ref +LatexCommand ref +reference "fig:pdf-crop" + +\end_inset + +). +\end_layout + +\begin_layout Standard +\begin_inset Float figure +wide false +sideways false +status open + +\begin_layout Plain Layout +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +begin{kframe} +\end_layout + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +par(mar=c(5,4,4,2),bg='white') # large margin +\end_layout + +\begin_layout Plain Layout + +plot(lat~long,data=quakes,pch=20,col=rgb(0,0,0,.2)) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\begin_layout Plain Layout + + +\backslash +end{kframe} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Plain Layout +\begin_inset Caption Standard + +\begin_layout Plain Layout +The original plot produced in R, with a large margin. +\begin_inset CommandInset label +LatexCommand label +name "fig:pdf-nocrop" + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Float figure +wide false +sideways false +status open + +\begin_layout Plain Layout +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +begin{kframe} +\end_layout + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\begin_layout Plain Layout + + +\backslash +end{kframe} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Plain Layout +\begin_inset Caption Standard + +\begin_layout Plain Layout +The cropped plot; it fits better in the document. +\begin_inset CommandInset label +LatexCommand label +name "fig:pdf-crop" + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +As we can see, the white margins are gone. + If we use +\emph on +par() +\emph default +, it might be hard and tedious to figure out a reasonable amount of margin + in order that neither is any label cropped nor do we get a too large margin. + My experience is that +\family typewriter +pdfcrop +\family default + works well with base graphics, but barely works with +\series bold +grid +\series default + graphics (therefore +\series bold +lattice +\series default + and +\series bold +ggplot2 +\series default + are ruled out). +\end_layout + +\begin_layout Subsection +Manually Saved Plots +\end_layout + +\begin_layout Standard +We have explained how R plots are recorded before. + In some cases, it is not possible to capture plots by +\emph on +recordPlot() +\emph default + (such as +\series bold +rgl +\series default + plots), but we can save them using other functions. + To insert these plots into the output, we need to set up a hook first like + this (see +\family typewriter +?hook_plot_custom +\family default + for details): +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +knit_hooks$set(custom.plot = hook_plot_custom) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Then we set the chunk option +\family typewriter +custom.plot=TRUE +\family default +, and manually write plot files in the chunk. + Here we show an example of capturing GGobi plots using the function +\emph on +ggobi_display_save_picture() +\emph default + in the +\series bold +rggobi +\series default + package: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +library(rggobi) +\end_layout + +\begin_layout Plain Layout + +ggobi(ggobi_find_file('data', 'flea.csv')) +\end_layout + +\begin_layout Plain Layout + +Sys.sleep(1) # wait for snapshot +\end_layout + +\begin_layout Plain Layout + +ggobi_display_save_picture(path=fig_path('.png')) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +One thing to note here is we have to make sure the plot filename is from + +\emph on +fig_path() +\emph default +, which is a convenience function to return the figure path for the current + chunk. +\end_layout + +\begin_layout Standard +We can do whatever normal R plots can do with this hook, and we give another + example below to show how to work with animations. +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +library(animation) # adapted from demo('rgl_animation') +\end_layout + +\begin_layout Plain Layout + +data(pollen) +\end_layout + +\begin_layout Plain Layout + +uM = matrix(c(-0.37, -0.51, -0.77, 0, -0.73, 0.67, -0.1, 0, 0.57, 0.53, -0.63, 0, + 0, 0, 0, 1), 4, 4) +\end_layout + +\begin_layout Plain Layout + +library(rgl) +\end_layout + +\begin_layout Plain Layout + +open3d(userMatrix = uM, windowRect = c(0, 0, 400, 400)) +\end_layout + +\begin_layout Plain Layout + +plot3d(pollen[, 1:3]) +\end_layout + +\begin_layout Plain Layout + +zm = seq(1, 0.05, length = 20) +\end_layout + +\begin_layout Plain Layout + +par3d(zoom = 1) # change the zoom factor gradually later +\end_layout + +\begin_layout Plain Layout + +for (i in 1:length(zm)) { +\end_layout + +\begin_layout Plain Layout + + par3d(zoom = zm[i]); Sys.sleep(.05) +\end_layout + +\begin_layout Plain Layout + + rgl.snapshot(fig_path('png', number = i)) +\end_layout + +\begin_layout Plain Layout + +} +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Subsection +rgl Plots +\end_layout + +\begin_layout Standard +With the hook +\emph on +hook_rgl() +\emph default +, we can easily save snapshots from the +\series bold +rgl +\series default + package. + We have shown an example in the main manual, and here we add some details. + The rgl hook is a good example of taking care of details by carefully using + the +\family typewriter +options +\family default + argument in the hook; for example, we cannot directly set the width and + height of rgl plots in +\emph on +rgl.snapshot() +\emph default + or +\emph on +rgl.postscript() +\emph default +, so we make use of the options +\family typewriter +fig.width +\family default +, +\family typewriter +fig.height +\family default + and +\family typewriter +dpi +\family default + to calculate the expected size of the window, then resize the current window + by +\emph on +par3d() +\emph default +, and finally save the plot. +\end_layout + +\begin_layout Standard +This hook is actually built upon +\emph on +hook_plot_custom() +\emph default + -- first it saves the +\series bold +rgl +\series default + snapshot, then it calls +\emph on +hook_plot_custom() +\emph default + to write the output code. +\end_layout + +\begin_layout Section +\start_of_appendix +How to Compile This Manual +\end_layout + +\begin_layout Standard +This manual has a long chain of dependencies, so it may not be easy to compile. + These packages are required (all of them are free software): +\end_layout + +\begin_layout Description +R Cairo, ggplot2, tikzDevice, rgl, rggobi, animation (all available on CRAN + except tikzDevice which is on R-Forge for the time being) +\end_layout + +\begin_layout Description +LaTeX animate, hyperref and the tufte-handout class +\end_layout + +\begin_layout Description +Other GGobi, pdfcrop +\end_layout + +\end_body +\end_document diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-input-child.Rnw b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-input-child.Rnw new file mode 100644 index 00000000..b5f078d6 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-input-child.Rnw @@ -0,0 +1,9 @@ +This chunk below is from the child document. + +<>= +1+1 +rnorm(5) +plot(1) +boxplot(1:10) +str(mtcars) +@ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-input.Rnw b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-input.Rnw new file mode 100644 index 00000000..60dee287 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-input.Rnw @@ -0,0 +1,19 @@ +\documentclass{article} + +\begin{document} + +<>= +options(width = 60) +summary(iris) +@ + +Let's see how to work with child documents in knitr. Below we input +the file \textsf{knitr-input-child.Rnw}: + +<>= +@ +% Or alternatively, use knit_child('knitr-input-child.Rnw') in \Sexpr + +Done! + +\end{document} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-latex.Rtex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-latex.Rtex new file mode 100644 index 00000000..b167d9fd --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-latex.Rtex @@ -0,0 +1 @@ +See https://github.com/yihui/knitr-examples/blob/master/005-latex.Rtex diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-listings.Rnw b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-listings.Rnw new file mode 100644 index 00000000..0edd8b00 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-listings.Rnw @@ -0,0 +1,106 @@ +%% LyX 2.2.1 created this file. For more info, see http://www.lyx.org/. +%% Do not edit unless you really know what you are doing. +\documentclass{article} +\usepackage[sc]{mathpazo} +\usepackage[T1]{fontenc} +\usepackage{geometry} +\geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=2.5cm,rmargin=2.5cm} +\usepackage{url} +\usepackage[unicode=true,pdfusetitle, + bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=2, + breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=false] + {hyperref} +\hypersetup{ + pdfstartview={XYZ null null 1}} +\usepackage{breakurl} +\usepackage{listings} +\lstset{language=R} +\begin{document} +<>= +library(knitr) +opts_chunk$set(fig.path = 'figure/listings-') +options(formatR.arrow = TRUE) +render_listings() +@ + +\title{Using listings with knitr} + +\author{Yihui Xie} + +\maketitle +To use the \textbf{listings} package with \textbf{knitr}, all you +need to do is to call a function in your first setup chunk (that chunk +should be hidden from the output with \texttt{include=FALSE} and should +not be cached): + +% I just want to echo the 2nd line +<>= +@ + +This function modifies the output hooks and header information so +that the output is written in \textbf{listings} environments, which +are kindly provided by Frank Harrell and can be found in \url{https://github.com/yihui/knitr/blob/master/inst/misc/Sweavel.sty}. +Of course you have to install the \textbf{listings} package if your +\LaTeX{} toolset does not include this package. + +Now we can see how the results look like with our new settings: + +<>= +set.seed(1121) # for reproducibility +options(width=85) +x=rnorm(20) +x +mean(x) +sqrt(-1) # this will give you a warning message +@ + +Another chunk: + +<>= +hook_rgl = function(before, options, envir) { + ## after a chunk has been evaluated + if (before || !require('rgl') || rgl.cur() == 0) return() # no active device + name = paste(valid_prefix(options$fig.path), options$label, sep = '') + par3d(windowRect = 100 + options$dpi * c(0, 0, options$width, options$height)) + Sys.sleep(.05) # need time to respond to window size change + + fmt = opts_knit$get('out.format') + if (fmt %in% c('html', 'markdown', 'gfm', 'jekyll')) options$dev = 'png' + + ## support 3 formats: eps, pdf and png (default) + switch(options$dev, + postscript = rgl.postscript(paste(name, '.eps', sep = ''), fmt = 'eps'), + pdf = rgl.postscript(paste(name, '.pdf', sep = ''), fmt = 'pdf'), + rgl.snapshot(paste(name, '.png', sep = ''), fmt = 'png')) + + if (fmt == 'html') return(.plot.hook.html(c(name, 'png'), options)) + if (fmt %in% c('markdown', 'gfm', 'jekyll')) + return(.plot.hook.markdown(c(name, 'png'), options)) + + paste(ifelse(options$align == 'center', '\\centering{}', ''), '\\includegraphics[', + sprintf('width=%s', options$out.width), ']{', name, '}\n', sep = '') +} +@ + +Well, we can do crazier things with \textbf{knitr}. Here we use the +\texttt{fig.cap} option to write plots into the \texttt{figure} environment +automatically, and the caption is generated from data dynamically +(see Figure \ref{fig:boxplot-ex}): + +% set an option first +<>= +opts_knit$set(eval.after = 'fig.cap') # evaluate fig.cap after the chunk + +<>= +par(mar=c(4,4,.1,.1)) +boxplot(x, horizontal=TRUE) +@ + +As we know, \texttt{figure} is a float environment, so it has floated +away from the R code to the top of this page. This should not be surprising +to \LaTeX{} users. + +You should be able to compile the \TeX{} document and get a PDF file +like this one: \url{https://github.com/yihui/knitr/releases/download/doc/knitr-listings.pdf}. +For more information about out hooks, see \url{https://yihui.org/knitr/hooks/}. +\end{document} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-listings.lyx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-listings.lyx new file mode 100644 index 00000000..6246882b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-listings.lyx @@ -0,0 +1,517 @@ +#LyX 2.0 created this file. For more info see http://www.lyx.org/ +\lyxformat 413 +\begin_document +\begin_header +\textclass article +\use_default_options true +\begin_modules +knitr +\end_modules +\maintain_unincluded_children false +\language english +\language_package none +\inputencoding default +\fontencoding global +\font_roman palatino +\font_sans default +\font_typewriter default +\font_default_family default +\use_non_tex_fonts false +\font_sc true +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 + +\graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\paperfontsize default +\spacing single +\use_hyperref true +\pdf_bookmarks true +\pdf_bookmarksnumbered true +\pdf_bookmarksopen true +\pdf_bookmarksopenlevel 2 +\pdf_breaklinks false +\pdf_pdfborder false +\pdf_colorlinks false +\pdf_backref false +\pdf_pdfusetitle true +\pdf_quoted_options "pdfstartview={XYZ null null 1}" +\papersize default +\use_geometry true +\use_amsmath 1 +\use_esint 1 +\use_mhchem 1 +\use_mathdots 1 +\cite_engine basic +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\use_refstyle 1 +\index Index +\shortcut idx +\color #008000 +\end_index +\leftmargin 2.5cm +\topmargin 2.5cm +\rightmargin 2.5cm +\bottommargin 2.5cm +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\paragraph_indentation default +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\listings_params "language=R" +\tracking_changes false +\output_changes false +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\end_header + +\begin_body + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +library(knitr) +\end_layout + +\begin_layout Plain Layout + +opts_chunk$set(fig.path = 'figure/listings-') +\end_layout + +\begin_layout Plain Layout + +options(formatR.arrow = TRUE) +\end_layout + +\begin_layout Plain Layout + +render_listings() +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Title +Using listings with knitr +\end_layout + +\begin_layout Author +Yihui Xie +\end_layout + +\begin_layout Standard +To use the +\series bold +listings +\series default + package with +\series bold +knitr +\series default +, all you need to do is to call a function in your first setup chunk (that + chunk should be hidden from the output with +\family typewriter +include=FALSE +\family default + and should not be cached): +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +% I just want to echo the 2nd line +\end_layout + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +This function modifies the output hooks and header information so that the + output is written in +\series bold +listings +\series default + environments, which are kindly provided by Frank Harrell and can be found + in +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://github.com/yihui/knitr/blob/master/inst/misc/Sweavel.sty +\end_layout + +\end_inset + +. + Of course you have to install the +\series bold +listings +\series default + package if your LaTeX toolset does not include this package. +\end_layout + +\begin_layout Standard +Now we can see how the results look like with our new settings: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +set.seed(1121) # for reproducibility +\end_layout + +\begin_layout Plain Layout + +options(width=85) +\end_layout + +\begin_layout Plain Layout + +x=rnorm(20) +\end_layout + +\begin_layout Plain Layout + +x +\end_layout + +\begin_layout Plain Layout + +mean(x) +\end_layout + +\begin_layout Plain Layout + +sqrt(-1) # this will give you a warning message +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Another chunk: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +hook_rgl = function(before, options, envir) { +\end_layout + +\begin_layout Plain Layout + + ## after a chunk has been evaluated +\end_layout + +\begin_layout Plain Layout + + if (before || !require('rgl') || rgl.cur() == 0) return() # no active + device +\end_layout + +\begin_layout Plain Layout + + name = paste(valid_prefix(options$fig.path), options$label, sep = '') +\end_layout + +\begin_layout Plain Layout + + par3d(windowRect = 100 + options$dpi * c(0, 0, options$width, options$height +)) +\end_layout + +\begin_layout Plain Layout + + Sys.sleep(.05) # need time to respond to window size change +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + + fmt = opts_knit$get('out.format') +\end_layout + +\begin_layout Plain Layout + + if (fmt %in% c('html', 'markdown', 'gfm', 'jekyll')) options$dev = 'png' +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + + ## support 3 formats: eps, pdf and png (default) +\end_layout + +\begin_layout Plain Layout + + switch(options$dev, +\end_layout + +\begin_layout Plain Layout + + postscript = rgl.postscript(paste(name, '.eps', sep = ''), fmt + = 'eps'), +\end_layout + +\begin_layout Plain Layout + + pdf = rgl.postscript(paste(name, '.pdf', sep = ''), fmt = 'pdf'), +\end_layout + +\begin_layout Plain Layout + + rgl.snapshot(paste(name, '.png', sep = ''), fmt = 'png')) +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + + if (fmt == 'html') return(.plot.hook.html(c(name, 'png'), options)) +\end_layout + +\begin_layout Plain Layout + + if (fmt %in% c('markdown', 'gfm', 'jekyll')) +\end_layout + +\begin_layout Plain Layout + + return(.plot.hook.markdown(c(name, 'png'), options)) +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + + paste(ifelse(options$align == 'center', ' +\backslash + +\backslash +centering{}', ''), ' +\backslash + +\backslash +includegraphics[', +\end_layout + +\begin_layout Plain Layout + + sprintf('width=%s', options$out.width), ']{', name, '} +\backslash +n', sep = '') +\end_layout + +\begin_layout Plain Layout + +} +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Well, we can do crazier things with +\series bold +knitr +\series default +. + Here we use the +\family typewriter +fig.cap +\family default + option to write plots into the +\family typewriter +figure +\family default + environment automatically, and the caption is generated from data dynamically + (see Figure +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + + +\backslash +ref{fig:boxplot-ex} +\end_layout + +\end_inset + +): +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +% set an option first +\end_layout + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +opts_knit$set(eval.after = 'fig.cap') # evaluate fig.cap after the chunk +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +par(mar=c(4,4,.1,.1)) +\end_layout + +\begin_layout Plain Layout + +boxplot(x, horizontal=TRUE) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +As we know, +\family typewriter +figure +\family default + is a float environment, so it has floated away from the R code to the top + of this page. + This should not be surprising to LaTeX users. +\end_layout + +\begin_layout Standard +You should be able to compile the TeX document and get a PDF file like this + one: +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://github.com/yihui/knitr/releases/download/doc/knitr-listings.pdf +\end_layout + +\end_inset + +. + For more information about out hooks, see +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://yihui.org/knitr/hooks/ +\end_layout + +\end_inset + +. +\end_layout + +\end_body +\end_document diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-manual.Rnw b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-manual.Rnw new file mode 100644 index 00000000..b69df88a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-manual.Rnw @@ -0,0 +1,690 @@ +%% LyX 2.2.1 created this file. For more info, see http://www.lyx.org/. +%% Do not edit unless you really know what you are doing. +\documentclass{article} +\usepackage[sc]{mathpazo} +\renewcommand{\sfdefault}{lmss} +\renewcommand{\ttdefault}{lmtt} +\usepackage[T1]{fontenc} +\usepackage{geometry} +\geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=2.5cm,rmargin=2.5cm} +\setcounter{secnumdepth}{2} +\setcounter{tocdepth}{2} +\usepackage{url} +\usepackage[authoryear]{natbib} +\usepackage[unicode=true,pdfusetitle, + bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=2, + breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=false] + {hyperref} +\hypersetup{ + pdfstartview={XYZ null null 1}} +\usepackage{breakurl} + +\makeatletter + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands. +\providecommand{\LyX}{\texorpdfstring% + {L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@} + {LyX}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands. +\renewcommand{\textfraction}{0.05} +\renewcommand{\topfraction}{0.8} +\renewcommand{\bottomfraction}{0.8} +\renewcommand{\floatpagefraction}{0.75} + +\usepackage[buttonsize=1em]{animate} + +\makeatother + +\begin{document} +<>= +library(knitr) +## set global chunk options +opts_chunk$set(fig.path='figure/manual-', cache.path='cache/manual-', fig.align='center', fig.show='hold', par=TRUE) +## I use = but I can replace it with <-; set code/output width to be 68 +options(formatR.arrow=TRUE, width=68, digits=4) +## tune details of base graphics (https://yihui.org/knitr/hooks/) +knit_hooks$set(par=function(before, options, envir){ +if (before && options$fig.show!='none') par(mar=c(4,4,.1,.1),cex.lab=.95,cex.axis=.9,mgp=c(2,.7,0),tcl=-.3) +}) +@ + +\title{knitr: A General-Purpose Tool for Dynamic Report Generation in R} + +\author{Yihui Xie} + +\maketitle +The original paradigm of literate programming was brought forward +mainly for software development, or specifically, to mix source code +(for computer) and documentation (for human) together. Early systems +include \href{http://www.literateprogramming.com/web.pdf}{WEB} and +\href{http://www.cs.tufts.edu/~nr/noweb/}{Noweb}; Sweave \citep{leisch2002} +was derived from the latter, but it is less focused on documenting +software, instead it is mainly used for reproducible data analysis +and generating statistical reports. The \textbf{knitr} package \citep{R-knitr} +is following the steps of Sweave. For this manual, I assume readers +have some background knowledge of Sweave to understand the technical +details; for a reference of available options, hooks and demos, see +the package homepage \url{https://yihui.org/knitr/}. + +\section{Hello World} + +A natural question is why to reinvent the wheel. The short answer +is that extending Sweave by hacking \textsf{SweaveDrivers.R} in the +\textbf{utils} package is a difficult job to me. Many features in +\textbf{knitr} come naturally as users would have expected. Figure +\ref{fig:cars-demo} is a simple demo of some features of \textbf{knitr}. + +\begin{figure} +<>= +fit=lm(dist~speed,data=cars) # linear regression +par(mar=c(4, 4, 1, .1), mgp=c(2,1,0)) +with(cars,plot(speed,dist,panel.last=abline(fit))) +text(10,100,'$Y = \\beta_0 + \\beta_1x + \\epsilon$') +library(ggplot2) +qplot(speed, dist, data=cars)+geom_smooth() +@ + +\caption{\label{fig:cars-demo}A simple demo of possible output in \textbf{knitr}: +(1) multiple plots per chunk; (2) no need to \emph{print()} objects +in \textbf{ggplot2}; (3) device size is $4\times2.8$ (inches) but +output size is adjusted to \texttt{.45\textbackslash{}textwidth} in +chunk options; (4) base graphics and \textbf{ggplot2} can sit side +by side; (5) use the \emph{tikz()} device in \textbf{tikzDevice} by +setting chunk option \texttt{dev='tikz'} (hence can write native \protect\LaTeX{} +expressions in R plots); (6) code highlighting.} +\end{figure} + +I would have chosen to hide the R code if this were a real report, +but here I show the code just for the sake of demonstration. If we +type \emph{qplot()} in R, we get a plot, and the same thing happens +in \textbf{knitr}. If we draw two plots in the code, \textbf{knitr} +will show two plots and we do not need to tell it how many plots are +there in the code in advance. If we set \texttt{out.width='.49\textbackslash{}\textbackslash{}textwidth'} +in chunk options, we get it in the final output document. If we say +\texttt{fig.align='center'}, the plots are centered. That's it. Many +enhancements and new features will be introduced later. If you come +from the Sweave land, you can take a look at the page of transition +first: \url{https://yihui.org/knitr/demo/sweave/}. + +\section{Design} + +The flow of processing an input file is similar to Sweave, and two +major differences are that \textbf{knitr} provides more flexibility +to the users to customize the processing, and has many built-in options +such as the support to a wide range of graphics devices and cache. +Below is a brief description of the process: +\begin{enumerate} +\item \textbf{knitr} takes an input file and automatically determines an +appropriate set of \href{https://yihui.org/knitr/patterns/}{patterns} +to use if they are not provided in advance (e.g. \textsf{file.Rnw} +will use \texttt{knit\_patterns\$get('rnw')}); +\item a set of output \href{https://yihui.org/knitr/hooks/}{hooks} will +also be set up automatically according to the filename extension (e.g. +use \LaTeX{} environments or HTML elements to wrap up R results); +\item the input file is read in and split into pieces consisting of R code +chunks and normal texts; the former will be executed one after the +other, and the latter may contain global chunk options or inline R +code; +\item for each chunk, the code is evaluated using the \textbf{evaluate} +package \citep{R-evaluate}, and the results may be filtered according +to chunk options (e.g. \texttt{echo=FALSE} will remove the R source +code) + +\begin{enumerate} +\item if \texttt{cache=TRUE} for this chunk, \textbf{knitr} will first check +if there are previously cached results under the cache directory before +really evaluating the chunk; if cached results exist and this code +chunk has not been changed since last run (use MD5 sum to verify), +the cached results will be (lazy-) loaded, otherwise new cache will +be built; if a cached chunk depends on other chunks (see the \texttt{dependson} +\href{https://yihui.org/knitr/options/}{option}) and any one of these +chunks has changed, this chunk must be forcibly updated (old cache +will be purged) +\item there are six types of possible output from \textbf{evaluate}, and +their classes are \texttt{character} (normal text output), \texttt{source} +(source code), \texttt{warning}, \texttt{message}, \texttt{error} +and \texttt{recordedplot}; an internal S3 generic function \emph{wrap()} +is used to deal with different types of output, using output hooks +defined in the object \texttt{knit\_hooks} +\item note plots are recorded as R objects before they are really saved +to files, so graphics devices will not be opened unless plots have +really been produced in a chunk +\item a code chunk is evaluated in a separate empty environment with the +global environment as its parent, and all the objects in this environment +after the evaluation will be saved if \texttt{cache=TRUE} +\item chunk hooks can be run before and/or after a chunk +\end{enumerate} +\item for normal texts, \textbf{knitr} will find inline R code (e.g. in +\texttt{\textbackslash{}Sexpr\{\}}) and evaluate it; the output is +wrapped by the \texttt{inline} hook; +\end{enumerate} +The hooks play important roles in \textbf{knitr}: this package makes +almost everything accessible to the users. Consider the following +extremely simple example which may demonstrate this freedom: + +<>= +1+1 +@ + +There are two parts in the final output: the source code \texttt{1 ++ 1} and the output \texttt{{[}1{]} 2}; the comment characters \texttt{\#\#} +are from the default chunk option \texttt{comment}. Users may define +a hook function for the source code like this to use the \texttt{lstlisting} +environment: + +<>= +knit_hooks$set(source = function(x, options) { +paste('\\begin{lstlisting}\n', x, '\\end{lstlisting}\n', sep = '') +}) +@ + +Similarly we can put other types of output into other environments. +There is no need to hack at \textsf{Sweave.sty} for \textbf{knitr} +and you can put the output in any environments. What is more, the +output hooks make \textbf{knitr} ready for other types of output, +and a typical one is HTML (there are built-in hooks). The website +has provided many examples demonstrating the flexibility of the output. + +\section{Features} + +The \textbf{knitr} package borrowed features such as tikz graphics +and cache from \textbf{pgfSweave} and \textbf{cacheSweave} respectively, +but the implementations are different. New features like code reference +from an external R script as well as output customization are also +introduced. The feature of hook functions in Sweave is re-implemented +and hooks have new usage now. There are several other small features +which are motivated from my everyday use of Sweave. For example, a +progress bar is provided when knitting a file so we roughly know how +long we still need to wait; output from inline R code (e.g. \texttt{\textbackslash{}Sexpr\{x{[}1{]}\}}) +is automatically formatted in \TeX{} math notation (like \Sexpr{123456789}) +if the result is numeric. You may check out a number of specific manuals +dedicated to specific features such as graphics in the website: \url{https://yihui.org/knitr/demo/}. + +\subsection{Code Decoration} + +The \textbf{highr} package \citep{R-highr} is used to highlight R +code, and the \textbf{formatR} package \citep{R-formatR} is used +to reformat R code (like \texttt{keep.source=FALSE} in Sweave but +will also try to retain comments). For \LaTeX{} output, the \textbf{framed} +package is used to decorate code chunks with a light gray background. +If this \LaTeX{} package is not found in the system, a version will +be copied directly from \textbf{knitr}. The prompt characters are +removed by default because they mangle the R source code in the output +and make it difficult to copy R code. The R output is masked in comments +by default based on the same rationale. It is easy to revert to the +output with prompts (set option \texttt{prompt=TRUE}), and you will +quickly realize the inconvenience to the readers if they want to copy +and run the code in the output document: + +<>= +x=rnorm(5) +x +var(x) +@ + +The example below shows the effect of \texttt{tidy=TRUE/FALSE}: + +<>= +## option tidy=FALSE +for(k in 1:10){j=cos(sin(k)*k^2)+3;print(j-5)} +@ +<>= +## option tidy=TRUE +for(k in 1:10){j=cos(sin(k)*k^2)+3;print(j-5)} +@ + +Note \texttt{=} is replaced by \texttt{<-} because \texttt{options('formatR.arrow')} +was set to be \texttt{TRUE} in this document; see the documentation +of \emph{tidy.source()} in \textbf{formatR} for details. + +Many highlighting themes can be used in \textbf{knitr}, which are +borrowed from the \textbf{highlight} package by \href{http://www.andre-simon.de/}{Andre Simon}\footnote{not the R package mentioned before; for a preview of these themes, +see \url{http://www.andre-simon.de/dokuwiki/doku.php?id=theme_examples}}; it is also possible to use themes from \url{http://www.eclipsecolorthemes.org/} +by providing a theme id to \textbf{knitr}\footnote{many thanks to \href{https://github.com/ramnathv}{Ramnath Vaidyanathan} +for the work on themes}. See \texttt{?knit\_theme} for details. + +\subsection{Graphics} + +Graphics is an important part of reports, and several enhancements +have been made in \textbf{knitr}. For example, grid graphics may not +need to be explicitly printed as long as the same code can produce +plots in R (in some cases, however, they have to be printed, e.g. +in a loop, because you have to do so in an R terminal). + +\subsubsection{Graphical Devices} + +Over a long time, a frequently requested feature for Sweave was the +support for other graphics devices, which has been implemented since +R 2.13.0. Instead of using logical options like \texttt{png} or \texttt{jpeg} +(this list can go on and on), \textbf{knitr} uses a single option +\texttt{dev} (like \texttt{grdevice} in Sweave) which has support +for more than 20 devices. For instance, \texttt{dev='png'} will use +the \emph{png()} device, and \texttt{dev='CairoJPEG'} uses the \emph{CairoJPEG()} +device in the \textbf{Cairo} package (it has to be installed first, +of course). If none of these devices is satisfactory, you can provide +the name of a customized device function, which must have been defined +before it is called. + +\subsubsection{Plot Recording} + +As mentioned before, all the plots in a code chunk are first recorded +as R objects and then ``replayed'' inside a graphical device to +generate plot files. The \textbf{evaluate} package will record plots +per \emph{expression} basis, in other words, the source code is split +into individual complete expressions and \textbf{evaluate} will examine +possible plot changes in snapshots after each single expression has +been evaluated. For example, the code below consists of three expressions, +out of which two are related to drawing plots, therefore \textbf{evaluate} +will produce two plots by default: + +<>= +par(mar=c(3,3,.1,.1)) +plot(1:10, ann=FALSE,las=1) +text(5,9,'mass $\\rightarrow$ energy\n$E=mc^2$') +@ + +This brings a significant difference with traditional tools in R for +dynamic report generation, since low-level plotting changes can also +be recorded. The option \texttt{fig.keep} controls which plots to +keep in the output; \texttt{fig.keep='all'} will keep low-level changes +as separate plots; by default (\texttt{fig.keep='high'}), \textbf{knitr} +will merge low-level plot changes into the previous high-level plot, +like most graphics devices do. This feature may be useful for teaching +R graphics step by step. Note, however, low-level plotting commands +in a single expression (a typical case is a loop) will not be recorded +accumulatively, but high-level plotting commands, regardless of where +they are, will always be recorded. For example, this chunk will only +produce 2 plots instead of 21 plots because there are 2 complete expressions: + +<>= +plot(0,0,type='n',ann=FALSE) +for(i in seq(0, 2*pi,length=20)) points(cos(i),sin(i)) +@ + +But this will produce 20 plots as expected: + +<>= +for(i in seq(0, 2*pi,length=20)) {plot(cos(i),sin(i),xlim=c(-1,1),ylim=c(-1,1))} +@ + +As I showed in the beginning of this manual, it is straightforward +to let \textbf{knitr} keep all the plots in a chunk and insert them +into the output document, so we no longer need the \texttt{cat('\textbackslash{}\textbackslash{}includegraphics\{\}')} +trick. + +We can discard all previous plots and keep the last one only by \texttt{fig.keep='last'}, +or keep only the first plot by \texttt{fig.keep='first'}, or discard +all plots by \texttt{fig.keep='none'}. + +\subsubsection{Plot Rearrangement} + +The option \texttt{fig.show} can decide whether to hold all plots +while evaluating the code and ``flush'' all of them to the end of +a chunk (\texttt{fig.show='hold'}), or just insert them to the place +where they were created (by default \texttt{fig.show='asis'}). Here +is an example of \texttt{fig.show='asis'}: + +<>= +contour(volcano) # contour lines +filled.contour(volcano) # fill contour plot with colors +@ + +Beside \texttt{hold} and \texttt{asis}, the option \texttt{fig.show} +can take a third value: \texttt{animate}, which makes it possible +to insert animations into the output document. In \LaTeX{}, the package +\textbf{animate} is used to put together image frames as an animation. +For animations to work, there must be more than one plot produced +in a chunk. The option \texttt{interval} controls the time interval +between animation frames; by default it is 1 second. Note you have +to add \texttt{\textbackslash{}usepackage\{animate\}} in the \LaTeX{} +preamble, because \textbf{knitr} will not add it automatically. Animations +in the PDF output can only be viewed in Adobe Reader. + +As a simple demonstration, here is a \href{http://en.wikipedia.org/wiki/Mandelbrot_set}{Mandelbrot animation} +taken from the \textbf{animation} package \citep{R-animation}; note +the PNG device is used because PDF files are too large. You should +be able to see the animation immediately with Acrobat Reader since +it was set to play automatically: + +<>= +library(animation) +demo('Mandelbrot', echo = FALSE, package = 'animation') +@ + +\subsubsection{Plot Size} + +The \texttt{fig.width} and \texttt{fig.height} options specify the +size of plots in the graphics device, and the real size in the output +document can be different (see \texttt{out.width} and \texttt{out.height}). +When there are multiple plots per chunk, it is possible to arrange +more than one plot per line in \LaTeX{} \textendash{} just specify +\texttt{out.width} to be less than half of the current line width, +e.g. \texttt{out.width='.49\textbackslash{}\textbackslash{}linewidth'}. + +\subsubsection{The tikz Device} + +Beside PDF, PNG and other traditional R graphical devices, \textbf{knitr} +has special support to tikz graphics via the \textbf{tikzDevice} package +\citep{R-tikzDevice}, which is similar to \textbf{pgfSweave}. If +we set the chunk option \texttt{dev='tikz'}, the \emph{tikz()} device +in \textbf{tikzDevice} will be used to save plots. Options \texttt{sanitize} +and \texttt{external} are related to the tikz device: see the documentation +of \emph{tikz()} for details. Note \texttt{external=TRUE} in \textbf{knitr} +has a different meaning with \textbf{pgfSweave} \textendash{} it means +\texttt{standAlone=TRUE} in \emph{tikz()}, and the tikz graphics output +will be compiled to PDF \emph{immediately} after it is created, so +the ``externalization'' does not depend on the \textbf{tikz} package; +to maintain consistency in (font) styles, \textbf{knitr} will read +the preamble of the input document and use it in the tikz device. +At the moment, I'm not sure if this is a faithful way to externalize +tikz graphics, but I have not seen any problems so far. The assumption +to make, however, is that you declare all the styles in the preamble; +\textbf{knitr} is agnostic of \emph{local} style changes in the body +of the document. + +Below is an example taken from StackOverflow\footnote{\url{http://stackoverflow.com/q/8190087/559676}}; +we usually have to write R code like this to obtain a math expression +$\mathrm{d}\mathbf{x}_{t}=\alpha[(\theta-\mathbf{x}_{t})\mathrm{d}t+4]\mathrm{d}B_{t}$ +in R graphics: + +<>= +qplot(1:10, 1:10) + opts(title = substitute(paste(d * + bolditalic(x)[italic(t)] == alpha * (theta - bolditalic(x)[italic(t)]) * + d * italic(t) + lambda * d * italic(B)[italic(t)]), list(lambda = 4))) +@ + +With the tikz device, it is both straightforward and more beautiful: + +<>= +library(ggplot2) +qplot(1:10, 1:10) + +labs(title = sprintf('$\\mathrm{d}\\mathbf{x}_{t} = \\alpha[(\\theta - \\mathbf{x}_{t})\\mathrm{d}t + %d]\\mathrm{d}B_{t}$', 4)) +@ + +The advantage of tikz graphics is the consistency of styles\footnote{Users are encouraged to read the vignette of \textbf{tikzDevice}, +which is the most beautiful vignette I have ever seen in R packages: +\url{http://cran.r-project.org/web/packages/tikzDevice/vignettes/tikzDevice.pdf}}, and one disadvantage is that \LaTeX{} may not be able to handle +too large tikz files (it can run out of memory). For example, an R +plot with tens of thousands of graphical elements may fail to compile +in \LaTeX{} if we use the tikz device. In such cases, we can switch +to the PDF or PNG device, or reconsider our decision on the type of +plots, e.g., a scatter plot with millions of points is usually difficult +to read, and a contour plot or a hexagon plot showing the 2D density +can be a better alternative (they are smaller in size). + +The graphics manual contains more detailed information and you can +check it out in the \href{https://yihui.org/knitr/demo/graphics/}{website}. + +\subsection{Cache} + +The feature of cache is not a new idea \textendash{} both \textbf{cacheSweave} +and \textbf{weaver} have implemented it based on Sweave, with the +former using \textbf{filehash} and the latter using \textsf{.RData} +images; \textbf{cacheSweave} also supports lazy-loading of objects +based on \textbf{filehash}. The \textbf{knitr} package directly uses +internal base R functions to save (\emph{tools:::makeLazyLoadDB()}) +and lazy-load objects (\emph{lazyLoad()}). These functions are either +undocumented or marked as internal, but as far as I understand, they +are the tools to implement lazy-loading for packages. The \textbf{cacheSweave} +vignette has clearly explained lazy-loading, and roughly speaking, +lazy-loading means an object will not be really loaded into memory +unless it is really used somewhere. This is very useful for cache; +sometimes we read a large object and cache it, then take a subset +for analysis and this subset is also cached; in the future, the initial +large object will not be loaded into R if our computation is only +based on the object of its subset. + +The paths of cache files are determined by the chunk option \texttt{cache.path}; +by default all cache files are created under a directory \textsf{cache} +relative to the current working directory, and if the option value +contains a directory (e.g. \texttt{cache.path='cache/abc-'}), cache +files will be stored under that directory (automatically created if +it does not exist). The cache is invalidated and purged on any changes +to the code chunk, including both the R code and chunk options\footnote{One exception is the \texttt{include} option, which is not cached +because \texttt{include=TRUE/FALSE} does not affect code evaluation; +meanwhile, the value \texttt{getOption('width')} is also cached, so +if you change this option, the cache will also be invalidated (this +option affects the width of text output)}; this means previous cache files of this chunk are removed (filenames +are identified by the chunk label). Unlike \textbf{pgfSweave}, cache +files will never accumulate since old cache files will always be removed +in \textbf{knitr}. Unlike \textbf{weaver} or \textbf{cacheSweave}, +\textbf{knitr} will try to preserve these side-effects: +\begin{enumerate} +\item printed results: meaning that any output of a code chunk will be loaded +into the output document for a cached chunk, although it is not really +evaluated. The reason is \textbf{knitr} also cache the output of a +chunk as a character string. Note this means graphics output is also +cached since it is part of the output. It has been a pain for me for +a long time to have to lose output to gain cache; +\item loaded packages: after the evaluation of each cached chunk, the list +of packages used in the current R session is written to a file under +the cache path named \textsf{\_\_packages}; next time if a cached +chunk needs to be rebuilt, these packages will be loaded first. The +reasons for caching package names are, it can be slow to load some +packages, and a package might be loaded in a previous cached chunk +which is not available to the next cached chunk when only the latter +needs to be rebuilt. Note this only applies to cached chunks, and +for uncached chunks, you must always use \emph{library()} to load +packages explicitly; +\end{enumerate} +Although \textbf{knitr} tries to keep some side-effects, there are +still other types of side-effects like setting \emph{par()} or \emph{options()} +which are not cached. Users should be aware of these special cases, +and make sure to clearly separate the code which is not meant to be +cached to other chunks which are not cached, e.g., set all global +options in the first chunk of a document and do not cache that chunk. + +Sometimes a cached chunk may need to use objects from other cached +chunks, which can bring a serious problem \textendash{} if objects +in previous chunks have changed, this chunk will not be aware of the +changes and will still use old cached results, unless there is a way +to detect such changes from other chunks. There is an option called +\texttt{dependson} in \textbf{cacheSweave} which does this job. We +can explicitly specify which other chunks this chunk depends on by +setting an option like \texttt{dependson='chunkA;chunkB'} or equivalently +\texttt{dependson=c('chunkA', 'chunkB')}. Each time the cache of a +chunk is rebuilt, all other chunks which depend on this chunk will +lose cache, hence their cache will be rebuilt as well. + +Another way to specify the dependencies among chunks is to use the +chunk option \texttt{autodep} and the function \emph{dep\_auto()}. +This is an experimental feature borrowed from \textbf{weaver} which +frees us from setting chunk dependencies manually. The basic idea +is, if a latter chunk uses any objects created from a previous chunk, +the latter chunk is said to depend on the previous one. The function +\emph{findGlobals()} in the \textbf{codetools} package is used to +find out all global objects in a chunk, and according to its documentation, +the result is an approximation. Global objects roughly mean the ones +which are not created locally, e.g. in the expression \texttt{function() +\{y <- x\}}, \texttt{x} should be a global object, whereas \texttt{y} +is local. Meanwhile, we also need to save the list of objects created +in each cached chunk, so that we can compare them to the global objects +in latter chunks. For example, if chunk A created an object \texttt{x} +and chunk B uses this object, chunk B must depend on A, i.e. whenever +A changes, B must also be updated. When \texttt{autodep=TRUE}, \textbf{knitr} +will write out the names of objects created in a cached chunk as well +as those global objects in two files named \textsf{\_\_objects} and +\textsf{\_\_globals} respectively; later we can use the function \emph{dep\_auto()} +to analyze the object names to figure out the dependencies automatically. +See \url{https://yihui.org/knitr/demo/cache/} for examples. + +Yet another way to specify dependencies is \emph{dep\_prev()}: this +is a conservative approach which sets the dependencies so that a cached +chunk will depend on all its previous chunks, i.e. whenever a previous +chunk is updated, all later chunks will be updated accordingly. + +\subsection{Code Externalization} + +It can be more convenient to write R code in a separate file, rather +than mixing it into a \LaTeX{} document; for example, we can run +R code successively in a pure R script from one chunk to the other +without jumping through other texts. Since I prefer using \LyX{} +to write reports, Sweave is even more inconvenient because I have +to recompile the whole document each time, even if I only want to +know the results of a single chunk. Therefore \textbf{knitr} introduced +the feature of code externalization to a separate R script. Currently +the setting is like this: the R script also uses chunk labels (marked +in the form \texttt{\#\# -{}-{}-{}- chunk-label} by default); if the +code chunk in the input document is empty, \textbf{knitr} will match +its label with the label in the R script to input external R code. +For example, suppose this is a code chunk labelled as \texttt{Q1} +in an R script named \textsf{homework1-xie.R} which is under the same +directory as the Rnw document: + +<>= +## ---- Q1 --------------------- +gcd = function(m, n) { + while ((r <- m %% n) != 0) { + m = n; n = r + } + n +} +@ + +In the Rnw document, we can first read the script using the function +\emph{read\_chunk()}: + +<>= +read_chunk('homework1-xie.R') +@ + +This is usually done in an early chunk, and we can use the chunk \texttt{Q1} +later in the Rnw document: + +<>= +cat('<>=','@',sep='\n') +@ + +Different documents can read the same R script, so the R code can +be reusable across different input documents. + +\subsection{Evaluation of Chunk Options\label{subsec:conditional}} + +By default \textbf{knitr} uses a new syntax to parse chunk options: +it treats them as function arguments instead of a text string to be +split to obtain option values. This gives the user much more power +than the old syntax; we can pass arbitrary R objects to chunk options +besides simple ones like \texttt{TRUE}/\texttt{FALSE}, numbers and +character strings. The page \url{https://yihui.org/knitr/demo/sweave/} +has given two examples to show the advantages of the new syntax. Here +we show yet another useful application. + +Before \textbf{knitr} 0.3, there was a feature named ``conditional +evaluation''\footnote{request from \url{https://plus.google.com/u/0/116405544829727492615/posts/43WrRUffjzK}}. +The idea is, instead of setting chunk options \texttt{eval} and \texttt{echo} +to be \texttt{TRUE} or \texttt{FALSE} (constants), their values can +be controlled by global variables in the current R session. This enables +\textbf{knitr} to conditionally evaluate code chunks according to +variables. For example, here we assign \texttt{TRUE} to a variable +\texttt{dothis}: + +<>= +dothis=TRUE +@ + +In the next chunk, we set chunk options \texttt{eval=dothis} and \texttt{echo=!dothis}, +both are valid R expressions since the variable \texttt{dothis} exists. +As we can see, the source code is hidden, but it was indeed evaluated: + +<>= +print('you cannot see my source because !dothis is FALSE') +@ + +Then we set \texttt{eval=dothis} and \texttt{echo=dothis} for another +chunk: + +<>= +dothis +@ + +If we change the value of \texttt{dothis} to \texttt{FALSE}, neither +of the above chunks will be evaluated any more. Therefore we can control +many chunks with a single variable, and present results selectively. + +This old feature requires \textbf{knitr} to treat \texttt{eval} and +\texttt{echo} specially, and we can easily see that it is no longer +necessary with the new syntax: \texttt{eval=dothis} will tell R to +find the variable \texttt{dothis} automatically just like we call +a function \texttt{foobar(eval = dothis)}. What is more, all options +will be evaluated as R expressions unless they are already constants +which do not need to be evaluated, so this old feature has been generalized +to all other options naturally. + +\subsection{Customization} + +The \textbf{knitr} package is ready for customization. Both the patterns +and hooks can be customized; see the package website for details. +Here I show an example on how to save \textbf{rgl} plots \citep{R-rgl} +using a customized hook function. First we define a hook named \texttt{rgl} +using the function \emph{hook\_rgl()} in \textbf{rgl}: + +<>= +library(rgl) +knit_hooks$set(rgl = hook_rgl) +head(hook_rgl) # the hook function is defined as this +@ + +Then we only have to set the chunk option \texttt{rgl=TRUE}: + +<>= +library(rgl) +demo('bivar', package='rgl', echo=FALSE) +par3d(zoom=.7) +@ + +Due to the flexibility of output hooks, \textbf{knitr} supports several +different output formats. The implementation is fairly easy, e.g., +for \LaTeX{} we put R output in \texttt{verbatim} environments, and +in HTML, it is only a matter of putting output in \texttt{div} layers. +These are simply character string operations. Many demos in \url{https://yihui.org/knitr/demo/} +show this idea clearly. This manual did not cover all the features +of \textbf{knitr}, and users are encouraged to thumb through the website +to know more possible features. + +\section{Editors} + +You can use any text editors to write the source documents, but some +have built-in support for \textbf{knitr}. Both RStudio (\url{http://www.rstudio.org}) +and \LyX{} (\url{http://www.lyx.org}) have full support for \textbf{knitr}, +and you can compile the document to PDF with just one click. See \url{https://yihui.org/knitr/demo/rstudio/} +and \url{https://yihui.org/knitr/demo/lyx/} respectively. It is also +possible to support other editors like \href{https://yihui.org/knitr/demo/eclipse/}{Eclipse}, +\href{https://yihui.org/knitr/demo/editors/}{Texmaker and WinEdt}; +see the demo list in the website for configuration instructions. + +\section*{About This Document} + +This manual was written in \LyX{} and compiled with \textbf{knitr} +(version \Sexpr{packageVersion('knitr')}). The \LyX{} source and +the Rnw document exported from \LyX{} can be found under these directories: + +<>= +system.file('examples', 'knitr-manual.lyx', package='knitr') # lyx source +system.file('examples', 'knitr-manual.Rnw', package='knitr') # Rnw source +@ + +You can use the function \emph{knit()} to knit the Rnw document (remember +to put the two \textsf{.bib} files under the same directory), and +you need to make sure all the R packages used in this document are +installed: + +<>= +install.packages(c('animation', 'rgl', 'tikzDevice', 'ggplot2')) +@ + +Feedback and comments on this manual and the package are always welcome. +Bug reports and feature requests can be sent to \url{https://github.com/yihui/knitr/issues}, +and questions can be delivered to the \href{mailto:knitr@googlegroups.com}{mailing list} +\url{https://groups.google.com/group/knitr}. + +% when knitr is updated, this chunk will be updated; why? +<>= +# write all packages in the current session to a bib file +write_bib(c(.packages(), 'evaluate', 'formatR', 'highr'), file = 'knitr-packages.bib') +@ + +\bibliographystyle{jss} +\bibliography{knitr-manual,knitr-packages} + +\end{document} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-manual.lyx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-manual.lyx new file mode 100644 index 00000000..e8c3b641 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-manual.lyx @@ -0,0 +1,2986 @@ +#LyX 2.1 created this file. For more info see http://www.lyx.org/ +\lyxformat 474 +\begin_document +\begin_header +\textclass article +\begin_preamble +\renewcommand{\textfraction}{0.05} +\renewcommand{\topfraction}{0.8} +\renewcommand{\bottomfraction}{0.8} +\renewcommand{\floatpagefraction}{0.75} + +\usepackage[buttonsize=1em]{animate} +\end_preamble +\use_default_options true +\begin_modules +knitr +\end_modules +\maintain_unincluded_children false +\language english +\language_package none +\inputencoding default +\fontencoding global +\font_roman palatino +\font_sans lmss +\font_typewriter lmtt +\font_math auto +\font_default_family default +\use_non_tex_fonts false +\font_sc true +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 +\graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\paperfontsize default +\spacing single +\use_hyperref true +\pdf_bookmarks true +\pdf_bookmarksnumbered true +\pdf_bookmarksopen true +\pdf_bookmarksopenlevel 2 +\pdf_breaklinks false +\pdf_pdfborder false +\pdf_colorlinks false +\pdf_backref false +\pdf_pdfusetitle true +\pdf_quoted_options "pdfstartview={XYZ null null 1}" +\papersize default +\use_geometry true +\use_package amsmath 1 +\use_package amssymb 1 +\use_package cancel 1 +\use_package esint 1 +\use_package mathdots 1 +\use_package mathtools 1 +\use_package mhchem 1 +\use_package stackrel 1 +\use_package stmaryrd 1 +\use_package undertilde 1 +\cite_engine natbib +\cite_engine_type authoryear +\biblio_style plainnat +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\justification true +\use_refstyle 1 +\index Index +\shortcut idx +\color #008000 +\end_index +\leftmargin 2.5cm +\topmargin 2.5cm +\rightmargin 2.5cm +\bottommargin 2.5cm +\secnumdepth 2 +\tocdepth 2 +\paragraph_separation indent +\paragraph_indentation default +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\end_header + +\begin_body + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +library(knitr) +\end_layout + +\begin_layout Plain Layout + +## set global chunk options +\end_layout + +\begin_layout Plain Layout + +opts_chunk$set(fig.path='figure/manual-', cache.path='cache/manual-', fig.align='ce +nter', fig.show='hold', par=TRUE) +\end_layout + +\begin_layout Plain Layout + +## I use = but I can replace it with <-; set code/output width to be 68 +\end_layout + +\begin_layout Plain Layout + +options(formatR.arrow=TRUE, width=68, digits=4) +\end_layout + +\begin_layout Plain Layout + +## tune details of base graphics (https://yihui.org/knitr/hooks) +\end_layout + +\begin_layout Plain Layout + +knit_hooks$set(par=function(before, options, envir){ +\end_layout + +\begin_layout Plain Layout + +if (before && options$fig.show!='none') par(mar=c(4,4,.1,.1),cex.lab=.95,cex.axis=.9,mg +p=c(2,.7,0),tcl=-.3) +\end_layout + +\begin_layout Plain Layout + +}) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Title +knitr: A General-Purpose Tool for Dynamic Report Generation in R +\end_layout + +\begin_layout Author +Yihui Xie +\end_layout + +\begin_layout Standard +The original paradigm of literate programming was brought forward mainly + for software development, or specifically, to mix source code (for computer) + and documentation (for human) together. + Early systems include +\begin_inset CommandInset href +LatexCommand href +name "WEB" +target "http://www.literateprogramming.com/web.pdf" + +\end_inset + + and +\begin_inset CommandInset href +LatexCommand href +name "Noweb" +target "http://www.cs.tufts.edu/~nr/noweb/" + +\end_inset + +; Sweave +\begin_inset CommandInset citation +LatexCommand citep +key "leisch2002" + +\end_inset + + was derived from the latter, but it is less focused on documenting software, + instead it is mainly used for reproducible data analysis and generating + statistical reports. + The +\series bold +knitr +\series default + package +\begin_inset CommandInset citation +LatexCommand citep +key "R-knitr" + +\end_inset + + is following the steps of Sweave. + For this manual, I assume readers have some background knowledge of Sweave + to understand the technical details; for a reference of available options, + hooks and demos, see the package homepage +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://yihui.org/knitr/ +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Section +Hello World +\end_layout + +\begin_layout Standard +A natural question is why to reinvent the wheel. + The short answer is that extending Sweave by hacking +\family sans +SweaveDrivers.R +\family default + in the +\series bold +utils +\series default + package is a difficult job to me. + Many features in +\series bold +knitr +\series default + come naturally as users would have expected. + Figure +\begin_inset CommandInset ref +LatexCommand ref +reference "fig:cars-demo" + +\end_inset + + is a simple demo of some features of +\series bold +knitr +\series default +. +\end_layout + +\begin_layout Standard +\begin_inset Float figure +wide false +sideways false +status open + +\begin_layout Plain Layout +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +fit=lm(dist~speed,data=cars) # linear regression +\end_layout + +\begin_layout Plain Layout + +par(mar=c(4, 4, 1, .1), mgp=c(2,1,0)) +\end_layout + +\begin_layout Plain Layout + +with(cars,plot(speed,dist,panel.last=abline(fit))) +\end_layout + +\begin_layout Plain Layout + +text(10,100,'$Y = +\backslash + +\backslash +beta_0 + +\backslash + +\backslash +beta_1x + +\backslash + +\backslash +epsilon$') +\end_layout + +\begin_layout Plain Layout + +library(ggplot2) +\end_layout + +\begin_layout Plain Layout + +qplot(speed, dist, data=cars)+geom_smooth() +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Plain Layout +\begin_inset Caption Standard + +\begin_layout Plain Layout +\begin_inset CommandInset label +LatexCommand label +name "fig:cars-demo" + +\end_inset + +A simple demo of possible output in +\series bold +knitr +\series default +: (1) multiple plots per chunk; (2) no need to +\emph on +print() +\emph default + objects in +\series bold +ggplot2 +\series default +; (3) device size is +\begin_inset Formula $4\times2.8$ +\end_inset + + (inches) but output size is adjusted to +\family typewriter +.45 +\backslash +textwidth +\family default + in chunk options; (4) base graphics and +\series bold +ggplot2 +\series default + can sit side by side; (5) use the +\emph on +tikz() +\emph default + device in +\series bold +tikzDevice +\series default + by setting chunk option +\family typewriter +dev='tikz' +\family default + (hence can write native LaTeX expressions in R plots); (6) code highlighting. +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +I would have chosen to hide the R code if this were a real report, but here + I show the code just for the sake of demonstration. + If we type +\emph on +qplot() +\emph default + in R, we get a plot, and the same thing happens in +\series bold +knitr +\series default +. + If we draw two plots in the code, +\series bold +knitr +\series default + will show two plots and we do not need to tell it how many plots are there + in the code in advance. + If we set +\family typewriter +out.width='.49 +\backslash + +\backslash +textwidth' +\family default + in chunk options, we get it in the final output document. + If we say +\family typewriter +fig.align='center' +\family default +, the plots are centered. + That's it. + Many enhancements and new features will be introduced later. + If you come from the Sweave land, you can take a look at the page of transition + first: +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://yihui.org/knitr/demo/sweave/ +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Section +Design +\end_layout + +\begin_layout Standard +The flow of processing an input file is similar to Sweave, and two major + differences are that +\series bold +knitr +\series default + provides more flexibility to the users to customize the processing, and + has many built-in options such as the support to a wide range of graphics + devices and cache. + Below is a brief description of the process: +\end_layout + +\begin_layout Enumerate + +\series bold +knitr +\series default + takes an input file and automatically determines an appropriate set of + +\begin_inset CommandInset href +LatexCommand href +name "patterns" +target "https://yihui.org/knitr/patterns/" + +\end_inset + + to use if they are not provided in advance (e.g. + +\family sans +file.Rnw +\family default + will use +\family typewriter +knit_patterns$get('rnw') +\family default +); +\end_layout + +\begin_layout Enumerate +a set of output +\begin_inset CommandInset href +LatexCommand href +name "hooks" +target "https://yihui.org/knitr/hooks/" + +\end_inset + + will also be set up automatically according to the filename extension (e.g. + use LaTeX environments or HTML elements to wrap up R results); +\end_layout + +\begin_layout Enumerate +the input file is read in and split into pieces consisting of R code chunks + and normal texts; the former will be executed one after the other, and + the latter may contain global chunk options or inline R code; +\end_layout + +\begin_layout Enumerate +for each chunk, the code is evaluated using the +\series bold +evaluate +\series default + package +\begin_inset CommandInset citation +LatexCommand citep +key "R-evaluate" + +\end_inset + +, and the results may be filtered according to chunk options (e.g. + +\family typewriter +echo=FALSE +\family default + will remove the R source code) +\end_layout + +\begin_deeper +\begin_layout Enumerate +if +\family typewriter +cache=TRUE +\family default + for this chunk, +\series bold +knitr +\series default + will first check if there are previously cached results under the cache + directory before really evaluating the chunk; if cached results exist and + this code chunk has not been changed since last run (use MD5 sum to verify), + the cached results will be (lazy-) loaded, otherwise new cache will be + built; if a cached chunk depends on other chunks (see the +\family typewriter +dependson +\family default + +\begin_inset CommandInset href +LatexCommand href +name "option" +target "https://yihui.org/knitr/options/" + +\end_inset + +) and any one of these chunks has changed, this chunk must be forcibly updated + (old cache will be purged) +\end_layout + +\begin_layout Enumerate +there are six types of possible output from +\series bold +evaluate +\series default +, and their classes are +\family typewriter +character +\family default + (normal text output), +\family typewriter +source +\family default + (source code), +\family typewriter +warning +\family default +, +\family typewriter +message +\family default +, +\family typewriter +error +\family default + and +\family typewriter +recordedplot +\family default +; an internal S3 generic function +\emph on +wrap() +\emph default + is used to deal with different types of output, using output hooks defined + in the object +\family typewriter +knit_hooks +\end_layout + +\begin_layout Enumerate +note plots are recorded as R objects before they are really saved to files, + so graphics devices will not be opened unless plots have really been produced + in a chunk +\end_layout + +\begin_layout Enumerate +a code chunk is evaluated in a separate empty environment with the global + environment as its parent, and all the objects in this environment after + the evaluation will be saved if +\family typewriter +cache=TRUE +\end_layout + +\begin_layout Enumerate +chunk hooks can be run before and/or after a chunk +\end_layout + +\end_deeper +\begin_layout Enumerate +for normal texts, +\series bold +knitr +\series default + will find inline R code (e.g. + in +\family typewriter + +\backslash +Sexpr{} +\family default +) and evaluate it; the output is wrapped by the +\family typewriter +inline +\family default + hook; +\end_layout + +\begin_layout Standard +The hooks play important roles in +\series bold +knitr +\series default +: this package makes almost everything accessible to the users. + Consider the following extremely simple example which may demonstrate this + freedom: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +1+1 +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +There are two parts in the final output: the source code +\family typewriter +1 + 1 +\family default + and the output +\family typewriter +[1] 2 +\family default +; the comment characters +\family typewriter +## +\family default + are from the default chunk option +\family typewriter +comment +\family default +. + Users may define a hook function for the source code like this to use the + +\family typewriter +lstlisting +\family default + environment: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +knit_hooks$set(source = function(x, options) { +\end_layout + +\begin_layout Plain Layout + +paste(' +\backslash + +\backslash +begin{lstlisting} +\backslash +n', x, ' +\backslash + +\backslash +end{lstlisting} +\backslash +n', sep = '') +\end_layout + +\begin_layout Plain Layout + +}) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Similarly we can put other types of output into other environments. + There is no need to hack at +\family sans +Sweave.sty +\family default + for +\series bold +knitr +\series default + and you can put the output in any environments. + What is more, the output hooks make +\series bold +knitr +\series default + ready for other types of output, and a typical one is HTML (there are built-in + hooks). + The website has provided many examples demonstrating the flexibility of + the output. +\end_layout + +\begin_layout Section +Features +\end_layout + +\begin_layout Standard +The +\series bold +knitr +\series default + package borrowed features such as tikz graphics and cache from +\series bold +pgfSweave +\series default + and +\series bold +cacheSweave +\series default + respectively, but the implementations are different. + New features like code reference from an external R script as well as output + customization are also introduced. + The feature of hook functions in Sweave is re-implemented and hooks have + new usage now. + There are several other small features which are motivated from my everyday + use of Sweave. + For example, a progress bar is provided when knitting a file so we roughly + know how long we still need to wait; output from inline R code (e.g. + +\family typewriter + +\backslash +Sexpr{x[1]} +\family default +) is automatically formatted in TeX math notation (like +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + + +\backslash +Sexpr{123456789} +\end_layout + +\end_inset + +) if the result is numeric. + You may check out a number of specific manuals dedicated to specific features + such as graphics in the website: +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://yihui.org/knitr/demo/ +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Subsection +Code Decoration +\end_layout + +\begin_layout Standard +The +\series bold +highr +\series default + package +\begin_inset CommandInset citation +LatexCommand citep +key "R-highr" + +\end_inset + + is used to highlight R code, and the +\series bold +formatR +\series default + package +\begin_inset CommandInset citation +LatexCommand citep +key "R-formatR" + +\end_inset + + is used to reformat R code (like +\family typewriter +keep.source=FALSE +\family default + in Sweave but will also try to retain comments). + For LaTeX output, the +\series bold +framed +\series default + package is used to decorate code chunks with a light gray background. + If this LaTeX package is not found in the system, a version will be copied + directly from +\series bold +knitr +\series default +. + The prompt characters are removed by default because they mangle the R + source code in the output and make it difficult to copy R code. + The R output is masked in comments by default based on the same rationale. + It is easy to revert to the output with prompts (set option +\family typewriter +prompt=TRUE +\family default +), and you will quickly realize the inconvenience to the readers if they + want to copy and run the code in the output document: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +x=rnorm(5) +\end_layout + +\begin_layout Plain Layout + +x +\end_layout + +\begin_layout Plain Layout + +var(x) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +The example below shows the effect of +\family typewriter +tidy=TRUE/FALSE +\family default +: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +## option tidy=FALSE +\end_layout + +\begin_layout Plain Layout + +for(k in 1:10){j=cos(sin(k)*k^2)+3;print(j-5)} +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +## option tidy=TRUE +\end_layout + +\begin_layout Plain Layout + +for(k in 1:10){j=cos(sin(k)*k^2)+3;print(j-5)} +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Note +\family typewriter += +\family default + is replaced by +\family typewriter +<- +\family default + because +\family typewriter +options('formatR.arrow') +\family default + was set to be +\family typewriter +TRUE +\family default + in this document; see the documentation of +\emph on +tidy.source() +\emph default + in +\series bold +formatR +\series default + for details. +\end_layout + +\begin_layout Standard +Many highlighting themes can be used in +\series bold +knitr +\series default +, which are borrowed from the +\series bold +highlight +\series default + package by +\begin_inset CommandInset href +LatexCommand href +name "Andre Simon" +target "http://www.andre-simon.de/" + +\end_inset + + +\begin_inset Foot +status open + +\begin_layout Plain Layout +not the R package mentioned before; for a preview of these themes, see +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +http://www.andre-simon.de/dokuwiki/doku.php?id=theme_examples +\end_layout + +\end_inset + + +\end_layout + +\end_inset + +; it is also possible to use themes from +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +http://www.eclipsecolorthemes.org/ +\end_layout + +\end_inset + + by providing a theme id to +\series bold +knitr +\series default + +\begin_inset Foot +status open + +\begin_layout Plain Layout +many thanks to +\begin_inset CommandInset href +LatexCommand href +name "Ramnath Vaidyanathan" +target "https://github.com/ramnathv" + +\end_inset + + for the work on themes +\end_layout + +\end_inset + +. + See +\family typewriter +?knit_theme +\family default + for details. +\end_layout + +\begin_layout Subsection +Graphics +\end_layout + +\begin_layout Standard +Graphics is an important part of reports, and several enhancements have + been made in +\series bold +knitr +\series default +. + For example, grid graphics may not need to be explicitly printed as long + as the same code can produce plots in R (in some cases, however, they have + to be printed, e.g. + in a loop, because you have to do so in an R terminal). +\end_layout + +\begin_layout Subsubsection +Graphical Devices +\end_layout + +\begin_layout Standard +Over a long time, a frequently requested feature for Sweave was the support + for other graphics devices, which has been implemented since R 2.13.0. + Instead of using logical options like +\family typewriter +png +\family default + or +\family typewriter +jpeg +\family default + (this list can go on and on), +\series bold +knitr +\series default + uses a single option +\family typewriter +dev +\family default + (like +\family typewriter +grdevice +\family default + in Sweave) which has support for more than 20 devices. + For instance, +\family typewriter +dev='png' +\family default + will use the +\emph on +png() +\emph default + device, and +\family typewriter +dev='CairoJPEG' +\family default + uses the +\emph on +CairoJPEG() +\emph default + device in the +\series bold +Cairo +\series default + package (it has to be installed first, of course). + If none of these devices is satisfactory, you can provide the name of a + customized device function, which must have been defined before it is called. +\end_layout + +\begin_layout Subsubsection +Plot Recording +\end_layout + +\begin_layout Standard +As mentioned before, all the plots in a code chunk are first recorded as + R objects and then +\begin_inset Quotes eld +\end_inset + +replayed +\begin_inset Quotes erd +\end_inset + + inside a graphical device to generate plot files. + The +\series bold +evaluate +\series default + package will record plots per +\emph on +expression +\emph default + basis, in other words, the source code is split into individual complete + expressions and +\series bold +evaluate +\series default + will examine possible plot changes in snapshots after each single expression + has been evaluated. + For example, the code below consists of three expressions, out of which + two are related to drawing plots, therefore +\series bold +evaluate +\series default + will produce two plots by default: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +par(mar=c(3,3,.1,.1)) +\end_layout + +\begin_layout Plain Layout + +plot(1:10, ann=FALSE,las=1) +\end_layout + +\begin_layout Plain Layout + +text(5,9,'mass $ +\backslash + +\backslash +rightarrow$ energy +\backslash +n$E=mc^2$') +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +This brings a significant difference with traditional tools in R for dynamic + report generation, since low-level plotting changes can also be recorded. + The option +\family typewriter +fig.keep +\family default + controls which plots to keep in the output; +\family typewriter +fig.keep='all' +\family default + will keep low-level changes as separate plots; by default ( +\family typewriter +fig.keep='high' +\family default +), +\series bold +knitr +\series default + will merge low-level plot changes into the previous high-level plot, like + most graphics devices do. + This feature may be useful for teaching R graphics step by step. + Note, however, low-level plotting commands in a single expression (a typical + case is a loop) will not be recorded accumulatively, but high-level plotting + commands, regardless of where they are, will always be recorded. + For example, this chunk will only produce 2 plots instead of 21 plots because + there are 2 complete expressions: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +plot(0,0,type='n',ann=FALSE) +\end_layout + +\begin_layout Plain Layout + +for(i in seq(0, 2*pi,length=20)) points(cos(i),sin(i)) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +But this will produce 20 plots as expected: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +for(i in seq(0, 2*pi,length=20)) {plot(cos(i),sin(i),xlim=c(-1,1),ylim=c(-1,1))} +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +As I showed in the beginning of this manual, it is straightforward to let + +\series bold +knitr +\series default + keep all the plots in a chunk and insert them into the output document, + so we no longer need the +\family typewriter +cat(' +\backslash + +\backslash +includegraphics{}') +\family default + trick. +\end_layout + +\begin_layout Standard +We can discard all previous plots and keep the last one only by +\family typewriter +fig.keep='last' +\family default +, or keep only the first plot by +\family typewriter +fig.keep='first' +\family default +, or discard all plots by +\family typewriter +fig.keep='none' +\family default +. +\end_layout + +\begin_layout Subsubsection +Plot Rearrangement +\end_layout + +\begin_layout Standard +The option +\family typewriter +fig.show +\family default + can decide whether to hold all plots while evaluating the code and +\begin_inset Quotes eld +\end_inset + +flush +\begin_inset Quotes erd +\end_inset + + all of them to the end of a chunk ( +\family typewriter +fig.show='hold' +\family default +), or just insert them to the place where they were created (by default + +\family typewriter +fig.show='asis' +\family default +). + Here is an example of +\family typewriter +fig.show='asis' +\family default +: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +contour(volcano) # contour lines +\end_layout + +\begin_layout Plain Layout + +filled.contour(volcano) # fill contour plot with colors +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Beside +\family typewriter +hold +\family default + and +\family typewriter +asis +\family default +, the option +\family typewriter +fig.show +\family default + can take a third value: +\family typewriter +animate +\family default +, which makes it possible to insert animations into the output document. + In LaTeX, the package +\series bold +animate +\series default + is used to put together image frames as an animation. + For animations to work, there must be more than one plot produced in a + chunk. + The option +\family typewriter +interval +\family default + controls the time interval between animation frames; by default it is 1 + second. + Note you have to add +\family typewriter + +\backslash +usepackage{animate} +\family default + in the LaTeX preamble, because +\series bold +knitr +\series default + will not add it automatically. + Animations in the PDF output can only be viewed in Adobe Reader. +\end_layout + +\begin_layout Standard +As a simple demonstration, here is a +\begin_inset CommandInset href +LatexCommand href +name "Mandelbrot animation" +target "http://en.wikipedia.org/wiki/Mandelbrot_set" + +\end_inset + + taken from the +\series bold +animation +\series default + package +\begin_inset CommandInset citation +LatexCommand citep +key "R-animation" + +\end_inset + +; note the PNG device is used because PDF files are too large. + You should be able to see the animation immediately with Acrobat Reader + since it was set to play automatically: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +library(animation) +\end_layout + +\begin_layout Plain Layout + +demo('Mandelbrot', echo = FALSE, package = 'animation') +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Subsubsection +Plot Size +\end_layout + +\begin_layout Standard +The +\family typewriter +fig.width +\family default + and +\family typewriter +fig.height +\family default + options specify the size of plots in the graphics device, and the real + size in the output document can be different (see +\family typewriter +out.width +\family default + and +\family typewriter +out.height +\family default +). + When there are multiple plots per chunk, it is possible to arrange more + than one plot per line in LaTeX -- just specify +\family typewriter +out.width +\family default + to be less than half of the current line width, e.g. + +\family typewriter +out.width='.49 +\backslash + +\backslash +linewidth' +\family default +. +\end_layout + +\begin_layout Subsubsection +The tikz Device +\end_layout + +\begin_layout Standard +Beside PDF, PNG and other traditional R graphical devices, +\series bold +knitr +\series default + has special support to tikz graphics via the +\series bold +tikzDevice +\series default + package +\begin_inset CommandInset citation +LatexCommand citep +key "R-tikzDevice" + +\end_inset + +, which is similar to +\series bold +pgfSweave +\series default +. + If we set the chunk option +\family typewriter +dev='tikz' +\family default +, the +\emph on +tikz() +\emph default + device in +\series bold +tikzDevice +\series default + will be used to save plots. + Options +\family typewriter +sanitize +\family default + and +\family typewriter +external +\family default + are related to the tikz device: see the documentation of +\emph on +tikz() +\emph default + for details. + Note +\family typewriter +external=TRUE +\family default + in +\series bold +knitr +\series default + has a different meaning with +\series bold +pgfSweave +\series default + -- it means +\family typewriter +standAlone=TRUE +\family default + in +\emph on +tikz() +\emph default +, and the tikz graphics output will be compiled to PDF +\emph on +immediately +\emph default + after it is created, so the +\begin_inset Quotes eld +\end_inset + +externalization +\begin_inset Quotes erd +\end_inset + + does not depend on the +\series bold +tikz +\series default + package; to maintain consistency in (font) styles, +\series bold +knitr +\series default + will read the preamble of the input document and use it in the tikz device. + At the moment, I'm not sure if this is a faithful way to externalize tikz + graphics, but I have not seen any problems so far. + The assumption to make, however, is that you declare all the styles in + the preamble; +\series bold +knitr +\series default + is agnostic of +\emph on +local +\emph default + style changes in the body of the document. +\end_layout + +\begin_layout Standard +Below is an example taken from StackOverflow +\begin_inset Foot +status open + +\begin_layout Plain Layout +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +http://stackoverflow.com/q/8190087/559676 +\end_layout + +\end_inset + + +\end_layout + +\end_inset + +; we usually have to write R code like this to obtain a math expression + +\begin_inset Formula $\mathrm{d}\mathbf{x}_{t}=\alpha[(\theta-\mathbf{x}_{t})\mathrm{d}t+4]\mathrm{d}B_{t}$ +\end_inset + + in R graphics: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +qplot(1:10, 1:10) + opts(title = substitute(paste(d * +\end_layout + +\begin_layout Plain Layout + + bolditalic(x)[italic(t)] == alpha * (theta - bolditalic(x)[italic(t)]) + * +\end_layout + +\begin_layout Plain Layout + + d * italic(t) + lambda * d * italic(B)[italic(t)]), list(lambda = 4))) + +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +With the tikz device, it is both straightforward and more beautiful: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +library(ggplot2) +\end_layout + +\begin_layout Plain Layout + +qplot(1:10, 1:10) + +\end_layout + +\begin_layout Plain Layout + +labs(title = sprintf('$ +\backslash + +\backslash +mathrm{d} +\backslash + +\backslash +mathbf{x}_{t} = +\backslash + +\backslash +alpha[( +\backslash + +\backslash +theta - +\backslash + +\backslash +mathbf{x}_{t}) +\backslash + +\backslash +mathrm{d}t + %d] +\backslash + +\backslash +mathrm{d}B_{t}$', 4)) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +The advantage of tikz graphics is the consistency of styles +\begin_inset Foot +status collapsed + +\begin_layout Plain Layout +Users are encouraged to read the vignette of +\series bold +tikzDevice +\series default +, which is the most beautiful vignette I have ever seen in R packages: +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +http://cran.r-project.org/web/packages/tikzDevice/vignettes/tikzDevice.pdf +\end_layout + +\end_inset + + +\end_layout + +\end_inset + +, and one disadvantage is that LaTeX may not be able to handle too large + tikz files (it can run out of memory). + For example, an R plot with tens of thousands of graphical elements may + fail to compile in LaTeX if we use the tikz device. + In such cases, we can switch to the PDF or PNG device, or reconsider our + decision on the type of plots, e.g., a scatter plot with millions of points + is usually difficult to read, and a contour plot or a hexagon plot showing + the 2D density can be a better alternative (they are smaller in size). +\end_layout + +\begin_layout Standard +The graphics manual contains more detailed information and you can check + it out in the +\begin_inset CommandInset href +LatexCommand href +name "website" +target "https://yihui.org/knitr/demo/graphics/" + +\end_inset + +. +\end_layout + +\begin_layout Subsection +Cache +\end_layout + +\begin_layout Standard +The feature of cache is not a new idea -- both +\series bold +cacheSweave +\series default + and +\series bold +weaver +\series default + have implemented it based on Sweave, with the former using +\series bold +filehash +\series default + and the latter using +\family sans +.RData +\family default + images; +\series bold +cacheSweave +\series default + also supports lazy-loading of objects based on +\series bold +filehash +\series default +. + The +\series bold +knitr +\series default + package directly uses internal base R functions to save ( +\emph on +tools:::makeLazyLoadDB() +\emph default +) and lazy-load objects ( +\emph on +lazyLoad() +\emph default +). + These functions are either undocumented or marked as internal, but as far + as I understand, they are the tools to implement lazy-loading for packages. + The +\series bold +cacheSweave +\series default + vignette has clearly explained lazy-loading, and roughly speaking, lazy-loading + means an object will not be really loaded into memory unless it is really + used somewhere. + This is very useful for cache; sometimes we read a large object and cache + it, then take a subset for analysis and this subset is also cached; in + the future, the initial large object will not be loaded into R if our computati +on is only based on the object of its subset. +\end_layout + +\begin_layout Standard +The paths of cache files are determined by the chunk option +\family typewriter +cache.path +\family default +; by default all cache files are created under a directory +\family sans +cache +\family default + relative to the current working directory, and if the option value contains + a directory (e.g. + +\family typewriter +cache.path='cache/abc-' +\family default +), cache files will be stored under that directory (automatically created + if it does not exist). + The cache is invalidated and purged on any changes to the code chunk, including + both the R code and chunk options +\begin_inset Foot +status open + +\begin_layout Plain Layout +One exception is the +\family typewriter +include +\family default + option, which is not cached because +\family typewriter +include=TRUE/FALSE +\family default + does not affect code evaluation; meanwhile, the value +\family typewriter +getOption('width') +\family default + is also cached, so if you change this option, the cache will also be invalidate +d (this option affects the width of text output) +\end_layout + +\end_inset + +; this means previous cache files of this chunk are removed (filenames are + identified by the chunk label). + Unlike +\series bold +pgfSweave +\series default +, cache files will never accumulate since old cache files will always be + removed in +\series bold +knitr +\series default +. + Unlike +\series bold +weaver +\series default + or +\series bold +cacheSweave +\series default +, +\series bold +knitr +\series default + will try to preserve these side-effects: +\end_layout + +\begin_layout Enumerate +printed results: meaning that any output of a code chunk will be loaded + into the output document for a cached chunk, although it is not really + evaluated. + The reason is +\series bold +knitr +\series default + also cache the output of a chunk as a character string. + Note this means graphics output is also cached since it is part of the + output. + It has been a pain for me for a long time to have to lose output to gain + cache; +\end_layout + +\begin_layout Enumerate +loaded packages: after the evaluation of each cached chunk, the list of + packages used in the current R session is written to a file under the cache + path named +\family sans +__packages +\family default +; next time if a cached chunk needs to be rebuilt, these packages will be + loaded first. + The reasons for caching package names are, it can be slow to load some + packages, and a package might be loaded in a previous cached chunk which + is not available to the next cached chunk when only the latter needs to + be rebuilt. + Note this only applies to cached chunks, and for uncached chunks, you must + always use +\emph on +library() +\emph default + to load packages explicitly; +\end_layout + +\begin_layout Standard +Although +\series bold +knitr +\series default + tries to keep some side-effects, there are still other types of side-effects + like setting +\emph on +par() +\emph default + or +\emph on +options() +\emph default + which are not cached. + Users should be aware of these special cases, and make sure to clearly + separate the code which is not meant to be cached to other chunks which + are not cached, e.g., set all global options in the first chunk of a document + and do not cache that chunk. +\end_layout + +\begin_layout Standard +Sometimes a cached chunk may need to use objects from other cached chunks, + which can bring a serious problem -- if objects in previous chunks have + changed, this chunk will not be aware of the changes and will still use + old cached results, unless there is a way to detect such changes from other + chunks. + There is an option called +\family typewriter +dependson +\family default + in +\series bold +cacheSweave +\series default + which does this job. + We can explicitly specify which other chunks this chunk depends on by setting + an option like +\family typewriter +dependson='chunkA;chunkB' +\family default + or equivalently +\family typewriter +dependson=c('chunkA', 'chunkB') +\family default +. + Each time the cache of a chunk is rebuilt, all other chunks which depend + on this chunk will lose cache, hence their cache will be rebuilt as well. +\end_layout + +\begin_layout Standard +Another way to specify the dependencies among chunks is to use the chunk + option +\family typewriter +autodep +\family default + and the function +\emph on +dep_auto() +\emph default +. + This is an experimental feature borrowed from +\series bold +weaver +\series default + which frees us from setting chunk dependencies manually. + The basic idea is, if a latter chunk uses any objects created from a previous + chunk, the latter chunk is said to depend on the previous one. + The function +\emph on +findGlobals() +\emph default + in the +\series bold +codetools +\series default + package is used to find out all global objects in a chunk, and according + to its documentation, the result is an approximation. + Global objects roughly mean the ones which are not created locally, e.g. + in the expression +\family typewriter +function() {y <- x} +\family default +, +\family typewriter +x +\family default + should be a global object, whereas +\family typewriter +y +\family default + is local. + Meanwhile, we also need to save the list of objects created in each cached + chunk, so that we can compare them to the global objects in latter chunks. + For example, if chunk A created an object +\family typewriter +x +\family default + and chunk B uses this object, chunk B must depend on A, i.e. + whenever A changes, B must also be updated. + When +\family typewriter +autodep=TRUE +\family default +, +\series bold +knitr +\series default + will write out the names of objects created in a cached chunk as well as + those global objects in two files named +\family sans +__objects +\family default + and +\family sans +__globals +\family default + respectively; later we can use the function +\emph on +dep_auto() +\emph default + to analyze the object names to figure out the dependencies automatically. + See +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://yihui.org/knitr/demo/cache/ +\end_layout + +\end_inset + + for examples. +\end_layout + +\begin_layout Standard +Yet another way to specify dependencies is +\emph on +dep_prev() +\emph default +: this is a conservative approach which sets the dependencies so that a + cached chunk will depend on all its previous chunks, i.e. + whenever a previous chunk is updated, all later chunks will be updated + accordingly. +\end_layout + +\begin_layout Subsection +Code Externalization +\end_layout + +\begin_layout Standard +It can be more convenient to write R code in a separate file, rather than + mixing it into a LaTeX document; for example, we can run R code successively + in a pure R script from one chunk to the other without jumping through + other texts. + Since I prefer using LyX to write reports, Sweave is even more inconvenient + because I have to recompile the whole document each time, even if I only + want to know the results of a single chunk. + Therefore +\series bold +knitr +\series default + introduced the feature of code externalization to a separate R script. + Currently the setting is like this: the R script also uses chunk labels + (marked in the form +\family typewriter +## ---- chunk-label +\family default + by default); if the code chunk in the input document is empty, +\series bold +knitr +\series default + will match its label with the label in the R script to input external R + code. + For example, suppose this is a code chunk labelled as +\family typewriter +Q1 +\family default + in an R script named +\family sans +homework1-xie.R +\family default + which is under the same directory as the Rnw document: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +## ---- Q1 --------------------- +\end_layout + +\begin_layout Plain Layout + +gcd = function(m, n) { +\end_layout + +\begin_layout Plain Layout + + while ((r <- m %% n) != 0) { +\end_layout + +\begin_layout Plain Layout + + m = n; n = r +\end_layout + +\begin_layout Plain Layout + + } +\end_layout + +\begin_layout Plain Layout + + n +\end_layout + +\begin_layout Plain Layout + +} +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +In the Rnw document, we can first read the script using the function +\emph on +read_chunk() +\emph default +: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +read_chunk('homework1-xie.R') +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +This is usually done in an early chunk, and we can use the chunk +\family typewriter +Q1 +\family default + later in the Rnw document: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +cat('<>=','@',sep=' +\backslash +n') +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Different documents can read the same R script, so the R code can be reusable + across different input documents. +\end_layout + +\begin_layout Subsection +Evaluation of Chunk Options +\begin_inset CommandInset label +LatexCommand label +name "sub:conditional" + +\end_inset + + +\end_layout + +\begin_layout Standard +By default +\series bold +knitr +\series default + uses a new syntax to parse chunk options: it treats them as function arguments + instead of a text string to be split to obtain option values. + This gives the user much more power than the old syntax; we can pass arbitrary + R objects to chunk options besides simple ones like +\family typewriter +TRUE +\family default +/ +\family typewriter +FALSE +\family default +, numbers and character strings. + The page +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://yihui.org/knitr/demo/sweave/ +\end_layout + +\end_inset + + has given two examples to show the advantages of the new syntax. + Here we show yet another useful application. +\end_layout + +\begin_layout Standard +Before +\series bold +knitr +\series default + 0.3, there was a feature named +\begin_inset Quotes eld +\end_inset + +conditional evaluation +\begin_inset Quotes erd +\end_inset + + +\begin_inset Foot +status open + +\begin_layout Plain Layout +request from +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://plus.google.com/u/0/116405544829727492615/posts/43WrRUffjzK +\end_layout + +\end_inset + + +\end_layout + +\end_inset + +. + The idea is, instead of setting chunk options +\family typewriter +eval +\family default + and +\family typewriter +echo +\family default + to be +\family typewriter +TRUE +\family default + or +\family typewriter +FALSE +\family default + (constants), their values can be controlled by global variables in the + current R session. + This enables +\series bold +knitr +\series default + to conditionally evaluate code chunks according to variables. + For example, here we assign +\family typewriter +TRUE +\family default + to a variable +\family typewriter +dothis +\family default +: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +dothis=TRUE +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +In the next chunk, we set chunk options +\family typewriter +eval=dothis +\family default + and +\family typewriter +echo=!dothis +\family default +, both are valid R expressions since the variable +\family typewriter +dothis +\family default + exists. + As we can see, the source code is hidden, but it was indeed evaluated: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +print('you cannot see my source because !dothis is FALSE') +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Then we set +\family typewriter +eval=dothis +\family default + and +\family typewriter +echo=dothis +\family default + for another chunk: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +dothis +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +If we change the value of +\family typewriter +dothis +\family default + to +\family typewriter +FALSE +\family default +, neither of the above chunks will be evaluated any more. + Therefore we can control many chunks with a single variable, and present + results selectively. +\end_layout + +\begin_layout Standard +This old feature requires +\series bold +knitr +\series default + to treat +\family typewriter +eval +\family default + and +\family typewriter +echo +\family default + specially, and we can easily see that it is no longer necessary with the + new syntax: +\family typewriter +eval=dothis +\family default + will tell R to find the variable +\family typewriter +dothis +\family default + automatically just like we call a function +\family typewriter +foobar(eval = dothis) +\family default +. + What is more, all options will be evaluated as R expressions unless they + are already constants which do not need to be evaluated, so this old feature + has been generalized to all other options naturally. +\end_layout + +\begin_layout Subsection +Customization +\end_layout + +\begin_layout Standard +The +\series bold +knitr +\series default + package is ready for customization. + Both the patterns and hooks can be customized; see the package website + for details. + Here I show an example on how to save +\series bold +rgl +\series default + plots +\begin_inset CommandInset citation +LatexCommand citep +key "R-rgl" + +\end_inset + + using a customized hook function. + First we define a hook named +\family typewriter +rgl +\family default + using the function +\emph on +hook_rgl() +\emph default + in +\series bold +rgl +\series default +: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +library(rgl) +\end_layout + +\begin_layout Plain Layout + +knit_hooks$set(rgl = hook_rgl) +\end_layout + +\begin_layout Plain Layout + +head(hook_rgl) # the hook function is defined as this +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Then we only have to set the chunk option +\family typewriter +rgl=TRUE +\family default +: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +library(rgl) +\end_layout + +\begin_layout Plain Layout + +demo('bivar', package='rgl', echo=FALSE) +\end_layout + +\begin_layout Plain Layout + +par3d(zoom=.7) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Due to the flexibility of output hooks, +\series bold +knitr +\series default + supports several different output formats. + The implementation is fairly easy, e.g., for LaTeX we put R output in +\family typewriter +verbatim +\family default + environments, and in HTML, it is only a matter of putting output in +\family typewriter +div +\family default + layers. + These are simply character string operations. + Many demos in +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://yihui.org/knitr/demo/ +\end_layout + +\end_inset + + show this idea clearly. + This manual did not cover all the features of +\series bold +knitr +\series default +, and users are encouraged to thumb through the website to know more possible + features. +\end_layout + +\begin_layout Section +Editors +\end_layout + +\begin_layout Standard +You can use any text editors to write the source documents, but some have + built-in support for +\series bold +knitr +\series default +. + Both RStudio ( +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +http://www.rstudio.org +\end_layout + +\end_inset + +) and LyX ( +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +http://www.lyx.org +\end_layout + +\end_inset + +) have full support for +\series bold +knitr +\series default +, and you can compile the document to PDF with just one click. + See +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://yihui.org/knitr/demo/rstudio/ +\end_layout + +\end_inset + + and +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://yihui.org/knitr/demo/lyx/ +\end_layout + +\end_inset + + respectively. + It is also possible to support other editors like +\begin_inset CommandInset href +LatexCommand href +name "Eclipse" +target "https://yihui.org/knitr/demo/eclipse/" + +\end_inset + +, +\begin_inset CommandInset href +LatexCommand href +name "Texmaker and WinEdt" +target "https://yihui.org/knitr/demo/editors/" + +\end_inset + +; see the demo list in the website for configuration instructions. +\end_layout + +\begin_layout Section* +About This Document +\end_layout + +\begin_layout Standard +This manual was written in LyX and compiled with +\series bold +knitr +\series default + (version +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + + +\backslash +Sexpr{packageVersion('knitr')} +\end_layout + +\end_inset + +). + The LyX source and the Rnw document exported from LyX can be found under + these directories: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +system.file('examples', 'knitr-manual.lyx', package='knitr') # lyx source +\end_layout + +\begin_layout Plain Layout + +system.file('examples', 'knitr-manual.Rnw', package='knitr') # Rnw source +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +You can use the function +\emph on +knit() +\emph default + to knit the Rnw document (remember to put the two +\family sans +.bib +\family default + files under the same directory), and you need to make sure all the R packages + used in this document are installed: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +install.packages(c('animation', 'rgl', 'tikzDevice', 'ggplot2')) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Feedback and comments on this manual and the package are always welcome. + Bug reports and feature requests can be sent to +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://github.com/yihui/knitr/issues +\end_layout + +\end_inset + +, and questions can be delivered to the +\begin_inset CommandInset href +LatexCommand href +name "mailing list" +target "knitr@googlegroups.com" +type "mailto:" + +\end_inset + + +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://groups.google.com/group/knitr +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +% when knitr is updated, this chunk will be updated; why? +\end_layout + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +# write all packages in the current session to a bib file +\end_layout + +\begin_layout Plain Layout + +write_bib(c(.packages(), 'evaluate', 'formatR', 'highr'), file = 'knitr-packages.b +ib') +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset bibtex +LatexCommand bibtex +bibfiles "knitr-manual,knitr-packages" +options "jss" + +\end_inset + + +\end_layout + +\end_body +\end_document diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-minimal.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-minimal.Rmd new file mode 100644 index 00000000..8600f943 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-minimal.Rmd @@ -0,0 +1,59 @@ +# A Minimal Example for Markdown + +This is a minimal example of using **knitr** to produce an _HTML_ page from _Markdown_. + +## R code chunks + +```{r setup} +# set global chunk options: images will be 7x5 inches +knitr::opts_chunk$set(fig.width=7, fig.height=5) +options(digits = 4) +``` + +Now we write some code chunks in this markdown file: + +```{r computing} +x <- 1+1 # a simple calculator +set.seed(123) +rnorm(5) # boring random numbers +``` + +We can also produce plots: + +```{r graphics} +par(mar = c(4, 4, .1, .1)) +with(mtcars, { + plot(mpg~hp, pch=20, col='darkgray') + lines(lowess(hp, mpg)) +}) +``` + +## Inline code + +Inline R code is also supported, e.g. the value of `x` is `r x`, and 2 × π += `r 2*pi`. + +## Math + +LaTeX math as usual: $f(\alpha, \beta) \propto x^{\alpha-1}(1-x)^{\beta-1}$. + +## Misc + +You can indent code chunks so they can nest within other environments such as lists. + +1. the area of a circle with radius x + ```{r foo} + pi * x^2 + ``` +2. OK, that is great + +To compile me, use + +```{r compile, eval=FALSE} +library(knitr) +knit('knitr-minimal.Rmd') +``` + +## Conclusion + +Markdown is super easy to write. Go to **knitr** [homepage](https://yihui.org/knitr/) for details. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-minimal.Rnw b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-minimal.Rnw new file mode 100644 index 00000000..fcd135fe --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-minimal.Rnw @@ -0,0 +1,53 @@ +%% LyX 2.2.1 created this file. For more info, see http://www.lyx.org/. +%% Do not edit unless you really know what you are doing. +\documentclass{article} +\usepackage[sc]{mathpazo} +\usepackage[T1]{fontenc} +\usepackage{geometry} +\geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=2.5cm,rmargin=2.5cm} +\setcounter{secnumdepth}{2} +\setcounter{tocdepth}{2} +\usepackage{url} +\usepackage[unicode=true,pdfusetitle, + bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=2, + breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=false] + {hyperref} +\hypersetup{ + pdfstartview={XYZ null null 1}} +\usepackage{breakurl} +\begin{document} +<>= +library(knitr) +# set global chunk options +opts_chunk$set(fig.path='figure/minimal-', fig.align='center', fig.show='hold') +options(formatR.arrow=TRUE,width=90) +@ + +\title{A Minimal Demo of knitr} + +\author{Yihui Xie} + +\maketitle +You can test if \textbf{knitr} works with this minimal demo. OK, let's +get started with some boring random numbers: + +<>= +set.seed(1121) +(x=rnorm(20)) +mean(x);var(x) +@ + +The first element of \texttt{x} is \Sexpr{x[1]}. Boring boxplots +and histograms recorded by the PDF device: + +<>= +## two plots side by side (option fig.show='hold') +par(mar=c(4,4,.1,.1),cex.lab=.95,cex.axis=.9,mgp=c(2,.7,0),tcl=-.3,las=1) +boxplot(x) +hist(x,main='') +@ + +Do the above chunks work? You should be able to compile the \TeX{} +document and get a PDF file like this one: \url{https://github.com/yihui/knitr/releases/download/doc/knitr-minimal.pdf}. +The Rnw source of this document is at \url{https://github.com/yihui/knitr/blob/master/inst/examples/knitr-minimal.Rnw}. +\end{document} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-minimal.Rrst b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-minimal.Rrst new file mode 100644 index 00000000..dc714402 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-minimal.Rrst @@ -0,0 +1 @@ +See https://github.com/yihui/knitr-examples/blob/master/006-minimal.Rrst diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-minimal.brew b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-minimal.brew new file mode 100644 index 00000000..b32b977b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-minimal.brew @@ -0,0 +1 @@ +See https://github.com/yihui/knitr-examples/blob/master/004-minimal.brew diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-minimal.lyx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-minimal.lyx new file mode 100644 index 00000000..12ee611c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-minimal.lyx @@ -0,0 +1,264 @@ +#LyX 2.0 created this file. For more info see http://www.lyx.org/ +\lyxformat 413 +\begin_document +\begin_header +\textclass article +\use_default_options true +\begin_modules +knitr +\end_modules +\maintain_unincluded_children false +\language english +\language_package none +\inputencoding default +\fontencoding global +\font_roman palatino +\font_sans default +\font_typewriter default +\font_default_family default +\use_non_tex_fonts false +\font_sc true +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 + +\graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\paperfontsize default +\spacing single +\use_hyperref true +\pdf_bookmarks true +\pdf_bookmarksnumbered true +\pdf_bookmarksopen true +\pdf_bookmarksopenlevel 2 +\pdf_breaklinks false +\pdf_pdfborder false +\pdf_colorlinks false +\pdf_backref false +\pdf_pdfusetitle true +\pdf_quoted_options "pdfstartview={XYZ null null 1}" +\papersize default +\use_geometry true +\use_amsmath 1 +\use_esint 1 +\use_mhchem 1 +\use_mathdots 1 +\cite_engine basic +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\use_refstyle 1 +\index Index +\shortcut idx +\color #008000 +\end_index +\leftmargin 2.5cm +\topmargin 2.5cm +\rightmargin 2.5cm +\bottommargin 2.5cm +\secnumdepth 2 +\tocdepth 2 +\paragraph_separation indent +\paragraph_indentation default +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\end_header + +\begin_body + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +library(knitr) +\end_layout + +\begin_layout Plain Layout + +# set global chunk options +\end_layout + +\begin_layout Plain Layout + +opts_chunk$set(fig.path='figure/minimal-', fig.align='center', fig.show='hold') +\end_layout + +\begin_layout Plain Layout + +options(formatR.arrow=TRUE,width=90) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Title +A Minimal Demo of knitr +\end_layout + +\begin_layout Author +Yihui Xie +\end_layout + +\begin_layout Standard +You can test if +\series bold +knitr +\series default + works with this minimal demo. + OK, let's get started with some boring random numbers: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +set.seed(1121) +\end_layout + +\begin_layout Plain Layout + +(x=rnorm(20)) +\end_layout + +\begin_layout Plain Layout + +mean(x);var(x) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +The first element of +\family typewriter +x +\family default + is +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + + +\backslash +Sexpr{x[1]} +\end_layout + +\end_inset + +. + Boring boxplots and histograms recorded by the PDF device: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +## two plots side by side (option fig.show='hold') +\end_layout + +\begin_layout Plain Layout + +par(mar=c(4,4,.1,.1),cex.lab=.95,cex.axis=.9,mgp=c(2,.7,0),tcl=-.3,las=1) +\end_layout + +\begin_layout Plain Layout + +boxplot(x) +\end_layout + +\begin_layout Plain Layout + +hist(x,main='') +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Do the above chunks work? You should be able to compile the TeX document + and get a PDF file like this one: +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://github.com/yihui/knitr/releases/download/doc/knitr-minimal.pdf +\end_layout + +\end_inset + +. + The Rnw source of this document is at +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://github.com/yihui/knitr/blob/master/inst/examples/knitr-minimal.Rnw +\end_layout + +\end_inset + +. +\end_layout + +\end_body +\end_document diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-spin.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-spin.R new file mode 100644 index 00000000..ae837d5d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-spin.R @@ -0,0 +1,50 @@ +#' This is a special R script which can be used to generate a report. You can +#' write normal text in roxygen comments. +#' +#' First we set up some options (you do not have to do this): + +#+ setup, include=FALSE +knitr::opts_chunk$set(collapse = TRUE) + +#' The report begins here. + +#+ test-a, cache=FALSE +# boring examples as usual +set.seed(123) +x = rnorm(5) +mean(x) + +#' You can use the special syntax {{code}} to embed inline expressions, e.g. +{{mean(x) + 2}} +#' is the mean of x plus 2. +#' The code itself may contain braces, but these are not checked. Thus, +#' perfectly valid (though very strange) R code such as `{{2 + 3}} - {{4 - 5}}` +#' can lead to errors because `2 + 3}} - {{4 - 5` will be treated as inline code. +#' +#' Now we continue writing the report. We can draw plots as well. + +#+ test-b, fig.width=5, fig.height=5 +par(mar = c(4, 4, .1, .1)); plot(x) + +#' Actually you do not have to write chunk options, in which case knitr will use +#' default options. For example, the code below has no options attached: + +var(x) +quantile(x) + +#' And you can also write two chunks successively like this: + +#+ test-chisq5 +sum(x^2) # chi-square distribution with df 5 +#+ test-chisq4 +sum((x - mean(x))^2) # df is 4 now + +#' Done. Call spin('knitr-spin.R') to make silk from sow's ear now and knit a +#' lovely purse. + +# /* you can write comments between /* and */ like C comments (the preceding # +# is optional) +Sys.sleep(60) +# */ + +# /* there is no inline comment; you have to write block comments */ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-spin.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-spin.Rmd new file mode 100644 index 00000000..8a1d0a61 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-spin.Rmd @@ -0,0 +1,51 @@ +This is a special R script which can be used to generate a report. You can +write normal text in roxygen comments. + +First we set up some options (you do not have to do this): + +```{r setup, include=FALSE} +library(knitr) +opts_chunk$set(fig.path = 'figure/silk-') +``` + +The report begins here. + +```{r test-a, cache=FALSE} +# boring examples as usual +set.seed(123) +x = rnorm(5) +mean(x) +``` + +You can use the special syntax {{code}} to embed inline expressions, e.g. +`r mean(x) + 2` +is the mean of x plus 2. +The code itself may contain braces, but these are not checked. Thus, +perfectly valid (though very strange) R code such as `{{2 + 3}} - {{4 - 5}}` +can lead to errors because `2 + 3}} - {{4 - 5` will be treated as inline code. + +Now we continue writing the report. We can draw plots as well. + +```{r test-b, fig.width=5, fig.height=5} +par(mar = c(4, 4, .1, .1)); plot(x) +``` + +Actually you do not have to write chunk options, in which case knitr will use +default options. For example, the code below has no options attached: + +```{r } +var(x) +quantile(x) +``` + +And you can also write two chunks successively like this: + +```{r test-chisq5} +sum(x^2) # chi-square distribution with df 5 +``` +```{r test-chisq4} +sum((x - mean(x))^2) # df is 4 now +``` + +Done. Call spin('knitr-spin.R') to make silk from sow's ear now and knit a +lovely purse. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-subfloats.Rnw b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-subfloats.Rnw new file mode 100644 index 00000000..0bb12891 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-subfloats.Rnw @@ -0,0 +1,71 @@ +%% LyX 2.2.1 created this file. For more info, see http://www.lyx.org/. +%% Do not edit unless you really know what you are doing. +\documentclass{article} +\usepackage[T1]{fontenc} +\usepackage[latin9]{inputenc} +\usepackage{url} + +\makeatletter + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands. +\providecommand{\LyX}{L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands. +\renewcommand{\textfraction}{0.05} +\renewcommand{\topfraction}{0.8} +\renewcommand{\bottomfraction}{0.8} +\renewcommand{\floatpagefraction}{0.75} + +\@ifundefined{showcaptionsetup}{}{% + \PassOptionsToPackage{caption=false}{subfig}} +\usepackage{subfig} +\makeatother + +\begin{document} +<>= +library(knitr) +opts_chunk$set(fig.path='figure/subfloats-') +@ + +\title{Using subfloats in \LyX{} with knitr} + +\author{Yihui Xie} + +\maketitle +If you insert a float figure inside a float figure in \LyX{}, you +will get subfloats. To make sure the two subfloats can stand side +by side, you have to: +\begin{enumerate} +\item remove new lines between the two subfloat environments in \LyX{} +(if you are not sure if there are blank lines between them, check +the \LaTeX{} source); +\item use the chunk option \texttt{echo=FALSE} to hide the R source code +in the output; +\item set \texttt{out.width} to be less than half of the linewidth if you +do not want the sub figures to exceed the page margin; +\item most importantly, leave a blank line in the beginning of the subfloat +environment, so that \texttt{<\textcompwordmark{}<>\textcompwordmark{}>=} +starts in a new line and \textbf{knitr} can recognize it; +\end{enumerate} +Figure \ref{fig:knitr-subfloat} is an example. + +This document was compiled with \textbf{knitr} \Sexpr{packageVersion('knitr')}. +Rnw source at \url{https://github.com/yihui/knitr/blob/master/inst/examples/knitr-subfloats.Rnw}. + +\begin{figure} +\subfloat[this is a subfloat]{ +<>= +plot(1) +@ + +}\subfloat[another float]{ +<>= +plot(rnorm(100)) +@ + +} + +\caption{one figure with 2 sub figures\label{fig:knitr-subfloat}} +\end{figure} + +\end{document} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-subfloats.lyx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-subfloats.lyx new file mode 100644 index 00000000..e1d2e751 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-subfloats.lyx @@ -0,0 +1,332 @@ +#LyX 2.0 created this file. For more info see http://www.lyx.org/ +\lyxformat 413 +\begin_document +\begin_header +\textclass article +\begin_preamble +\renewcommand{\textfraction}{0.05} +\renewcommand{\topfraction}{0.8} +\renewcommand{\bottomfraction}{0.8} +\renewcommand{\floatpagefraction}{0.75} +\end_preamble +\use_default_options true +\begin_modules +knitr +\end_modules +\maintain_unincluded_children false +\language english +\language_package default +\inputencoding auto +\fontencoding global +\font_roman default +\font_sans default +\font_typewriter default +\font_default_family default +\use_non_tex_fonts false +\font_sc false +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 + +\graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\paperfontsize default +\spacing single +\use_hyperref false +\papersize default +\use_geometry false +\use_amsmath 1 +\use_esint 1 +\use_mhchem 1 +\use_mathdots 1 +\cite_engine basic +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\use_refstyle 1 +\index Index +\shortcut idx +\color #008000 +\end_index +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\paragraph_indentation default +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\end_header + +\begin_body + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +library(knitr) +\end_layout + +\begin_layout Plain Layout + +opts_chunk$set(fig.path='figure/subfloats-') +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Title +Using subfloats in LyX with knitr +\end_layout + +\begin_layout Author +Yihui Xie +\end_layout + +\begin_layout Standard +If you insert a float figure inside a float figure in LyX, you will get + subfloats. + To make sure the two subfloats can stand side by side, you have to: +\end_layout + +\begin_layout Enumerate +remove new lines between the two subfloat environments in LyX (if you are + not sure if there are blank lines between them, check the LaTeX source); +\end_layout + +\begin_layout Enumerate +use the chunk option +\family typewriter +echo=FALSE +\family default + to hide the R source code in the output; +\end_layout + +\begin_layout Enumerate +set +\family typewriter +out.width +\family default + to be less than half of the linewidth if you do not want the sub figures + to exceed the page margin; +\end_layout + +\begin_layout Enumerate +most importantly, leave a blank line in the beginning of the subfloat environmen +t, so that +\family typewriter +<<>>= +\family default + starts in a new line and +\series bold +knitr +\series default + can recognize it; +\end_layout + +\begin_layout Standard +Figure +\begin_inset CommandInset ref +LatexCommand ref +reference "fig:knitr-subfloat" + +\end_inset + + is an example. +\end_layout + +\begin_layout Standard +This document was compiled with +\series bold +knitr +\series default + +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +Sexpr{packageVersion('knitr')} +\end_layout + +\end_inset + +. + Rnw source at +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://github.com/yihui/knitr/blob/master/inst/examples/knitr-subfloats.Rnw +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Standard +\begin_inset Float figure +wide false +sideways false +status open + +\begin_layout Plain Layout +\begin_inset Float figure +wide false +sideways false +status open + +\begin_layout Plain Layout +\begin_inset ERT +status open + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +plot(1) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Plain Layout +\begin_inset Caption + +\begin_layout Plain Layout +this is a subfloat +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset Float figure +wide false +sideways false +status open + +\begin_layout Plain Layout +\begin_inset ERT +status open + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +plot(rnorm(100)) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Plain Layout +\begin_inset Caption + +\begin_layout Plain Layout +another float +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Plain Layout +\begin_inset Caption + +\begin_layout Plain Layout +one figure with 2 sub figures +\begin_inset CommandInset label +LatexCommand label +name "fig:knitr-subfloat" + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\end_body +\end_document diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-themes.Rnw b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-themes.Rnw new file mode 100644 index 00000000..496e296c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-themes.Rnw @@ -0,0 +1,126 @@ +%% LyX 2.2.1 created this file. For more info, see http://www.lyx.org/. +%% Do not edit unless you really know what you are doing. +\documentclass[nohyper,justified]{tufte-handout} +\usepackage[T1]{fontenc} +\usepackage{url} + +\makeatletter + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands. + +\title{Customizing Syntax Highlighting Themes} +\author{Yihui Xie \& Ramnath Vaidyanathan} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands. +\renewcommand{\textfraction}{0.05} +\renewcommand{\topfraction}{0.8} +\renewcommand{\bottomfraction}{0.8} +\renewcommand{\floatpagefraction}{0.75} + +\usepackage[breaklinks=true,pdfstartview=FitH]{hyperref} + +\makeatother + +\begin{document} +<>= +library(knitr) +opts_chunk$set(fig.path='figure/theme-', cache.path='cache/theme-', cache=TRUE) +options(formatR.arrow=TRUE,width=78) +knit_hooks$set(par=function(before, options, envir){if (before) par(mar=c(4,4,.1,.1),cex.lab=.95,cex.axis=.9,mgp=c(2,.7,0),tcl=-.3)}) +@ +<>= +thm = knit_theme$get("solarized-dark") +knit_theme$set(thm) +@ +\maketitle +\begin{abstract} +This manual\footnote{source code at \url{https://github.com/yihui/knitr/blob/master/inst/examples/knitr-themes.Rnw}} +shows how to customize syntax highlighting of source code using themes. +It walks the user through the basics of syntax highlighting in \textbf{knitr}, +and the use of built-in themes. +\end{abstract} +The \textbf{knitr} package uses the \textbf{highr} package to highlight +source code in a document. In short, the \textbf{highr} package parses +the source code, tokenizes it into grammar symbols, and formats their +appearance using CSS or \LaTeX{} commands. + +\section{Usage} + +We can use the object \texttt{knit\_theme} to set / get a theme. See +\texttt{?knit\_theme} for the usage. For example, we set the theme +of this document to be \texttt{solarized-dark}: + +<>= +@ + +\section{Built-in Themes} + +\begin{margintable} +<>= +cat(c(readLines('../themes/edit-eclipse.css', n=30),'...'),sep='\n') +@ +\end{margintable} + +The listing on the right shows the CSS file for one of the themes, +\texttt{edit-eclipse}, which was adapted from Andre Simon's excellent +highlighter\footnote{\url{http://www.andre-simon.de/}}. The \textbf{knitr} +package comes pre-loaded with a number of themes based on this highlighter. +Here is list of all available code themes\footnote{For a preview of all themes, see \url{https://gist.github.com/yihui/3422133}}: + +<>= +knit_theme$get() +@ + +Shown below is how the \texttt{solarized-dark} theme looks like when +applied to R code: + +<>= +library(XML) +library(plyr) +library(reshape) +# SCRAPE THE DATA FROM WEB + +base_url = "http://www.mlsoccer.com/stats/%s/reg" +years = 1996:2010 +options(width = 40) + +#' Function to save data for each year +save_data = function(y){ + url = sprintf(base_url, y) + tab = readHTMLTable(url, header = FALSE, stringsAsFactors = FALSE); + pos = max(grep("United", tab)); + tab = tab[[pos]]; + tab$year = y; + return(tab) +} + +team.list = llply(years, save_data); +mls = merge_recurse(team.list); +@ + +\section{Misc} + +One thing to consider is the foreground color of plots when we use +dark themes; we need to make it lighter, otherwise the graphical elements +will be difficult to be read. We can access the foreground color of +the theme in the list returned by \texttt{knit\_theme\$get(theme)}, +e.g., for this document: + +<>= +## the object thm is from the first chunk +thm$foreground # foreground color +thm$background # background color +@ + +When we make plots, we may use these colors, e.g. + +<>= +## can design a chunk hook to set foreground color automatically +fgcolor=thm$foreground +par(fg=fgcolor, col.axis=fgcolor, col.lab=fgcolor) +plot(rnorm(100),pch=19) +@ + +Of course, we do not need to worry about these colors when we use +a white background for the plots. +\end{document} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-themes.lyx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-themes.lyx new file mode 100644 index 00000000..c5787be0 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-themes.lyx @@ -0,0 +1,610 @@ +#LyX 2.1 created this file. For more info see http://www.lyx.org/ +\lyxformat 474 +\begin_document +\begin_header +\textclass tufte-handout +\begin_preamble +\renewcommand{\textfraction}{0.05} +\renewcommand{\topfraction}{0.8} +\renewcommand{\bottomfraction}{0.8} +\renewcommand{\floatpagefraction}{0.75} + +\usepackage[breaklinks=true,pdfstartview=FitH]{hyperref} +\end_preamble +\options justified +\use_default_options true +\begin_modules +knitr +\end_modules +\maintain_unincluded_children false +\language english +\language_package none +\inputencoding default +\fontencoding global +\font_roman default +\font_sans default +\font_typewriter default +\font_math auto +\font_default_family default +\use_non_tex_fonts false +\font_sc false +\font_osf false +\font_sf_scale 100 +\font_tt_scale 88 +\graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\paperfontsize default +\spacing single +\use_hyperref false +\pdf_author "Ramnath Vaidyanathan" +\pdf_bookmarks true +\pdf_bookmarksnumbered true +\pdf_bookmarksopen true +\pdf_bookmarksopenlevel 1 +\pdf_breaklinks false +\pdf_pdfborder true +\pdf_colorlinks true +\pdf_backref false +\pdf_pdfusetitle true +\pdf_quoted_options "citecolor = blue, linkcolor = magenta, urlcolor = green" +\papersize default +\use_geometry true +\use_package amsmath 1 +\use_package amssymb 1 +\use_package cancel 1 +\use_package esint 1 +\use_package mathdots 1 +\use_package mathtools 1 +\use_package mhchem 1 +\use_package stackrel 1 +\use_package stmaryrd 1 +\use_package undertilde 1 +\cite_engine basic +\cite_engine_type default +\biblio_style plain +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\justification true +\use_refstyle 0 +\index Index +\shortcut idx +\color #008000 +\end_index +\leftmargin 1in +\topmargin 1in +\rightmargin 1in +\bottommargin 1in +\secnumdepth 2 +\tocdepth 2 +\paragraph_separation indent +\paragraph_indentation default +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\end_header + +\begin_body + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +library(knitr) +\end_layout + +\begin_layout Plain Layout + +opts_chunk$set(fig.path='figure/theme-', cache.path='cache/theme-', cache=TRUE) +\end_layout + +\begin_layout Plain Layout + +options(formatR.arrow=TRUE,width=78) +\end_layout + +\begin_layout Plain Layout + +knit_hooks$set(par=function(before, options, envir){if (before) par(mar=c(4,4,.1,. +1),cex.lab=.95,cex.axis=.9,mgp=c(2,.7,0),tcl=-.3)}) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +thm = knit_theme$get("solarized-dark") +\end_layout + +\begin_layout Plain Layout + +knit_theme$set(thm) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Title +Customizing Syntax Highlighting Themes +\end_layout + +\begin_layout Author +Yihui Xie & Ramnath Vaidyanathan +\end_layout + +\begin_layout Abstract +This manual +\begin_inset Foot +status open + +\begin_layout Plain Layout +source code at +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://github.com/yihui/knitr/blob/master/inst/examples/knitr-themes.Rnw +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + shows how to customize syntax highlighting of source code using themes. + It walks the user through the basics of syntax highlighting in +\series bold +knitr +\series default +, and the use of built-in themes. +\end_layout + +\begin_layout Standard +The +\series bold +knitr +\series default + package uses the +\series bold +highr +\series default + package to highlight source code in a document. + In short, the +\series bold +highr +\series default + package parses the source code, tokenizes it into grammar symbols, and + formats their appearance using CSS or LaTeX commands. + +\end_layout + +\begin_layout Section +Usage +\end_layout + +\begin_layout Standard +We can use the object +\family typewriter +knit_theme +\family default + to set / get a theme. + See +\family typewriter +?knit_theme +\family default + for the usage. + For example, we set the theme of this document to be +\family typewriter +solarized-dark +\family default +: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Section +Built-in Themes +\end_layout + +\begin_layout Standard +\begin_inset Float margintable +wide false +sideways false +status open + +\begin_layout Plain Layout +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +cat(c(readLines('../themes/edit-eclipse.css', n=30),'...'),sep=' +\backslash +n') +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +The listing on the right shows the CSS file for one of the themes, +\family typewriter +edit-eclipse +\family default +, which was adapted from Andre Simon's excellent highlighter +\begin_inset Foot +status open + +\begin_layout Plain Layout +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +http://www.andre-simon.de/ +\end_layout + +\end_inset + + +\end_layout + +\end_inset + +. + The +\series bold +knitr +\series default + package comes pre-loaded with a number of themes based on this highlighter. + Here is list of all available code themes +\begin_inset Foot +status open + +\begin_layout Plain Layout +For a preview of all themes, see +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://gist.github.com/yihui/3422133 +\end_layout + +\end_inset + + +\end_layout + +\end_inset + +: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +knit_theme$get() +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Shown below is how the +\family typewriter +solarized-dark +\family default + theme looks like when applied to R code: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +library(XML) +\end_layout + +\begin_layout Plain Layout + +library(plyr) +\end_layout + +\begin_layout Plain Layout + +library(reshape) +\end_layout + +\begin_layout Plain Layout + +# SCRAPE THE DATA FROM WEB +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + +base_url = "http://www.mlsoccer.com/stats/%s/reg" +\end_layout + +\begin_layout Plain Layout + +years = 1996:2010 +\end_layout + +\begin_layout Plain Layout + +options(width = 40) +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + +#' Function to save data for each year +\end_layout + +\begin_layout Plain Layout + +save_data = function(y){ +\end_layout + +\begin_layout Plain Layout + + url = sprintf(base_url, y) +\end_layout + +\begin_layout Plain Layout + + tab = readHTMLTable(url, header = FALSE, stringsAsFactors = FALSE); +\end_layout + +\begin_layout Plain Layout + + pos = max(grep("United", tab)); +\end_layout + +\begin_layout Plain Layout + + tab = tab[[pos]]; +\end_layout + +\begin_layout Plain Layout + + tab$year = y; +\end_layout + +\begin_layout Plain Layout + + return(tab) +\end_layout + +\begin_layout Plain Layout + +} +\end_layout + +\begin_layout Plain Layout + + +\end_layout + +\begin_layout Plain Layout + +team.list = llply(years, save_data); +\end_layout + +\begin_layout Plain Layout + +mls = merge_recurse(team.list); +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Section +Misc +\end_layout + +\begin_layout Standard +One thing to consider is the foreground color of plots when we use dark + themes; we need to make it lighter, otherwise the graphical elements will + be difficult to be read. + We can access the foreground color of the theme in the list returned by + +\family typewriter +knit_theme$get(theme) +\family default +, e.g., for this document: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +## the object thm is from the first chunk +\end_layout + +\begin_layout Plain Layout + +thm$foreground # foreground color +\end_layout + +\begin_layout Plain Layout + +thm$background # background color +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +When we make plots, we may use these colors, e.g. +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +## can design a chunk hook to set foreground color automatically +\end_layout + +\begin_layout Plain Layout + +fgcolor=thm$foreground +\end_layout + +\begin_layout Plain Layout + +par(fg=fgcolor, col.axis=fgcolor, col.lab=fgcolor) +\end_layout + +\begin_layout Plain Layout + +plot(rnorm(100),pch=19) +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Of course, we do not need to worry about these colors when we use a white + background for the plots. +\end_layout + +\end_body +\end_document diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-twocolumn.Rnw b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-twocolumn.Rnw new file mode 100644 index 00000000..61fe4985 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-twocolumn.Rnw @@ -0,0 +1,65 @@ +%% LyX 2.2.1 created this file. For more info, see http://www.lyx.org/. +%% Do not edit unless you really know what you are doing. +\documentclass[twocolumn]{article} +\usepackage[sc]{mathpazo} +\usepackage[T1]{fontenc} +\usepackage{geometry} +\geometry{verbose,tmargin=3cm,bmargin=3cm,lmargin=3cm,rmargin=3cm} +\setcounter{secnumdepth}{2} +\setcounter{tocdepth}{2} +\setlength{\parskip}{\bigskipamount} +\setlength{\parindent}{0pt} +\usepackage{url} +\usepackage[unicode=true,pdfusetitle, + bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=2, + breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=false] + {hyperref} +\hypersetup{ + pdfstartview={XYZ null null 1}} +\usepackage{breakurl} + +\makeatletter +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands. +\renewcommand{\textfraction}{0.05} +\renewcommand{\topfraction}{0.8} +\renewcommand{\bottomfraction}{0.8} +\renewcommand{\floatpagefraction}{0.75} + +\makeatother + +\begin{document} +<>= +library(knitr) +opts_chunk$set(fig.path='figure/twocolumn-', fig.align='center', fig.show='hold') +render_listings() +@ + +\title{Using knitr in A Two-column Document} + +\author{Yihui Xie} + +\maketitle +We can use the \texttt{figure{*}} environment in \LaTeX{} so that +figures can span over two columns. Because the output hooks use the +\textbf{framed} package which does not work well with the \texttt{figure{*}} +environment, we can either modify the output hooks or use other packages +like \textbf{listings}. For example, + +<>= +<> +@ + +\begin{figure*} +<>= +x=rnorm(100) +par(mar=c(4,4,.1,.1)) +boxplot(x) +hist(x,main='') +@ + +\caption{Two plots spanning over two columns.} +\end{figure*} + +The output PDF file will be like: \url{https://github.com/yihui/knitr/releases/download/doc/knitr-twocolumn.pdf}. +The Rnw source of this document is at \url{https://github.com/yihui/knitr/blob/master/inst/examples/knitr-twocolumn.Rnw}. +\end{document} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-twocolumn.lyx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-twocolumn.lyx new file mode 100644 index 00000000..da5de358 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/examples/knitr-twocolumn.lyx @@ -0,0 +1,269 @@ +#LyX 2.0 created this file. For more info see http://www.lyx.org/ +\lyxformat 413 +\begin_document +\begin_header +\textclass article +\begin_preamble +\renewcommand{\textfraction}{0.05} +\renewcommand{\topfraction}{0.8} +\renewcommand{\bottomfraction}{0.8} +\renewcommand{\floatpagefraction}{0.75} +\end_preamble +\use_default_options true +\begin_modules +knitr +\end_modules +\maintain_unincluded_children false +\language english +\language_package none +\inputencoding default +\fontencoding global +\font_roman palatino +\font_sans default +\font_typewriter default +\font_default_family default +\use_non_tex_fonts false +\font_sc true +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 + +\graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\paperfontsize default +\spacing single +\use_hyperref true +\pdf_bookmarks true +\pdf_bookmarksnumbered true +\pdf_bookmarksopen true +\pdf_bookmarksopenlevel 2 +\pdf_breaklinks false +\pdf_pdfborder false +\pdf_colorlinks false +\pdf_backref false +\pdf_pdfusetitle true +\pdf_quoted_options "pdfstartview={XYZ null null 1}" +\papersize default +\use_geometry true +\use_amsmath 1 +\use_esint 1 +\use_mhchem 1 +\use_mathdots 1 +\cite_engine basic +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\use_refstyle 1 +\index Index +\shortcut idx +\color #008000 +\end_index +\leftmargin 3cm +\topmargin 3cm +\rightmargin 3cm +\bottommargin 3cm +\secnumdepth 2 +\tocdepth 2 +\paragraph_separation skip +\defskip bigskip +\quotes_language english +\papercolumns 2 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\end_header + +\begin_body + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +library(knitr) +\end_layout + +\begin_layout Plain Layout + +opts_chunk$set(fig.path='figure/twocolumn-', fig.align='center', fig.show='hold') +\end_layout + +\begin_layout Plain Layout + +render_listings() +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Title +Using knitr in A Two-column Document +\end_layout + +\begin_layout Author +Yihui Xie +\end_layout + +\begin_layout Standard +We can use the +\family typewriter +figure* +\family default + environment in LaTeX so that figures can span over two columns. + Because the output hooks use the +\series bold +framed +\series default + package which does not work well with the +\family typewriter +figure* +\family default + environment, we can either modify the output hooks or use other packages + like +\series bold +listings +\series default +. + For example, +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +<> +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Float figure +wide true +sideways false +status open + +\begin_layout Plain Layout +\begin_inset ERT +status open + +\begin_layout Plain Layout + +<>= +\end_layout + +\begin_layout Plain Layout + +x=rnorm(100) +\end_layout + +\begin_layout Plain Layout + +par(mar=c(4,4,.1,.1)) +\end_layout + +\begin_layout Plain Layout + +boxplot(x) +\end_layout + +\begin_layout Plain Layout + +hist(x,main='') +\end_layout + +\begin_layout Plain Layout + +@ +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Plain Layout +\begin_inset Caption + +\begin_layout Plain Layout +Two plots spanning over two columns. +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +The output PDF file will be like: +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://github.com/yihui/knitr/releases/download/doc/knitr-twocolumn.pdf +\end_layout + +\end_inset + +. + The Rnw source of this document is at +\begin_inset Flex URL +status collapsed + +\begin_layout Plain Layout + +https://github.com/yihui/knitr/blob/master/inst/examples/knitr-twocolumn.Rnw +\end_layout + +\end_inset + +. +\end_layout + +\end_body +\end_document diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/help/AnIndex new file mode 100644 index 00000000..09c05a06 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/help/AnIndex @@ -0,0 +1,133 @@ +knitr-package knitr-package +all_labels all_labels +all_patterns all_patterns +all_rcpp_labels all_labels +asis_output asis_output +cache_engines cache_engines +clean_cache clean_cache +combine_words combine_words +convert_chunk_header convert_chunk_header +current_input current_input +dep_auto dep_auto +dep_prev dep_prev +download_image download_image +engine_output engine_output +extract_raw_output raw_output +fig_chunk fig_chunk +fig_path fig_path +hooks_asciidoc output_hooks +hooks_html output_hooks +hooks_jekyll output_hooks +hooks_latex output_hooks +hooks_listings output_hooks +hooks_markdown output_hooks +hooks_rst output_hooks +hooks_sweave output_hooks +hooks_textile output_hooks +hook_ffmpeg_html hook_animation +hook_gifski hook_animation +hook_mogrify chunk_hook +hook_movecode hook_document +hook_optipng chunk_hook +hook_pdfcrop chunk_hook +hook_plot_asciidoc hook_plot +hook_plot_custom chunk_hook +hook_plot_html hook_plot +hook_plot_md hook_plot +hook_plot_rst hook_plot +hook_plot_tex hook_plot +hook_plot_textile hook_plot +hook_pngquant chunk_hook +hook_purl chunk_hook +hook_r2swf hook_animation +hook_scianimator hook_animation +image_uri image_uri +imgur_upload imgur_upload +include_app include_url +include_graphics include_graphics +include_url include_url +inline_expr inline_expr +is_html_output output_type +is_latex_output output_type +is_low_change is_low_change +kable kable +kables kable +knit knit +knit2html knit2html +knit2pandoc knit2pandoc +knit2pdf knit2pdf +knit2wp knit2wp +knitr knitr-package +knit_child knit_child +knit_code knit_code +knit_engines knit_engines +knit_exit knit_exit +knit_expand knit_expand +knit_filter knit_filter +knit_global knit_global +knit_hooks knit_hooks +knit_meta knit_meta +knit_meta_add knit_meta +knit_params knit_params +knit_params_yaml knit_params_yaml +knit_patterns knit_patterns +knit_print knit_print +knit_rd knit_rd +knit_rd_all knit_rd +knit_theme knit_theme +knit_watch knit_watch +load_cache load_cache +normal_print knit_print +opts_chunk opts_chunk +opts_current opts_chunk +opts_hooks opts_hooks +opts_knit opts_knit +opts_template opts_template +pandoc pandoc +pandoc_from output_type +pandoc_to output_type +partition_chunk partition_chunk +pat_asciidoc pat_fun +pat_brew pat_fun +pat_html pat_fun +pat_md pat_fun +pat_rnw pat_fun +pat_rst pat_fun +pat_tex pat_fun +pat_textile pat_fun +plot_crop plot_crop +purl knit +rand_seed rand_seed +raw_block raw_block +raw_html raw_block +raw_latex raw_block +raw_output raw_output +read_chunk read_chunk +read_demo read_chunk +read_rforge read_rforge +render_asciidoc output_hooks +render_html output_hooks +render_jekyll output_hooks +render_latex output_hooks +render_listings output_hooks +render_markdown output_hooks +render_rst output_hooks +render_sweave output_hooks +render_textile output_hooks +restore_raw_output raw_output +rnw2pdf rnw2pdf +rocco rocco +rst2pdf rst2pdf +set_alias set_alias +set_header set_header +set_parent set_parent +sew sew +spin spin +spin_child spin_child +stitch stitch +stitch_rhtml stitch +stitch_rmd stitch +Sweave2knitr Sweave2knitr +vignette_engines vignette_engines +wrap_rmd wrap_rmd +write_bib write_bib diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/help/aliases.rds new file mode 100644 index 00000000..d63c5e51 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/help/knitr.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/help/knitr.rdb new file mode 100644 index 00000000..8c17a3c1 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/help/knitr.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/help/knitr.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/help/knitr.rdx new file mode 100644 index 00000000..737ce0ee Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/help/knitr.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/help/paths.rds new file mode 100644 index 00000000..7682a7f6 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/html/00Index.html new file mode 100644 index 00000000..a7bd4552 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/html/00Index.html @@ -0,0 +1,390 @@ + + +R: A General-Purpose Package for Dynamic Report Generation in R + + + +
+

A General-Purpose Package for Dynamic Report Generation in R + +

+
+
+[Up] +[Top] +

Documentation for package ‘knitr’ version 1.49

+ + + +

Help Pages

+ + +

+ +A +C +D +E +F +H +I +K +L +N +O +P +R +S +V +W +

+ + + + +
knitr-packageA general-purpose tool for dynamic report generation in R
+ +

-- A --

+ + + + + + + + + + +
all_labelsGet all chunk labels in a document
all_patternsAll built-in patterns
all_rcpp_labelsGet all chunk labels in a document
asis_outputMark an R object with a special class
+ +

-- C --

+ + + + + + + + + + + + +
cache_enginesCache engines of other languages
clean_cacheClean cache files that are probably no longer needed
combine_wordsCombine multiple words into a single string
convert_chunk_headerConvert the in-header chunk option syntax to the in-body syntax
current_inputQuery the current input filename
+ +

-- D --

+ + + + + + + + +
dep_autoBuild automatic dependencies among chunks
dep_prevMake later chunks depend on previous chunks
download_imageDownload an image from the web and include it in a document
+ +

-- E --

+ + + + + + +
engine_outputAn output wrapper for language engine output
extract_raw_outputMark character strings as raw output that should not be converted
+ +

-- F --

+ + + + + + +
fig_chunkObtain the figure filenames for a chunk
fig_pathPath for figure files
+ +

-- H --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
hooks_asciidocSet or get output hooks for different output formats
hooks_htmlSet or get output hooks for different output formats
hooks_jekyllSet or get output hooks for different output formats
hooks_latexSet or get output hooks for different output formats
hooks_listingsSet or get output hooks for different output formats
hooks_markdownSet or get output hooks for different output formats
hooks_rstSet or get output hooks for different output formats
hooks_sweaveSet or get output hooks for different output formats
hooks_textileSet or get output hooks for different output formats
hook_ffmpeg_htmlHooks to create animations in HTML output
hook_gifskiHooks to create animations in HTML output
hook_mogrifyBuilt-in chunk hooks to extend knitr
hook_movecodeSome potentially useful document hooks
hook_optipngBuilt-in chunk hooks to extend knitr
hook_pdfcropBuilt-in chunk hooks to extend knitr
hook_plot_asciidocDefault plot hooks for different output formats
hook_plot_customBuilt-in chunk hooks to extend knitr
hook_plot_htmlDefault plot hooks for different output formats
hook_plot_mdDefault plot hooks for different output formats
hook_plot_rstDefault plot hooks for different output formats
hook_plot_texDefault plot hooks for different output formats
hook_plot_textileDefault plot hooks for different output formats
hook_pngquantBuilt-in chunk hooks to extend knitr
hook_purlBuilt-in chunk hooks to extend knitr
hook_r2swfHooks to create animations in HTML output
hook_scianimatorHooks to create animations in HTML output
+ +

-- I --

+ + + + + + + + + + + + + + + + + + +
image_uriEncode an image file to a data URI
include_appEmbed a URL as an HTML iframe or a screenshot in 'knitr' documents
include_graphicsEmbed external images in 'knitr' documents
include_urlEmbed a URL as an HTML iframe or a screenshot in 'knitr' documents
inline_exprWrap code using the inline R expression syntax
is_html_outputCheck the current input and output type
is_latex_outputCheck the current input and output type
is_low_changeCompare two recorded plots
+ +

-- K --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
kableCreate tables in LaTeX, HTML, Markdown and reStructuredText
kablesCreate tables in LaTeX, HTML, Markdown and reStructuredText
knitKnit a document
knit2htmlConvert markdown to HTML using knit() and mark_html()
knit2pandocConvert various input files to various output files using 'knit()' and Pandoc
knit2pdfConvert Rnw or Rrst files to PDF
knit2wpKnit an R Markdown document and post it to WordPress
knitrA general-purpose tool for dynamic report generation in R
knit_childKnit a child document
knit_codeThe code manager to manage code in all chunks
knit_enginesEngines of other languages
knit_exitExit knitting early
knit_expandA simple macro preprocessor for templating purposes
knit_filterSpell check filter for source documents
knit_globalThe global environment for evaluating code
knit_hooksHooks for R code chunks, inline R code and output
knit_metaMetadata about objects to be printed
knit_meta_addMetadata about objects to be printed
knit_paramsExtract knit parameters from a document
knit_params_yamlExtract knit parameters from YAML text
knit_patternsPatterns to match and extract R code in a document
knit_printA custom printing function
knit_rdKnit package documentation
knit_rd_allKnit package documentation
knit_themeSyntax highlighting themes
knit_watchWatch an input file continuously and knit it when it is updated
+ +

-- L --

+ + + + +
load_cacheLoad the cache database of a code chunk
+ +

-- N --

+ + + + +
normal_printA custom printing function
+ +

-- O --

+ + + + + + + + + + + + +
opts_chunkDefault and current chunk options
opts_currentDefault and current chunk options
opts_hooksHooks for code chunk options
opts_knitOptions for the knitr package
opts_templateTemplate for creating reusable chunk options
+ +

-- P --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
pandocA Pandoc wrapper to convert documents to other formats
pandoc_fromCheck the current input and output type
pandoc_toCheck the current input and output type
pat_asciidocSet regular expressions to read input documents
pat_brewSet regular expressions to read input documents
pat_htmlSet regular expressions to read input documents
pat_mdSet regular expressions to read input documents
pat_rnwSet regular expressions to read input documents
pat_rstSet regular expressions to read input documents
pat_texSet regular expressions to read input documents
pat_textileSet regular expressions to read input documents
plot_cropCrop a plot (remove the edges) using PDFCrop or ImageMagick
purlKnit a document
+ +

-- R --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
rand_seedAn unevaluated expression to return .Random.seed if exists
raw_blockMark character strings as raw blocks in R Markdown
raw_htmlMark character strings as raw blocks in R Markdown
raw_latexMark character strings as raw blocks in R Markdown
raw_outputMark character strings as raw output that should not be converted
read_chunkRead chunks from an external script
read_demoRead chunks from an external script
read_rforgeRead source code from R-Forge
render_asciidocSet or get output hooks for different output formats
render_htmlSet or get output hooks for different output formats
render_jekyllSet or get output hooks for different output formats
render_latexSet or get output hooks for different output formats
render_listingsSet or get output hooks for different output formats
render_markdownSet or get output hooks for different output formats
render_rstSet or get output hooks for different output formats
render_sweaveSet or get output hooks for different output formats
render_textileSet or get output hooks for different output formats
restore_raw_outputMark character strings as raw output that should not be converted
rnw2pdfConvert an 'Rnw' document to PDF
roccoKnit R Markdown using the classic Docco style
rst2pdfA wrapper for rst2pdf
+ +

-- S --

+ + + + + + + + + + + + + + + + + + + + + + +
set_aliasSet aliases for chunk options
set_headerSet the header information
set_parentSpecify the parent document of child documents
sewWrap evaluated results for output
spinSpin goat's hair into wool
spin_childSpin a child R script
stitchAutomatically create a report based on an R script and a template
stitch_rhtmlAutomatically create a report based on an R script and a template
stitch_rmdAutomatically create a report based on an R script and a template
Sweave2knitrConvert Sweave to knitr documents
+ +

-- V --

+ + + + +
vignette_enginesPackage vignette engines
+ +

-- W --

+ + + + + + +
wrap_rmdWrap long lines in Rmd files
write_bibGenerate BibTeX bibliography databases for R packages
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/R.css new file mode 100644 index 00000000..212cf4c4 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/R.css @@ -0,0 +1,55 @@ +* { + font-family: "Trebuchet MS", "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Arial, sans-serif; + font-size: 14px; +} +body { + padding: 0 5px; + margin: 0 auto; + width: 80%; + max-width: 60em; /* 960px */ +} + +h1, h2, h3, h4, h5, h6 { + color: #666; +} +h1, h2 { + text-align: center; +} +h1 { + font-size: x-large; +} +h2, h3 { + font-size: large; +} +h4, h6 { + font-style: italic; +} +h3 { + border-left: solid 5px #ddd; + padding-left: 5px; + font-variant: small-caps; +} + +p img { + display: block; + margin: auto; +} + +span, code, pre { + font-family: Monaco, "Lucida Console", "Courier New", Courier, monospace; +} +span.acronym {} +span.env { + font-style: italic; +} +span.file {} +span.option {} +span.pkg { + font-weight: bold; +} +span.samp{} + +dt, p code { + background-color: #F7F7F7; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/Sweavel.sty b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/Sweavel.sty new file mode 100644 index 00000000..bc0dab4b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/Sweavel.sty @@ -0,0 +1,60 @@ +% Source: http://biostat.mc.vanderbilt.edu/wiki/pub/Main/SweaveTemplate/Sweavel.sty +% Author: Frank Harrell (with slight tweaks by Yihui Xie) +% Usage: \usepackage{Sweavel} +% To change size of R code and output, use e.g.: \def\Sweavesize{\normalsize} +% To change just the size of output, use e.g.: \def\Routsize{\smaller[2]} +% To change colors of R code, output, and commands, use e.g.: +% \def\Rcolor{\color{black}} +% \def\Routcolor{\color{green}} +% \def\Rcommentcolor{\color{red}} +% To change background color or R code and/or output, use e.g.: +% \def\Rbackground{\color{white}} +% \def\Routbackground{\color{white}} +% To use rgb specifications use \color[rgb]{ , , } +% To use gray scale use e.g. \color[gray]{0.5} +% If you change any of these after the first chunk is produced, the +% changes will have effect only for the next chunk. + + + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{Sweavel}{} % substitute for Sweave.sty using + % listings package with relsize +\RequirePackage{listings,fancyvrb,color,relsize} + +\providecommand{\Sweavesize}{\smaller} +\providecommand{\Routsize}{\Sweavesize} + +\providecommand{\Rcolor}{\color[rgb]{0, 0.5, 0.5}} +\providecommand{\Routcolor}{\color[rgb]{0.461, 0.039, 0.102}} +\providecommand{\Rcommentcolor}{\color[rgb]{0.101, 0.043, 0.432}} + +\providecommand{\Rbackground}{\color[gray]{0.91}} +\providecommand{\Routbackground}{\color[gray]{0.935}} +% Can specify \color[gray]{1} for white background or just \color{white} + +\lstdefinestyle{Rstyle}{fancyvrb=false,escapechar=`,language=R,% + basicstyle={\Rcolor\Sweavesize},% some want \ttfamily too + backgroundcolor=\Rbackground,% + showstringspaces=false,% + keywordstyle=\Rcolor,% + commentstyle={\Rcommentcolor\ttfamily\itshape},% + literate={<-}{{$\leftarrow$}}2{<<-}{{$\twoheadleftarrow$}}2{~}{{$\sim$}}1{<=}{{$\leq$}}2{>=}{{$\geq$}}2{^}{{$^{\scriptstyle\wedge}$}}1,% + alsoother={$},% + alsoletter={.<-},% + otherkeywords={!,!=,~,$,*,\&,\%/\%,\%*\%,\%\%,<-,<<-,/},% + escapeinside={(*}{*)}}% +% Other options of interest: +% frame=single,framerule=0.1pt,framesep=1pt,rulecolor=\color{blue}, +% numbers=left,numberstyle=\tiny,stepnumber=1,numbersep=7pt, +% keywordstyle={\bf\Rcolor} + +\lstdefinestyle{Routstyle}{fancyvrb=false,literate={~}{{$\sim$}}1{R^2}{{$R^{2}$}}2{^}{{$^{\scriptstyle\wedge}$}}1{R-squared}{{$R^{2}$}}2,% + frame=single,framerule=0.2pt,framesep=1pt,basicstyle=\Routcolor\Routsize\ttfamily,% + backgroundcolor=\Routbackground} + +\newenvironment{Schunk}{}{} +\lstnewenvironment{Sinput}{\lstset{style=Rstyle}}{} +\lstnewenvironment{Scode}{\lstset{style=Rstyle}}{} +\lstnewenvironment{Soutput}{\lstset{style=Routstyle}}{} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/gWidgetsWWW2-knitr.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/gWidgetsWWW2-knitr.R new file mode 100644 index 00000000..d93c8a14 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/gWidgetsWWW2-knitr.R @@ -0,0 +1,15 @@ +library(gWidgetsWWW2) +w = gwindow('An R Notebook') +sb = gstatusbar('Powered by Rook, gWidgetsWWW2 and knitr', container = w) +g = gframe('An R Notebook based on knitr', use.scrollwindow = TRUE, + horizontal = FALSE, container = w) +gbutton('Knit', container = g, handler = function(h, ...) { + library(knitr) + svalue(g3) = try(knit2html(text = svalue(g1), template = FALSE)) +}) +g0 = ggroup(container = g) +code = readLines(system.file('examples', 'knitr-minimal.Rmd', package = 'knitr')) +# g1 = gtext(code, container = g, use.codemirror = TRUE, width = 500) +g1 = gtext(code, container = g0, width = 500, height = 500) +g2 = ggroup(cont = g0, expand = TRUE) +g3 = ghtml('results here', container = g2) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/knitr-template.Rhtml b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/knitr-template.Rhtml new file mode 100644 index 00000000..fe71fdcb --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/knitr-template.Rhtml @@ -0,0 +1,34 @@ + + + + + + <!--rinline I(.knitr.title) --> + + + +

This report is automatically generated with the R + package knitr + (version ) + .

+ + + +

The R session information (including the OS info, R version and all + packages used):

+ + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/knitr-template.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/knitr-template.Rmd new file mode 100644 index 00000000..85de169a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/knitr-template.Rmd @@ -0,0 +1,21 @@ +`r if (exists('.knitr.title')) I(paste('#', .knitr.title, sep = ''))` + +`r if (exists('.knitr.author')) I(.knitr.author)` + +This report was automatically generated with the R package **knitr** +(version `r packageVersion('knitr')`). + +```{r %sCHUNK_LABEL_HERE} +``` + +The R session information (including the OS info, R version and all +packages used): + +```{r session-info, cache=FALSE} +sessionInfo() +Sys.time() +``` +```{r clean-up, include=FALSE} +if (exists('.knitr.title')) rm(.knitr.author) +if (exists('.knitr.author')) rm(.knitr.author) +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/knitr-template.Rnw b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/knitr-template.Rnw new file mode 100644 index 00000000..7445c945 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/knitr-template.Rnw @@ -0,0 +1,60 @@ +\documentclass{article} +\usepackage[sc]{mathpazo} +\renewcommand{\sfdefault}{lmss} +\renewcommand{\ttdefault}{lmtt} +\usepackage[T1]{fontenc} +\usepackage{geometry} +\geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=2.5cm,rmargin=2.5cm} +\setcounter{secnumdepth}{2} +\setcounter{tocdepth}{2} +\usepackage[unicode=true,pdfusetitle, + bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=2, + breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=false] + {hyperref} +\hypersetup{ + pdfstartview={XYZ null null 1}} + +\makeatletter +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands. +\renewcommand{\textfraction}{0.05} +\renewcommand{\topfraction}{0.8} +\renewcommand{\bottomfraction}{0.8} +\renewcommand{\floatpagefraction}{0.75} + +\makeatother + +\begin{document} + +<>= +options(width=90) +knitr::opts_chunk$set(out.width = '.6\\linewidth') +.knitr.title = if (exists('.knitr.title')) paste('\\title{', .knitr.title, '}', sep = '') else '' +.knitr.author = if (nzchar(.knitr.title) && exists('.knitr.author')) { + paste('\\author{', .knitr.author, '%\n', + '\\thanks{This report is automatically generated with the R package \\textbf{knitr} + (version ', packageVersion('knitr'), ').}}', sep = '') +} else '' +@ + +\Sexpr{.knitr.title} + +\Sexpr{.knitr.author} + +\Sexpr{if (nzchar(.knitr.title)) '\\maketitle'} +The results below are generated from an R script. + +<<%sCHUNK_LABEL_HERE>>= +@ + +The R session information (including the OS info, R version and all +packages used): + +<>= +sessionInfo() +Sys.time() +@ +<>= +rm(.knitr.author); rm(.knitr.author) +@ + +\end{document} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/knitr.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/knitr.css new file mode 100644 index 00000000..c079bfb0 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/knitr.css @@ -0,0 +1,30 @@ +.inline { + background-color: #f7f7f7; + border:solid 1px #B0B0B0; +} +.error { + font-weight: bold; + color: #FF0000; +} +.warning { + font-weight: bold; +} +.message { + font-style: italic; +} +.source, .output, .warning, .error, .message { + padding: 0 1em; + border:solid 1px #F7F7F7; +} +.source { + background-color: #F7F7F7; +} +.left { + text-align: left; +} +.right { + text-align: right; +} +.center { + text-align: center; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/knitr.sty b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/knitr.sty new file mode 100644 index 00000000..17fbc214 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/knitr.sty @@ -0,0 +1,25 @@ +\usepackage{framed} +\makeatletter +\newenvironment{kframe}{% + \def\at@end@of@kframe{}% + \ifinner\ifhmode% + \def\at@end@of@kframe{\end{minipage}}% + \begin{minipage}{\columnwidth}% + \fi\fi% + \def\FrameCommand##1{\hskip\@totalleftmargin \hskip-\fboxsep + \colorbox{shadecolor}{##1}\hskip-\fboxsep + % There is no \\@totalrightmargin, so: + \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}% + \MakeFramed {\advance\hsize-\width + \@totalleftmargin\z@ \linewidth\hsize + \@setminipage}}% + {\par\unskip\endMakeFramed% + \at@end@of@kframe} +\makeatother + +\definecolor{shadecolor}{rgb}{.97, .97, .97} +\definecolor{messagecolor}{rgb}{0, 0, 0} +\definecolor{warningcolor}{rgb}{1, 0, 1} +\definecolor{errorcolor}{rgb}{1, 0, 0} +\newenvironment{knitrout}{}{} % an empty environment to be redefined in TeX + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/stitch-test.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/stitch-test.R new file mode 100644 index 00000000..c18aed74 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/stitch-test.R @@ -0,0 +1,8 @@ +## title: A test script for the function stitch() +## author: Yihui Xie +set.seed(1121) +(x = rnorm(20)) +mean(x);var(x) +boxplot(x) +hist(x, main = '') + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/tikz2pdf.tex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/tikz2pdf.tex new file mode 100644 index 00000000..377ee333 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/tikz2pdf.tex @@ -0,0 +1,9 @@ +\documentclass[ +%% TIKZ_CLASSOPTION %% +]{standalone} +\usepackage{amsmath} +\usetikzlibrary{matrix} +%% EXTRA_TIKZ_PREAMBLE_CODE %% +\begin{document} +%% TIKZ_CODE %% +\end{document} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/toggleR.js b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/toggleR.js new file mode 100644 index 00000000..65f45149 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/toggleR.js @@ -0,0 +1,9 @@ +// toggle visibility of R source blocks in R Markdown output +(d => { + d.insertAdjacentHTML('beforeend',''); + d.lastElementChild.onclick = (e) => { + d.querySelectorAll('pre.r').forEach(el => { + el.style.display = (el.style.display === 'none') ? 'block' : 'none'; + }); + }; +})(document.body); diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/tweak_bib.csv b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/tweak_bib.csv new file mode 100644 index 00000000..a167151d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/tweak_bib.csv @@ -0,0 +1,44 @@ +"package","author" +"ade4","Stéphane Dray and Anne-Béatrice Dufour and Jean Thioulouse and Thibaut Jombart and Sandrine Pavoine and Jean R. Lobry and Sébastien Ollier and Aurélie Siberchicot and Daniel Chessel" +"akima","H. Akima and Albrecht Gebhardt and Thomas Petzoldt and Martin Maechler" +"ash","David W. Scott and Albrecht Gebhardt and Stephen Kaluzny" +"bcpa","Jose Claudio Faria and Clarice Garcia Borges Demetrio" +"BiplotGUI","Anthony la Grange and N. J. le Roux and P.J. Rousseeuw and I. Ruts and J. W. Tukey" +"bitops","Steve Dutky and Martin Maechler" +"cacheSweave","Roger D. Peng" +"cat","Ted Harding and Fernando Tusell and Joseph L. Schafer" +"CircStats","Ulric Lund and Claudio Agostinelli" +"contrast","Max Kuhn and Steve Weston and Jed Wing and James Forester" +"date","Terry Therneau and Thomas Lumley and Kjetil Halvorsen and Kurt Hornik" +"digest","Dirk Eddelbuettel" +"ElemStatLearn","Kjetil Halvorsen" +"epiR","Mark Stevenson and Telmo Nunes and Cord Heuer and Jonathon Marshall and Javier Sanchez and Ron Thornton and Jeno Reiczigel and Jim Robison-Cox and Paola Sebastiani and Peter Solymos" +"Fahrmeir","Kjetil Halvorsen" +"flashClust","Fionn Murtagh and {R development team} and Peter Langfelder" +"foreach","{Revolution Analytics} and Steve Weston}" +"fortunes","Achim Zeileis and the R community" +"gee","Vincent J Carey and Thomas Lumley and Brian Ripley" +"gmodels","Gregory R. Warnes andBen Bolker and Thomas Lumley and Randall C Johnson and Randall C. Johnson" +"gWidgets","John Verzani" +"hexbin","Dan Carr and Nicholas Lewin-Koh and Martin Maechler" +"Hmisc","Harrell, Jr., Frank E" +"Hmisc","Frank E. {Harrell, Jr.}" +"leaps","Thomas Lumley" +"mapproj","Doug McIlroy and Ray Brownrigg and Thomas P Minka and Roger Bivand" +"maps","Ray Brownrigg" +"mathgraph","Patrick J. Burns and Nick Efthymiou and Claus Dethlefsen" +"oz","Bill Venables and Kurt Hornik" +"pbivnorm","Alan Genz and Brenton Kenkel" +"pscl","Simon Jackman and Alex Tahk and Achim Zeileis and Christina Maimone and Jim Fearon" +"quadprog","Berwin A. Turlach and Andreas Weingessel" +"R2SWF","Yixuan Qiu and Yihui Xie and Cameron Bracken" +"R2WinBUGS","Andrew Gelman and Sibylle Sturtz and Uwe Ligges and Gregor Gorjanc and Jouni Kerman" +"randomForest","Leo Breiman and Adele Cutler and Andy Liaw and Matthew Wiener" +"rgl","Daniel Adler and Duncan Murdoch" +"RgoogleMaps","Markus Loecher" +"rms","Frank E. {Harrell, Jr.}" +"robustbase","Valentin Todorov and Andreas Ruckstuhl and Matias Salibian-Barrera and Tobias Verbeke and Manuel Koller and Martin Maechler" +"RODBC","Brian Ripley and Michael Lapsley" +"Sleuth2","F. L. Ramsey and D. W. Schafer and Jeannie Sifneos and Berwin A. Turlach" +"sm","Adrian Bowman and Adelchi Azzalini" +"tuneR","Uwe Ligges" diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/vignette.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/vignette.css new file mode 100644 index 00000000..7d2eb68e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/vignette.css @@ -0,0 +1,207 @@ +body { + background-color: #fff; + margin: 1em auto; + max-width: 800px; + padding: 0 2em; + line-height: 1.5; +} + +.title, .author, .date { + text-align: center; +} + +#TOC { + clear: both; + margin: 0 0 10px 0; + padding: 4px; + border: 1px solid #CCCCCC; + border-radius: 5px; + background-color: #f6f6f6; +} + #TOC .toctitle { + font-weight: bold; + font-size: 15px; + margin-left: 5px; + } + + #TOC ul { + padding-left: 40px; + margin-left: -1.5em; + margin-top: 5px; + margin-bottom: 5px; + } + #TOC ul ul { + margin-left: -2em; + } + #TOC li { + line-height: 16px; + } + +table:not([class]) { + margin: auto; + min-width: 40%; + border-width: 1px; + border-color: #DDDDDD; + border-style: outset; + border-collapse: collapse; +} +table[summary="R argblock"] { + width: 100%; + border: none; +} +table:not([class]) th { + border-width: 2px; + padding: 5px; + border-style: inset; +} +table:not([class]) td { + border-width: 1px; + border-style: inset; + line-height: 18px; + padding: 5px 5px; +} +table:not([class]), table:not([class]) th, table:not([class]) td { + border-left-style: none; + border-right-style: none; +} +table:not([class]) tr.odd { + background-color: #f7f7f7; +} + +blockquote { + background-color: #f6f6f6; + padding: 1em; +} + +hr { + border: none; + border-top: 1px solid #777; + margin: 28px 0; +} + +dl { + margin-left: 0; +} + dl dd { + margin-bottom: 13px; + margin-left: 13px; + } + dl dt { + font-weight: bold; + } + +ul { + margin-top: 0; +} + ul li { + list-style: circle outside; + } + ul ul { + margin-bottom: 0; + } + +pre, code { + background-color: #f5f5f5; + border-radius: 3px; + color: #333; +} +pre { + overflow-x: auto; + border-radius: 3px; + margin: 5px 0 10px 0; + padding: 10px; +} +pre code { + display: block; +} +pre:not([class]) { + background-color: white; + border: #f5f5f5 1px solid; +} +pre:not([class]) code { + color: #444; + background-color: white; +} +code { + font-family: monospace; + font-size: 90%; +} +p > code, li > code { + padding: 2px 4px; + color: #d14; + border: 1px solid #e1e1e8; + white-space: inherit; +} +div.figure { + text-align: center; +} +table > caption, div.figure p.caption { + font-style: italic; +} +table > caption span, div.figure p.caption span { + font-style: normal; + font-weight: bold; +} + +img:not([class]) { + background-color: #FFFFFF; + padding: 2px; + border-radius: 3px; + border: 1px solid #CCCCCC; + margin: 0 5px; + max-width: 100%; +} + +h1 { + margin-top: 0; + font-size: 35px; +} + +h2 { + border-bottom: 4px solid #f5f5f5; + padding-top: 10px; + padding-bottom: 2px; + font-size: 145%; +} + +h3 { + border-bottom: 2px solid #f5f5f5; + padding-top: 10px; + font-size: 120%; +} + +h4 { + border-bottom: 1px solid #f5f5f5; + margin-left: 8px; + font-size: 105%; +} + +h5, h6 { + border-bottom: 1px solid #ccc; + font-size: 105%; +} + +a { + color: #0033dd; + text-decoration: none; +} + a:hover { + color: #6666ff; } + a:visited { + color: #800080; } + a:visited:hover { + color: #BB00BB; } + a[href^="http:"] { + text-decoration: underline; } + a[href^="https:"] { + text-decoration: underline; } + +div.r-help-page { + background-color: #f9f9f9; + border-bottom: #ddd 1px solid; + margin-bottom: 10px; + padding: 10px; +} +div.r-help-page:hover { + background-color: #f4f4f4; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/vignette.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/vignette.html new file mode 100644 index 00000000..e730c78c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/misc/vignette.html @@ -0,0 +1,4 @@ + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/opencpu/apps/index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/opencpu/apps/index.html new file mode 100644 index 00000000..5bc88494 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/opencpu/apps/index.html @@ -0,0 +1,64 @@ + + + + + R Notebook: A knitr app on OpenCPU + + + + + + + + + + + + +
+
+ +
+ +
+
+
+ + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/shiny/server.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/shiny/server.R new file mode 100644 index 00000000..4119a01f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/shiny/server.R @@ -0,0 +1,20 @@ +library(shiny) +library(knitr) +options(device.ask.default = FALSE) + +shinyServer(function(input, output) { + + output$nbOut = reactive({ + src = input$nbSrc + if (length(src) == 0L || src == '') return('Nothing to show yet...') + owd = setwd(tempdir()); on.exit(setwd(owd)) + opts_knit$set(root.dir = owd) + + paste(knit2html(text = src, template = FALSE, quiet = TRUE), + '', sep = '\n') + }) +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/shiny/ui.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/shiny/ui.R new file mode 100644 index 00000000..6f2c68a4 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/shiny/ui.R @@ -0,0 +1,27 @@ +library(shiny) + +# div nbSrc takes source code from div notebook (via Ace editor), and div nbOut +# holds results from knitr +shinyUI( + bootstrapPage( + tags$head( + tags$title('An R Notebook in Shiny'), + tags$script(src = 'http://ajaxorg.github.io/ace/build/src-min-noconflict/ace.js', + type = 'text/javascript', charset = 'utf-8'), + tags$link(rel = 'stylesheet', type = 'text/css', href = 'ace-shiny.css'), + tags$script(src = '//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/highlight.min.js', type = 'text/javascript'), + tags$script(src = '//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/languages/r.min.js', type = 'text/javascript'), + tags$link(rel = 'stylesheet', type = 'text/css', + href = '//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/styles/github.min.css'), + tags$script(src = '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML', + type = 'text/javascript') + ), + div(id = 'notebook', title = 'Compile notebook: F4\nInsert chunk: Ctrl+Alt+I', + paste(c('This is an example taken from the **knitr** package. Press `F4` or `Ctrl+Shift+H` to compile it, and `Ctrl+Alt+I` to insert a code chunk.', '', + readLines(system.file('examples', 'knitr-minimal.Rmd', package = 'knitr'))), collapse = '\n')), + tags$textarea(id = 'nbSrc', style = 'display: none;'), + tags$script(src = 'ace-shiny.js', type = 'text/javascript'), + htmlOutput('nbOut'), + div(id = 'proxy', submitButton('Knit Notebook')) + ) +) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/shiny/www/ace-shiny.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/shiny/www/ace-shiny.css new file mode 100644 index 00000000..9db8a5a0 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/shiny/www/ace-shiny.css @@ -0,0 +1,24 @@ +#proxy { + position: absolute; + top: 0; + right: 0; + display: none; +} + +#notebook { + position: absolute; + width: 600px; + top: 0; + left: 0; + bottom: 0; +} + +#nbOut { + position: absolute; + left: 620px; + top: 0; + right: 0; + bottom: 0; + padding-right: 5px; + overflow-y: scroll; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/shiny/www/ace-shiny.js b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/shiny/www/ace-shiny.js new file mode 100644 index 00000000..35f04ef2 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/shiny/www/ace-shiny.js @@ -0,0 +1,63 @@ +var editor = ace.edit("notebook"); +editor.setTheme("ace/theme/tomorrow"); +editor.getSession().setMode('ace/mode/markdown'); +editor.getSession().setUseWrapMode(true); +editor.getSession().setTabSize(2); +editor.getSession().setFoldStyle('markbegin'); + +editor.getSession().on('change', function(e) { + $('#nbSrc').val(editor.getValue()).change(); +}); +editor.getSession().selection.on('changeSelection', function(e) { + var s = editor.session.getTextRange(editor.getSelectionRange()); + if (s == '') s = editor.getValue(); + $('#nbSrc').val(s).change(); +}); +editor.commands.addCommand({ + name: 'insertChunk', + bindKey: 'Ctrl-Alt-I', + exec: function(editor) { + editor.insert('```{r}\n\n```\n'); + editor.navigateUp(2); + } +}); +editor.commands.addCommand({ + name: 'compileNotebook', + bindKey: 'F4|Ctrl-Shift-H', + exec: function(editor) { + $('#proxy button').trigger('click'); + } +}); + +$(document).ready(function() { + // may pass a url as a query string after ? in the url + var h = window.location.search.substring(1); + function setSrc(msg) { + if (msg) { + alert('unable to read URL ' + h + '\n\nusing default R Markdown example'); + } + $('#nbSrc').val(editor.getValue()); + $('#proxy button').trigger('click'); + } + var w = Math.max($(window).width()/2, 300); + $('#notebook').width(w - 10); + $('#nbOut').css('left', w + 10 + 'px'); + if (h) { + $.get(h, {}, function(res) { + var data = res.data, str = data.content; + if (typeof(str) != 'string') return(setSrc(true)); + if (data.encoding == 'base64') { + str = str.replace(/\n/g, ''); + str = decodeURIComponent(escape(window.atob( str ))); + } + if (str) { + editor.setValue(str); + editor.gotoLine(1); + setSrc(false); + } else setSrc(true); + }, 'jsonp') + .error(function() { + setSrc(true); + }); + } else setSrc(false); +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/acid.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/acid.css new file mode 100644 index 00000000..6e3b1ad3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/acid.css @@ -0,0 +1,34 @@ +.background { + color: #eeeeee; +} +.num { + color: #800080; + font-weight: bold; +} +.sng { + color: #a68500; +} +.com { + color: #ff8000; +} +.opt { + color: #ff0080; + font-weight: bold; +} +.def { + color: #000000; +} +.kwa { + color: #bb7977; + font-weight: bold; +} +.kwb { + color: #8080c0; + font-weight: bold; +} +.kwc { + color: #0080c0; +} +.kwd { + color: #004466; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/aiseered.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/aiseered.css new file mode 100644 index 00000000..304f69bc --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/aiseered.css @@ -0,0 +1,32 @@ +.background { + color: #600000; +} +.num { + color: #88ddee; +} +.sng { + color: #ffcc88; +} +.com { + color: #ffffff; + font-style: italic; +} +.opt { + color: #ffcc33; +} +.def { + color: #f08080; +} +.kwa { + color: #eeff99; + font-weight: bold; +} +.kwb { + color: #88ffaa; +} +.kwc { + color: #aa99ff; +} +.kwd { + color: #f0b77f; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/andes.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/andes.css new file mode 100644 index 00000000..9ea4fd36 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/andes.css @@ -0,0 +1,30 @@ +.background { + color: #0f0f0f; +} +.num { + color: #dfaf87; +} +.sng { + color: #ffff77; +} +.com { + color: #33ff00; +} +.opt { + color: #ff00cc; +} +.def { + color: #f0f0f0; +} +.kwa { + color: #66aaff; +} +.kwb { + color: #66ff99; +} +.kwc { + color: #cc9966; +} +.kwd { + color: #ff99aa; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/anotherdark.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/anotherdark.css new file mode 100644 index 00000000..0d46a855 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/anotherdark.css @@ -0,0 +1,30 @@ +.background { + color: #323232; +} +.num { + color: #ffa0a0; +} +.sng { + color: #ffa0a0; +} +.com { + color: #ffa500; +} +.opt { + color: #dedede; +} +.def { + color: #dedede; +} +.kwa { + color: #f0e68c; +} +.kwb { + color: #bdb66b; +} +.kwc { + color: #8b95f0; +} +.kwd { + color: #f25252; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/autumn.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/autumn.css new file mode 100644 index 00000000..b7a041a5 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/autumn.css @@ -0,0 +1,30 @@ +.background { + color: #fff4e8; +} +.num { + color: #00884c; +} +.sng { + color: #00884c; +} +.com { + color: #ff5050; +} +.opt { + color: #404040; +} +.def { + color: #404040; +} +.kwa { + color: #80a030; +} +.kwb { + color: #b06c58; +} +.kwc { + color: #30a188; +} +.kwd { + color: #990000; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/baycomb.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/baycomb.css new file mode 100644 index 00000000..8b48f527 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/baycomb.css @@ -0,0 +1,31 @@ +.background { + color: #11121a; +} +.num { + color: #4580b4; +} +.sng { + color: #5c78f0; +} +.com { + color: #349d58; +} +.opt { + color: #b0b0b0; +} +.def { + color: #a0b4e0; +} +.kwa { + color: #fca8ad; +} +.kwb { + color: #0490e8; + font-weight: bold; +} +.kwc { + color: #a9fcf7; +} +.kwd { + color: #b4e09f; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/bclear.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/bclear.css new file mode 100644 index 00000000..b0117acd --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/bclear.css @@ -0,0 +1,30 @@ +.background { + color: #ffffff; +} +.num { + color: #1094a0; +} +.sng { + color: #1094a0; +} +.com { + color: #969696; +} +.opt { + color: #323232; +} +.def { + color: #323232; +} +.kwa { + color: #3b6ac8; +} +.kwb { + color: #a00050; +} +.kwc { + color: #00a150; +} +.kwd { + color: #c73a69; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/biogoo.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/biogoo.css new file mode 100644 index 00000000..0be25aed --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/biogoo.css @@ -0,0 +1,31 @@ +.background { + color: #d6d6d6; +} +.num { + color: #b85d00; +} +.sng { + color: #d10000; +} +.com { + color: #0000c3; +} +.opt { + color: #000000; +} +.def { + color: #000000; +} +.kwa { + color: #00007f; +} +.kwb { + color: #540054; + font-weight: bold; +} +.kwc { + color: #005400; +} +.kwd { + color: #002a54; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/bipolar.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/bipolar.css new file mode 100644 index 00000000..2bc7cc13 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/bipolar.css @@ -0,0 +1,35 @@ +.background { + color: #0f020a; +} +.num { + color: #0083c9; +} +.sng { + color: #eba236; +} +.com { + color: #35d6e5; + font-style: italic; +} +.opt { + color: #e3d922; +} +.def { + color: #d62b9a; +} +.kwa { + color: #20c79d; + font-weight: bold; +} +.kwb { + color: #1d9617; + font-weight: bold; +} +.kwc { + color: #72d42c; + font-weight: bold; +} +.kwd { + color: #81e535; + font-weight: bold; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/blacknblue.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/blacknblue.css new file mode 100644 index 00000000..bcefdadd --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/blacknblue.css @@ -0,0 +1,33 @@ +.background { + color: #000000; +} +.num { + color: #cc3366; +} +.sng { + color: #cfc631; +} +.com { + color: #c47b6a; + font-style: italic; +} +.opt { + color: #ccc6c6; +} +.def { + color: #22a0d6; +} +.kwa { + color: #1ededc; + font-weight: bold; +} +.kwb { + color: #c06cf8; + font-weight: bold; +} +.kwc { + color: #00ff99; +} +.kwd { + color: #1ceddc; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/bluegreen.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/bluegreen.css new file mode 100644 index 00000000..5fd86b90 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/bluegreen.css @@ -0,0 +1,33 @@ +.background { + color: #061A3E; +} +.num { + color: #72A5E4; + font-weight: bold; +} +.sng { + color: #72A5E4; + font-weight: bold; +} +.com { + color: #DABEA2; + font-style: italic; +} +.opt { + color: #ffffff; +} +.def { + color: #ffffff; +} +.kwa { + color: #7E75B5; +} +.kwb { + color: #A9EE8A; +} +.kwc { + color: #b5768d; +} +.kwd { + color: #76b57e; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/breeze.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/breeze.css new file mode 100644 index 00000000..d6394954 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/breeze.css @@ -0,0 +1,30 @@ +.background { + color: #005c70; +} +.num { + color: #60ffff; +} +.sng { + color: #60ffff; +} +.com { + color: #c8d0d0; +} +.opt { + color: #ffffff; +} +.def { + color: #ffffff; +} +.kwa { + color: #ffff80; +} +.kwb { + color: #80ffa0; +} +.kwc { + color: #7f7fff; +} +.kwd { + color: #ff7fff; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/bright.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/bright.css new file mode 100644 index 00000000..2dd47bfe --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/bright.css @@ -0,0 +1,30 @@ +.background { + color: #ffffff; +} +.num { + color: #32ba06; +} +.sng { + color: #1861a7; +} +.com { + color: #006633; +} +.opt { + color: #555555; +} +.def { + color: #330066; +} +.kwa { + color: #ff3030; +} +.kwb { + color: #F48C23; +} +.kwc { + color: #0000ff; +} +.kwd { + color: #d11ced; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/camo.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/camo.css new file mode 100644 index 00000000..0ba630bd --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/camo.css @@ -0,0 +1,30 @@ +.background { + color: #232323; +} +.num { + color: #d2691e; +} +.sng { + color: #ffe4b5; +} +.com { + color: #d2b48c; +} +.opt { + color: #ffe4c4; +} +.def { + color: #ffe4c4; +} +.kwa { + color: #f0e68c; +} +.kwb { + color: #cdc673; +} +.kwc { + color: #c7f08b; +} +.kwd { + color: #ffc7c4; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/candy.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/candy.css new file mode 100644 index 00000000..ce79f1e3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/candy.css @@ -0,0 +1,31 @@ +.background { + color: #000000; +} +.num { + color: #90d0ff; +} +.sng { + color: #90d0ff; +} +.com { + color: #c0c0d0; + font-style: italic; +} +.opt { + color: #f0f0f8; +} +.def { + color: #f0f0f8; +} +.kwa { + color: #ffa0ff; +} +.kwb { + color: #ffc864; +} +.kwc { + color: #ffffa1; +} +.kwd { + color: #ff5c33; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/clarity.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/clarity.css new file mode 100644 index 00000000..826a476e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/clarity.css @@ -0,0 +1,30 @@ +.background { + color: #1F3055; +} +.num { + color: #b3ee3a; +} +.sng { + color: #cccccc; +} +.com { + color: #9e9e9e; +} +.opt { + color: #b2dfee; +} +.def { + color: #b2dfee; +} +.kwa { + color: #cd919e; +} +.kwb { + color: #ff4400; +} +.kwc { + color: #9ecc91; +} +.kwd { + color: #edc1b2; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/dante.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/dante.css new file mode 100644 index 00000000..cb4fb2e3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/dante.css @@ -0,0 +1,30 @@ +.background { + color: #000000; +} +.num { + color: #ee0000; +} +.sng { + color: #cd2626; +} +.com { + color: #008b8b; +} +.opt { + color: #cdaf96; +} +.def { + color: #cdaf96; +} +.kwa { + color: #cdad00; +} +.kwb { + color: #66cd00; +} +.kwc { + color: #cc0085; +} +.kwd { + color: #cccccc; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/darkblue.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/darkblue.css new file mode 100644 index 00000000..253a0ccb --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/darkblue.css @@ -0,0 +1,31 @@ +.background { + color: #000040; +} +.num { + color: #42cad9; +} +.sng { + color: #ffa0a0; +} +.com { + color: #80a0ff; +} +.opt { + color: #bababa; +} +.def { + color: #ffffff; +} +.kwa { + color: #e2e825; +} +.kwb { + color: #60ff60; +} +.kwc { + color: #e88d25; +} +.kwd { + color: #e825e2; + font-weight: bold; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/darkbone.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/darkbone.css new file mode 100644 index 00000000..64ae92e0 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/darkbone.css @@ -0,0 +1,30 @@ +.background { + color: #000000; +} +.num { + color: #d0e080; +} +.sng { + color: #d0e080; +} +.com { + color: #606080; +} +.opt { + color: #cccccc; +} +.def { + color: #a0a0c0; +} +.kwa { + color: #8090f0; +} +.kwb { + color: #e0e0ff; +} +.kwc { + color: #7ff0a6; +} +.kwd { + color: #9fbfaf; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/darkness.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/darkness.css new file mode 100644 index 00000000..781befef --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/darkness.css @@ -0,0 +1,32 @@ +.background { + color: #000000; +} +.num { + color: #619de7; +} +.sng { + color: #abab00; + font-weight: bold; +} +.com { + color: #008888; +} +.opt { + color: #ff00ff; +} +.def { + color: #ffffff; +} +.kwa { + color: #ffff00; + font-weight: bold; +} +.kwb { + color: #00ff00; +} +.kwc { + color: #26e0e7; +} +.kwd { + color: #f34627; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/darkslategray.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/darkslategray.css new file mode 100644 index 00000000..077fc9a8 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/darkslategray.css @@ -0,0 +1,32 @@ +.background { + color: #2f4f4f; +} +.num { + color: #ff6347; +} +.sng { + color: #7fffd4; +} +.com { + color: #da70d6; +} +.opt { + color: #f5deb3; +} +.def { + color: #f5deb3; +} +.kwa { + color: #4682b4; + font-weight: bold; +} +.kwb { + color: #98fb98; + font-weight: bold; +} +.kwc { + color: #b57847; +} +.kwd { + color: #b3caf5; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/darkspectrum.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/darkspectrum.css new file mode 100644 index 00000000..273cc20c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/darkspectrum.css @@ -0,0 +1,32 @@ +.background { + color: #2A2A2A; +} +.num { + color: #fce94f; +} +.sng { + color: #fce94f; +} +.com { + color: #8a8a8a; +} +.opt { + color: #efefef; +} +.def { + color: #efefef; +} +.kwa { + color: #ffffff; + font-weight: bold; +} +.kwb { + color: #8ae234; + font-weight: bold; +} +.kwc { + color: #34e3e3; +} +.kwd { + color: #efefef; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/default.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/default.css new file mode 100644 index 00000000..f58f2b63 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/default.css @@ -0,0 +1,33 @@ +.background { + color: #F5F5F5; +} +.num { + color: #AF0F91; +} +.sng { + color: #317ECC; +} +.com { + color: #AD95AF; + font-style: italic; +} +.opt { + color: #000000; +} +.def { + color: #585858; +} +.kwa { + color: #295F94; + font-weight: bold; +} +.kwb { + color: #B05A65; +} +.kwc { + color: #55aa55; +} +.kwd { + color: #BC5A65; + font-weight: bold; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/denim.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/denim.css new file mode 100644 index 00000000..917a2420 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/denim.css @@ -0,0 +1,30 @@ +.background { + color: #000038; +} +.num { + color: #33FF33; +} +.sng { + color: #CCCC99; +} +.com { + color: #999999; +} +.opt { + color: #FFFFFF; +} +.def { + color: #FFFFFF; +} +.kwa { + color: #FFFFCC; +} +.kwb { + color: #33FF99; +} +.kwc { + color: #33FF99; +} +.kwd { + color: #9966cc; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/dusk.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/dusk.css new file mode 100644 index 00000000..8c22de8f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/dusk.css @@ -0,0 +1,30 @@ +.background { + color: #1f3048; +} +.num { + color: #cdb7b5; +} +.sng { + color: #9ac0cd; +} +.com { + color: #708090; +} +.opt { + color: #fffff0; +} +.def { + color: #fffff0; +} +.kwa { + color: #f0e68c; +} +.kwb { + color: #ffdead; +} +.kwc { + color: #8bf0b3; +} +.kwd { + color: #8bf0e6; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/earendel.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/earendel.css new file mode 100644 index 00000000..32b5431b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/earendel.css @@ -0,0 +1,33 @@ +.background { + color: #ffffff; +} +.num { + color: #a8660d; +} +.sng { + color: #a8660d; +} +.com { + color: #558817; +} +.opt { + color: #000000; +} +.def { + color: #000000; +} +.kwa { + color: #2239a8; + font-weight: bold; +} +.kwb { + color: #8c1d69; + font-weight: bold; +} +.kwc { + color: #a89222; + font-weight: bold; +} +.kwd { + color: #a8227b; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/easter.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/easter.css new file mode 100644 index 00000000..aa9da3af --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/easter.css @@ -0,0 +1,34 @@ +.background { + color: #fff9b9; +} +.num { + color: #e11a70; +} +.sng { + color: #ca4be3; +} +.com { + color: #1ea411; + font-style: italic; +} +.opt { + color: #fa4700; +} +.def { + color: #2C7B34; +} +.kwa { + color: #1d45d6; + font-weight: bold; +} +.kwb { + color: #ed0f55; + font-weight: bold; +} +.kwc { + color: #26aae7; + font-weight: bold; +} +.kwd { + color: #1d45d6; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-anjuta.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-anjuta.css new file mode 100644 index 00000000..b3f97af1 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-anjuta.css @@ -0,0 +1,32 @@ +.background { + color: #ffffff; +} +.num { + color: #008800; +} +.sng { + color: #ddbb00; +} +.com { + color: #ff0000; + font-style: italic; +} +.opt { + color: #000000; +} +.def { + color: #000000; +} +.kwa { + color: #000080; + font-weight: bold; +} +.kwb { + color: #000080; +} +.kwc { + color: #0000ff; +} +.kwd { + color: #000000; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-eclipse.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-eclipse.css new file mode 100644 index 00000000..ec12832d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-eclipse.css @@ -0,0 +1,33 @@ +.background { + color: #ffffff; +} +.num { + color: #000000; +} +.sng { + color: #0000ff; +} +.com { + color: #717ab3; +} +.opt { + color: #000000; +} +.def { + color: #000000; +} +.kwa { + color: #7f0055; + font-weight: bold; +} +.kwb { + color: #7f0055; + font-weight: bold; +} +.kwc { + color: #7f0055; + font-weight: bold; +} +.kwd { + color: #000000; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-emacs.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-emacs.css new file mode 100644 index 00000000..ceba9489 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-emacs.css @@ -0,0 +1,32 @@ +.background { + color: #ffffff; +} +.num { + color: #000000; +} +.sng { + color: #bd8d8b; +} +.com { + color: #ac2020; + font-style: italic; +} +.opt { + color: #000000; +} +.def { + color: #000000; +} +.kwa { + color: #9c20ee; + font-weight: bold; +} +.kwb { + color: #208920; +} +.kwc { + color: #0000ff; +} +.kwd { + color: #000000; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-flashdevelop.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-flashdevelop.css new file mode 100644 index 00000000..632859fb --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-flashdevelop.css @@ -0,0 +1,31 @@ +.background { + color: #ffffff; +} +.num { + color: #0000ff; + font-weight: bold; +} +.sng { + color: #a31515; +} +.com { + color: #606060; +} +.opt { + color: #000000; +} +.def { + color: #000000; +} +.kwa { + color: #0000ff; +} +.kwb { + color: #0000ff; +} +.kwc { + color: #2b91af; +} +.kwd { + color: #2b91af; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-gedit.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-gedit.css new file mode 100644 index 00000000..0427c07b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-gedit.css @@ -0,0 +1,31 @@ +.background { + color: #ffffff; +} +.num { + color: #FF00FF; +} +.sng { + color: #FF00FF; +} +.com { + color: #003CFF; +} +.opt { + color: #3A3935; +} +.def { + color: #3A3935; +} +.kwa { + color: #A52A35; +} +.kwb { + color: #2E8B57; +} +.kwc { + color: #572e8c; +} +.kwd { + color: #3A3935; + font-weight: bold; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-jedit.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-jedit.css new file mode 100644 index 00000000..728224f8 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-jedit.css @@ -0,0 +1,33 @@ +.background { + color: #ffffff; +} +.num { + color: #ff0000; +} +.sng { + color: #ff00cc; +} +.com { + color: #cc0000; +} +.opt { + color: #000000; + font-weight: bold; +} +.def { + color: #000000; +} +.kwa { + color: #009966; + font-weight: bold; +} +.kwb { + color: #009966; + font-weight: bold; +} +.kwc { + color: #0099ff; +} +.kwd { + color: #9966ff; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-kwrite.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-kwrite.css new file mode 100644 index 00000000..fa956ea5 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-kwrite.css @@ -0,0 +1,33 @@ +.background { + color: #E0EAEE; +} +.num { + color: #B07E00; +} +.sng { + color: #BF0303; +} +.com { + color: #838183; + font-style: italic; +} +.opt { + color: #000000; +} +.def { + color: #000000; +} +.kwa { + color: #000000; + font-weight: bold; +} +.kwb { + color: #0057AE; +} +.kwc { + color: #000000; + font-weight: bold; +} +.kwd { + color: #010181; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-matlab.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-matlab.css new file mode 100644 index 00000000..ff92e67c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-matlab.css @@ -0,0 +1,30 @@ +.background { + color: #ffffff; +} +.num { + color: #000000; +} +.sng { + color: #800000; +} +.com { + color: #000000; +} +.opt { + color: #000000; +} +.def { + color: #000000; +} +.kwa { + color: #0000ff; +} +.kwb { + color: #000000; +} +.kwc { + color: #0000ff; +} +.kwd { + color: #000000; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-msvs2008.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-msvs2008.css new file mode 100644 index 00000000..f4452993 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-msvs2008.css @@ -0,0 +1,30 @@ +.background { + color: #ffffff; +} +.num { + color: #000000; +} +.sng { + color: #a31515; +} +.com { + color: #008000; +} +.opt { + color: #000000; +} +.def { + color: #000000; +} +.kwa { + color: #0000ff; +} +.kwb { + color: #0000ff; +} +.kwc { + color: #2b91af; +} +.kwd { + color: #000000; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-nedit.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-nedit.css new file mode 100644 index 00000000..4c4d7faa --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-nedit.css @@ -0,0 +1,35 @@ +.background { + color: #ffffff; +} +.num { + color: #006400; +} +.sng { + color: #006400; +} +.com { + color: #000000; + font-style: italic; +} +.opt { + color: #000000; + font-weight: bold; +} +.def { + color: #000000; +} +.kwa { + color: #000000; + font-weight: bold; +} +.kwb { + color: #a52a2a; + font-weight: bold; +} +.kwc { + color: #dda0dd; + font-weight: bold; +} +.kwd { + color: #000000; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-vim-dark.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-vim-dark.css new file mode 100644 index 00000000..ce6a510c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-vim-dark.css @@ -0,0 +1,30 @@ +.background { + color: #000000; +} +.num { + color: #ff0000; +} +.sng { + color: #ff0000; +} +.com { + color: #0000ff; +} +.opt { + color: #ffffff; +} +.def { + color: #ffffff; +} +.kwa { + color: #B26818; +} +.kwb { + color: #00ff00; +} +.kwc { + color: #B26818; +} +.kwd { + color: #ffffff; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-vim.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-vim.css new file mode 100644 index 00000000..6b01be35 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-vim.css @@ -0,0 +1,30 @@ +.background { + color: #ffffff; +} +.num { + color: #ff0000; +} +.sng { + color: #ff0000; +} +.com { + color: #0000ff; +} +.opt { + color: #000000; +} +.def { + color: #000000; +} +.kwa { + color: #B26818; +} +.kwb { + color: #00ff00; +} +.kwc { + color: #B26818; +} +.kwd { + color: #000000; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-xcode.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-xcode.css new file mode 100644 index 00000000..3451ab15 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/edit-xcode.css @@ -0,0 +1,30 @@ +.background { + color: #ffffff; +} +.num { + color: #2300ff; +} +.sng { + color: #c00000; +} +.com { + color: #007f1c; +} +.opt { + color: #000000; +} +.def { + color: #000000; +} +.kwa { + color: #8f0055; +} +.kwb { + color: #8f0055; +} +.kwc { + color: #8f0055; +} +.kwd { + color: #000000; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/ekvoli.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/ekvoli.css new file mode 100644 index 00000000..83e4242f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/ekvoli.css @@ -0,0 +1,34 @@ +.background { + color: #001535; +} +.num { + color: #87c6f0; + font-style: italic; +} +.sng { + color: #87c6f0; + font-style: italic; +} +.com { + color: #9590d5; + font-style: italic; +} +.opt { + color: #dedede; +} +.def { + color: #dedede; +} +.kwa { + color: #ffffff; + font-weight: bold; +} +.kwb { + color: #90bfd0; +} +.kwc { + color: #9fd190; +} +.kwd { + color: #d1909e; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/fine_blue.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/fine_blue.css new file mode 100644 index 00000000..c6551635 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/fine_blue.css @@ -0,0 +1,35 @@ +.background { + color: #f8f8f8; +} +.num { + color: #2020ff; +} +.sng { + color: #2020ff; +} +.com { + color: #ff00c0; + font-style: italic; +} +.opt { + color: #404048; +} +.def { + color: #404048; +} +.kwa { + color: #008858; + font-weight: bold; +} +.kwb { + color: #7040ff; + font-weight: bold; +} +.kwc { + color: #87002f; + font-weight: bold; +} +.kwd { + color: #404048; + font-weight: bold; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/freya.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/freya.css new file mode 100644 index 00000000..2dc9169c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/freya.css @@ -0,0 +1,32 @@ +.background { + color: #2a2a2a; +} +.num { + color: #afe091; +} +.sng { + color: #afe091; +} +.com { + color: #c2b680; +} +.opt { + color: #dcdccc; +} +.def { + color: #dcdccc; +} +.kwa { + color: #e0af91; + font-weight: bold; +} +.kwb { + color: #dabfa5; + font-weight: bold; +} +.kwc { + color: #d792e0; +} +.kwd { + color: #a6e1ff; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/fruit.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/fruit.css new file mode 100644 index 00000000..20deabf7 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/fruit.css @@ -0,0 +1,30 @@ +.background { + color: #f8f8f8; +} +.num { + color: #8016ff; +} +.sng { + color: #ff6633; +} +.com { + color: #ff4080; +} +.opt { + color: #404040; +} +.def { + color: #404040; +} +.kwa { + color: #f030d0; +} +.kwb { + color: #0070e6; +} +.kwc { + color: #30f050; +} +.kwd { + color: #b030f0; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/golden.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/golden.css new file mode 100644 index 00000000..a2742668 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/golden.css @@ -0,0 +1,34 @@ +.background { + color: #000000; +} +.num { + color: #ffffff; +} +.sng { + color: #ff0000; +} +.com { + color: #978345; + font-style: italic; +} +.opt { + color: #ababab; +} +.def { + color: #ddbb00; +} +.kwa { + color: #ffed8a; + font-weight: bold; +} +.kwb { + color: #ffed8a; +} +.kwc { + color: #dedede; + font-weight: bold; +} +.kwd { + color: #ddbb00; + font-weight: bold; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/greenlcd.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/greenlcd.css new file mode 100644 index 00000000..183dbf30 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/greenlcd.css @@ -0,0 +1,32 @@ +.background { + color: #003000; +} +.num { + color: #3399cc; +} +.sng { + color: #dfdfdf; +} +.com { + color: #888888; + font-style: italic; +} +.opt { + color: #2fe7a9; +} +.def { + color: #00bb00; +} +.kwa { + color: #00ed00; + font-weight: bold; +} +.kwb { + color: #00ed00; +} +.kwc { + color: #beef13; +} +.kwd { + color: #c0ff73; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/greyscale0.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/greyscale0.css new file mode 100644 index 00000000..b0110710 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/greyscale0.css @@ -0,0 +1,32 @@ +.background { + color: #ffffff; +} +.num { + color: #333333; +} +.sng { + color: #333333; +} +.com { + font-style: italic; + color: #4D4D4D; +} +.opt { + color: #1A1A1A; +} +.def { + color: #1A1A1A; +} +.kwa { + color: #1A1A1A; +} +.kwb { + color: #1A1A1A; +} +.kwc { + color: #333333; +} +.kwd { + font-weight: bold; + color: #1A1A1A; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/greyscale1.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/greyscale1.css new file mode 100644 index 00000000..b5bc4ce3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/greyscale1.css @@ -0,0 +1,32 @@ +.background { + color: #ffffff; +} +.num { + color: #4D4D4D; +} +.sng { + color: #4D4D4D; +} +.com { + font-style: italic; + color: #808080; +} +.opt { + color: #1A1A1A; +} +.def { + color: #1A1A1A; +} +.kwa { + color: #1A1A1A; +} +.kwb { + color: #1A1A1A; +} +.kwc { + color: #4D4D4D; +} +.kwd { + font-weight: bold; + color: #1A1A1A; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/greyscale2.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/greyscale2.css new file mode 100644 index 00000000..a05b913b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/greyscale2.css @@ -0,0 +1,32 @@ +.background { + color: #ffffff; +} +.num { + color: #666666; +} +.sng { + color: #666666; +} +.com { + font-style: italic; + color: #B3B3B3; +} +.opt { + color: #1A1A1A; +} +.def { + color: #1A1A1A; +} +.kwa { + color: #1A1A1A; +} +.kwb { + color: #1A1A1A; +} +.kwc { + color: #666666; +} +.kwd { + font-weight: bold; + color: #1A1A1A; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/kellys.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/kellys.css new file mode 100644 index 00000000..b6808f6e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/kellys.css @@ -0,0 +1,31 @@ +.background { + color: #2a2b2f; +} +.num { + color: #d1c79e; +} +.sng { + color: #d1c79e; +} +.com { + color: #67686b; +} +.opt { + color: #e1e0e5; +} +.def { + color: #e1e0e5; +} +.kwa { + color: #62acce; + font-weight: bold; +} +.kwb { + color: #e6ac32; +} +.kwc { + color: #cf8563; +} +.kwd { + color: #bb63cf; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/leo.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/leo.css new file mode 100644 index 00000000..ce17a8b9 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/leo.css @@ -0,0 +1,31 @@ +.background { + color: #000000; +} +.num { + color: #ff875f; +} +.sng { + color: #ffd7d7; +} +.com { + color: #a8a8a8; + font-style: italic; +} +.opt { + color: #ffffff; +} +.def { + color: #ffffff; +} +.kwa { + color: #00d700; +} +.kwb { + color: #5fafff; +} +.kwc { + color: #006bd6; +} +.kwd { + color: #d600d6; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/lucretia.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/lucretia.css new file mode 100644 index 00000000..982bf7fd --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/lucretia.css @@ -0,0 +1,30 @@ +.background { + color: #001C42; +} +.num { + color: #63759C; +} +.sng { + color: #E7F3B5; +} +.com { + color: #944D39; +} +.opt { + color: #6A7969; +} +.def { + color: #de9d7c; +} +.kwa { + color: #907fd4; +} +.kwb { + color: #29a655; +} +.kwc { + color: #427142; +} +.kwd { + color: #A59A39; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/manxome.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/manxome.css new file mode 100644 index 00000000..00968655 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/manxome.css @@ -0,0 +1,30 @@ +.background { + color: #000000; +} +.num { + color: #00ffff; +} +.sng { + color: #00ffff; +} +.com { + color: #00ff00; +} +.opt { + color: #ffff00; +} +.def { + color: #cccccc; +} +.kwa { + color: #00aaaa; +} +.kwb { + color: #f70000; +} +.kwc { + color: #5500ab; +} +.kwd { + color: #00aaaa; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/maroloccio.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/maroloccio.css new file mode 100644 index 00000000..8949d621 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/maroloccio.css @@ -0,0 +1,30 @@ +.background { + color: #1a202a; +} +.num { + color: #8b8b00; +} +.sng { + color: #5B5BD0; +} +.com { + color: #006666; +} +.opt { + color: #8b9aaa; +} +.def { + color: #8b9aaa; +} +.kwa { + color: #9966cc; +} +.kwb { + color: #ffcc00; +} +.kwc { + color: #cc6666; +} +.kwd { + color: #99cc66; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/matrix.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/matrix.css new file mode 100644 index 00000000..4e1e4eaa --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/matrix.css @@ -0,0 +1,32 @@ +.background { + color: #000000; +} +.num { + color: #55ff55; +} +.sng { + color: #ccff33; +} +.com { + color: #226622; +} +.opt { + color: #44cc44; +} +.def { + color: #44cc44; +} +.kwa { + color: #55ff55; + font-weight: bold; +} +.kwb { + color: #aaff54; + font-weight: bold; +} +.kwc { + color: #48d990; +} +.kwd { + color: #54ffaa; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/moe.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/moe.css new file mode 100644 index 00000000..4ad0916a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/moe.css @@ -0,0 +1,33 @@ +.background { + color: #f6f6f6; +} +.num { + color: #880022; +} +.sng { + color: #aa4400; +} +.com { + color: #ff8800; +} +.opt { + color: #000000; + font-weight: bold; +} +.def { + color: #000000; +} +.kwa { + color: #661111; + font-weight: bold; +} +.kwb { + color: #000066; + font-weight: bold; +} +.kwc { + color: #000066; +} +.kwd { + color: #004466; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/molokai.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/molokai.css new file mode 100644 index 00000000..9541c167 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/molokai.css @@ -0,0 +1,31 @@ +.background { + color: #272822; +} +.num { + color: #AE81FF; +} +.sng { + color: #E6DB74; +} +.com { + color: #75715E; +} +.opt { + color: #F8F8F2; +} +.def { + color: #F8F8F2; +} +.kwa { + color: #F92672; + font-weight: bold; +} +.kwb { + color: #66D9EF; +} +.kwc { + color: #95f067; +} +.kwd { + color: #25faac; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/moria.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/moria.css new file mode 100644 index 00000000..80912fb6 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/moria.css @@ -0,0 +1,32 @@ +.background { + color: #202020; +} +.num { + color: #87df71; +} +.sng { + color: #87df71; +} +.com { + color: #d0d0a0; +} +.opt { + color: #d0d0d0; +} +.def { + color: #d0d0d0; +} +.kwa { + color: #7ec0ee; + font-weight: bold; +} +.kwb { + color: #f09479; + font-weight: bold; +} +.kwc { + color: #87ed7e; +} +.kwd { + color: #e47eed; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/navajo-night.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/navajo-night.css new file mode 100644 index 00000000..48992281 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/navajo-night.css @@ -0,0 +1,34 @@ +.background { + color: #35536f; +} +.num { + color: #3fffa7; +} +.sng { + color: #3fffa7; +} +.com { + color: #e7e77f; +} +.opt { + color: #ffffff; +} +.def { + color: #ffffff; +} +.kwa { + color: #5ad5d5; + font-weight: bold; +} +.kwb { + color: #d174a8; + font-weight: bold; +} +.kwc { + color: #98d65a; + font-weight: bold; +} +.kwd { + color: #ffffff; + font-weight: bold; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/navy.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/navy.css new file mode 100644 index 00000000..40bc7400 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/navy.css @@ -0,0 +1,32 @@ +.background { + color: #000035; +} +.num { + color: #f87ff4; +} +.sng { + color: #ff7f66; +} +.com { + color: #ffbb00; + font-style: italic; +} +.opt { + color: #ffffff; +} +.def { + color: #008bff; +} +.kwa { + color: #f8c50b; + font-weight: bold; +} +.kwb { + color: #e1e72f; +} +.kwc { + color: #13d8ef; +} +.kwd { + color: #ffffff; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/neon.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/neon.css new file mode 100644 index 00000000..891bd97a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/neon.css @@ -0,0 +1,30 @@ +.background { + color: #303030; +} +.num { + color: #92d4ff; +} +.sng { + color: #92d4ff; +} +.com { + color: #c0c0c0; +} +.opt { + color: #f0f0f0; +} +.def { + color: #f0f0f0; +} +.kwa { + color: #dcdc78; +} +.kwb { + color: #60f0a8; +} +.kwc { + color: #7979db; +} +.kwd { + color: #db79aa; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/night.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/night.css new file mode 100644 index 00000000..766d074a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/night.css @@ -0,0 +1,30 @@ +.background { + color: #303040; +} +.num { + color: #b8b8c8; +} +.sng { + color: #f0f0f8; +} +.com { + color: #e0e070; +} +.opt { + color: #f0f0f8; +} +.def { + color: #f0f0f8; +} +.kwa { + color: #00d8f8; +} +.kwb { + color: #bbaaff; +} +.kwc { + color: #9d00f7; +} +.kwd { + color: #cc66cc; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/nightshimmer.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/nightshimmer.css new file mode 100644 index 00000000..082655a4 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/nightshimmer.css @@ -0,0 +1,30 @@ +.background { + color: #103040; +} +.num { + color: #00ffff; +} +.sng { + color: #00ffff; +} +.com { + color: #507080; +} +.opt { + color: #e0eee0; +} +.def { + color: #e0eee0; +} +.kwa { + color: #90ee90; +} +.kwb { + color: #add8e6; +} +.kwc { + color: #cc99ff; +} +.kwd { + color: #ff9999; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/nuvola.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/nuvola.css new file mode 100644 index 00000000..6352a00e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/nuvola.css @@ -0,0 +1,31 @@ +.background { + color: #F9F5F9; +} +.num { + color: #00C226; +} +.sng { + color: #B91F49; +} +.com { + color: #3F6B5B; +} +.opt { + color: #000000; +} +.def { + color: #000000; +} +.kwa { + color: #F06F00; +} +.kwb { + color: #0000ff; +} +.kwc { + color: #08f000; + font-weight: bold; +} +.kwd { + color: #e800f0; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/olive.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/olive.css new file mode 100644 index 00000000..4e640b14 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/olive.css @@ -0,0 +1,31 @@ +.background { + color: #333300; +} +.num { + color: #ffddad; +} +.sng { + color: #afff2f; +} +.com { + color: #bdb66b; +} +.opt { + color: #D9D9C3; +} +.def { + color: #D9D9C3; +} +.kwa { + color: #8fbc8f; + font-weight: bold; +} +.kwb { + color: #daa520; +} +.kwc { + color: #21d948; +} +.kwd { + color: #D9D9C3; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/orion.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/orion.css new file mode 100644 index 00000000..ea04661d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/orion.css @@ -0,0 +1,30 @@ +.background { + color: #1E1616; +} +.num { + color: #9C928C; +} +.sng { + color: #635D63; +} +.com { + color: #C4674A; +} +.opt { + color: #7B94AD; +} +.def { + color: #C4B1A8; +} +.kwa { + color: #49d4d6; +} +.kwb { + color: #BA1919; +} +.kwc { + color: #7B2421; +} +.kwd { + color: #AD5139; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/oxygenated.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/oxygenated.css new file mode 100644 index 00000000..9d571852 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/oxygenated.css @@ -0,0 +1,34 @@ +.background { + color: #0f0f0f; +} +.num { + color: #0099CC; +} +.sng { + color: #FFCC00; + font-weight: bold; +} +.com { + color: #00CC33; +} +.opt { + color: #ff0099; + font-weight: bold; +} +.def { + color: #FFFF66; + font-weight: bold; +} +.kwa { + color: #99aaff; + font-weight: bold; +} +.kwb { + color: #66ff99; +} +.kwc { + color: #ff99ff; +} +.kwd { + color: #33ddee; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/pablo.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/pablo.css new file mode 100644 index 00000000..fbf1cb5e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/pablo.css @@ -0,0 +1,33 @@ +.background { + color: #000000; +} +.num { + color: #00ffff; +} +.sng { + color: #00ffff; +} +.com { + color: #808080; +} +.opt { + color: #ff0000; +} +.def { + color: #ffffff; +} +.kwa { + color: #c0c000; + font-weight: bold; +} +.kwb { + color: #00c000; + font-weight: bold; +} +.kwc { + color: #3939bf; + font-weight: bold; +} +.kwd { + color: #21ffc0; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/peaksea.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/peaksea.css new file mode 100644 index 00000000..bcd28bf4 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/peaksea.css @@ -0,0 +1,30 @@ +.background { + color: #e0e0e0; +} +.num { + color: #907000; +} +.sng { + color: #007068; +} +.com { + color: #606000; +} +.opt { + color: #000000; +} +.def { + color: #000000; +} +.kwa { + color: #2060a8; +} +.kwb { + color: #0850a0; +} +.kwc { + color: #a86920; +} +.kwd { + color: #20a825; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/print.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/print.css new file mode 100644 index 00000000..b90be669 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/print.css @@ -0,0 +1,36 @@ +.background { + color: #ffffff; +} +.num { + color: #000000; +} +.sng { + color: #000000; +} +.com { + color: #666666; + font-style: italic; +} +.opt { + color: #000000; + font-weight: bold; +} +.def { + color: #000000; +} +.kwa { + color: #000000; + font-weight: bold; +} +.kwb { + color: #000000; + font-weight: bold; +} +.kwc { + color: #000000; + font-weight: bold; +} +.kwd { + color: #000000; + font-weight: bold; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/rand01.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/rand01.css new file mode 100644 index 00000000..55fb151b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/rand01.css @@ -0,0 +1,33 @@ +.background { + color: #ffffff; +} +.num { + color: #0da344; +} +.sng { + color: #2b83ba; +} +.com { + color: #ababab; + font-style: italic; +} +.opt { + color: #0000de; +} +.def { + color: #121b28; +} +.kwa { + color: #0a7f6d; + font-weight: bold; +} +.kwb { + color: #c42638; + font-weight: bold; +} +.kwc { + color: #e12f76; +} +.kwd { + color: #2ac749; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/rdark.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/rdark.css new file mode 100644 index 00000000..d51dc3fb --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/rdark.css @@ -0,0 +1,30 @@ +.background { + color: #1e2426; +} +.num { + color: #8ae234; +} +.sng { + color: #8ae234; +} +.com { + color: #656763; +} +.opt { + color: #babdb6; +} +.def { + color: #babdb6; +} +.kwa { + color: #729fcf; +} +.kwb { + color: #e3e7df; +} +.kwc { + color: #cfa272; +} +.kwd { + color: #9ebd77; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/relaxedgreen.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/relaxedgreen.css new file mode 100644 index 00000000..798745b0 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/relaxedgreen.css @@ -0,0 +1,30 @@ +.background { + color: #000000; +} +.num { + color: #0099dd; +} +.sng { + color: #0099dd; +} +.com { + color: #00a594; +} +.opt { + color: #aaaaaa; +} +.def { + color: #aaaaaa; +} +.kwa { + color: #ac0000; +} +.kwb { + color: #559955; +} +.kwc { + color: #00abab; +} +.kwd { + color: #ededed; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/rootwater.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/rootwater.css new file mode 100644 index 00000000..66ecf15e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/rootwater.css @@ -0,0 +1,30 @@ +.background { + color: #151b1d; +} +.num { + color: #77dd88; +} +.sng { + color: #77dd88; +} +.com { + color: #656565; +} +.opt { + color: #babdb6; +} +.def { + color: #babdb6; +} +.kwa { + color: #8fffff; +} +.kwb { + color: #ffffff; +} +.kwc { + color: #ff8f8f; +} +.kwd { + color: #ededed; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/seashell.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/seashell.css new file mode 100644 index 00000000..913af15e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/seashell.css @@ -0,0 +1,33 @@ +.background { + color: #fff5ee; +} +.num { + color: #ff1493; +} +.sng { + color: #ff1493; +} +.com { + color: #2929cc; +} +.opt { + color: #676767; +} +.def { + color: #000000; +} +.kwa { + color: #2e8b57; + font-weight: bold; +} +.kwb { + color: #2e8b57; + font-weight: bold; +} +.kwc { + color: #696969; + font-weight: bold; +} +.kwd { + color: #00008f; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/solarized-dark.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/solarized-dark.css new file mode 100644 index 00000000..c184f882 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/solarized-dark.css @@ -0,0 +1,30 @@ +.background { + color: #002b36; +} +.num { + color: #dc322f; +} +.sng { + color: #dc322f; +} +.com { + color: #586e75; +} +.opt { + color: #93a1a1; +} +.def { + color: #839496; +} +.kwa { + color: #cb4b16; +} +.kwb { + color: #859900; +} +.kwc { + color: #cb4b16; +} +.kwd { + color: #93a1a1; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/solarized-light.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/solarized-light.css new file mode 100644 index 00000000..bdba1ad5 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/solarized-light.css @@ -0,0 +1,30 @@ +.background { + color: #fdf6e3; +} +.num { + color: #dc322f; +} +.sng { + color: #dc322f; +} +.com { + color: #93a1a1; +} +.opt { + color: #586e75; +} +.def { + color: #657b83; +} +.kwa { + color: #cb4b16; +} +.kwb { + color: #859900; +} +.kwc { + color: #cb4b16; +} +.kwd { + color: #586e75; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/tabula.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/tabula.css new file mode 100644 index 00000000..80f127e9 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/tabula.css @@ -0,0 +1,31 @@ +.background { + color: #004A41; +} +.num { + color: #00A7F7; +} +.sng { + color: #00DF00; +} +.com { + color: #00C5E7; +} +.opt { + color: #71D289; +} +.def { + color: #71D289; +} +.kwa { + color: #DEDE00; + font-weight: bold; +} +.kwb { + color: #F269E4; +} +.kwc { + color: #ffffff; +} +.kwd { + color: #ff7f00; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/tcsoft.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/tcsoft.css new file mode 100644 index 00000000..9fd46911 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/tcsoft.css @@ -0,0 +1,32 @@ +.background { + color: #FFFFFF; +} +.num { + color: #666666; +} +.sng { + color: #666666; +} +.com { + color: #000099; + font-style: italic; +} +.opt { + color: #000000; +} +.def { + color: #000000; +} +.kwa { + color: #FF9900; +} +.kwb { + color: #FF9900; + font-weight: bold; +} +.kwc { + color: #0066ff; +} +.kwd { + color: #ff00e5; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/vampire.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/vampire.css new file mode 100644 index 00000000..11dc0025 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/vampire.css @@ -0,0 +1,33 @@ +.background { + color: #000000; +} +.num { + color: #aaff00; +} +.sng { + color: #bb00ff; +} +.com { + color: #ababab; + font-style: italic; +} +.opt { + color: #F3E651; +} +.def { + color: #ff0000; +} +.kwa { + color: #ffffff; + font-weight: bold; +} +.kwb { + color: #F35E1E; + font-weight: bold; +} +.kwc { + color: #ffffff; +} +.kwd { + color: #ffcc33; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/whitengrey.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/whitengrey.css new file mode 100644 index 00000000..93b9446f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/whitengrey.css @@ -0,0 +1,33 @@ +.background { + color: #ffffff; +} +.num { + color: #bb00ff; +} +.sng { + color: #008800; +} +.com { + color: #1326a2; + font-style: italic; +} +.opt { + color: #696969; +} +.def { + color: #696969; +} +.kwa { + color: #696969; + font-weight: bold; +} +.kwb { + color: #696969; +} +.kwc { + color: #696969; + font-weight: bold; +} +.kwd { + color: #000000; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/xoria256.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/xoria256.css new file mode 100644 index 00000000..6a1c9189 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/xoria256.css @@ -0,0 +1,30 @@ +.background { + color: #1c1c1c; +} +.num { + color: #dfaf87; +} +.sng { + color: #ffffaf; +} +.com { + color: #808080; +} +.opt { + color: #d0d0d0; +} +.def { + color: #d0d0d0; +} +.kwa { + color: #87afdf; +} +.kwb { + color: #87de8c; +} +.kwc { + color: #deb787; +} +.kwd { + color: #de87da; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/zellner.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/zellner.css new file mode 100644 index 00000000..dacb02a3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/zellner.css @@ -0,0 +1,31 @@ +.background { + color: #ffffff; +} +.num { + color: #ff0066; +} +.sng { + color: #ff00ff; +} +.com { + color: #ff0000; +} +.opt { + color: #000000; +} +.def { + color: #000000; +} +.kwa { + color: #a52a2a; +} +.kwb { + color: #0000ff; +} +.kwc { + color: #225f2d; +} +.kwd { + color: #000000; + font-weight: bold; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/zenburn.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/zenburn.css new file mode 100644 index 00000000..42cc6552 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/zenburn.css @@ -0,0 +1,33 @@ +.background { + color: #1f1f1f; +} +.num { + color: #dca3a3; + font-weight: bold; +} +.sng { + color: #cc9393; +} +.com { + color: #7f9f7f; + font-style: italic; +} +.opt { + color: #dcdccc; +} +.def { + color: #dcdccc; +} +.kwa { + color: #e3ceab; +} +.kwb { + color: #dfdfbf; + font-weight: bold; +} +.kwc { + color: #aae3b2; +} +.kwd { + color: #aabfe3; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/zmrok.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/zmrok.css new file mode 100644 index 00000000..de445ab5 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/knitr/themes/zmrok.css @@ -0,0 +1,31 @@ +.background { + color: #141414; +} +.num { + color: #FACE43; +} +.sng { + color: #D9FF77; +} +.com { + color: #888888; +} +.opt { + color: #F8F8F8; +} +.def { + color: #F8F8F8; +} +.kwa { + color: #A56A30; + font-weight: bold; +} +.kwb { + color: #C7CA87; +} +.kwc { + color: #30a630; +} +.kwd { + color: #3b84cc; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/DESCRIPTION new file mode 100644 index 00000000..df194d97 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/DESCRIPTION @@ -0,0 +1,39 @@ +Package: lifecycle +Title: Manage the Life Cycle of your Package Functions +Version: 1.0.4 +Authors@R: c( + person("Lionel", "Henry", , "lionel@posit.co", role = c("aut", "cre")), + person("Hadley", "Wickham", , "hadley@posit.co", role = "aut", + comment = c(ORCID = "0000-0003-4757-117X")), + person("Posit Software, PBC", role = c("cph", "fnd")) + ) +Description: Manage the life cycle of your exported functions with shared + conventions, documentation badges, and user-friendly deprecation + warnings. +License: MIT + file LICENSE +URL: https://lifecycle.r-lib.org/, https://github.com/r-lib/lifecycle +BugReports: https://github.com/r-lib/lifecycle/issues +Depends: R (>= 3.6) +Imports: cli (>= 3.4.0), glue, rlang (>= 1.1.0) +Suggests: covr, crayon, knitr, lintr, rmarkdown, testthat (>= 3.0.1), + tibble, tidyverse, tools, vctrs, withr +VignetteBuilder: knitr +Config/Needs/website: tidyverse/tidytemplate, usethis +Config/testthat/edition: 3 +Encoding: UTF-8 +RoxygenNote: 7.2.1 +NeedsCompilation: no +Packaged: 2023-11-06 16:07:36 UTC; lionel +Author: Lionel Henry [aut, cre], + Hadley Wickham [aut] (), + Posit Software, PBC [cph, fnd] +Maintainer: Lionel Henry +Repository: CRAN +Date/Publication: 2023-11-07 10:10:10 UTC +Built: R 4.4.1; ; 2025-02-01 04:52:04 UTC; unix +RemoteType: standard +RemotePkgRef: lifecycle +RemoteRef: lifecycle +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 1.0.4 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/INDEX new file mode 100644 index 00000000..8fdf2f09 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/INDEX @@ -0,0 +1,13 @@ +badge Embed a lifecycle badge in documentation +deprecate_soft Deprecate functions and arguments +deprecated Mark an argument as deprecated +expect_deprecated Does expression produce lifecycle warnings or + errors? +last_lifecycle_warnings + Display last deprecation warnings +pkg_lifecycle_statuses + Lint usages of functions that have a non-stable + life cycle. +signal_stage Signal other experimental or superseded + features +verbosity Control the verbosity of deprecation signals diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/LICENSE new file mode 100644 index 00000000..3542f99f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2023 +COPYRIGHT HOLDER: lifecycle authors diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/Meta/Rd.rds new file mode 100644 index 00000000..239df560 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/Meta/hsearch.rds new file mode 100644 index 00000000..e62ba3cd Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/Meta/links.rds new file mode 100644 index 00000000..957fdfdc Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/Meta/nsInfo.rds new file mode 100644 index 00000000..a0e3b8b9 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/Meta/package.rds new file mode 100644 index 00000000..82aec562 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/Meta/vignette.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/Meta/vignette.rds new file mode 100644 index 00000000..7a1b6a2f Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/Meta/vignette.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/NAMESPACE new file mode 100644 index 00000000..1f69576e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/NAMESPACE @@ -0,0 +1,19 @@ +# Generated by roxygen2: do not edit by hand + +S3method(print,lifecycle_warnings) +export(badge) +export(deprecate_soft) +export(deprecate_stop) +export(deprecate_warn) +export(deprecated) +export(expect_defunct) +export(expect_deprecated) +export(is_present) +export(last_lifecycle_warnings) +export(lint_lifecycle) +export(lint_tidyverse_lifecycle) +export(pkg_lifecycle_statuses) +export(signal_experimental) +export(signal_stage) +export(signal_superseded) +import(rlang) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/NEWS.md new file mode 100644 index 00000000..68fe8858 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/NEWS.md @@ -0,0 +1,131 @@ +# lifecycle 1.0.4 + +* Repeated calls to `deprecate_soft()` and `deprecate_warn()` are faster thanks + to some internal refactoring (#177). + +* Switch from `expr_deparse()` to `deparse()`. This improves performance + considerably and the cost of making some unusual function calls mildly + less appealing (#167). + +# lifecycle 1.0.3 + +* The `with` line is now an info bullet. The `details` lines are info + bullets by default, unless the argument is named. + +* Indirect usages of deprecated features now mention the package that + likely used the deprecated feature and recommends contacting the + authors (#135). + +* Indirect usages of `deprecate_warn()` no longer warn repeatedly, + even if `always = TRUE` (#135). + +* In tests, `deprecate_soft()` will only warn if the deprecated function + is called directly from the package being tested, not one of its dependencies. + This ensures that you only see the warning when it's your responsibility to + do something about it (#134). + +* Soft deprecations now only warn every 8 hours in non-package code (#134). + + +# lifecycle 1.0.2 + +* You can now generate arbitrary text in a deprecation message by + wrapping `what` or `with` in `I()` (#120). + +* `deprecate_warn()` gains an `always = TRUE` argument to force + warnings to occur every time, not every 8 hours. This adds an extra + step in between `deprecate_warn()` and `deprecate_stop()` (#124). + +* `signal_stage()` now supports `with` (#116). + + +# lifecycle 1.0.1 + +* `deprecate_soft()` now follows the verbosity option when called from + the global environment (#113). + +* `last_warnings()` has been renamed to `last_lifecycle_warnings()` + and `last_warning()` has been removed. This is for compatibility + with the future `rlang::last_warnings()` function to be released in + the next rlang version. + + +# lifecycle 1.0.0 + +* New vignettes: + * `vignette("stages")` describes the lifecycle stages + * `vignette("manage")` teaches you how to manage lifecycle changes in + functions you _use_. + * `vignette("communicate")` shows how to use lifecycle in functions that + you _write_. + +* In `deprecate_soft()`, `deprecate_warn()`, and `deprecate_stop()`: + + * You can deprecate an argument with `foo(arg)` instead of `foo(arg =)` (#78). + This syntax is similar in spirit to the formal arguments of function + definitions. + + * You can deprecate R6 methods by using `class$method()` (#54). + + * A character vector `details` is now converted into a bulleted list (#55). + + * Messages for non-prefix functions (like "`x<-`()" and "`%>%`()") + look a little nicer (#95). + + * Manually printed warnings now omit the advice footer (#68). + +* Experimental `signal_stage()` can be used to signal that a function is + experimental or superseded. These signals are not currently hooked up to any + behaviour, but we'll add tools in a future release (#44). + +* `lifecycle_cnd_data()` has been removed; as far as I can tell it wasn't + used by anyone. + + +# lifecycle 0.2.0 + +* Lifecycle warnings are now displayed once every 8 hours. + +* Added experimental `signal_experimental()` and `signal_superseded()` + functions. + +* Added the "superseded" lifecycle stage to the documentation. + +* `deprecate_stop()` now mentions that function is defunct (#28). + +* New `expect_deprecated()` and `expect_defunct()` functions for + testting lifecycle warnings and errors. `expect_deprecated()` + automatically sets the `lifecycle_verbosity` option to `"warning"` + to enforce warnings at each invokation rather than once per session. + +* New syntax `"foo(arg = 'can\\'t be a baz')"` to describe that specific inputs + for an argument are deprecated (#30, @krlmlr). + +* New `is_present()` function to test whether the caller has supplied a + `deprecated()` function. + + +# lifecycle 0.1.0 + +* Deprecated functions under the control of the developer now warn + repeatedly in unit tests. + +* Deprecation warnings now record a backtrace. Call + `lifecycle::last_lifecycle_warnings()` and `lifecycle::last_warning()` to + print the warnings that occurred during the last command, along with + their backtraces. + +* The naming scheme of signaller functions has been simplified: + + - `signal_soft_deprecated()` is now `deprecate_soft()`. + - `warn_deprecated()` is now `deprecate_warn()`. + - `stop_defunct()` is now `deprecate_stop()`. + +* The signaller functions now take a version and two descriptors for + the deprecated feature and its replacement (the latter is + optional). The deprecation message is built from these + components. You can pass a `details` argument to append additional + information to the generated deprecation message. + +* Helpers from rlang's `compat-lifecycle.R` drop-in file are now + exported in this package. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/R/lifecycle b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/R/lifecycle new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/R/lifecycle @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/R/lifecycle.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/R/lifecycle.rdb new file mode 100644 index 00000000..b01a077b Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/R/lifecycle.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/R/lifecycle.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/R/lifecycle.rdx new file mode 100644 index 00000000..6767fa7f Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/R/lifecycle.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/communicate.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/communicate.R new file mode 100644 index 00000000..434a125a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/communicate.R @@ -0,0 +1,211 @@ +## ----include = FALSE---------------------------------------------------------- +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) + +options( + # Pretend we're in the lifecycle package + "lifecycle:::calling_package" = "lifecycle", + # suppress last_lifecycle_warnings() message by default + "lifecycle_verbosity" = "warning" +) + +## ----eval = FALSE------------------------------------------------------------- +# #' `r lifecycle::badge("experimental")` +# #' `r lifecycle::badge("deprecated")` +# #' `r lifecycle::badge("superseded")` + +## ----------------------------------------------------------------------------- +lifecycle::deprecate_warn("1.0.0", "old_fun()", "new_fun()") +lifecycle::deprecate_warn("1.0.0", "fun()", "testthat::fun()") +lifecycle::deprecate_warn("1.0.0", "fun(old_arg)", "fun(new_arg)") + +## ----------------------------------------------------------------------------- +#' Add two numbers +#' +#' @description +#' `r lifecycle::badge("deprecated")` +#' +#' This function was deprecated because we realised that it's +#' a special case of the [sum()] function. + +## ----------------------------------------------------------------------------- +#' @examples +#' add_two(1, 2) +#' # -> +#' sum(1, 2) + +## ----------------------------------------------------------------------------- +#' @keywords internal + +## ----------------------------------------------------------------------------- +add_two <- function(x, y) { + lifecycle::deprecate_warn("1.0.0", "add_two()", "base::sum()") + x + y +} + +add_two(1, 2) + +## ----------------------------------------------------------------------------- +add_two <- function(x, y) { + lifecycle::deprecate_warn( + "1.0.0", + "add_two()", + details = "This function is a special case of sum(); use it instead." + ) + x + y +} + +add_two(1, 2) + +## ----eval = FALSE------------------------------------------------------------- +# test_that("add_two is deprecated", { +# expect_snapshot({ +# x <- add_two(1, 1) +# expect_equal(x, 2) +# }) +# }) + +## ----eval = FALSE------------------------------------------------------------- +# test_that("add_two returns the sum of its inputs", { +# withr::local_options(lifecycle_verbosity = "quiet") +# expect_equal(add_two(1, 1), 2) +# }) + +## ----eval = FALSE------------------------------------------------------------- +# test_that("add_two is deprecated", { +# expect_snapshot(add_two(1, 1)) +# }) + +## ----------------------------------------------------------------------------- +#' Add two numbers +#' +#' @description +#' `r lifecycle::badge("deprecated")` +#' +#' `add_two()` was renamed to `number_add()` to create a more +#' consistent API. +#' @keywords internal +#' @export +add_two <- function(foo, bar) { + lifecycle::deprecate_warn("1.0.0", "add_two()", "number_add()") + number_add(foo, bar) +} + +# documentation goes here... +#' @export +number_add <- function(x, y) { + x + y +} + +## ----------------------------------------------------------------------------- +#' Gather columns into key-value pairs +#' +#' @description +#' `r lifecycle::badge("superseded")` + +## ----------------------------------------------------------------------------- +#' +#' Development on `gather()` is complete, and for new code we recommend +#' switching to `pivot_longer()`, which is easier to use, more featureful, +#' and still under active development. +#' +#' In brief, +#' `df %>% gather("key", "value", x, y, z)` is equivalent to +#' `df %>% pivot_longer(c(x, y, z), names_to = "key", values_to = "value")`. +#' See more details in `vignette("pivot")`. + +## ----------------------------------------------------------------------------- +gather <- function(data, key = "key", value = "value", ...) { + lifecycle::signal_stage("superseded", "gather()") +} + +## ----------------------------------------------------------------------------- +#' @description +#' `r lifecycle::badge("experimental")` + +## ----------------------------------------------------------------------------- +cool_function <- function() { + lifecycle::signal_stage("experimental", "cool_function()") +} + +## ----------------------------------------------------------------------------- +add_two <- function(x, y, na.rm = TRUE) { + sum(x, y, na.rm = na.rm) +} + +## ----------------------------------------------------------------------------- +#' @param na.rm `r lifecycle::badge("deprecated")` `na.rm = FALSE` is no +#' longer supported; this function will always remove missing values + +## ----------------------------------------------------------------------------- +add_two <- function(x, y, na.rm = TRUE) { + if (!isTRUE(na.rm)) { + lifecycle::deprecate_warn( + when = "1.0.0", + what = "add_two(na.rm)", + details = "Ability to retain missing values will be dropped in next release." + ) + } + + sum(x, y, na.rm = na.rm) +} + +add_two(1, NA, na.rm = TRUE) +add_two(1, NA, na.rm = FALSE) + +## ----------------------------------------------------------------------------- +#' @importFrom lifecycle deprecated +add_two <- function(x, y, na.rm = deprecated()) { + if (lifecycle::is_present(na.rm)) { + lifecycle::deprecate_warn( + when = "1.0.0", + what = "add_two(na.rm)", + details = "Ability to retain missing values will be dropped in next release." + ) + } + + sum(x, y, na.rm = na.rm) +} + +## ----------------------------------------------------------------------------- +add_two(1, NA, na.rm = TRUE) +add_two(1, NA, na.rm = FALSE) + +## ----------------------------------------------------------------------------- +add_two <- function(x, y, na_rm = TRUE, na.rm = deprecated()) { + if (lifecycle::is_present(na.rm)) { + lifecycle::deprecate_warn("1.0.0", "add_two(na.rm)", "add_two(na_rm)") + na_rm <- na.rm + } + + sum(x, y, na.rm = na_rm) +} + +add_two(1, NA, na.rm = TRUE) + +## ----------------------------------------------------------------------------- +add_two <- function(x, y) { + if (length(y) != 1) { + lifecycle::deprecate_warn("1.0.0", "foo(y = 'must be a scalar')") + y <- sum(y) + } + x + y +} + +add_two(1, 2) +add_two(1, 1:5) + +## ----------------------------------------------------------------------------- +lifecycle::deprecate_warn( + when = "1.0.0", + what = I('Setting the global option "pkg.opt" to "foo"') +) + +lifecycle::deprecate_warn( + when = "1.0.0", + what = I('The global option "pkg.another_opt"'), + with = I('"pkg.this_opt"') +) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/communicate.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/communicate.Rmd new file mode 100644 index 00000000..68cde99a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/communicate.Rmd @@ -0,0 +1,387 @@ +--- +title: "Communicate lifecycle changes in your functions" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Communicate lifecycle changes in your functions} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) + +options( + # Pretend we're in the lifecycle package + "lifecycle:::calling_package" = "lifecycle", + # suppress last_lifecycle_warnings() message by default + "lifecycle_verbosity" = "warning" +) +``` + +lifecycle provides a standard way to document the lifecycle stages of functions and arguments, paired with tools to steer users away from deprecated functions. +Before we go in to the details, make sure that you're familiar with the lifecycle stages as described in `vignette("stages")`. + +## Basics + +lifecycle badges make it easy for users to see the lifecycle stage when reading the documentation. +To use the badges, first call `usethis::use_lifecycle()` to embed the badge images in your package (you only need to do this once), then use `lifecycle::badge()` to insert a badge: + +```{r, eval = FALSE} +#' `r lifecycle::badge("experimental")` +#' `r lifecycle::badge("deprecated")` +#' `r lifecycle::badge("superseded")` +``` + +Deprecated functions also need to advertise their status when run. +lifecycle provides `deprecate_warn()` which takes three main arguments: + +- The first argument, `when`, gives the version number when the deprecation occurred. + +- The second argument, `what`, describes exactly what was deprecated. + +- The third argument, `with`, provides the recommended alternative. + +We'll cover the details shortly, but here are a few sample uses: + +```{r} +lifecycle::deprecate_warn("1.0.0", "old_fun()", "new_fun()") +lifecycle::deprecate_warn("1.0.0", "fun()", "testthat::fun()") +lifecycle::deprecate_warn("1.0.0", "fun(old_arg)", "fun(new_arg)") +``` + +(Note that the message includes the package name --- this is automatically discovered from the environment of the calling function so will not work unless the function is called from the package namespace.) + +The following sections describe how to use lifecycle badges and functions together to handle a variety of common development tasks. + +## Functions + +### Deprecate a function + +First, add a badge to the the `@description` block[^1]. +Briefly describe why the deprecation occurred and what to use instead. + +[^1]: We only use an explicit `@description` when the description will be multiple paragraphs, as in these examples. + +```{r} +#' Add two numbers +#' +#' @description +#' `r lifecycle::badge("deprecated")` +#' +#' This function was deprecated because we realised that it's +#' a special case of the [sum()] function. +``` + +Next, update the examples to show how to convert from the old usage to the new usage: + +```{r} +#' @examples +#' add_two(1, 2) +#' # -> +#' sum(1, 2) +``` + +Then add `@keywords internal` to remove the function from the documentation index. +If you use pkgdown, also check that it's no longer listed in `_pkgdown.yml`. +These changes reduce the chance of new users coming across a deprecated function, but don't prevent those who already know about it from referring to the docs. + +```{r} +#' @keywords internal +``` + +You're now done with the docs, and it's time to add a warning when the user calls your function. +Do this by adding call to `deprecate_warn()` on the first line of the function: + +```{r} +add_two <- function(x, y) { + lifecycle::deprecate_warn("1.0.0", "add_two()", "base::sum()") + x + y +} + +add_two(1, 2) +``` + +`deprecate_warn()` generates user friendly messages for two common deprecation alternatives: + +- Function in same package: `lifecycle::deprecate_warn("1.0.0", "fun_old()", "fun_new()")` + +- Function in another package: `lifecycle::deprecate_warn("1.0.0", "old()", "package::new()")` + +For other cases, use the `details` argument to provide your own message to the user: + +```{r} +add_two <- function(x, y) { + lifecycle::deprecate_warn( + "1.0.0", + "add_two()", + details = "This function is a special case of sum(); use it instead." + ) + x + y +} + +add_two(1, 2) +``` + +It's good practice to test that you've correctly implemented the deprecation, testing that the deprecated function still works and that it generates a useful warning. +Using an expectation inside `testthat::expect_snapshot()`[^2] is a convenient way to do this: + +[^2]: You can learn more about snapshot testing in `vignette("snapshotting", package = "testthat")`. + +```{r, eval = FALSE} +test_that("add_two is deprecated", { + expect_snapshot({ + x <- add_two(1, 1) + expect_equal(x, 2) + }) +}) +``` + +If you have existing tests for the deprecated function you can suppress the warning in those tests with the `lifecycle_verbosity` option: + +```{r, eval = FALSE } +test_that("add_two returns the sum of its inputs", { + withr::local_options(lifecycle_verbosity = "quiet") + expect_equal(add_two(1, 1), 2) +}) +``` + +And then add a separate test specifically for the deprecation. + +```{r, eval = FALSE} +test_that("add_two is deprecated", { + expect_snapshot(add_two(1, 1)) +}) +``` + +### Gradual deprecation + +For particularly important functions, you can choose to add two other stages to the deprecation process: + +- `deprecate_soft()` is used before `deprecate_warn()`. + This function only warns (a) users who try the feature from the global environment and (b) developers who directly use the feature (when running testthat tests). + There is no warning when the deprecated feature is called indirectly by another package --- the goal is to ensure that warn only the person who has the power to stop using the deprecated feature. + +- `deprecate_stop()` comes after `deprecate_warn()` and generates an error instead of a warning. + The main benefit over simply removing the function is that the user is informed about the replacement. + +If you use these stages you'll also need a process for bumping the deprecation stage for major and minor releases. +We recommend something like this: + +1. Search for `deprecate_stop()` and consider if you're ready to the remove the function completely. + +2. Search for `deprecate_warn()` and replace with `deprecate_stop()`. + Remove the remaining body of the function and any tests. + +3. Search for `deprecate_soft()` and replace with `deprecate_warn()`. + +### Rename a function + +To rename a function without breaking existing code, move the implementation to the new function, then call the new function from the old function, along with a deprecation message: + +```{r} +#' Add two numbers +#' +#' @description +#' `r lifecycle::badge("deprecated")` +#' +#' `add_two()` was renamed to `number_add()` to create a more +#' consistent API. +#' @keywords internal +#' @export +add_two <- function(foo, bar) { + lifecycle::deprecate_warn("1.0.0", "add_two()", "number_add()") + number_add(foo, bar) +} + +# documentation goes here... +#' @export +number_add <- function(x, y) { + x + y +} +``` + +If you are renaming many functions as part of an API overhaul, it'll often make sense to document all the changes in one file, like . + +### Supersede a function + +Superseding a function is simpler than deprecating it, since you don't need to steer users away from it with a warning. +So all you need to do is add a superseded badge: + +```{r} +#' Gather columns into key-value pairs +#' +#' @description +#' `r lifecycle::badge("superseded")` +``` + +Then describe why the function was superseded, and what the recommended alternative is: + +```{r} +#' +#' Development on `gather()` is complete, and for new code we recommend +#' switching to `pivot_longer()`, which is easier to use, more featureful, +#' and still under active development. +#' +#' In brief, +#' `df %>% gather("key", "value", x, y, z)` is equivalent to +#' `df %>% pivot_longer(c(x, y, z), names_to = "key", values_to = "value")`. +#' See more details in `vignette("pivot")`. +``` + +The rest of the documentation can stay the same. + +If you're willing to live on the bleeding edge of lifecycle, add a call to the experimental `signal_stage()`: + +```{r} +gather <- function(data, key = "key", value = "value", ...) { + lifecycle::signal_stage("superseded", "gather()") +} +``` + +This signal isn't currently hooked up to any behaviour, but we plan to provide logging and analysis tools in a future release. + +### Mark function as experimental + +To advertise that a function is experimental and the interface might change in the future, first add an experimental badge to the description: + +```{r} +#' @description +#' `r lifecycle::badge("experimental")` +``` + +If the function is very experimental, you might want to add `@keywords internal` too. + +If you're willing to try an experimental lifecycle feature, add a call to `signal_stage()` in the body: + +```{r} +cool_function <- function() { + lifecycle::signal_stage("experimental", "cool_function()") +} +``` + +This signal isn't currently hooked up to any behaviour, but we plan to provide logging and analysis tools in a future release. + +## Arguments + +### Deprecate an argument, keeping the existing default + +Take this example where we want to deprecate `na.rm` in favour of always making it `TRUE.` + +```{r} +add_two <- function(x, y, na.rm = TRUE) { + sum(x, y, na.rm = na.rm) +} +``` + +First, add a badge to the argument description: + +```{r} +#' @param na.rm `r lifecycle::badge("deprecated")` `na.rm = FALSE` is no +#' longer supported; this function will always remove missing values +``` + +And add a deprecation warning if `na.rm` is FALSE. +In this case, there's no replacement to the behaviour, so we instead use `details` to provide a custom message: + +```{r} +add_two <- function(x, y, na.rm = TRUE) { + if (!isTRUE(na.rm)) { + lifecycle::deprecate_warn( + when = "1.0.0", + what = "add_two(na.rm)", + details = "Ability to retain missing values will be dropped in next release." + ) + } + + sum(x, y, na.rm = na.rm) +} + +add_two(1, NA, na.rm = TRUE) +add_two(1, NA, na.rm = FALSE) +``` + +### Deprecating an argument, providing a new default + +Alternatively, you can change the default value to `lifecycle::deprecated()` to make the deprecation status more obvious from the outside, and use `lifecycle::is_present()` to test whether or not the argument was provided. +Unlike `missing()`, this works for both direct and indirect calls. + +```{r} +#' @importFrom lifecycle deprecated +add_two <- function(x, y, na.rm = deprecated()) { + if (lifecycle::is_present(na.rm)) { + lifecycle::deprecate_warn( + when = "1.0.0", + what = "add_two(na.rm)", + details = "Ability to retain missing values will be dropped in next release." + ) + } + + sum(x, y, na.rm = na.rm) +} +``` + +The chief advantage of this technique is that users will get a warning regardless of what value of `na.rm` they use: + +```{r} +add_two(1, NA, na.rm = TRUE) +add_two(1, NA, na.rm = FALSE) +``` + +### Renaming an argument + +You may want to rename an argument if you realise you have made a mistake with the name of an argument. +For example, you've realised that an argument accidentally uses `.` to separate a compound name, instead of `_`. +You'll need to temporarily permit both arguments, generating a deprecation warning when the user supplies the old argument: + +```{r} +add_two <- function(x, y, na_rm = TRUE, na.rm = deprecated()) { + if (lifecycle::is_present(na.rm)) { + lifecycle::deprecate_warn("1.0.0", "add_two(na.rm)", "add_two(na_rm)") + na_rm <- na.rm + } + + sum(x, y, na.rm = na_rm) +} + +add_two(1, NA, na.rm = TRUE) +``` + +### Reducing allowed inputs to an argument + +To narrow the set of allowed inputs, call `deprecate_warn()` only when the user supplies the previously supported inputs. +Make sure you preserve the previous behaviour: + +```{r} +add_two <- function(x, y) { + if (length(y) != 1) { + lifecycle::deprecate_warn("1.0.0", "foo(y = 'must be a scalar')") + y <- sum(y) + } + x + y +} + +add_two(1, 2) +add_two(1, 1:5) +``` + +## Anything else + +You can wrap `what` and `with` in `I()` to deprecate behaviours not otherwise described above: + +```{r} +lifecycle::deprecate_warn( + when = "1.0.0", + what = I('Setting the global option "pkg.opt" to "foo"') +) + +lifecycle::deprecate_warn( + when = "1.0.0", + what = I('The global option "pkg.another_opt"'), + with = I('"pkg.this_opt"') +) +``` + +Note that your `what` fragment needs to make sense with "was deprecated ..." added to the end, and your `with` fragment needs to make sense in the sentence "Please use `{with}` instead". diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/communicate.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/communicate.html new file mode 100644 index 00000000..8b471c07 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/communicate.html @@ -0,0 +1,490 @@ + + + + + + + + + + + + + + +Communicate lifecycle changes in your functions + + + + + + + + + + + + + + + + + + + + + + + + + + +

Communicate lifecycle changes in your functions

+ + + +

lifecycle provides a standard way to document the lifecycle stages of functions and arguments, paired with tools to steer users away from deprecated functions. Before we go in to the details, make sure that you’re familiar with the lifecycle stages as described in vignette("stages").

+
+

Basics

+

lifecycle badges make it easy for users to see the lifecycle stage when reading the documentation. To use the badges, first call usethis::use_lifecycle() to embed the badge images in your package (you only need to do this once), then use lifecycle::badge() to insert a badge:

+
#' `r lifecycle::badge("experimental")`
+#' `r lifecycle::badge("deprecated")`
+#' `r lifecycle::badge("superseded")`
+

Deprecated functions also need to advertise their status when run. lifecycle provides deprecate_warn() which takes three main arguments:

+
    +
  • The first argument, when, gives the version number when the deprecation occurred.

  • +
  • The second argument, what, describes exactly what was deprecated.

  • +
  • The third argument, with, provides the recommended alternative.

  • +
+

We’ll cover the details shortly, but here are a few sample uses:

+
lifecycle::deprecate_warn("1.0.0", "old_fun()", "new_fun()")
+#> Warning: `old_fun()` was deprecated in lifecycle 1.0.0.
+#> ℹ Please use `new_fun()` instead.
+#> ℹ The deprecated feature was likely used in the base package.
+#>   Please report the issue to the authors.
+#> This warning is displayed once every 8 hours.
+#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
+#> generated.
+lifecycle::deprecate_warn("1.0.0", "fun()", "testthat::fun()")
+#> Warning: `fun()` was deprecated in lifecycle 1.0.0.
+#> ℹ Please use `testthat::fun()` instead.
+#> ℹ The deprecated feature was likely used in the base package.
+#>   Please report the issue to the authors.
+#> This warning is displayed once every 8 hours.
+#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
+#> generated.
+lifecycle::deprecate_warn("1.0.0", "fun(old_arg)", "fun(new_arg)")
+#> Warning: The `old_arg` argument of `fun()` is deprecated as of lifecycle 1.0.0.
+#> ℹ Please use the `new_arg` argument instead.
+#> ℹ The deprecated feature was likely used in the base package.
+#>   Please report the issue to the authors.
+#> This warning is displayed once every 8 hours.
+#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
+#> generated.
+

(Note that the message includes the package name — this is automatically discovered from the environment of the calling function so will not work unless the function is called from the package namespace.)

+

The following sections describe how to use lifecycle badges and functions together to handle a variety of common development tasks.

+
+
+

Functions

+
+

Deprecate a function

+

First, add a badge to the the @description block1. Briefly describe why the deprecation occurred and what to use instead.

+
#' Add two numbers
+#' 
+#' @description
+#' `r lifecycle::badge("deprecated")`
+#' 
+#' This function was deprecated because we realised that it's
+#' a special case of the [sum()] function.
+

Next, update the examples to show how to convert from the old usage to the new usage:

+
#' @examples 
+#' add_two(1, 2)
+#' # ->
+#' sum(1, 2)
+

Then add @keywords internal to remove the function from the documentation index. If you use pkgdown, also check that it’s no longer listed in _pkgdown.yml. These changes reduce the chance of new users coming across a deprecated function, but don’t prevent those who already know about it from referring to the docs.

+
#' @keywords internal
+

You’re now done with the docs, and it’s time to add a warning when the user calls your function. Do this by adding call to deprecate_warn() on the first line of the function:

+
add_two <- function(x, y) {
+  lifecycle::deprecate_warn("1.0.0", "add_two()", "base::sum()")
+  x + y
+}
+
+add_two(1, 2)
+#> Warning: `add_two()` was deprecated in lifecycle 1.0.0.
+#> ℹ Please use `base::sum()` instead.
+#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
+#> generated.
+#> [1] 3
+

deprecate_warn() generates user friendly messages for two common deprecation alternatives:

+
    +
  • Function in same package: lifecycle::deprecate_warn("1.0.0", "fun_old()", "fun_new()")

  • +
  • Function in another package: lifecycle::deprecate_warn("1.0.0", "old()", "package::new()")

  • +
+

For other cases, use the details argument to provide your own message to the user:

+
add_two <- function(x, y) {
+  lifecycle::deprecate_warn(
+    "1.0.0", 
+    "add_two()", 
+    details = "This function is a special case of sum(); use it instead."
+  )
+  x + y
+}
+
+add_two(1, 2)
+#> Warning: `add_two()` was deprecated in lifecycle 1.0.0.
+#> ℹ This function is a special case of sum(); use it instead.
+#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
+#> generated.
+#> [1] 3
+

It’s good practice to test that you’ve correctly implemented the deprecation, testing that the deprecated function still works and that it generates a useful warning. Using an expectation inside testthat::expect_snapshot()2 is a convenient way to do this:

+
test_that("add_two is deprecated", {
+  expect_snapshot({
+    x <- add_two(1, 1)
+    expect_equal(x, 2)
+  })
+})
+

If you have existing tests for the deprecated function you can suppress the warning in those tests with the lifecycle_verbosity option:

+
test_that("add_two returns the sum of its inputs", {
+  withr::local_options(lifecycle_verbosity = "quiet")
+  expect_equal(add_two(1, 1), 2)
+})
+

And then add a separate test specifically for the deprecation.

+
test_that("add_two is deprecated", {
+  expect_snapshot(add_two(1, 1))
+})
+
+
+

Gradual deprecation

+

For particularly important functions, you can choose to add two other stages to the deprecation process:

+
    +
  • deprecate_soft() is used before deprecate_warn(). This function only warns (a) users who try the feature from the global environment and (b) developers who directly use the feature (when running testthat tests). There is no warning when the deprecated feature is called indirectly by another package — the goal is to ensure that warn only the person who has the power to stop using the deprecated feature.

  • +
  • deprecate_stop() comes after deprecate_warn() and generates an error instead of a warning. The main benefit over simply removing the function is that the user is informed about the replacement.

  • +
+

If you use these stages you’ll also need a process for bumping the deprecation stage for major and minor releases. We recommend something like this:

+
    +
  1. Search for deprecate_stop() and consider if you’re ready to the remove the function completely.

  2. +
  3. Search for deprecate_warn() and replace with deprecate_stop(). Remove the remaining body of the function and any tests.

  4. +
  5. Search for deprecate_soft() and replace with deprecate_warn().

  6. +
+
+
+

Rename a function

+

To rename a function without breaking existing code, move the implementation to the new function, then call the new function from the old function, along with a deprecation message:

+
#' Add two numbers
+#' 
+#' @description 
+#' `r lifecycle::badge("deprecated")`
+#' 
+#' `add_two()` was renamed to `number_add()` to create a more
+#' consistent API.
+#' @keywords internal
+#' @export
+add_two <- function(foo, bar) {
+  lifecycle::deprecate_warn("1.0.0", "add_two()", "number_add()")
+  number_add(foo, bar)
+}
+
+# documentation goes here...
+#' @export
+number_add <- function(x, y) {
+  x + y
+}
+

If you are renaming many functions as part of an API overhaul, it’ll often make sense to document all the changes in one file, like https://rvest.tidyverse.org/reference/rename.html.

+
+
+

Supersede a function

+

Superseding a function is simpler than deprecating it, since you don’t need to steer users away from it with a warning. So all you need to do is add a superseded badge:

+
#' Gather columns into key-value pairs
+#'
+#' @description
+#' `r lifecycle::badge("superseded")`
+

Then describe why the function was superseded, and what the recommended alternative is:

+
#'
+#' Development on `gather()` is complete, and for new code we recommend
+#' switching to `pivot_longer()`, which is easier to use, more featureful,
+#' and still under active development.
+#' 
+#' In brief,
+#' `df %>% gather("key", "value", x, y, z)` is equivalent to
+#' `df %>% pivot_longer(c(x, y, z), names_to = "key", values_to = "value")`.
+#' See more details in `vignette("pivot")`.
+

The rest of the documentation can stay the same.

+

If you’re willing to live on the bleeding edge of lifecycle, add a call to the experimental signal_stage():

+
gather <- function(data, key = "key", value = "value", ...) {
+  lifecycle::signal_stage("superseded", "gather()")
+}
+

This signal isn’t currently hooked up to any behaviour, but we plan to provide logging and analysis tools in a future release.

+
+
+

Mark function as experimental

+

To advertise that a function is experimental and the interface might change in the future, first add an experimental badge to the description:

+
#' @description
+#' `r lifecycle::badge("experimental")`
+

If the function is very experimental, you might want to add @keywords internal too.

+

If you’re willing to try an experimental lifecycle feature, add a call to signal_stage() in the body:

+
cool_function <- function() {
+  lifecycle::signal_stage("experimental", "cool_function()")
+}
+

This signal isn’t currently hooked up to any behaviour, but we plan to provide logging and analysis tools in a future release.

+
+
+
+

Arguments

+
+

Deprecate an argument, keeping the existing default

+

Take this example where we want to deprecate na.rm in favour of always making it TRUE.

+
add_two <- function(x, y, na.rm = TRUE) {
+  sum(x, y, na.rm = na.rm)
+}
+

First, add a badge to the argument description:

+
#' @param na.rm `r lifecycle::badge("deprecated")` `na.rm = FALSE` is no
+#'   longer supported; this function will always remove missing values
+

And add a deprecation warning if na.rm is FALSE. In this case, there’s no replacement to the behaviour, so we instead use details to provide a custom message:

+
add_two <- function(x, y, na.rm = TRUE) {
+  if (!isTRUE(na.rm)) {
+    lifecycle::deprecate_warn(
+      when = "1.0.0", 
+      what = "add_two(na.rm)",
+      details = "Ability to retain missing values will be dropped in next release."
+    )
+  }
+  
+  sum(x, y, na.rm = na.rm)
+}
+
+add_two(1, NA, na.rm = TRUE)
+#> [1] 1
+add_two(1, NA, na.rm = FALSE)
+#> Warning: The `na.rm` argument of `add_two()` is deprecated as of lifecycle 1.0.0.
+#> ℹ Ability to retain missing values will be dropped in next release.
+#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
+#> generated.
+#> [1] NA
+
+
+

Deprecating an argument, providing a new default

+

Alternatively, you can change the default value to lifecycle::deprecated() to make the deprecation status more obvious from the outside, and use lifecycle::is_present() to test whether or not the argument was provided. Unlike missing(), this works for both direct and indirect calls.

+
#' @importFrom lifecycle deprecated
+add_two <- function(x, y, na.rm = deprecated()) {
+  if (lifecycle::is_present(na.rm)) {
+    lifecycle::deprecate_warn(
+      when = "1.0.0", 
+      what = "add_two(na.rm)",
+      details = "Ability to retain missing values will be dropped in next release."
+    )
+  }
+  
+  sum(x, y, na.rm = na.rm)
+}
+

The chief advantage of this technique is that users will get a warning regardless of what value of na.rm they use:

+
add_two(1, NA, na.rm = TRUE)
+#> Warning: The `na.rm` argument of `add_two()` is deprecated as of lifecycle 1.0.0.
+#> ℹ Ability to retain missing values will be dropped in next release.
+#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
+#> generated.
+#> [1] 1
+add_two(1, NA, na.rm = FALSE)
+#> Warning: The `na.rm` argument of `add_two()` is deprecated as of lifecycle 1.0.0.
+#> ℹ Ability to retain missing values will be dropped in next release.
+#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
+#> generated.
+#> [1] NA
+
+
+

Renaming an argument

+

You may want to rename an argument if you realise you have made a mistake with the name of an argument. For example, you’ve realised that an argument accidentally uses . to separate a compound name, instead of _. You’ll need to temporarily permit both arguments, generating a deprecation warning when the user supplies the old argument:

+
add_two <- function(x, y, na_rm = TRUE, na.rm = deprecated()) {
+  if (lifecycle::is_present(na.rm)) {
+    lifecycle::deprecate_warn("1.0.0", "add_two(na.rm)", "add_two(na_rm)")
+    na_rm <- na.rm
+  }
+  
+  sum(x, y, na.rm = na_rm)
+}
+
+add_two(1, NA, na.rm = TRUE)
+#> Warning: The `na.rm` argument of `add_two()` is deprecated as of lifecycle 1.0.0.
+#> ℹ Please use the `na_rm` argument instead.
+#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
+#> generated.
+#> [1] 1
+
+
+

Reducing allowed inputs to an argument

+

To narrow the set of allowed inputs, call deprecate_warn() only when the user supplies the previously supported inputs. Make sure you preserve the previous behaviour:

+
add_two <- function(x, y) {
+  if (length(y) != 1) {
+    lifecycle::deprecate_warn("1.0.0", "foo(y = 'must be a scalar')")
+    y <- sum(y)
+  }
+  x + y
+}
+
+add_two(1, 2)
+#> [1] 3
+add_two(1, 1:5)
+#> Warning: The `y` argument of `foo()` must be a scalar as of lifecycle 1.0.0.
+#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
+#> generated.
+#> [1] 16
+
+
+
+

Anything else

+

You can wrap what and with in I() to deprecate behaviours not otherwise described above:

+
lifecycle::deprecate_warn(
+  when = "1.0.0",
+  what = I('Setting the global option "pkg.opt" to "foo"')
+)
+#> Warning: Setting the global option "pkg.opt" to "foo" was deprecated in lifecycle 1.0.0.
+#> ℹ The deprecated feature was likely used in the base package.
+#>   Please report the issue to the authors.
+#> This warning is displayed once every 8 hours.
+#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
+#> generated.
+
+lifecycle::deprecate_warn(
+  when = "1.0.0",
+  what = I('The global option "pkg.another_opt"'),
+  with = I('"pkg.this_opt"')
+)
+#> Warning: The global option "pkg.another_opt" was deprecated in lifecycle 1.0.0.
+#> ℹ Please use "pkg.this_opt" instead.
+#> ℹ The deprecated feature was likely used in the base package.
+#>   Please report the issue to the authors.
+#> This warning is displayed once every 8 hours.
+#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
+#> generated.
+

Note that your what fragment needs to make sense with “was deprecated …” added to the end, and your with fragment needs to make sense in the sentence “Please use {with} instead”.

+
+
+
+
    +
  1. We only use an explicit @description when the description will be multiple paragraphs, as in these examples.↩︎

  2. +
  3. You can learn more about snapshot testing in vignette("snapshotting", package = "testthat").↩︎

  4. +
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/index.html new file mode 100644 index 00000000..97156b7d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/index.html @@ -0,0 +1,39 @@ + + +R: Vignettes and other documentation + + + +
+

Vignettes and other documentation + +

+
+
+[Top] +
+

Vignettes from package 'lifecycle'

+ +++++++ + + + + + + + + + + + + + + +
lifecycle::communicateCommunicate lifecycle changes in your functionsHTMLsourceR code
lifecycle::manageManage lifecycle changes in functions you useHTMLsourceR code
lifecycle::stagesLifecycle stagesHTMLsourceR code
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/manage.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/manage.R new file mode 100644 index 00000000..4803373b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/manage.R @@ -0,0 +1,37 @@ +## ----include = FALSE---------------------------------------------------------- +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +options("lifecycle:::calling_package" = "tibble") + +## ----------------------------------------------------------------------------- +data_frame <- function(...) { + lifecycle::deprecate_warn("1.1.0", "data_frame()", "tibble()") + tibble::tibble(...) +} + +## ----------------------------------------------------------------------------- +df1 <- data_frame(x = 1, y = 2) +#> This warning is displayed once every 8 hours. +#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated. +df2 <- data_frame(a = "apple", b = "banana") + +## ----eval = FALSE------------------------------------------------------------- +# lifecycle::last_lifecycle_warnings() +# #> [[1]] +# #> +# #> message: `data_frame()` was deprecated in tibble 1.1.0. +# #> Please use `tibble()` instead. +# #> Backtrace: +# #> 1. global::data_frame(x = 1) + +## ----------------------------------------------------------------------------- +options(lifecycle_verbosity = "warning") +df1 <- data_frame(x = 1, y = 2) +df2 <- data_frame(a = "apple", b = "banana") + +## ----error = TRUE------------------------------------------------------------- +options("lifecycle_verbosity" = "error") +df1 <- data_frame(x = 1, y = 2) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/manage.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/manage.Rmd new file mode 100644 index 00000000..8f179a5e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/manage.Rmd @@ -0,0 +1,73 @@ +--- +title: "Manage lifecycle changes in functions you use" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Manage lifecycle changes in functions you use} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +options("lifecycle:::calling_package" = "tibble") +``` + +The lifecycle package uses warnings to tell you about deprecated functions. +Deprecated functions will be removed in a future release, so it's good practice to eliminate the warnings as soon as you see them. + +For example, lets imagine your code uses `tibble::data_frame()`, which was deprecated in favour of `tibble()` in version 1.1.0. +`data_frame()` now looks something like this: + +```{r} +data_frame <- function(...) { + lifecycle::deprecate_warn("1.1.0", "data_frame()", "tibble()") + tibble::tibble(...) +} +``` + +That means if you use `data_frame()` in your own code you'll get a warning: + +```{r} +df1 <- data_frame(x = 1, y = 2) +#> This warning is displayed once every 8 hours. +#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated. +df2 <- data_frame(a = "apple", b = "banana") +``` + +You'll notice that the warning only appears the first time we call it --- lifecycle only notifies you every 8 hours so it's not overly disruptive if you've used a deprecated function in many places. + +So how do you track down exactly where the warning came from? +Firstly, you might notice the deprecation warning message includes the advice to call `lifecycle::last_lifecycle_warnings()`. +That'll give you a list of all the deprecation warnings that have happened recently: + +```{r, eval = FALSE} +lifecycle::last_lifecycle_warnings() +#> [[1]] +#> +#> message: `data_frame()` was deprecated in tibble 1.1.0. +#> Please use `tibble()` instead. +#> Backtrace: +#> 1. global::data_frame(x = 1) +``` + +Each warning comes with a back trace that shows you the full sequence of calls that lead to the deprecated function. + +Alternatively, if you're ready to spend some time tracking down all your uses of deprecated functions, you can use the `lifecycle_verbosity` option to make deprecated functions warn every time: + +```{r} +options(lifecycle_verbosity = "warning") +df1 <- data_frame(x = 1, y = 2) +df2 <- data_frame(a = "apple", b = "banana") +``` + +Then use `lifecycle::last_lifecycle_warnings()` to track down the source. + +Alternatively, if you want to be really strict, you can turn all deprecation warnings into errors, forcing you to deal with them immediately: + +```{r, error = TRUE} +options("lifecycle_verbosity" = "error") +df1 <- data_frame(x = 1, y = 2) +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/manage.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/manage.html new file mode 100644 index 00000000..765ae1b0 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/manage.html @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + +Manage lifecycle changes in functions you use + + + + + + + + + + + + + + + + + + + + + + + + + + +

Manage lifecycle changes in functions you use

+ + + +

The lifecycle package uses warnings to tell you about deprecated functions. Deprecated functions will be removed in a future release, so it’s good practice to eliminate the warnings as soon as you see them.

+

For example, lets imagine your code uses tibble::data_frame(), which was deprecated in favour of tibble() in version 1.1.0. data_frame() now looks something like this:

+
data_frame <- function(...) {
+  lifecycle::deprecate_warn("1.1.0", "data_frame()", "tibble()")
+  tibble::tibble(...)
+}
+

That means if you use data_frame() in your own code you’ll get a warning:

+
df1 <- data_frame(x = 1, y = 2)
+#> Warning: `data_frame()` was deprecated in tibble 1.1.0.
+#> ℹ Please use `tibble()` instead.
+#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
+#> generated.
+#> This warning is displayed once every 8 hours.
+#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
+df2 <- data_frame(a = "apple", b = "banana")
+#> Warning: `data_frame()` was deprecated in tibble 1.1.0.
+#> ℹ Please use `tibble()` instead.
+#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
+#> generated.
+

You’ll notice that the warning only appears the first time we call it — lifecycle only notifies you every 8 hours so it’s not overly disruptive if you’ve used a deprecated function in many places.

+

So how do you track down exactly where the warning came from? Firstly, you might notice the deprecation warning message includes the advice to call lifecycle::last_lifecycle_warnings(). That’ll give you a list of all the deprecation warnings that have happened recently:

+
lifecycle::last_lifecycle_warnings()
+#> [[1]]
+#> <deprecated>
+#> message: `data_frame()` was deprecated in tibble 1.1.0.
+#> Please use `tibble()` instead.
+#> Backtrace:
+#>  1. global::data_frame(x = 1)
+

Each warning comes with a back trace that shows you the full sequence of calls that lead to the deprecated function.

+

Alternatively, if you’re ready to spend some time tracking down all your uses of deprecated functions, you can use the lifecycle_verbosity option to make deprecated functions warn every time:

+
options(lifecycle_verbosity = "warning")
+df1 <- data_frame(x = 1, y = 2)
+#> Warning: `data_frame()` was deprecated in tibble 1.1.0.
+#> ℹ Please use `tibble()` instead.
+#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
+#> generated.
+df2 <- data_frame(a = "apple", b = "banana")
+#> Warning: `data_frame()` was deprecated in tibble 1.1.0.
+#> ℹ Please use `tibble()` instead.
+#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
+#> generated.
+

Then use lifecycle::last_lifecycle_warnings() to track down the source.

+

Alternatively, if you want to be really strict, you can turn all deprecation warnings into errors, forcing you to deal with them immediately:

+
options("lifecycle_verbosity" = "error")
+df1 <- data_frame(x = 1, y = 2)
+#> Error:
+#> ! `data_frame()` was deprecated in tibble 1.1.0.
+#> ℹ Please use `tibble()` instead.
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/stages.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/stages.R new file mode 100644 index 00000000..6ab0d652 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/stages.R @@ -0,0 +1,8 @@ +## ----eval = FALSE------------------------------------------------------------- +# df <- tibble::data_frame(x = 1) +# #> Warning message: +# #> `data_frame()` is deprecated as of tibble 1.1.0. +# #> Please use `tibble()` instead. +# #> This warning is displayed once every 8 hours. +# #> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated. + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/stages.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/stages.Rmd new file mode 100644 index 00000000..0aef65a3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/stages.Rmd @@ -0,0 +1,112 @@ +--- +title: "Lifecycle stages" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Lifecycle stages} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +This vignette describes the four primary stages of the tidyverse lifecycle: stable, deprecated, superseded, and experimental. + +![A diagram showing the transitions between the four main stages: experimental can become stable and stable can become deprecated or superseded.](figures/lifecycle.svg){width="75%"} + +The lifecycle stages can apply to packages, functions, function arguments, and even specific values of a function argument. +However, you'll mostly see them used to label individual functions, so that's the language we use below. + +## Stable + +The default development stage is ![stable](figures/lifecycle-stable.svg){style="vertical-align:middle"}. +A function is considered stable when the author is happy with its interface, doesn't see major issues, and is happy to share it with the world. +Because this stage is the default, functions will only be given a stable badge if there's some specific need to draw attention to their status. + +Stability is defined in terms of breaking changes. +A **breaking change** is a change that breaks code that uses the function as expected. +In general, breaking changes reduce the set of code that works without error, either by removing a function, removing a function argument, or decreasing the set of valid inputs. +Breaking changes also include changes to output type. +If you imagine all the possible inputs to a function that return a result (and not an error), a breaking change makes the set smaller. + +Not all changes that cause your function to stop working are breaking changes. +For example, you might have accidentally relied on a bug. +When the bug is fixed, your code breaks, but this is not a breaking change. +A good way of making your code more robust to this sort of behaviour change is to only use a function for its explicitly intended effects. +For example, using `c()` to concatenate two vectors will not put your code at risk because it clearly is the intended usage of this function. +On the other hand, using `c()` just for the side effect of removing attributes is probably not a good idea. +For example, if you had used `c(factor("foo"))` to retrieve the underlying integers of a factor, your code will have broken when R added support for concatenating factors in R 4.1.0. + +Stable functions come with two promises related to breaking changes: + +- Breaking changes will be avoided where possible. + We'll only make breaking changes if we consider the long term benefit of the change to be greater than short term pain of changing existing code. + +- If a breaking change is needed, it will occur gradually, through the deprecation process described next. + This gives you plenty of time to adjust your code before it starts generating errors. + +## Deprecated + +A ![Deprecated](figures/lifecycle-deprecated.svg){style="vertical-align:middle"} function has a better alternative available and is scheduled for removal. +When you call a deprecated function, you get a warning telling you what to use instead. +For example, take `tibble::as_data_frame()`: + +```{r, eval = FALSE} +df <- tibble::data_frame(x = 1) +#> Warning message: +#> `data_frame()` is deprecated as of tibble 1.1.0. +#> Please use `tibble()` instead. +#> This warning is displayed once every 8 hours. +#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated. +``` + +The deprecation warning tells you when the function was deprecated (in tibble 1.1.0, released in 2016), and what to use instead (`tibble()`). +To avoid being too annoying, deprecation messages will only appear once per session, and you can find out exactly where they come from by calling `lifecycle::last_lifecycle_warnings()`. +`vignette("manage")` provides more advice on handling deprecation warnings in your code. + +Particularly important functions may go through two additional stages of deprecation: + +- **Soft deprecated** comes before deprecated. + It's a gentler form of deprecation designed to prevent new uses of a function and encourage package developers to move away from it. + Soft deprecated allows a package to change its interface to encourage package developers to update their code before their users are forced to change. + +- **Defunct** comes after deprecated. + In most cases, a deprecated function will eventually just be deleted. + For very important functions, we'll instead make the function defunct, which means that function continues to exist but the deprecation warning turns into an error. + This is more user-friendly than just removing the function because users will get a clear error message explaining why their code no longer works and how they can fix it. + +## Superseded + +A softer alternative to deprecation is superseded. +A ![superseded](figures/lifecycle-superseded.svg)[^1] function has a known better alternative, but the function itself is not going away +. A superseded function will not emit a warning (since there's no risk if you keep using it), but the documentation will tell you what we recommend instead +. + +[^1]: This stage was previously called retired. + +Superseded functions will not receive new features, but will receive any critical bug fixes needed to keep it working. +In some ways a superseded function is actually safer than a stable function because it's guaranteed never to change (for better or for worse). + +## Experimental + +Some functions are released in an ![experimental](figures/lifecycle-experimental.svg){style="vertical-align:middle"} stage. +Experimental functions are made available so people can try them out and provide feedback, but come with no promises for long term stability. +In particular, the author reserves the right to make breaking changes without a deprecation cycle. +That said, there is some interaction between popularity and stability. +Breaking a popular function, even if clearly labelled as experimental, is likely to cause widespread pain so we'll generally try to avoid it. + +In general, you can assume any package with version number less than 1.0.0 is at least somewhat experimental, and it may have major changes in its future. +The most experimental packages only exist on GitHub. +If you're using a non-CRAN package you should plan for an active relationship: when the package changes, you need to be prepared to update your code. + +## Superseded stages + +We no longer use these stages, but we document them here because we have used them in the past. + +### Questioning + +Sometimes the author of a function is no longer certain that a function is the optimal approach, but doesn't yet know how to do it better. +These functions can be marked as ![questioning](figures/lifecycle-questioning.svg){style="vertical-align:middle"} to give users a heads up that the author has doubts about the function. +Because knowing that a function is questioning is not very actionable, we no longer use or recommend this stage. + +### Maturing + +Previously we used as ![maturing](figures/lifecycle-maturing.svg){style="vertical-align:middle"} for functions that lay somewhere between experimental and stable. +We stopped using this stage because, like questioning, it's not clear what actionable information this stage delivers. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/stages.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/stages.html new file mode 100644 index 00000000..17d9b393 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/doc/stages.html @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + +Lifecycle stages + + + + + + + + + + + + + + + + + + + + + + + + + + +

Lifecycle stages

+ + + +

This vignette describes the four primary stages of the tidyverse lifecycle: stable, deprecated, superseded, and experimental.

+
+ +

A diagram showing the transitions between the four main stages: experimental can become stable and stable can become deprecated or superseded.

+
+

The lifecycle stages can apply to packages, functions, function arguments, and even specific values of a function argument. However, you’ll mostly see them used to label individual functions, so that’s the language we use below.

+
+

Stable

+

The default development stage is stable. A function is considered stable when the author is happy with its interface, doesn’t see major issues, and is happy to share it with the world. Because this stage is the default, functions will only be given a stable badge if there’s some specific need to draw attention to their status.

+

Stability is defined in terms of breaking changes. A breaking change is a change that breaks code that uses the function as expected. In general, breaking changes reduce the set of code that works without error, either by removing a function, removing a function argument, or decreasing the set of valid inputs. Breaking changes also include changes to output type. If you imagine all the possible inputs to a function that return a result (and not an error), a breaking change makes the set smaller.

+

Not all changes that cause your function to stop working are breaking changes. For example, you might have accidentally relied on a bug. When the bug is fixed, your code breaks, but this is not a breaking change. A good way of making your code more robust to this sort of behaviour change is to only use a function for its explicitly intended effects. For example, using c() to concatenate two vectors will not put your code at risk because it clearly is the intended usage of this function. On the other hand, using c() just for the side effect of removing attributes is probably not a good idea. For example, if you had used c(factor("foo")) to retrieve the underlying integers of a factor, your code will have broken when R added support for concatenating factors in R 4.1.0.

+

Stable functions come with two promises related to breaking changes:

+
    +
  • Breaking changes will be avoided where possible. We’ll only make breaking changes if we consider the long term benefit of the change to be greater than short term pain of changing existing code.

  • +
  • If a breaking change is needed, it will occur gradually, through the deprecation process described next. This gives you plenty of time to adjust your code before it starts generating errors.

  • +
+
+
+

Deprecated

+

A Deprecated function has a better alternative available and is scheduled for removal. When you call a deprecated function, you get a warning telling you what to use instead. For example, take tibble::as_data_frame():

+
df <- tibble::data_frame(x = 1)
+#> Warning message:
+#> `data_frame()` is deprecated as of tibble 1.1.0.
+#> Please use `tibble()` instead.
+#> This warning is displayed once every 8 hours.
+#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated. 
+

The deprecation warning tells you when the function was deprecated (in tibble 1.1.0, released in 2016), and what to use instead (tibble()). To avoid being too annoying, deprecation messages will only appear once per session, and you can find out exactly where they come from by calling lifecycle::last_lifecycle_warnings(). vignette("manage") provides more advice on handling deprecation warnings in your code.

+

Particularly important functions may go through two additional stages of deprecation:

+
    +
  • Soft deprecated comes before deprecated. It’s a gentler form of deprecation designed to prevent new uses of a function and encourage package developers to move away from it. Soft deprecated allows a package to change its interface to encourage package developers to update their code before their users are forced to change.

  • +
  • Defunct comes after deprecated. In most cases, a deprecated function will eventually just be deleted. For very important functions, we’ll instead make the function defunct, which means that function continues to exist but the deprecation warning turns into an error. This is more user-friendly than just removing the function because users will get a clear error message explaining why their code no longer works and how they can fix it.

  • +
+
+
+

Superseded

+

A softer alternative to deprecation is superseded. A superseded1 function has a known better alternative, but the function itself is not going away . A superseded function will not emit a warning (since there’s no risk if you keep using it), but the documentation will tell you what we recommend instead .

+

Superseded functions will not receive new features, but will receive any critical bug fixes needed to keep it working. In some ways a superseded function is actually safer than a stable function because it’s guaranteed never to change (for better or for worse).

+
+
+

Experimental

+

Some functions are released in an experimental stage. Experimental functions are made available so people can try them out and provide feedback, but come with no promises for long term stability. In particular, the author reserves the right to make breaking changes without a deprecation cycle. That said, there is some interaction between popularity and stability. Breaking a popular function, even if clearly labelled as experimental, is likely to cause widespread pain so we’ll generally try to avoid it.

+

In general, you can assume any package with version number less than 1.0.0 is at least somewhat experimental, and it may have major changes in its future. The most experimental packages only exist on GitHub. If you’re using a non-CRAN package you should plan for an active relationship: when the package changes, you need to be prepared to update your code.

+
+
+

Superseded stages

+

We no longer use these stages, but we document them here because we have used them in the past.

+
+

Questioning

+

Sometimes the author of a function is no longer certain that a function is the optimal approach, but doesn’t yet know how to do it better. These functions can be marked as questioning to give users a heads up that the author has doubts about the function. Because knowing that a function is questioning is not very actionable, we no longer use or recommend this stage.

+
+
+

Maturing

+

Previously we used as maturing for functions that lay somewhere between experimental and stable. We stopped using this stage because, like questioning, it’s not clear what actionable information this stage delivers.

+
+
+
+
+
    +
  1. This stage was previously called retired.↩︎

  2. +
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/AnIndex new file mode 100644 index 00000000..9a82a69e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/AnIndex @@ -0,0 +1,18 @@ +lifecycle-package lifecycle-package +badge badge +deprecated deprecated +deprecate_soft deprecate_soft +deprecate_stop deprecate_soft +deprecate_warn deprecate_soft +expect_defunct expect_deprecated +expect_deprecated expect_deprecated +is_present deprecated +last_lifecycle_warnings last_lifecycle_warnings +lifecycle lifecycle-package +lint_lifecycle lint_lifecycle +lint_tidyverse_lifecycle lint_lifecycle +pkg_lifecycle_statuses lint_lifecycle +signal_experimental signal_experimental +signal_stage signal_stage +signal_superseded signal_experimental +verbosity verbosity diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/aliases.rds new file mode 100644 index 00000000..038f2241 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-archived.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-archived.svg new file mode 100644 index 00000000..745ab0c7 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-archived.svg @@ -0,0 +1,21 @@ + + lifecycle: archived + + + + + + + + + + + + + + + lifecycle + + archived + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-defunct.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-defunct.svg new file mode 100644 index 00000000..ed45c62b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-defunct.svg @@ -0,0 +1,21 @@ + + lifecycle: defunct + + + + + + + + + + + + + + + lifecycle + + defunct + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-deprecated.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-deprecated.svg new file mode 100644 index 00000000..b61c57c3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-deprecated.svg @@ -0,0 +1,21 @@ + + lifecycle: deprecated + + + + + + + + + + + + + + + lifecycle + + deprecated + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-experimental.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-experimental.svg new file mode 100644 index 00000000..5d88fc2c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-experimental.svg @@ -0,0 +1,21 @@ + + lifecycle: experimental + + + + + + + + + + + + + + + lifecycle + + experimental + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-maturing.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-maturing.svg new file mode 100644 index 00000000..897370ec --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-maturing.svg @@ -0,0 +1,21 @@ + + lifecycle: maturing + + + + + + + + + + + + + + + lifecycle + + maturing + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-questioning.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-questioning.svg new file mode 100644 index 00000000..7c1721d0 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-questioning.svg @@ -0,0 +1,21 @@ + + lifecycle: questioning + + + + + + + + + + + + + + + lifecycle + + questioning + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-retired.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-retired.svg new file mode 100644 index 00000000..8822d2d1 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-retired.svg @@ -0,0 +1,21 @@ + + lifecycle: retired + + + + + + + + + + + + + + + lifecycle + + retired + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-soft-deprecated.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-soft-deprecated.svg new file mode 100644 index 00000000..9c166ff3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-soft-deprecated.svg @@ -0,0 +1,21 @@ + + lifecycle: soft-deprecated + + + + + + + + + + + + + + + lifecycle + + soft-deprecated + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-stable.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-stable.svg new file mode 100644 index 00000000..9bf21e76 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-stable.svg @@ -0,0 +1,29 @@ + + lifecycle: stable + + + + + + + + + + + + + + + + lifecycle + + + + stable + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-superseded.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-superseded.svg new file mode 100644 index 00000000..db8d757f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/figures/lifecycle-superseded.svg @@ -0,0 +1,21 @@ + + lifecycle: superseded + + + + + + + + + + + + + + + lifecycle + + superseded + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/lifecycle.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/lifecycle.rdb new file mode 100644 index 00000000..f12c90bf Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/lifecycle.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/lifecycle.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/lifecycle.rdx new file mode 100644 index 00000000..9865dc39 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/lifecycle.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/macros/lifecycle.Rd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/macros/lifecycle.Rd new file mode 100644 index 00000000..72700d6b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/macros/lifecycle.Rd @@ -0,0 +1,2 @@ + +\newcommand{\lifecycle}{\Sexpr[results=rd, stage=render]{lifecycle::badge("#1")}} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/paths.rds new file mode 100644 index 00000000..81111f0f Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/html/00Index.html new file mode 100644 index 00000000..476f1031 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/html/00Index.html @@ -0,0 +1,55 @@ + + +R: Manage the Life Cycle of your Package Functions + + + +
+

Manage the Life Cycle of your Package Functions + +

+
+
+[Up] +[Top] +

Documentation for package ‘lifecycle’ version 1.0.4

+ + + +

Help Pages

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
badgeEmbed a lifecycle badge in documentation
deprecatedMark an argument as deprecated
deprecate_softDeprecate functions and arguments
deprecate_stopDeprecate functions and arguments
deprecate_warnDeprecate functions and arguments
expect_defunctDoes expression produce lifecycle warnings or errors?
expect_deprecatedDoes expression produce lifecycle warnings or errors?
is_presentMark an argument as deprecated
last_lifecycle_warningsDisplay last deprecation warnings
lint_lifecycleLint usages of functions that have a non-stable life cycle.
lint_tidyverse_lifecycleLint usages of functions that have a non-stable life cycle.
pkg_lifecycle_statusesLint usages of functions that have a non-stable life cycle.
signal_stageSignal other experimental or superseded features
verbosityControl the verbosity of deprecation signals
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/lifecycle/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/DESCRIPTION new file mode 100644 index 00000000..a821ca9b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/DESCRIPTION @@ -0,0 +1,46 @@ +Type: Package +Package: magrittr +Title: A Forward-Pipe Operator for R +Version: 2.0.3 +Authors@R: c( + person("Stefan Milton", "Bache", , "stefan@stefanbache.dk", role = c("aut", "cph"), + comment = "Original author and creator of magrittr"), + person("Hadley", "Wickham", , "hadley@rstudio.com", role = "aut"), + person("Lionel", "Henry", , "lionel@rstudio.com", role = "cre"), + person("RStudio", role = c("cph", "fnd")) + ) +Description: Provides a mechanism for chaining commands with a new + forward-pipe operator, %>%. This operator will forward a value, or the + result of an expression, into the next function call/expression. + There is flexible support for the type of right-hand side expressions. + For more information, see package vignette. To quote Rene Magritte, + "Ceci n'est pas un pipe." +License: MIT + file LICENSE +URL: https://magrittr.tidyverse.org, + https://github.com/tidyverse/magrittr +BugReports: https://github.com/tidyverse/magrittr/issues +Depends: R (>= 3.4.0) +Suggests: covr, knitr, rlang, rmarkdown, testthat +VignetteBuilder: knitr +ByteCompile: Yes +Config/Needs/website: tidyverse/tidytemplate +Encoding: UTF-8 +RoxygenNote: 7.1.2 +NeedsCompilation: yes +Packaged: 2022-03-29 09:34:37 UTC; lionel +Author: Stefan Milton Bache [aut, cph] (Original author and creator of + magrittr), + Hadley Wickham [aut], + Lionel Henry [cre], + RStudio [cph, fnd] +Maintainer: Lionel Henry +Repository: CRAN +Date/Publication: 2022-03-30 07:30:09 UTC +Built: R 4.4.1; aarch64-apple-darwin20; 2025-01-25 22:02:35 UTC; unix +Archs: magrittr.so.dSYM +RemoteType: standard +RemotePkgRef: magrittr +RemoteRef: magrittr +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 2.0.3 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/INDEX new file mode 100644 index 00000000..49f9c22d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/INDEX @@ -0,0 +1,14 @@ +%$% Exposition pipe +%<>% Assignment pipe +%>% Pipe +%T>% Tee pipe +[[.fseq Extract function(s) from a functional sequence. +debug_fseq Debugging function for functional sequences. +debug_pipe Debugging function for magrittr pipelines. +extract Aliases +faq-pipe-gender FAQ: What is the gender of the pipe? +freduce Apply a list of functions sequentially +functions Extract the function list from a functional + sequence. +pipe-eager Eager pipe +print.fseq Print method for functional sequence. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/LICENSE new file mode 100644 index 00000000..b77588f5 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2019 +COPYRIGHT HOLDER: Stefan Milton Bache and Hadley Wickham diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/Meta/Rd.rds new file mode 100644 index 00000000..a307f88d Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/Meta/hsearch.rds new file mode 100644 index 00000000..2bb9cbe9 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/Meta/links.rds new file mode 100644 index 00000000..4714033e Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/Meta/nsInfo.rds new file mode 100644 index 00000000..7640b3fd Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/Meta/package.rds new file mode 100644 index 00000000..2a21ef9b Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/Meta/vignette.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/Meta/vignette.rds new file mode 100644 index 00000000..847a55ad Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/Meta/vignette.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/NAMESPACE new file mode 100644 index 00000000..a164b861 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/NAMESPACE @@ -0,0 +1,48 @@ +# Generated by roxygen2: do not edit by hand + +S3method("[",fseq) +S3method("[[",fseq) +S3method(print,fseq) +export("%!>%") +export("%$%") +export("%<>%") +export("%>%") +export("%T>%") +export("n'est pas") +export(add) +export(and) +export(debug_fseq) +export(debug_pipe) +export(divide_by) +export(divide_by_int) +export(equals) +export(extract) +export(extract2) +export(freduce) +export(functions) +export(inset) +export(inset2) +export(is_greater_than) +export(is_in) +export(is_less_than) +export(is_weakly_greater_than) +export(is_weakly_less_than) +export(mod) +export(multiply_by) +export(multiply_by_matrix) +export(not) +export(or) +export(pipe_eager_lexical) +export(pipe_lazy_masking) +export(pipe_nested) +export(raise_to_power) +export(set_attr) +export(set_attributes) +export(set_class) +export(set_colnames) +export(set_names) +export(set_rownames) +export(subtract) +export(undebug_fseq) +export(use_series) +useDynLib(magrittr, .registration = TRUE) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/NEWS.md new file mode 100644 index 00000000..1db82930 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/NEWS.md @@ -0,0 +1,233 @@ +# magrittr 2.0.3 + +* Fixed a C level protection issue in `%>%` (#256). + + +# magrittr 2.0.2 + +* New eager pipe `%!>%` for sequential evaluation (#247). Consider + using `force()` in your functions instead to make them strict, if + sequentiality is required. See the examples in `?"pipe-eager"`. + +* Fixed an issue that could cause pipe invocations to fail in versions of + R built with `--enable-strict-barrier`. (#239, @kevinushey) + + +# magrittr 2.0.1 + +* Fixed issue caused by objects with certain names being present in + the calling environment (#233). + +* Fixed regression in `freduce()` with long lists (kcf-jackson/sketch#5). + + +# magrittr 2.0.0 + +## Fast and lean implementation of the pipe + +The pipe has been rewritten in C with the following goals in mind: + +- Minimal performance cost. +- Minimal impact on backtraces. +- No impact on reference counts. + +As part of this rewrite we have changed the behaviour of the pipe to +make it closer to the implementation that will likely be included in a +future version of R. The pipe now evaluates piped expressions lazily (#120). +The main consequence of this change is that warnings and errors can +now be handled by trailing pipe calls: + +```r +stop("foo") %>% try() +warning("bar") %>% suppressWarnings() +``` + + +## Breaking changes + +The pipe rewrite should generally not affect your code. We have +checked magrittr on 2800 CRAN packages and found only a dozen of +failures. The development version of magrittr has been advertised on +social media for a 3 months trial period, and no major issues were +reported. However, there are some corner cases that might require +updating your code. Below is a report of the backward +incompatibilities we found in real code to help you transition, should +you find an issue in your code. + + +### Behaviour of `return()` in a pipeline + +In previous versions of magrittr, the behaviour of `return()` within +pipe expressions was undefined. Should it return from the current pipe +expression, from the whole pipeline, or from the enclosing function? +The behaviour that makes the most sense is to return from the +enclosing function. However, we can't make this work easily with the +new implementation, and so calling `return()` is now an error. + +```r +my_function <- function(x) { + x %>% { + if (.) return("true") + "false" + } +} + +my_function(TRUE) +#> Error: no function to return from, jumping to top level +``` + +In magrittr 1.5, `return()` used to return from the current pipe +expression. You can rewrite this to the equivalent: + +```r +my_function <- function(x) { + x %>% { + if (.) { + "true" + } else { + "false" + } + } +} + +my_function(TRUE) +#> [1] "true" +``` + +For backward-compatibility we have special-cased trailing `return()` +calls as this is a common occurrence in packages: + +```r +1 %>% identity() %>% return() +``` + +Note however that this only returns from the pipeline, not the +enclosing function (which is the historical behaviour): + +```r +my_function <- function() { + "value" %>% identity() %>% return() + "wrong value" +} + +my_function() +#> [1] "wrong value" +``` + +It is generally best to avoid using `return()` in a pipeline, even if +trailing. + + +### Failures caused by laziness + +With the new lazy model for the evaluation of pipe expressions, +earlier parts of a pipeline are not yet evaluated when the last pipe +expression is called. They only get evaluated when the last function +actually uses the piped arguments: + +```r +ignore <- function(x) "return value" +stop("never called") %>% ignore() +#> [1] "return value" +``` + +This should generally not cause problems. However we found some +functions with special behaviour, written under the assumption that +earlier parts of the pipeline were already evaluated and had already +produced side effects. This is generally incorrect behaviour because +that means that these functions do not work properly when called +with the nested form, e.g. `f(g(1))` instead of `1 %>% g() %>% f()`. + +The solution to fix this is to call `force()` on the inputs to force +evaluation, and only then check for side effects: + +```r +my_function <- function(data) { + force(data) + peek_side_effect() +} +``` + +Another issue caused by laziness is that if any function in a pipeline +returns invisibly, than the whole pipeline returns invisibly as well. + +```r +1 %>% identity() %>% invisible() +1 %>% invisible() %>% identity() +1 %>% identity() %>% invisible() %>% identity() +``` + +This is consistent with the equivalent nested code. This behaviour can +be worked around in two ways. You can force visibility by wrapping the +pipeline in parentheses: + +```r +my_function <- function(x) { + (x %>% invisible() %>% identity()) +} +``` + +Or by assigning the result to a variable and return it: + +```r +my_function <- function(x) { + out <- x %>% invisible() %>% identity() + out +} +``` + + +### Incorrect call stack introspection + +The magrittr expressions are no longer evaluated in frames that can be +inspected by `sys.frames()` or `sys.parent()`. Using these functions +for implementing actual functionality (as opposed as debugging tools) +is likely to produce bugs. Instead, you should generally use +`parent.frame()` which works even when R code is called from +non-inspectable frames. This happens with e.g. `do.call()` and the new +C implementation of magrittr. + + +### Incorrect assumptions about magrittr internals + +Some packages were depending on how magrittr was internally +structured. Robust code should only use the documented and exported +API of other packages. + + +## Bug fixes + +* Can now use the placeholder `.` with the splicing operator `!!!` + from rlang (#191). + +* Piped arguments are now persistent. They can be evaluated after the + pipeline has returned, which fixes subtle issues with function + factories (#159, #195). + + +# magrittr 1.5 + +## New features + +### Functional sequences. +A pipeline, or a "functional sequence", need not be applied +to a left-hand side value instantly. Instead it can serve as +a function definition. A pipeline where the left-most left-hand +side is the magrittr placeholder (the dot `.`) will thus create a +function, which applies each right-hand side in sequence to its +argument, e.g. `f <- . %>% abs %>% mean(na.rm = TRUE)`. + +### New operators +Three new operators are introduced for some special cases + +* Assignment pipe: `%<>%` +* Tee pipe: `%T>%` +* Exposition pipe: `%$%` + +For more information see the documentation, e.g. `?%T>%`. + +### Lambdas +Lambdas can now be made by enclosing several statements in curly braces, +and is a unary function of the dot argument. + +For more information and examples, see the updated vignette, and help files. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/R/magrittr b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/R/magrittr new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/R/magrittr @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/R/magrittr.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/R/magrittr.rdb new file mode 100644 index 00000000..d9467568 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/R/magrittr.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/R/magrittr.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/R/magrittr.rdx new file mode 100644 index 00000000..92bdd64a Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/R/magrittr.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/doc/index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/doc/index.html new file mode 100644 index 00000000..d0aa6866 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/doc/index.html @@ -0,0 +1,34 @@ + + +R: Vignettes and other documentation + + + +
+

Vignettes and other documentation + +

+
+
+[Top] +
+

Vignettes from package 'magrittr'

+ +++++++ + + + + + + + + + +
magrittr::magrittrIntroducing magrittrHTMLsourceR code
magrittr::tradeoffsDesign tradeoffsHTMLsourceR code
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/doc/magrittr.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/doc/magrittr.R new file mode 100644 index 00000000..28d8fcc8 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/doc/magrittr.R @@ -0,0 +1,75 @@ +## ----include = FALSE---------------------------------------------------------- +library(magrittr) +options(scipen = 3) +knitr::opts_chunk$set(comment = "#>", collapse = TRUE) + +## ----------------------------------------------------------------------------- +library(magrittr) + +car_data <- + mtcars %>% + subset(hp > 100) %>% + aggregate(. ~ cyl, data = ., FUN = . %>% mean %>% round(2)) %>% + transform(kpl = mpg %>% multiply_by(0.4251)) %>% + print + +## ----------------------------------------------------------------------------- +car_data <- + transform(aggregate(. ~ cyl, + data = subset(mtcars, hp > 100), + FUN = function(x) round(mean(x), 2)), + kpl = mpg*0.4251) + +## ---- eval = FALSE------------------------------------------------------------ +# car_data %>% +# (function(x) { +# if (nrow(x) > 2) +# rbind(head(x, 1), tail(x, 1)) +# else x +# }) + +## ----------------------------------------------------------------------------- +car_data %>% +{ + if (nrow(.) > 0) + rbind(head(., 1), tail(., 1)) + else . +} + +## ----------------------------------------------------------------------------- +1:10 %>% (substitute(f(), list(f = sum))) + +## ---- fig.keep='none'--------------------------------------------------------- +rnorm(200) %>% +matrix(ncol = 2) %T>% +plot %>% # plot usually does not return anything. +colSums + +## ---- eval = FALSE------------------------------------------------------------ +# iris %>% +# subset(Sepal.Length > mean(Sepal.Length)) %$% +# cor(Sepal.Length, Sepal.Width) +# +# data.frame(z = rnorm(100)) %$% +# ts.plot(z) + +## ---- eval = FALSE------------------------------------------------------------ +# iris$Sepal.Length %<>% sqrt + +## ----------------------------------------------------------------------------- +rnorm(1000) %>% +multiply_by(5) %>% +add(5) %>% +{ + cat("Mean:", mean(.), + "Variance:", var(.), "\n") + head(.) +} + +## ---- results = 'hide'-------------------------------------------------------- +rnorm(100) %>% `*`(5) %>% `+`(5) %>% +{ + cat("Mean:", mean(.), "Variance:", var(.), "\n") + head(.) +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/doc/magrittr.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/doc/magrittr.Rmd new file mode 100644 index 00000000..af237945 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/doc/magrittr.Rmd @@ -0,0 +1,210 @@ +--- +title: "Introducing magrittr" +author: Stefan Milton Bache +date: November, 2014 +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Introducing magrittr} + %\VignetteEngine{knitr::rmarkdown} + %\usepackage[utf8]{inputenc} +--- + +```{r include = FALSE} +library(magrittr) +options(scipen = 3) +knitr::opts_chunk$set(comment = "#>", collapse = TRUE) +``` + +# Abstract + +The *magrittr* (to be pronounced with a sophisticated french accent) package has +two aims: decrease development time and improve readability and maintainability +of code. Or even shortr: make your code smokin' (puff puff)! + +To achieve its humble aims, *magrittr* (remember the accent) provides a new +"pipe"-like operator, `%>%`, with which you may pipe a value forward into an +expression or function call; something along the lines of ` x %>% f `, rather +than ` f(x)`. This is not an unknown feature elsewhere; a prime example is the +`|>` operator used extensively in `F#` (to say the least) and indeed this +-- along with Unix pipes -- served as a motivation for developing the magrittr +package. + +This vignette describes the main features of *magrittr* and demonstrates +some features which have been added since the initial release. + +# Introduction and basics + +At first encounter, you may wonder whether an operator such as `%>%` can really +be all that beneficial; but as you may notice, it semantically changes your +code in a way that makes it more intuitive to both read and write. + +Consider the following example, in which the `mtcars` dataset shipped with +R is munged a little: +```{r} +library(magrittr) + +car_data <- + mtcars %>% + subset(hp > 100) %>% + aggregate(. ~ cyl, data = ., FUN = . %>% mean %>% round(2)) %>% + transform(kpl = mpg %>% multiply_by(0.4251)) %>% + print +``` +We start with a value, here `mtcars` (a `data.frame`). From there, we extract a +subset, aggregate the information based on the number of cylinders, and then +transform the dataset by adding a variable for kilometers per liter as a +supplement to miles per gallon. Finally we print the result before assigning +it. Note how the code is arranged in the logical order of how you think about +the task: data->transform->aggregate, which is also the same order as the code +will execute. It's like a recipe -- easy to read, easy to follow! + +A horrific alternative would be to write: +```{r} +car_data <- + transform(aggregate(. ~ cyl, + data = subset(mtcars, hp > 100), + FUN = function(x) round(mean(x), 2)), + kpl = mpg*0.4251) +``` +There is a lot more clutter with parentheses, and the mental task of deciphering +the code is more challenging---particularly if you did not write it yourself. + +Note also how "building" a function on the fly for use in `aggregate` is very +simple in *magrittr*: rather than an actual value as the left-hand side in +the pipeline, just use the placeholder. This is also very useful in R's +`*apply` family of functions. + +Granted, you may make the second example better, perhaps throw in a few +temporary variables (which is often avoided to some degree when using +*magrittr*), but one often sees cluttered lines like the ones presented. + +And here is another selling point: suppose I want to quickly add another step +somewhere in the process. This is very easy to do in the pipeline version, but +a little more challenging in the "standard" example. + +The combined example shows a few neat features of the pipe (which it is not): + +1. By default the left-hand side (LHS) will be *piped in* as the first argument of +the function appearing on the right-hand side (RHS). This is the case in the +`subset` and `transform` expressions. +2. `%>%` may be used in a nested fashion, e.g. it may appear in expressions within +arguments. This is illustrated in the `mpg` to `kpl` conversion. +3. When the LHS is needed at a position other than the first, one can use +the dot,`'.'`, as placeholder. This is shown in the `aggregate` expression. +4. The dot in e.g. a formula is *not* confused with a placeholder, which is +utilized in the `aggregate` expression. +5. Whenever only *one* argument (the LHS) is needed, one can omit the empty +parentheses. This is shown in the call to `print` (which also returns its +argument). Here, `LHS %>% print()`, or even `LHS %>% print(.)` would also work. +6. A pipeline with a dot (`.`) as the LHS will create a unary function. This is +used to define the aggregator function. + +One feature, which was not demonstrated above is piping into *anonymous +functions*, or *lambdas*. This is possible using standard function definitions, +e.g.: +```{r, eval = FALSE} +car_data %>% +(function(x) { + if (nrow(x) > 2) + rbind(head(x, 1), tail(x, 1)) + else x +}) +``` +However, *magrittr* also allows a short-hand notation: +```{r} +car_data %>% +{ + if (nrow(.) > 0) + rbind(head(., 1), tail(., 1)) + else . +} +``` +Since all right-hand sides are really "body expressions" of unary functions, +this is only the natural extension of the simple right-hand side expressions. +Of course, longer and more complex functions can be made using this approach. + +In the first example, the anonymous function is enclosed in parentheses. +Whenever you want to use a function- or call-generating statement as right-hand +side, parentheses are used to evaluate the right-hand side before piping takes +place. + +Another, less useful example is: +```{r} +1:10 %>% (substitute(f(), list(f = sum))) +``` + +# Additional pipe operators +*magrittr* also provides three related pipe operators. These are not as common +as `%>%` but they become useful in special cases. + +The "tee" pipe, `%T>%` works like `%>%`, except it returns the left-hand +side value, and not the result of the right-hand side operation. This is useful +when a step in a pipeline is used for its side-effect (printing, plotting, +logging, etc.). As an example (where the actual plot is omitted here): +```{r, fig.keep='none'} +rnorm(200) %>% +matrix(ncol = 2) %T>% +plot %>% # plot usually does not return anything. +colSums +``` + +The "exposition" pipe, `%$%` exposes the names within the left-hand side +object to the right-hand side expression. Essentially, it is a short-hand for +using the `with` functions (and the same left-hand side objects are accepted). +This operator is handy when functions do not themselves have a data argument, as +for example `lm` and `aggregate` do. Here are a few examples as illustration: + +```{r, eval = FALSE} +iris %>% + subset(Sepal.Length > mean(Sepal.Length)) %$% + cor(Sepal.Length, Sepal.Width) + +data.frame(z = rnorm(100)) %$% + ts.plot(z) +``` + +Finally, the "assignment" pipe `%<>%` can be used as the first +pipe in a chain. The effect will be that the result of the pipeline is assigned +to the left-hand side object, rather than returning the result as usual. It is +essentially shorthand notation for expressions like `foo <- foo %>% bar %>% baz`, +which boils down to `foo %<>% bar %>% baz`. Another example is: + +```{r, eval = FALSE} +iris$Sepal.Length %<>% sqrt +``` + +The `%<>%` can be used whenever `expr <- ...` makes sense, e.g. + +* `x %<>% foo %>% bar` +* `x[1:10] %<>% foo %>% bar` +* `x$baz %<>% foo %>% bar` + +# Aliases + +In addition to the `%>%`-operator, *magrittr* provides some aliases for other +operators which make operations such as addition or multiplication fit well +into the *magrittr*-syntax. As an example, consider: +```{r} +rnorm(1000) %>% +multiply_by(5) %>% +add(5) %>% +{ + cat("Mean:", mean(.), + "Variance:", var(.), "\n") + head(.) +} +``` +which could be written in more compact form as: +```{r, results = 'hide'} +rnorm(100) %>% `*`(5) %>% `+`(5) %>% +{ + cat("Mean:", mean(.), "Variance:", var(.), "\n") + head(.) +} +``` +To see a list of the aliases, execute e.g. `?multiply_by`. + +# Development +The *magrittr* package is also available in a development version at the +GitHub development page: +[github.com/tidyverse/magrittr](https://github.com/tidyverse/magrittr). diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/doc/magrittr.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/doc/magrittr.html new file mode 100644 index 00000000..a4d5a96d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/doc/magrittr.html @@ -0,0 +1,280 @@ + + + + + + + + + + + + + + + +Introducing magrittr + + + + + + + + + + + + + + + + + + + + + + + + + + +

Introducing magrittr

+

Stefan Milton Bache

+

November, 2014

+ + + +
+

Abstract

+

The magrittr (to be pronounced with a sophisticated french accent) package has two aims: decrease development time and improve readability and maintainability of code. Or even shortr: make your code smokin’ (puff puff)!

+

To achieve its humble aims, magrittr (remember the accent) provides a new “pipe”-like operator, %>%, with which you may pipe a value forward into an expression or function call; something along the lines of x %>% f, rather than f(x). This is not an unknown feature elsewhere; a prime example is the |> operator used extensively in F# (to say the least) and indeed this – along with Unix pipes – served as a motivation for developing the magrittr package.

+

This vignette describes the main features of magrittr and demonstrates some features which have been added since the initial release.

+
+
+

Introduction and basics

+

At first encounter, you may wonder whether an operator such as %>% can really be all that beneficial; but as you may notice, it semantically changes your code in a way that makes it more intuitive to both read and write.

+

Consider the following example, in which the mtcars dataset shipped with R is munged a little:

+
library(magrittr)
+
+car_data <- 
+  mtcars %>%
+  subset(hp > 100) %>%
+  aggregate(. ~ cyl, data = ., FUN = . %>% mean %>% round(2)) %>%
+  transform(kpl = mpg %>% multiply_by(0.4251)) %>%
+  print
+#>   cyl   mpg   disp     hp drat   wt  qsec   vs   am gear carb       kpl
+#> 1   4 25.90 108.05 111.00 3.94 2.15 17.75 1.00 1.00 4.50 2.00 11.010090
+#> 2   6 19.74 183.31 122.29 3.59 3.12 17.98 0.57 0.43 3.86 3.43  8.391474
+#> 3   8 15.10 353.10 209.21 3.23 4.00 16.77 0.00 0.14 3.29 3.50  6.419010
+

We start with a value, here mtcars (a data.frame). From there, we extract a subset, aggregate the information based on the number of cylinders, and then transform the dataset by adding a variable for kilometers per liter as a supplement to miles per gallon. Finally we print the result before assigning it. Note how the code is arranged in the logical order of how you think about the task: data->transform->aggregate, which is also the same order as the code will execute. It’s like a recipe – easy to read, easy to follow!

+

A horrific alternative would be to write:

+
car_data <- 
+  transform(aggregate(. ~ cyl, 
+                      data = subset(mtcars, hp > 100), 
+                      FUN = function(x) round(mean(x), 2)), 
+            kpl = mpg*0.4251)
+

There is a lot more clutter with parentheses, and the mental task of deciphering the code is more challenging—particularly if you did not write it yourself.

+

Note also how “building” a function on the fly for use in aggregate is very simple in magrittr: rather than an actual value as the left-hand side in the pipeline, just use the placeholder. This is also very useful in R’s *apply family of functions.

+

Granted, you may make the second example better, perhaps throw in a few temporary variables (which is often avoided to some degree when using magrittr), but one often sees cluttered lines like the ones presented.

+

And here is another selling point: suppose I want to quickly add another step somewhere in the process. This is very easy to do in the pipeline version, but a little more challenging in the “standard” example.

+

The combined example shows a few neat features of the pipe (which it is not):

+
    +
  1. By default the left-hand side (LHS) will be piped in as the first argument of the function appearing on the right-hand side (RHS). This is the case in the subset and transform expressions.
  2. +
  3. %>% may be used in a nested fashion, e.g. it may appear in expressions within arguments. This is illustrated in the mpg to kpl conversion.
  4. +
  5. When the LHS is needed at a position other than the first, one can use the dot,'.', as placeholder. This is shown in the aggregate expression.
  6. +
  7. The dot in e.g. a formula is not confused with a placeholder, which is utilized in the aggregate expression.
  8. +
  9. Whenever only one argument (the LHS) is needed, one can omit the empty parentheses. This is shown in the call to print (which also returns its argument). Here, LHS %>% print(), or even LHS %>% print(.) would also work.
  10. +
  11. A pipeline with a dot (.) as the LHS will create a unary function. This is used to define the aggregator function.
  12. +
+

One feature, which was not demonstrated above is piping into anonymous functions, or lambdas. This is possible using standard function definitions, e.g.:

+
car_data %>%
+(function(x) {
+  if (nrow(x) > 2) 
+    rbind(head(x, 1), tail(x, 1))
+  else x
+})
+

However, magrittr also allows a short-hand notation:

+
car_data %>%
+{ 
+  if (nrow(.) > 0)
+    rbind(head(., 1), tail(., 1))
+  else .
+}
+#>   cyl  mpg   disp     hp drat   wt  qsec vs   am gear carb      kpl
+#> 1   4 25.9 108.05 111.00 3.94 2.15 17.75  1 1.00 4.50  2.0 11.01009
+#> 3   8 15.1 353.10 209.21 3.23 4.00 16.77  0 0.14 3.29  3.5  6.41901
+

Since all right-hand sides are really “body expressions” of unary functions, this is only the natural extension of the simple right-hand side expressions. Of course, longer and more complex functions can be made using this approach.

+

In the first example, the anonymous function is enclosed in parentheses. Whenever you want to use a function- or call-generating statement as right-hand side, parentheses are used to evaluate the right-hand side before piping takes place.

+

Another, less useful example is:

+
1:10 %>% (substitute(f(), list(f = sum)))
+#> [1] 55
+
+
+

Additional pipe operators

+

magrittr also provides three related pipe operators. These are not as common as %>% but they become useful in special cases.

+

The “tee” pipe, %T>% works like %>%, except it returns the left-hand side value, and not the result of the right-hand side operation. This is useful when a step in a pipeline is used for its side-effect (printing, plotting, logging, etc.). As an example (where the actual plot is omitted here):

+
rnorm(200) %>%
+matrix(ncol = 2) %T>%
+plot %>% # plot usually does not return anything. 
+colSums
+#> [1]  -4.018676 -27.018219
+

The “exposition” pipe, %$% exposes the names within the left-hand side object to the right-hand side expression. Essentially, it is a short-hand for using the with functions (and the same left-hand side objects are accepted). This operator is handy when functions do not themselves have a data argument, as for example lm and aggregate do. Here are a few examples as illustration:

+
iris %>%
+  subset(Sepal.Length > mean(Sepal.Length)) %$%
+  cor(Sepal.Length, Sepal.Width)
+   
+data.frame(z = rnorm(100)) %$% 
+  ts.plot(z)
+

Finally, the “assignment” pipe %<>% can be used as the first pipe in a chain. The effect will be that the result of the pipeline is assigned to the left-hand side object, rather than returning the result as usual. It is essentially shorthand notation for expressions like foo <- foo %>% bar %>% baz, which boils down to foo %<>% bar %>% baz. Another example is:

+
iris$Sepal.Length %<>% sqrt
+

The %<>% can be used whenever expr <- ... makes sense, e.g. 

+
    +
  • x %<>% foo %>% bar
  • +
  • x[1:10] %<>% foo %>% bar
  • +
  • x$baz %<>% foo %>% bar
  • +
+
+
+

Aliases

+

In addition to the %>%-operator, magrittr provides some aliases for other operators which make operations such as addition or multiplication fit well into the magrittr-syntax. As an example, consider:

+
rnorm(1000)    %>%
+multiply_by(5) %>%
+add(5)         %>%
+{ 
+   cat("Mean:", mean(.), 
+       "Variance:", var(.), "\n")
+   head(.)
+}
+#> Mean: 5.06493 Variance: 27.05389
+#> [1]  2.477662 -3.999358  8.624820  5.322125  3.014306 10.204276
+

which could be written in more compact form as:

+
rnorm(100) %>% `*`(5) %>% `+`(5) %>% 
+{
+  cat("Mean:", mean(.), "Variance:", var(.),  "\n")
+  head(.)
+}
+

To see a list of the aliases, execute e.g. ?multiply_by.

+
+
+

Development

+

The magrittr package is also available in a development version at the GitHub development page: github.com/tidyverse/magrittr.

+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/doc/tradeoffs.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/doc/tradeoffs.R new file mode 100644 index 00000000..1625483e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/doc/tradeoffs.R @@ -0,0 +1,261 @@ +## ----setup, include = FALSE--------------------------------------------------- +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>", + eval = FALSE +) + +library(rlang) +fail <- function() "\u274c" +pass <- function() "\u2705" + +## ----------------------------------------------------------------------------- +# bar(foo(x)) + +## ----------------------------------------------------------------------------- +# local({ +# . <- x +# . <- foo(.) +# bar(.) +# }) + +## ----------------------------------------------------------------------------- +# local({ +# ...1 <- x +# ...2 <- foo(...1) +# bar(...2) +# }) + +## ----------------------------------------------------------------------------- +# with_dot_cleanup <- function(expr) { +# # Initialises `.` in the caller environment and resets it on exit. +# # (We use `:=` instead of `=` to avoid partial matching.) +# rlang::local_bindings(. := NULL, .env = parent.frame()) +# expr +# } +# with_dot_cleanup({ +# . <- x +# . <- foo(.) +# bar(.) +# }) + +## ----------------------------------------------------------------------------- +# mask1 <- new.env(parent = env) +# mask2 <- new.env(parent = env) +# +# delayedAssign(".", x, mask1) +# delayedAssign(".", foo(.), mask2) +# with(mask2, bar(.)) + +## ----------------------------------------------------------------------------- +# local({ +# delayedAssign("...1", x) +# delayedAssign("...2", foo(...1)) +# bar(...2) +# }) + +## ----------------------------------------------------------------------------- +# delayedAssign("...1", x) +# delayedAssign("...2", foo(.)) +# bar(...2) + +## ----------------------------------------------------------------------------- +# sample(10) %>% list(., .) +# +# # Becomes +# list(sample(10), sample(10)) + +## ----------------------------------------------------------------------------- +# sample(10) %>% foo(., .) +# foo(. <- sample(10), .) + +## ---- eval = TRUE------------------------------------------------------------- +`%|>%` <- magrittr::pipe_nested + +## ---- eval = TRUE, error = TRUE----------------------------------------------- +"foo" %|>% list(., .) + +## ---- eval = TRUE------------------------------------------------------------- +{ + stop("oh no") %|>% try(silent = TRUE) + "success" +} + +## ---- eval = TRUE------------------------------------------------------------- +factory <- function(x) function() x +fn <- factory(TRUE) +fn() + +## ----------------------------------------------------------------------------- +# fn <- TRUE %|>% factory() +# fn() + +## ----------------------------------------------------------------------------- +# faulty <- function() stop("tilt") +# f <- function(x) x + 1 +# g <- function(x) x + 2 +# h <- function(x) x + 3 +# +# faulty() %|>% f() %|>% g() %|>% h() +# #> Error in faulty() : tilt +# +# traceback() +# #> 7: stop("tilt") +# #> 6: faulty() +# #> 5: f(faulty()) +# #> 4: g(f(faulty())) +# #> 3: h(g(f(faulty()))) +# #> 2: .External2(magrittr_pipe) at pipe.R#181 +# #> 1: faulty() %|>% f() %|>% g() %|>% h() + +## ---- eval = TRUE------------------------------------------------------------- +foo <- FALSE +TRUE %|>% assign("foo", .) +foo + +## ---- eval = TRUE------------------------------------------------------------- +fn <- function() { + TRUE %|>% return() + FALSE +} +fn() + +## ----------------------------------------------------------------------------- +# options(error = rlang::entrace) + +## ----------------------------------------------------------------------------- +# foobar <- function(x) x %|>% quux() +# quux <- function(x) x %|>% stop() +# +# "tilt" %|>% foobar() +# #> Error in x %|>% stop() : tilt +# +# rlang::last_trace() +# #> +# #> tilt +# #> Backtrace: +# #> █ +# #> 1. ├─"tilt" %|>% foobar() +# #> 2. └─global::foobar("tilt") +# #> 3. ├─x %|>% quux() +# #> 4. └─global::quux(x) +# #> 5. └─x %|>% stop() + +## ---- eval = TRUE------------------------------------------------------------- +`%!>%` <- magrittr::pipe_eager_lexical + +## ---- eval = TRUE------------------------------------------------------------- +"foo" %!>% list(., .) + +## ---- eval = TRUE, error = TRUE----------------------------------------------- +{ + stop("oh no") %!>% try(silent = TRUE) + "success" +} + +## ---- eval = TRUE------------------------------------------------------------- +fn <- TRUE %!>% factory() %!>% { .() } +fn() + +## ---- eval = TRUE, error = TRUE----------------------------------------------- +fn <- TRUE %!>% factory() +fn() + +## ---- eval = TRUE------------------------------------------------------------- +. <- "wrong" +fn <- TRUE %!>% factory() +fn() + +## ----------------------------------------------------------------------------- +# faulty <- function() stop("tilt") +# f <- function(x) x + 1 +# g <- function(x) x + 2 +# h <- function(x) x + 3 +# +# faulty() %!>% f() %!>% g() %!>% h() +# #> Error in faulty() : tilt +# +# traceback() +# #> 4: stop("tilt") +# #> 3: faulty() +# #> 2: .External2(magrittr_pipe) at pipe.R#163 +# #> 1: faulty() %!>% f() %!>% g() %!>% h() + +## ---- eval = TRUE------------------------------------------------------------- +foo <- FALSE +NA %!>% { foo <- TRUE; . } + +foo + +## ---- eval = TRUE------------------------------------------------------------- +fn <- function() { + TRUE %!>% return() + + FALSE +} +fn() + +## ---- eval = TRUE------------------------------------------------------------- +`%?>%` <- magrittr::pipe_lazy_masking + +## ---- eval = TRUE------------------------------------------------------------- +"foo" %?>% list(., .) + +## ---- eval = TRUE------------------------------------------------------------- +{ + stop("oh no") %?>% try(silent = TRUE) + "success" +} + +## ---- eval = TRUE------------------------------------------------------------- +fn <- TRUE %?>% factory() +fn() + +## ----------------------------------------------------------------------------- +# faulty <- function() stop("tilt") +# f <- function(x) x + 1 +# g <- function(x) x + 2 +# h <- function(x) x + 3 +# +# faulty() %?>% f() %?>% g() %?>% h() +# #> Error in faulty() : tilt +# +# traceback() +# #> 7: stop("tilt") +# #> 6: faulty() +# #> 5: f(.) +# #> 4: g(.) +# #> 3: h(.) +# #> 2: .External2(magrittr_pipe) at pipe.R#174 +# #> 1: faulty() %?>% f() %?>% g() %?>% h() + +## ---- eval = TRUE------------------------------------------------------------- +foo <- FALSE +TRUE %?>% assign("foo", .) +foo + +## ---- eval = TRUE, error = TRUE----------------------------------------------- +fn <- function() { + TRUE %?>% return() + FALSE +} +fn() + +## ----------------------------------------------------------------------------- +# foobar <- function(x) x %?>% quux() +# quux <- function(x) x %?>% stop() +# +# "tilt" %?>% foobar() +# #> Error in x %?>% stop() : tilt +# +# rlang::last_trace() +# #> +# #> tilt +# #> Backtrace: +# #> █ +# #> 1. ├─"tilt" %?>% foobar() +# #> 2. ├─global::foobar(.) +# #> 3. │ └─x %?>% quux() +# #> 4. └─global::quux(.) +# #> 5. └─x %?>% stop() + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/doc/tradeoffs.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/doc/tradeoffs.Rmd new file mode 100644 index 00000000..51492c2d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/doc/tradeoffs.Rmd @@ -0,0 +1,544 @@ +--- +title: "Design tradeoffs" +author: + - "Hadley Wickham" + - "Lionel Henry" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Design tradeoffs} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r setup, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>", + eval = FALSE +) + +library(rlang) +fail <- function() "\u274c" +pass <- function() "\u2705" +``` + +There are many different ways that magrittr could implement the pipe. The goal of this document is to elucidate the variations, and the various pros and cons of each approach. This document is primarily aimed at the magrittr developers (so we don't forget about important considerations), but will be of interest to anyone who wants to understand pipes better, or to create their own pipe that makes different tradeoffs + + +## Code transformation + +There are three main options for how we might transform a pipeline in base R expressions. Here they are illustrated with `x %>% foo() %>% bar()`: + +- **Nested** + + ```{r} + bar(foo(x)) + ``` + +- **Eager (mask)**, masking environment + + This is essentially how `%>%` has been implemented prior to magrittr 2.0: + + ```{r} + local({ + . <- x + . <- foo(.) + bar(.) + }) + ``` + +- **Eager (mask-num)**: masking environment, numbered placeholder + + ```{r} + local({ + ...1 <- x + ...2 <- foo(...1) + bar(...2) + }) + ``` + +- **Eager (lexical)**: lexical environment + + This variant assigns pipe expressions to the placeholder `.` in the current environment. This assignment is temporary: once the pipe has returned, the placeholder binding is reset to its previous state. + + ```{r} + with_dot_cleanup <- function(expr) { + # Initialises `.` in the caller environment and resets it on exit. + # (We use `:=` instead of `=` to avoid partial matching.) + rlang::local_bindings(. := NULL, .env = parent.frame()) + expr + } + with_dot_cleanup({ + . <- x + . <- foo(.) + bar(.) + }) + ``` + +- **Lazy (mask)**: masking environments + + ```{r} + mask1 <- new.env(parent = env) + mask2 <- new.env(parent = env) + + delayedAssign(".", x, mask1) + delayedAssign(".", foo(.), mask2) + with(mask2, bar(.)) + ``` + +- **Lazy (mask-num)**: masking environment, numbered placeholder + + ```{r} + local({ + delayedAssign("...1", x) + delayedAssign("...2", foo(...1)) + bar(...2) + }) + ``` + +- **Lazy (lexical-num)**: lexical environment, numbered placeholder + + ```{r} + delayedAssign("...1", x) + delayedAssign("...2", foo(.)) + bar(...2) + ``` + + +We'll first explore the desired properties we might want a pipe to possess and then see how each of the three variants does. + + +## Desired properties + +These are the properties that we might want a pipe to possess, roughly ordered from most important to least important. + +* **Visibility**: the visibility of the final function in the pipe should be preserved. This is important so that pipes that end in a side-effect function (which generally returns its first argument invisibly) do not print. + +* **Multiple placeholders**: each component of the pipe should only be evaluated once even when there are multiple placeholders, so that `sample(10) %>% cbind(., .)` yields two columns with the same value. Relatedly, `sample(10) %T>% print() %T>% print()` must print the same values twice. + +* **Lazy evaluation**: steps of the pipe should only be evaluated when actually needed. This is a useful property as it means that pipes can handle code like `stop("!") %>% try()`, making pipes capable of capturing a wider range of R expressions. + + On the other hand, it might have surprising effects. For instance if a function that suppresses warnings is added to the end of a pipeline, the suppression takes effect for the whole pipeline. + +* **Persistence of piped values**: arguments are not necessarily evaluated right away by the piped function. Sometimes they are evaluated long after the pipeline has returned, for example when a function factory is piped. With persistent piped values, the constructed function can be called at any time: + + ```r + factory <- function(x) function() x + fn <- NA %>% factory() + fn() + #> [1] NA + ``` + +* **Refcount neutrality**: the return value of the pipeline should have a reference count of 1 so it can be mutated in place in further manipulations. + +* **Eager unbinding**: pipes are often used with large data objects, so intermediate objects in the pipeline should be unbound as soon as possible so they are available for garbage collection. + +* **Progressive stack**: using the pipe should add as few entries to the call stack as possible, so that `traceback()` is maximally useful. + +* **Lexical side effects**: side effects should occur in the current lexical environment. This way, `NA %>% { foo <- . }` assigns the piped value in the current environment and `NA %>% { return(.) }` returns from the function that contains the pipeline. + +* **Continuous stack**: the pipe should not affect the chain of parent frames. This is important for tree representations of the call stack. + +It is possible to have proper visibility and a neutral impact on refcounts with all implementations by being a bit careful, so we'll only consider the other properties: + + +| | Nested | Eager
(mask) | Eager
(mask-num) | Eager
(lexical) | Lazy
(mask) | Lazy
(mask-num) | Lazy
(lexical-num) | +|-----------------------|:----------:|:---------------:|:-------------------:|:------------------:|:--------------:|:------------------:|:---------------------:| +| Multiple placeholders | `r fail()` | `r pass()` | `r pass()` | `r pass()` | `r pass()` | `r pass()` | `r pass()` | +| Lazy evaluation | `r pass()` | `r fail()` | `r fail()` | `r fail()` | `r pass()` | `r pass()` | `r pass()` | +| Persistence | `r pass()` | `r fail()` | `r pass()` | `r fail()` | `r pass()` | `r pass()` | `r pass()` | +| Eager unbinding | `r pass()` | `r pass()` | `r fail()` | `r pass()` | `r pass()` | `r fail()` | `r fail()` | +| Progressive stack | `r fail()` | `r pass()` | `r pass()` | `r pass()` | `r fail()` | `r fail()` | `r fail()` | +| Lexical effects | `r pass()` | `r fail()` | `r fail()` | `r pass()` | `r fail()` | `r fail()` | `r pass()` | +| Continuous stack | `r pass()` | `r fail()` | `r fail()` | `r pass()` | `r fail()` | `r fail()` | `r pass()` | + + +### Implications of design decisions + +Some properties are a direct reflection of the high level design decisions. + + +#### Placeholder binding + +The nested pipe does not assign piped expressions to a placeholder. All the other variants perform this assignment. This means that with a nested rewrite approach, it isn't possible to have multiple placeholders unless the piped expression is pasted multiple times. This would cause multiple evaluations with deleterious effects: + +```{r} +sample(10) %>% list(., .) + +# Becomes +list(sample(10), sample(10)) +``` + +Assigning to the placeholder within an argument would preserve the nestedness and lazyness. However that wouldn't work properly because there's no guarantee that the first argument will be evaluated before the second argument. + +```{r} +sample(10) %>% foo(., .) +foo(. <- sample(10), .) +``` + +For these reasons, the nested pipe does not support multiple placeholders. By contrast, all the other variants assign the result of pipe expressions to the placeholder. There are variations in how the placeholder binding is created (lazily or eagerly, in a mask or in the current environment, with numbered symbols or with a unique symbol) but all these variants allow multiple placeholders. + + +#### Masking environment + +Because the local variants of the pipe evaluate in a mask, they do not have lexical effects or a continuous stack. This is unlike the lexical variants that evaluate in the current environment. + + +#### Laziness + +Unlike the lazy variants, all eager versions implementing the pipe with iterated evaluation do not pass the lazy evaluation criterion. + +Secondly, no lazy variant passes the progressive stack criterion. By construction, lazy evaluation requires pushing all the pipe expressions on the stack before evaluation starts. Conversely, all eager variants have a progressive stack. + + +#### Numbered placeholders + +None of the variants that use numbered placeholders can unbind piped values eagerly. This is how they achieve persistence of these bindings. + + +## Three implementations + +The GNU R team is considering implementing the nested approach in base R with a parse-time code transformation (just like `->` is transformed to `<-` by the parser). + +We have implemented three approaches in magrittr: + +- The nested pipe +- The eager lexical pipe +- The lazy masking pipe + +These approaches have complementary strengths and weaknesses. + + +### Nested pipe + +```{r, eval = TRUE} +`%|>%` <- magrittr::pipe_nested +``` + +#### Multiple placeholders `r fail()` + +The nested pipe does not bind expressions to a placeholder and so can't support multiple placeholders. + +```{r, eval = TRUE, error = TRUE} +"foo" %|>% list(., .) +``` + + +#### Lazy evaluation `r pass()` + +Because it relies on the usual rules of argument application, the nested pipe is lazy. + +```{r, eval = TRUE} +{ + stop("oh no") %|>% try(silent = TRUE) + "success" +} +``` + +#### Persistence and eager unbinding `r pass()` + +The pipe expressions are binded as promises within the execution environment of each function. This environment persists as long as a promise holds onto it. Evaluating the promise discards the reference to the environment which becomes available for garbage collection. + +For instance, here is a function factory that creates a function. The constructed function returns the value supplied at the time of creation: + +```{r, eval = TRUE} +factory <- function(x) function() x +fn <- factory(TRUE) +fn() +``` + +This does not cause any issue with the nested pipe: + +```{r} +fn <- TRUE %|>% factory() +fn() +``` + +#### Progressive stack `r fail()` + +Because the piped expressions are lazily evaluated, the whole pipeline is pushed on the stack before execution starts. This results in a more complex backtrace than necessary: + +```{r} +faulty <- function() stop("tilt") +f <- function(x) x + 1 +g <- function(x) x + 2 +h <- function(x) x + 3 + +faulty() %|>% f() %|>% g() %|>% h() +#> Error in faulty() : tilt + +traceback() +#> 7: stop("tilt") +#> 6: faulty() +#> 5: f(faulty()) +#> 4: g(f(faulty())) +#> 3: h(g(f(faulty()))) +#> 2: .External2(magrittr_pipe) at pipe.R#181 +#> 1: faulty() %|>% f() %|>% g() %|>% h() +``` + +Also note how the expressions in the backtrace look different from the actual code. This is because of the nested rewrite of the pipeline. + + +#### Lexical effects `r pass()` + +This is a benefit of using the normal R rules of evaluation. Side effects occur in the correct environment: + +```{r, eval = TRUE} +foo <- FALSE +TRUE %|>% assign("foo", .) +foo +``` + +Control flow has the correct behaviour: + +```{r, eval = TRUE} +fn <- function() { + TRUE %|>% return() + FALSE +} +fn() +``` + + +#### Continuous stack `r pass()` + +Because evaluation occurs in the current environment, the stack is continuous. Let's instrument errors with a structured backtrace to see what that means: + +```{r} +options(error = rlang::entrace) +``` + +The tree representation of the backtrace correctly represents the hierarchy of execution frames: + +```{r} +foobar <- function(x) x %|>% quux() +quux <- function(x) x %|>% stop() + +"tilt" %|>% foobar() +#> Error in x %|>% stop() : tilt + +rlang::last_trace() +#> +#> tilt +#> Backtrace: +#> █ +#> 1. ├─"tilt" %|>% foobar() +#> 2. └─global::foobar("tilt") +#> 3. ├─x %|>% quux() +#> 4. └─global::quux(x) +#> 5. └─x %|>% stop() +``` + + +### Eager lexical pipe + +```{r, eval = TRUE} +`%!>%` <- magrittr::pipe_eager_lexical +``` + +#### Multiple placeholders `r pass()` + +Pipe expressions are eagerly assigned to the placeholder. This makes it possible to use the placeholder multiple times without causing multiple evaluations. + +```{r, eval = TRUE} +"foo" %!>% list(., .) +``` + + +#### Lazy evaluation `r fail()` + +Assignment forces eager evaluation of each step. + +```{r, eval = TRUE, error = TRUE} +{ + stop("oh no") %!>% try(silent = TRUE) + "success" +} +``` + +#### Persistence: `r fail()` + +Because we're updating the value of `.` at each step, the piped expressions are not persistent. This has subtle effects when the piped expressions are not evaluated right away. + +With the eager pipe we get rather confusing results with the factory function if we try to call the constructed function in the middle of the pipeline. In the following snippet the placeholder `.` is binded to the constructed function itself rather than the initial value `TRUE`, by the time the function is called: + +```{r, eval = TRUE} +fn <- TRUE %!>% factory() %!>% { .() } +fn() +``` + +Also, since we're binding `.` in the current environment, we need to clean it up once the pipeline has returned. At that point, the placeholder no longer exists: + +```{r, eval = TRUE, error = TRUE} +fn <- TRUE %!>% factory() +fn() +``` + +Or it has been reset to its previous value, if any: + +```{r, eval = TRUE} +. <- "wrong" +fn <- TRUE %!>% factory() +fn() +``` + + +#### Eager unbinding: `r pass()` + +This is the flip side of updating the value of the placeholder at each step. The previous intermediary values can be collected right away. + + +#### Progressive stack: `r pass()` + +Since pipe expressions are evaluated one by one as they come, only the relevant part of the pipeline is on the stack when an error is thrown: + +```{r} +faulty <- function() stop("tilt") +f <- function(x) x + 1 +g <- function(x) x + 2 +h <- function(x) x + 3 + +faulty() %!>% f() %!>% g() %!>% h() +#> Error in faulty() : tilt + +traceback() +#> 4: stop("tilt") +#> 3: faulty() +#> 2: .External2(magrittr_pipe) at pipe.R#163 +#> 1: faulty() %!>% f() %!>% g() %!>% h() +``` + + +#### Lexical effects and continuous stack: `r pass()` + +Evaluating in the current environment rather than in a mask produces the correct side effects: + +```{r, eval = TRUE} +foo <- FALSE +NA %!>% { foo <- TRUE; . } + +foo +``` + +```{r, eval = TRUE} +fn <- function() { + TRUE %!>% return() + + FALSE +} +fn() +``` + + +### Lazy masking pipe + +```{r, eval = TRUE} +`%?>%` <- magrittr::pipe_lazy_masking +``` + +#### Multiple placeholders `r pass()` + +Pipe expressions are lazily assigned to the placeholder. This makes it possible to use the placeholder multiple times without causing multiple evaluations. + +```{r, eval = TRUE} +"foo" %?>% list(., .) +``` + + +#### Lazy evaluation `r pass()` + +Arguments are assigned with `delayedAssign()` and lazily evaluated: + +```{r, eval = TRUE} +{ + stop("oh no") %?>% try(silent = TRUE) + "success" +} +``` + + +#### Persistence: `r pass()` + +The lazy masking pipe uses one masking environment per pipe expression. This allows persistence of the intermediary values and out of order evaluation. The factory function works as expected for instance: + +```{r, eval = TRUE} +fn <- TRUE %?>% factory() +fn() +``` + + +#### Eager unbinding: `r pass()` + +Because we use one mask environment per pipe expression, the intermediary values can be collected as soon as they are no longer needed. + + +#### Progressive stack: `r fail()` + +With a lazy pipe the whole pipeline is pushed onto the stack before evaluation. + +```{r} +faulty <- function() stop("tilt") +f <- function(x) x + 1 +g <- function(x) x + 2 +h <- function(x) x + 3 + +faulty() %?>% f() %?>% g() %?>% h() +#> Error in faulty() : tilt + +traceback() +#> 7: stop("tilt") +#> 6: faulty() +#> 5: f(.) +#> 4: g(.) +#> 3: h(.) +#> 2: .External2(magrittr_pipe) at pipe.R#174 +#> 1: faulty() %?>% f() %?>% g() %?>% h() +``` + +Note however how the backtrace is less cluttered than with the nested pipe approach, thanks to the placeholder. + + +#### Lexical effects `r fail()` + +The lazy pipe evaluates in a mask. This causes lexical side effects to occur in the incorrect environment. + +```{r, eval = TRUE} +foo <- FALSE +TRUE %?>% assign("foo", .) +foo +``` + +Stack-sensitive functions like `return()` function cannot find the proper frame environment: + +```{r, eval = TRUE, error = TRUE} +fn <- function() { + TRUE %?>% return() + FALSE +} +fn() +``` + + +#### Continuous stack `r fail()` + +The masking environment causes a discontinuous stack tree: + +```{r} +foobar <- function(x) x %?>% quux() +quux <- function(x) x %?>% stop() + +"tilt" %?>% foobar() +#> Error in x %?>% stop() : tilt + +rlang::last_trace() +#> +#> tilt +#> Backtrace: +#> █ +#> 1. ├─"tilt" %?>% foobar() +#> 2. ├─global::foobar(.) +#> 3. │ └─x %?>% quux() +#> 4. └─global::quux(.) +#> 5. └─x %?>% stop() +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/doc/tradeoffs.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/doc/tradeoffs.html new file mode 100644 index 00000000..abcbe224 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/doc/tradeoffs.html @@ -0,0 +1,635 @@ + + + + + + + + + + + + + + + + +Design tradeoffs + + + + + + + + + + + + + + + + + + + + + + + + + + +

Design tradeoffs

+

Hadley Wickham

+

Lionel Henry

+ + + +

There are many different ways that magrittr could implement the pipe. The goal of this document is to elucidate the variations, and the various pros and cons of each approach. This document is primarily aimed at the magrittr developers (so we don’t forget about important considerations), but will be of interest to anyone who wants to understand pipes better, or to create their own pipe that makes different tradeoffs

+
+

Code transformation

+

There are three main options for how we might transform a pipeline in base R expressions. Here they are illustrated with x %>% foo() %>% bar():

+
    +
  • Nested

    +
    bar(foo(x))
  • +
  • Eager (mask), masking environment

    +

    This is essentially how %>% has been implemented prior to magrittr 2.0:

    +
    local({
    +  . <- x
    +  . <- foo(.)
    +  bar(.)
    +})
  • +
  • Eager (mask-num): masking environment, numbered placeholder

    +
    local({
    +  ...1 <- x
    +  ...2 <- foo(...1)
    +  bar(...2)
    +})
  • +
  • Eager (lexical): lexical environment

    +

    This variant assigns pipe expressions to the placeholder . in the current environment. This assignment is temporary: once the pipe has returned, the placeholder binding is reset to its previous state.

    +
    with_dot_cleanup <- function(expr) {
    +  # Initialises `.` in the caller environment and resets it on exit.
    +  # (We use `:=` instead of `=` to avoid partial matching.)
    +  rlang::local_bindings(. := NULL, .env = parent.frame())
    +  expr
    +}
    +with_dot_cleanup({
    +  . <- x
    +  . <- foo(.)
    +  bar(.)
    +})
  • +
  • Lazy (mask): masking environments

    +
    mask1 <- new.env(parent = env)
    +mask2 <- new.env(parent = env)
    +
    +delayedAssign(".", x, mask1)
    +delayedAssign(".", foo(.), mask2)
    +with(mask2, bar(.))
  • +
  • Lazy (mask-num): masking environment, numbered placeholder

    +
    local({
    +  delayedAssign("...1", x)
    +  delayedAssign("...2", foo(...1))
    +  bar(...2)
    +})
  • +
  • Lazy (lexical-num): lexical environment, numbered placeholder

    +
    delayedAssign("...1", x)
    +delayedAssign("...2", foo(.))
    +bar(...2)
  • +
+

We’ll first explore the desired properties we might want a pipe to possess and then see how each of the three variants does.

+
+
+

Desired properties

+

These are the properties that we might want a pipe to possess, roughly ordered from most important to least important.

+
    +
  • Visibility: the visibility of the final function in the pipe should be preserved. This is important so that pipes that end in a side-effect function (which generally returns its first argument invisibly) do not print.

  • +
  • Multiple placeholders: each component of the pipe should only be evaluated once even when there are multiple placeholders, so that sample(10) %>% cbind(., .) yields two columns with the same value. Relatedly, sample(10) %T>% print() %T>% print() must print the same values twice.

  • +
  • Lazy evaluation: steps of the pipe should only be evaluated when actually needed. This is a useful property as it means that pipes can handle code like stop("!") %>% try(), making pipes capable of capturing a wider range of R expressions.

    +

    On the other hand, it might have surprising effects. For instance if a function that suppresses warnings is added to the end of a pipeline, the suppression takes effect for the whole pipeline.

  • +
  • Persistence of piped values: arguments are not necessarily evaluated right away by the piped function. Sometimes they are evaluated long after the pipeline has returned, for example when a function factory is piped. With persistent piped values, the constructed function can be called at any time:

    +
    factory <- function(x) function() x
    +fn <- NA %>% factory()
    +fn()
    +#> [1] NA
  • +
  • Refcount neutrality: the return value of the pipeline should have a reference count of 1 so it can be mutated in place in further manipulations.

  • +
  • Eager unbinding: pipes are often used with large data objects, so intermediate objects in the pipeline should be unbound as soon as possible so they are available for garbage collection.

  • +
  • Progressive stack: using the pipe should add as few entries to the call stack as possible, so that traceback() is maximally useful.

  • +
  • Lexical side effects: side effects should occur in the current lexical environment. This way, NA %>% { foo <- . } assigns the piped value in the current environment and NA %>% { return(.) } returns from the function that contains the pipeline.

  • +
  • Continuous stack: the pipe should not affect the chain of parent frames. This is important for tree representations of the call stack.

  • +
+

It is possible to have proper visibility and a neutral impact on refcounts with all implementations by being a bit careful, so we’ll only consider the other properties:

+ ++++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NestedEager
(mask)
Eager
(mask-num)
Eager
(lexical)
Lazy
(mask)
Lazy
(mask-num)
Lazy
(lexical-num)
Multiple placeholders
Lazy evaluation
Persistence
Eager unbinding
Progressive stack
Lexical effects
Continuous stack
+
+

Implications of design decisions

+

Some properties are a direct reflection of the high level design decisions.

+
+

Placeholder binding

+

The nested pipe does not assign piped expressions to a placeholder. All the other variants perform this assignment. This means that with a nested rewrite approach, it isn’t possible to have multiple placeholders unless the piped expression is pasted multiple times. This would cause multiple evaluations with deleterious effects:

+
sample(10) %>% list(., .)
+
+# Becomes
+list(sample(10), sample(10))
+

Assigning to the placeholder within an argument would preserve the nestedness and lazyness. However that wouldn’t work properly because there’s no guarantee that the first argument will be evaluated before the second argument.

+
sample(10) %>% foo(., .)
+foo(. <- sample(10), .)
+

For these reasons, the nested pipe does not support multiple placeholders. By contrast, all the other variants assign the result of pipe expressions to the placeholder. There are variations in how the placeholder binding is created (lazily or eagerly, in a mask or in the current environment, with numbered symbols or with a unique symbol) but all these variants allow multiple placeholders.

+
+
+

Masking environment

+

Because the local variants of the pipe evaluate in a mask, they do not have lexical effects or a continuous stack. This is unlike the lexical variants that evaluate in the current environment.

+
+
+

Laziness

+

Unlike the lazy variants, all eager versions implementing the pipe with iterated evaluation do not pass the lazy evaluation criterion.

+

Secondly, no lazy variant passes the progressive stack criterion. By construction, lazy evaluation requires pushing all the pipe expressions on the stack before evaluation starts. Conversely, all eager variants have a progressive stack.

+
+
+

Numbered placeholders

+

None of the variants that use numbered placeholders can unbind piped values eagerly. This is how they achieve persistence of these bindings.

+
+
+
+
+

Three implementations

+

The GNU R team is considering implementing the nested approach in base R with a parse-time code transformation (just like -> is transformed to <- by the parser).

+

We have implemented three approaches in magrittr:

+
    +
  • The nested pipe
  • +
  • The eager lexical pipe
  • +
  • The lazy masking pipe
  • +
+

These approaches have complementary strengths and weaknesses.

+
+

Nested pipe

+
`%|>%` <- magrittr::pipe_nested
+
+

Multiple placeholders ❌

+

The nested pipe does not bind expressions to a placeholder and so can’t support multiple placeholders.

+
"foo" %|>% list(., .)
+#> Error: Can't use multiple placeholders.
+
+
+

Lazy evaluation ✅

+

Because it relies on the usual rules of argument application, the nested pipe is lazy.

+
{
+  stop("oh no") %|>% try(silent = TRUE)
+  "success"
+}
+#> [1] "success"
+
+
+

Persistence and eager unbinding ✅

+

The pipe expressions are binded as promises within the execution environment of each function. This environment persists as long as a promise holds onto it. Evaluating the promise discards the reference to the environment which becomes available for garbage collection.

+

For instance, here is a function factory that creates a function. The constructed function returns the value supplied at the time of creation:

+
factory <- function(x) function() x
+fn <- factory(TRUE)
+fn()
+#> [1] TRUE
+

This does not cause any issue with the nested pipe:

+
fn <- TRUE %|>% factory()
+fn()
+
+
+

Progressive stack ❌

+

Because the piped expressions are lazily evaluated, the whole pipeline is pushed on the stack before execution starts. This results in a more complex backtrace than necessary:

+
faulty <- function() stop("tilt")
+f <- function(x) x + 1
+g <- function(x) x + 2
+h <- function(x) x + 3
+
+faulty() %|>% f() %|>% g() %|>% h()
+#> Error in faulty() : tilt
+
+traceback()
+#> 7: stop("tilt")
+#> 6: faulty()
+#> 5: f(faulty())
+#> 4: g(f(faulty()))
+#> 3: h(g(f(faulty())))
+#> 2: .External2(magrittr_pipe) at pipe.R#181
+#> 1: faulty() %|>% f() %|>% g() %|>% h()
+

Also note how the expressions in the backtrace look different from the actual code. This is because of the nested rewrite of the pipeline.

+
+
+

Lexical effects ✅

+

This is a benefit of using the normal R rules of evaluation. Side effects occur in the correct environment:

+
foo <- FALSE
+TRUE %|>% assign("foo", .)
+foo
+#> [1] TRUE
+

Control flow has the correct behaviour:

+
fn <- function() {
+  TRUE %|>% return()
+  FALSE
+}
+fn()
+#> [1] TRUE
+
+
+

Continuous stack ✅

+

Because evaluation occurs in the current environment, the stack is continuous. Let’s instrument errors with a structured backtrace to see what that means:

+
options(error = rlang::entrace)
+

The tree representation of the backtrace correctly represents the hierarchy of execution frames:

+
foobar <- function(x) x %|>% quux()
+quux <- function(x) x %|>% stop()
+
+"tilt" %|>% foobar()
+#> Error in x %|>% stop() : tilt
+
+rlang::last_trace()
+#> <error/rlang_error>
+#> tilt
+#> Backtrace:
+#>     █
+#>  1. ├─"tilt" %|>% foobar()
+#>  2. └─global::foobar("tilt")
+#>  3.   ├─x %|>% quux()
+#>  4.   └─global::quux(x)
+#>  5.     └─x %|>% stop()
+
+
+
+

Eager lexical pipe

+
`%!>%` <- magrittr::pipe_eager_lexical
+
+

Multiple placeholders ✅

+

Pipe expressions are eagerly assigned to the placeholder. This makes it possible to use the placeholder multiple times without causing multiple evaluations.

+
"foo" %!>% list(., .)
+#> [[1]]
+#> [1] "foo"
+#> 
+#> [[2]]
+#> [1] "foo"
+
+
+

Lazy evaluation ❌

+

Assignment forces eager evaluation of each step.

+
{
+  stop("oh no") %!>% try(silent = TRUE)
+  "success"
+}
+#> Error in stop("oh no") %!>% try(silent = TRUE): oh no
+
+
+

Persistence: ❌

+

Because we’re updating the value of . at each step, the piped expressions are not persistent. This has subtle effects when the piped expressions are not evaluated right away.

+

With the eager pipe we get rather confusing results with the factory function if we try to call the constructed function in the middle of the pipeline. In the following snippet the placeholder . is binded to the constructed function itself rather than the initial value TRUE, by the time the function is called:

+
fn <- TRUE %!>% factory() %!>% { .() }
+fn()
+#> function() x
+#> <bytecode: 0x11d1b6758>
+#> <environment: 0x11da6d628>
+

Also, since we’re binding . in the current environment, we need to clean it up once the pipeline has returned. At that point, the placeholder no longer exists:

+
fn <- TRUE %!>% factory()
+fn()
+#> Error in fn(): object '.' not found
+

Or it has been reset to its previous value, if any:

+
. <- "wrong"
+fn <- TRUE %!>% factory()
+fn()
+#> [1] "wrong"
+
+
+

Eager unbinding: ✅

+

This is the flip side of updating the value of the placeholder at each step. The previous intermediary values can be collected right away.

+
+
+

Progressive stack: ✅

+

Since pipe expressions are evaluated one by one as they come, only the relevant part of the pipeline is on the stack when an error is thrown:

+
faulty <- function() stop("tilt")
+f <- function(x) x + 1
+g <- function(x) x + 2
+h <- function(x) x + 3
+
+faulty() %!>% f() %!>% g() %!>% h()
+#> Error in faulty() : tilt
+
+traceback()
+#> 4: stop("tilt")
+#> 3: faulty()
+#> 2: .External2(magrittr_pipe) at pipe.R#163
+#> 1: faulty() %!>% f() %!>% g() %!>% h()
+
+
+

Lexical effects and continuous stack: ✅

+

Evaluating in the current environment rather than in a mask produces the correct side effects:

+
foo <- FALSE
+NA %!>% { foo <- TRUE; . }
+#> [1] NA
+
+foo
+#> [1] TRUE
+
fn <- function() {
+  TRUE %!>% return()
+
+  FALSE
+}
+fn()
+#> [1] TRUE
+
+
+
+

Lazy masking pipe

+
`%?>%` <- magrittr::pipe_lazy_masking
+
+

Multiple placeholders ✅

+

Pipe expressions are lazily assigned to the placeholder. This makes it possible to use the placeholder multiple times without causing multiple evaluations.

+
"foo" %?>% list(., .)
+#> [[1]]
+#> [1] "foo"
+#> 
+#> [[2]]
+#> [1] "foo"
+
+
+

Lazy evaluation ✅

+

Arguments are assigned with delayedAssign() and lazily evaluated:

+
{
+  stop("oh no") %?>% try(silent = TRUE)
+  "success"
+}
+#> [1] "success"
+
+
+

Persistence: ✅

+

The lazy masking pipe uses one masking environment per pipe expression. This allows persistence of the intermediary values and out of order evaluation. The factory function works as expected for instance:

+
fn <- TRUE %?>% factory()
+fn()
+#> [1] TRUE
+
+
+

Eager unbinding: ✅

+

Because we use one mask environment per pipe expression, the intermediary values can be collected as soon as they are no longer needed.

+
+
+

Progressive stack: ❌

+

With a lazy pipe the whole pipeline is pushed onto the stack before evaluation.

+
faulty <- function() stop("tilt")
+f <- function(x) x + 1
+g <- function(x) x + 2
+h <- function(x) x + 3
+
+faulty() %?>% f() %?>% g() %?>% h()
+#> Error in faulty() : tilt
+
+traceback()
+#> 7: stop("tilt")
+#> 6: faulty()
+#> 5: f(.)
+#> 4: g(.)
+#> 3: h(.)
+#> 2: .External2(magrittr_pipe) at pipe.R#174
+#> 1: faulty() %?>% f() %?>% g() %?>% h()
+

Note however how the backtrace is less cluttered than with the nested pipe approach, thanks to the placeholder.

+
+
+

Lexical effects ❌

+

The lazy pipe evaluates in a mask. This causes lexical side effects to occur in the incorrect environment.

+
foo <- FALSE
+TRUE %?>% assign("foo", .)
+foo
+#> [1] FALSE
+

Stack-sensitive functions like return() function cannot find the proper frame environment:

+
fn <- function() {
+  TRUE %?>% return()
+  FALSE
+}
+fn()
+#> [1] FALSE
+
+
+

Continuous stack ❌

+

The masking environment causes a discontinuous stack tree:

+
foobar <- function(x) x %?>% quux()
+quux <- function(x) x %?>% stop()
+
+"tilt" %?>% foobar()
+#> Error in x %?>% stop() : tilt
+
+rlang::last_trace()
+#> <error/rlang_error>
+#> tilt
+#> Backtrace:
+#>     █
+#>  1. ├─"tilt" %?>% foobar()
+#>  2. ├─global::foobar(.)
+#>  3. │ └─x %?>% quux()
+#>  4. └─global::quux(.)
+#>  5.   └─x %?>% stop()
+
+
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/help/AnIndex new file mode 100644 index 00000000..142fad5a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/help/AnIndex @@ -0,0 +1,49 @@ +magrittr-package magrittr-package +%!>% pipe-eager +%$% exposition +%<>% compound +%>% pipe +%T>% tee +add aliases +and aliases +debug_fseq debug_fseq +debug_pipe debug_pipe +divide_by aliases +divide_by_int aliases +equals aliases +extract aliases +extract2 aliases +faq-pipe-gender faq-pipe-gender +freduce freduce +functions functions +inset aliases +inset2 aliases +is_greater_than aliases +is_in aliases +is_less_than aliases +is_weakly_greater_than aliases +is_weakly_less_than aliases +magrittr magrittr-package +mod aliases +multiply_by aliases +multiply_by_matrix aliases +n'est pas aliases +not aliases +or aliases +pipe-eager pipe-eager +pipe_eager_lexical pipe_eager_lexical +pipe_lazy_masking pipe_eager_lexical +pipe_nested pipe_eager_lexical +print.fseq print.fseq +raise_to_power aliases +set_attr aliases +set_attributes aliases +set_class aliases +set_colnames aliases +set_names aliases +set_rownames aliases +subtract aliases +undebug_fseq debug_fseq +use_series aliases +[.fseq fseq +[[.fseq fseq diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/help/aliases.rds new file mode 100644 index 00000000..09532675 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/help/figures/exposition-1.png b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/help/figures/exposition-1.png new file mode 100644 index 00000000..43affda2 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/help/figures/exposition-1.png differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/help/figures/logo.png b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/help/figures/logo.png new file mode 100644 index 00000000..e4d7004d Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/help/figures/logo.png differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/help/magrittr.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/help/magrittr.rdb new file mode 100644 index 00000000..47a3d53e Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/help/magrittr.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/help/magrittr.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/help/magrittr.rdx new file mode 100644 index 00000000..5831538f Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/help/magrittr.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/help/paths.rds new file mode 100644 index 00000000..34995368 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/html/00Index.html new file mode 100644 index 00000000..29942c23 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/html/00Index.html @@ -0,0 +1,115 @@ + + +R: A Forward-Pipe Operator for R + + + +
+

A Forward-Pipe Operator for R + +

+
+
+[Up] +[Top] +

Documentation for package ‘magrittr’ version 2.0.3

+ + + +

Help Pages

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
%!>%Eager pipe
%$%Exposition pipe
%<>%Assignment pipe
%>%Pipe
%T>%Tee pipe
addAliases
andAliases
debug_fseqDebugging function for functional sequences.
debug_pipeDebugging function for magrittr pipelines.
divide_byAliases
divide_by_intAliases
equalsAliases
extractAliases
extract2Aliases
faq-pipe-genderFAQ: What is the gender of the pipe?
freduceApply a list of functions sequentially
functionsExtract the function list from a functional sequence.
insetAliases
inset2Aliases
is_greater_thanAliases
is_inAliases
is_less_thanAliases
is_weakly_greater_thanAliases
is_weakly_less_thanAliases
modAliases
multiply_byAliases
multiply_by_matrixAliases
n'est pasAliases
notAliases
orAliases
pipe-eagerEager pipe
print.fseqPrint method for functional sequence.
raise_to_powerAliases
set_attrAliases
set_attributesAliases
set_classAliases
set_colnamesAliases
set_namesAliases
set_rownamesAliases
subtractAliases
undebug_fseqDebugging function for functional sequences.
use_seriesAliases
[.fseqExtract function(s) from a functional sequence.
[[.fseqExtract function(s) from a functional sequence.
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/libs/magrittr.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/libs/magrittr.so new file mode 100755 index 00000000..ad5cad51 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/libs/magrittr.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/libs/magrittr.so.dSYM/Contents/Info.plist b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/libs/magrittr.so.dSYM/Contents/Info.plist new file mode 100644 index 00000000..bbbabd53 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/libs/magrittr.so.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.magrittr.so + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/libs/magrittr.so.dSYM/Contents/Resources/DWARF/magrittr.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/libs/magrittr.so.dSYM/Contents/Resources/DWARF/magrittr.so new file mode 100644 index 00000000..bf335f94 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/libs/magrittr.so.dSYM/Contents/Resources/DWARF/magrittr.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/logo-hex.png b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/logo-hex.png new file mode 100644 index 00000000..52c52111 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/logo-hex.png differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/logo-hex.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/logo-hex.svg new file mode 100644 index 00000000..6ba04bef --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/logo-hex.svg @@ -0,0 +1,106 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/logo.png b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/logo.png new file mode 100644 index 00000000..9164d6fd Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/logo.png differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/logo.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/logo.svg new file mode 100644 index 00000000..058c7efe --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/magrittr/logo.svg @@ -0,0 +1,115 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/DESCRIPTION new file mode 100644 index 00000000..664485a6 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/DESCRIPTION @@ -0,0 +1,39 @@ +Package: pkgbuild +Title: Find Tools Needed to Build R Packages +Version: 1.4.6 +Authors@R: c( + person("Hadley", "Wickham", role = "aut"), + person("Jim", "Hester", role = "aut"), + person("Gábor", "Csárdi", , "csardi.gabor@gmail.com", role = c("aut", "cre")), + person("Posit Software, PBC", role = c("cph", "fnd")) + ) +Description: Provides functions used to build R packages. Locates + compilers needed to build R packages on various platforms and ensures + the PATH is configured appropriately so R can use them. +License: MIT + file LICENSE +URL: https://github.com/r-lib/pkgbuild, https://pkgbuild.r-lib.org +BugReports: https://github.com/r-lib/pkgbuild/issues +Depends: R (>= 3.5) +Imports: callr (>= 3.2.0), cli (>= 3.4.0), desc, processx, R6 +Suggests: covr, cpp11, knitr, Rcpp, rmarkdown, testthat (>= 3.2.0), + withr (>= 2.3.0) +Config/Needs/website: tidyverse/tidytemplate +Config/testthat/edition: 3 +Encoding: UTF-8 +RoxygenNote: 7.3.2 +NeedsCompilation: no +Packaged: 2025-01-16 17:45:57 UTC; gaborcsardi +Author: Hadley Wickham [aut], + Jim Hester [aut], + Gábor Csárdi [aut, cre], + Posit Software, PBC [cph, fnd] +Maintainer: Gábor Csárdi +Repository: CRAN +Date/Publication: 2025-01-16 19:00:02 UTC +Built: R 4.4.1; ; 2025-01-16 19:12:26 UTC; unix +RemoteType: standard +RemotePkgRef: pkgbuild +RemoteRef: pkgbuild +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 1.4.6 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/INDEX new file mode 100644 index 00000000..909fc0a2 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/INDEX @@ -0,0 +1,12 @@ +build Build package +clean_dll Remove compiled objects from /src/ directory +compile_dll Compile a .dll/.so from source. +compiler_flags Default compiler flags used by devtools. +has_build_tools Are build tools are available? +has_compiler Is a compiler available? +has_latex Is latex installed? +pkg_has_src Does a source package have src/ directory? +pkgbuild_process Build package in the background +rcmd_build_tools Call R CMD 'command' with build tools active +with_debug Temporarily set debugging compilation flags. +without_compiler Tools for testing pkgbuild diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/LICENSE new file mode 100644 index 00000000..5f2d5e02 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2023 +COPYRIGHT HOLDER: pkgbuild authors diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/Meta/Rd.rds new file mode 100644 index 00000000..40657492 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/Meta/hsearch.rds new file mode 100644 index 00000000..46a165e5 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/Meta/links.rds new file mode 100644 index 00000000..307c3b86 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/Meta/nsInfo.rds new file mode 100644 index 00000000..bcd794cd Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/Meta/package.rds new file mode 100644 index 00000000..5062b9a1 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/NAMESPACE new file mode 100644 index 00000000..442f9210 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/NAMESPACE @@ -0,0 +1,35 @@ +# Generated by roxygen2: do not edit by hand + +export(build) +export(check_build_tools) +export(check_compiler) +export(check_latex) +export(check_rtools) +export(clean_dll) +export(compile_dll) +export(compiler_flags) +export(find_rtools) +export(has_build_tools) +export(has_compiler) +export(has_devel) +export(has_latex) +export(has_rtools) +export(local_build_tools) +export(needs_compile) +export(pkg_has_src) +export(pkg_links_to_cpp11) +export(pkg_links_to_rcpp) +export(pkgbuild_process) +export(rcmd_build_tools) +export(rtools_needed) +export(rtools_path) +export(setup_rtools) +export(with_build_tools) +export(with_debug) +export(with_latex) +export(without_cache) +export(without_compiler) +export(without_latex) +importFrom(R6,R6Class) +importFrom(utils,head) +importFrom(utils,tail) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/NEWS.md new file mode 100644 index 00000000..6f248f02 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/NEWS.md @@ -0,0 +1,196 @@ +# pkgbuild 1.4.6 + +* No changes. + +# pkgbuild 1.4.5 + +* pkgbuild now does a better job at finding Rtools 4.3 and 4.4 if they + were not installed from an installer. + +* pkgbuild now detects Rtools correctly from the Windows registry + again for Rtools 4.3 and 4.4 + +# pkgbuild 1.4.4 + +* pkgbuild now supports R 4.4.x and Rtools44 (#183). + +# pkgbuild 1.4.3 + +* pkgbuild now does not need the crayon, rprojroot and prettyunits + packages. + +# pkgbuild 1.4.2 + +* Running `bootstrap.R` now works with `pkgbuild_process`, so it also works + from pak (https://github.com/r-lib/pak/issues/508). + +# pkgbuild 1.4.1 + +* New `Config/build/extra-sources` `DESCRIPTION` option to make pkgbuild aware + of extra source files to consider in `needs_compile()`. + +* New `Config/build/bootstrap` `DESCRIPTION` option. Set it to `TRUE` to run + `Rscript bootstrap.R` in the package root prior to building the source + package (#157, @paleolimbot). + +* pkgbuild now supports Rtools43. + +* pkgbuild now always _appends_ its extra compiler flags to the ones that + already exist in the system and/or user `Makevars` files (#156). + +# pkgbuild 1.4.0 + +* pkgbuild can now avoid copying large package directories when building a + source package. See the `PKG_BUILD_COPY_METHOD` environment variable in + `?build` or the package README (#59). + + This is currently an experimental feature, and feedback is + appreciated. + +* `R CMD build` warnings can now be turned into errors, by setting the + `pkg.build_stop_for_warnings` option to `TRUE` or by setting the + `PKG_BUILD_STOP_FOR_WARNINGS` environment variable to `true` (#114). + +* `need_compile()` now knows about Rust source code files, i.e. `Cargo.toml` + and `*.rs` (#115). + +* Now `pkgbuild::build()` will not clean up `inst/doc` by default if the + `Config/build/clean-inst-doc` entry in `DESCRIPTION` is set to `FALSE` (#128). + +* New `PKG_BUILD_COLOR_DIAGNOSTICS` environment variable to opt out from + colored compiler output (#141). + +* pkgbuild now works with a full XCode installation if the XCode Command + Line Tools are not installed, on macOS, in RStudio (#103). + +# pkgbuild 1.3.1 + +* Accept Rtools40 for R 4.2, it works well, as long as the PATH includes + both `${RTOOLS40_HOME}/usr/bin` and `${RTOOLS40_HOME}/ucrt64/bin`. + E.g. `~/.Renviron` should contain now + ``` + PATH="${RTOOLS40_HOME}\usr\bin;${RTOOLS40_HOME}\ucrt64\bin;${PATH}" + ``` + to make Rtools40 work with both R 4.2.x (devel currently) and R 4.1.x and + R 4.0.x. + +# pkgbuild 1.3.0 + +* pkgbuild now supports Rtools 4.2. + +* pkgbuild now returns the correct path for R 3.x (#96). + +* `build()` now always returns the path of the built package (#108). + +* pkgbuild output now looks better in `.Rmd` documents and in general in non-dynamic terminals. You can also force dynamic and non-dynamic output now (#64). + +* pkgbuild does not build the PDF manual now if `pdflatex` is not installed, even if `manual = TRUE` (#123). + +# pkgbuild 1.2.1 + +* Gábor Csárdi is now the maintainer. + +* `build_setup_source` now considers both command-line build arguments, as + well as parameters `vignettes` or `manual` when conditionally executing + flag-dependent behaviors (@dgkf, #120) + +# pkgbuild 1.2.0 + +* pkgbuild is now licensed as MIT (#106) +* `compile_dll()` gains a `debug` argument for more control over the compile options used (@richfitz, #100) +* `pkgbuild_process()` and `build()` now use colored compiler diagnostics if supported (#102) +* Avoid documentation link ambiguity in R 4.1 (#105) + +# pkgbuild 1.1.0 + +* `compile_dll()` now supports automatic cpp11 registration if the package links to cpp11. +* `rtools_needed` returns correct version instead of "custom" (@burgerga, #97) + +# pkgbuild 1.0.8 + +* Fixes for capability RStudio 1.2. and Rtools 40, R 4.0.0 + +# pkgbuild 1.0.7 + +* Additional fixes for Rtools 40 + +# pkgbuild 1.0.6 + +* Support for RTools 40 and custom msys2 toolchains that are explicitly set + using the `CC` Makevars (#40). + +# pkgbuild 1.0.5 + +* `check_build_tools()` gains a `quiet` argument, to control when the message + is displayed. The message is no longer displayed when `check_build_tools()` + is called internally by pkgbuild functions. (#83) + +# pkgbuild 1.0.4 + +* `build()` gains a `clean_doc` argument, to control if the `inst/doc` + directory is cleaned before building. (#79, #75) + +* `build()` and `pkgbuild_process` now have standard output and error are + correctly interleaved, by redirecting the standard error of build process + to the standard output (@gaborcsardi, #78). + +* `check_build_tools()` now has a more helpful error message which points you + towards ways to debug the issue (#68). + +* `pkgbuild_process` now do not set custom compiler flags, and it uses + the user's `Makevars` file (@gaborcsardi, #76). + +* `rtools_path()` now returns `NA` on non-windows systems and also works when + `has_rtools()` has not been run previously (#74). + +# pkgbuild 1.0.3 + +* Tests which wrote to the package library are now skipped on CRAN. + +* `build()` can now build a tar.gz file directly (#55) + +# pkgbuild 1.0.2 + +* `build()` and `compile_dll()` gain a `register_routines` argument, to + automatically register C routines with + `tools::package_native_routines_registration_skeleton()` (#50) + +* `build()` will now warn if trying to build packages on R versions <= 3.4.2 on + Windows with a space in the R installation directory (#49) + +* `build()` will now message if a build contains long paths, which are unsupported on windows + (#48) + +* `compile_dll()` no longer doubles output, a regression caused by the styling callback. + (https://github.com/r-lib/devtools/issues/1877) + +* `build()` output is now styled like that in the rcmdcheck package + (https://github.com/r-lib/devtools/issues/1874). + +* `build()` no longer sets compile flags (#46) + +# pkgbuild 1.0.1 + +* Preliminary support for rtools 4.0 (#40) + +* `compile_dll()` now does not supply compiler flags if there is an existing + user defined Makevars file. + +* `local_build_tools()` function added to provide a deferred equivalent to + `with_build_tools()`. So you can add rtools to the PATH until the end of a + function body. + +# pkgbuild 1.0.0 + +* Add metadata to support Rtools 3.5 (#38). + +* `build()` only uses the `--no-resave-data` argument in `R CMD build` + if the `--resave-data` argument wasn't supplied by the user + (@theGreatWhiteShark, #26) + +* `build()` now cleans existing vignette files in `inst/doc` if they exist. (#10) + +* `clean_dll()` also deletes `symbols.rds` which is created when `compile_dll()` + is run inside of `R CMD check`. + +* First argument of all functions is now `path` rather than `pkg`. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/R/pkgbuild b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/R/pkgbuild new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/R/pkgbuild @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/R/pkgbuild.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/R/pkgbuild.rdb new file mode 100644 index 00000000..64cac017 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/R/pkgbuild.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/R/pkgbuild.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/R/pkgbuild.rdx new file mode 100644 index 00000000..4417e4d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/R/pkgbuild.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/help/AnIndex new file mode 100644 index 00000000..7f4775ef --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/help/AnIndex @@ -0,0 +1,32 @@ +pkgbuild-package pkgbuild-package +build build +check_build_tools has_build_tools +check_compiler has_compiler +check_latex has_latex +check_rtools has_rtools +clean_dll clean_dll +compiler_flags compiler_flags +compile_dll compile_dll +find_rtools has_rtools +has_build_tools has_build_tools +has_compiler has_compiler +has_devel has_compiler +has_latex has_latex +has_rtools has_rtools +local_build_tools has_build_tools +needs_compile needs_compile +pkgbuild pkgbuild-package +pkgbuild_process pkgbuild_process +pkg_has_src pkg_has_src +pkg_links_to_cpp11 pkg_links_to_rcpp +pkg_links_to_rcpp pkg_links_to_rcpp +rcmd_build_tools rcmd_build_tools +rtools_needed rtools_needed +rtools_path has_rtools +setup_rtools has_rtools +without_cache without_compiler +without_compiler without_compiler +without_latex without_compiler +with_build_tools has_build_tools +with_debug with_debug +with_latex without_compiler diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/help/aliases.rds new file mode 100644 index 00000000..e9a8a7e6 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/help/paths.rds new file mode 100644 index 00000000..4a8d00bf Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/help/pkgbuild.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/help/pkgbuild.rdb new file mode 100644 index 00000000..caa6d5b0 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/help/pkgbuild.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/help/pkgbuild.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/help/pkgbuild.rdx new file mode 100644 index 00000000..faaf4639 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/help/pkgbuild.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/html/00Index.html new file mode 100644 index 00000000..57b14ce1 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/html/00Index.html @@ -0,0 +1,68 @@ + + +R: Find Tools Needed to Build R Packages + + + +
+

Find Tools Needed to Build R Packages + +

+
+
+[Up] +[Top] +

Documentation for package ‘pkgbuild’ version 1.4.6

+ + + +

Help Pages

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
buildBuild package
check_build_toolsAre build tools are available?
check_compilerIs a compiler available?
check_latexIs latex installed?
clean_dllRemove compiled objects from /src/ directory
compiler_flagsDefault compiler flags used by devtools.
compile_dllCompile a .dll/.so from source.
has_build_toolsAre build tools are available?
has_compilerIs a compiler available?
has_develIs a compiler available?
has_latexIs latex installed?
local_build_toolsAre build tools are available?
pkgbuild_processBuild package in the background
pkg_has_srcDoes a source package have src/ directory?
rcmd_build_toolsCall R CMD 'command' with build tools active
without_cacheTools for testing pkgbuild
without_compilerTools for testing pkgbuild
without_latexTools for testing pkgbuild
with_build_toolsAre build tools are available?
with_debugTemporarily set debugging compilation flags.
with_latexTools for testing pkgbuild
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgbuild/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/DESCRIPTION new file mode 100644 index 00000000..b431708a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/DESCRIPTION @@ -0,0 +1,48 @@ +Package: pkgload +Title: Simulate Package Installation and Attach +Version: 1.4.0 +Authors@R: c( + person("Hadley", "Wickham", role = "aut"), + person("Winston", "Chang", role = "aut"), + person("Jim", "Hester", role = "aut"), + person("Lionel", "Henry", , "lionel@posit.co", role = c("aut", "cre")), + person("Posit Software, PBC", role = c("cph", "fnd")), + person("R Core team", role = "ctb", + comment = "Some namespace and vignette code extracted from base R") + ) +Description: Simulates the process of installing a package and then + attaching it. This is a key part of the 'devtools' package as it + allows you to rapidly iterate while developing a package. +License: GPL-3 +URL: https://github.com/r-lib/pkgload, https://pkgload.r-lib.org +BugReports: https://github.com/r-lib/pkgload/issues +Depends: R (>= 3.4.0) +Imports: cli (>= 3.3.0), desc, fs, glue, lifecycle, methods, pkgbuild, + processx, rlang (>= 1.1.1), rprojroot, utils, withr (>= 2.4.3) +Suggests: bitops, jsonlite, mathjaxr, pak, Rcpp, remotes, rstudioapi, + testthat (>= 3.2.1.1), usethis +Config/Needs/website: tidyverse/tidytemplate, ggplot2 +Config/testthat/edition: 3 +Config/testthat/parallel: TRUE +Config/testthat/start-first: dll +Encoding: UTF-8 +RoxygenNote: 7.3.1 +NeedsCompilation: no +Packaged: 2024-06-28 10:36:56 UTC; lionel +Author: Hadley Wickham [aut], + Winston Chang [aut], + Jim Hester [aut], + Lionel Henry [aut, cre], + Posit Software, PBC [cph, fnd], + R Core team [ctb] (Some namespace and vignette code extracted from base + R) +Maintainer: Lionel Henry +Repository: CRAN +Date/Publication: 2024-06-28 11:30:02 UTC +Built: R 4.4.0; ; 2024-06-28 12:27:35 UTC; unix +RemoteType: standard +RemotePkgRef: pkgload +RemoteRef: pkgload +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 1.4.0 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/INDEX new file mode 100644 index 00000000..f22b6b8f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/INDEX @@ -0,0 +1,15 @@ +dev_example Run a examples for an in-development function. +dev_help In-development help for package loaded with + devtools +help Drop-in replacements for help and ? functions +inst Get the installation path of a package +is_dev_package Is the package currently under development? +load_all Load complete package +load_code Load R code. +load_data Load data. +load_dll Load a compiled DLL +package_file Find file in a package. +packages Helper functions for working with development + packages. +system.file Replacement version of system.file +unload Unload a package diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/Meta/Rd.rds new file mode 100644 index 00000000..84c0a387 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/Meta/features.rds new file mode 100644 index 00000000..ded31532 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/Meta/hsearch.rds new file mode 100644 index 00000000..325f9b12 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/Meta/links.rds new file mode 100644 index 00000000..ae49fc95 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/Meta/nsInfo.rds new file mode 100644 index 00000000..62846ba8 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/Meta/package.rds new file mode 100644 index 00000000..c9a455f2 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/NAMESPACE new file mode 100644 index 00000000..cc2a17b5 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/NAMESPACE @@ -0,0 +1,36 @@ +# Generated by roxygen2: do not edit by hand + +S3method(print,dev_topic) +export(check_dep_version) +export(check_suggested) +export(dev_example) +export(dev_help) +export(dev_meta) +export(dev_topic_find) +export(dev_topic_index) +export(dev_topic_index_reset) +export(has_tests) +export(imports_env) +export(inst) +export(is_dev_package) +export(is_loading) +export(load_all) +export(load_code) +export(load_data) +export(load_dll) +export(ns_env) +export(package_file) +export(parse_deps) +export(parse_ns_file) +export(pkg_desc) +export(pkg_env) +export(pkg_name) +export(pkg_ns) +export(pkg_path) +export(pkg_version) +export(pkg_version_raw) +export(pkgtest) +export(run_example) +export(unload) +export(unregister) +import(rlang) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/NEWS.md new file mode 100644 index 00000000..5f78119c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/NEWS.md @@ -0,0 +1,316 @@ +# pkgload 1.4.0 + +* The `reset` argment of `load_all()` is no longer supported because preserving + the namespace requires unlocking its environment, which is no longer possible + in recent versions of R. It should no longer be necessary as the performance + issues caused by resetting the namespace were resolved a while ago. + +* New experimental feature for generating a `compile_commands.json` file after + each `load_all()`. This file is used by LSP servers such as clangd to provide + intellisense features in your native files. To enable it, add this directive + to your `DESCRIPTION` file: + + ``` + Config/build/compilation-database: true + ``` + + You'll also want to add `compile_commands.json` and `.cache` to your gitignore + and Rbuildignore files. + + To accomplish all these steps, feel free to use the unexported function + `pkgload:::use_compilation_db()`. It will eventually be exported from the + usethis package. + +* `load_all()` now includes a link to the exact location when loading failed (@olivroy, #282). + +* User onload hooks are now passed a library path. + +* Fixed an error when updating packages on load (@olivroy, #261). + +* Fixed a bug in `shim_help()` where a complex `package = ` argument + evaluating to `NULL` would cause an error (#266). + + +# pkgload 1.3.4 + +* On load, pkgload now sets `PKGLOAD_PARENT_TEMPDIR` to the temporary + directory used in the current process. This provides a convenient place + to cache results for functions used in subprocesses (e.g. `devtools::test()`, + `devtools::document()`). + +* Fixes for Debian packaging. + + +# pkgload 1.3.3 + +* `dev_topic_index()` is now exported (#257). + +* Fix handling of active bindings inside a package during unloading (#255, @klmr). + +* The `helpers` argument of `load_all` now defaults to the value + provided for the `export_all` arguments. This makes the behaviour + safer by default (#244). + +* pkgload now depends unconditionally on pkgbuild (#249). + +* `load_all()` no longer standardises version number in namespace metadata + (#231). + +* New `pkg_version_raw()` to get raw package version as a string. + + +# pkgload 1.3.2 + +* Fixes for CRAN checks. + +# pkgload 1.3.1 + +* `dev_topic_find()` is now exported (#215). + +* `dev_help()` will remind you to run `pkgload::load_all()` if no + in-development packages are found (#221). + +* Shimmed `?` now works even if you've renamed the documentation topic (#220). + +* `dev_help()` now works with an RStudio daily to deliver a rendered + development documentation that includes working images and links (#228). + + +# pkgload 1.3.0 + +* `load_all()` now calls `rlang::check_installed()` to prompt whether + to install missing packages. + + Outdated and missing dependencies are installed using pak if + installed. If not, the remotes package is used if installed. + Otherwise `install.packages()` is used as a last resort but this + method does not support Remotes fields. + +* `load_all()` gains an `attach` argument set to `TRUE` by default (#209). + If set to `FALSE`, `load_all()` creates a new namespace but doesn't + create a package environment on the search path. In this case, it is + more similar to `loadNamespace()` than to `library()`. + +* Improved the way help pages are displayed in RStudio. This makes the + behaviour within and outside RStudio consistent and fixes issues + with Rd macros (#120). + +* `unregister()` is now exported. This is a gentler version of + `unload()` which removes the package from the search path, + unregisters methods, and unregisters the namespace. However it + doesn't try to unload the namespace or its DLL so that dangling + references keep working. + +* User `onLoad` hooks are now run after exports have been + populated. This allows the hook to use exported functions. + +* The loaded namespace is now locked just before user `onLoad` hooks + are run. This better reproduced the namespace sealing behaviour of + regular loading. + + The package environment environment is now locked as well before + both the user and package `onAttach` hooks are run. + +* Added support for loading a .so or .dll file from the `inst` + folder via a new `library.dynam()` shim (@ethanplunkett, #48). + +* The `system.file()` shim now fails if you supply a path that starts + with `inst` to better reproduce the behaviour with installed + packages (#104). + +* `load_all()` now imports its dependencies lazily to avoid parallel + installation issues (#89). + +* Unknown Rd macros no longer trigger a warning when building the + package topic index (#119). + +* `load_all(compile = TRUE)` now forces a full recompilation (#93). + +* The advice about running `rm()` to remove conflicts with objects in + the global environment is now clickable in RStudio (#199). + +* New `is_loading()` predicate to detect whether `load_all()` is + currently running (#134). + +* `.dynLibs()` is no longer emptied when package with no DLL is + unloaded (#176). + +* The `?` shim no longer interprets `?"/"` as a path (#198). + +* rstudioapi is no longer a hard dependency of pkgload (#187). + +* Errors thrown in user hooks are now demoted to a warning + condition. Previously they were demoted using `try()`, making it + harder to debug them. + +* `load_all()` correctly re-loads modified translations, avoiding + the usual gettext behaviour. + + +# pkgload 1.2.4 + +* Lionel Henry is now the maintainer. + +* `load_all()` automatically registers package translations, if found. + + +# pkgload 1.2.3 + +* pkgload now forces all bindings on unload. This fixes errors and inconsistencies when dangling references force lazy bindings after unload or reload. + +* `load_all()` now restores S3 methods registered by third party packages (#163). + +* `load_dll()` will now preserve the DLL name when loading instead of always using the package name. This allows packages to include DLL's with different names (#162, @dfalbel). + + +# pkgload 1.2.2 + +# pkgload 1.2.1 + +* `unload()` no longer unregisters methods for generics of the package being unloaded. This way dangling references to generics defined in the stale namespace still work as expected (r-lib/vctrs#1341). +* `load_all()` will now work for packages that have testthat tests but do not have testthat installed (#151) +* The `pkgbuild` dependency has been moved to `Suggests`, as it is only needed for packages with compiled code. + +* `load_all()` will now work for packages that have testthat tests but do not have testthat installed (#151) + +* `load_all(warn_conflicts = TRUE)` becomes more narrow and only warns when a *function* in the global environment masks a *function* in the package, consistent with the docs (#125, #143 @jennybc). + +* `load_all()` no longer does a comprehensive check on the `DESCRIPTION` file when loading, instead just checking that it exists and starts with Package (#149, @malcolmbarrett) + +* `unload()` no longer warns when it can't unload a namespace. + + +# pkgload 1.2.0 + +* Fix test failure in R 4.1 with regards to S4 method registration + +* `load_all()` now preserves existing namespaces in working order. In + particular, it doesn't unload the package's shared library and keeps + it loaded instead. When reloading, a copy of the SO for the new + namespace is loaded from a temporary location. These temporary SOs + are only unloaded on GC and deleted from their temporary location + via a weak reference attached to the namespace. + + This mechanism ensures that lingering references to the namespace + keep working as expected. Consequently the namespace + propagation routine that was added to pkgload as a workaround has + been removed. + + Note that `.Call()` invocations that pass a string symbol rather + than a structured symbol may keep crashing, because R will look into + the most recently loaded SO of a given name. Since symbol + registration is now the norm, we don't expect this to cause much + trouble. + +* `load_all()` no longer forces all bindings of a namespace to avoid + lazy-load errors. Instead, it removes exported S3 methods from the + relevant tables. + + - This improves the loading behaviour with packages that define + objects in their namespaces lazily (e.g. with `delayedAssign()`). + + - This also makes `load_all()` more predictable after a method has + been removed from the package. It is now actually removed from the + generic table. It would previously linger until R was restarted. + +* If `load_all()` attaches testthat, it automatically suppresses conflicts. + + +# pkgload 1.1.0 + +* `dev_example()` now works after removing an inconsistent call to `load_all()` (@riccardoporreca, #122). + +* `load_all()` now issues a warning if exported objects conflict with objects defined in the global environment (#112) + +* `run_example()` arguments `run` and `test` are deprecated in favor of the (hopefully) more clear `run_dontrun` and `run_donttest` (#107). + +* Internal fixes for compatibility with the future 4.1.0 release. + + +# pkgload 1.0.2 + +* `shim_question()` now works for topics from the R base package that are passed with the double colon operator (e.g. `base::min`) (@mdequeljoe, #99). + +* `load_all()` now allows using explicitly qualified, exported names in test + helpers (@klmr, #95). + +* `load_all()` gains a `compile` argument which controls more finely whether to + compile the code or not. The `recompile` argument is now deprecated and will + be removed in a future version of pkgload. + + +# pkgload 1.0.1 + +* `unload()` now only removes S4 classes which were generated in the package + being unloaded (#75) + +* `help()` will no longer error when trying to load package level help (#67). + +* Trailing slashes now removed from all paths, which fixes issues on Windows (#73). + +* `load_dll()` now fixed in R-devel (#77). + +* The help shim's now work for `:::` inputs (#72). + +# pkgload 1.0.0 + +* `load_all()` now updates imports of dependent packages when a package is + reloaded (#59). + +* `load_all()` now assigns `DESCRIPTION/Depends` to `.Depends` object of + package environment. (@yiufung pkgload#61) + +* `load_all()` now attaches `testthat` if the `attach_testthat` option is + `TRUE`. This allows `load_all()` to more closely mimic the testing + environment. (#56) + +* `check_dep_version()` and `check_suggested()` are now exported. + +* `check_dep_version()` now emits a warning and returns `FALSE` rather than + aborting. (#47) + +* Package imports are now exported when using `load_all()`. This behavior can + be disabled by using `load_all(export_imports = FALSE)`. + +* The `as.package()` and `is.package()` functions have been removed. + +* `load_code()`, `load_data()`, `load_dll()`, `load_all()`, `parse_ns_file()` + all now take an explicit path rather than a path or a `package` object. + +* `imports_env()`, `ns_env()`, `pkg_env()` and `unload()` now take a package + name rather than a path or a `package` object. + +* `run_example()` now works on R 3.1. + +* `unload()` now unloads S4 classes for packages loaded with `library()` as + well as `load_all()` (#46). + +* `load_all()` gains a `helpers` option to specify whether or not to + source testthat helpers. (@pitakakariki devtools #1202) + +* `load_all()` now sources the testthat helpers in the namespace environment + rather than the package environment (#40). + +* `load_all()` now sets the `NOT_CRAN` environment variable when it + sources testthat helpers. It also sets `DEVTOOLS_LOAD` to "true" so + that you can check whether they are run during package loading. + +* `dev_topic_path()` now only returns the last path found, fixing an error + when a package has both a package function level help with the same name. + (#21) + +* New function `is_dev_package()` to determine if a given package has been loaded + by `pkgload::load_all()` (#2). + +* `load_all()` no longer updates the collate directive. Instead this + functionality has been moved to `devtools::document()`. + +* `dev_help()` now optionally takes a character vector of packages to + search within. This replaces `find_topic()`. + +* `dev_topic_index_reset()` is now exported, and allows you to reset + the topic index associated with a given package. + +* Added a `NEWS.md` file to track changes to the package. + +* Initial release from code spun off from devtools diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/R/pkgload b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/R/pkgload new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/R/pkgload @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/R/pkgload.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/R/pkgload.rdb new file mode 100644 index 00000000..3aa03648 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/R/pkgload.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/R/pkgload.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/R/pkgload.rdx new file mode 100644 index 00000000..b4d9340d Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/R/pkgload.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/WORDLIST b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/WORDLIST new file mode 100644 index 00000000..81b7cc7e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/WORDLIST @@ -0,0 +1,4 @@ +devtools +dir +dirs +recompiles diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/help/AnIndex new file mode 100644 index 00000000..7cec6982 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/help/AnIndex @@ -0,0 +1,44 @@ +pkgload-package pkgload-package +? help +check_dep_version check_dep_version +check_suggested check_suggested +dev_example dev_example +dev_help dev_help +dev_meta dev_meta +dev_topic_find dev_help +dev_topic_index dev_help +dev_topic_index_reset dev_help +has_tests has_tests +help help +imports_env imports_env +inst inst +is_dev_package is_dev_package +is_loading load_all +load_all load_all +load_code load_code +load_data load_data +load_dll load_dll +load_imports load_imports +ns_env ns_env +packages packages +package_file package_file +parse_deps parse_deps +parse_ns_file parse_ns_file +pkgload pkgload-package +pkgtest pkgtest +pkg_desc packages +pkg_env pkg_env +pkg_name packages +pkg_ns packages +pkg_path packages +pkg_version packages +pkg_version_raw packages +run_example dev_example +run_pkg_hook run_pkg_hook +run_user_hook run_pkg_hook +shim_help help +shim_question help +shim_system.file system.file +system.file system.file +unload unload +unregister unload diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/help/aliases.rds new file mode 100644 index 00000000..726ba088 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/help/paths.rds new file mode 100644 index 00000000..2446b2b4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/help/pkgload.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/help/pkgload.rdb new file mode 100644 index 00000000..b5465451 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/help/pkgload.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/help/pkgload.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/help/pkgload.rdx new file mode 100644 index 00000000..30050d32 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/help/pkgload.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/html/00Index.html new file mode 100644 index 00000000..50025ca1 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/html/00Index.html @@ -0,0 +1,84 @@ + + +R: Simulate Package Installation and Attach + + + +
+

Simulate Package Installation and Attach + +

+
+
+[Up] +[Top] +

Documentation for package ‘pkgload’ version 1.4.0

+ + + +

Help Pages

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
?Drop-in replacements for help and ? functions
dev_exampleRun a examples for an in-development function.
dev_helpIn-development help for package loaded with devtools
dev_topic_findIn-development help for package loaded with devtools
dev_topic_indexIn-development help for package loaded with devtools
dev_topic_index_resetIn-development help for package loaded with devtools
helpDrop-in replacements for help and ? functions
instGet the installation path of a package
is_dev_packageIs the package currently under development?
is_loadingLoad complete package
load_allLoad complete package
load_codeLoad R code.
load_dataLoad data.
load_dllLoad a compiled DLL
packagesHelper functions for working with development packages.
package_fileFind file in a package.
pkg_descHelper functions for working with development packages.
pkg_nameHelper functions for working with development packages.
pkg_nsHelper functions for working with development packages.
pkg_pathHelper functions for working with development packages.
pkg_versionHelper functions for working with development packages.
pkg_version_rawHelper functions for working with development packages.
run_exampleRun a examples for an in-development function.
shim_helpDrop-in replacements for help and ? functions
shim_questionDrop-in replacements for help and ? functions
shim_system.fileReplacement version of system.file
system.fileReplacement version of system.file
unloadUnload a package
unregisterUnload a package
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/print-var.mk b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/print-var.mk new file mode 100644 index 00000000..380264d3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/pkgload/print-var.mk @@ -0,0 +1,11 @@ +print-% : ; @echo $($*) + +print-compilers: + @echo $(CC) + @echo $(CXX) + @echo $(CXX14) + @echo $(CXX17) + @echo $(CXX20) + @echo $(CXX23) + @echo $(FC) + @echo $(OBJC) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/CODE_OF_CONDUCT.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..24aa0a3c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/CODE_OF_CONDUCT.md @@ -0,0 +1,25 @@ +# Contributor Code of Conduct + +As contributors and maintainers of this project, we pledge to respect all people who +contribute through reporting issues, posting feature requests, updating documentation, +submitting pull requests or patches, and other activities. + +We are committed to making participation in this project a harassment-free experience for +everyone, regardless of level of experience, gender, gender identity and expression, +sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion. + +Examples of unacceptable behavior by participants include the use of sexual language or +imagery, derogatory comments or personal attacks, trolling, public or private harassment, +insults, or other unprofessional conduct. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, +commits, code, wiki edits, issues, and other contributions that are not aligned to this +Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed +from the project team. + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by +opening an issue or contacting one or more of the project maintainers. + +This Code of Conduct is adapted from the Contributor Covenant +(http://contributor-covenant.org), version 1.0.0, available at +http://contributor-covenant.org/version/1/0/0/ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/COPYRIGHTS b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/COPYRIGHTS new file mode 100644 index 00000000..e5d7d75a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/COPYRIGHTS @@ -0,0 +1,3 @@ +(c) 2016 Ascent Digital Services (formerly Mango Solutions) +(c) 2017 Gábor Csárdi +(c) 2017-2024 Posit Software, PBC (formerly RStudio) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/DESCRIPTION new file mode 100644 index 00000000..08e75859 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/DESCRIPTION @@ -0,0 +1,45 @@ +Package: processx +Title: Execute and Control System Processes +Version: 3.8.5 +Authors@R: c( + person("Gábor", "Csárdi", , "csardi.gabor@gmail.com", role = c("aut", "cre", "cph"), + comment = c(ORCID = "0000-0001-7098-9676")), + person("Winston", "Chang", role = "aut"), + person("Posit Software, PBC", role = c("cph", "fnd")), + person("Ascent Digital Services", role = c("cph", "fnd")) + ) +Description: Tools to run system processes in the background. It can + check if a background process is running; wait on a background process + to finish; get the exit status of finished processes; kill background + processes. It can read the standard output and error of the processes, + using non-blocking connections. 'processx' can poll a process for + standard output or error, with a timeout. It can also poll several + processes at once. +License: MIT + file LICENSE +URL: https://processx.r-lib.org, https://github.com/r-lib/processx +BugReports: https://github.com/r-lib/processx/issues +Depends: R (>= 3.4.0) +Imports: ps (>= 1.2.0), R6, utils +Suggests: callr (>= 3.7.3), cli (>= 3.3.0), codetools, covr, curl, + debugme, parallel, rlang (>= 1.0.2), testthat (>= 3.0.0), + webfakes, withr +Config/Needs/website: tidyverse/tidytemplate +Config/testthat/edition: 3 +Encoding: UTF-8 +RoxygenNote: 7.3.1.9000 +NeedsCompilation: yes +Packaged: 2025-01-08 20:40:10 UTC; gaborcsardi +Author: Gábor Csárdi [aut, cre, cph] (), + Winston Chang [aut], + Posit Software, PBC [cph, fnd], + Ascent Digital Services [cph, fnd] +Maintainer: Gábor Csárdi +Repository: CRAN +Date/Publication: 2025-01-08 21:30:02 UTC +Built: R 4.4.1; aarch64-apple-darwin20; 2025-02-01 04:52:55 UTC; unix +RemoteType: standard +RemotePkgRef: processx +RemoteRef: processx +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 3.8.5 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/INDEX new file mode 100644 index 00000000..a3e50b46 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/INDEX @@ -0,0 +1,11 @@ +base64_decode Base64 Encoding and Decoding +conn_create_fd Processx connections +conn_create_fifo Processx FIFOs +conn_create_unix_socket + Unix domain sockets +curl_fds Create a pollable object from a curl multi + handle's file descriptors +default_pty_options Default options for pseudo terminals (ptys) +poll Poll for process I/O or termination +process External process +run Run external command, and wait until finishes diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/LICENSE new file mode 100644 index 00000000..4f638ffc --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2016-2024 +COPYRIGHT HOLDER: processx core team, see COPYRIGHTS file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/Meta/Rd.rds new file mode 100644 index 00000000..2553e337 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/Meta/hsearch.rds new file mode 100644 index 00000000..8b921ca6 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/Meta/links.rds new file mode 100644 index 00000000..f3cd2fe5 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/Meta/nsInfo.rds new file mode 100644 index 00000000..62e124dc Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/Meta/package.rds new file mode 100644 index 00000000..9d324cdf Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/NAMESPACE new file mode 100644 index 00000000..1cda648e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/NAMESPACE @@ -0,0 +1,48 @@ +# Generated by roxygen2: do not edit by hand + +S3method(close,processx_connection) +S3method(close_named_pipe,unix_named_pipe) +S3method(close_named_pipe,windows_named_pipe) +S3method(conn_is_incomplete,processx_connection) +S3method(conn_read_chars,processx_connection) +S3method(conn_read_lines,processx_connection) +S3method(conn_write,processx_connection) +S3method(format,system_command_error) +S3method(is_pipe_open,unix_named_pipe) +S3method(is_pipe_open,windows_named_pipe) +S3method(print,system_command_error) +S3method(write_lines_named_pipe,unix_named_pipe) +S3method(write_lines_named_pipe,windows_named_pipe) +export(base64_decode) +export(base64_encode) +export(conn_accept_unix_socket) +export(conn_connect_fifo) +export(conn_connect_unix_socket) +export(conn_create_fd) +export(conn_create_fifo) +export(conn_create_file) +export(conn_create_pipepair) +export(conn_create_unix_socket) +export(conn_disable_inheritance) +export(conn_file_name) +export(conn_get_fileno) +export(conn_is_incomplete) +export(conn_read_chars) +export(conn_read_lines) +export(conn_set_stderr) +export(conn_set_stdout) +export(conn_unix_socket_state) +export(conn_write) +export(curl_fds) +export(default_pty_options) +export(is_valid_fd) +export(poll) +export(process) +export(processx_conn_close) +export(processx_conn_is_incomplete) +export(processx_conn_read_chars) +export(processx_conn_read_lines) +export(processx_conn_write) +export(run) +export(supervisor_kill) +useDynLib(processx, .registration = TRUE, .fixes = "c_") diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/NEWS.md new file mode 100644 index 00000000..6b5cd8f4 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/NEWS.md @@ -0,0 +1,338 @@ +# processx 3.8.5 + +* No changes. + +# processx 3.8.4 + +* No changes. + +# processx 3.8.3 + +* `*printf()` format strings are now safer (#379). + +# processx 3.8.2 + +* The client library, used by callr, now ignores `SIGPIPE` when writing + to a file descriptor, on unix. This avoid possible freezes when a + `callr::r_session` subprocess is trying to report its result after the + main process was terminated. In particular, this happened with parallel + testthat: https://github.com/r-lib/testthat/issues/1819 + +# processx 3.8.1 + +* On Unixes, R processes created by callr now feature a `SIGTERM` + cleanup handler that cleans up the temporary directory before + shutting down. To enable it, set the `PROCESSX_R_SIGTERM_CLEANUP` + envvar to a non-empty value. + +# processx 3.8.0 + +* processx error stacks are better now. They have ANSI hyperlinks for + function calls to their manual pages, and they also print operators + better. + +* processx now does not mark standard streams as close-on-exec on Unix, + as this causes problems when calling `system()` from an R subprocess + (https://github.com/r-lib/callr/issues/236). + +# processx 3.7.0 + +* New functions for creating portable FIFOs and Unix socket connections. + See `conn_create_fifo()`, `conn_create_unix_socket()` and + `vignettes/internals.Rmd` for documentation. These functions are currently + experimental. + +# processx 3.6.1 + +* processx now closes file unneeded file descriptors when redirecting + the standard output and error, in the client file. + +* processx errors now do not have `rlang_error` and `rlang_trace` classes, + because they are actually not compatible with rlang errors and traces. + +# processx 3.6.0 + +* processx now gives better error messages, and better stack traces. + +# processx 3.5.3 + +* `run()` now sets `stderr` to `NULL` in the result (instead of an empty + string), if the standard error was redirected to the standard output. + This also fixes an error when interrupting a `run()` with a redirected + standard error. + +* processx now does not fail if the current working directory contains + a non-ASCII character on Windows, and `getwd()` returns a short path + for it (#313). + +# processx 3.5.2 + +* `run()` now does not truncate stdout and stderr when the output + contains multibyte characters (#298, @infotroph). + +* processx now compiles with custom compilers that enable OpenMP (#297). + +* processx now avoids a race condition when the working directory is + changed right after starting a process, potentially before the + sub-process is initialized (#300). + +* processx now works with non-ASCII path names on non-UTF-8 Unix platforms + (#293). + +# processx 3.5.1 + +* Fix a potential failure when polling curl file descriptors on Windows. + +# processx 3.5.0 + +* You can now append environment variables to the ones set in the current + process if you include `"current"` in the value of `env`, in `run()` + and for `process$new()`: `env = c("current", NEW = "newvalue")` (#232). + +* Sub-processes can now inherit the standard input, output and error from + the main R process, by setting the corresponding argument to an empty + string. E.g. `run("ls", stdout = "")` (#72). + +* `run()` is now much faster with large standard output or standard + error (#286). + +* `run()` can now discard the standard output and error or redirect + them to file(s), instead of collecting them. + +* processx now optionally uses the cli package to color error messages + and stack traces, instead of crayon. + +# processx 3.4.5 + +* New options in `pty_options` to set the initial size of the pseudo + terminal. + +* Reading the standard output or error now does not crash occasionally + when a `\n` character is at the beginning of the input buffer (#281). + +# processx 3.4.4 + +* processx now works correctly for non-ASCII commands and arguments passed + in the native encoding, on Windows (#261, #262, #263, #264). + +* Providing multiple environment variables now works on windows (#267). + +# processx 3.4.3 + +* The supervisor (activated with `supervise = TRUE`) does not crash + on the Windows Subsystem on Linux (WSL) now (#222). + +* Fix ABI compatibility for pre and post R 4.0.1 versions. Now CRAN + builds (with R 4.0.2 and later 4.0.x) work well on R 4.0.0. + +* Now processx can run commands on UNC paths specified with + forward slashes: `//hostname/...` UNC paths with the usual + back-slashes were always fine (#249). + +* The `$as_ps_handle()` method works now better; previously it + sometimes created an invalid `ps::ps_handle` object, if the system + clock has changed (#258). + +# processx 3.4.2 + +* `run()` now does a better job with displaying the spinner on terminals + that buffer the output (#223). + +* Error messages are now fully printed after an error. In non-interactive + sessions, the stack trace is printed as well. + +* Further improved error messages. Errors from C code now include the + name of the C function, and errors that belong to a process include the + system command (#197). + +* processx does not crash now if the process receives a SIGPIPE signal when + trying to write to a pipe, of which the other end has already exited. + +* processx now to works better with fork clusters from the parallel + package. See 'Mixing processx and the parallel base R package' in the + README file (#236). + +* processx now does no block SIGCHLD by default in the subprocess, + blocking potentially causes zombie sub-subprocesses (#240). + +* The `process$wait()` method now does not leak file descriptors on + Unix when interrupted (#141). + +# processx 3.4.1 + +* Now `run()` does not create an `ok` variable in the global environment. + +# processx 3.4.0 + +* Processx has now better error messages, in particular, all errors from C + code contain the file name and line number, and the system error code + and message (where applicable). + +* Processx now sets the `.Last.error` variable for every un-caught processx + error to the error condition, and also sets `.Last.error.trace` to its + stack trace. + +* `run()` now prints the last 10 lines of the standard error stream on + error, if `echo = FALSE`, and it also prints the exit status of the + process. + +* `run()` now includes the standard error in the condition signalled on + interrupt. + +* `process` now supports creating pseudo terminals on Unix systems. + +* `conn_create_pipepair()` gets new argument to set the pipes as blocking + or non-blocking. + +* `process` does not set the inherited extra connections as blocking, + and it also does not close them after starting the subprocess. + This is now the responsibility of the user. Note that this is a + breaking change. + +* `run()` now passes extra `...` arguments to `process$new()`. + +* `run()` now does not error if the process is killed in a callback. + +# processx 3.3.1 + +* Fix a crash on Windows, when a connection that has a pending read + internally is finalized. + +# processx 3.3.0 + +* `process` can now redirect the standard error to the standard output, via + specifying `stderr = "2>&1"`. This works both with files and pipes. + +* `run()` can now redirect the standard error to the standard output, via + the new `stderr_to_stdout` argument. + +* The `$kill()` and `$kill_tree()` methods get a `close_connection = TRUE` + argument that closes all pipe connections of the process. + +* `run()` now always kills the process (and its process tree if + `cleanup_tree` is `TRUE`) before exiting. This also closes all + pipe connections (#149). + +# processx 3.2.1 + +* processx does not depend on assertthat now, and the crayon package + is now an optional dependency. + +# processx 3.2.0 + +* New `process$kill_tree()` method, and new `cleanup_tree` arguments in + `run()` and `process$new()`, to clean up the process tree rooted at a + processx process. (#139, #143). + +* New `process$interupt()` method to send an interrupt to a process, + SIGINT on Unix, CTRL+C on Windows (#127). + +* New `stdin` argument in `process$new()` to support writing to the + standard input of a process (#27, #114). + +* New `connections` argument in `process$new()` to support passing extra + connections to the child process, in addition to the standard streams. + +* New `poll_connection` argument to `process$new()`, an extra connection + that can be used to poll the process, even if `stdout` and `stderr` are + not pipes (#125). + +* `poll()` now works with connections objects, and they can be mixed with + process objects (#121). + +* New `env` argument in `run()` and `process$new()`, to set the + environment of the child process, optionally (#117, #118). + +* Removed the `$restart()` method, because it was less useful than + expected, and hard to maintain (#116). + +* New `conn_set_stdout()` and `conn_set_stderr()` to set the standard + output or error of the calling process. + +* New `conn_disable_inheritance()` to disable stdio inheritance. It is + suggested that child processes call this immediately after starting, so + the file handles are not inherited further. + +* Fixed a signal handler bug on Unix that marked the process as finished, + even if it has not (d221aa1f). + +* Fixed a bug that occasionally caused crashes in `wait()`, on Unix (#138). + +* When `run()` is interrupted, no error message is printed, just like + for interruption of R code in general. The thrown condition now also + has the `interrupt` class (#148). + +# processx 3.1.0 + +* Fix interference with the parallel package, and other packages that + redefine the `SIGCHLD` signal handler on Unix. If the processx signal + handler is overwritten, we might miss the exit status of some processes + (they are set to `NA`). + +* `run()` and `process$new()` allow specifying the working directory + of the process (#63). + +* Make the debugme package an optional dependency (#74). + +* processx is now compatible with R 3.1.x. + +* Allow polling more than 64 connections on Windows, by using IOCP + instead of `WaitForMultipleObjects()` (#81, #106). + +* Fix a race condition on Windows, when creating named pipes for stdout + or stderr. The client sometimes didn't wait for the server, and processx + failed with ERROR_PIPE_BUSY (231, All pipe instances are busy). + +# processx 3.0.3 + +* Fix a crash on windows when trying to run a non-existing command (#90) + +* Fix a race condition in `process$restart()` + +* `run()` and `process$new()` do not support the `commandline` argument + any more, because process cleanup is error prone with an intermediate + shell. (#88) + +* `processx` process objects no longer use R connection objects, + because the R connection API was retroactive made private by R-core + `processx` uses its own connection class now to manage standard output + and error of the process. + +* The encoding of the standard output and error can be specified now, + and `processx` re-encodes `stdout` and `stderr` in UTF-8. + +* Cloning of process objects is disables now, as it is likely that it + causes problems (@wch). + +* `supervise` option to kill child process if R crashes (@wch). + +* Add `get_output_file` and `get_error_file`, `has_output_connection()` + and `has_error_connection()` methods (@wch). + +* `stdout` and `stderr` default to `NULL` now, i.e. they are + discarded (@wch). + +* Fix undefined behavior when stdout/stderr was read out after the + process was already finalized, on Unix. + +* `run()`: Better message on interruption, kill process when interrupted. + +* Unix: better kill count on unloading the package. + +* Unix: make wait() work when SIGCHLD is not delivered for some reason. + +* Unix: close inherited file descriptors more conservatively. + +* Fix a race condition and several memory leaks on Windows. + +* Fixes when running under job control that does not allow breaking away + from the job, on Windows. + +# processx 2.0.0.1 + +This is an unofficial release, created by CRAN, to fix compilation on +Solaris. + +# processx 2.0.0 + +First public release. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/R/processx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/R/processx new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/R/processx @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/R/processx.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/R/processx.rdb new file mode 100644 index 00000000..a5e977c7 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/R/processx.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/R/processx.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/R/processx.rdx new file mode 100644 index 00000000..5eabbf70 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/R/processx.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/bin/px b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/bin/px new file mode 100755 index 00000000..a6eabc08 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/bin/px differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/bin/sock b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/bin/sock new file mode 100755 index 00000000..dc643722 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/bin/sock differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/bin/supervisor b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/bin/supervisor new file mode 100755 index 00000000..20ecff16 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/bin/supervisor differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/AnIndex new file mode 100644 index 00000000..d34368ca --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/AnIndex @@ -0,0 +1,40 @@ +processx-package processx-package +base64_decode base64_decode +base64_encode base64_decode +close.processx_connection processx_connections +conn_accept_unix_socket processx_sockets +conn_connect_fifo processx_fifos +conn_connect_unix_socket processx_sockets +conn_create_fd processx_connections +conn_create_fifo processx_fifos +conn_create_file processx_connections +conn_create_pipepair processx_connections +conn_create_unix_socket processx_sockets +conn_disable_inheritance processx_connections +conn_file_name processx_connections +conn_get_fileno processx_connections +conn_is_incomplete processx_connections +conn_is_incomplete.processx_connection processx_connections +conn_read_chars processx_connections +conn_read_chars.processx_connection processx_connections +conn_read_lines processx_connections +conn_read_lines.processx_connection processx_connections +conn_set_stderr processx_connections +conn_set_stdout processx_connections +conn_unix_socket_state processx_sockets +conn_write processx_connections +conn_write.processx_connection processx_connections +curl_fds curl_fds +default_pty_options default_pty_options +is_valid_fd processx_connections +poll poll +process process +processx processx-package +processx_conn_close processx_connections +processx_conn_is_incomplete processx_connections +processx_conn_read_chars processx_connections +processx_conn_read_lines processx_connections +processx_conn_write processx_connections +process_initialize process_initialize +run run +supervisor_kill supervisor_kill diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/aliases.rds new file mode 100644 index 00000000..fba05fc5 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-archived.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-archived.svg new file mode 100644 index 00000000..48f72a6f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-archived.svg @@ -0,0 +1 @@ + lifecyclelifecyclearchivedarchived \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-defunct.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-defunct.svg new file mode 100644 index 00000000..01452e5f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-defunct.svg @@ -0,0 +1 @@ +lifecyclelifecycledefunctdefunct \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-deprecated.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-deprecated.svg new file mode 100644 index 00000000..4baaee01 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-deprecated.svg @@ -0,0 +1 @@ +lifecyclelifecycledeprecateddeprecated \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-experimental.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-experimental.svg new file mode 100644 index 00000000..d1d060e9 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-experimental.svg @@ -0,0 +1 @@ +lifecyclelifecycleexperimentalexperimental \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-maturing.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-maturing.svg new file mode 100644 index 00000000..df713101 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-maturing.svg @@ -0,0 +1 @@ +lifecyclelifecyclematuringmaturing \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-questioning.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-questioning.svg new file mode 100644 index 00000000..08ee0c90 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-questioning.svg @@ -0,0 +1 @@ +lifecyclelifecyclequestioningquestioning \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-stable.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-stable.svg new file mode 100644 index 00000000..e015dc81 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-stable.svg @@ -0,0 +1 @@ +lifecyclelifecyclestablestable \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-superseded.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-superseded.svg new file mode 100644 index 00000000..75f24f55 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/figures/lifecycle-superseded.svg @@ -0,0 +1 @@ + lifecyclelifecyclesupersededsuperseded \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/paths.rds new file mode 100644 index 00000000..88744862 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/processx.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/processx.rdb new file mode 100644 index 00000000..89ec8ec6 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/processx.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/processx.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/processx.rdx new file mode 100644 index 00000000..92be8c90 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/help/processx.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/html/00Index.html new file mode 100644 index 00000000..60726e74 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/html/00Index.html @@ -0,0 +1,98 @@ + + +R: Execute and Control System Processes + + + +
+

Execute and Control System Processes + +

+
+
+[Up] +[Top] +

Documentation for package ‘processx’ version 3.8.5

+ + + +

Help Pages

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
base64_decodeBase64 Encoding and Decoding
base64_encodeBase64 Encoding and Decoding
close.processx_connectionProcessx connections
conn_accept_unix_socketUnix domain sockets
conn_connect_fifoProcessx FIFOs
conn_connect_unix_socketUnix domain sockets
conn_create_fdProcessx connections
conn_create_fifoProcessx FIFOs
conn_create_fileProcessx connections
conn_create_pipepairProcessx connections
conn_create_unix_socketUnix domain sockets
conn_disable_inheritanceProcessx connections
conn_file_nameProcessx connections
conn_get_filenoProcessx connections
conn_is_incompleteProcessx connections
conn_is_incomplete.processx_connectionProcessx connections
conn_read_charsProcessx connections
conn_read_chars.processx_connectionProcessx connections
conn_read_linesProcessx connections
conn_read_lines.processx_connectionProcessx connections
conn_set_stderrProcessx connections
conn_set_stdoutProcessx connections
conn_unix_socket_stateUnix domain sockets
conn_writeProcessx connections
conn_write.processx_connectionProcessx connections
curl_fdsCreate a pollable object from a curl multi handle's file descriptors
default_pty_optionsDefault options for pseudo terminals (ptys)
is_valid_fdProcessx connections
pollPoll for process I/O or termination
processExternal process
processx_conn_closeProcessx connections
processx_conn_is_incompleteProcessx connections
processx_conn_read_charsProcessx connections
processx_conn_read_linesProcessx connections
processx_conn_writeProcessx connections
runRun external command, and wait until finishes
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/include/processx/unix-sockets.c b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/include/processx/unix-sockets.c new file mode 100644 index 00000000..45587aac --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/include/processx/unix-sockets.c @@ -0,0 +1,151 @@ + +#include "unix-sockets.h" + +PROCESSX_STATIC int processx_socket_connect(const char *filename, + processx_socket_t *pxsocket) { +#ifdef _WIN32 + HANDLE hnd; + SECURITY_ATTRIBUTES sa; + DWORD access = GENERIC_READ | GENERIC_WRITE; + DWORD attr = FILE_ATTRIBUTE_NORMAL; + + sa.nLength = sizeof(sa); + sa.lpSecurityDescriptor = NULL; + sa.bInheritHandle = TRUE; + + hnd = CreateFileA( + filename, + access, + 0, + &sa, + OPEN_EXISTING, + attr, + NULL + ); + + if (hnd == INVALID_HANDLE_VALUE) { + return -1; + } else { + *pxsocket = hnd; + return 0; + } + +#else + struct sockaddr_un addr; + int fd = socket(AF_UNIX, SOCK_STREAM, 0); + if (fd == -1) { + return -1; + } + memset(&addr, 0, sizeof(struct sockaddr_un)); + addr.sun_family = AF_UNIX; + strncpy(addr.sun_path, filename, sizeof(addr.sun_path) - 1); + + int ret = connect( + fd, + (struct sockaddr *) &addr, + sizeof(struct sockaddr_un) + ); + + if (ret == -1) { + return -1; + } + + *pxsocket = fd; + return 0; + +#endif +} + +PROCESSX_STATIC ssize_t processx_socket_read(processx_socket_t *pxsocket, + void *buf, + size_t nbyte) { +#ifdef _WIN32 + DWORD got; + BOOL ok = ReadFile( + /* hFile = */ *pxsocket, + /* lpBuffer = */ buf, + /* nNumberOfBytesToRead = */ nbyte, + /* lpNumberOfBytesRead = */ &got, + /* lpOverlapped = */ NULL + ); + if (!ok) { + return -1; + } else { + return got; + } + +#else + return read(*pxsocket, buf, nbyte); +#endif +} + +PROCESSX_STATIC ssize_t processx_socket_write(processx_socket_t *pxsocket, + void *buf, + size_t nbyte) { +#ifdef _WIN32 + DWORD did; + BOOL ok = WriteFile( + /* hFile = */ *pxsocket, + /* lpBuffer = */ buf, + /* nNumberOfBytesToWrite = */ nbyte, + /* lpNumberOfBytesWritten = */ &did, + /* lpOverlapped = */ NULL + ); + if (!ok) { + return -1; + } else { + return did; + } + +#else + return write(*pxsocket, buf, nbyte); +#endif +} + +PROCESSX_STATIC int processx_socket_close(processx_socket_t *pxsocket) { +#ifdef _WIN32 + BOOL ok = CloseHandle(*pxsocket); + if (!ok) { + return -1; + } else { + return 0; + } +#else + return close(*pxsocket); +#endif +} + +PROCESSX_STATIC const char* processx_socket_error_message(void) { +#ifdef _WIN32 +#define ERRORBUF_SIZE 4096 + static char errorbuf[ERRORBUF_SIZE]; + LPVOID lpMsgBuf; + char *failmsg = "Formatting the system message failed :("; + char *realsysmsg = failmsg; + DWORD errorcode = GetLastError(); + + DWORD ret = FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + errorcode, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &lpMsgBuf, + 0, + NULL + ); + + if (ret != 0) { + memset(errorbuf, 0, sizeof(errorbuf)); + strncpy(errorbuf, lpMsgBuf, sizeof(errorbuf) - 1); + realsysmsg = errorbuf; + LocalFree(lpMsgBuf); + } + + return realsysmsg; + +#else + return strerror(errno); +#endif +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/include/processx/unix-sockets.h b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/include/processx/unix-sockets.h new file mode 100644 index 00000000..17bd35da --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/include/processx/unix-sockets.h @@ -0,0 +1,42 @@ +#ifndef R_PROCESSX_UNIX_SOCKETS_H +#define R_PROCESSX_UNIX_SOCKETS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WIN32 +#include +#include +typedef HANDLE processx_socket_t; +#else +#include +#include +#include +#include +#include +#include +#include +typedef int processx_socket_t; +#endif + +#ifndef PROCESSX_STATIC +#define PROCESSX_STATIC +#endif + +PROCESSX_STATIC int processx_socket_connect(const char *filename, + processx_socket_t *pxsocket); +PROCESSX_STATIC ssize_t processx_socket_read(processx_socket_t *pxsocket, + void *buf, + size_t nbyte); +PROCESSX_STATIC ssize_t processx_socket_write(processx_socket_t *pxsocket, + void *buf, + size_t nbyte); +PROCESSX_STATIC int processx_socket_close(processx_socket_t *pxsocket); +PROCESSX_STATIC const char* processx_socket_error_message(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/libs/client.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/libs/client.so new file mode 100755 index 00000000..6bad1d09 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/libs/client.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/libs/processx.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/libs/processx.so new file mode 100755 index 00000000..d62ce5bf Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/processx/libs/processx.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/DESCRIPTION new file mode 100644 index 00000000..a39a57f1 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/DESCRIPTION @@ -0,0 +1,41 @@ +Package: ps +Title: List, Query, Manipulate System Processes +Version: 1.8.1 +Authors@R: c( + person("Jay", "Loden", role = "aut"), + person("Dave", "Daeschler", role = "aut"), + person("Giampaolo", "Rodola'", role = "aut"), + person("Gábor", "Csárdi", , "csardi.gabor@gmail.com", role = c("aut", "cre")), + person("Posit Software, PBC", role = c("cph", "fnd")) + ) +Description: List, query and manipulate all system processes, on + 'Windows', 'Linux' and 'macOS'. +License: MIT + file LICENSE +URL: https://github.com/r-lib/ps, https://ps.r-lib.org/ +BugReports: https://github.com/r-lib/ps/issues +Depends: R (>= 3.4) +Imports: utils +Suggests: callr, covr, curl, pillar, pingr, processx (>= 3.1.0), R6, + rlang, testthat (>= 3.0.0), webfakes, withr +Biarch: true +Config/Needs/website: tidyverse/tidytemplate +Config/testthat/edition: 3 +Encoding: UTF-8 +RoxygenNote: 7.3.2 +NeedsCompilation: yes +Packaged: 2024-10-28 21:43:41 UTC; gaborcsardi +Author: Jay Loden [aut], + Dave Daeschler [aut], + Giampaolo Rodola' [aut], + Gábor Csárdi [aut, cre], + Posit Software, PBC [cph, fnd] +Maintainer: Gábor Csárdi +Repository: CRAN +Date/Publication: 2024-10-28 22:10:02 UTC +Built: R 4.4.1; aarch64-apple-darwin20; 2025-02-01 04:47:15 UTC; unix +RemoteType: standard +RemotePkgRef: ps +RemoteRef: ps +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 1.8.1 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/INDEX new file mode 100644 index 00000000..11544826 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/INDEX @@ -0,0 +1,64 @@ +CleanupReporter testthat reporter that checks if child + processes are cleaned up in tests +errno List of 'errno' error codes +ps Process table +ps_apps List currently running applications +ps_boot_time Boot time of the system +ps_children List of child processes (process objects) of + the process. Note that this typically requires + enumerating all processes on the system, so it + is a costly operation. +ps_cmdline Command line of the process +ps_connections List network connections of a process +ps_cpu_count Number of logical or physical CPUs +ps_cpu_times CPU times of the process +ps_create_time Start time of a process +ps_cwd Process current working directory as an + absolute path. +ps_descent Query the ancestry of a process +ps_disk_io_counters System-wide disk I/O counters +ps_disk_partitions List all mounted partitions +ps_disk_usage Disk usage statistics, per partition +ps_environ Environment variables of a process +ps_exe Full path of the executable of a process +ps_fs_info File system information for files +ps_fs_mount_point Find the mount point of a file or directory +ps_fs_stat File status +ps_get_cpu_affinity Query or set CPU affinity +ps_handle Create a process handle +ps_interrupt Interrupt a process +ps_is_running Checks whether a process is running +ps_kill Kill one or more processes +ps_loadavg Return the average system load over the last 1, + 5 and 15 minutes as a tuple. +ps_mark_tree Mark a process and its (future) child tree +ps_memory_info Memory usage information +ps_name Process name +ps_num_fds Number of open file descriptors +ps_num_threads Number of threads +ps_open_files Open files of a process +ps_os_type Query the type of the OS +ps_pid Pid of a process handle +ps_pids Ids of all processes on the system +ps_ppid Parent pid or parent process of a process +ps_resume Resume (continue) a stopped process +ps_send_signal Send signal to a process +ps_shared_lib_users List all processes that loaded a shared library +ps_shared_libs List the dynamically loaded libraries of a + process +ps_status Current process status +ps_suspend Suspend (stop) the process +ps_system_cpu_times System CPU times. +ps_system_memory Statistics about system memory usage +ps_system_swap System swap memory statistics +ps_terminal Terminal device of the process +ps_terminate Terminate a Unix process +ps_tty_size Query the size of the current terminal +ps_uids User ids and group ids of the process +ps_username Owner of the process +ps_users List users connected to the system +ps_wait Wait for one or more processes to terminate, + with a timeout +ps_windows_nice_values + Get or set the priority of a process +signals List of all supported signals diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/LICENSE new file mode 100644 index 00000000..5fd408f5 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2023 +COPYRIGHT HOLDER: ps authors diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/Meta/Rd.rds new file mode 100644 index 00000000..0eb856de Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/Meta/hsearch.rds new file mode 100644 index 00000000..c2bc4c6d Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/Meta/links.rds new file mode 100644 index 00000000..bbf3d96f Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/Meta/nsInfo.rds new file mode 100644 index 00000000..488f2178 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/Meta/package.rds new file mode 100644 index 00000000..428b1be1 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/NAMESPACE new file mode 100644 index 00000000..b80cb2b0 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/NAMESPACE @@ -0,0 +1,77 @@ +# Generated by roxygen2: do not edit by hand + +S3method(as.character,ps_handle) +S3method(format,ps_handle) +S3method(print,ps_handle) +S3method(print,with_process_cleanup) +export(CleanupReporter) +export(errno) +export(ps) +export(ps_apps) +export(ps_boot_time) +export(ps_children) +export(ps_cmdline) +export(ps_connections) +export(ps_cpu_count) +export(ps_cpu_times) +export(ps_create_time) +export(ps_cwd) +export(ps_descent) +export(ps_disk_io_counters) +export(ps_disk_partitions) +export(ps_disk_usage) +export(ps_environ) +export(ps_environ_raw) +export(ps_exe) +export(ps_find_tree) +export(ps_fs_info) +export(ps_fs_mount_point) +export(ps_fs_stat) +export(ps_get_cpu_affinity) +export(ps_get_nice) +export(ps_gids) +export(ps_handle) +export(ps_interrupt) +export(ps_is_running) +export(ps_is_supported) +export(ps_kill) +export(ps_kill_tree) +export(ps_loadavg) +export(ps_mark_tree) +export(ps_memory_full_info) +export(ps_memory_info) +export(ps_name) +export(ps_num_fds) +export(ps_num_threads) +export(ps_open_files) +export(ps_os_type) +export(ps_parent) +export(ps_pid) +export(ps_pids) +export(ps_ppid) +export(ps_resume) +export(ps_send_signal) +export(ps_set_cpu_affinity) +export(ps_set_nice) +export(ps_shared_lib_users) +export(ps_shared_libs) +export(ps_status) +export(ps_suspend) +export(ps_system_cpu_times) +export(ps_system_memory) +export(ps_system_swap) +export(ps_terminal) +export(ps_terminate) +export(ps_tty_size) +export(ps_uids) +export(ps_username) +export(ps_users) +export(ps_wait) +export(ps_windows_nice_values) +export(signals) +export(with_process_cleanup) +importFrom(utils,head) +importFrom(utils,read.delim) +importFrom(utils,read.table) +importFrom(utils,tail) +useDynLib(ps, .registration = TRUE) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/NEWS.md new file mode 100644 index 00000000..257f80f2 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/NEWS.md @@ -0,0 +1,194 @@ +# ps 1.8.1 + +* ps can now be installed again on unsupported platforms. + +# ps 1.8.0 + +* New `ps_apps()` function to list all running applications on macOS. + +* New function `ps_disk_io_counters()` to query disk I/O counters + (#145, @michaelwalshe). + +* New `ps_fs_info()` to query information about the file system of one + or more files or directories. + +* New `ps_wait()` to start an interruptible wait on multiple processes, + with a timeout (#166). + +* `ps_handle()` now allows a numeric (double) scalar as the pid, as long + as its value is integer. + +* `ps_send_signal()`, `ps_suspend()`, `ps_resume()`, `ps_terminate()`, + `ps_kill()`, and `ps_interrupt()` can now operate on multiple processes, + if passed a list of process handles. + +* `ps_kill()` and `ps_kill_tree()` have a new `grace` argument. + On Unix, if this argument is not zero, then `ps_kill()` first sends a + `TERM` signal, and waits for the processes to quit gracefully, via + `ps_wait()`. The processes that are still alive after the grace period + are then killed with `SIGKILL`. + +* `ps_status()` (and thus `ps()`) is now better at getting the correct + status of processes on macOS. This usually requires calling the external + `ps` tool. See `?ps_status()` on how to opt out from the new + behavior (#31). + +# ps 1.7.7 + +* `ps_cpu_times()` values are now correct on newer arm64 macOS. + +# ps 1.7.6 + +* `ps_name()` now does not fail in the rare case when `ps_cmdline()` returns an empty vector (#150). + +* `ps_system_cpu_times()` now returns CPU times divided by the HZ as reported by CLK_TCK, in-line with other OS's and the per-process version. (#144, @michaelwalshe). + +# ps 1.7.5 + +No user visible changes. + +# ps 1.7.4 + +* `ps::ps_get_cpu_affinity()` now works for other processes on Linux, not only + the calling process. + +# ps 1.7.3 + +* The output of `ps_disk_usage()`, `ps_disk_partitions()` and + `ps_shared_lib_users()` now do not include a spurious `stringsAsFactors` + column. + +# ps 1.7.2 + +* `ps_system_memory()$percent` now returns a number scaled between 0 and 100 + on Windows, rather than between 0 and 1 (#131, @francisbarton). + +# ps 1.7.1 + +* ps now returns data frames instead of tibbles. While data frames and + tibbles are very similar, they are not completely compatible. To convert + the output of ps to tibbles call the `tibble::as_tibble()` function + on them. + +* `ps()` now does not fail if both `user` and `after` are specified (#129). + +# ps 1.7.0 + +* ps now compiles on platforms that enable OpenMP (#109). + +* New functions `ps_get_cpu_affinity()` and `ps_set_cpu_affinity()` to query + and set CPU affinity (#123). + +* `ps_memory_info()` now does not mix up `rss` and `vms` on Linux. + +* `ps_memory_info()` now reports memory in bytes instead of pages on Linux (#115) + +# ps 1.6.0 + +* New function `ps_system_cpu_times()` to calculate system CPU times. + +* New function `ps_loadavg()` to show the Unix style load average. + +# ps 1.5.0 + +* New function `ps_shared_libs()` to list the loaded shared libraries + of a process, on Windows. + +* New function `ps_shared_lib_users()` to list all processes that + loaded a certain shared library, on Windows. + +* New function `ps_descent()` to query the ancestry of a process. + +# ps 1.4.0 + +* ps is now under the MIT license. + +* Process functions now default to the calling R process. So e.g. you can + write simply `ps_connections()` to list all network connections of the + current process, instead of `ps_connections(ps_handle())`. + +* New `ps_get_nice()` and `ps_set_nice()` functions to get and set the + priority of a process (#89). + +* New `ps_system_memory()` and `ps_system_swap()` functions, to + return information about system memory and swap usage. + +* New `ps_disk_partitions()` and `ps_disk_usage()` functions, they + return information about file systems, similarly to the `mount` and + `df` Unix commands. + +* New `ps_tty_size()` function to query the size of the terminal. + +* Fixed an issue in `CleanupReporter()` that triggered random failures + on macOS. + +# ps 1.3.4 + +* `ps_cpu_count()` now reports the correct number on Windows, even if + the package binary was built on a Windows version with a different + API (#77). + +# ps 1.3.3 + +* New function `errno()` returns a table of `errno.h` error codes and + their description. + +* ps now compiles again on Solaris. + +# ps 1.3.2 + +* ps now compiles again on unsupported platforms like Solaris. + +# ps 1.3.1 + +* Fixed an installation problem on some Windows versions, where the + output of `cmd /c ver` looks different (#69). + +# ps 1.3.0 + +* New `ps_cpu_count()` function returns the number of logical or + physical processors. + +# ps 1.2.1 + +* Fix a crash on Linux, that happened at load time (#50). + +# ps 1.2.0 + +* New `ps_connections()` to list network connections. The + `CleanupReporter()` testthat reporter can check for leftover open + network connections in test cases. + +* `ps_open_files()` does not include open sockets now on Linux, they are + rather included in `ps_connections()`. + +* `CleanupReporter()` now ignores `/dev/urandom`, some packages (curl, + openssl, etc.) keep this file open. + +* Fix `ps()` printing without the tibble package (#43). + +* Fix compilation with ICC (#39). + +* Fix a crash on Linux (#47). + +# ps 1.1.0 + +* New `ps_num_fds()` returns the number of open files/handles. + +* New `ps_open_files()` lists all open files of a process. + +* New `ps_interrupt()` interrupts a process. It sends a `SIGINT` signal on + POSIX systems, and it can send CTRL+C or CTRL+BREAK events on Windows. + +* New `ps_users()` lists users connected to the system. + +* New `ps_mark_tree()`, `ps_find_tree()`, `ps_kill_tree()`, + `with_process_cleanup()`: functions to mark and clean up child + processes. + +* New `CleanupReporter`, to be used with testthat: it checks for + leftover child processes and open files in `test_that()` blocks. + +# ps 1.0.0 + +First released version. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/R/ps b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/R/ps new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/R/ps @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/R/ps.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/R/ps.rdb new file mode 100644 index 00000000..1113ce15 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/R/ps.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/R/ps.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/R/ps.rdx new file mode 100644 index 00000000..527beaa9 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/R/ps.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/WORDLIST b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/WORDLIST new file mode 100644 index 00000000..e7b26dde --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/WORDLIST @@ -0,0 +1,22 @@ +CTRL +DRS +IDEs +macOS +pageins +pid +Pid +PID +pids +RStudio +runnable +SHR +SIGCONT +SIGKILL +signalling +testthat +tibble +TRS +UDP +uid +unparsed +VIRT diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/bin/px b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/bin/px new file mode 100755 index 00000000..7be2b156 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/bin/px differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/help/AnIndex new file mode 100644 index 00000000..d00acbf8 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/help/AnIndex @@ -0,0 +1,70 @@ +ps-package ps-package +as.character.ps_handle ps_handle +CleanupReporter CleanupReporter +errno errno +format.ps_handle ps_handle +print.ps_handle ps_handle +ps ps +ps_apps ps_apps +ps_boot_time ps_boot_time +ps_children ps_children +ps_cmdline ps_cmdline +ps_connections ps_connections +ps_cpu_count ps_cpu_count +ps_cpu_times ps_cpu_times +ps_create_time ps_create_time +ps_cwd ps_cwd +ps_descent ps_descent +ps_disk_io_counters ps_disk_io_counters +ps_disk_partitions ps_disk_partitions +ps_disk_usage ps_disk_usage +ps_environ ps_environ +ps_environ_raw ps_environ +ps_exe ps_exe +ps_find_tree ps_kill_tree +ps_fs_info ps_fs_info +ps_fs_mount_point ps_fs_mount_point +ps_fs_stat ps_fs_stat +ps_get_cpu_affinity ps_get_cpu_affinity +ps_get_nice ps_get_nice +ps_gids ps_uids +ps_handle ps_handle +ps_interrupt ps_interrupt +ps_is_running ps_is_running +ps_is_supported ps_os_type +ps_kill ps_kill +ps_kill_tree ps_kill_tree +ps_loadavg ps_loadavg +ps_mark_tree ps_kill_tree +ps_memory_full_info ps_memory_info +ps_memory_info ps_memory_info +ps_name ps_name +ps_num_fds ps_num_fds +ps_num_threads ps_num_threads +ps_open_files ps_open_files +ps_os_type ps_os_type +ps_parent ps_ppid +ps_pid ps_pid +ps_pids ps_pids +ps_ppid ps_ppid +ps_resume ps_resume +ps_send_signal ps_send_signal +ps_set_cpu_affinity ps_get_cpu_affinity +ps_set_nice ps_get_nice +ps_shared_libs ps_shared_libs +ps_shared_lib_users ps_shared_lib_users +ps_status ps_status +ps_suspend ps_suspend +ps_system_cpu_times ps_system_cpu_times +ps_system_memory ps_system_memory +ps_system_swap ps_system_swap +ps_terminal ps_terminal +ps_terminate ps_terminate +ps_tty_size ps_tty_size +ps_uids ps_uids +ps_username ps_username +ps_users ps_users +ps_wait ps_wait +ps_windows_nice_values ps_get_nice +signals signals +with_process_cleanup ps_kill_tree diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/help/aliases.rds new file mode 100644 index 00000000..84d21ff3 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/help/paths.rds new file mode 100644 index 00000000..90226c24 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/help/ps.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/help/ps.rdb new file mode 100644 index 00000000..c3f9f50c Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/help/ps.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/help/ps.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/help/ps.rdx new file mode 100644 index 00000000..c4ab3299 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/help/ps.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/html/00Index.html new file mode 100644 index 00000000..8ea73a3b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/html/00Index.html @@ -0,0 +1,164 @@ + + +R: List, Query, Manipulate System Processes + + + +
+

List, Query, Manipulate System Processes + +

+
+
+[Up] +[Top] +

Documentation for package ‘ps’ version 1.8.1

+ + + +

Help Pages

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
as.character.ps_handleCreate a process handle
CleanupReportertestthat reporter that checks if child processes are cleaned up in tests
errnoList of 'errno' error codes
format.ps_handleCreate a process handle
print.ps_handleCreate a process handle
psProcess table
ps_appsList currently running applications
ps_boot_timeBoot time of the system
ps_childrenList of child processes (process objects) of the process. Note that this typically requires enumerating all processes on the system, so it is a costly operation.
ps_cmdlineCommand line of the process
ps_connectionsList network connections of a process
ps_cpu_countNumber of logical or physical CPUs
ps_cpu_timesCPU times of the process
ps_create_timeStart time of a process
ps_cwdProcess current working directory as an absolute path.
ps_descentQuery the ancestry of a process
ps_disk_io_countersSystem-wide disk I/O counters
ps_disk_partitionsList all mounted partitions
ps_disk_usageDisk usage statistics, per partition
ps_environEnvironment variables of a process
ps_environ_rawEnvironment variables of a process
ps_exeFull path of the executable of a process
ps_find_treeMark a process and its (future) child tree
ps_fs_infoFile system information for files
ps_fs_mount_pointFind the mount point of a file or directory
ps_fs_statFile status
ps_get_cpu_affinityQuery or set CPU affinity
ps_get_niceGet or set the priority of a process
ps_gidsUser ids and group ids of the process
ps_handleCreate a process handle
ps_interruptInterrupt a process
ps_is_runningChecks whether a process is running
ps_is_supportedQuery the type of the OS
ps_killKill one or more processes
ps_kill_treeMark a process and its (future) child tree
ps_loadavgReturn the average system load over the last 1, 5 and 15 minutes as a tuple.
ps_mark_treeMark a process and its (future) child tree
ps_memory_full_infoMemory usage information
ps_memory_infoMemory usage information
ps_nameProcess name
ps_num_fdsNumber of open file descriptors
ps_num_threadsNumber of threads
ps_open_filesOpen files of a process
ps_os_typeQuery the type of the OS
ps_parentParent pid or parent process of a process
ps_pidPid of a process handle
ps_pidsIds of all processes on the system
ps_ppidParent pid or parent process of a process
ps_resumeResume (continue) a stopped process
ps_send_signalSend signal to a process
ps_set_cpu_affinityQuery or set CPU affinity
ps_set_niceGet or set the priority of a process
ps_shared_libsList the dynamically loaded libraries of a process
ps_shared_lib_usersList all processes that loaded a shared library
ps_statusCurrent process status
ps_suspendSuspend (stop) the process
ps_system_cpu_timesSystem CPU times.
ps_system_memoryStatistics about system memory usage
ps_system_swapSystem swap memory statistics
ps_terminalTerminal device of the process
ps_terminateTerminate a Unix process
ps_tty_sizeQuery the size of the current terminal
ps_uidsUser ids and group ids of the process
ps_usernameOwner of the process
ps_usersList users connected to the system
ps_waitWait for one or more processes to terminate, with a timeout
ps_windows_nice_valuesGet or set the priority of a process
signalsList of all supported signals
with_process_cleanupMark a process and its (future) child tree
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/internals.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/internals.md new file mode 100644 index 00000000..5dc04de9 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/internals.md @@ -0,0 +1,62 @@ + +# `ps_handle` methods + +``` +method A C Z +-------------- - - - +ps_pid + . + +ps_create_time + . + +ps_is_running + . + +ps_format + . + +- +ps_ppid . > + +ps_parent . > + +ps_name . > + +ps_exe . > Z +ps_cmdline . > Z +ps_status . > + +ps_username . > + +ps_cwd . > Z +ps_uids . > + +ps_gids . > + +ps_terminal . > + +ps_environ . > Z +ps_environ_raw . > Z +ps_num_threads . > Z +ps_cpu_times . > Z +ps_memory_info . > Z +ps_num_fds . > Z +ps_open_files . > Z +ps_connections . > Z +ps_children . > + +ps_send_signal . < + +ps_suspend . < + +ps_resume . < + +ps_terminate . < + +ps_kill . < + +ps_interrupt . < + +``` + +``` +A: always works, even if the process has finished +C: <: checks if process is running, before + >: checks if process is running, after +Z: +: works fine on a zombie + Z: errors (zombie_process) on a zombie +``` + +# System API + +## `ps()` + +## `ps_pids()` + +## `ps_boot_time()` + +## Process cleanup + +`ps_kill_tree()`, `ps_mark_tree()`, `with_process_cleanup()`. + +## `ps_os_type()` + +## `signals()` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/libs/ps.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/libs/ps.so new file mode 100755 index 00000000..e62f7762 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/libs/ps.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/tools/error-codes.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/tools/error-codes.R new file mode 100644 index 00000000..f39edac5 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/tools/error-codes.R @@ -0,0 +1,198 @@ + + +code <- ' +#include "common.h" + +#include + +SEXP ps__define_errno(void) { + + SEXP env = PROTECT(Rf_allocSExp(ENVSXP)); + +#define PS_ADD_ERRNO(err,str,val) \\ + defineVar( \\ + install(#err), \\ + PROTECT(list2(PROTECT(ScalarInteger(val)), PROTECT(mkString(str)))), \\ + env); \\ + UNPROTECT(3) + +%s + +#undef PS_ADD_ERRNO +#undef PS_ADD_ERRNOX + + UNPROTECT(1); + return env; +} +' + +data <- read.csv(stringsAsFactors = FALSE, textConnection(' +name,txt +EPERM,"Operation not permitted." +ENOENT,"No such file or directory." +ESRCH,"No such process." +EINTR,"Interrupted function call." +EIO,"Input/output error." +ENXIO,"No such device or address." +E2BIG,"Arg list too long." +ENOEXEC,"Exec format error." +EBADF,"Bad file descriptor." +ECHILD,"No child processes." +EDEADLK,"Resource deadlock avoided." +ENOMEM,"Cannot allocate memory." +EACCES,"Permission denied." +EFAULT,"Bad address." +ENOTBLK,"Not a block device." +EBUSY,"Resource busy." +EEXIST,"File exists." +EXDEV,"Improper link." +ENODEV,"Operation not supported by device." +ENOTDIR,"Not a directory." +EISDIR,"Is a directory." +EINVAL,"Invalid argument." +ENFILE,"Too many open files in system." +EMFILE,"Too many open files." +ENOTTY,"Inappropriate ioctl for device." +ETXTBSY,"Text file busy." +EFBIG,"File too large." +ENOSPC,"Device out of space." +ESPIPE,"Illegal seek." +EROFS,"Read-only file system." +EMLINK,"Too many links." +EPIPE,"Broken pipe." +EDOM,"Numerical argument out of domain." +ERANGE,"Numerical result out of range." +EAGAIN,"Resource temporarily unavailable." +EINPROGRESS,"Operation now in progress." +EALREADY,"Operation already in progress." +ENOTSOCK,"Socket operation on non-socket." +EDESTADDRREQ,"Destination address required." +EMSGSIZE,"Message too long." +EPROTOTYPE,"Protocol wrong type for socket." +ENOPROTOOPT,"Protocol not available." +EPROTONOSUPPORT,"Protocol not supported." +ESOCKTNOSUPPORT,"Socket type not supported." +ENOTSUP,"Not supported." +EPFNOSUPPORT,"Protocol family not supported." +EAFNOSUPPORT,"Address family not supported by protocol family." +EADDRINUSE,"Address already in use." +EADDRNOTAVAIL,"Cannot assign requested address." +ENETDOWN,"Network is down." +ENETUNREACH,"Network is unreachable." +ENETRESET,"Network dropped connection on reset." +ECONNABORTED,"Software caused connection abort." +ECONNRESET,"Connection reset by peer." +ENOBUFS,"No buffer space available." +EISCONN,"Socket is already connected." +ENOTCONN,"Socket is not connected." +ESHUTDOWN,"Cannot send after socket shutdown." +ETIMEDOUT,"Operation timed out." +ECONNREFUSED,"Connection refused." +ELOOP,"Too many levels of symbolic links." +ENAMETOOLONG,"File name too long." +EHOSTDOWN,"Host is down." +EHOSTUNREACH,"No route to host." +ENOTEMPTY,"Directory not empty." +EPROCLIM,"Too many processes." +EUSERS,"Too many users." +EDQUOT,"Disc quota exceeded." +ESTALE,"Stale NFS file handle." +EBADRPC,"RPC struct is bad." +ERPCMISMATCH,"RPC version wrong." +EPROGUNAVAIL,"RPC prog. not avail." +EPROGMISMATCH,"Program version wrong." +EPROCUNAVAIL,"Bad procedure for program." +ENOLCK,"No locks available." +ENOSYS,"Function not implemented." +EFTYPE,"Inappropriate file type or format." +EAUTH,"Authentication error." +ENEEDAUTH,"Need authenticator." +EPWROFF,"Device power is off." +EDEVERR,"Device error." +EOVERFLOW,"Value too large to be stored in data type." +EBADEXEC,"Bad executable (or shared library)." +EBADARCH,"Bad CPU type in executable." +ESHLIBVERS,"Shared library version mismatch." +EBADMACHO,"Malformed Mach-o file." +ECANCELED,"Operation canceled." +EIDRM,"Identifier removed." +ENOMSG,"No message of desired type." +EILSEQ,"Illegal byte sequence." +ENOATTR,"Attribute not found." +EBADMSG,"Bad message." +EMULTIHOP,"Multihop attempted." +ENODATA,"No message available." +ENOSTR,"Not a STREAM." +EPROTO,"Protocol error." +ETIME,"STREAM ioctl() timeout." +EOPNOTSUPP,"Operation not supported on socket." +EWOULDBLOCK,"Resource temporarily unavailable." +ETOOMANYREFS,"Too many references: cannot splice." +EREMOTE,"File is already NFS-mounted" +EBACKGROUND,"Caller not in the foreground process group" +EDIED,"Translator died" +ED,"The experienced user will know what is wrong."#else +EGREGIOUS,"You did *what*?" +EIEIO,"Go home and have a glass of warm, dairy-fresh milk." +EGRATUITOUS,"This error code has no purpose." +ENOLINK,"Link has been severed." +ENOSR,"Out of streams resources." +ERESTART,"Interrupted system call should be restarted." +ECHRNG,"Channel number out of range." +EL2NSYNC,"Level 2 not synchronized." +EL3HLT,"Level 3 halted." +EL3RST,"Level 3 reset." +ELNRNG,"Link number out of range." +EUNATCH,"Protocol driver not attached." +ENOCSI,"No CSI structure available." +EL2HLT,"Level 2 halted." +EBADE,"Invalid exchange." +EBADR,"Invalid request descriptor." +EXFULL,"Exchange full." +ENOANO,"No anode." +EBADRQC,"Invalid request code." +EBADSLT,"Invalid slot." +EDEADLOCK,"File locking deadlock error." +EBFONT,"Bad font file format." +ENONET,"Machine is not on the network." +ENOPKG,"Package not installed." +EADV,"Advertise error." +ESRMNT,"Srmount error." +ECOMM,"Communication error on send." +EDOTDOT,"RFS specific error" +ENOTUNIQ,"Name not unique on network." +EBADFD,"File descriptor in bad state." +EREMCHG,"Remote address changed." +ELIBACC,"Can not access a needed shared library." +ELIBBAD,"Accessing a corrupted shared library." +ELIBSCN,".lib section in a.out corrupted." +ELIBMAX,"Attempting to link in too many shared libraries." +ELIBEXEC,"Cannot exec a shared library directly." +ESTRPIPE,"Streams pipe error." +EUCLEAN,"Structure needs cleaning." +ENOTNAM,"Not a XENIX named type file." +ENAVAIL,"No XENIX semaphores available." +EISNAM,"Is a named type file." +EREMOTEIO,"Remote I/O error." +ENOMEDIUM,"No medium found." +EMEDIUMTYPE,"Wrong medium type." +ENOKEY,"Required key not available." +EKEYEXPIRED,"Key has expired." +EKEYREVOKED,"Key has been revoked." +EKEYREJECTED,"Key was rejected by service." +EOWNERDEAD,"Owner died." +ENOTRECOVERABLE,"State not recoverable." +ERFKILL,"Operation not possible due to RF-kill." +EHWPOISON,"Memory page has hardware error." +')) + +defs <- sprintf(" +#ifdef %s + PS_ADD_ERRNO(%s,\"%s\",%s); +#else + PS_ADD_ERRNO(%s,\"%s\",NA_INTEGER); +#endif +", data$name, data$name, data$txt, data$name, data$name, data$txt) + +txt <- paste0(sprintf(code, paste(defs, collapse = "\n")), collapse = "\n") +writeBin(charToRaw(txt), con = "src/error-codes.c") diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/tools/winver.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/tools/winver.R new file mode 100644 index 00000000..288333ca --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/ps/tools/winver.R @@ -0,0 +1,30 @@ + +winver_ver <- function(v = NULL) { + if (is.null(v)) v <- system("cmd /c ver", intern = TRUE) + v2 <- grep("\\[.*\\s.*\\]", v, value = TRUE)[1] + v3 <- sub("^.*\\[[^ ]+\\s+", "", v2) + v4 <- sub("\\]$", "", v3) + if (is.na(v4)) stop("Failed to parse windows version") + v4 +} + +winver_wmic <- function(v = NULL) { + cmd <- "wmic os get Version /value" + if (is.null(v)) v <- system(cmd, intern = TRUE) + v2 <- grep("=", v, value = TRUE) + v3 <- strsplit(v2, "=", fixed = TRUE)[[1]][2] + v4 <- sub("\\s*$", "", sub("^\\s*", "", v3)) + if (is.na(v4)) stop("Failed to parse windows version") + v4 +} + +winver <- function() { + ## First we try with `wmic` + v <- if (Sys.which("wmic") != "") { + tryCatch(winver_wmic(), error = function(e) NULL) + } + ## Otherwise `ver` + if (is.null(v)) winver_ver() else v +} + +if (is.null(sys.calls())) cat(winver()) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/DESCRIPTION new file mode 100644 index 00000000..27b64274 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/DESCRIPTION @@ -0,0 +1,45 @@ +Package: purrr +Title: Functional Programming Tools +Version: 1.0.4 +Authors@R: c( + person("Hadley", "Wickham", , "hadley@posit.co", role = c("aut", "cre"), + comment = c(ORCID = "0000-0003-4757-117X")), + person("Lionel", "Henry", , "lionel@posit.co", role = "aut"), + person("Posit Software, PBC", role = c("cph", "fnd"), + comment = c(ROR = "03wc8by49")) + ) +Description: A complete and consistent functional programming toolkit for + R. +License: MIT + file LICENSE +URL: https://purrr.tidyverse.org/, https://github.com/tidyverse/purrr +BugReports: https://github.com/tidyverse/purrr/issues +Depends: R (>= 4.0) +Imports: cli (>= 3.6.1), lifecycle (>= 1.0.3), magrittr (>= 1.5.0), + rlang (>= 1.1.1), vctrs (>= 0.6.3) +Suggests: covr, dplyr (>= 0.7.8), httr, knitr, lubridate, rmarkdown, + testthat (>= 3.0.0), tibble, tidyselect +LinkingTo: cli +VignetteBuilder: knitr +Biarch: true +Config/build/compilation-database: true +Config/Needs/website: tidyverse/tidytemplate, tidyr +Config/testthat/edition: 3 +Config/testthat/parallel: TRUE +Encoding: UTF-8 +RoxygenNote: 7.3.2 +NeedsCompilation: yes +Packaged: 2025-01-29 21:33:56 UTC; hadleywickham +Author: Hadley Wickham [aut, cre] (), + Lionel Henry [aut], + Posit Software, PBC [cph, fnd] (03wc8by49) +Maintainer: Hadley Wickham +Repository: CRAN +Date/Publication: 2025-02-05 18:00:01 UTC +Built: R 4.4.1; aarch64-apple-darwin20; 2025-02-05 18:50:51 UTC; unix +Archs: purrr.so.dSYM +RemoteType: standard +RemotePkgRef: purrr +RemoteRef: purrr +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 1.0.4 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/INDEX new file mode 100644 index 00000000..90c54da3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/INDEX @@ -0,0 +1,56 @@ +accumulate Accumulate intermediate results of a vector + reduction +array-coercion Coerce array to list +as_mapper Convert an object into a mapper function +attr_getter Create an attribute getter function +auto_browse Wrap a function so it will automatically + 'browse()' on error +chuck Get an element deep within a nested data + structure, failing if it doesn't exist +compose Compose multiple functions together to create a + new function +detect Find the value or position of the first match +every Do every, some, or none of the elements of a + list satisfy a predicate? +has_element Does a list contain an object? +head_while Find head/tail that all satisfies a predicate. +imap Apply a function to each element of a vector, + and its index +insistently Transform a function to wait then retry after + an error +keep Keep/discard elements based on their values +keep_at Keep/discard elements based on their + name/position +list_assign Modify a list +list_c Combine list elements into a single data + structure +list_flatten Flatten a list +list_simplify Simplify a list to an atomic or S3 vector +list_transpose Transpose a list +lmap Apply a function to list-elements of a list +map Apply a function to each element of a vector +map2 Map over two inputs +map_depth Map/modify elements at given depth +map_if Apply a function to each element of a vector + conditionally +modify Modify elements selectively +modify_in Modify a pluck location +modify_tree Recursively modify a list +negate Negate a predicate function so it selects what + it previously rejected +partial Partially apply a function, filling in some + arguments +pluck Safely get or set an element deep within a + nested data structure +pluck_depth Compute the depth of a vector +pmap Map over multiple input simultaneously (in + "parallel") +possibly Wrap a function to return a value instead of an + error +progress_bars Progress bars in purrr +quietly Wrap a function to capture side-effects +rate-helpers Create delaying rate settings +reduce Reduce a list to a single value by iteratively + applying a binary function +safely Wrap a function to capture errors +slowly Wrap a function to wait between executions diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/LICENSE new file mode 100644 index 00000000..eb969a34 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2023 +COPYRIGHT HOLDER: purrr authors diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/Meta/Rd.rds new file mode 100644 index 00000000..fa4ebe3f Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/Meta/hsearch.rds new file mode 100644 index 00000000..427a9941 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/Meta/links.rds new file mode 100644 index 00000000..e123b762 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/Meta/nsInfo.rds new file mode 100644 index 00000000..ff934111 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/Meta/package.rds new file mode 100644 index 00000000..77e3320c Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/Meta/vignette.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/Meta/vignette.rds new file mode 100644 index 00000000..d8711ffc Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/Meta/vignette.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/NAMESPACE new file mode 100644 index 00000000..bb906a65 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/NAMESPACE @@ -0,0 +1,240 @@ +# Generated by roxygen2: do not edit by hand + +S3method(as_mapper,character) +S3method(as_mapper,default) +S3method(as_mapper,list) +S3method(as_mapper,numeric) +S3method(print,purrr_function_compose) +S3method(print,purrr_function_partial) +S3method(print,purrr_rate_backoff) +S3method(print,purrr_rate_delay) +S3method(rate_sleep,purrr_rate_backoff) +S3method(rate_sleep,purrr_rate_delay) +export("%>%") +export("%@%") +export("%||%") +export("pluck<-") +export(accumulate) +export(accumulate2) +export(accumulate_right) +export(array_branch) +export(array_tree) +export(as_mapper) +export(as_vector) +export(assign_in) +export(at_depth) +export(attr_getter) +export(auto_browse) +export(chuck) +export(compact) +export(compose) +export(cross) +export(cross2) +export(cross3) +export(cross_d) +export(cross_df) +export(cross_n) +export(detect) +export(detect_index) +export(discard) +export(discard_at) +export(done) +export(every) +export(exec) +export(flatten) +export(flatten_chr) +export(flatten_dbl) +export(flatten_df) +export(flatten_dfc) +export(flatten_dfr) +export(flatten_int) +export(flatten_lgl) +export(flatten_raw) +export(has_element) +export(head_while) +export(imap) +export(imap_chr) +export(imap_dbl) +export(imap_dfc) +export(imap_dfr) +export(imap_int) +export(imap_lgl) +export(imap_raw) +export(imap_vec) +export(imodify) +export(insistently) +export(invoke) +export(invoke_map) +export(invoke_map_chr) +export(invoke_map_dbl) +export(invoke_map_df) +export(invoke_map_dfc) +export(invoke_map_dfr) +export(invoke_map_int) +export(invoke_map_lgl) +export(invoke_map_raw) +export(is_atomic) +export(is_bare_atomic) +export(is_bare_character) +export(is_bare_double) +export(is_bare_integer) +export(is_bare_list) +export(is_bare_logical) +export(is_bare_numeric) +export(is_bare_vector) +export(is_character) +export(is_double) +export(is_empty) +export(is_formula) +export(is_function) +export(is_integer) +export(is_list) +export(is_logical) +export(is_null) +export(is_rate) +export(is_scalar_atomic) +export(is_scalar_character) +export(is_scalar_double) +export(is_scalar_integer) +export(is_scalar_list) +export(is_scalar_logical) +export(is_scalar_vector) +export(is_vector) +export(iwalk) +export(keep) +export(keep_at) +export(lift) +export(lift_dl) +export(lift_dv) +export(lift_ld) +export(lift_lv) +export(lift_vd) +export(lift_vl) +export(list_along) +export(list_assign) +export(list_c) +export(list_cbind) +export(list_flatten) +export(list_merge) +export(list_modify) +export(list_rbind) +export(list_simplify) +export(list_transpose) +export(lmap) +export(lmap_at) +export(lmap_if) +export(map) +export(map2) +export(map2_chr) +export(map2_dbl) +export(map2_df) +export(map2_dfc) +export(map2_dfr) +export(map2_int) +export(map2_lgl) +export(map2_raw) +export(map2_vec) +export(map_at) +export(map_chr) +export(map_dbl) +export(map_depth) +export(map_df) +export(map_dfc) +export(map_dfr) +export(map_if) +export(map_int) +export(map_lgl) +export(map_raw) +export(map_vec) +export(modify) +export(modify2) +export(modify_at) +export(modify_depth) +export(modify_if) +export(modify_in) +export(modify_tree) +export(negate) +export(none) +export(partial) +export(pluck) +export(pluck_depth) +export(pluck_exists) +export(pmap) +export(pmap_chr) +export(pmap_dbl) +export(pmap_df) +export(pmap_dfc) +export(pmap_dfr) +export(pmap_int) +export(pmap_lgl) +export(pmap_raw) +export(pmap_vec) +export(possibly) +export(prepend) +export(pwalk) +export(quietly) +export(rate_backoff) +export(rate_delay) +export(rate_reset) +export(rate_sleep) +export(rbernoulli) +export(rdunif) +export(reduce) +export(reduce2) +export(reduce2_right) +export(reduce_right) +export(rep_along) +export(rerun) +export(safely) +export(set_names) +export(simplify) +export(simplify_all) +export(slowly) +export(some) +export(splice) +export(tail_while) +export(transpose) +export(update_list) +export(vec_depth) +export(walk) +export(walk2) +export(when) +export(zap) +import(rlang) +import(vctrs) +importFrom(cli,cli_progress_bar) +importFrom(lifecycle,deprecated) +importFrom(magrittr,"%>%") +importFrom(rlang,"%||%") +importFrom(rlang,done) +importFrom(rlang,exec) +importFrom(rlang,is_atomic) +importFrom(rlang,is_bare_atomic) +importFrom(rlang,is_bare_character) +importFrom(rlang,is_bare_double) +importFrom(rlang,is_bare_integer) +importFrom(rlang,is_bare_list) +importFrom(rlang,is_bare_logical) +importFrom(rlang,is_bare_numeric) +importFrom(rlang,is_bare_vector) +importFrom(rlang,is_character) +importFrom(rlang,is_double) +importFrom(rlang,is_empty) +importFrom(rlang,is_formula) +importFrom(rlang,is_function) +importFrom(rlang,is_integer) +importFrom(rlang,is_list) +importFrom(rlang,is_logical) +importFrom(rlang,is_null) +importFrom(rlang,is_scalar_atomic) +importFrom(rlang,is_scalar_character) +importFrom(rlang,is_scalar_double) +importFrom(rlang,is_scalar_integer) +importFrom(rlang,is_scalar_list) +importFrom(rlang,is_scalar_logical) +importFrom(rlang,is_scalar_vector) +importFrom(rlang,is_vector) +importFrom(rlang,rep_along) +importFrom(rlang,set_names) +importFrom(rlang,zap) +useDynLib(purrr, .registration = TRUE) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/NEWS.md new file mode 100644 index 00000000..53d22d29 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/NEWS.md @@ -0,0 +1,1031 @@ +# purrr 1.0.4 + +# purrr 1.0.3 + +* Varies fixed to bring purrr back into compliance with R CMD check (@shikokuchuo, @jayhesselberth). + +* Added missing `imap_vec()` (#1084) + +* `list_transpose()` now asserts that it does not work on data frames + (@KimLopezGuell, #1141, #1149), and inspects all elements to determine + the correct template if not provided by the user (#1128, @krlmlr). + +# purrr 1.0.2 + +* Fixed valgrind issue. + +* Deprecation infrastructure in `map_chr()` now has much less overhead + leading to improved performance (#1089). + +* purrr now requires R 3.5.0. + +# purrr 1.0.1 + +* As of purrr 1.0.0, the `map()` family of functions wraps all errors generated + by `.f` inside an wrapper error that tracks the iteration index. As of purrr + 1.0.1, this error now has a custom class (`purrr_error_indexed`), + `location` and `name` fields, and is documented in `?purrr_error_indexed` + (#1027). + +* `map()` errors with named inputs also report the name of the element that + errored. + +* Fixed an issue where progress bars weren't being closed when user interrupts + or errors were encountered during a `map()` call (#1024). + +* Fixed an invalid C signature for `pluck()` (#1018). + +* Set `Biarch: true` to build purrr on 32-bit Windows on R < 4.2.0 (#1017). + +# purrr 1.0.0 + +## Breaking changes + +### Core purpose refinements + +* `cross()` and all its variants have been deprecated in favour of + `tidyr::expand_grid()`. These functions were slow and buggy and we + no longer think they are the right approach to solving this problem. + See #768 for more information. + +* `update_list()` (#858) and `rerun()` (#877), and the use of tidyselect + with `map_at()` and friends (#874) have been deprecated. These functions + use some form of non-standard evaluation which we now believe is a poor + fit for purrr. + +* The `lift_*` family of functions has been deprecated. We no longer believe + these to be a good fit for purrr because they rely on a style of function + manipulation that is very uncommon in R code (#871). + +* `prepend()`, `rdunif()`, `rbernoulli()`, `when()`, and `list_along()` have + all been deprecated (#925). It's now clear that they don't align with the + core purpose of purrr. + +* `splice()` is deprecated because we no longer believe that automatic + splicing makes for good UI. Instead use `list2()` + `!!!` or + `list_flatten()` (#869). + +### Mapping + +* Use of map functions with expressions, calls, and pairlists has been + deprecated (#961). + +* All map `_raw()` variants have been deprecated because they are of limited + use and you can now use `map_vec()` instead (#903). + +* In `map_chr()`, automatic conversion from logical, integer, and double to + character is now deprecated. Use an explicit `as.character()` if needed + (#904). + +* Errors from `.f` are now wrapped in an additional class that gives + information about where the error occurred (#945). + +### Deprecation next steps + +* `as_function()` and the `...f` argument to `partial()` are no longer + supported. They have been defunct for quite some time. + +* Soft deprecated functions: `%@%`, `reduce_right()`, `reduce2_right()`, + `accumulate_right()` are now fully deprecated. Similarly, the + `.lazy`, `.env`, and `.first` arguments to `partial()`, + and the `.right` argument to `detect()` and `detect_index()` + are fully deprecated. Removing elements with `NULL` in `list_modify()` and + `list_merge()` is now fully deprecated. + +* `is_numeric()` and `is_scalar_numeric()` have been removed. They have + been deprecated since purrr 0.2.3 (Sep 2017). + +* `invoke_*()` is now deprecated. It was superseded in 0.3.0 (Jan 2019) and + 3.5 years later, we have decided to deprecate it as part of the API + refinement in the 1.0.0 release. + +* `map_call()` has been removed. It was made defunct in 0.3.0 (Jan 2019). + +## New features + +* `*_at()` can now take a function (or formula) that's passed the vector of + element names and returns the elements to select. + +* New `map_vec()`, `map2_vec()`, and `pmap_vec()` work on all types of vectors, + extending `map_lgl()`, `map_int()`, and friends so that you can easily work + with dates, factors, date-times and more (#435). + +* New `keep_at()` and `discard_at()` that work like `keep()` and `discard()` + but operation on element names rather than element contents (#817). + +* Some mapping functions have now a `.progress` argument to create a + progress bar. See `?progress_bars` (#149). + +* purrr is now licensed as MIT (#805). + +* `modify()`, `modify_if()`, `modify_at()`, and `modify2()` are no longer + generics. We have discovered a simple implementation that no longer requires + genericity and methods were only provided by a very small number of packages + (#894). + +* purrr now uses the base pipe (`|>`) and anonymous function short hand (`\(x)`), + in all examples. This means that examples will no longer work in R 4.0 and + earlier so in those versions of R, the examples are automatically converted + to a regular section with a note that they might not work (#936). + +* When map functions fail, they now report the element they failed at (#945). + +* New `modify_tree()` for recursively modifying nested data structures (#720). + +### Flattening and simplification + +* New `list_c()`, `list_rbind()`, and `list_cbind()` make it easy to + `c()`, `rbind()`, or `cbind()` all of the elements in a list. + +* New `list_simplify()` reduces a list of length-1 vectors to a simpler atomic + or S3 vector (#900). + +* New `list_transpose()` which automatically simplifies if possible (#875). + +* `accumulate()` and `accumulate2()` now both simplify the output if possible + using vctrs. New arguments `simplify` and `ptype` allow you to control the + details of simplification (#774, #809). + +* `flatten()` and friends are superseded in favour of `list_flatten()`, + `list_c()`, `list_cbind()`, and `list_rbind()`. + +* `*_dfc()` and `*_dfr()` have been superseded in favour of using the + appropriate map function along with `list_rbind()` or `list_cbind()` (#912). + +* `simplify()`, `simplify_all()`, and `as_vector()` have been superseded in + favour of `list_simplify()`. It provides a more consistent definition of + simplification (#900). + +* `transpose()` has been superseded in favour of `list_transpose()` (#875). + It has built-in simplification. + +### Tidyverse consistency + +* `_lgl()`, `_int()`, `_int()`, and `_dbl()` now use the same (strict) coercion + methods as vctrs (#904). This means that: + + * `map_chr(TRUE, identity)`, `map_chr(0L, identity)`, and + `map_chr(1L, identity)` are deprecated because we now believe that + converting a logical/integer/double to a character vector should require + an explicit coercion. + + * `map_int(1.5, identity)` now fails because we believe that silently + truncating doubles to integers is dangerous. But note that + `map_int(1, identity)` still works since no numeric precision is lost. + + * `map_int(c(TRUE, FALSE), identity)`, `map_dbl(c(TRUE, FALSE), identity)`, + `map_lgl(c(1L, 0L), identity)` and `map_lgl(c(1, 0), identity)` now + succeed because 1/TRUE and 0/FALSE should be interchangeable. + +* `map2()`, `modify2()`, and `pmap()` now use tidyverse recycling rules where + vectors of length 1 are recycled to any size but all others must have + the same length (#878). + +* `map2()` and `pmap()` now recycle names of their first input if + needed (#783). + +* `modify()`, `modify_if()`, and `modify_at()` have been reimplemented using + vctrs principles. This shouldn't have an user facing impact, but it does + make the implementation much simpler. + +### Plucking + +* `vec_depth()` is now `pluck_depth()` and works with more types of input + (#818). + +* `pluck()` now requires indices to be length 1 (#813). It also now reports + the correct type if you supply an unexpected index. + +* `pluck()` now accepts negative integers, indexing from the right (#603). + +* `pluck()` and `chuck()` now fail if you provide named inputs to ... (#788). + +* `pluck()` no longer replaces 0-length vectors with `default`; it now + only applies absent and `NULL` components (#480). + +* `pluck<-`/`assign_in()` can now modify non-existing locations (#704). + +### Setting with NULL + +* `pluck<-`/`assign_in()` now sets elements to `NULL` rather than removing them + (#636). Now use the explicit `zap()` if you want to remove elements. + +* `modify()`, `modify2()`, and `modify_if()` now correctly handle `NULL`s + in replacement values (#655, #746, #753). + +* `list_modify()`'s interface has been standardised. Modifying with `NULL` + now always creates a `NULL` in the output (#810) + +### `list_` functions + +* New `list_assign()` which is similar to `list_modify()` but doesn't work + recursively (#822). + +* `list_modify()` no longer recurses into data frames (and other objects built + on top of lists that are fundamentally non-list like) (#810). You can + revert to the previous behaviour by setting `.is_node = is.list`. + +## Minor improvements and bug fixes + +* `capture_output()` correctly uses `conditionMessage()` instead of directly + interrogating the `message` field (#1010). + +* `modify()` no longer works with calls or pairlists. + +* `modify_depth()` is no longer a generic. This makes it more consistent + with `map_depth()`. + +* `map_depth()` and `modify_depth()` have a new `is_node` argument that + allows you to control what counts as a level. The default uses + `vec_is_list()` to avoid recursing into rich S3 objects like linear models + or data.frames (#958, #920). + +* `map_depth()` and `modify_depth()` now correctly recurse at depth 1. + +* `as_mapper()` is now around twice as fast when used with character, + integer, or list (#820). + +* `possibly()` now defaults `otherwise` to NULL. + +* `modify_if(.else)` is now actually evaluated for atomic vectors (@mgirlich, + #701). + +* `lmap_if()` correctly handles `.else` functions (#847). + +* `every()` now correctly propagates missing values using the same + rules as `&&` (#751). Internally, it has become a wrapper around + `&&`. This makes it consistent with `&&` and also with `some()` + which has always been a wrapper around `||` with the same + propagation rules. + +* `every()` and `some()` now properly check the return value of their + predicate function. It must now return a `TRUE`, `FALSE`, or `NA`. + +* Greatly improved performance of functions created with `partial()` (#715). + Their invocation is now as fast as for functions creating manually. + +* `partial()` no longer inlines the function in the call stack. This + fixes issues when `partial()` is used with `lm()` for instance (#707). + + +# purrr 0.3.5 + +* Fixes for CRAN checks. + + +# purrr 0.3.4 + +* Fixed issue in `list_modify()` that prevented lists from being + removed with `zap()` (@adamroyjones, #777). + +* Added documentation for exporting functions created with purrr + adverb (@njtierney, #668). See `?faq-adverbs-export`. + +* Added `none()`, which tests that a predicate is false for all elements + (the opposite of `every()`) (@AliciaSchep, #735). + + +# purrr 0.3.3 + +* Maintenance release. + +* The documentation of `map()` and its variants has been improved by + @surdina as part of the Tidyverse Developer Day (@surdina, #671). + +* purrr now depends on R 3.2 or greater. + + +# purrr 0.3.2 + +* Fix protection issues reported by rchk. + + +# purrr 0.3.1 + +* `reduce()` now forces arguments (#643). + +* Fixed an issue in `partial()` with generic functions (#647). + +* `negate()` now works with generic functions and functions with early + returns. + +* `compose()` now works with generic functions again (#629, #639). Its + set of unit tests was expanded to cover many edge cases. + +* `prepend()` now works with empty lists (@czeildi, #637) + + +# purrr 0.3.0 + +## Breaking changes + +* `modify()` and variants are now wrapping `[[<-` instead of + `[<-`. This change increases the genericity of these functions but + might cause different behaviour in some cases. + + For instance, the `[[<-` for data frames is stricter than the `[<-` + method and might throw errors instead of warnings. This is the case + when assigning a longer vector than the number of rows. `[<-` + truncates the vector with a warning, `[[<-` fails with an error (as + is appropriate). + +* `modify()` and variants now return the same type as the input when + the input is an atomic vector. + +* All functionals taking predicate functions (like `keep()`, + `detect()`, `some()`) got stricter. Predicate functions must now + return a single `TRUE` or `FALSE`. + + This change is meant to detect problems early with a more meaningful + error message. + + +## Plucking + +* New `chuck()` function. This is a strict variant of `pluck()` that + throws errors when an element does not exist instead of returning + `NULL` (@daniel-barnett, #482). + +* New `assign_in()` and `pluck<-` functions. They modify a data + structure at an existing pluck location. + +* New `modify_in()` function to map a function at a pluck location. + +* `pluck()` now dispatches properly with S3 vectors. The vector class + must implement a `length()` method for numeric indexing and a + `names()` method for string indexing. + +* `pluck()` now supports primitive functions (#404). + + +## Mapping + +* New `.else` argument for `map_if()` and `modify_if()`. They take an + alternative function that is mapped over elements of the input for + which the predicate function returns `FALSE` (#324). + +* `reduce()`, `reduce2()`, `accumulate()`, and `accumulate2()` now + terminate early when the function returns a value wrapped with + `done()` (#253). When an empty `done()` is returned, the + value at the last iteration is returned instead. + +* Functions taking predicates (`map_if()`, `keep()`, `some()`, + `every()`, `keep()`, etc) now fail with an informative message when + the return value is not `TRUE` or `FALSE` (#470). + + This is a breaking change for `every()` and `some()` which were + documented to be more liberal in the values they accepted as logical + (any vector was considered `TRUE` if not a single `FALSE` value, no + matter its length). These functions signal soft-deprecation warnings + instead of a hard failure. + + Edit (purr 0.4.0): `every()` and `some()` never issued deprecation + warnings because of a technical issue. We didn't fix the warnings in + the end, and using predicates returning `NA` is no longer considered + deprecated. If you need to use `every()` and `some()` in contexts + where `NA` propagation is unsafe, e.g. in `if ()` conditions, make + sure to use safe predicate functions like `is_true()`. + +* `modify()` and variants are now implemented using `length()`, `[[`, + and `[[<-` methods. This implementation should be compatible with + most vector classes. + +* New `modify2()` and `imodify()` functions. These work like `map()` + and `imap()` but preserve the type of `.x` in the return value. + +* `pmap()` and `pwalk()` now preserve class for inputs of `factor`, + `Date`, `POSIXct` and other atomic S3 classes with an appropriate + `[[` method (#358, @mikmart). + +* `modify()`, `modify_if()` and `modify_at()` now preserve the class of atomic + vectors instead of promoting them to lists. New S3 methods are provided for + character, logical, double, and integer classes (@t-kalinowski, #417). + +* By popular request, `at_depth()` has been brought back as + `map_depth()`. Like `modify_depth()`, it applies a function at a + specified level of a data structure. However, it transforms all + traversed vectors up to `.depth` to bare lists (#381). + +* `map_at()`, `modify_at()` and `lmap_at()` accept negative values for + `.at`, ignoring elements at those positions. + +* `map()` and `modify()` now work with calls and pairlists (#412). + +* `modify_depth()` now modifies atomic leaves as well. This makes + `modify_depth(x, 1, fn)` equivalent to `modify(x, fn)` (#359). + +* New `accumulate2()` function which is to `accumulate()` what + `reduce2()` is to `reduce()`. + + +## Rates + +* New `rate_backoff()` and `rate_delay()` functions to create rate + objects. You can pass rates to `insistently()`, `slowly()`, or the + lower level function `rate_sleep()`. This will cause a function to + wait for a given amount of time with exponential backoff + (increasingly larger waiting times) or for a constant delay. + +* `insistently(f)` modifies a function, `f`, so that it is repeatedly + called until it succeeds (@richierocks, @ijlyttle). + + `slowly()` modifies a function so that it waits for a given amount + of time between calls. + + +## `partial()` + +The interface of `partial()` has been simplified. It now supports +quasiquotation to control the timing of evaluation, and the +`rlang::call_modify()` syntax to control the position of partialised +arguments. + +* `partial()` now supports empty `... = ` argument to specify the + position of future arguments, relative to partialised ones. This + syntax is borrowed from (and implemented with) `rlang::call_modify()`. + + To prevent partial matching of `...` on `...f`, the latter has been + renamed to `.f`, which is more consistent with other purrr function + signatures. + +* `partial()` now supports quasiquotation. When you unquote an + argument, it is evaluated only once at function creation time. This + is more flexible than the `.lazy` argument since you can control the + timing of evaluation for each argument. Consequently, `.lazy` is + soft-deprecated (#457). + +* Fixed an infinite loop when partialised function is given the same + name as the original function (#387). + +* `partial()` now calls `as_closure()` on primitive functions to + ensure argument matching (#360). + +* The `.lazy` argument of `partial()` is soft-deprecated in favour of + quasiquotation: + + ```r + # Before + partial(fn, u = runif(1), n = rnorm(1), .lazy = FALSE) + + # After + partial(fn, u = !!runif(1), n = !!rnorm(1)) # All constant + partial(fn, u = !!runif(1), n = rnorm(1)) # First constant + ``` + + +## Minor improvements and fixes + +* The tibble package is now in Suggests rather than Imports. This + brings the hard dependency of purrr to just rlang and magrittr. + +* `compose()` now returns an identity function when called without + inputs. + +* Functions created with `compose()` now have the same formal + parameters as the first function to be called. They also feature a + more informative print method that prints all composed functions in + turn (@egnha, #366). + +* New `.dir` argument in `compose()`. When set to `"forward"`, the + functions are composed from left to right rather than right to left. + +* `list_modify()` now supports the `zap()` sentinel (reexported from + rlang) to remove elements from lists. Consequently, removing + elements with the ambiguous sentinel `NULL` is soft-deprecated. + +* The requirements of `list_modify()` and `list_merge()` have been + relaxed. Previously it required both the modified lists and the + inputs to be either named or unnamed. This restriction now only + applies to inputs in `...`. When inputs are all named, they are + matched to the list by name. When they are all unnamed, they are + matched positionally. Otherwise, this is an error. + +* Fixed ordering of names returned by `accumulate_right()` + output. They now correspond to the order of inputs. + +* Fixed names of `accumulate()` output when `.init` is supplied. + +* `compose()` now supports composition with lambdas (@ColinFay, #556) + +* Fixed a `pmap()` crash with empty lists on the Win32 platform (#565). + +* `modify_depth` now has `.ragged` argument evaluates correctly to + `TRUE` by default when `.depth < 0` (@cderv, #530). + +* `accumulate()` now inherits names from their first input (@AshesITR, #446). + +* `attr_getter()` no longer uses partial matching. For example, if an + `x` object has a `labels` attribute but no `label` attribute, + `attr_getter("label")(x)` will no longer extract the `labels` + attribute (#460, @huftis). + +* `flatten_dfr()` and `flatten_dfc()` now aborts if dplyr is not installed. (#454) + +* `imap_dfr()` now works with `.id` argument is provided (#429) + +* `list_modify()`, `update_list()` and `list_merge()` now handle duplicate + duplicate argument names correctly (#441, @mgirlich). + +* `map_raw`, `imap_raw`, `flatten_raw`, `invoke_map_raw`, `map2_raw` and `pmap_raw` + added to support raw vectors. (#455, @romainfrancois) + +* `flatten()` now supports raw and complex elements. + +* `array_branch()` and `array_tree()` now retain the `dimnames()` of the input + array (#584, @flying-sheep) + +* `pluck()` no longer flattens lists of arguments. You can still do it + manually with `!!!`. This change is for consistency with other + dots-collecting functions of the tidyverse. + +* `map_at()`, `lmap_at()` and `modify_at()` now supports selection + using `vars()` and `tidyselect` (@ColinFay, #608). + + Note that for now you need to import `vars()` from dplyr or call it + qualified like `dplyr::vars()`. It will be reexported from rlang in + a future release. + +* `detect()` now has a .default argument to specify the value returned when + nothing is detected (#622, @ColinFay). + + +## Life cycle + +### `.dir` arguments + +We have standardised the purrr API for reverse iteration with a common +`.dir` argument. + +* `reduce_right()` is soft-deprecated and replaced by a new `.dir` + argument of `reduce()`: + + ```{r} + # Before: + reduce_right(1:3, f) + + # After: + reduce(1:3, f, .dir = "backward") + ``` + + Note that the details of the computation have changed. Whereas + `reduce_right()` computed `f(f(3, 2), 1)`, it now computes `f(1, + f(2, 3))`. This is the standard way of reducing from the right. + + To produce the exact same reduction as `reduce_right()`, simply + reverse your vector and use a left reduction: + + ```{r} + # Before: + reduce_right(1:3, f) + + # After: + reduce(rev(1:3), f) + ``` + +* `reduce2_right()` is soft-deprecated without replacement. It is not + clear what algorithmic properties should a right reduction have in + this case. Please reach out if you know about a use case for a right + reduction with a ternary function. + +* `accumulate_right()` is soft-deprecated and replaced by the new + `.dir` argument of `accumulate()`. Note that the algorithm has + slightly changed: the accumulated value is passed to the right + rather than the left, which is consistent with a right reduction. + + ```{r} + # Before: + accumulate_right(1:3, f) + + # After: + accumulate(1:3, f, .dir = "backward") + ``` + +* The `.right` argument of `detect()` and `detect_index()` is + soft-deprecated and renamed to `.dir` for consistency with other + functions and clarity of the interface. + + ```{r} + # Before + detect(x, f, .right = TRUE) + + # After + detect(x, f, .dir = "backward") + ``` + + +### Simplification of `partial()` + +The interface of `partial()` has been simplified (see more about +`partial()` below): + +* The `.lazy` argument of `partial()` is soft-deprecated in favour of + quasiquotation. + +* We had to rename `...f` to `.f` in `partial()` in order to support + `... = ` argument (which would otherwise partial-match on + `...f`). This also makes `partial()` more consistent with other + purrr function signatures. + + +### Retirement of `invoke()` + +`invoke()` and `invoke_map()` are retired in favour of `exec()`. Note +that retired functions are no longer under active development, but +continue to be maintained undefinitely in the package. + +* `invoke()` is retired in favour of the `exec()` function, reexported + from rlang. `exec()` evaluates a function call built from its inputs + and supports tidy dots: + + ```r + # Before: + invoke(mean, list(na.rm = TRUE), x = 1:10) + + # After + exec(mean, 1:10, !!!list(na.rm = TRUE)) + ``` + + Note that retired functions are not removed from the package and + will be maintained undefinitely. + +* `invoke_map()` is retired without replacement because it is more + complex to understand than the corresponding code using `map()`, + `map2()` and `exec()`: + + ```r + # Before: + invoke_map(fns, list(args)) + invoke_map(fns, list(args1, args2)) + + # After: + map(fns, exec, !!!args) + map2(fns, list(args1, args2), function(fn, args) exec(fn, !!!args)) + ``` + + +### Other lifecycle changes + +* `%@%` is soft-deprecated, please use the operator exported in rlang + instead. The latter features an interface more consistent with `@` + as it uses NSE, supports S4 fields, and has an assignment variant. + +* Removing elements from lists using `NULL` in `list_modify()` is + soft-deprecated. Please use the new `zap()` sentinel reexported from + rlang instead: + + ```{r} + # Before: + list_modify(x, foo = NULL) + + # After: + list_modify(x, foo = zap()) + ``` + + This change is motivated by the ambiguity of `NULL` as a deletion + sentinel because `NULL` is also a valid value in lists. In the + future, `NULL` will set an element to `NULL` rather than removing + the element. + +* `rerun()` is now in the questioning stage because we are no longer + convinced NSE functions are a good fit for purrr. Also, `rerun(n, + x)` can just as easily be expressed as `map(1:n, ~ x)` (with the + added benefit of being passed the current index as argument to the + lambda). + +* `map_call()` is defunct. + + + +# purrr 0.2.5 + +* This is a maintenance release following the release of dplyr 0.7.5. + +# purrr 0.2.4 + +* Fixes for R 3.1. + +# purrr 0.2.3 + +## Breaking changes + +We noticed the following issues during reverse dependencies checks: + +* If `reduce()` fails with this message: ``Error: `.x` is empty, and + no `.init` supplied``, this is because `reduce()` now returns + `.init` when `.x` is empty. Fix the problem by supplying an + appropriate argument to `.init`, or by providing special behaviour + when `.x` has length 0. + +* The type predicates have been migrated to rlang. Consequently the + `bare-type-predicates` documentation topic is no longer in purrr, + which might cause a warning if you cross-reference it. + + +## Dependencies + +purrr no longer depends on lazyeval or Rcpp (or dplyr, as of the +previous version). This makes the dependency graph of the tidyverse +simpler, and makes purrr more suitable as a dependency of lower-level +packages. + +There have also been two changes to eliminate name conflicts between +purrr and dplyr: + +* `order_by()`, `sort_by()` and `split_by()` have been removed. `order_by()` + conflicted with `dplyr::order_by()` and the complete family doesn't feel that + useful. Use tibbles instead (#217). + +* `contains()` has been renamed to `has_element()` to avoid conflicts with + dplyr (#217). + + +## pluck() + +The plucking mechanism used for indexing into data structures with +`map()` has been extracted into the function `pluck()`. Plucking is +often more readable to extract an element buried in a deep data +structure. Compare this syntax-heavy extraction which reads +non-linearly: + +``` +accessor(x[[1]])$foo +``` + +to the equivalent pluck: + +``` +x |> pluck(1, accessor, "foo") +``` + + +## Map helpers + +* `as_function()` is now `as_mapper()` because it is a tranformation that + makes sense primarily for mapping functions, not in general (#298). + `.null` has been renamed to `.default` to better reflect its intent (#298). + `.default` is returned whenever an element is absent or empty (#231, #254). + + `as_mapper()` sanitises primitive functions by transforming them to + closures with standardised argument names (using `rlang::as_closure()`). + For instance `+` is transformed to `function(.x, .y) .x + .y`. This + results in proper argument matching so that `map(1:10, partial(`-`, + .x = 5))` produces `list(5 - 1, 5 - 2, ...)`. + +* Recursive indexing can now extract objects out of environments (#213) and + S4 objects (#200), as well as lists. + +* `attr_getter()` makes it possible to extract from attributes + like `map(list(iris, mtcars), attr_getter("row.names"))`. + +* The argument list for formula-functions has been tweaked so that you can + refer to arguments by position with `..1`, `..2`, and so on. This makes it + possible to use the formula shorthand for functions with more than two + arguments (#289). + +* `possibly()`, `safely()` and friends no longer capture interrupts: this + means that you can now terminate a mapper using one of these with + Escape or Ctrl + C (#314) + + +## Map functions + +* All map functions now treat `NULL` the same way as an empty vector (#199), + and return an empty vector if any input is an empty vector. + +* All `map()` functions now force their arguments in the same way that base R + does for `lapply()` (#191). This makes `map()` etc easier to use when + generating functions. + +* A new family of "indexed" map functions, `imap()`, `imap_lgl()` etc, + provide a short-hand for `map2(x, names(x))` or `map2(x, seq_along(x))` + (#240). + +* The data frame suffix `_df` has been (soft) deprecated in favour of + `_dfr` to more clearly indicate that it's a row-bind. All variants now + also have a `_dfc` for column binding (#167). (These will not be terribly + useful until `dplyr::bind_rows()`/`dplyr::bind_cols()` have better + semantics for vectors.) + + +## Modify functions + +A new `modify()` family returns the same output of the type as the +input `.x`. This is in contrast to the `map()` family which always +returns a list, regardless of the input type. + +The modify functions are S3 generics. However their default methods +should be sufficient for most classes since they rely on the semantics +of `[<-`. `modify.default()` is thus a shorthand for `x[] <- map(x, f)`. + +* `at_depth()` has been renamed to `modify_depth()`. + +* `modify_depth()` gains new `.ragged` argument, and negative depths are + now computed relative to the deepest component of the list (#236). + + +## New functions + +* `auto_browse(f)` returns a new function that automatically calls `browser()` + if `f` throws an error (#281). + +* `vec_depth()` computes the depth (i.e. the number of levels of indexing) + or a vector (#243). + +* `reduce2()` and `reduce2_right()` make it possible to reduce with a + 3 argument function where the first argument is the accumulated value, the + second argument is `.x`, and the third argument is `.y` (#163). + +* `list_modify()` extends `stats::modifyList()` to replace by position + if the list is not named.(#201). `list_merge()` operates similarly + to `list_modify()` but combines instead of replacing (#322). + +* The legacy function `update_list()` is basically a version of + `list_modify` that evaluates formulas within the list. It is likely + to be deprecated in the future in favour of a tidyeval interface + such as a list method for `dplyr::mutate()`. + + +## Minor improvements and bug fixes + +* Thanks to @dchiu911, the unit test coverage of purrr is now much greater. + +* All predicate functions are re-exported from rlang (#124). + +* `compact()` now works with standard mapper conventions (#282). + +* `cross_n()` has been renamed to `cross()`. The `_n` suffix was + removed for consistency with `pmap()` (originally called `map_n()` + at the start of the project) and `transpose()` (originally called + `zip_n()`). Similarly, `cross_d()` has been renamed to `cross_df()` + for consistency with `map_df()`. + +* `every()` and `some()` now return `NA` if present in the input (#174). + +* `invoke()` uses a more robust approach to generate the argument list (#249) + It no longer uses lazyeval to figure out which enviroment a character `f` + comes from. + +* `is_numeric()` and `is_scalar_numeric()` are deprecated because they + don't test for what you might expect at first sight. + +* `reduce()` now throws an error if `.x` is empty and `.init` is not + supplied. + +* Deprecated functions `flatmap()`, `map3()`, `map_n()`, `walk3()`, + `walk_n()`, `zip2()`, `zip3()`, `zip_n()` have been removed. + +* `pmap()` coerces data frames to lists to avoid the expensive `[.data.frame` + which provides security that is unneeded here (#220). + +* `rdunif()` checks its inputs for validity (#211). + +* `set_names()` can now take a function to tranform the names programmatically + (#276), and you can supply names in `...` to reduce typing even more + more (#316). `set_names()` is now powered by `rlang::set_names()`. + +* `safely()` now actually uses the `quiet` argument (#296). + +* `transpose()` now matches by name if available (#164). You can + override the default choice with the new `.names` argument. + +* The function argument of `detect()` and `detect_index()` have been + renamed from `.p` to `.f`. This is because they have mapper + semantics rather than predicate semantics. + + +# purrr 0.2.2.1 + +This is a compatibility release with dplyr 0.6.0. + +* All data-frame based mappers have been removed in favour of new + functions and idioms in the tidyverse. `dmap()`, `dmap_at()`, + `dmap_if()`, `invoke_rows()`, `slice_rows()`, `map_rows()`, + `by_slice()`, `by_row()`, and `unslice()` have been moved to + purrrlyr. This is a bit of an aggresive change but it allows us to + make the dependencies much lighter. + + +# purrr 0.2.2 + +* Fix for dev tibble support. + +* `as_function()` now supports list arguments which allow recursive indexing + using either names or positions. They now always stop when encountering + the first NULL (#173). + +* `accumulate` and `reduce` correctly pass extra arguments to the + worker function. + + +# purrr 0.2.1 + +* `as_function()` gains a `.null` argument that for character and numeric + values allows you to specify what to return for null/absent elements (#110). + This can be used with any map function, e.g. `map_int(x, 1, .null = NA)` + +* `as_function()` is now generic. + +* New `is_function()` that returns `TRUE` only for regular functions. + +* Fix crash on GCC triggered by `invoke_rows()`. + + +# purrr 0.2.0 + +## New functions + +* There are two handy infix functions: + + * `x %||% y` is shorthand for `if (is.null(x)) y else x` (#109). + * `x %@% "a"` is shorthand for `attr(x, "a", exact = TRUE)` (#69). + +* `accumulate()` has been added to handle recursive folding. It is shortand + for `Reduce(f, .x, accumulate = TRUE)` and follows a similar syntax to + `reduce()` (#145). A right-hand version `accumulate_right()` was also added. + +* `map_df()` row-binds output together. It's the equivalent of `plyr::ldply()` + (#127) + +* `flatten()` is now type-stable and always returns a list. To return a simpler + vector, use `flatten_lgl()`, `flatten_int()`, `flatten_dbl()`, + `flatten_chr()`, or `flatten_df()`. + +* `invoke()` has been overhauled to be more useful: it now works similarly + to `map_call()` when `.x` is NULL, and hence `map_call()` has been + deprecated. `invoke_map()` is a vectorised complement to `invoke()` (#125), + and comes with typed variants `invoke_map_lgl()`, `invoke_map_int()`, + `invoke_map_dbl()`, `invoke_map_chr()`, and `invoke_map_df()`. + +* `transpose()` replaces `zip2()`, `zip3()`, and `zip_n()` (#128). + The name more clearly reflects the intent (transposing the first and second + levels of list). It no longer has fields argument or the `.simplify` argument; + instead use the new `simplify_all()` function. + +* `safely()`, `quietly()`, and `possibly()` are experimental functions + for working with functions with side-effects (e.g. printed output, + messages, warnings, and errors) (#120). `safely()` is a version of `try()` + that modifies a function (rather than an expression), and always returns a + list with two components, `result` and `error`. + +* `list_along()` and `rep_along()` generalise the idea of `seq_along()`. + (#122). + +* `is_null()` is the snake-case version of `is.null()`. + +* `pmap()` (parallel map) replaces `map_n()` (#132), and has typed-variants + suffixed `pmap_lgl()`, `pmap_int()`, `pmap_dbl()`, `pmap_chr()`, and + `pmap_df()`. + +* `set_names()` is a snake-case alternative to `setNames()` with stricter + equality checking, and more convenient defaults for pipes: + `x |> set_names()` is equivalent to `setNames(x, x)` (#119). + + +## Row based functionals + +We are still figuring out what belongs in dplyr and what belongs in +purrr. Expect much experimentation and many changes with these +functions. + +* `map()` now always returns a list. Data frame support has been moved + to `map_df()` and `dmap()`. The latter supports sliced data frames + as a shortcut for the combination of `by_slice()` and `dmap()`: + `x |> by_slice(dmap, fun, .collate = "rows")`. The conditional + variants `dmap_at()` and `dmap_if()` also support sliced data frames + and will recycle scalar results to the slice size. + +* `map_rows()` has been renamed to `invoke_rows()`. As other + rows-based functionals, it collates results inside lists by default, + but with column collation this function is equivalent to + `plyr::mdply()`. + +* The rows-based functionals gain a `.to` option to name the output + column as well as a `.collate` argument. The latter allows to + collate the output in lists (by default), on columns or on + rows. This makes these functions more flexible and more predictable. + +## Bug fixes and minor changes + +* `as_function()`, which converts formulas etc to functions, is now + exported (#123). + +* `rerun()` is correctly scoped (#95) + +* `update_list()` can now modify an element called `x` (#98). + +* `map*()` now use custom C code, rather than relying on `lapply()`, `mapply()` + etc. The performance characteristcs are very similar, but it allows us greater + control over the output (#118). + +* `map_lgl()` now has second argument `.f`, not `.p` (#134). + + +## Deprecated functions + +* `flatmap()` -> use `map()` followed by the appropriate `flatten()`. + +* `map_call()` -> `invoke()`. + +* `map_n()` -> `pmap()`; `walk_n()` -> `pwalk()`. + +* `map3(x, y, z)` -> `map_n(list(x, y, z))`; `walk3(x, y, z) -> `pwalk(list(x, y, z))` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/R/purrr b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/R/purrr new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/R/purrr @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/R/purrr.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/R/purrr.rdb new file mode 100644 index 00000000..d2ad2bae Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/R/purrr.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/R/purrr.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/R/purrr.rdx new file mode 100644 index 00000000..6b09d8c9 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/R/purrr.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/doc/base.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/doc/base.R new file mode 100644 index 00000000..1b2949de --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/doc/base.R @@ -0,0 +1,113 @@ +## ----include = FALSE---------------------------------------------------------- +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>", + fig.width = 7, + fig.height = 4.5, + fig.align = "center" +) +options(tibble.print_min = 6, tibble.print_max = 6) + +modern_r <- getRversion() >= "4.1.0" + +## ----setup-------------------------------------------------------------------- +library(purrr) +library(tibble) + +## ----------------------------------------------------------------------------- +means <- 1:4 + +## ----------------------------------------------------------------------------- +set.seed(2020) +samples <- lapply(means, rnorm, n = 5, sd = 1) +str(samples) + +## ----------------------------------------------------------------------------- +set.seed(2020) +samples <- map(means, rnorm, n = 5, sd = 1) +str(samples) + +## ----------------------------------------------------------------------------- +means <- 1:4 +sds <- 1:4 + +## ----------------------------------------------------------------------------- +set.seed(2020) +samples <- mapply( + rnorm, + mean = means, + sd = sds, + MoreArgs = list(n = 5), + SIMPLIFY = FALSE +) +str(samples) + +## ----------------------------------------------------------------------------- +samples <- Map(function(...) rnorm(..., n = 5), mean = means, sd = sds) + +## ----eval = modern_r---------------------------------------------------------- +samples <- Map(\(...) rnorm(..., n = 5), mean = means, sd = sds) + +## ----------------------------------------------------------------------------- +set.seed(2020) +samples <- map2(means, sds, rnorm, n = 5) +str(samples) + +## ----------------------------------------------------------------------------- +ns <- 4:1 + +## ----------------------------------------------------------------------------- +set.seed(2020) +samples <- Map(rnorm, mean = means, sd = sds, n = ns) +str(samples) + +## ----------------------------------------------------------------------------- +set.seed(2020) +samples <- pmap(list(mean = means, sd = sds, n = ns), rnorm) +str(samples) + +## ----------------------------------------------------------------------------- +# type stable +medians <- vapply(samples, median, FUN.VALUE = numeric(1L)) +medians + +# not type stable +medians <- sapply(samples, median) + +## ----------------------------------------------------------------------------- +medians <- map_dbl(samples, median) +medians + +## ----fig.show='hide'---------------------------------------------------------- +# for loop +for (s in samples) { + hist(s, xlab = "value", main = "") +} + +# lapply +invisible(lapply(samples, function(s) { + hist(s, xlab = "value", main = "") +})) + +## ----fig.show='hide'---------------------------------------------------------- +walk(samples, ~ hist(.x, xlab = "value", main = "")) + +## ----------------------------------------------------------------------------- +set.seed(2020) +means %>% + map(rnorm, n = 5, sd = 1) %>% + map_dbl(median) + +## ----eval = modern_r---------------------------------------------------------- +set.seed(2020) +means |> + lapply(rnorm, n = 5, sd = 1) |> + sapply(median) + +## ----eval = modern_r---------------------------------------------------------- +mtcars |> + split(mtcars$cyl) |> + map(\(df) lm(mpg ~ wt, data = df))|> + map(coef) |> + map_dbl(1) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/doc/base.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/doc/base.Rmd new file mode 100644 index 00000000..9f13787c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/doc/base.Rmd @@ -0,0 +1,289 @@ +--- +title: "purrr <-> base R" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{purrr <-> base R} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>", + fig.width = 7, + fig.height = 4.5, + fig.align = "center" +) +options(tibble.print_min = 6, tibble.print_max = 6) + +modern_r <- getRversion() >= "4.1.0" +``` + +# Introduction + +This vignette compares purrr's functionals to their base R equivalents, focusing primarily on the map family and related functions. +This helps those familiar with base R understand better what purrr does, and shows purrr users how you might express the same ideas in base R code. +We'll start with a rough overview of the major differences, give a rough translation guide, and then show a few examples. + +```{r setup} +library(purrr) +library(tibble) +``` + +## Key differences + +There are two primary differences between the base apply family and the purrr map family: purrr functions are named more consistently, and more fully explore the space of input and output variants. + +- purrr functions consistently use `.` as prefix to avoid [inadvertently matching arguments](https://adv-r.hadley.nz/functionals.html#argument-names) of the purrr function, instead of the function that you're trying to call. + Base functions use a variety of techniques including upper case (e.g. `lapply(X, FUN, ...)`) or require anonymous functions (e.g. `Map()`). + +- All map functions are type stable: you can predict the type of the output using little information about the inputs. + In contrast, the base functions `sapply()` and `mapply()` automatically simplify making the return value hard to predict. + +- The map functions all start with the data, followed by the function, then any additional constant argument. + Most base apply functions also follow this pattern, but `mapply()` starts with the function, and `Map()` has no way to supply additional constant arguments. + +- purrr functions provide all combinations of input and output variants, and include variants specifically for the common two argument case. + +## Direct translations + +The following sections give a high-level translation between base R commands and their purrr equivalents. +See function documentation for the details. + +### `Map` functions + +Here `x` denotes a vector and `f` denotes a function + +| Output | Input | Base R | purrr | +|------------------|------------------|------------------|-------------------| +| List | 1 vector | `lapply()` | `map()` | +| List | 2 vectors | `mapply()`, `Map()` | `map2()` | +| List | \>2 vectors | `mapply()`, `Map()` | `pmap()` | +| Atomic vector of desired type | 1 vector | `vapply()` | `map_lgl()` (logical), `map_int()` (integer), `map_dbl()` (double), `map_chr()` (character), `map_raw()` (raw) | +| Atomic vector of desired type | 2 vectors | `mapply()`, `Map()`, then `is.*()` to check type | `map2_lgl()` (logical), `map2_int()` (integer), `map2_dbl()` (double), `map2_chr()` (character), `map2_raw()` (raw) | +| Atomic vector of desired type | \>2 vectors | `mapply()`, `Map()`, then `is.*()` to check type | `pmap_lgl()` (logical), `pmap_int()` (integer), `pmap_dbl()` (double), `pmap_chr()` (character), `pmap_raw()` (raw) | +| Side effect only | 1 vector | loops | `walk()` | +| Side effect only | 2 vectors | loops | `walk2()` | +| Side effect only | \>2 vectors | loops | `pwalk()` | +| Data frame (`rbind` outputs) | 1 vector | `lapply()` then `rbind()` | `map_dfr()` | +| Data frame (`rbind` outputs) | 2 vectors | `mapply()`/`Map()` then `rbind()` | `map2_dfr()` | +| Data frame (`rbind` outputs) | \>2 vectors | `mapply()`/`Map()` then `rbind()` | `pmap_dfr()` | +| Data frame (`cbind` outputs) | 1 vector | `lapply()` then `cbind()` | `map_dfc()` | +| Data frame (`cbind` outputs) | 2 vectors | `mapply()`/`Map()` then `cbind()` | `map2_dfc()` | +| Data frame (`cbind` outputs) | \>2 vectors | `mapply()`/`Map()` then `cbind()` | `pmap_dfc()` | +| Any | Vector and its names | `l/s/vapply(X, function(x) f(x, names(x)))` or `mapply/Map(f, x, names(x))` | `imap()`, `imap_*()` (`lgl`, `dbl`, `dfr`, and etc. just like for `map()`, `map2()`, and `pmap()`) | +| Any | Selected elements of the vector | `l/s/vapply(X[index], FUN, ...)` | `map_if()`, `map_at()` | +| List | Recursively apply to list within list | `rapply()` | `map_depth()` | +| List | List only | `lapply()` | `lmap()`, `lmap_at()`, `lmap_if()` | + +### Extractor shorthands + +Since a common use case for map functions is list extracting components, purrr provides a handful of shortcut functions for various uses of `[[`. + +| Input | base R | purrr | +|-------------------|--------------------------|---------------------------| +| Extract by name | `` lapply(x, `[[`, "a") `` | `map(x, "a")` | +| Extract by position | `` lapply(x, `[[`, 3) `` | `map(x, 3)` | +| Extract deeply | `lapply(x, \(y) y[[1]][["x"]][[3]])` | `map(x, list(1, "x", 3))` | +| Extract with default value | `lapply(x, function(y) tryCatch(y[[3]], error = function(e) NA))` | `map(x, 3, .default = NA)` | + +### Predicates + +Here `p`, a predicate, denotes a function that returns `TRUE` or `FALSE` indicating whether an object fulfills a criterion, e.g. `is.character()`. + +| Description | base R | purrr | +|-----------------------------|--------------------|-----------------------| +| Find a matching element | `Find(p, x)` | `detect(x, p)`, | +| Find position of matching element | `Position(p, x)` | `detect_index(x, p)` | +| Do all elements of a vector satisfy a predicate? | `all(sapply(x, p))` | `every(x, p)` | +| Does any elements of a vector satisfy a predicate? | `any(sapply(x, p))` | `some(x, p)` | +| Does a list contain an object? | `any(sapply(x, identical, obj))` | `has_element(x, obj)` | +| Keep elements that satisfy a predicate | `x[sapply(x, p)]` | `keep(x, p)` | +| Discard elements that satisfy a predicate | `x[!sapply(x, p)]` | `discard(x, p)` | +| Negate a predicate function | `function(x) !p(x)` | `negate(p)` | + +### Other vector transforms + +| Description | base R | purrr | +|-----------------------------|--------------------|-----------------------| +| Accumulate intermediate results of a vector reduction | `Reduce(f, x, accumulate = TRUE)` | `accumulate(x, f)` | +| Recursively combine two lists | `c(X, Y)`, but more complicated to merge recursively | `list_merge()`, `list_modify()` | +| Reduce a list to a single value by iteratively applying a binary function | `Reduce(f, x)` | `reduce(x, f)` | + +## Examples + +### Varying inputs + +#### One input + +Suppose we would like to generate a list of samples of 5 from normal distributions with different means: + +```{r} +means <- 1:4 +``` + +There's little difference when generating the samples: + +- Base R uses `lapply()`: + + ```{r} + set.seed(2020) + samples <- lapply(means, rnorm, n = 5, sd = 1) + str(samples) + ``` + +- purrr uses `map()`: + + ```{r} + set.seed(2020) + samples <- map(means, rnorm, n = 5, sd = 1) + str(samples) + ``` + +#### Two inputs + +Lets make the example a little more complicated by also varying the standard deviations: + +```{r} +means <- 1:4 +sds <- 1:4 +``` + +- This is relatively tricky in base R because we have to adjust a number of `mapply()`'s defaults. + + ```{r} + set.seed(2020) + samples <- mapply( + rnorm, + mean = means, + sd = sds, + MoreArgs = list(n = 5), + SIMPLIFY = FALSE + ) + str(samples) + ``` + + Alternatively, we could use `Map()` which doesn't simply, but also doesn't take any constant arguments, so we need to use an anonymous function: + + ```{r} + samples <- Map(function(...) rnorm(..., n = 5), mean = means, sd = sds) + ``` + + In R 4.1 and up, you could use the shorter anonymous function form: + + ```{r, eval = modern_r} + samples <- Map(\(...) rnorm(..., n = 5), mean = means, sd = sds) + ``` + +- Working with a pair of vectors is a common situation so purrr provides the `map2()` family of functions: + + ```{r} + set.seed(2020) + samples <- map2(means, sds, rnorm, n = 5) + str(samples) + ``` + +#### Any number of inputs + +We can make the challenge still more complex by also varying the number of samples: + +```{r} +ns <- 4:1 +``` + +- Using base R's `Map()` becomes more straightforward because there are no constant arguments. + + ```{r} + set.seed(2020) + samples <- Map(rnorm, mean = means, sd = sds, n = ns) + str(samples) + ``` + +- In purrr, we need to switch from `map2()` to `pmap()` which takes a list of any number of arguments. + + ```{r} + set.seed(2020) + samples <- pmap(list(mean = means, sd = sds, n = ns), rnorm) + str(samples) + ``` + +### Outputs + +Given the samples, imagine we want to compute their means. +A mean is a single number, so we want the output to be a numeric vector rather than a list. + +- There are two options in base R: `vapply()` or `sapply()`. + `vapply()` requires you to specific the output type (so is relatively verbose), but will always return a numeric vector. + `sapply()` is concise, but if you supply an empty list you'll get a list instead of a numeric vector. + + ```{r} + # type stable + medians <- vapply(samples, median, FUN.VALUE = numeric(1L)) + medians + + # not type stable + medians <- sapply(samples, median) + ``` + +- purrr is little more compact because we can use `map_dbl()`. + + ```{r} + medians <- map_dbl(samples, median) + medians + ``` + +What if we want just the side effect, such as a plot or a file output, but not the returned values? + +- In base R we can either use a for loop or hide the results of `lapply`. + + ```{r, fig.show='hide'} + # for loop + for (s in samples) { + hist(s, xlab = "value", main = "") + } + + # lapply + invisible(lapply(samples, function(s) { + hist(s, xlab = "value", main = "") + })) + ``` + +- In purrr, we can use `walk()`. + + ```{r, fig.show='hide'} + walk(samples, ~ hist(.x, xlab = "value", main = "")) + ``` + +### Pipes + +You can join multiple steps together either using the magrittr pipe: + +```{r} +set.seed(2020) +means %>% + map(rnorm, n = 5, sd = 1) %>% + map_dbl(median) +``` + +Or the base pipe R: + +```{r, eval = modern_r} +set.seed(2020) +means |> + lapply(rnorm, n = 5, sd = 1) |> + sapply(median) +``` + +(And of course you can mix and match the piping style with either base R or purrr.) + +The pipe is particularly compelling when working with longer transformations. +For example, the following code splits `mtcars` up by `cyl`, fits a linear model, extracts the coefficients, and extracts the first one (the intercept). + +```{r, eval = modern_r} +mtcars |> + split(mtcars$cyl) |> + map(\(df) lm(mpg ~ wt, data = df))|> + map(coef) |> + map_dbl(1) +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/doc/base.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/doc/base.html new file mode 100644 index 00000000..2782e0cc --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/doc/base.html @@ -0,0 +1,870 @@ + + + + + + + + + + + + + + +purrr <-> base R + + + + + + + + + + + + + + + + + + + + + + + + + + +

purrr <-> base R

+ + + +
+

Introduction

+

This vignette compares purrr’s functionals to their base R +equivalents, focusing primarily on the map family and related functions. +This helps those familiar with base R understand better what purrr does, +and shows purrr users how you might express the same ideas in base R +code. We’ll start with a rough overview of the major differences, give a +rough translation guide, and then show a few examples.

+
library(purrr)
+library(tibble)
+
+

Key differences

+

There are two primary differences between the base apply family and +the purrr map family: purrr functions are named more consistently, and +more fully explore the space of input and output variants.

+
    +
  • purrr functions consistently use . as prefix to +avoid inadvertently +matching arguments of the purrr function, instead of the function +that you’re trying to call. Base functions use a variety of techniques +including upper case (e.g. lapply(X, FUN, ...)) or require +anonymous functions (e.g. Map()).

  • +
  • All map functions are type stable: you can predict the type of +the output using little information about the inputs. In contrast, the +base functions sapply() and mapply() +automatically simplify making the return value hard to predict.

  • +
  • The map functions all start with the data, followed by the +function, then any additional constant argument. Most base apply +functions also follow this pattern, but mapply() starts +with the function, and Map() has no way to supply +additional constant arguments.

  • +
  • purrr functions provide all combinations of input and output +variants, and include variants specifically for the common two argument +case.

  • +
+
+
+

Direct translations

+

The following sections give a high-level translation between base R +commands and their purrr equivalents. See function documentation for the +details.

+
+

Map functions

+

Here x denotes a vector and f denotes a +function

+ ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OutputInputBase Rpurrr
List1 vectorlapply()map()
List2 vectorsmapply(), Map()map2()
List>2 vectorsmapply(), Map()pmap()
Atomic vector of desired type1 vectorvapply()map_lgl() (logical), map_int() (integer), +map_dbl() (double), map_chr() (character), +map_raw() (raw)
Atomic vector of desired type2 vectorsmapply(), Map(), then is.*() +to check typemap2_lgl() (logical), map2_int() +(integer), map2_dbl() (double), map2_chr() +(character), map2_raw() (raw)
Atomic vector of desired type>2 vectorsmapply(), Map(), then is.*() +to check typepmap_lgl() (logical), pmap_int() +(integer), pmap_dbl() (double), pmap_chr() +(character), pmap_raw() (raw)
Side effect only1 vectorloopswalk()
Side effect only2 vectorsloopswalk2()
Side effect only>2 vectorsloopspwalk()
Data frame (rbind outputs)1 vectorlapply() then rbind()map_dfr()
Data frame (rbind outputs)2 vectorsmapply()/Map() then +rbind()map2_dfr()
Data frame (rbind outputs)>2 vectorsmapply()/Map() then +rbind()pmap_dfr()
Data frame (cbind outputs)1 vectorlapply() then cbind()map_dfc()
Data frame (cbind outputs)2 vectorsmapply()/Map() then +cbind()map2_dfc()
Data frame (cbind outputs)>2 vectorsmapply()/Map() then +cbind()pmap_dfc()
AnyVector and its namesl/s/vapply(X, function(x) f(x, names(x))) or +mapply/Map(f, x, names(x))imap(), imap_*() (lgl, +dbl, dfr, and etc. just like for +map(), map2(), and pmap())
AnySelected elements of the vectorl/s/vapply(X[index], FUN, ...)map_if(), map_at()
ListRecursively apply to list within listrapply()map_depth()
ListList onlylapply()lmap(), lmap_at(), +lmap_if()
+
+
+

Extractor shorthands

+

Since a common use case for map functions is list extracting +components, purrr provides a handful of shortcut functions for various +uses of [[.

+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Inputbase Rpurrr
Extract by namelapply(x, `[[`, "a")map(x, "a")
Extract by positionlapply(x, `[[`, 3)map(x, 3)
Extract deeplylapply(x, \(y) y[[1]][["x"]][[3]])map(x, list(1, "x", 3))
Extract with default valuelapply(x, function(y) tryCatch(y[[3]], error = function(e) NA))map(x, 3, .default = NA)
+
+
+

Predicates

+

Here p, a predicate, denotes a function that returns +TRUE or FALSE indicating whether an object +fulfills a criterion, e.g. is.character().

+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Descriptionbase Rpurrr
Find a matching elementFind(p, x)detect(x, p),
Find position of matching elementPosition(p, x)detect_index(x, p)
Do all elements of a vector satisfy a predicate?all(sapply(x, p))every(x, p)
Does any elements of a vector satisfy a predicate?any(sapply(x, p))some(x, p)
Does a list contain an object?any(sapply(x, identical, obj))has_element(x, obj)
Keep elements that satisfy a predicatex[sapply(x, p)]keep(x, p)
Discard elements that satisfy a predicatex[!sapply(x, p)]discard(x, p)
Negate a predicate functionfunction(x) !p(x)negate(p)
+
+
+

Other vector transforms

+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + +
Descriptionbase Rpurrr
Accumulate intermediate results of a vector reductionReduce(f, x, accumulate = TRUE)accumulate(x, f)
Recursively combine two listsc(X, Y), but more complicated to merge recursivelylist_merge(), list_modify()
Reduce a list to a single value by iteratively applying a binary +functionReduce(f, x)reduce(x, f)
+
+
+
+

Examples

+
+

Varying inputs

+
+

One input

+

Suppose we would like to generate a list of samples of 5 from normal +distributions with different means:

+
means <- 1:4
+

There’s little difference when generating the samples:

+
    +
  • Base R uses lapply():

    +
    set.seed(2020)
    +samples <- lapply(means, rnorm, n = 5, sd = 1)
    +str(samples)
    +#> List of 4
    +#>  $ : num [1:5] 1.377 1.302 -0.098 -0.13 -1.797
    +#>  $ : num [1:5] 2.72 2.94 1.77 3.76 2.12
    +#>  $ : num [1:5] 2.15 3.91 4.2 2.63 2.88
    +#>  $ : num [1:5] 5.8 5.704 0.961 1.711 4.058
  • +
  • purrr uses map():

    +
    set.seed(2020)
    +samples <- map(means, rnorm, n = 5, sd = 1)
    +str(samples)
    +#> List of 4
    +#>  $ : num [1:5] 1.377 1.302 -0.098 -0.13 -1.797
    +#>  $ : num [1:5] 2.72 2.94 1.77 3.76 2.12
    +#>  $ : num [1:5] 2.15 3.91 4.2 2.63 2.88
    +#>  $ : num [1:5] 5.8 5.704 0.961 1.711 4.058
  • +
+
+
+

Two inputs

+

Lets make the example a little more complicated by also varying the +standard deviations:

+
means <- 1:4
+sds <- 1:4
+
    +
  • This is relatively tricky in base R because we have to adjust a +number of mapply()’s defaults.

    +
    set.seed(2020)
    +samples <- mapply(
    +  rnorm, 
    +  mean = means, 
    +  sd = sds, 
    +  MoreArgs = list(n = 5), 
    +  SIMPLIFY = FALSE
    +)
    +str(samples)
    +#> List of 4
    +#>  $ : num [1:5] 1.377 1.302 -0.098 -0.13 -1.797
    +#>  $ : num [1:5] 3.44 3.88 1.54 5.52 2.23
    +#>  $ : num [1:5] 0.441 5.728 6.589 1.885 2.63
    +#>  $ : num [1:5] 11.2 10.82 -8.16 -5.16 4.23
    +

    Alternatively, we could use Map() which doesn’t simply, +but also doesn’t take any constant arguments, so we need to use an +anonymous function:

    +
    samples <- Map(function(...) rnorm(..., n = 5), mean = means, sd = sds)
    +

    In R 4.1 and up, you could use the shorter anonymous function +form:

    +
    samples <- Map(\(...) rnorm(..., n = 5), mean = means, sd = sds)
  • +
  • Working with a pair of vectors is a common situation so purrr +provides the map2() family of functions:

    +
    set.seed(2020)
    +samples <- map2(means, sds, rnorm, n = 5)
    +str(samples)
    +#> List of 4
    +#>  $ : num [1:5] 1.377 1.302 -0.098 -0.13 -1.797
    +#>  $ : num [1:5] 3.44 3.88 1.54 5.52 2.23
    +#>  $ : num [1:5] 0.441 5.728 6.589 1.885 2.63
    +#>  $ : num [1:5] 11.2 10.82 -8.16 -5.16 4.23
  • +
+
+
+

Any number of inputs

+

We can make the challenge still more complex by also varying the +number of samples:

+
ns <- 4:1
+
    +
  • Using base R’s Map() becomes more straightforward +because there are no constant arguments.

    +
    set.seed(2020)
    +samples <- Map(rnorm, mean = means, sd = sds, n = ns)
    +str(samples)
    +#> List of 4
    +#>  $ : num [1:4] 1.377 1.302 -0.098 -0.13
    +#>  $ : num [1:3] -3.59 3.44 3.88
    +#>  $ : num [1:2] 2.31 8.28
    +#>  $ : num 4.47
  • +
  • In purrr, we need to switch from map2() to +pmap() which takes a list of any number of arguments.

    +
    set.seed(2020)
    +samples <- pmap(list(mean = means, sd = sds, n = ns), rnorm)
    +str(samples)
    +#> List of 4
    +#>  $ : num [1:4] 1.377 1.302 -0.098 -0.13
    +#>  $ : num [1:3] -3.59 3.44 3.88
    +#>  $ : num [1:2] 2.31 8.28
    +#>  $ : num 4.47
  • +
+
+
+
+

Outputs

+

Given the samples, imagine we want to compute their means. A mean is +a single number, so we want the output to be a numeric vector rather +than a list.

+
    +
  • There are two options in base R: vapply() or +sapply(). vapply() requires you to specific +the output type (so is relatively verbose), but will always return a +numeric vector. sapply() is concise, but if you supply an +empty list you’ll get a list instead of a numeric vector.

    +
    # type stable
    +medians <- vapply(samples, median, FUN.VALUE = numeric(1L))
    +medians
    +#> [1] 0.6017626 3.4411470 5.2946304 4.4694671
    +
    +# not type stable
    +medians <- sapply(samples, median)
  • +
  • purrr is little more compact because we can use +map_dbl().

    +
    medians <- map_dbl(samples, median)
    +medians
    +#> [1] 0.6017626 3.4411470 5.2946304 4.4694671
  • +
+

What if we want just the side effect, such as a plot or a file +output, but not the returned values?

+
    +
  • In base R we can either use a for loop or hide the results of +lapply.

    +
    # for loop
    +for (s in samples) {
    +  hist(s, xlab = "value", main = "")
    +}
    +
    +# lapply
    +invisible(lapply(samples, function(s) {
    +  hist(s, xlab = "value", main = "")
    +}))
  • +
  • In purrr, we can use walk().

    +
    walk(samples, ~ hist(.x, xlab = "value", main = ""))
  • +
+
+
+

Pipes

+

You can join multiple steps together either using the magrittr +pipe:

+
set.seed(2020)
+means %>%
+  map(rnorm, n = 5, sd = 1) %>%
+  map_dbl(median)
+#> [1] -0.09802317  2.72057350  2.87673977  4.05830349
+

Or the base pipe R:

+
set.seed(2020)
+means |> 
+  lapply(rnorm, n = 5, sd = 1) |> 
+  sapply(median)
+#> [1] -0.09802317  2.72057350  2.87673977  4.05830349
+

(And of course you can mix and match the piping style with either +base R or purrr.)

+

The pipe is particularly compelling when working with longer +transformations. For example, the following code splits +mtcars up by cyl, fits a linear model, +extracts the coefficients, and extracts the first one (the +intercept).

+
mtcars |>
+  split(mtcars$cyl) |> 
+  map(\(df) lm(mpg ~ wt, data = df))|> 
+  map(coef) |> 
+  map_dbl(1)
+#>        4        6        8 
+#> 39.57120 28.40884 23.86803
+
+
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/doc/index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/doc/index.html new file mode 100644 index 00000000..9e0c8486 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/doc/index.html @@ -0,0 +1,34 @@ + + +R: Vignettes and other documentation + + + +
+

Vignettes and other documentation + +

+
+
+[Top] +
+

Vignettes from package 'purrr'

+ +++++++ + + + + + + + + + +
purrr::basepurrr <-> base RHTMLsourceR code
purrr::other-langsFunctional programming in other languagesHTMLsource
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/doc/other-langs.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/doc/other-langs.Rmd new file mode 100644 index 00000000..dd51b534 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/doc/other-langs.Rmd @@ -0,0 +1,43 @@ +--- +title: "Functional programming in other languages" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Functional programming in other languages} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +purrr draws inspiration from many related tools: + +* List operations defined in the Haskell [prelude][haskell] + +* Scala's [list methods][scala]. + +* Functional programming libraries for javascript: + [underscore.js](http://underscorejs.org), + [lodash](https://lodash.com) and + [lazy.js](http://danieltao.com/lazy.js/). + +* [rlist](https://renkun-ken.github.io/rlist/), another R package to support working + with lists. Similar goals but somewhat different philosophy. + +However, the goal of purrr is not to try and simulate a purer functional programming language in R; we don't want to implement a second-class version of Haskell in R. The goal is to give you similar expressiveness to an FP language, while allowing you to write code that looks and works like R: + +* Instead of point free (tacit) style, we use the pipe, `|>`, to write code + that can be read from left to right. + +* Instead of currying, we use `...` to pass in extra arguments. + +* Before R 4.1, anonymous functions were verbose, so we provide two convenient shorthands. + For unary functions, `~ .x + 1` is equivalent to `function(.x) .x + 1`. + +* R is weakly typed, so we need `map` variants that describe the output type + (like `map_int()`, `map_dbl()`, etc) because we don't know the return type of `.f`. + +* R has named arguments, so instead of providing different functions for + minor variations (e.g. `detect()` and `detectLast()`) we use a named + argument, `.right`. Type-stable functions are easy to reason about so + additional arguments will never change the type of the output. + +[scala]:https://www.scala-lang.org/api/current/index.html +[haskell]:http://hackage.haskell.org/package/base-4.7.0.1/docs/Prelude.html#g:11 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/doc/other-langs.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/doc/other-langs.html new file mode 100644 index 00000000..c974d5bf --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/doc/other-langs.html @@ -0,0 +1,294 @@ + + + + + + + + + + + + + + +Functional programming in other languages + + + + + + + + + + + + + + + + + + + + + + + +

Functional programming in other +languages

+ + + +

purrr draws inspiration from many related tools:

+
    +
  • List operations defined in the Haskell prelude

  • +
  • Scala’s list +methods.

  • +
  • Functional programming libraries for javascript: underscore.js, lodash and lazy.js.

  • +
  • rlist, another +R package to support working with lists. Similar goals but somewhat +different philosophy.

  • +
+

However, the goal of purrr is not to try and simulate a purer +functional programming language in R; we don’t want to implement a +second-class version of Haskell in R. The goal is to give you similar +expressiveness to an FP language, while allowing you to write code that +looks and works like R:

+
    +
  • Instead of point free (tacit) style, we use the pipe, +|>, to write code that can be read from left to +right.

  • +
  • Instead of currying, we use ... to pass in extra +arguments.

  • +
  • Before R 4.1, anonymous functions were verbose, so we provide two +convenient shorthands. For unary functions, ~ .x + 1 is +equivalent to function(.x) .x + 1.

  • +
  • R is weakly typed, so we need map variants that +describe the output type (like map_int(), +map_dbl(), etc) because we don’t know the return type of +.f.

  • +
  • R has named arguments, so instead of providing different +functions for minor variations (e.g. detect() and +detectLast()) we use a named argument, .right. +Type-stable functions are easy to reason about so additional arguments +will never change the type of the output.

  • +
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/AnIndex new file mode 100644 index 00000000..3d68c766 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/AnIndex @@ -0,0 +1,203 @@ +purrr-package purrr-package +%>% pipe +%@% get-attr +%||% reexports +accumulate accumulate +accumulate2 accumulate +accumulate_right reduce_right +along along +array-coercion array-coercion +array_branch array-coercion +array_tree array-coercion +assign_in modify_in +as_mapper as_mapper +as_mapper.character as_mapper +as_mapper.list as_mapper +as_mapper.numeric as_mapper +as_vector as_vector +attr_getter attr_getter +at_depth at_depth +auto_browse auto_browse +chuck chuck +compact keep +compose compose +cross cross +cross2 cross +cross3 cross +cross_d cross +cross_df cross +cross_n cross +detect detect +detect_index detect +discard keep +discard_at keep_at +done reexports +every every +exec reexports +faq-adverbs-export faq-adverbs-export +flatten flatten +flatten_chr flatten +flatten_dbl flatten +flatten_df flatten +flatten_dfc flatten +flatten_dfr flatten +flatten_int flatten +flatten_lgl flatten +flatten_raw map_raw +get-attr get-attr +has_element has_element +head_while head_while +imap imap +imap_chr imap +imap_dbl imap +imap_dfc map_dfr +imap_dfr map_dfr +imap_int imap +imap_lgl imap +imap_raw map_raw +imap_vec imap +imodify modify +insistently insistently +invoke invoke +invoke_map invoke +invoke_map_chr invoke +invoke_map_dbl invoke +invoke_map_df invoke +invoke_map_dfc invoke +invoke_map_dfr invoke +invoke_map_int invoke +invoke_map_lgl invoke +invoke_map_raw invoke +is_atomic reexports +is_bare_atomic reexports +is_bare_character reexports +is_bare_double reexports +is_bare_integer reexports +is_bare_list reexports +is_bare_logical reexports +is_bare_numeric reexports +is_bare_vector reexports +is_character reexports +is_double reexports +is_empty reexports +is_formula reexports +is_function reexports +is_integer reexports +is_list reexports +is_logical reexports +is_null reexports +is_rate rate-helpers +is_scalar_atomic reexports +is_scalar_character reexports +is_scalar_double reexports +is_scalar_integer reexports +is_scalar_list reexports +is_scalar_logical reexports +is_scalar_vector reexports +is_vector reexports +iwalk imap +keep keep +keep_at keep_at +lift lift +lift_dl lift +lift_dv lift +lift_ld lift +lift_lv lift +lift_vd lift +lift_vl lift +list_along along +list_assign list_assign +list_c list_c +list_cbind list_c +list_flatten list_flatten +list_merge list_assign +list_modify list_assign +list_rbind list_c +list_simplify list_simplify +list_transpose list_transpose +lmap lmap +lmap_at lmap +lmap_if lmap +map map +map2 map2 +map2_chr map2 +map2_dbl map2 +map2_df map_dfr +map2_dfc map_dfr +map2_dfr map_dfr +map2_int map2 +map2_lgl map2 +map2_raw map_raw +map2_vec map2 +map_at map_if +map_chr map +map_dbl map +map_depth map_depth +map_df map_dfr +map_dfc map_dfr +map_dfr map_dfr +map_if map_if +map_int map +map_lgl map +map_raw map_raw +map_vec map +modify modify +modify2 modify +modify_at modify +modify_depth map_depth +modify_if modify +modify_in modify_in +modify_tree modify_tree +negate negate +none every +partial partial +pluck pluck +pluck<- pluck +pluck_depth pluck_depth +pluck_exists pluck +pmap pmap +pmap_chr pmap +pmap_dbl pmap +pmap_df map_dfr +pmap_dfc map_dfr +pmap_dfr map_dfr +pmap_int pmap +pmap_lgl pmap +pmap_raw map_raw +pmap_vec pmap +possibly possibly +prepend prepend +progress_bars progress_bars +purrr purrr-package +purrr_error_indexed purrr_error_indexed +pwalk pmap +quietly quietly +rate-helpers rate-helpers +rate_backoff rate-helpers +rate_delay rate-helpers +rate_reset rate_sleep +rate_sleep rate_sleep +rbernoulli rbernoulli +rdunif rdunif +reduce reduce +reduce2 reduce +reduce2_right reduce_right +reduce_right reduce_right +reexports reexports +rep_along reexports +rerun rerun +safely safely +set_names reexports +simplify as_vector +simplify_all as_vector +slowly slowly +some every +splice splice +tail_while head_while +transpose transpose +update_list update_list +vec_depth pluck_depth +walk map +walk2 map2 +when when +zap reexports diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/aliases.rds new file mode 100644 index 00000000..550e3c25 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-archived.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-archived.svg new file mode 100644 index 00000000..48f72a6f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-archived.svg @@ -0,0 +1 @@ + lifecyclelifecyclearchivedarchived \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-defunct.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-defunct.svg new file mode 100644 index 00000000..01452e5f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-defunct.svg @@ -0,0 +1 @@ +lifecyclelifecycledefunctdefunct \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-deprecated.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-deprecated.svg new file mode 100644 index 00000000..4baaee01 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-deprecated.svg @@ -0,0 +1 @@ +lifecyclelifecycledeprecateddeprecated \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-experimental.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-experimental.svg new file mode 100644 index 00000000..d1d060e9 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-experimental.svg @@ -0,0 +1 @@ +lifecyclelifecycleexperimentalexperimental \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-maturing.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-maturing.svg new file mode 100644 index 00000000..df713101 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-maturing.svg @@ -0,0 +1 @@ +lifecyclelifecyclematuringmaturing \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-questioning.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-questioning.svg new file mode 100644 index 00000000..08ee0c90 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-questioning.svg @@ -0,0 +1 @@ +lifecyclelifecyclequestioningquestioning \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-soft-deprecated.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-soft-deprecated.svg new file mode 100644 index 00000000..9f014fd1 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-soft-deprecated.svg @@ -0,0 +1 @@ +lifecyclelifecyclesoft-deprecatedsoft-deprecated \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-stable.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-stable.svg new file mode 100644 index 00000000..e015dc81 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-stable.svg @@ -0,0 +1 @@ +lifecyclelifecyclestablestable \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-superseded.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-superseded.svg new file mode 100644 index 00000000..75f24f55 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/lifecycle-superseded.svg @@ -0,0 +1 @@ + lifecyclelifecyclesupersededsuperseded \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/logo.png b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/logo.png new file mode 100644 index 00000000..86547014 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/figures/logo.png differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/paths.rds new file mode 100644 index 00000000..04c8d9d5 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/purrr.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/purrr.rdb new file mode 100644 index 00000000..fb9e054a Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/purrr.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/purrr.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/purrr.rdx new file mode 100644 index 00000000..3bf8f608 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/help/purrr.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/html/00Index.html new file mode 100644 index 00000000..35da6cf5 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/html/00Index.html @@ -0,0 +1,221 @@ + + +R: Functional Programming Tools + + + +
+

Functional Programming Tools + +

+
+
+[Up] +[Top] +

Documentation for package ‘purrr’ version 1.0.4

+ + + +

Help Pages

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
accumulateAccumulate intermediate results of a vector reduction
accumulate2Accumulate intermediate results of a vector reduction
array-coercionCoerce array to list
array_branchCoerce array to list
array_treeCoerce array to list
assign_inModify a pluck location
as_mapperConvert an object into a mapper function
as_mapper.characterConvert an object into a mapper function
as_mapper.listConvert an object into a mapper function
as_mapper.numericConvert an object into a mapper function
attr_getterCreate an attribute getter function
auto_browseWrap a function so it will automatically 'browse()' on error
chuckGet an element deep within a nested data structure, failing if it doesn't exist
compactKeep/discard elements based on their values
composeCompose multiple functions together to create a new function
detectFind the value or position of the first match
detect_indexFind the value or position of the first match
discardKeep/discard elements based on their values
discard_atKeep/discard elements based on their name/position
everyDo every, some, or none of the elements of a list satisfy a predicate?
has_elementDoes a list contain an object?
head_whileFind head/tail that all satisfies a predicate.
imapApply a function to each element of a vector, and its index
imap_chrApply a function to each element of a vector, and its index
imap_dblApply a function to each element of a vector, and its index
imap_intApply a function to each element of a vector, and its index
imap_lglApply a function to each element of a vector, and its index
imap_vecApply a function to each element of a vector, and its index
imodifyModify elements selectively
insistentlyTransform a function to wait then retry after an error
is_rateCreate delaying rate settings
iwalkApply a function to each element of a vector, and its index
keepKeep/discard elements based on their values
keep_atKeep/discard elements based on their name/position
list_assignModify a list
list_cCombine list elements into a single data structure
list_cbindCombine list elements into a single data structure
list_flattenFlatten a list
list_mergeModify a list
list_modifyModify a list
list_rbindCombine list elements into a single data structure
list_simplifySimplify a list to an atomic or S3 vector
list_transposeTranspose a list
lmapApply a function to list-elements of a list
lmap_atApply a function to list-elements of a list
lmap_ifApply a function to list-elements of a list
mapApply a function to each element of a vector
map2Map over two inputs
map2_chrMap over two inputs
map2_dblMap over two inputs
map2_intMap over two inputs
map2_lglMap over two inputs
map2_vecMap over two inputs
map_atApply a function to each element of a vector conditionally
map_chrApply a function to each element of a vector
map_dblApply a function to each element of a vector
map_depthMap/modify elements at given depth
map_ifApply a function to each element of a vector conditionally
map_intApply a function to each element of a vector
map_lglApply a function to each element of a vector
map_vecApply a function to each element of a vector
modifyModify elements selectively
modify2Modify elements selectively
modify_atModify elements selectively
modify_depthMap/modify elements at given depth
modify_ifModify elements selectively
modify_inModify a pluck location
modify_treeRecursively modify a list
negateNegate a predicate function so it selects what it previously rejected
noneDo every, some, or none of the elements of a list satisfy a predicate?
partialPartially apply a function, filling in some arguments
pluckSafely get or set an element deep within a nested data structure
pluck<-Safely get or set an element deep within a nested data structure
pluck_depthCompute the depth of a vector
pluck_existsSafely get or set an element deep within a nested data structure
pmapMap over multiple input simultaneously (in "parallel")
pmap_chrMap over multiple input simultaneously (in "parallel")
pmap_dblMap over multiple input simultaneously (in "parallel")
pmap_intMap over multiple input simultaneously (in "parallel")
pmap_lglMap over multiple input simultaneously (in "parallel")
pmap_vecMap over multiple input simultaneously (in "parallel")
possiblyWrap a function to return a value instead of an error
progress_barsProgress bars in purrr
pwalkMap over multiple input simultaneously (in "parallel")
quietlyWrap a function to capture side-effects
rate-helpersCreate delaying rate settings
rate_backoffCreate delaying rate settings
rate_delayCreate delaying rate settings
reduceReduce a list to a single value by iteratively applying a binary function
reduce2Reduce a list to a single value by iteratively applying a binary function
safelyWrap a function to capture errors
slowlyWrap a function to wait between executions
someDo every, some, or none of the elements of a list satisfy a predicate?
tail_whileFind head/tail that all satisfies a predicate.
vec_depthCompute the depth of a vector
walkApply a function to each element of a vector
walk2Map over two inputs
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/libs/purrr.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/libs/purrr.so new file mode 100755 index 00000000..acbd16a6 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/libs/purrr.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/libs/purrr.so.dSYM/Contents/Info.plist b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/libs/purrr.so.dSYM/Contents/Info.plist new file mode 100644 index 00000000..7ea5e8c4 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/libs/purrr.so.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.purrr.so + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/libs/purrr.so.dSYM/Contents/Resources/DWARF/purrr.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/libs/purrr.so.dSYM/Contents/Resources/DWARF/purrr.so new file mode 100644 index 00000000..91fe13cd Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/purrr/libs/purrr.so.dSYM/Contents/Resources/DWARF/purrr.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/DESCRIPTION new file mode 100644 index 00000000..0b38b57e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/DESCRIPTION @@ -0,0 +1,52 @@ +Package: rlang +Version: 1.1.5 +Title: Functions for Base Types and Core R and 'Tidyverse' Features +Description: A toolbox for working with base types, core R features + like the condition system, and core 'Tidyverse' features like tidy + evaluation. +Authors@R: c( + person("Lionel", "Henry", ,"lionel@posit.co", c("aut", "cre")), + person("Hadley", "Wickham", ,"hadley@posit.co", "aut"), + person(given = "mikefc", + email = "mikefc@coolbutuseless.com", + role = "cph", + comment = "Hash implementation based on Mike's xxhashlite"), + person(given = "Yann", + family = "Collet", + role = "cph", + comment = "Author of the embedded xxHash library"), + person(given = "Posit, PBC", role = c("cph", "fnd")) + ) +License: MIT + file LICENSE +ByteCompile: true +Biarch: true +Depends: R (>= 3.5.0) +Imports: utils +Suggests: cli (>= 3.1.0), covr, crayon, fs, glue, knitr, magrittr, + methods, pillar, rmarkdown, stats, testthat (>= 3.0.0), tibble, + usethis, vctrs (>= 0.2.3), withr +Enhances: winch +Encoding: UTF-8 +RoxygenNote: 7.3.2 +URL: https://rlang.r-lib.org, https://github.com/r-lib/rlang +BugReports: https://github.com/r-lib/rlang/issues +Config/testthat/edition: 3 +Config/Needs/website: dplyr, tidyverse/tidytemplate +NeedsCompilation: yes +Packaged: 2025-01-17 08:43:17 UTC; lionel +Author: Lionel Henry [aut, cre], + Hadley Wickham [aut], + mikefc [cph] (Hash implementation based on Mike's xxhashlite), + Yann Collet [cph] (Author of the embedded xxHash library), + Posit, PBC [cph, fnd] +Maintainer: Lionel Henry +Repository: CRAN +Date/Publication: 2025-01-17 14:30:02 UTC +Built: R 4.4.1; aarch64-apple-darwin20; 2025-02-01 04:45:40 UTC; unix +Archs: rlang.so.dSYM +RemoteType: standard +RemotePkgRef: rlang +RemoteRef: rlang +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 1.1.5 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/INDEX new file mode 100644 index 00000000..88c5ddd3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/INDEX @@ -0,0 +1,136 @@ +abort Signal an error, warning, or message +arg_match Match an argument to a character vector +args_error_context Documentation anchor for error arguments +as_box Convert object to a box +as_data_mask Create a data mask +as_environment Coerce to an environment +as_function Convert to function +as_label Create a default name for an R object +as_name Extract names from symbols +as_string Cast symbol to string +bare-type-predicates Bare type predicates +box Box a value +bytes-class Human readable memory sizes +call2 Create a call +call_args Extract arguments from a call +call_inspect Inspect a call +call_match Match supplied arguments to function definition +call_modify Modify the arguments of a call +call_name Extract function name or namespace of a call +caller_arg Find the caller argument for error messages +catch_cnd Catch a condition +check_dots_empty Check that dots are empty +check_dots_unnamed Check that all dots are unnamed +check_dots_used Check that all dots have been used +check_exclusive Check that arguments are mutually exclusive +check_required Check that argument is supplied +cnd_inherits Does a condition or its ancestors inherit from + a class? +cnd_message Build an error message from parts +cnd_signal Signal a condition object +done Box a final value for early termination +dot-data '.data' and '.env' pronouns +dyn-dots Dynamic dots features +embrace-operator Embrace operator {{ +empty_env Get the empty environment +englue Defuse function arguments with glue +enquo Defuse function arguments +env Create a new environment +env_bind Bind symbols to objects in an environment +env_browse Browse environments +env_cache Cache a value in an environment +env_clone Clone or coalesce an environment +env_depth Depth of an environment chain +env_get Get an object in an environment +env_has Does an environment have or see bindings? +env_inherits Does environment inherit from another + environment? +env_is_user_facing Is frame environment user facing? +env_name Label of an environment +env_names Names and numbers of symbols bound in an + environment +env_parent Get parent environments +env_poke Poke an object in an environment +env_print Pretty-print an environment +env_unbind Remove bindings from an environment +eval_bare Evaluate an expression in an environment +eval_tidy Evaluate an expression with quosures and + pronoun support +exec Execute a function +expr Defuse an R expression +expr_print Print an expression +exprs_auto_name Ensure that all elements of a list of + expressions are named +f_rhs Get or set formula components +f_text Turn RHS of formula into a string or label +faq-options Global options for rlang +fn_body Get or set function body +fn_env Return the closure environment of a function +fn_fmls Extract arguments from a function +format_error_bullets Format bullets for error messages +get_env Get or set the environment of an object +global_entrace Entrace unexpected errors +global_handle Register default global handlers +global_prompt_install Prompt user to install missing packages +glue-operators Name injection with '"{"' and '"{{"' +has_name Does an object have an element with this name? +hash Hashing +inherits_any Does an object inherit from a set of classes? +inject Inject objects in an R expression +injection-operator Injection operator !! +is_call Is object a call? +is_empty Is object an empty vector or NULL? +is_environment Is object an environment? +is_expression Is an object an expression? +is_formula Is object a formula? +is_function Is object a function? +is_installed Are packages installed in any of the libraries? +is_integerish Is a vector integer-like? +is_interactive Is R running interactively? +is_named Is object named? +is_namespace Is an object a namespace environment? +is_symbol Is object a symbol? +is_true Is object identical to TRUE or FALSE? +is_weakref Is object a weak reference? +last_error Last 'abort()' error +last_warnings Display last messages and warnings +list2 Collect dynamic dots in a list +local_bindings Temporarily change bindings of an environment +local_error_call Set local error call in an execution + environment +local_options Change global options +missing_arg Generate or handle a missing argument +names2 Get names of a vector +new_formula Create a formula +new_function Create a function +new_quosure Create a quosure from components +new_quosures Create a list of quosures +new_weakref Create a weak reference +on_load Run expressions on load +op-get-attr Infix attribute accessor and setter +op-null-default Default value for 'NULL' +pairlist2 Collect dynamic dots in a pairlist +parse_expr Parse R code +qq_show Show injected expression +quo_squash Squash a quosure +quosure-tools Quosure getters, setters and predicates +rep_along Create vectors matching the length of a given + vector +rlang_backtrace_on_error + Display backtrace on error +rlang_error Errors of class 'rlang_error' +scalar-type-predicates + Scalar type predicates +seq2 Increasing sequence of integers in an interval +set_names Set names of a vector +splice Splice values at dots collection time +splice-operator Splice operator !!! +stack Get properties of the current or caller frame +sym Create a symbol or list of symbols +trace_back Capture a backtrace +try_fetch Try an expression with condition handlers +type-predicates Type predicates +vector-construction Create vectors +wref_key Get key/value from a weak reference object +zap Create zap objects +zap_srcref Zap source references diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/LICENSE new file mode 100644 index 00000000..a1559d15 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2020 +COPYRIGHT HOLDER: rlang authors diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/Meta/Rd.rds new file mode 100644 index 00000000..d8925a56 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/Meta/hsearch.rds new file mode 100644 index 00000000..d48268c1 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/Meta/links.rds new file mode 100644 index 00000000..563af0fb Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/Meta/nsInfo.rds new file mode 100644 index 00000000..45adce1d Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/Meta/package.rds new file mode 100644 index 00000000..9d57ee0e Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/NAMESPACE new file mode 100644 index 00000000..98829a24 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/NAMESPACE @@ -0,0 +1,542 @@ +# Generated by roxygen2: do not edit by hand + +S3method("$",rlang_ctxt_pronoun) +S3method("$",rlang_data_pronoun) +S3method("$",rlang_fake_data_pronoun) +S3method("$<-",quosures) +S3method("$<-",rlang_ctxt_pronoun) +S3method("$<-",rlang_data_pronoun) +S3method("[","rlang:::list_of_conditions") +S3method("[",quosure) +S3method("[",quosures) +S3method("[",rlang_ctxt_pronoun) +S3method("[",rlang_data_pronoun) +S3method("[",rlang_envs) +S3method("[",rlib_bytes) +S3method("[<-",quosures) +S3method("[[",quosure) +S3method("[[",rlang_ctxt_pronoun) +S3method("[[",rlang_data_pronoun) +S3method("[[",rlang_fake_data_pronoun) +S3method("[[",rlib_bytes) +S3method("[[<-",quosures) +S3method("[[<-",rlang_ctxt_pronoun) +S3method("[[<-",rlang_data_pronoun) +S3method(Math,quosure) +S3method(Ops,quosure) +S3method(Ops,rlib_bytes) +S3method(Summary,quosure) +S3method(as.character,quosure) +S3method(as.character,rlang_error) +S3method(as.character,rlang_message) +S3method(as.character,rlang_warning) +S3method(as.character,rlib_bytes) +S3method(as.list,quosures) +S3method(as_bytes,character) +S3method(as_bytes,numeric) +S3method(as_bytes,rlib_bytes) +S3method(c,quosure) +S3method(c,quosures) +S3method(c,rlang_envs) +S3method(cnd_body,default) +S3method(cnd_footer,default) +S3method(cnd_header,default) +S3method(cnd_header,rlib_error_package_not_found) +S3method(conditionMessage,rlang_error) +S3method(conditionMessage,rlang_message) +S3method(conditionMessage,rlang_warning) +S3method(dimnames,rlang_data_pronoun) +S3method(format,rlang_error) +S3method(format,rlang_message) +S3method(format,rlang_trace) +S3method(format,rlang_warning) +S3method(format,rlib_bytes) +S3method(length,rlang_ctxt_pronoun) +S3method(length,rlang_data_pronoun) +S3method(length,rlang_fake_data_pronoun) +S3method(max,rlib_bytes) +S3method(mean,quosure) +S3method(median,quosure) +S3method(min,rlib_bytes) +S3method(names,rlang_ctxt_pronoun) +S3method(names,rlang_data_pronoun) +S3method(names,rlang_fake_data_pronoun) +S3method(print,"rlang:::list_of_conditions") +S3method(print,quosure) +S3method(print,quosures) +S3method(print,rlang_box_done) +S3method(print,rlang_box_splice) +S3method(print,rlang_data_pronoun) +S3method(print,rlang_dict) +S3method(print,rlang_dyn_array) +S3method(print,rlang_envs) +S3method(print,rlang_error) +S3method(print,rlang_fake_data_pronoun) +S3method(print,rlang_lambda_function) +S3method(print,rlang_message) +S3method(print,rlang_trace) +S3method(print,rlang_warning) +S3method(print,rlang_zap) +S3method(print,rlib_bytes) +S3method(quantile,quosure) +S3method(rlang_type_sum,Date) +S3method(rlang_type_sum,POSIXct) +S3method(rlang_type_sum,data.frame) +S3method(rlang_type_sum,default) +S3method(rlang_type_sum,difftime) +S3method(rlang_type_sum,factor) +S3method(rlang_type_sum,ordered) +S3method(str,quosure) +S3method(str,rlang_data_pronoun) +S3method(str,rlang_envs) +S3method(sum,rlib_bytes) +S3method(summary,"rlang:::list_of_conditions") +S3method(summary,rlang_error) +S3method(summary,rlang_message) +S3method(summary,rlang_trace) +S3method(summary,rlang_warning) +export("!!!") +export("!!") +export("%<~%") +export("%@%") +export("%@%<-") +export("%|%") +export("%||%") +export(":=") +export("f_env<-") +export("f_lhs<-") +export("f_rhs<-") +export("fn_body<-") +export("fn_env<-") +export("fn_fmls<-") +export("fn_fmls_names<-") +export("names2<-") +export(.data) +export(.env) +export(UQ) +export(UQS) +export(abort) +export(are_na) +export(arg_match) +export(arg_match0) +export(as_box) +export(as_box_if) +export(as_bytes) +export(as_character) +export(as_closure) +export(as_complex) +export(as_data_mask) +export(as_data_pronoun) +export(as_double) +export(as_environment) +export(as_function) +export(as_integer) +export(as_label) +export(as_list) +export(as_logical) +export(as_name) +export(as_quosure) +export(as_quosures) +export(as_string) +export(as_utf8_character) +export(base_env) +export(bytes) +export(call2) +export(call_args) +export(call_args_names) +export(call_fn) +export(call_inspect) +export(call_match) +export(call_modify) +export(call_name) +export(call_ns) +export(call_standardise) +export(caller_arg) +export(caller_call) +export(caller_env) +export(caller_fn) +export(calling) +export(catch_cnd) +export(check_dots_empty) +export(check_dots_empty0) +export(check_dots_unnamed) +export(check_dots_used) +export(check_exclusive) +export(check_installed) +export(check_required) +export(child_env) +export(chr) +export(chr_unserialise_unicode) +export(cnd) +export(cnd_body) +export(cnd_entrace) +export(cnd_footer) +export(cnd_header) +export(cnd_inherits) +export(cnd_message) +export(cnd_muffle) +export(cnd_signal) +export(cnd_type) +export(coerce_class) +export(coerce_type) +export(cpl) +export(ctxt_frame) +export(current_call) +export(current_env) +export(current_fn) +export(data_sym) +export(data_syms) +export(dbl) +export(done) +export(dots_list) +export(dots_n) +export(dots_splice) +export(dots_values) +export(duplicate) +export(empty_env) +export(enexpr) +export(enexprs) +export(englue) +export(enquo) +export(enquo0) +export(enquos) +export(enquos0) +export(ensym) +export(ensyms) +export(entrace) +export(env) +export(env_bind) +export(env_bind_active) +export(env_bind_lazy) +export(env_binding_are_active) +export(env_binding_are_lazy) +export(env_binding_are_locked) +export(env_binding_lock) +export(env_binding_unlock) +export(env_browse) +export(env_bury) +export(env_cache) +export(env_clone) +export(env_coalesce) +export(env_depth) +export(env_get) +export(env_get_list) +export(env_has) +export(env_inherits) +export(env_is_browsed) +export(env_is_locked) +export(env_is_user_facing) +export(env_label) +export(env_length) +export(env_lock) +export(env_name) +export(env_names) +export(env_parent) +export(env_parents) +export(env_poke) +export(env_poke_parent) +export(env_print) +export(env_tail) +export(env_unbind) +export(env_unlock) +export(error_call) +export(error_cnd) +export(eval_bare) +export(eval_tidy) +export(exec) +export(exiting) +export(expr) +export(expr_deparse) +export(expr_interp) +export(expr_label) +export(expr_name) +export(expr_print) +export(expr_text) +export(exprs) +export(exprs_auto_name) +export(f_env) +export(f_label) +export(f_lhs) +export(f_name) +export(f_rhs) +export(f_text) +export(ffi_standalone_check_number_1.0.7) +export(ffi_standalone_is_bool_1.0.7) +export(flatten) +export(flatten_chr) +export(flatten_cpl) +export(flatten_dbl) +export(flatten_if) +export(flatten_int) +export(flatten_lgl) +export(flatten_raw) +export(fn_body) +export(fn_env) +export(fn_fmls) +export(fn_fmls_names) +export(fn_fmls_syms) +export(format_error_bullets) +export(format_error_call) +export(frame_call) +export(frame_fn) +export(friendly_type) +export(get_env) +export(get_expr) +export(global_entrace) +export(global_env) +export(global_frame) +export(global_handle) +export(global_prompt_install) +export(has_length) +export(has_name) +export(hash) +export(hash_file) +export(have_name) +export(inform) +export(inherits_all) +export(inherits_any) +export(inherits_only) +export(inject) +export(int) +export(interrupt) +export(invoke) +export(is_atomic) +export(is_attached) +export(is_bare_atomic) +export(is_bare_bytes) +export(is_bare_character) +export(is_bare_complex) +export(is_bare_double) +export(is_bare_environment) +export(is_bare_formula) +export(is_bare_integer) +export(is_bare_integerish) +export(is_bare_list) +export(is_bare_logical) +export(is_bare_numeric) +export(is_bare_raw) +export(is_bare_string) +export(is_bare_vector) +export(is_bool) +export(is_box) +export(is_bytes) +export(is_call) +export(is_call_simple) +export(is_callable) +export(is_character) +export(is_chr_na) +export(is_closure) +export(is_complex) +export(is_condition) +export(is_copyable) +export(is_cpl_na) +export(is_dbl_na) +export(is_dictionaryish) +export(is_done_box) +export(is_double) +export(is_empty) +export(is_environment) +export(is_error) +export(is_expression) +export(is_false) +export(is_formula) +export(is_function) +export(is_installed) +export(is_int_na) +export(is_integer) +export(is_integerish) +export(is_interactive) +export(is_lambda) +export(is_lang) +export(is_lgl_na) +export(is_list) +export(is_logical) +export(is_message) +export(is_missing) +export(is_na) +export(is_named) +export(is_named2) +export(is_namespace) +export(is_node) +export(is_node_list) +export(is_null) +export(is_pairlist) +export(is_primitive) +export(is_primitive_eager) +export(is_primitive_lazy) +export(is_quosure) +export(is_quosures) +export(is_raw) +export(is_reference) +export(is_scalar_atomic) +export(is_scalar_bytes) +export(is_scalar_character) +export(is_scalar_complex) +export(is_scalar_double) +export(is_scalar_integer) +export(is_scalar_integerish) +export(is_scalar_list) +export(is_scalar_logical) +export(is_scalar_raw) +export(is_scalar_vector) +export(is_scoped) +export(is_spliced) +export(is_spliced_bare) +export(is_string) +export(is_symbol) +export(is_symbolic) +export(is_syntactic_literal) +export(is_true) +export(is_vector) +export(is_warning) +export(is_weakref) +export(is_zap) +export(lang) +export(last_error) +export(last_messages) +export(last_trace) +export(last_warnings) +export(lgl) +export(list2) +export(ll) +export(local_bindings) +export(local_error_call) +export(local_interactive) +export(local_options) +export(local_use_cli) +export(locally) +export(maybe_missing) +export(message_cnd) +export(missing_arg) +export(na_chr) +export(na_cpl) +export(na_dbl) +export(na_int) +export(na_lgl) +export(names2) +export(names_inform_repair) +export(new_box) +export(new_call) +export(new_character) +export(new_complex) +export(new_data_mask) +export(new_double) +export(new_environment) +export(new_formula) +export(new_function) +export(new_integer) +export(new_list) +export(new_logical) +export(new_node) +export(new_quosure) +export(new_quosures) +export(new_raw) +export(new_weakref) +export(node_caar) +export(node_cadr) +export(node_car) +export(node_cdar) +export(node_cddr) +export(node_cdr) +export(node_poke_caar) +export(node_poke_cadr) +export(node_poke_car) +export(node_poke_cdar) +export(node_poke_cddr) +export(node_poke_cdr) +export(node_poke_tag) +export(node_tag) +export(ns_env) +export(ns_env_name) +export(ns_imports_env) +export(ns_registry_env) +export(obj_address) +export(on_load) +export(on_package_load) +export(pairlist2) +export(parse_bytes) +export(parse_expr) +export(parse_exprs) +export(parse_quo) +export(parse_quos) +export(peek_option) +export(peek_options) +export(pkg_env) +export(pkg_env_name) +export(prim_name) +export(push_options) +export(qq_show) +export(quo) +export(quo_expr) +export(quo_get_env) +export(quo_get_expr) +export(quo_is_call) +export(quo_is_missing) +export(quo_is_null) +export(quo_is_symbol) +export(quo_is_symbolic) +export(quo_label) +export(quo_name) +export(quo_set_env) +export(quo_set_expr) +export(quo_squash) +export(quo_text) +export(quos) +export(quos_auto_name) +export(raw_deparse_str) +export(rep_along) +export(rep_named) +export(reset_message_verbosity) +export(reset_warning_verbosity) +export(return_from) +export(run_on_load) +export(scoped_bindings) +export(scoped_env) +export(scoped_interactive) +export(scoped_options) +export(search_env) +export(search_envs) +export(seq2) +export(seq2_along) +export(set_attrs) +export(set_env) +export(set_expr) +export(set_names) +export(signal) +export(splice) +export(squash) +export(squash_chr) +export(squash_cpl) +export(squash_dbl) +export(squash_if) +export(squash_int) +export(squash_lgl) +export(squash_raw) +export(string) +export(switch_class) +export(switch_type) +export(sym) +export(syms) +export(trace_back) +export(trace_length) +export(try_fetch) +export(type_of) +export(unbox) +export(vec_poke_n) +export(vec_poke_range) +export(warn) +export(warning_cnd) +export(with_bindings) +export(with_env) +export(with_handlers) +export(with_interactive) +export(with_options) +export(wref_key) +export(wref_value) +export(zap) +export(zap_srcref) +importFrom(stats,median) +importFrom(stats,quantile) +importFrom(utils,adist) +importFrom(utils,str) +useDynLib(rlang, .registration = TRUE) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/NEWS.md new file mode 100644 index 00000000..62392cef --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/NEWS.md @@ -0,0 +1,2750 @@ +# rlang 1.1.5 + +* We now report full backtraces during knitting (#1769). + + +# rlang 1.1.4 + +* Added missing C level `r_dyn_raw_push_back()` and `r_dyn_chr_push_back()` + utilities (#1699). + +* `last_trace()` hyperlinks now use the modern `x-r-run` format (#1678). + + +# rlang 1.1.3 + +* Fix for CRAN checks. + +* `%||%` is now reexported from base on newer R versions. This avoids + conflict messages when attaching or importing rlang. + + +# rlang 1.1.2 + +* Fixed an off-by-one typo in the traceback source column location (#1633). + +* `abort()` now respects the base R global option, + `options(show.error.messages = FALSE)` (#1630). + +* `obj_type_friendly()` now only displays the first class of S3 objects (#1622). + +* `expr_label()` now has back-compatility with respect to changes made by R version 4.4 and `is.atomic(NULL)` (#1655) + +* Performance improvement in `.rlang_cli_compat()` (#1657). + + +# rlang 1.1.1 + +* `englue()` now allows omitting `{{`. This is to make it easier to + embed in external functions that need to support either `{` and `{{` + (#1601). + +* Fix for CRAN checks. + +* `stop_input_type()` now handles `I()` input literally in `arg` + (#1607, @simonpcouch). + +* `parse_expr()` and `parse_exprs()` are now faster when + `getOption("keep.source")` is `TRUE` (#1603). + + +# rlang 1.1.0 + +## Life cycle changes + +* `dots_splice()` is deprecated. This function was previously in + the questioning lifecycle stage as we were moving towards the + explicit `!!!` splicing style. + +* `flatten()`, `squash()`, and their variants are deprecated in favour + of `purrr::list_flatten()` and `purrr::list_c()`. + +* `child_env()` is deprecated in favour of `env()` which has supported + creating child environments for several years now. + + +## Main new features + +* `last_error()` and `options(rlang_backtrace_on_error = "full")` now + print the full backtrace tree by default (except for some hidden + frames). The simplified backtraces tended to hide important context + too often. Now we show intervening frames in a lighter colour so + that they don't distract from the important parts of the backtraces + but are still easily inspectable. + +* `global_entrace()`, `last_warnings()`, and `last_messages()` now + support knitr documents. + +* New `rlang_backtrace_on_warning_report` global option. This is + useful in conjunction with `global_entrace()` to get backtraces on + warnings inside RMarkdown documents. + +* `global_entrace()` and `entrace()` now stop entracing warnings and + messages after 20 times. This is to avoid a large overhead when 100s + or 1000s of warnings are signalled in a loop (#1473). + +* `abort()`, `warn()`, and `inform()` gain an `.inherit` parameter. + This controls whether `parent` is inherited. If `FALSE`, + `cnd_inherits()` and `try_fetch()` do not match chained conditions + across parents. + + It's normally `TRUE` by default, but if a warning is chained to an + error or a message is chained to a warning or error (downgraded + chaining), `.inherit` defaults to `FALSE` (#1573). + +* `try_fetch()` now looks up condition classes across chained errors + (#1534). This makes `try_fetch()` insensitive to changes of + implementation or context of evaluation that cause a classed error + to suddenly get chained to a contextual error. + +* `englue()` gained `env`, `error_arg`, and `error_call` arguments to + support being wrapped in another function (#1565). + +* The data-masking documentation for arguments has been imported from + dplyr. You can link to it by starting an argument documentation with + this button: + + ``` + <[`data-masking`][rlang::args_data_masking]> + ``` + +* `enquos()` and friends gain a `.ignore_null` argument (#1450). + +* New `env_is_user_facing()` function to determine if an evaluation + frame corresponds to a direct usage by the end user (from the global + environment or a package being tested) or indirect usage by a third + party function. The return value can be overridden by setting the + `"rlang_user_facing"` global option. + + +## Miscellaneous fixes and features + +* New `check_data_frame()` and `check_logical()` functions in + `standalone-types-check.R` (#1587, @mgirlich). + +* Added `allow_infinite` argument to `check_number_whole()` (#1588, @mgirlich). + +* The lifecycle standalone file has been updated to match the modern + lifecycle tools. + +* `parse_expr()` now supports vectors of lines (#1540). + +* Quosures can now be consistently concatenated to lists of quosures (#1446). + +* Fixed a memory issue that caused excessive duplication in `list2()` + and friends (#1491). + +* Embraced empty arguments are now properly detected and trimmed by + `quos()` (#1421). + +* Fixed an edge case that caused `enquos(.named = NULL)` to return a + named list (#1505). + +* `expr_deparse()` now deparses the embrace operator `{{` on a single + line (#1511). + +* `zap_srcref()` has been rewritten in C for efficiency (#1513). + +* `zap_srcref()` now supports expression vectors. + +* The non-error path of `check_dots_unnamed()` has been rewritten in C + for efficiency (#1528). + +* Improved error messages in `englue()` (#1531) and in glue strings in + the LHS of `:=` (#1526). + +* `englue()` now requires size 1 outputs (#1492). This prevents + surprising errors or inconsistencies when an interpolated input of + size != 1 makes its way into the glue string. + +* `arg_match()` now throws correct error when supplied a missing value + or an empty vector (#1519). + +* `is_integerish()` now handles negative doubles more consistently + with positive ones (@sorhawell, #1530). + +* New `check_logical()` in `standalone-types-check.R` (#1560). + +* `quo_squash()` now squashes quosures in function position (#1509). + +* `is_expression()` now recognises quoted functions (#1499). + It now also recognises non-parsable attributes (#1475). + +* `obj_address()` now supports the missing argument (#1521). + +* Fixed a `check_installed()` issue with packages removed during the + current R session (#1561). + +* `new_data_mask()` is now slightly faster due to a smaller initial mask size + and usage of the C level function `R_NewEnv()` on R >=4.1.0 (#1553). + +* The C level `r_dyn_*_push_back()` utilities are now faster (#1542). + +* The C level `r_lgl_sum()` and `r_lgl_which()` helpers are now faster + (#1577, with contributions from @mgirlich). + +* rlang is now compliant with `-Wstrict-prototypes` as requested by CRAN + (#1508). + + +# rlang 1.0.6 + +* `as_closure(seq.int)` now works (#1468). + +* rlang no longer stores errors and backtraces in a `org:r-lib` + environment on the search path. + +* The low-level function `error_call()` is now exported (#1474). + +* Fixed an issue that caused a failure about a missing `is_character` + function when rlang is installed alongside an old version of vctrs (#1482). + +* Fixed an issue that caused multiline calls in backtraces. + +* The C API function `r_lgl_which()` now propagates the names of the input + (#1471). + +* The `pkg_version_info()` function now allows `==` for package + version comparison (#1469, @kryekuzhinieri). + + +# rlang 1.0.5 + +* Fixed backtrace display with calls containing long lists of + arguments (#1456). + +* New `r_obj_type_friendly()` function in the C library (#1463). It + interfaces with `obj_type_friendly()` from `compat-obj-type.R` via a + C callable. + + +# rlang 1.0.4 + +* `is_installed()` no longer throws an error with irregular package + names. + +* `is_installed()` and `check_installed()` now properly detect that + the base package is installed on older versions of R (#1434). + + +# rlang 1.0.3 + +* Child errors may now have empty messages to enable this pattern: + + ``` + Error in `my_function()`: + Caused by error in `their_function()`: + ! Message. + ``` + +* The `rlib_bytes` class now uses prettyunits to format bytes. The + bytes are now represented with decimal prefixes instead of binary + prefixes. + +* Supplying a frame environment to the `call` argument of `abort()` + now causes the corresponding function call in the backtrace to be + highlighted. + + In addition, if you store the argument name of a failing input in + the `arg` error field, the argument is also highlighted in the + backtrace. + + Instead of: + + ``` + cli::cli_abort("{.arg {arg}} must be a foobar.", call = call) + ``` + + You can now write this to benefit from arg highlighting: + + ``` + cli::cli_abort("{.arg {arg}} must be a foobar.", arg = arg, call = call) + ``` + +* `abort(message = )` can now be a function. In this case, it is + stored in the `header` field and acts as a `cnd_header()` method + invoked when the message is displayed. + +* New `obj_type_oo()` function in `compat-obj-type.R` (#1426). + +* `friendly_type_of()` from `compat-obj-type.R` (formerly + `compat-friendly-type.R`) is now `obj_type_friendly()`. + +* `options(backtrace_on_error = "collapse")` and `print(trace, + simplify = "collapse")` are deprecated. They fall back to `"none"` + with a warning. + +* `call_match()` now better handles `...` when `dots_expand = FALSE`. + +* `list2(!!!x)` is now faster when `x` is a list. It is now returned + as is instead of being duplicated into a new list. + +* `abort()` gains a `.trace_bottom` argument to disambiguate from + other `.frame`. This allows `cli::cli_abort()` to wrap `abort()` in + such a way that `.internal` mentions the correct package to report + the error in (#1386). + +* The `transpose()` compat is now more consistent with purrr when + inner names are not congruent (#1346). + +* New `reset_warning_verbosity()` and `reset_message_verbosity()` + functions. These reset the verbosity of messages signalled with + `warn()` and `inform()` with the `.frequency` argument. This is + useful for testing verbosity in your package (#1414). + +* `check_dots_empty()` now allows trailing missing arguments (#1390). + +* Calls to local functions that are not accessible through `::` or + `:::` are now marked with `(local)` in backtraces (#1399). + +* Error messages now mention indexed calls like `foo$bar()`. + +* New `env_coalesce()` function to copy bindings from one environment + to another. Unlike approaches based on looping with `[[<-`, + `env_coalesce()` preserves active and lazy bindings. + +* Chaining errors at top-level (directly in the console instead of in + a function) no longer fails (#1405). + +* Warning style is propagated across parent errors in chained error + messages (#1387). + +* `check_installed()` now works within catch-all `tryCatch(error = )` + expressions (#1402, tidyverse/ggplot2#4845). + +* `arg_match()` and `arg_match0()` now mention the correct call in + case of type error (#1388). + +* `abort()` and `inform()` now print messages to `stdout` in RStudio + panes (#1393). + +* `is_installed()` now detects unsealed namespaces (#1378). This fixes + inconsistent behaviour when run within user onLoad hooks. + +* Source references in backtraces and `last_error()`/`last_trace()` instructions + are now clickable in IDEs that support links (#1396). + +* `compat-cli.R` now supports `style_hyperlink()`. + +* `abort(.homonyms = "error")` now throws the expected error (#1394). + +* `env_binding_are_active()` no longer accidentally triggers active bindings + (#1376). + +* Fixed bug in `quo_squash()` with nested quosures containing the + missing argument. + + +# rlang 1.0.2 + +* Backtraces of parent errors are now reused on rethrow. This avoids + capturing the same backtrace twice and solves consistency problems + by making sure both errors in a chain have the same backtrace. + +* Fixed backtrace oversimplification when `cnd` is a base error in + `abort(parent = cnd)`. + +* Internal errors thrown with `abort(.internal = TRUE)` now mention + the name of the package the error should be reported to. + +* Backtraces are now separated from error messages with a `---` ruler + line (#1368). + +* The internal bullet formatting routine now ignores unknown names + (#1364). This makes it consistent with the cli package, increases + resilience against hard-to-detect errors, and increases forward + compatibility. + +* `abort()` and friends no longer calls non-existent functions + (e.g. `cli::format_error()` or `cli::format_warning`) when the + installed version of cli is too old (#1367, tidyverse/dplyr#6189). + +* Fixed an OOB subsetting error in `abort()`. + + +# rlang 1.0.1 + +* New `rlang_call_format_srcrefs` global option (#1349). Similar to + `rlang_trace_format_srcrefs`, this option allows turning off the + display of srcrefs in error calls. This can be useful for + reproducibility but note that srcrefs are already disabled + within testthat by default. + +* `abort(parent = NA)` is now supported to indicate an unchained + rethrow. This helps `abort()` detect the condition handling context + to create simpler backtraces where this context is hidden by + default. + +* When `parent` is supplied, `abort()` now loops over callers to + detect the condition handler frame. This makes it easier to wrap or + extract condition handlers in functions without supplying `.frame`. + +* When `parent` is supplied and `call` points to the condition setup + frame (e.g. `withCallingHandlers()` or `try_fetch()`), `call` is + replaced with the caller of that setup frame. This provides a more + helpful default call. + +* `is_call()` is now implemented in C for performance. + +* Fixed performance regression in `trace_back()`. + +* Fixed a partial matching issue with `header`, `body`, and `footer` + condition fields. + +* `eval_tidy()` calls are no longer mentioned in error messages. + + +# rlang 1.0.0 + +## Major changes + +This release focuses on the rlang errors framework and features +extensive changes to the display of error messages. + +* `abort()` now displays errors as fully bulleted lists. Error headers + are displayed with a `!` prefix. See + + to customise the display of error messages. + +* `abort()` now displays a full chain of messages when errors are + chained with the `parent` argument. Following this change, you + should update dplyr to version 1.0.8 to get proper error messages. + +* `abort()` now displays function calls in which a message originated + by default. We have refrained from showing these calls until now to + avoid confusing messages when an error is thrown from a helper + function that isn't relevant to users. + + To help with these cases, `abort()` now takes a `call` argument that + you can set to `caller_env()` or `parent.frame()` when used in a + helper function. The function call corresponding to this environment + is retrieved and stored in the condition. + +* cli formatting is now supported. Use `cli::cli_abort()` to get + advanced formatting of error messages, including indented bulleted + lists. See . + +* New `try_fetch()` function for error handling. We recommend to use + it for chaining errors. It mostly works like `tryCatch()` with a few + important differences. + + - Compared to `tryCatch()`, `try_fetch()` preserves the call + stack. This allows full backtrace capture and allows `recover()` + to reach the error site. + + - Compared to `withCallingHandler()`, `try_fetch()` is able to + handle stack overflow errors (this requires R 4.2, unreleased at + the time of writing). + +* The tidy eval documentation has been fully rewritten to reflect + current practices. Access it through the "Tidy evaluation" and + "Metaprogramming" menus on . + + +## Breaking changes + +* The `.data` object exported by rlang now fails when subsetted + instead of returning `NULL`. This new error helps you detect when + `.data` is used in the wrong context. + + We've noticed several packages failing after this change because + they were using `.data` outside of a data-masking context. For + instance the `by` argument of `dplyr::join()` is not data-masked. + Previously `dplyr::join(by = .data$foo)` would silently be + interpreted as `dplyr::join(by = NULL)`. This is now an error. + + Another issue is using `.data` inside `ggplot2::labs(...)`. This is + not allowed since `labs()` isn't data-masked. + +* `call_name()` now returns `NULL` instead of `"::"` for calls of the + form `foo::bar`. + + We've noticed some packages do not check for `NULL` results from + `call_name()`. Note that many complex calls such as `foo()()`, + `foo$bar()` don't have a "name" and cause a `NULL` result. This is + why you should always check for `NULL` results when using + `call_name()`. + + We've added the function `is_call_simple()` to make it easier to + work safely with `call_name()`. The invariant is that `call_name()` + always returns a string when `is_call_simple()` returns `TRUE`. + Conversely it always returns `NULL` when `is_call_simple()` retuns + `FALSE`. + +* `is_expression()` now returns `FALSE` for manually constructed + expressions that can't be created by the parser. It used to return + `TRUE` for any calls, including those that contain injected objects. + + Consider using `is_call()` or just remove the expression check. In + many cases it is fine letting all objects go through when an + expression is expected. For instance you can inject objects directly + inside dplyr arguments: + + ``` + x <- seq_len(nrow(data)) + dplyr::mutate(data, col = !!x) + ``` + +* If a string is supplied to `as_function()` instead of an object + (function or formula), the function is looked up in the global + environment instead of the calling environment. In general, passing + a function name as a string is brittle. It is easy to forget to pass + the user environment to `as_function()` and sometimes there is no + obvious user environment. The support for strings should be + considered a convenience for end users only, not for programmers. + + Since environment forwarding is easy to mess up, and since the + feature is aimed towards end users, `as_function()` now defaults to + the global environment. Supply an environment explicitly if that is + not correct in your case. + +* `with_handlers()`, `call_fn()`, and `friendly_type()` are deprecated. + +* The `action` argument of `check_dots_used()`, `check_dots_unnamed()`, + and `check_dots_empty()` is deprecated in favour of the new `error` + argument which takes an error handler. + +* Many functions deprecated in rlang 0.2.0 and 0.3.0 have + been removed from the package. + + +## Fixes and features + +### tidyeval + +* New `englue()` operator to allow string-embracing outside of dynamic + dots (#1172). + +* New `data_sym()` and `data_syms()` functions to create calls of the + form `.data$foo`. + +* `.data` now fails early when it is subsetted outside of a data mask + context. This provides a more informative error message (#804, #1133). + +* `as_label()` now better handles calls to infix operators (#956, + r-lib/testthat#1432). This change improves auto-labelled expressions + in data-masking functions like `tibble()`, `mutate()`, etc. + +* The `{{` operator is now detected more strictly (#1087). If + additional arguments are supplied through `{`, it is no longer + interpreted as an injection operator. + +* The `.ignore_empty` argument of `enexprs()` and `enquos()` no longer + treats named arguments supplied through `...` as empty, consistently + with `exprs()` and `quos()` (#1229). + +* Fixed a hang when a quosure inheriting from a data mask is evaluated + in the mask again. + +* Fixed performance issue when splicing classes that explicitly + inherit from list with `!!!` (#1140, r-lib/vctrs#1170). + +* Attributes of quosure lists are no longer modified by side effect + (#1142). + +* `enquo()`, `enquos()` and variants now support numbered dots like + `..1` (#1137). + +* Fixed a bug in the AST rotation algorithm that caused the `!!` + operator to unexpectedly mutate injected objects (#1103). + +* Fixed AST rotation issue with `!!` involving binary operators (#1125). + + +### rlang errors + +* `try_fetch()` is a flexible alternative to both `tryCatch()` and + `withCallingHandlers()` (#503). It is also more efficient than + `tryCatch()` and creates leaner backtraces. + +* New `cnd_inherits()` function to detect a class in a chain of errors + (#1293). + +* New `global_entrace()` function, a user-friendly helper for + configuring errors in your RProfile. Call it to enrich all base + errors and warnings with an rlang backtrace. This enables + `last_error()`, `last_warnings()`, `last_messages()`, and + `backtrace_on_error` support for all conditions. + +* New `global_handle()` function to install a default configuration of + error handlers. This currently calls `global_entrace()` and + `global_prompt_install()`. Expect more to come. + +* The "Error:" part of error messages is now printed by rlang instead + of R. This introduces several cosmetic and informative changes in + errors thrown by `abort()`: + + - The `call` field of error messages is now displayed, as is the + default in `base::stop()`. The call is only displayed if it is a + simple expression (e.g. no inlined function) and the arguments are + not displayed to avoid distracting from the error message. The + message is formatted with the tidyverse style (`code` formatting + by the cli package if available). + + - The source location is displayed (as in `base::stop()`) if `call` + carries a source reference. Source locations are not displayed + when testthat is running to avoid brittle snapshots. + + - Error headers are always displayed on their own line, with a `"!"` + bullet prefix. + + See + to customise this new display. + +* The display of chained errors created with the `parent` argument of + `abort()` has been improved. Chains of errors are now displayed at + throw time with the error prefix "Caused by error:". + +* The `print()` method of rlang errors (commonly invoked with + `last_error()`) has been improved: + - Display calls if present. + - Chained errors are displayed more clearly. + +* `inform()` and `warn()` messages can now be silenced with the global + options `rlib_message_verbosity` and `rlib_warning_verbosity`. + +* `abort()` now outputs error messages to `stdout` in interactive + sessions, following the same approach as `inform()`. + +* Errors, warnings, and messages generated from rlang are now + formatted with cli. This means in practice that long lines are + width-wrapped to the terminal size and user themes are applied. + This is currently only the case for rlang messages. + + This special formatting is not applied when `abort()`, `warn()`, and + `inform()` are called from another namespace than rlang. + See + if you'd like to use cli to format condition messages in your + package. + +* `format_error_bullets()` (used as a fallback instead of cli) now + treats: + + - Unnamed elements as unindented line breaks (#1130) + - Elements named `"v"` as green ticks (@rossellhayes) + - Elements named `" "` as indented line breaks + - Elements named `"*"` as normal bullets + - Elements named `"!"` as warning bullets + + For convenience, a fully unnamed vector is interpreted as a vector + of `"*"` bullets. + +* `abort()` gains a `.internal` argument. When set to `TRUE`, a footer + bullet is added to `message` to let the user know that the error is + internal and that they should report it to the package authors. + +* `abort()`, `warn()`, and `inform()` gain a `body` argument to supply + additional bullets in the error message. + +* rlang conditions now have `as.character()` methods. Use this generic + on conditions to generate a whole error message, including the + `Error:` prefix. These methods are implemented as wrappers around + `cnd_message()`. + +* `header` and `footer` methods can now be stored as closures in + condition fields of the same name. + +* `cnd_message()` gains a `prefix` argument to print the message with + a full prefix, including `call` field if present and parent messages + if the condition is chained. + +* `cnd_message()` gains an `inherit` argument to control whether to + print the messages of parent errors. + +* Condition constructors now check for duplicate field names (#1268). + +* `cnd_footer()` now returns the `footer` field by default, if any. + +* `warn()` and `inform()` now signal conditions of classes + `"rlang_warning"` and `"rlang_message"` respectively. + +* The `body` field of error conditions can now be a character vector. + +* The error returned by `last_error()` is now stored on the search + path as the `.Last.error` binding of the `"org:r-lib"` + environment. This is consistent with how the processx package + records error conditions. Printing the `.Last.error` object is now + equivalent to running `last_error()`. + +* Added `is_error()`, `is_warning()`, and `is_message()` predicates (#1220). + +* `interrupt()` no longer fails when interrupts are suspended (#1224). + +* `warn()` now temporarily sets the `warning.length` global option to + the maximum value (8170). The default limit (1000 characters) is + especially easy to hit when the message contains a lot of ANSI + escapes, as created by the crayon or cli packages (#1211). + + +### Backtraces + +* `entrace()` and `global_entrace()` now log warnings and messages + with backtraces attached. Run `last_warnings()` or `last_messages()` + to inspect the warnings or messages emitted during the last command. + +* Internal errors now include a winch backtrace if installed. The user + is invited to install it if not installed. + +* Display of rlang backtraces for expected errors in dynamic reports + (chunks where `error = TRUE` in knitted documents and RStudio + notebooks) is now controlled by the + `rlang_backtrace_on_error_report` option. By default, this is set to + `"none"`. + + The display of backtraces for _unexpected_ errors (in chunks where + `error` is unset or set to `FALSE`) is still controlled by + `rlang_backtrace_on_error`. + +* The `last_error()` reminder is no longer displayed in RStudio + notebooks. + +* A `knitr::sew()` method is registered for `rlang_error`. This makes + it possible to consult `last_error()` (the call must occur in a + different chunk than the error) and to set + `rlang_backtrace_on_error_report` global options in knitr to display + a backtrace for expected errors. + + If you show rlang backtraces in a knitted document, also set this in + a hidden chunk to trim the knitr context from the backtraces: + + ``` + options( + rlang_trace_top_env = environment() + ) + ``` + + This change replaces an ad hoc mechanism that caused bugs in corner + cases (#1205). + +* The `rlang_trace_top_env` global option for `trace_back()` now + detects when backtraces are created within knitr. If the option is + not set, its default value becomes `knitr::knit_global()` when knitr + is in progress (as determined from `knitr.in.progress` global + option). This prevents the knitr evaluation context from appearing + in the backtraces (#932). + +* Namespace changes are now emboldened in backtraces (#946). + +* Functions defined in the global environments or in local execution + environments are now displayed with a space separator in backtraces + instead of `::` and `:::`. This avoids making it seem like these + frame calls are valid R code ready to be typed in (#902). + +* Backtraces no longer contain inlined objects to avoid performance + issues in edge cases (#1069, r-lib/testthat#1223). + +* External backtraces in error chains are now separately displayed (#1098). + +* Trace capture now better handles wrappers of calling handler in case + of rethrown chained errors. + +* Backtraces now print dangling srcrefs (#1206). Paths are shortened + to show only three components (two levels of folder and the file). + +* The root symbol in backtraces is now slightly different so that it + can't be confused with a prompt character (#1207). + + +### Argument intake + +* `arg_match()` gains a `multiple` argument for cases where zero or + several matches are allowed (#1281). + +* New function `check_required()` to check that an argument is + supplied. It produces a more friendly error message than `force()` + (#1118). + +* `check_dots_empty()`, `check_dots_used()`, and + `check_dots_unnamed()` have been moved from ellipsis to rlang. The + ellipsis package is deprecated and will eventually be archived. + + We have added `check_dots_empty0()`. It has a different UI but is + almost as efficient as checking for `missing(...)`. Use this in very + low level functions where a couple microseconds make a difference. + +* The `arg_nm` argument of `arg_match0()` must now be a string or + symbol. + +* `arg_match()` now mentions the supplied argument (#1113). + +* `is_installed()` and `check_installed()` gain a `version` argument (#1165). + +* `check_installed()` now consults the + `rlib_restart_package_not_found` global option to determine whether + to prompt users to install packages. This also disables the restart + mechanism (see below). + +* `check_installed()` now signals errors of class + `rlib_error_package_not_found` with a + `rlib_restart_package_not_found` restart. This allows calling + handlers to install the required packages and restart the check + (#1150). + +* `is_installed()` and `check_installed()` now support + DESCRIPTION-style version requirements like `"rlang (>= 1.0)"`. + They also gain `version` and `compare` arguments to supply requirements + programmatically. + +* `check_installed()` gains an `action` argument that is called when + the user chooses to install and update missing and outdated packages. + +* New `check_exclusive()` function to check that only one argument of + a set is supplied (#1261). + + +### R APIs + +* `on_load()` and `run_on_load()` lets you run `.onLoad()` expressions + from any file of your package. `on_package_load()` runs expressions + when another package is loaded. (#1284) + +* The new predicate `is_call_simple()` indicates whether a call has a + name and/or a namespace. It provides two invariants: + + - If `is_call_simple(x)` is `TRUE`, `call_name()` always returns a + string. + + - If `is_call_simple(x, ns = TRUE)` is `TRUE`, `call_ns()` always + returns a string. + +* `call_name()` and `call_ns()` now return `NULL` with calls of the + form `foo::bar` (#670). + +* New `current_call()`, `caller_call()`, and `frame_call()` + accessors. New `frame_fn()` accessor. + +* `env_has()` and the corresponding C-level function no longer force + active bindings (#1292). + +* New `names2<-` replacement function that never adds missing values + when names don't have names (#1301). + +* `zap_srcref()` now preserves attributes of closures. + +* Objects headers (as printed by `last_error()`, `env_print()`, ...) + are now formatted using the `cls` class of the cli package. + +* `as_function()` gains `arg` and `call` arguments to provide + contextual information about erroring inputs. + +* `is_expression()` now returns `FALSE` for manually constructed + expressions that cannot be created by the R parser. + +* New C callable `rlang_env_unbind()`. This is a wrapper around + `R_removeVarFromFrame()` on R >= 4.0.0. On older R this wraps the R + function `base::rm()`. Unlike `rm()`, this function does not warn + (nor throw) when a binding does not exist. + +* `friendly_type_of()` now supports missing arguments. + +* `env_clone()` now properly clones active bindings and avoids forcing + promises (#1228). On R < 4.0, promises are still forced. + +* Fixed an `s3_register()` issue when the registering package is a + dependency of the package that exports the generic (#1225). + +* Added `compat-vctrs.R` file for robust manipulation of data frames + in zero-deps packages. + +* Added `compat-cli.R` file to format message elements consistently + with cli in zero-deps packages. + +* `compat-purrr.R` now longer includes `pluck*` helpers; these used a defintion + of pluck that predated purrr (#1159). `*_cpl()` has also been removed. + The `map*` wrappers now call `as_function()` so that you can pass short + anonymous functions that use `~` (#1157). + +* `exprs_auto_name()` gains a `repair_auto` argument to make automatic + names unique (#1116). + +* The `.named` argument of `dots_list()` can now be set to `NULL` to + give the result default names. With this option, fully unnamed + inputs produce a fully unnamed result with `NULL` names instead of a + character vector of minimal `""` names (#390). + +* `is_named2()` is a variant of `is_named()` that always returns + `TRUE` for empty vectors (#191). It tests for the property that each + element of a vector is named rather than the presence of a `names` + attribute. + +* New `rlib_bytes` class imported from the bench package (#1117). + It prints and parses human-friendly sizes. + +* The `env` argument of `as_function()` now defaults to the global + environment. Its previous default was the caller of `as_function()`, + which was rarely the correct environment to look in. Since it's hard + to remember to pass the user environment and it's sometimes tricky + to keep track of it, it's best to consider string lookup as a + convenience for end users, not for developers (#1170). + +* `s3_register()` no longer fails when generic does not exist. This + prevents failures when users don't have all the last versions of + packages (#1112). + +* Formulas are now deparsed according to the tidyverse style guide + (`~symbol` without space and `~ expression()` with a space). + +* New `hash_file()`, complementing `hash()`, to generate 128-bit hashes for + the data within a file without loading it into R (#1134). + +* New `env_cache()` function to retrieve a value or create it with a + default if it doesn't exist yet (#1081). + +* `env_get()` and `env_get_list()` gain a `last` argument. Lookup + stops in that environment. This can be useful in conjunction with + `base::topenv()`. + +* New `call_match()` function. It is like `match.call()` but also + supports matching missing arguments to their defaults in the function + definition (#875). + + `call_standardise()` is deprecated in favour of `call_match()`. + +* `expr_deparse()` now properly escapes `\` characters in symbols, + argument names, and vector names (#1160). + +* `friendly_type_of()` (from `compat-friendly-type.R`) now supports + matrices and arrays (#141). + +* Updated `env_print()` to use `format_error_bullets()` and consistent + tidyverse style (#1154). + +* `set_names()` now recycles names of size 1 to the size of the input, + following the tidyverse recycling rules. + +* `is_bare_formula()` now handles the `scoped` argument + consistently. The default has been changed to `TRUE` for + compatibility with the historical default behaviour (#1115). + +* The "definition" API (`dots_definitions()` etc.) has been archived. + +* New `is_complex()` predicates to complete the family (#1127). + +* The C function `r_obj_address()` now properly prefixes addresses + with the hexadecimal prefix `0x` on Windows (#1135). + +* `obj_address()` is now exported. + +* `%<~%` now actually works. + +* `XXH3_64bits()` from the XXHash library is now exposed as C callable + under the name `rlang_xxh3_64bits()`. + + +# rlang 0.4.12 + +* Fix for CRAN checks. + + +# rlang 0.4.11 + +* Fix for CRAN checks. + +* Fixed a gcc11 warning related to `hash()` (#1088). + + +# rlang 0.4.10 + +* New `hash()` function to generate 128-bit hashes for arbitrary R objects + using the xxHash library. The implementation is modeled after + [xxhashlite](https://github.com/coolbutuseless/xxhashlite), created + by @coolbutuseless. + +* New `check_installed()` function. Unlike `is_installed()`, it asks + the user whether to install missing packages. If the user accepts, + the packages are installed with `pak::pkg_install()` if available, + or `utils::install.packages()` otherwise. If the session is non + interactive or if the user chooses not to install the packages, the + current evaluation is aborted (#1075). + +* rlang is now licensed as MIT (#1063). + +* Fixed an issue causing extra empty lines in `inform()` messages with + `.frequency` (#1076, @schloerke). + +* `expr_deparse()` now correctly wraps code using `::` and `:::` + (#1072, @krlmlr). + + +# rlang 0.4.9 + +## Breaking changes + +* Dropped support for the R 3.2 series. + + +## New features + +* `inject()` evaluates its argument with `!!`, `!!!`, and `{{` + support. + +* New `enquo0()` and `enquos0()` operators for defusing function + arguments without automatic injection (unquotation). + +* `format_error_bullets()` is no longer experimental. The `message` + arguments of `abort()`, `warn()`, and `inform()` are automatically + passed to that function to make it easy to create messages with + regular, info, and error bullets. See `?format_error_bullets` for + more information. + +* New `zap_srcref()` function to recursively remove source references + from functions and calls. + +* A new compat file for the zeallot operator `%<-%` is now available + in the rlang repository. + +* New `%<~%` operator to define a variable lazily. + +* New `env_browse()` and `env_is_browsed()` functions. `env_browse()` + is equivalent to evaluating `browser()` within an environment. It + sets the environment to be persistently browsable (or unsets it if + `value = FALSE` is supplied). + +* Functions created from quosures with `as_function()` now print in a + more user friendly way. + +* New `rlang_print_backtrace` C callable for debugging from C + interpreters (#1059). + + +## Bugfixes and improvements + +* The `.data` pronoun no longer skips functions (#1061). This solves a + dplyr issue involving rowwise data frames and list-columns of + functions (tidyverse/dplyr#5608). + +* `as_data_mask()` now intialises environments of the correct size to + improve efficiency (#1048). + +* `eval_bare()`, `eval_tidy()` (#961), and `with_handlers()` (#518) + now propagate visibility. + +* `cnd_signal()` now ignores `NULL` inputs. + +* Fixed bug that prevented splicing a named empty vector with the + `!!!` operator (#1045). + +* The exit status of is now preserved in non-interactive sessions when + `entrace()` is used as an `options(error = )` handler (#1052, + rstudio/bookdown#920). + +* `next` and `break` are now properly deparsed as nullary operators. + + +# rlang 0.4.8 + +* Backtraces now include native stacks (e.g. from C code) when the + [winch](https://r-prof.github.io/winch/) package is installed and + `rlang_trace_use_winch` is set to `TRUE` (@krlmlr). + +* Compatibility with upcoming testthat 3 and magrittr 2 releases. + +* `get_env()` now returns the proper environment with primitive + functions, i.e. the base namespace rather than the base environment + (r-lib/downlit#32). + +* `entrace()` no longer handles non-rlang errors that carry a + backtrace. This improves compatibility with packages like callr. + +* Backtraces of unhandled errors are now displayed without truncation + in non-interactive sessions (#856). + +* `is_interactive()` no longer consults "rstudio.notebook.executing" + option (#1031). + + +# rlang 0.4.7 + +* `cnd_muffle()` now returns `FALSE` instead of failing if the + condition is not mufflable (#1022). + +* `warn()` and `inform()` gain a `.frequency` argument to control how + frequently the warning or message should be displayed. + +* New `raw_deparse_str()` function for converting a raw vector into a + string of hexadecimal characters (@krlmlr, #978). + +* The backtraces of chained errors are no longer decomposed by error + context. Instead, the error messages are displayed as a tree to + reflect the error ancestry, and the deepest backtrace in the ancestry + is displayed. + + This change simplifies the display (#851) and makes it possible to + rethow errors from a calling handler rather than an exiting handler, + which we now think is more appropriate because it allows users to + `recover()` into the error. + +* `env_bind()`, `env_bind_active()`, `env_bind_lazy()`, `env_get()`, + and `env_get_list()` have been rewritten in C. + +* `env_poke()` now supports `zap()` sentinels for removing bindings + (#1012) and has better support for characters that are not + representable in the local encoding. + +* `env_poke()` has been rewritten in C for performance. + +* The unicode translation warnings that appeared on Windows with R 4.0 + are now fixed. + +* `env_unbind(inherit = TRUE)` now only removes a binding from the + first parent environment that has a binding. It used to remove the + bindings from the whole ancestry. The new behaviour doesn't + guarantee that a scope doesn't have a binding but it is safer. + +* `env_has()` is now rewritten in C for performance. + +* `dots_list()` gains a `.named` argument for auto-naming dots (#957). + +* It is now possible to subset the `.data` pronoun with quosured + symbols or strings (#807). + +* Expressions like `quote(list("a b" = 1))` are now properly deparsed + by `expr_deparse()` (#950). + +* `parse_exprs()` now preserves names (#808). When a single string + produces multiple expressions, the names may be useful to figure out + what input produced which expression. + +* `parse_exprs()` now supports empty expressions (#954). + +* `list2(!!!x)` no longer evaluates `x` multiple times (#981). + +* `is_installed()` now properly handles a `pkg` argument of length > 1. + Before this it silently tested the first element of `pkg` only + and thus always returned `TRUE` if the first package was installed + regardless of the actual length of `pkg`. (#991, @salim-b) + +* `arg_match0()` is a faster version of `arg_match()` for use when performance + is at a premium (#997, @krlmlr). + + +# rlang 0.4.6 + +* `!!!` now uses a combination of `length()`, `names()`, and `[[` to splice + S3 and S4 objects. This produces more consistent behaviour than `as.list()` + on a wider variety of vector classes (#945, tidyverse/dplyr#4931). + + +# rlang 0.4.5 + +* `set_names()`, `is_formula()`, and `names2()` are now implemented in + C for efficiency. + +* The `.data` pronoun now accepts symbol subscripts (#836). + +* Quosure lists now explicitly inherit from `"list"`. This makes them + compatible with the vctrs package (#928). + +* All rlang options are now documented in a centralised place, see + `?rlang::faq-options` (#899, @smingerson). + +* Fixed crash when `env_bindings_are_lazy()` gets improper arguments (#923). + +* `arg_match()` now detects and suggests possible typos in provided + arguments (@jonkeane, #798). + +* `arg_match()` now gives an error if argument is of length greater + than 1 and doesn't exactly match the values input, similar to base + `match.arg` (#914, @AliciaSchep) + + +# rlang 0.4.4 + +* Maintenance release for CRAN. + + +# rlang 0.4.3 + +* You can now use glue syntax to unquote on the LHS of `:=`. This + syntax is automatically available in all functions taking dots with + `list2()` and `enquos()`, and thus most of the tidyverse. Note that + if you use the glue syntax in an R package, you need to import glue. + + A single pair of braces triggers normal glue interpolation: + + ```r + df <- data.frame(x = 1:3) + + suffix <- "foo" + df %>% dplyr::mutate("var_{suffix}" := x * 2) + #> x var_foo + #> 1 1 2 + #> 2 2 4 + #> 3 3 6 + ``` + + Using a pair of double braces is for labelling a function argument. + Technically, this is shortcut for `"{as_label(enquo(arg))}"`. The + syntax is similar to the curly-curly syntax for interpolating + function arguments: + + ```r + my_wrapper <- function(data, var, suffix = "foo") { + data %>% dplyr::mutate("{{ var }}_{suffix}" := {{ var }} * 2) + } + df %>% my_wrapper(x) + #> x x_foo + #> 1 1 2 + #> 2 2 4 + #> 3 3 6 + + df %>% my_wrapper(sqrt(x)) + #> x sqrt(x)_foo + #> 1 1 2.000000 + #> 2 2 2.828427 + #> 3 3 3.464102 + ``` + +* Fixed a bug in magrittr backtraces that caused duplicate calls to + appear in the trace. + +* Fixed a bug in magrittr backtraces that caused wrong call indices. + +* Empty backtraces are no longer shown when `rlang_backtrace_on_error` + is set. + +* The tidy eval `.env` pronoun is now exported for documentation + purposes. + +* `warn()` and `abort()` now check that either `class` or `message` + was supplied. `inform()` allows sending empty message as it is + occasionally useful for building user output incrementally. + +* `flatten()` fails with a proper error when input can't be flattened (#868, #885). + +* `inform()` now consistently appends a final newline to the message + (#880). + +* `cnd_body.default()` is now properly registered. + +* `cnd_signal()` now uses the same approach as `abort()` to save + unhandled errors to `last_error()`. + +* Parsable constants like `NaN` and `NA_integer_` are now deparsed by + `expr_deparse()` in their parsable form (#890). + +* Infix operators now stick to their LHS when deparsed by + `expr_deparse()` (#890). + + +# rlang 0.4.2 + +* New `cnd_header()`, `cnd_body()` and `cnd_footer()` generics. These + are automatically called by `conditionMessage.rlang_error()`, the + default method for all rlang errors. + + Concretely, this is a way of breaking up lazy generation of error + messages with `conditionMessage()` into three independent + parts. This provides a lot of flexibility for hierarchies of error + classes, for instance you could inherit the body of an error message + from a parent class while overriding the header and footer. + +* The reminder to call `last_error()` is now less confusing thanks to + a suggestion by @markhwhiteii. + +* The functions prefixed in `scoped_` have been renamed to use the + more conventional `local_` prefix. For instance, `scoped_bindings()` + is now `local_bindings()`. The `scoped_` functions will be + deprecated in the next significant version of rlang (0.5.0). + +* The `.subclass` argument of `abort()`, `warn()` and `inform()` has + been renamed to `class`. This is for consistency with our + conventions for class constructors documented in + https://adv-r.hadley.nz/s3.html#s3-subclassing. + +* `inform()` now prints messages to the standard output by default in + interactive sessions. This makes them appear more like normal output + in IDEs such as RStudio. In non-interactive sessions, messages are + still printed to standard error to make it easy to redirect messages + when running R scripts (#852). + +* Fixed an error in `trace_back()` when the call stack contains a + quosured symbol. + +* Backtrace is now displayed in full when an error occurs in + non-interactive sessions. Previously the backtraces of parent errors + were left out. + + +# rlang 0.4.1 + +* New experimental framework for creating bulleted error messages. See + `?cnd_message` for the motivation and an overwiew of the tools we + have created to support this approach. In particular, `abort()` now + takes character vectors to assemble a bullet list. Elements named + `x` are prefixed with a red cross, elements named `i` are prefixed + with a blue info symbol, and unnamed elements are prefixed with a + bullet. + +* Capture of backtrace in the context of rethrowing an error from an + exiting handler has been improved. The `tryCatch()` context no + longer leaks in the high-level backtrace. + +* Printing an error no longer recommends calling `last_trace()`, + unless called from `last_error()`. + +* `env_clone()` no longer recreates active bindings and is now just an + alias for `env2list(as.list(env))`. Unlike `as.list()` which returns + the active binding function on R < 4.0, the value of active bindings + is consistently used in all versions. + +* The display of rlang errors derived from parent errors has been + improved. The simplified backtrace (as printed by + `rlang::last_error()`) no longer includes the parent errors. On the + other hand, the full backtrace (as printed by `rlang::last_trace()`) + now includes the backtraces of the parent errors. + +* `cnd_signal()` has improved support for rlang errors created with + `error_cnd()`. It now records a backtrace if there isn't one + already, and saves the error so it can be inspected with + `rlang::last_error()`. + +* rlang errors are no longer formatted and saved through + `conditionMessage()`. This makes it easier to use a + `conditionMessage()` method in subclasses created with `abort()`, + which is useful to delay expensive generation of error messages + until display time. + +* `abort()` can now be called without error message. This is useful + when `conditionMessage()` is used to generate the message at + print-time. + +* Fixed an infinite loop in `eval_tidy()`. It occurred when evaluating + a quosure that inherits from the mask itself. + +* `env_bind()`'s performance has been significantly improved by fixing a bug + that caused values to be repeatedly looked up by name. + +* `cnd_muffle()` now checks that a restart exists before invoking + it. The restart might not exist if the condition is signalled with a + different function (such as `stop(warning_cnd)`). + +* `trace_length()` returns the number of frames in a backtrace. + +* Added internal utility `cnd_entrace()` to add a backtrace to a + condition. + +* `rlang::last_error()` backtraces are no longer displayed in red. + +* `x %|% y` now also works when `y` is of same length as `x` (@rcannood, #806). + +* Empty named lists are now deparsed more explicitly as + `""`. + +* Fixed `chr()` bug causing it to return invisibly. + + +# rlang 0.4.0 + +## Tidy evaluation + +### Interpolate function inputs with the curly-curly operator + +The main change of this release is the new tidy evaluation operator +`{{`. This operator abstracts the quote-and-unquote idiom into a +single interpolation step: + +``` +my_wrapper <- function(data, var, by) { + data %>% + group_by({{ by }}) %>% + summarise(average = mean({{ var }}, na.rm = TRUE)) +} +``` + +`{{ var }}` is a shortcut for `!!enquo(var)` that should be easier on +the eyes, and easier to learn and teach. + +Note that for multiple inputs, the existing documentation doesn't +stress enough that you can just pass dots straight to other tidy eval +functions. There is no need for quote-and-unquote unless you need to +modify the inputs or their names in some way: + +``` +my_wrapper <- function(data, var, ...) { + data %>% + group_by(...) %>% + summarise(average = mean({{ var }}, na.rm = TRUE)) +} +``` + + +### More robust `.env` pronoun + +Another improvement to tidy evaluation should make it easier to use +the `.env` pronoun. Starting from this release, subsetting an object +from the `.env` pronoun now evaluates the corresponding symbol. This +makes `.env` more robust, in particular in magrittr pipelines. The +following example would previously fail: + +``` +foo <- 10 +mtcars %>% mutate(cyl = cyl * .env$foo) +``` + +This way, using the `.env` pronoun is now equivalent to unquoting a +constant objects, but with an easier syntax: + +``` +mtcars %>% mutate(cyl = cyl * !!foo) +``` + +Note that following this change, and despite its name, `.env` is no +longer referring to a bare environment. Instead, it is a special +shortcut with its own rules. Similarly, the `.data` pronoun is not +really a data frame. + + +## New functions and features + +* New `pairlist2()` function with splicing support. It preserves + missing arguments, which makes it useful for lists of formal + parameters for functions. + +* `is_bool()` is a scalar type predicate that checks whether its input + is a single `TRUE` or `FALSE`. Like `is_string()`, it returns + `FALSE` when the input is missing. This is useful for type-checking + function arguments (#695). + +* `is_string()` gains a `string` argument. `is_string(x, "foo")` is a + shortcut for `is_character(x) && length(x) == 1 && identical(x, + "foo")`. + +* Lists of quosures now have pillar methods for display in tibbles. + +* `set_names()` now names unnamed input vectors before applying a + function. The following expressions are now equivalent: + + ``` + letters %>% set_names() %>% set_names(toupper) + + letters %>% set_names(toupper) + ``` + +* You can now pass a character vector as message argument for + `abort()`, `warn()`, `inform()`, and `signal()`. The vector is + collapsed to a single string with a `"\n"` newline separating each + element of the input vector (#744). + +* `maybe_missing()` gains a `default` argument. + +* New functions for weak references: `new_weakref()`, `weakref_key()`, + `weakref_value()`, and `is_weakref()` (@wch, #787). + + +## Performance + +* The performance of `exec()` has been improved. It is now on the same + order of performance as `do.call()`, though slightly slower. + +* `call2()` now uses the new `pairlist2()` function internally. This + considerably improves its performance. This also means it now + preserves empty arguments: + + ``` + call2("fn", 1, , foo = ) + #> fn(1, , foo = ) + ``` + + +## Bugfixes and small improvements + +* `with_handlers()` now installs calling handlers first on the stack, + no matter their location in the argument list. This way they always + take precedence over exiting handlers, which ensures their side + effects (such as logging) take place (#718). + +* In rlang backtraces, the `global::` prefix is now only added when + the function directly inherits from the global environment. + Functions inheriting indirectly no longer have a namespace + qualifier (#733). + +* `options(error = rlang::entrace)` now has better support for errors + thrown from C (#779). It also saves structured errors in the `error` + field of `rlang::last_error()`. + +* `ns_env()` and `ns_env_name()` (experimental functions) now support + functions and environments consisently. They also require an + argument from now on. + +* `is_interactive()` is aware of the `TESTTHAT` environment variable and + returns `FALSE` when it is `"true"` (@jennybc, #738). + +* `fn_fmls()` and variants no longer coerce their input to a + closure. Instead, they throw an error. + +* Fixed an issue in knitr that caused backtraces to print even when `error = TRUE`. + +* The return object from `as_function()` now inherits from + `"function"` (@richierocks, #735). + + +## Lifecycle + +We commit to support 5 versions of R. As R 3.6 is about to be +released, rlang now requires R 3.2 or greater. We're also continuing +our efforts to streamline and narrow the rlang API. + +* `modify()` and `prepend()` (two experimental functions marked as in + the questioning stage since rlang 0.3.0) are now deprecated. Vector + functions are now out of scope for rlang. They might be revived in + the vctrs or funs packages. + +* `exiting()` is soft-deprecated because `with_handlers()` treats + handlers as exiting by default. + +* The vector constructors like `lgl()` or `new_logical()` are now in + the questioning stage. They are likely to be moved to the vctrs + package at some point. Same for the missing values shortcuts like + `na_lgl`. + +* `as_logical()`, `as_integer()`, etc have been soft-deprecated in + favour of `vctrs::vec_cast()`. + +* `type_of()`, `switch_type()`, `coerce_type()`, and friends are + soft-deprecated. + +* The encoding and locale API was summarily archived. This API didn't + bring any value and wasn't used on CRAN. + +* `lang_type_of()`, `switch_lang()`, and `coerce_lang()` were + archived. These functions were not used on CRAN or internally. + +* Subsetting quosures with `[` or `[[` is soft-deprecated. + +* All functions that were soft-deprecated, deprecated, or defunct in + previous releases have been bumped to the next lifecycle stage. + + +# rlang 0.3.2 + +* Fixed protection issue reported by rchk. + +* The experimental option `rlang__backtrace_on_error` is no longer + experimental and has been renamed to `rlang_backtrace_on_error`. + +* New "none" option for `rlang_backtrace_on_error`. + +* Unary operators applied to quosures now give better error messages. + +* Fixed issue with backtraces of warnings promoted to error, and + entraced via `withCallingHandlers()`. The issue didn't affect + entracing via top level `options(error = rlang::entrace)` handling. + + +# rlang 0.3.1 + +This patch release polishes the new backtrace feature introduced in +rlang 0.3.0 and solves bugs for the upcoming release of purrr +0.3.0. It also features `as_label()` and `as_name()` which are meant +to replace `quo_name()` in the future. Finally, a bunch of deparsing +issues have been fixed. + + +## Backtrace fixes + +* New `entrace()` condition handler. Add this to your RProfile to + enable rlang backtraces for all errors, including warnings promoted + to errors: + + ```r + if (requireNamespace("rlang", quietly = TRUE)) { + options(error = rlang::entrace) + } + ``` + + This handler also works as a calling handler: + + ```r + with_handlers( + error = calling(entrace), + foo(bar) + ) + ``` + + However it's often more practical to use `with_abort()` in that case: + + ```r + with_abort(foo(bar)) + ``` + +* `with_abort()` gains a `classes` argument to promote any kind of + condition to an rlang error. + +* New `last_trace()` shortcut to print the backtrace stored in the + `last_error()`. + +* Backtrace objects now print in full by default. + +* Calls in backtraces are now numbered according to their position in + the call tree. The numbering is non-contiguous for simplified + backtraces because of omitted call frames. + +* `catch_cnd()` gains a `classes` argument to specify which classes of + condition to catch. It returns `NULL` if the expected condition + could not be caught (#696). + + +## `as_label()` and `as_name()` + +The new `as_label()` and `as_name()` functions should be used instead +of `quo_name()` to transform objects and quoted expressions to a +string. We have noticed that tidy eval users often use `quo_name()` to +extract names from quosured symbols. This is not a good use for that +function because the way `quo_name()` creates a string is not a well +defined operation. + +For this reason, we are replacing `quo_name()` with two new functions +that have more clearly defined purposes, and hopefully better names +reflecting those purposes. Use `as_label()` to transform any object to +a short human-readable description, and `as_name()` to extract names +from (possibly quosured) symbols. + +Create labels with `as_label()` to: + +* Display an object in a concise way, for example to labellise axes + in a graphical plot. + +* Give default names to columns in a data frame. In this case, + labelling is the first step before name repair. + +We expect `as_label()` to gain additional parameters in the future, +for example to control the maximum width of a label. The way an object +is labelled is thus subject to change. + +On the other hand, `as_name()` transforms symbols back to a string in +a well defined manner. Unlike `as_label()`, `as_name()` guarantees the +roundtrip symbol -> string -> symbol. + +In general, if you don't know for sure what kind of object you're +dealing with (a call, a symbol, an unquoted constant), use +`as_label()` and make no assumption about the resulting string. If you +know you have a symbol and need the name of the object it refers to, +use `as_name()`. For instance, use `as_label()` with objects captured +with `enquo()` and `as_name()` with symbols captured with `ensym()`. + +Note that `quo_name()` will only be soft-deprecated at the next major +version of rlang (0.4.0). At this point, it will start issuing +once-per-session warnings in scripts, but not in packages. It will +then be deprecated in yet another major version, at which point it +will issue once-per-session warnings in packages as well. You thus +have plenty of time to change your code. + + +## Minor fixes and features + +* New `is_interactive()` function. It serves the same purpose as + `base::interactive()` but also checks if knitr is in progress and + provides an escape hatch. Use `with_interactive()` and + `scoped_interactive()` to override the return value of + `is_interactive()`. This is useful in unit tests or to manually turn + on interactive features in RMarkdown outputs + +* `calling()` now boxes its argument. + +* New `done()` function to box a value. Done boxes are sentinels to + indicate early termination of a loop or computation. For instance, + it will be used in the purrr package to allow users to shortcircuit + a reduction or accumulation. + +* `new_box()` now accepts additional attributes passed to `structure()`. + +* Fixed a quotation bug with binary operators of zero or one argument + such as `` `/`(1) `` (#652). They are now deparsed and printed + properly as well. + +* New `call_ns()` function to retrieve the namespace of a + call. Returns `NULL` if the call is not namespaced. + +* Top-level S3 objects are now deparsed properly. + +* Empty `{` blocks are now deparsed on the same line. + +* Fixed a deparsing issue with symbols containing non-ASCII + characters (#691). + +* `expr_print()` now handles `[` and `[[` operators correctly, and + deparses non-syntactic symbols with backticks. + +* `call_modify()` now respects ordering of unnamed inputs. Before this + fix, it would move all unnamed inputs after named ones. + +* `as_closure()` wrappers now call primitives with positional + arguments to avoid edge case issues of argument matching. + +* `as_closure()` wrappers now dispatch properly on methods defined in + the global environment (tidyverse/purrr#459). + +* `as_closure()` now supports both base-style (`e1` and `e2`) and + purrr-style (`.x` and `.y`) arguments with binary primitives. + +* `exec()` takes `.fn` as first argument instead of `f`, for + consistency with other rlang functions. + +* Fixed infinite loop with quosures created inside a data mask. + +* Base errors set as `parent` of rlang errors are now printed + correctly. + + + +# rlang 0.3.0 + +## Breaking changes + +The rlang API is still maturing. In this section, you'll find hard +breaking changes. See the life cycle section below for an exhaustive +list of API changes. + +* `quo_text()` now deparses non-syntactic symbols with backticks: + + ``` + quo_text(sym("foo+")) + #> [1] "`foo+`" + ``` + + This caused a number of issues in reverse dependencies as + `quo_text()` tends to be used for converting symbols to strings. + `quo_text()` and `quo_name()` should not be used for this purpose + because they are general purpose deparsers. These functions should + generally only be used for printing outputs or creating default + labels. If you need to convert symbols to strings, please use + `as_string()` rather than `quo_text()`. + + We have extended the documentation of `?quo_text` and `?quo_name` to + make these points clearer. + +* `exprs()` no longer flattens quosures. `exprs(!!!quos(x, y))` is now + equivalent to `quos(x, y)`. + +* The sentinel for removing arguments in `call_modify()` has been + changed from `NULL` to `zap()`. This breaking change is motivated + by the ambiguity of `NULL` with valid argument values. + + ```r + call_modify(call, arg = NULL) # Add `arg = NULL` to the call + call_modify(call, arg = zap()) # Remove the `arg` argument from the call + ``` + +* The `%@%` operator now quotes its input and supports S4 objects. + This makes it directly equivalent to `@` except that it extracts + attributes for non-S4 objects (#207). + +* Taking the `env_parent()` of the empty environment is now an error. + + +## Summary + +The changes for this version are organised around three main themes: +error reporting, tidy eval, and tidy dots. + +* `abort()` now records backtraces automatically in the error object. + Errors thrown with `abort()` invite users to call + `rlang::last_error()` to see a backtrace and help identifying where + and why the error occurred. The backtraces created by rlang (you can + create one manually with `trace_back()`) are printed in a simplified + form by default that removes implementation details from the + backtrace. To see the full backtrace, call + `summary(rlang::last_error())`. + + `abort()` also gains a `parent` argument. This is meant for + situations where you're calling a low level API (to download a file, + parse a JSON file, etc) and would like to intercept errors with + `base::tryCatch()` or `rlang::with_handlers()` and rethrow them with + a high-level message. Call `abort()` with the intercepted error as + the `parent` argument. When the user prints `rlang::last_error()`, + the backtrace will be shown in two sections corresponding to the + high-level and low-level contexts. + + In order to get segmented backtraces, the low-level error has to be + thrown with `abort()`. When that's not the case, you can call the + low-level function within `with_abort()` to automatically promote + all errors to rlang errors. + +* The tidy eval changes are mostly for developers of data masking + APIs. The main user-facing change is that `.data[[` is now an + unquote operator so that `var` in `.data[[var]]` is never masked by + data frame columns and always picked from the environment. This + makes the pronoun safe for programming in functions. + +* The `!!!` operator now supports all classed objects like factors. It + calls `as.list()` on S3 objects and `as(x, "list")` on S4 objects. + +* `dots_list()` gains several arguments to control how dots are + collected. You can control the selection of arguments with the same + name with `.homonyms` (keep first, last, all, or abort). You can + also elect to preserve empty arguments with `.preserve_empty`. + + +## Conditions and errors + +* New `trace_back()` captures a backtrace. Compared to the base R + traceback, it contains additional structure about the relationship + between frames. It comes with tools for automatically restricting to + frames after a certain environment on the stack, and to simplify + when printing. These backtraces are now recorded in errors thrown by + `abort()` (see below). + +* `abort()` gains a `parent` argument to specify a parent error. This + is meant for situations where a low-level error is expected + (e.g. download or parsing failed) and you'd like to throw an error + with higher level information. Specifying the low-level error as + parent makes it possible to partition the backtraces based on + ancestry. + +* Errors thrown with `abort()` now embed a backtrace in the condition + object. It is no longer necessary to record a trace with a calling + handler for such errors. + +* `with_abort()` runs expressions in a context where all errors are + promoted to rlang errors and gain a backtrace. + +* Unhandled errors thrown by `abort()` are now automatically saved and + can be retrieved with `rlang::last_error()`. The error prints with a + simplified backtrace. Call `summary(last_error())` to see the full + backtrace. + +* New experimental option `rlang__backtrace_on_error` to display + backtraces alongside error messages. See `?rlang::abort` for + supported options. + +* The new `signal()` function completes the `abort()`, `warn()` and + `inform()` family. It creates and signals a bare condition. + +* New `interrupt()` function to simulate an user interrupt from R + code. + +* `cnd_signal()` now dispatches messages, warnings, errors and + interrupts to the relevant signalling functions (`message()`, + `warning()`, `stop()` and the C function `Rf_onintr()`). This makes + it a good choice to resignal a captured condition. + +* New `cnd_type()` helper to determine the type of a condition + (`"condition"`, `"message"`, `"warning"`, `"error"` or `"interrupt"`). + +* `abort()`, `warn()` and `inform()` now accepts metadata with `...`. + The data are stored in the condition and can be examined by user + handlers. + + Consequently all arguments have been renamed and prefixed with a dot + (to limit naming conflicts between arguments and metadata names). + +* `with_handlers()` treats bare functions as exiting handlers + (equivalent to handlers supplied to `tryCatch()`). It also supports + the formula shortcut for lambda functions (as in purrr). + +* `with_handlers()` now produces a cleaner stack trace. + + +## Tidy dots + +* The input types of `!!!` have been standardised. `!!!` is generally + defined on vectors: it takes a vector (typically, a list) and + unquotes each element as a separate argument. The standardisation + makes `!!!` behave the same in functions taking dots with `list2()` + and in quoting functions. `!!!` accepts these types: + + - Lists, pairlists, and atomic vectors. If they have a class, they + are converted with `base::as.list()` to allow S3 dispatch. + Following this change, objects like factors can now be spliced + without data loss. + + - S4 objects. These are converted with `as(obj, "list")` before + splicing. + + - Quoted blocks of expressions, i.e. `{ }` calls + + `!!!` disallows: + + - Any other objects like functions or environments, but also + language objects like formula, symbols, or quosures. + + Quoting functions used to automatically wrap language objects in + lists to make them spliceable. This behaviour is now soft-deprecated + and it is no longer valid to write `!!!enquo(x)`. Please unquote + scalar objects with `!!` instead. + +* `dots_list()`, `enexprs()` and `enquos()` gain a `.homonyms` + argument to control how to treat arguments with the same name. + The default is to keep them. Set it to `"first"` or `"last"` to keep + only the first or last occurrences. Set it to `"error"` to raise an + informative error about the arguments with duplicated names. + +* `enexprs()` and `enquos()` now support `.ignore_empty = "all"` + with named arguments as well (#414). + +* `dots_list()` gains a `.preserve_empty` argument. When `TRUE`, empty + arguments are stored as missing arguments (see `?missing_arg`). + +* `dots_list()`, `enexprs()` and `enquos()` gain a `.check_assign` + argument. When `TRUE`, a warning is issued when a `<-` call is + detected in `...`. No warning is issued if the assignment is wrapped + in brackets like `{ a <- 1 }`. The warning lets users know about a + possible typo in their code (assigning instead of matching a + function parameter) and requires them to be explicit that they + really want to assign to a variable by wrapping in parentheses. + +* `lapply(list(quote(foo)), list2)` no longer evaluates `foo` (#580). + + +## Tidy eval + +* You can now unquote quosured symbols as LHS of `:=`. The symbol is + automatically unwrapped from the quosure. + +* Quosure methods have been defined for common operations like + `==`. These methods fail with an informative error message + suggesting to unquote the quosure (#478, #tidyverse/dplyr#3476). + +* `as_data_pronoun()` now accepts data masks. If the mask has multiple + environments, all of these are looked up when subsetting the pronoun. + Function objects stored in the mask are bypassed. + +* It is now possible to unquote strings in function position. This is + consistent with how the R parser coerces strings to symbols. These + two expressions are now equivalent: `expr("foo"())` and + `expr((!!"foo")())`. + +* Quosures converted to functions with `as_function()` now support + nested quosures. + +* `expr_deparse()` (used to print quosures at the console) now escapes + special characters. For instance, newlines now print as `"\n"` (#484). + This ensures that the roundtrip `parse_expr(expr_deparse(x))` is not + lossy. + +* `new_data_mask()` now throws an error when `bottom` is not a child + of `top` (#551). + +* Formulas are now evaluated in the correct environment within + `eval_tidy()`. This fixes issues in dplyr and other tidy-evaluation + interfaces. + +* New functions `new_quosures()` and `as_quosures()` to create or + coerce to a list of quosures. This is a small S3 class that ensures + two invariants on subsetting and concatenation: that each element is + a quosure and that the list is always named even if only with a + vector of empty strings. + + +## Environments + +* `env()` now treats a single unnamed argument as the parent of the + new environment. Consequently, `child_env()` is now superfluous and + is now in questioning life cycle. + +* New `current_env()` and `current_fn()` functions to retrieve the + current environment or the function being evaluated. They are + equivalent to `base::environment()` and `base::sys.function()` + called without argument. + +* `env_get()` and `env_get_list()` gain a `default` argument to + provide a default value for non-existing bindings. + +* `env_poke()` now returns the old value invisibly rather than the + input environment. + +* The new function `env_name()` returns the name of an environment. + It always adds the "namespace:" prefix to namespace names. It + returns "global" instead of ".GlobalEnv" or "R_GlobalEnv", "empty" + instead of "R_EmptyEnv". The companion `env_label()` is like + `env_name()` but returns the memory address for anonymous + environments. + +* `env_parents()` now returns a named list. The names are taken with + `env_name()`. + +* `env_parents()` and `env_tail()` now stop at the global environment + by default. This can be changed with the `last` argument. The empty + environment is always a stopping condition so you can take the + parents or the tail of an environment on the search path without + changing the default. + +* New predicates `env_binding_are_active()` and + `env_binding_are_lazy()` detect the kind of bindings in an + environment. + +* `env_binding_lock()` and `env_binding_unlock()` allows to lock and + unlock multiple bindings. The predicate `env_binding_are_locked()` + tests if bindings are locked. + +* `env_lock()` and `env_is_locked()` lock an environment or test if + an environment is locked. + +* `env_print()` pretty-prints environments. It shows the contents (up + to 20 elements) and the properties of the environment. + +* `is_scoped()` has been soft-deprecated and renamed to + `is_attached()`. It now supports environments in addition to search + names. + +* `env_bind_lazy()` and `env_bind_active()` now support quosures. + +* `env_bind_exprs()` and `env_bind_fns()` are soft-deprecated and + renamed to `env_bind_lazy()` and `env_bind_active()` for clarity + and consistency. + +* `env_bind()`, `env_bind_exprs()`, and `env_bind_fns()` now return + the list of old binding values (or missing arguments when there is + no old value). This makes it easy to restore the original + environment state: + + ``` + old <- env_bind(env, foo = "foo", bar = "bar") + env_bind(env, !!!old) + ``` + +* `env_bind()` now supports binding missing arguments and removing + bindings with zap sentinels. `env_bind(env, foo = )` binds a missing + argument and `env_bind(env, foo = zap())` removes the `foo` + binding. + +* The `inherit` argument of `env_get()` and `env_get_list()` has + changed position. It now comes after `default`. + +* `scoped_bindings()` and `with_bindings()` can now be called without + bindings. + +* `env_clone()` now recreates active bindings correctly. + +* `env_get()` now evaluates promises and active bindings since these are + internal objects which should not be exposed at the R level (#554) + +* `env_print()` calls `get_env()` on its argument, making it easier to + see the environment of closures and quosures (#567). + +* `env_get()` now supports retrieving missing arguments when `inherit` + is `FALSE`. + + +## Calls + +* `is_call()` now accepts multiple namespaces. For instance + `is_call(x, "list", ns = c("", "base"))` will match if `x` is + `list()` or if it's `base::list()`: + +* `call_modify()` has better support for `...` and now treats it like + a named argument. `call_modify(call, ... = )` adds `...` to the call + and `call_modify(call, ... = NULL)` removes it. + +* `call_modify()` now preserves empty arguments. It is no longer + necessary to use `missing_arg()` to add a missing argument to a + call. This is possible thanks to the new `.preserve_empty` option of + `dots_list()`. + +* `call_modify()` now supports removing unexisting arguments (#393) + and passing multiple arguments with the same name (#398). The new + `.homonyms` argument controls how to treat these arguments. + +* `call_standardise()` now handles primitive functions like `~` + properly (#473). + +* `call_print_type()` indicates how a call is deparsed and printed at + the console by R: prefix, infix, and special form. + +* The `call_` functions such as `call_modify()` now correctly check + that their input is the right type (#187). + + +## Other improvements and fixes + +* New function `zap()` returns a sentinel that instructs functions + like `env_bind()` or `call_modify()` that objects are to be removed. + +* New function `rep_named()` repeats value along a character vector of + names. + +* New function `exec()` is a simpler replacement to `invoke()` + (#536). `invoke()` has been soft-deprecated. + +* Lambda functions created from formulas with `as_function()` are now + classed. Use `is_lambda()` to check a function was created with the + formula shorthand. + +* `is_integerish()` now supports large double values (#578). + +* `are_na()` now requires atomic vectors (#558). + +* The operator `%@%` has now a replacement version to update + attributes of an object (#207). + +* `fn_body()` always returns a `{` block, even if the function has a + single expression. For instance `fn_body(function(x) do()) ` returns + `quote({ do() })`. + +* `is_string()` now returns `FALSE` for `NA_character_`. + +* The vector predicates have been rewritten in C for performance. + +* The `finite` argument of `is_integerish()` is now `NULL` by + default. Missing values are now considered as non-finite for + consistency with `base::is.finite()`. + +* `is_bare_integerish()` and `is_scalar_integerish()` gain a `finite` + argument for consistency with `is_integerish()`. + +* `flatten_if()` and `squash_if()` now handle primitive functions like + `base::is.list()` as predicates. + +* `is_symbol()` now accepts a character vector of names to mach the + symbol against. + +* `parse_exprs()` and `parse_quos()` now support character vectors. + Note that the output may be longer than the input as each string may + yield multiple expressions (such as `"foo; bar"`). + +* `parse_quos()` now adds the `quosures` class to its output. + + +## Lifecycle + +### Soft-deprecated functions and arguments + +rlang 0.3.0 introduces a new warning mechanism for soft-deprecated +functions and arguments. A warning is issued, but only under one of +these circumstances: + +* rlang has been attached with a `library()` call. +* The deprecated function has been called from the global environment. + +In addition, deprecation warnings appear only once per session in +order to not be disruptive. + +Deprecation warnings shouldn't make R CMD check fail for packages +using testthat. However, `expect_silent()` can transform the warning +to a hard failure. + + +#### tidyeval + +* `.data[[foo]]` is now an unquote operator. This guarantees that + `foo` is evaluated in the context rather than the data mask and + makes it easier to treat `.data[["bar"]]` the same way as a + symbol. For instance, this will help ensuring that `group_by(df, + .data[["name"]])` and `group_by(df, name)` produce the same column + name. + +* Automatic naming of expressions now uses a new deparser (still + unexported) instead of `quo_text()`. Following this change, + automatic naming is now compatible with all object types (via + `pillar::type_sum()` if available), prevents multi-line names, and + ensures `name` and `.data[["name"]]` are given the same default + name. + +* Supplying a name with `!!!` calls is soft-deprecated. This name is + ignored because only the names of the spliced vector are applied. + +* Quosure lists returned by `quos()` and `enquos()` now have "list-of" + behaviour: the types of new elements are checked when adding objects + to the list. Consequently, assigning non-quosure objects to quosure + lists is now soft-deprecated. Please coerce to a bare list with + `as.list()` beforehand. + +* `as_quosure()` now requires an explicit environment for symbols and + calls. This should typically be the environment in which the + expression was created. + +* `names()` and `length()` methods for data pronouns are deprecated. + It is no longer valid to write `names(.data)` or `length(.data)`. + +* Using `as.character()` on quosures is soft-deprecated (#523). + + +#### Miscellaneous + +* Using `get_env()` without supplying an environment is now + soft-deprecated. Please use `current_env()` to retrieve the current + environment. + +* The frame and stack API is soft-deprecated. Some of the + functionality has been replaced by `trace_back()`. + +* The `new_vector_along()` family is soft-deprecated because these + functions are longer to type than the equivalent `rep_along()` or + `rep_named()` calls without added clarity. + +* Passing environment wrappers like formulas or functions to `env_` + functions is now soft-deprecated. This internal genericity was + causing confusion (see issue #427). You should now extract the + environment separately before calling these functions. + + This change concerns `env_depth()`, `env_poke_parent()`, + `env_parent<-`, `env_tail()`, `set_env()`, `env_clone()`, + `env_inherits()`, `env_bind()`, `scoped_bindings()`, + `with_bindings()`, `env_poke()`, `env_has()`, `env_get()`, + `env_names()`, `env_bind_exprs()` and `env_bind_fns()`. + +* `cnd_signal()` now always installs a muffling restart for + non-critical conditions. Consequently the `.mufflable` argument has + been soft-deprecated and no longer has any effect. + + +### Deprecated functions and arguments + +Deprecated functions and arguments issue a warning inconditionally, +but only once per session. + +* Calling `UQ()` and `UQS()` with the rlang namespace qualifier is + deprecated as of rlang 0.3.0. Just use the unqualified forms + instead: + + ``` + # Bad + rlang::expr(mean(rlang::UQ(var) * 100)) + + # Ok + rlang::expr(mean(UQ(var) * 100)) + + # Good + rlang::expr(mean(!!var * 100)) + ``` + + Although soft-deprecated since rlang 0.2.0, `UQ()` and `UQS()` can still be used for now. + +* The `call` argument of `abort()` and condition constructors is now + deprecated in favour of storing full backtraces. + +* The `.standardise` argument of `call_modify()` is deprecated. Please + use `call_standardise()` beforehand. + +* The `sentinel` argument of `env_tail()` has been deprecated and + renamed to `last`. + + +### Defunct functions and arguments + +Defunct functions and arguments throw an error when used. + +* `as_dictionary()` is now defunct. + +* The experimental function `rst_muffle()` is now defunct. Please use + `cnd_muffle()` instead. Unlike its predecessor, `cnd_muffle()` is not + generic. It is marked as a calling handler and thus can be passed + directly to `with_handlers()` to muffle specific conditions (such as + specific subclasses of warnings). + +* `cnd_inform()`, `cnd_warn()` and `cnd_abort()` are retired and + defunct. The old `cnd_message()`, `cnd_warning()`, `cnd_error()` and + `new_cnd()` constructors deprecated in rlang 0.2.0 are now defunct. + +* Modifying a condition with `cnd_signal()` is defunct. In addition, + creating a condition with `cnd_signal()` is soft-deprecated, please + use the new function [signal()] instead. + +* `inplace()` has been renamed to `calling()` to follow base R + terminology more closely. + + +### Functions and arguments in the questioning stage + +We are no longer convinced these functions are the right approach but +we do not have a precise alternative yet. + +* The functions from the restart API are now in the questioning + lifecycle stage. It is not clear yet whether we want to recommend + restarts as a style of programming in R. + +* `prepend()` and `modify()` are in the questioning stage, as well as + `as_logical()`, `as_character()`, etc. We are still figuring out + what vector tools belong in rlang. + +* `flatten()`, `squash()` and their atomic variants are now in the + questioning lifecycle stage. They have slightly different semantics + than the flattening functions in purrr and we are currently + rethinking our approach to flattening with the new typing facilities + of the vctrs package. + + +# rlang 0.2.2 + +This is a maintenance release that fixes several garbage collection +protection issues. + + +# rlang 0.2.1 + +This is a maintenance release that fixes several tidy evaluation +issues. + +* Functions with tidy dots support now allow splicing atomic vectors. + +* Quosures no longer capture the current `srcref`. + +* Formulas are now evaluated in the correct environment by + `eval_tidy()`. This fixes issues in dplyr and other tidy-evaluation + interfaces. + + +# rlang 0.2.0 + +This release of rlang is mostly an effort at polishing the tidy +evaluation framework. All tidy eval functions and operators have been +rewritten in C in order to improve performance. Capture of expression, +quasiquotation, and evaluation of quosures are now vastly faster. On +the UI side, many of the inconveniences that affected the first +release of rlang have been solved: + +* The `!!` operator now has the precedence of unary `+` and `-` which + allows a much more natural syntax: `!!a > b` only unquotes `a` + rather than the whole `a > b` expression. + +* `enquo()` works in magrittr pipes: `mtcars %>% select(!!enquo(var))`. + +* `enquos()` is a variant of `quos()` that has a more natural + interface for capturing multiple arguments and `...`. + +See the first section below for a complete list of changes to the tidy +evaluation framework. + +This release also polishes the rlang API. Many functions have been +renamed as we get a better feel for the consistency and clarity of the +API. Note that rlang as a whole is still maturing and some functions +are even experimental. In order to make things clearer for users of +rlang, we have started to develop a set of conventions to document the +current stability of each function. You will now find "lifecycle" +sections in documentation topics. In addition we have gathered all +lifecycle information in the `?rlang::lifecycle` help page. Please +only use functions marked as stable in your projects unless you are +prepared to deal with occasional backward incompatible updates. + + +## Tidy evaluation + +* The backend for `quos()`, `exprs()`, `list2()`, `dots_list()`, etc + is now written in C. This greatly improve the performance of dots + capture, especially with the splicing operator `!!!` which now + scales much better (you'll see a 1000x performance gain in some + cases). The unquoting algorithm has also been improved which makes + `enexpr()` and `enquo()` more efficient as well. + +* The tidy eval `!!` operator now binds tightly. You no longer have to + wrap it in parentheses, i.e. `!!x > y` will only unquote `x`. + + Technically the `!!` operator has the same precedence as unary `-` + and `+`. This means that `!!a:b` and `!!a + b` are equivalent to + `(!!a):b` and `(!!a) + b`. On the other hand `!!a^b` and `!!a$b` are + equivalent to`!!(a^b)` and `!!(a$b)`. + +* The print method for quosures has been greatly improved. Quosures no + longer appear as formulas but as expressions prefixed with `^`; + quosures are colourised according to their environment; unquoted + objects are displayed between angular brackets instead of code + (i.e. an unquoted integer vector is shown as `` rather + than `1:2`); unquoted S3 objects are displayed using + `pillar::type_sum()` if available. + +* New `enquos()` function to capture arguments. It treats `...` the + same way as `quos()` but can also capture named arguments just like + `enquo()`, i.e. one level up. By comparison `quos(arg)` only + captures the name `arg` rather than the expression supplied to the + `arg` argument. + + In addition, `enexprs()` is like `enquos()` but like `exprs()` it + returns bare expressions. And `ensyms()` expects strings or symbols. + +* It is now possible to use `enquo()` within a magrittr pipe: + + ``` + select_one <- function(df, var) { + df %>% dplyr::select(!!enquo(var)) + } + ``` + + Technically, this is because `enquo()` now also captures arguments + in parents of the current environment rather than just in the + current environment. The flip side of this increased flexibility is + that if you made a typo in the name of the variable you want to + capture, and if an object of that name exists anywhere in the parent + contexts, you will capture that object rather than getting an error. + +* `quo_expr()` has been renamed to `quo_squash()` in order to better + reflect that it is a lossy operation that flattens all nested + quosures. + + +* `!!!` now accepts any kind of objects for consistency. Scalar types + are treated as vectors of length 1. Previously only symbolic objects + like symbols and calls were treated as such. + +* `ensym()` is a new variant of `enexpr()` that expects a symbol or a + string and always returns a symbol. If a complex expression is + supplied it fails with an error. + +* `exprs()` and `quos()` gain a `.unquote_names` arguments to switch + off interpretation of `:=` as a name operator. This should be useful + for programming on the language targetting APIs such as + data.table. + +* `exprs()` gains a `.named` option to auto-label its arguments (#267). + +* Functions taking dots by value rather than by expression + (e.g. regular functions, not quoting functions) have a more + restricted set of unquoting operations. They only support `:=` and + `!!!`, and only at top-level. I.e. `dots_list(!!! x)` is valid but + not `dots_list(nested_call(!!! x))` (#217). + +* Functions taking dots with `list2()` or `dots_list()` now support + splicing of `NULL` values. `!!! NULL` is equivalent to `!!! list()` + (#242). + +* Capture operators now support evaluated arguments. Capturing a + forced or evaluated argument is exactly the same as unquoting that + argument: the actual object (even if a vector) is inlined in the + expression. Capturing a forced argument occurs when you use + `enquo()`, `enexpr()`, etc too late. It also happens when your + quoting function is supplied to `lapply()` or when you try to quote + the first argument of an S3 method (which is necessarily evaluated + in order to detect which class to dispatch to). (#295, #300). + +* Parentheses around `!!` are automatically removed. This makes the + generated expression call cleaner: `(!! sym("name"))(arg)`. Note + that removing the parentheses will never affect the actual + precedence within the expression as the parentheses are only useful + when parsing code as text. The parentheses will also be added by R + when printing code if needed (#296). + +* Quasiquotation now supports `!!` and `!!!` as functional forms: + + ``` + expr(`!!`(var)) + quo(call(`!!!`(var))) + ``` + + This is consistent with the way native R operators parses to + function calls. These new functional forms are to be preferred to + `UQ()` and `UQS()`. We are now questioning the latter and might + deprecate them in a future release. + +* The quasiquotation parser now gives meaningful errors in corner + cases to help you figure out what is wrong. + +* New getters and setters for quosures: `quo_get_expr()`, + `quo_get_env()`, `quo_set_expr()`, and `quo_set_env()`. Compared to + `get_expr()` etc, these accessors only work on quosures and are + slightly more efficient. + +* `quo_is_symbol()` and `quo_is_call()` now take the same set of + arguments as `is_symbol()` and `is_call()`. + +* `enquo()` and `enexpr()` now deal with default values correctly (#201). + +* Splicing a list no longer mutates it (#280). + + +## Conditions + +* The new functions `cnd_warn()` and `cnd_inform()` transform + conditions to warnings or messages before signalling them. + +* `cnd_signal()` now returns invisibly. + +* `cnd_signal()` and `cnd_abort()` now accept character vectors to + create typed conditions with several S3 subclasses. + +* `is_condition()` is now properly exported. + +* Condition signallers such as `cnd_signal()` and `abort()` now accept + a call depth as `call` arguments. This allows plucking a call from + further up the call stack (#30). + +* New helper `catch_cnd()`. This is a small wrapper around + `tryCatch()` that captures and returns any signalled condition. It + returns `NULL` if none was signalled. + +* `cnd_abort()` now adds the correct S3 classes for error + conditions. This fixes error catching, for instance by + `testthat::expect_error()`. + + +## Environments + +* `env_get_list()` retrieves muliple bindings from an environment into + a named list. + +* `with_bindings()` and `scoped_bindings()` establish temporary + bindings in an environment. + +* `is_namespace()` is a snake case wrapper around `isNamespace()`. + + +## Various features + +* New functions `inherits_any()`, `inherits_all()`, and + `inherits_only()`. They allow testing for inheritance from multiple + classes. The `_any` variant is equivalent to `base::inherits()` but + is more explicit about its behaviour. `inherits_all()` checks that + all classes are present in order and `inherits_only()` checks that + the class vectors are identical. + +* New `fn_fmls<-` and `fn_fmls_names<-` setters. + +* New function experimental function `chr_unserialise_unicode()` for + turning characters serialised to unicode point form + (e.g. ``) to UTF-8. In addition, `as_utf8_character()` now + translates those as well. (@krlmlr) + +* `expr_label()` now supports quoted function definition calls (#275). + +* `call_modify()` and `call_standardise()` gain an argument to specify + an environment. The call definition is looked up in that environment + when the call to modify or standardise is not wrapped in a quosure. + +* `is_symbol()` gains a `name` argument to check that that the symbol + name matches a string (#287). + +* New `rlang_box` class. Its purpose is similar to the `AsIs` class + from `base::I()`, i.e. it protects a value temporarily. However it + does so by wrapping the value in a scalar list. Use `new_box()` to + create a boxed value, `is_box()` to test for a boxed value, and + `unbox()` to unbox it. `new_box()` and `is_box()` accept optional + subclass. + +* The vector constructors such as `new_integer()`, + `new_double_along()` etc gain a `names` argument. In the case of the + `_along` family it defaults to the names of the input vector. + + +## Bugfixes + +* When nested quosures are evaluated with `eval_tidy()`, the `.env` + pronoun now correctly refers to the current quosure under evaluation + (#174). Previously it would always refer to the environment of the + outermost quosure. + +* `as_pairlist()` (part of the experimental API) now supports `NULL` + and objects of type pairlist (#397). + +* Fixed a performance bug in `set_names()` that caused a full copy of + the vector names (@jimhester, #366). + + +## API changes + +The rlang API is maturing and still in flux. However we have made an +effort to better communicate what parts are stable. We will not +introduce breaking changes for stable functions unless the payoff for +the change is worth the trouble. See `?rlang::lifecycle` for the +lifecycle status of exported functions. + +* The particle "lang" has been renamed to "call": + + - `lang()` has been renamed to `call2()`. + - `new_language()` has ben renamed to `new_call()`. + - `is_lang()` has been renamed to `is_call()`. We haven't replaced + the `is_unary_lang()` and `is_binary_lang()` because they are + redundant with the `n` argument of `is_call()`. + - All call accessors such as `lang_fn()`, `lang_name()`, + `lang_args()` etc are soft-deprecated and renamed with `call_` + prefix. + + In rlang 0.1 calls were called "language" objects in order to follow + the R type nomenclature as returned by `base::typeof()`. We wanted + to avoid adding to the confusion between S modes and R types. With + hindsight we find it is better to use more meaningful type names. + +* We now use the term "data mask" instead of "overscope". We think + data mask is a more natural name in the context of R. We say that + that objects from user data mask objects in the current environment. + This makes reference to object masking in the search path which is + due to the same mechanism (in technical terms, lexical scoping with + hierarchically nested environments). + + Following this new terminology, the new functions `as_data_mask()` + and `new_data_mask()` replace `as_overscope()` and + `new_overscope()`. `as_data_mask()` has also a more consistent + interface. These functions are only meant for developers of tidy + evaluation interfaces. + +* We no longer require a data mask (previously called overscope) to be + cleaned up after evaluation. `overscope_clean()` is thus + soft-deprecated without replacement. + + +### Breaking changes + +* `!!` now binds tightly in order to match intuitive parsing of tidy + eval code, e.g. `!! x > y` is now equivalent to `(!! x) > y`. A + corollary of this new syntax is that you now have to be explicit + when you want to unquote the whole expression on the right of `!!`. + For instance you have to explicitly write `!! (x > y)` to unquote + `x > y` rather than just `x`. + +* `UQ()`, `UQS()` and `:=` now issue an error when called + directly. The previous definitions caused surprising results when + the operators were invoked in wrong places (i.e. not in quasiquoted + arguments). + +* The prefix form `` `!!`() `` is now an alias to `!!` rather than + `UQE()`. This makes it more in line with regular R syntax where + operators are parsed as regular calls, e.g. `a + b` is parsed as `` + `+`(a, b) `` and both forms are completely equivalent. Also the + prefix form `` `!!!`() `` is now equivalent to `!!!`. + +* `UQE()` is now deprecated in order to simplify the syntax of + quasiquotation. Please use `!! get_expr(x)` instead. + +* `expr_interp()` now returns a formula instead of a quosure when + supplied a formula. + +* `is_quosureish()` and `as_quosureish()` are deprecated. These + functions assumed that quosures are formulas but that is only an + implementation detail. + +* `new_cnd()` is now `cnd()` for consistency with other constructors. + Also, `cnd_error()`, `cnd_warning()` and `cnd_message()` are now + `error_cnd()`, `warning_cnd()` and `message_cnd()` to follow our + naming scheme according to which the type of output is a suffix + rather than a prefix. + +* `is_node()` now returns `TRUE` for calls as well and `is_pairlist()` + does not return `TRUE` for `NULL` objects. Use `is_node_list()` to + determine whether an object either of type `pairlist` or `NULL`. + Note that all these functions are still experimental. + +* `set_names()` no longer automatically splices lists of character + vectors as we are moving away from automatic splicing semantics. + + +### Upcoming breaking changes + +* Calling the functional forms of unquote operators with the rlang + namespace qualifier is soft-deprecated. `UQ()` and `UQS()` are not + function calls so it does not make sense to namespace them. + Supporting namespace qualifiers complicates the implementation of + unquotation and is misleading as to the nature of unquoting (which + are syntactic operators at quotation-time rather than function calls + at evaluation-time). + +* We are now questioning `UQ()` and `UQS()` as functional forms of + `!!`. If `!!` and `!!!` were native R operators, they would parse + to the functional calls `` `!!`() `` and `` `!!!`() ``. This is now + the preferred way to unquote with a function call rather than with + the operators. We haven't decided yet whether we will deprecate + `UQ()` and `UQS()` in the future. In any case we recommend using the + new functional forms. + +* `parse_quosure()` and `parse_quosures()` are soft-deprecated in + favour of `parse_quo()` and `parse_quos()`. These new names are + consistent with the rule that abbreviated suffixes indicate the + return type of a function. In addition the new functions require their + callers to explicitly supply an environment for the quosures. + +* Using `f_rhs()` and `f_env()` on quosures is soft-deprecated. The + fact that quosures are formulas is an implementation detail that + might change in the future. Please use `quo_get_expr()` and + `quo_get_env()` instead. + +* `quo_expr()` is soft-deprecated in favour of `quo_squash()`. + `quo_expr()` was a misnomer because it implied that it was a mere + expression acccessor for quosures whereas it was really a lossy + operation that squashed all nested quosures. + +* With the renaming of the `lang` particle to `call`, all these + functions are soft-deprecated: `lang()`, `is_lang()`, `lang_fn()`, + `lang_name()`, `lang_args()`. + + In addition, `lang_head()` and `lang_tail()` are soft-deprecated + without replacement because these are low level accessors that are + rarely needed. + +* `as_overscope()` is soft-deprecated in favour of `as_data_mask()`. + +* The node setters were renamed from `mut_node_` prefix to + `node_poke_`. This change follows a new naming convention in rlang + where mutation is referred to as "poking". + +* `splice()` is now in questioning stage as it is not needed given the + `!!!` operator works in functions taking dots with `dots_list()`. + +* `lgl_len()`, `int_len()` etc have been soft-deprecated and renamed + with `new_` prefix, e.g. `new_logical()` and `new_integer()`. This + is for consistency with other non-variadic object constructors. + +* `ll()` is now an alias to `list2()`. This is consistent with the new + `call2()` constructor for calls. `list2()` and `call2()` are + versions of `list()` and `call()` that support splicing of lists + with `!!!`. `ll()` remains around as a shorthand for users who like + its conciseness. + +* Automatic splicing of lists in vector constructors (e.g. `lgl()`, + `chr()`, etc) is now soft-deprecated. Please be explicit with the + splicing operator `!!!`. + + +# rlang 0.1.6 + +* This is a maintenance release in anticipation of a forthcoming + change to R's C API (use `MARK_NOT_MUTABLE()` instead of + `SET_NAMED()`). + +* New function `is_reference()` to check whether two objects are one + and the same. + + +# rlang 0.1.4 + +* `eval_tidy()` no longer maps over lists but returns them literally. + This behaviour is an overlook from past refactorings and was never + documented. + + +# rlang 0.1.2 + +This hotfix release makes rlang compatible with the R 3.1 branch. + + +# rlang 0.1.1 + +This release includes two important fixes for tidy evaluation: + +* Bare formulas are now evaluated in the correct environment in + tidyeval functions. + +* `enquo()` now works properly within compiled functions. Before this + release, constants optimised by the bytecode compiler couldn't be + enquoted. + + +## New functions: + +* The `new_environment()` constructor creates a child of the empty + environment and takes an optional named list of data to populate it. + Compared to `env()` and `child_env()`, it is meant to create + environments as data structures rather than as part of a scope + hierarchy. + +* The `new_call()` constructor creates calls out of a callable + object (a function or an expression) and a pairlist of arguments. It + is useful to avoid costly internal coercions between lists and + pairlists of arguments. + + +## UI improvements: + +* `env_child()`'s first argument is now `.parent` instead of `parent`. + +* `mut_` setters like `mut_attrs()` and environment helpers like + `env_bind()` and `env_unbind()` now return their (modified) input + invisibly. This follows the tidyverse convention that functions + called primarily for their side effects should return their input + invisibly. + +* `is_pairlist()` now returns `TRUE` for `NULL`. We added `is_node()` + to test for actual pairlist nodes. In other words, `is_pairlist()` + tests for the data structure while `is_node()` tests for the type. + + +## Bugfixes: + +* `env()` and `env_child()` can now get arguments whose names start + with `.`. Prior to this fix, these arguments were partial-matching + on `env_bind()`'s `.env` argument. + +* The internal `replace_na()` symbol was renamed to avoid a collision + with an exported function in tidyverse. This solves an issue + occurring in old versions of R prior to 3.3.2 (#133). + + +# rlang 0.1.0 + +Initial release. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/R/rlang b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/R/rlang new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/R/rlang @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/R/rlang.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/R/rlang.rdb new file mode 100644 index 00000000..d671faec Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/R/rlang.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/R/rlang.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/R/rlang.rdx new file mode 100644 index 00000000..ba2fb011 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/R/rlang.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/backtrace-ver b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/backtrace-ver new file mode 100644 index 00000000..7dea76ed --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/backtrace-ver @@ -0,0 +1 @@ +1.0.1 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/AnIndex new file mode 100644 index 00000000..46a398fd --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/AnIndex @@ -0,0 +1,504 @@ +rlang-package rlang-package +!! injection-operator +!!! splice-operator +%<~% env_bind +%@% op-get-attr +%@%<- op-get-attr +%|% op-na-default +%||% op-null-default +.data dot-data +.env dot-data +:= dyn-dots +abort abort +add_backtrace rlang_backtrace_on_error +are_na are_na +args_data_masking args_data_masking +args_dots_empty args_dots_empty +args_dots_used args_dots_used +args_error_context args_error_context +arg_match arg_match +arg_match0 arg_match +as_box as_box +as_box_if as_box +as_bytes bytes-class +as_character vector-coercion +as_closure as_closure +as_complex vector-coercion +as_data_mask as_data_mask +as_data_pronoun as_data_mask +as_double vector-coercion +as_environment as_environment +as_function as_function +as_integer vector-coercion +as_label as_label +as_list vector-coercion +as_logical vector-coercion +as_name as_name +as_quosure new_quosure +as_quosures new_quosures +as_string as_string +as_utf8_character as_utf8_character +bang-bang injection-operator +bare-type-predicates bare-type-predicates +base_env search_envs +box box +bytes vector-construction +bytes-class bytes-class +call2 call2 +caller_arg caller_arg +caller_call stack +caller_env stack +caller_fn stack +calling with_handlers +call_args call_args +call_args_names call_args +call_fn call_fn +call_inspect call_inspect +call_match call_match +call_modify call_modify +call_name call_name +call_ns call_name +call_standardise call_standardise +catch_cnd catch_cnd +check_dots_empty check_dots_empty +check_dots_empty0 check_dots_empty0 +check_dots_unnamed check_dots_unnamed +check_dots_used check_dots_used +check_exclusive check_exclusive +check_installed is_installed +check_required check_required +child_env child_env +chr vector-construction +chr_unserialise_unicode chr_unserialise_unicode +cnd cnd +cnd_body cnd_message +cnd_entrace entrace +cnd_footer cnd_message +cnd_header cnd_message +cnd_inherits cnd_inherits +cnd_message cnd_message +cnd_muffle cnd_muffle +cnd_signal cnd_signal +cnd_type cnd_type +coerce_class switch_type +coerce_type switch_type +cpl vector-construction +ctxt_frame stack-deprecated +curly-curly embrace-operator +current_call stack +current_env stack +current_fn stack +data_sym sym +data_syms sym +dbl vector-construction +defusing-advanced defusing-advanced +dev-notes-dots dev-notes-dots +doc_dots_dynamic dyn-dots +done done +dot-data dot-data +dots_list list2 +dots_n dots_n +dots_splice dots_splice +dots_values dots_values +duplicate duplicate +dyn-dots dyn-dots +embrace-operator embrace-operator +empty_env empty_env +enexpr defusing-advanced +enexprs defusing-advanced +englue englue +enquo enquo +enquo0 defusing-advanced +enquos enquo +enquos0 defusing-advanced +ensym defusing-advanced +ensyms defusing-advanced +entrace entrace +env env +env_bind env_bind +env_binding_are_active env_binding_are_active +env_binding_are_lazy env_binding_are_active +env_binding_are_locked env_binding_lock +env_binding_lock env_binding_lock +env_binding_unlock env_binding_lock +env_bind_active env_bind +env_bind_lazy env_bind +env_browse env_browse +env_bury env_bury +env_cache env_cache +env_clone env_clone +env_coalesce env_clone +env_depth env_depth +env_get env_get +env_get_list env_get +env_has env_has +env_inherits env_inherits +env_is_browsed env_browse +env_is_locked env_lock +env_is_user_facing env_is_user_facing +env_label env_name +env_length env_names +env_lock env_lock +env_name env_name +env_names env_names +env_parent env_parent +env_parents env_parent +env_poke env_poke +env_poke_parent get_env +env_print env_print +env_tail env_parent +env_unbind env_unbind +env_unlock env_unlock +error_call format_error_call +error_cnd cnd +eval_bare eval_bare +eval_tidy eval_tidy +exec exec +exiting with_handlers +expr expr +exprs defusing-advanced +exprs_auto_name exprs_auto_name +expr_deparse expr_print +expr_interp expr_interp +expr_label expr_label +expr_name expr_label +expr_print expr_print +expr_text expr_label +faq-options faq-options +ffi_standalone_check_number_1.0.7 ffi_standalone_types_check +ffi_standalone_is_bool_1.0.7 ffi_standalone_types_check +ffi_standalone_types_check ffi_standalone_types_check +flatten flatten +flatten_chr flatten +flatten_cpl flatten +flatten_dbl flatten +flatten_if flatten +flatten_int flatten +flatten_lgl flatten +flatten_raw flatten +fn_body fn_body +fn_body<- fn_body +fn_env fn_env +fn_env<- fn_env +fn_fmls fn_fmls +fn_fmls<- fn_fmls +fn_fmls_names fn_fmls +fn_fmls_names<- fn_fmls +fn_fmls_syms fn_fmls +format_error_bullets format_error_bullets +format_error_call format_error_call +frame_call stack +frame_fn stack +friendly_type friendly_type +f_env f_rhs +f_env<- f_rhs +f_label f_text +f_lhs f_rhs +f_lhs<- f_rhs +f_name f_text +f_rhs f_rhs +f_rhs<- f_rhs +f_text f_text +get_env get_env +get_expr set_expr +global_entrace global_entrace +global_env search_envs +global_frame stack-deprecated +global_handle global_handle +global_prompt_install global_prompt_install +glue-operators glue-operators +hash hash +hash_file hash +has_length has_length +has_name has_name +have_name is_named +inform abort +inherits_all inherits_any +inherits_any inherits_any +inherits_only inherits_any +inject inject +injection-operator injection-operator +int vector-construction +interrupt interrupt +invoke invoke +is_atomic type-predicates +is_attached search_envs +is_bare_atomic bare-type-predicates +is_bare_bytes bare-type-predicates +is_bare_character bare-type-predicates +is_bare_complex bare-type-predicates +is_bare_double bare-type-predicates +is_bare_environment is_environment +is_bare_formula is_formula +is_bare_integer bare-type-predicates +is_bare_integerish is_integerish +is_bare_list bare-type-predicates +is_bare_logical bare-type-predicates +is_bare_numeric bare-type-predicates +is_bare_raw bare-type-predicates +is_bare_string bare-type-predicates +is_bare_vector bare-type-predicates +is_bool scalar-type-predicates +is_box box +is_bytes type-predicates +is_call is_call +is_callable is_callable +is_call_simple call_name +is_character type-predicates +is_chr_na are_na +is_closure is_function +is_complex type-predicates +is_condition is_condition +is_copyable is_copyable +is_cpl_na are_na +is_dbl_na are_na +is_dictionaryish is_dictionaryish +is_done_box done +is_double type-predicates +is_empty is_empty +is_environment is_environment +is_error is_condition +is_expression is_expression +is_false is_true +is_formula is_formula +is_function is_function +is_installed is_installed +is_integer type-predicates +is_integerish is_integerish +is_interactive is_interactive +is_int_na are_na +is_lambda as_function +is_lang is_lang +is_lgl_na are_na +is_list type-predicates +is_logical type-predicates +is_message is_condition +is_missing missing_arg +is_na are_na +is_named is_named +is_named2 is_named +is_namespace is_namespace +is_node is_pairlist +is_node_list is_pairlist +is_null type-predicates +is_pairlist is_pairlist +is_primitive is_function +is_primitive_eager is_function +is_primitive_lazy is_function +is_quosure new_quosure +is_quosures new_quosures +is_raw type-predicates +is_reference is_reference +is_scalar_atomic scalar-type-predicates +is_scalar_bytes scalar-type-predicates +is_scalar_character scalar-type-predicates +is_scalar_complex scalar-type-predicates +is_scalar_double scalar-type-predicates +is_scalar_integer scalar-type-predicates +is_scalar_integerish is_integerish +is_scalar_list scalar-type-predicates +is_scalar_logical scalar-type-predicates +is_scalar_raw scalar-type-predicates +is_scalar_vector scalar-type-predicates +is_scoped scoped_env +is_spliced splice +is_spliced_bare splice +is_string scalar-type-predicates +is_symbol is_symbol +is_symbolic is_expression +is_syntactic_literal is_expression +is_true is_true +is_vector type-predicates +is_warning is_condition +is_weakref is_weakref +is_zap zap +lang lang +last_error last_error +last_messages last_warnings +last_trace last_error +last_warnings last_warnings +lgl vector-construction +list2 list2 +ll list2 +locally with_env +local_bindings local_bindings +local_error_call local_error_call +local_interactive is_interactive +local_options local_options +local_use_cli local_use_cli +maybe_missing missing_arg +message_cnd cnd +missing missing +missing_arg missing_arg +names2 names2 +names2<- names2 +names_inform_repair names_inform_repair +na_chr missing +na_cpl missing +na_dbl missing +na_int missing +na_lgl missing +new-vector new-vector +new_box box +new_call new_call +new_character new-vector +new_complex new-vector +new_data_mask as_data_mask +new_double new-vector +new_environment env +new_formula new_formula +new_function new_function +new_integer new-vector +new_list new-vector +new_logical new-vector +new_node new_node +new_quosure new_quosure +new_quosures new_quosures +new_raw new-vector +new_weakref new_weakref +node_caar new_node +node_cadr new_node +node_car new_node +node_cdar new_node +node_cddr new_node +node_cdr new_node +node_poke_caar new_node +node_poke_cadr new_node +node_poke_car new_node +node_poke_cdar new_node +node_poke_cddr new_node +node_poke_cdr new_node +node_poke_tag new_node +node_tag new_node +nse-defuse topic-defuse +nse-force topic-inject +nse-inject topic-inject +ns_env ns_env +ns_env_name ns_env +ns_imports_env ns_env +ns_registry_env ns_registry_env +obj_address obj_address +on_load on_load +on_package_load on_load +op-get-attr op-get-attr +op-na-default op-na-default +op-null-default op-null-default +pairlist2 pairlist2 +parse_bytes bytes-class +parse_expr parse_expr +parse_exprs parse_expr +parse_quo parse_expr +parse_quos parse_expr +peek_option local_options +peek_options local_options +pkg_env search_envs +pkg_env_name search_envs +prim_name prim_name +push_options local_options +qq_show qq_show +quasiquotation topic-inject +quo defusing-advanced +quos defusing-advanced +quosure quosure-tools +quosure-tools quosure-tools +quos_auto_name exprs_auto_name +quotation topic-defuse +quo_expr quo_expr +quo_get_env quosure-tools +quo_get_expr quosure-tools +quo_is_call quosure-tools +quo_is_missing quosure-tools +quo_is_null quosure-tools +quo_is_symbol quosure-tools +quo_is_symbolic quosure-tools +quo_label quo_label +quo_name quo_label +quo_set_env quosure-tools +quo_set_expr quosure-tools +quo_squash quo_squash +quo_text quo_label +raw_deparse_str raw_deparse_str +rep_along rep_along +rep_named rep_along +reset_message_verbosity abort +reset_warning_verbosity abort +return_from return_from +rlang rlang-package +rlang_backtrace_on_error rlang_backtrace_on_error +rlang_backtrace_on_error_report rlang_backtrace_on_error +rlang_backtrace_on_warning_report rlang_backtrace_on_error +rlang_error rlang_error +rlib_trace_spec rlib_trace_spec +run_on_load on_load +scalar-type-predicates scalar-type-predicates +scoped_bindings scoped_interactive +scoped_env scoped_env +scoped_interactive scoped_interactive +scoped_options scoped_interactive +search_env search_envs +search_envs search_envs +seq2 seq2 +seq2_along seq2 +set_attrs set_attrs +set_env get_env +set_expr set_expr +set_names set_names +signal abort +splice splice +splice-operator splice-operator +squash flatten +squash_chr flatten +squash_cpl flatten +squash_dbl flatten +squash_if flatten +squash_int flatten +squash_lgl flatten +squash_raw flatten +stack stack +stack-deprecated stack-deprecated +string string +switch_class switch_type +switch_type switch_type +sym sym +syms sym +tidy-dots dyn-dots +tidyeval-data dot-data +topic-condition-customisation topic-condition-customisation +topic-condition-formatting topic-condition-formatting +topic-data-mask topic-data-mask +topic-data-mask-ambiguity topic-data-mask-ambiguity +topic-data-mask-programming topic-data-mask-programming +topic-defuse topic-defuse +topic-double-evaluation topic-double-evaluation +topic-embrace-constants topic-embrace-constants +topic-embrace-non-args topic-embrace-non-args +topic-error-call topic-error-call +topic-error-chaining topic-error-chaining +topic-inject topic-inject +topic-inject-out-of-context topic-inject-out-of-context +topic-metaprogramming topic-metaprogramming +topic-multiple-columns topic-multiple-columns +topic-quosure topic-quosure +trace_back trace_back +trace_length trace_back +try_fetch try_fetch +type-predicates type-predicates +type_of type_of +unbox box +UQ UQ +UQS UQ +vector-coercion vector-coercion +vector-construction vector-construction +vec_poke_n vec_poke_n +vec_poke_range vec_poke_n +warn abort +warning_cnd cnd +with_bindings local_bindings +with_env with_env +with_handlers with_handlers +with_interactive is_interactive +with_options local_options +wref_key wref_key +wref_value wref_key +zap zap +zap_srcref zap_srcref diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/aliases.rds new file mode 100644 index 00000000..ac6f5cb8 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-archived.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-archived.svg new file mode 100644 index 00000000..48f72a6f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-archived.svg @@ -0,0 +1 @@ + lifecyclelifecyclearchivedarchived \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-defunct.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-defunct.svg new file mode 100644 index 00000000..01452e5f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-defunct.svg @@ -0,0 +1 @@ +lifecyclelifecycledefunctdefunct \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-deprecated.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-deprecated.svg new file mode 100644 index 00000000..4baaee01 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-deprecated.svg @@ -0,0 +1 @@ +lifecyclelifecycledeprecateddeprecated \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-experimental.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-experimental.svg new file mode 100644 index 00000000..d1d060e9 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-experimental.svg @@ -0,0 +1 @@ +lifecyclelifecycleexperimentalexperimental \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-maturing.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-maturing.svg new file mode 100644 index 00000000..df713101 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-maturing.svg @@ -0,0 +1 @@ +lifecyclelifecyclematuringmaturing \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-questioning.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-questioning.svg new file mode 100644 index 00000000..08ee0c90 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-questioning.svg @@ -0,0 +1 @@ +lifecyclelifecyclequestioningquestioning \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-retired.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-retired.svg new file mode 100644 index 00000000..33f406b1 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-retired.svg @@ -0,0 +1 @@ + lifecyclelifecycleretiredretired \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-soft-deprecated.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-soft-deprecated.svg new file mode 100644 index 00000000..9f014fd1 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-soft-deprecated.svg @@ -0,0 +1 @@ +lifecyclelifecyclesoft-deprecatedsoft-deprecated \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-stable.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-stable.svg new file mode 100644 index 00000000..e015dc81 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-stable.svg @@ -0,0 +1 @@ +lifecyclelifecyclestablestable \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-superseded.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-superseded.svg new file mode 100644 index 00000000..75f24f55 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/lifecycle-superseded.svg @@ -0,0 +1 @@ + lifecyclelifecyclesupersededsuperseded \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/logo.png b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/logo.png new file mode 100644 index 00000000..596f5137 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/figures/logo.png differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/paths.rds new file mode 100644 index 00000000..8d0c8cd8 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/rlang.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/rlang.rdb new file mode 100644 index 00000000..53c09e48 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/rlang.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/rlang.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/rlang.rdx new file mode 100644 index 00000000..837e2534 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/help/rlang.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/html/00Index.html new file mode 100644 index 00000000..4c3c4bd6 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/html/00Index.html @@ -0,0 +1,771 @@ + + +R: Functions for Base Types and Core R and 'Tidyverse' Features + + + +
+

Functions for Base Types and Core R and 'Tidyverse' Features + +

+
+
+[Up] +[Top] +

Documentation for package ‘rlang’ version 1.1.5

+ + + +

Help Pages

+ + +

+A +B +C +D +E +F +G +H +I +L +M +N +O +P +Q +R +S +T +U +V +W +Z +misc +

+ + +

-- A --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
abortSignal an error, warning, or message
add_backtraceDisplay backtrace on error
args_error_contextDocumentation anchor for error arguments
arg_matchMatch an argument to a character vector
arg_match0Match an argument to a character vector
as_boxConvert object to a box
as_box_ifConvert object to a box
as_bytesHuman readable memory sizes
as_data_maskCreate a data mask
as_data_pronounCreate a data mask
as_environmentCoerce to an environment
as_functionConvert to function
as_labelCreate a default name for an R object
as_nameExtract names from symbols
as_quosureCreate a quosure from components
as_quosuresCreate a list of quosures
as_stringCast symbol to string
+ +

-- B --

+ + + + + + + + + + + + +
bang-bangInjection operator !!
bare-type-predicatesBare type predicates
boxBox a value
bytesCreate vectors
bytes-classHuman readable memory sizes
+ +

-- C --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
call2Create a call
caller_argFind the caller argument for error messages
caller_callGet properties of the current or caller frame
caller_envGet properties of the current or caller frame
caller_fnGet properties of the current or caller frame
call_argsExtract arguments from a call
call_args_namesExtract arguments from a call
call_inspectInspect a call
call_matchMatch supplied arguments to function definition
call_modifyModify the arguments of a call
call_nameExtract function name or namespace of a call
call_nsExtract function name or namespace of a call
catch_cndCatch a condition
check_dots_emptyCheck that dots are empty
check_dots_unnamedCheck that all dots are unnamed
check_dots_usedCheck that all dots have been used
check_exclusiveCheck that arguments are mutually exclusive
check_installedAre packages installed in any of the libraries?
check_requiredCheck that argument is supplied
chrCreate vectors
cnd_bodyBuild an error message from parts
cnd_footerBuild an error message from parts
cnd_headerBuild an error message from parts
cnd_inheritsDoes a condition or its ancestors inherit from a class?
cnd_messageBuild an error message from parts
cnd_signalSignal a condition object
cplCreate vectors
curly-curlyEmbrace operator {{
current_callGet properties of the current or caller frame
current_envGet properties of the current or caller frame
current_fnGet properties of the current or caller frame
+ +

-- D --

+ + + + + + + + + + + + + + + + + + +
data_symCreate a symbol or list of symbols
data_symsCreate a symbol or list of symbols
dblCreate vectors
doc_dots_dynamicDynamic dots features
doneBox a final value for early termination
dot-data'.data' and '.env' pronouns
dots_listCollect dynamic dots in a list
dyn-dotsDynamic dots features
+ +

-- E --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
embrace-operatorEmbrace operator {{
empty_envGet the empty environment
englueDefuse function arguments with glue
enquoDefuse function arguments
enquosDefuse function arguments
envCreate a new environment
env_bindBind symbols to objects in an environment
env_bind_activeBind symbols to objects in an environment
env_bind_lazyBind symbols to objects in an environment
env_browseBrowse environments
env_cacheCache a value in an environment
env_cloneClone or coalesce an environment
env_coalesceClone or coalesce an environment
env_depthDepth of an environment chain
env_getGet an object in an environment
env_get_listGet an object in an environment
env_hasDoes an environment have or see bindings?
env_inheritsDoes environment inherit from another environment?
env_is_browsedBrowse environments
env_is_user_facingIs frame environment user facing?
env_labelLabel of an environment
env_lengthNames and numbers of symbols bound in an environment
env_nameLabel of an environment
env_namesNames and numbers of symbols bound in an environment
env_parentGet parent environments
env_parentsGet parent environments
env_pokePoke an object in an environment
env_poke_parentGet or set the environment of an object
env_printPretty-print an environment
env_tailGet parent environments
env_unbindRemove bindings from an environment
eval_bareEvaluate an expression in an environment
eval_tidyEvaluate an expression with quosures and pronoun support
execExecute a function
exprDefuse an R expression
exprs_auto_nameEnsure that all elements of a list of expressions are named
expr_deparsePrint an expression
expr_printPrint an expression
+ +

-- F --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
faq-optionsGlobal options for rlang
fn_bodyGet or set function body
fn_body<-Get or set function body
fn_envReturn the closure environment of a function
fn_env<-Return the closure environment of a function
fn_fmlsExtract arguments from a function
fn_fmls<-Extract arguments from a function
fn_fmls_namesExtract arguments from a function
fn_fmls_names<-Extract arguments from a function
fn_fmls_symsExtract arguments from a function
format_error_bulletsFormat bullets for error messages
frame_callGet properties of the current or caller frame
frame_fnGet properties of the current or caller frame
f_envGet or set formula components
f_env<-Get or set formula components
f_labelTurn RHS of formula into a string or label
f_lhsGet or set formula components
f_lhs<-Get or set formula components
f_nameTurn RHS of formula into a string or label
f_rhsGet or set formula components
f_rhs<-Get or set formula components
f_textTurn RHS of formula into a string or label
+ +

-- G --

+ + + + + + + + + + + + +
get_envGet or set the environment of an object
global_entraceEntrace unexpected errors
global_handleRegister default global handlers
global_prompt_installPrompt user to install missing packages
glue-operatorsName injection with '"{"' and '"{{"'
+ +

-- H --

+ + + + + + + + + + +
hashHashing
hash_fileHashing
has_nameDoes an object have an element with this name?
have_nameIs object named?
+ +

-- I --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
informSignal an error, warning, or message
inherits_allDoes an object inherit from a set of classes?
inherits_anyDoes an object inherit from a set of classes?
inherits_onlyDoes an object inherit from a set of classes?
injectInject objects in an R expression
injection-operatorInjection operator !!
intCreate vectors
is_atomicType predicates
is_bare_atomicBare type predicates
is_bare_bytesBare type predicates
is_bare_characterBare type predicates
is_bare_complexBare type predicates
is_bare_doubleBare type predicates
is_bare_environmentIs object an environment?
is_bare_formulaIs object a formula?
is_bare_integerBare type predicates
is_bare_integerishIs a vector integer-like?
is_bare_listBare type predicates
is_bare_logicalBare type predicates
is_bare_numericBare type predicates
is_bare_rawBare type predicates
is_bare_stringBare type predicates
is_bare_vectorBare type predicates
is_boolScalar type predicates
is_boxBox a value
is_bytesType predicates
is_callIs object a call?
is_call_simpleExtract function name or namespace of a call
is_characterType predicates
is_closureIs object a function?
is_complexType predicates
is_done_boxBox a final value for early termination
is_doubleType predicates
is_emptyIs object an empty vector or NULL?
is_environmentIs object an environment?
is_expressionIs an object an expression?
is_falseIs object identical to TRUE or FALSE?
is_formulaIs object a formula?
is_functionIs object a function?
is_installedAre packages installed in any of the libraries?
is_integerType predicates
is_integerishIs a vector integer-like?
is_interactiveIs R running interactively?
is_lambdaConvert to function
is_listType predicates
is_logicalType predicates
is_missingGenerate or handle a missing argument
is_namedIs object named?
is_named2Is object named?
is_namespaceIs an object a namespace environment?
is_nullType predicates
is_primitiveIs object a function?
is_primitive_eagerIs object a function?
is_primitive_lazyIs object a function?
is_quosureCreate a quosure from components
is_quosuresCreate a list of quosures
is_rawType predicates
is_scalar_atomicScalar type predicates
is_scalar_bytesScalar type predicates
is_scalar_characterScalar type predicates
is_scalar_complexScalar type predicates
is_scalar_doubleScalar type predicates
is_scalar_integerScalar type predicates
is_scalar_integerishIs a vector integer-like?
is_scalar_listScalar type predicates
is_scalar_logicalScalar type predicates
is_scalar_rawScalar type predicates
is_scalar_vectorScalar type predicates
is_splicedSplice values at dots collection time
is_spliced_bareSplice values at dots collection time
is_stringScalar type predicates
is_symbolIs object a symbol?
is_symbolicIs an object an expression?
is_syntactic_literalIs an object an expression?
is_trueIs object identical to TRUE or FALSE?
is_vectorType predicates
is_weakrefIs object a weak reference?
is_zapCreate zap objects
+ +

-- L --

+ + + + + + + + + + + + + + + + + + + + + + + + +
last_errorLast 'abort()' error
last_messagesDisplay last messages and warnings
last_traceLast 'abort()' error
last_warningsDisplay last messages and warnings
lglCreate vectors
list2Collect dynamic dots in a list
llCollect dynamic dots in a list
local_bindingsTemporarily change bindings of an environment
local_error_callSet local error call in an execution environment
local_interactiveIs R running interactively?
local_optionsChange global options
+ +

-- M --

+ + + + + + +
maybe_missingGenerate or handle a missing argument
missing_argGenerate or handle a missing argument
+ +

-- N --

+ + + + + + + + + + + + + + + + + + + + + + +
names2Get names of a vector
names2<-Get names of a vector
new_boxBox a value
new_data_maskCreate a data mask
new_environmentCreate a new environment
new_formulaCreate a formula
new_functionCreate a function
new_quosureCreate a quosure from components
new_quosuresCreate a list of quosures
new_weakrefCreate a weak reference
+ +

-- O --

+ + + + + + + + + + +
on_loadRun expressions on load
on_package_loadRun expressions on load
op-get-attrInfix attribute accessor and setter
op-null-defaultDefault value for 'NULL'
+ +

-- P --

+ + + + + + + + + + + + + + + + + + + + +
pairlist2Collect dynamic dots in a pairlist
parse_bytesHuman readable memory sizes
parse_exprParse R code
parse_exprsParse R code
parse_quoParse R code
parse_quosParse R code
peek_optionChange global options
peek_optionsChange global options
push_optionsChange global options
+ +

-- Q --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
qq_showShow injected expression
quosureQuosure getters, setters and predicates
quosure-toolsQuosure getters, setters and predicates
quos_auto_nameEnsure that all elements of a list of expressions are named
quo_get_envQuosure getters, setters and predicates
quo_get_exprQuosure getters, setters and predicates
quo_is_callQuosure getters, setters and predicates
quo_is_missingQuosure getters, setters and predicates
quo_is_nullQuosure getters, setters and predicates
quo_is_symbolQuosure getters, setters and predicates
quo_is_symbolicQuosure getters, setters and predicates
quo_set_envQuosure getters, setters and predicates
quo_set_exprQuosure getters, setters and predicates
quo_squashSquash a quosure
+ +

-- R --

+ + + + + + + + + + + + + + + + + + + + +
rep_alongCreate vectors matching the length of a given vector
rep_namedCreate vectors matching the length of a given vector
reset_message_verbositySignal an error, warning, or message
reset_warning_verbositySignal an error, warning, or message
rlang_backtrace_on_errorDisplay backtrace on error
rlang_backtrace_on_error_reportDisplay backtrace on error
rlang_backtrace_on_warning_reportDisplay backtrace on error
rlang_errorErrors of class 'rlang_error'
run_on_loadRun expressions on load
+ +

-- S --

+ + + + + + + + + + + + + + + + + + + + + + + + +
scalar-type-predicatesScalar type predicates
seq2Increasing sequence of integers in an interval
seq2_alongIncreasing sequence of integers in an interval
set_envGet or set the environment of an object
set_namesSet names of a vector
signalSignal an error, warning, or message
spliceSplice values at dots collection time
splice-operatorSplice operator !!!
stackGet properties of the current or caller frame
symCreate a symbol or list of symbols
symsCreate a symbol or list of symbols
+ +

-- T --

+ + + + + + + + + + + + + + +
tidy-dotsDynamic dots features
tidyeval-data'.data' and '.env' pronouns
trace_backCapture a backtrace
trace_lengthCapture a backtrace
try_fetchTry an expression with condition handlers
type-predicatesType predicates
+ +

-- U --

+ + + + +
unboxBox a value
+ +

-- V --

+ + + + +
vector-constructionCreate vectors
+ +

-- W --

+ + + + + + + + + + + + + + +
warnSignal an error, warning, or message
with_bindingsTemporarily change bindings of an environment
with_interactiveIs R running interactively?
with_optionsChange global options
wref_keyGet key/value from a weak reference object
wref_valueGet key/value from a weak reference object
+ +

-- Z --

+ + + + + + +
zapCreate zap objects
zap_srcrefZap source references
+ +

-- misc --

+ + + + + + + + + + + + + + + + + + + + +
!!Injection operator !!
!!!Splice operator !!!
%<~%Bind symbols to objects in an environment
%@%Infix attribute accessor and setter
%@%<-Infix attribute accessor and setter
%||%Default value for 'NULL'
.data'.data' and '.env' pronouns
.env'.data' and '.env' pronouns
:=Dynamic dots features
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/libs/rlang.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/libs/rlang.so new file mode 100755 index 00000000..bfe13173 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/libs/rlang.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/libs/rlang.so.dSYM/Contents/Info.plist b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/libs/rlang.so.dSYM/Contents/Info.plist new file mode 100644 index 00000000..d1781d97 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/libs/rlang.so.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.rlang.so + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/libs/rlang.so.dSYM/Contents/Resources/DWARF/rlang.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/libs/rlang.so.dSYM/Contents/Resources/DWARF/rlang.so new file mode 100644 index 00000000..dd35c325 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rlang/libs/rlang.so.dSYM/Contents/Resources/DWARF/rlang.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/DESCRIPTION new file mode 100644 index 00000000..1273e3a9 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/DESCRIPTION @@ -0,0 +1,54 @@ +Package: roxygen2 +Title: In-Line Documentation for R +Version: 7.3.2 +Authors@R: c( + person("Hadley", "Wickham", , "hadley@posit.co", role = c("aut", "cre", "cph"), + comment = c(ORCID = "0000-0003-4757-117X")), + person("Peter", "Danenberg", , "pcd@roxygen.org", role = c("aut", "cph")), + person("Gábor", "Csárdi", , "csardi.gabor@gmail.com", role = "aut"), + person("Manuel", "Eugster", role = c("aut", "cph")), + person("Posit Software, PBC", role = c("cph", "fnd")) + ) +Description: Generate your Rd documentation, 'NAMESPACE' file, and + collation field using specially formatted comments. Writing + documentation in-line with code makes it easier to keep your + documentation up-to-date as your requirements change. 'roxygen2' is + inspired by the 'Doxygen' system for C++. +License: MIT + file LICENSE +URL: https://roxygen2.r-lib.org/, https://github.com/r-lib/roxygen2 +BugReports: https://github.com/r-lib/roxygen2/issues +Depends: R (>= 3.6) +Imports: brew, cli (>= 3.3.0), commonmark, desc (>= 1.2.0), knitr, + methods, pkgload (>= 1.0.2), purrr (>= 1.0.0), R6 (>= 2.1.2), + rlang (>= 1.0.6), stringi, stringr (>= 1.0.0), utils, withr, + xml2 +Suggests: covr, R.methodsS3, R.oo, rmarkdown (>= 2.16), testthat (>= + 3.1.2), yaml +LinkingTo: cpp11 +VignetteBuilder: knitr +Config/Needs/development: testthat +Config/Needs/website: tidyverse/tidytemplate +Config/testthat/edition: 3 +Config/testthat/parallel: TRUE +Encoding: UTF-8 +Language: en-GB +RoxygenNote: 7.3.1.9000 +NeedsCompilation: yes +Packaged: 2024-06-27 21:29:24 UTC; hadleywickham +Author: Hadley Wickham [aut, cre, cph] + (), + Peter Danenberg [aut, cph], + Gábor Csárdi [aut], + Manuel Eugster [aut, cph], + Posit Software, PBC [cph, fnd] +Maintainer: Hadley Wickham +Repository: CRAN +Date/Publication: 2024-06-28 08:20:02 UTC +Built: R 4.4.0; aarch64-apple-darwin20; 2024-06-28 09:28:12 UTC; unix +Archs: roxygen2.so.dSYM +RemoteType: standard +RemotePkgRef: roxygen2 +RemoteRef: roxygen2 +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 7.3.2 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/INDEX new file mode 100644 index 00000000..a3b4eacb --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/INDEX @@ -0,0 +1,12 @@ +load Load package code +namespace_roclet Roclet: make 'NAMESPACE' +rd_roclet Roclet: make Rd files +roxygenize Process a package with the Rd, namespace and + collate roclets +tags-index-crossref Tags for indexing and cross-references +tags-namespace Tags for managing the 'NAMESPACE' +tags-rd Tags for documenting functions +tags-rd-formatting Tags related to markdown support +tags-rd-other Tags for documenting datasets and classes +tags-reuse Tags that help you reuse documentation +update_collate Update Collate field in DESCRIPTION diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/LICENSE new file mode 100644 index 00000000..97605f0d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2023 +COPYRIGHT HOLDER: roxygen2 authors diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/Meta/Rd.rds new file mode 100644 index 00000000..5137c5ca Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/Meta/features.rds new file mode 100644 index 00000000..ded31532 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/Meta/hsearch.rds new file mode 100644 index 00000000..2a368e0d Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/Meta/links.rds new file mode 100644 index 00000000..484af17d Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/Meta/nsInfo.rds new file mode 100644 index 00000000..0378195d Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/Meta/package.rds new file mode 100644 index 00000000..900d0f88 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/Meta/vignette.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/Meta/vignette.rds new file mode 100644 index 00000000..3a04fbf4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/Meta/vignette.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/NAMESPACE new file mode 100644 index 00000000..f4bd419c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/NAMESPACE @@ -0,0 +1,287 @@ +# Generated by roxygen2: do not edit by hand + +S3method(block_to_rd,default) +S3method(block_to_rd,roxy_block) +S3method(block_to_rd,roxy_block_r6class) +S3method(c,rd) +S3method(default_export,"NULL") +S3method(default_export,default) +S3method(default_export,rcclass) +S3method(default_export,s3method) +S3method(default_export,s4class) +S3method(default_export,s4generic) +S3method(default_export,s4method) +S3method(escape,"NULL") +S3method(escape,character) +S3method(escape,rd) +S3method(format,object) +S3method(format,rd_section) +S3method(format,rd_section_alias) +S3method(format,rd_section_author) +S3method(format,rd_section_backref) +S3method(format,rd_section_concept) +S3method(format,rd_section_description) +S3method(format,rd_section_details) +S3method(format,rd_section_docType) +S3method(format,rd_section_encoding) +S3method(format,rd_section_examples) +S3method(format,rd_section_family) +S3method(format,rd_section_field) +S3method(format,rd_section_formals) +S3method(format,rd_section_format) +S3method(format,rd_section_inherit) +S3method(format,rd_section_inherit_dot_params) +S3method(format,rd_section_inherit_section) +S3method(format,rd_section_keyword) +S3method(format,rd_section_minidesc) +S3method(format,rd_section_name) +S3method(format,rd_section_note) +S3method(format,rd_section_package) +S3method(format,rd_section_param) +S3method(format,rd_section_rawRd) +S3method(format,rd_section_rcmethods) +S3method(format,rd_section_reexport) +S3method(format,rd_section_references) +S3method(format,rd_section_section) +S3method(format,rd_section_seealso) +S3method(format,rd_section_slot) +S3method(format,rd_section_source) +S3method(format,rd_section_title) +S3method(format,rd_section_usage) +S3method(format,rd_section_value) +S3method(format,roxy_tag) +S3method(merge,rd_section) +S3method(merge,rd_section_author) +S3method(merge,rd_section_inherit) +S3method(merge,rd_section_inherit_dot_params) +S3method(merge,rd_section_inherit_section) +S3method(merge,rd_section_minidesc) +S3method(merge,rd_section_param) +S3method(merge,rd_section_reexport) +S3method(merge,rd_section_section) +S3method(object_defaults,"function") +S3method(object_defaults,data) +S3method(object_defaults,default) +S3method(object_defaults,import) +S3method(object_defaults,package) +S3method(object_defaults,r6class) +S3method(object_defaults,rcclass) +S3method(object_defaults,s3generic) +S3method(object_defaults,s3method) +S3method(object_defaults,s4class) +S3method(object_defaults,s4generic) +S3method(object_defaults,s4method) +S3method(object_format,default) +S3method(object_name,"function") +S3method(object_name,default) +S3method(object_name,s3generic) +S3method(object_name,s3method) +S3method(object_name,s4generic) +S3method(object_name,s4method) +S3method(object_usage,"function") +S3method(object_usage,data) +S3method(object_usage,default) +S3method(object_usage,s3method) +S3method(object_usage,s4generic) +S3method(object_usage,s4method) +S3method(print,object) +S3method(print,rd) +S3method(print,rd_section) +S3method(print,roxy_block) +S3method(print,roxy_tag) +S3method(roclet_clean,roclet_namespace) +S3method(roclet_clean,roclet_rd) +S3method(roclet_output,roclet_namespace) +S3method(roclet_output,roclet_rd) +S3method(roclet_output,roclet_vignette) +S3method(roclet_preprocess,default) +S3method(roclet_process,roclet_namespace) +S3method(roclet_process,roclet_rd) +S3method(roclet_process,roclet_vignette) +S3method(roxy_tag_ns,default) +S3method(roxy_tag_ns,roxy_tag_evalNamespace) +S3method(roxy_tag_ns,roxy_tag_export) +S3method(roxy_tag_ns,roxy_tag_exportClass) +S3method(roxy_tag_ns,roxy_tag_exportMethod) +S3method(roxy_tag_ns,roxy_tag_exportPattern) +S3method(roxy_tag_ns,roxy_tag_exportS3Method) +S3method(roxy_tag_ns,roxy_tag_import) +S3method(roxy_tag_ns,roxy_tag_importClassesFrom) +S3method(roxy_tag_ns,roxy_tag_importFrom) +S3method(roxy_tag_ns,roxy_tag_importMethodsFrom) +S3method(roxy_tag_ns,roxy_tag_rawNamespace) +S3method(roxy_tag_ns,roxy_tag_useDynLib) +S3method(roxy_tag_parse,default) +S3method(roxy_tag_parse,roxy_tag_aliases) +S3method(roxy_tag_parse,roxy_tag_author) +S3method(roxy_tag_parse,roxy_tag_backref) +S3method(roxy_tag_parse,roxy_tag_concept) +S3method(roxy_tag_parse,roxy_tag_describeIn) +S3method(roxy_tag_parse,roxy_tag_description) +S3method(roxy_tag_parse,roxy_tag_details) +S3method(roxy_tag_parse,roxy_tag_docType) +S3method(roxy_tag_parse,roxy_tag_encoding) +S3method(roxy_tag_parse,roxy_tag_eval) +S3method(roxy_tag_parse,roxy_tag_evalNamespace) +S3method(roxy_tag_parse,roxy_tag_evalRd) +S3method(roxy_tag_parse,roxy_tag_example) +S3method(roxy_tag_parse,roxy_tag_examples) +S3method(roxy_tag_parse,roxy_tag_examplesIf) +S3method(roxy_tag_parse,roxy_tag_export) +S3method(roxy_tag_parse,roxy_tag_exportClass) +S3method(roxy_tag_parse,roxy_tag_exportMethod) +S3method(roxy_tag_parse,roxy_tag_exportPattern) +S3method(roxy_tag_parse,roxy_tag_exportS3Method) +S3method(roxy_tag_parse,roxy_tag_family) +S3method(roxy_tag_parse,roxy_tag_field) +S3method(roxy_tag_parse,roxy_tag_format) +S3method(roxy_tag_parse,roxy_tag_import) +S3method(roxy_tag_parse,roxy_tag_importClassesFrom) +S3method(roxy_tag_parse,roxy_tag_importFrom) +S3method(roxy_tag_parse,roxy_tag_importMethodsFrom) +S3method(roxy_tag_parse,roxy_tag_include) +S3method(roxy_tag_parse,roxy_tag_includeRmd) +S3method(roxy_tag_parse,roxy_tag_inherit) +S3method(roxy_tag_parse,roxy_tag_inheritDotParams) +S3method(roxy_tag_parse,roxy_tag_inheritParams) +S3method(roxy_tag_parse,roxy_tag_inheritSection) +S3method(roxy_tag_parse,roxy_tag_keywords) +S3method(roxy_tag_parse,roxy_tag_md) +S3method(roxy_tag_parse,roxy_tag_method) +S3method(roxy_tag_parse,roxy_tag_name) +S3method(roxy_tag_parse,roxy_tag_noMd) +S3method(roxy_tag_parse,roxy_tag_noRd) +S3method(roxy_tag_parse,roxy_tag_note) +S3method(roxy_tag_parse,roxy_tag_order) +S3method(roxy_tag_parse,roxy_tag_param) +S3method(roxy_tag_parse,roxy_tag_rawNamespace) +S3method(roxy_tag_parse,roxy_tag_rawRd) +S3method(roxy_tag_parse,roxy_tag_rdname) +S3method(roxy_tag_parse,roxy_tag_references) +S3method(roxy_tag_parse,roxy_tag_return) +S3method(roxy_tag_parse,roxy_tag_returns) +S3method(roxy_tag_parse,roxy_tag_section) +S3method(roxy_tag_parse,roxy_tag_seealso) +S3method(roxy_tag_parse,roxy_tag_slot) +S3method(roxy_tag_parse,roxy_tag_source) +S3method(roxy_tag_parse,roxy_tag_template) +S3method(roxy_tag_parse,roxy_tag_templateVar) +S3method(roxy_tag_parse,roxy_tag_title) +S3method(roxy_tag_parse,roxy_tag_usage) +S3method(roxy_tag_parse,roxy_tag_useDynLib) +S3method(roxy_tag_rd,default) +S3method(roxy_tag_rd,roxy_tag_.formals) +S3method(roxy_tag_rd,roxy_tag_.methods) +S3method(roxy_tag_rd,roxy_tag_.package) +S3method(roxy_tag_rd,roxy_tag_.reexport) +S3method(roxy_tag_rd,roxy_tag_author) +S3method(roxy_tag_rd,roxy_tag_backref) +S3method(roxy_tag_rd,roxy_tag_concept) +S3method(roxy_tag_rd,roxy_tag_description) +S3method(roxy_tag_rd,roxy_tag_details) +S3method(roxy_tag_rd,roxy_tag_docType) +S3method(roxy_tag_rd,roxy_tag_encoding) +S3method(roxy_tag_rd,roxy_tag_evalRd) +S3method(roxy_tag_rd,roxy_tag_example) +S3method(roxy_tag_rd,roxy_tag_examples) +S3method(roxy_tag_rd,roxy_tag_examplesIf) +S3method(roxy_tag_rd,roxy_tag_family) +S3method(roxy_tag_rd,roxy_tag_field) +S3method(roxy_tag_rd,roxy_tag_format) +S3method(roxy_tag_rd,roxy_tag_includeRmd) +S3method(roxy_tag_rd,roxy_tag_inherit) +S3method(roxy_tag_rd,roxy_tag_inheritDotParams) +S3method(roxy_tag_rd,roxy_tag_inheritParams) +S3method(roxy_tag_rd,roxy_tag_inheritSection) +S3method(roxy_tag_rd,roxy_tag_keywords) +S3method(roxy_tag_rd,roxy_tag_note) +S3method(roxy_tag_rd,roxy_tag_param) +S3method(roxy_tag_rd,roxy_tag_rawRd) +S3method(roxy_tag_rd,roxy_tag_references) +S3method(roxy_tag_rd,roxy_tag_return) +S3method(roxy_tag_rd,roxy_tag_returns) +S3method(roxy_tag_rd,roxy_tag_section) +S3method(roxy_tag_rd,roxy_tag_seealso) +S3method(roxy_tag_rd,roxy_tag_slot) +S3method(roxy_tag_rd,roxy_tag_source) +S3method(roxy_tag_rd,roxy_tag_title) +S3method(roxy_tag_rd,roxy_tag_usage) +export(block_get_tag) +export(block_get_tag_value) +export(block_get_tags) +export(block_has_tags) +export(env_file) +export(env_package) +export(escape_examples) +export(is_s3_generic) +export(is_s3_method) +export(load_installed) +export(load_options) +export(load_pkgload) +export(load_source) +export(namespace_roclet) +export(object) +export(object_format) +export(parse_file) +export(parse_package) +export(parse_text) +export(rd_roclet) +export(rd_section) +export(roc_proc_text) +export(roclet) +export(roclet_clean) +export(roclet_find) +export(roclet_output) +export(roclet_preprocess) +export(roclet_process) +export(roclet_tags) +export(roxy_block) +export(roxy_meta_get) +export(roxy_tag) +export(roxy_tag_parse) +export(roxy_tag_rd) +export(roxy_tag_warning) +export(roxygenise) +export(roxygenize) +export(tag_code) +export(tag_examples) +export(tag_inherit) +export(tag_markdown) +export(tag_markdown_with_sections) +export(tag_name) +export(tag_name_description) +export(tag_toggle) +export(tag_two_part) +export(tag_value) +export(tag_words) +export(tag_words_line) +export(tags_list) +export(tags_metadata) +export(update_collate) +export(vignette_roclet) +export(warn_roxy_tag) +import(rlang) +import(stringr) +importFrom(R6,R6Class) +importFrom(knitr,knit) +importFrom(knitr,opts_chunk) +importFrom(purrr,keep) +importFrom(purrr,map) +importFrom(purrr,map2) +importFrom(purrr,map_chr) +importFrom(purrr,map_int) +importFrom(purrr,map_lgl) +importFrom(stats,setNames) +importFrom(utils,URLdecode) +importFrom(utils,URLencode) +importFrom(utils,head) +importFrom(utils,tail) +importFrom(xml2,xml_attr) +importFrom(xml2,xml_children) +importFrom(xml2,xml_contents) +importFrom(xml2,xml_find_all) +importFrom(xml2,xml_name) +importFrom(xml2,xml_ns_strip) +importFrom(xml2,xml_text) +importFrom(xml2,xml_type) +useDynLib(roxygen2, .registration=TRUE) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/NEWS.md new file mode 100644 index 00000000..4944febc --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/NEWS.md @@ -0,0 +1,1465 @@ +# roxygen2 7.3.2 + +* `@includeRmd` now additionally sets `options(cli.hyperlink = FALSE)` to make + code run in included `.Rmd`s even more consistent across sessions (#1620). + +# roxygen2 7.3.1 + +* S3 method export warning no longer fails if class contains `{` or `}` (#1575). + +* `@family` lists are now ordered more carefully, "foo1" comes after "foo" + (#1563, @krlmlr). + +* `@importFrom` works again for quoted non-syntactic names, e.g. + `@importFrom magrittr "%>%"` or ``@importFrom rlang `:=` `` + (#1570, @MichaelChirico). The unquoted form `@importFrom magrittr %>%` + continues to work. Relatedly, `@importFrom` directives matching no known + functions (e.g. `@importFrom utils plot pdf`) produce valid NAMESPACE files + again. + +* Multi-line `@rawNamespace` no longer break re-runs of `namespace_roclet()` + (#1572, @MichaelChirico). + +# roxygen2 7.3.0 + +## New features + +* `@docType package` now works more like documenting `"_PACKAGE"`, + creating a `{packagename}-package` alias and clearly suggesting that + you should switch to `"_PACKAGE"` instead (#1491). + +* `_PACKAGE` will no longer generate an alias for your package name if + a function of the same name exists (#1160). + +* The NAMESPACE roclet now reports if you have S3 methods that are missing + an `@export` tag. All S3 methods need to be `@export`ed (which confusingly + really registers the method) even if the generic is not. This avoids rare, + but hard to debug, problems (#1175). You can suppress the warning with + `@exportS3Method NULL` (#1550). + +* The `NAMESPACE` roclet once again regenerates imports _before_ loading + package code and parsing roxygen blocks. This has been the goal for a long + time (#372), but we accidentally broke it when adding support for code + execution in markdown blocks. This resolves a family of problems where you + somehow bork your `NAMESPACE` and can't easily get out of it because you + can't re-document the package because your code doesn't reload. + +## Minor improvements and bug fixes + +* If you document a function from another package it is automatically + imported. Additionally, if you set `@rdname` or `@name` you can opt out + of the default `reexports` topic generation and provide your own docs + (#1408). + +* Generate correct usage for S4 methods with non-syntactic class names. + +* The `ROXYGEN_PKG` env var provides the name of the package being documented + (#1517). + +* `@describeIn foo` now suggests that you might want `@rdname` instead + (#1493). It also gives a more informative warning if you use it with an + unsupported type (#1490). + +* In `DESCRIPTION`, URLs containing escapes in `URL` and `BugReports` are + now correctly handled (@HenningLorenzen-ext-bayer, #1415). Authors can now + have multiple email addresses (@jmbarbone, #1487). + +* `escape_examples()` is now exported (#1450). + +* `@exportS3Method` provides the needed metadata to generate correct usage + for S3 methods, just like `@method` (#1202). + +* `is_s3_generic()` now ignores non-function objects when looking for a + candidate function. I believe this is closer to how R operates. + +* `@import` and friends are now ignored if they try to import from the + package being documented. This is useful to add self-dependencies in + standalone files meant to be used in other packages (r-lib/usethis#1853). + +* `@importFrom` throws a friendlier error if you try and import a non-existing + functions (@MichaelChirico, #1409). + +* `@include` now gives an informative warning if you use a path that doesn't + exist (#1497). + +* `@inherit` can now also inherit from `@format` (#1293). + +# roxygen2 7.2.3 + +* roxygen2 now supports HTML blocks in markdown. They are only included + in the HTML manual. They can also be produced as the output of code + chunks. + +* Improved support for RStudio IDE. + +# roxygen2 7.2.2 + +* `@includeRmd` calls `local_reproducible_output()` to make code run in + included `.Rmd`s more consistent with other sources (#1431). + +* Fix duplicated argument in `roxy_block()` to avoid CRAN removal. + +# roxygen2 7.2.1 + +## Tags + +* All built-in tags are now documented so that you can do (e.g.) `?"@param"` + to get a basic description of `@param` and a pointer where to learn more + (#1165). This is powered by a new `tags_list()` lists all tags defined by + roxygen2 and `tags_metadata()` provides some useful information about them + for use by (e.g.) IDEs (#1375). + +* `@describeIn` can now be used to combine more types of functions + (generics, methods and other functions) into a single topic. + The resulting section organises the functions by type (#1181) + and displays methods like function calls. Methods are recognized only if + they extend the generic in the destination,or if the destination can + heuristically be identified as a constructor. + +* Code evaluated in inline markdown code chunks and `@eval`/`@evalRd`/ + `@evalNamespace` is now evaluated in an environment designed to be more + reproducible and to suppress output that won't work in Rd (e.g. turning + off colour and unicode support in cli) (#1351). They now also set + knitr options `comment = #>` (#1380) and `collapse = TRUE` (#1376). + +* `@export` will now export both the class and constructor function when + applied to expressions like `foo <- setClass("foo")` (#1216). + +* `@includeRmd` now gives better feedback when it fails (#1089). + +## (R)markdown + +* New `knitr_chunk_options` option (in the `Roxygen` entry of + `DESCRIPTION` or in `man/roxygen/meta.R`) is added to the knitr chunk + options that roxygen2 uses for markdown code blocks and inline + code (#1390). + +* PDF figures are only included the PDF manual, and SVG figures are only + included in the HTML manual (#1399). + +* You can now use alternative knitr engines in markdown code blocks (#1149). + +* Generated HTML for code blocks never includes "NA" for language (#1251). + +* Using a level 1 heading in the wrong tag now gives a more useful warning + (#1374). + +* Fix bug interpolating the results of indented inline RMarkdown (#1353). + +## Other + +* If you have a daily build of RStudio, the lists of changed Rd files are + now clickable so you can immediately see the rendered development + documentation (#1354). + +* R6 documentation no longer shows inherited methods if there aren't any + (#1371), and only links to superclass docs if they're actually available + (#1236). + +* Automated usage no longer mangles nbsp in default arguments (#1342). + +# roxygen2 7.2.0 + +## New features + +* The NAMESPACE roclet now preserves all existing non-import directives during + it's first pre-processing pass. This eliminates the "NAMESPACE has changed" + messages and reduces the incidence of namespace borking (#1254). + +* `@inheritParams` now only inherits exact multiparameter matches, so if you're + inheriting from a function with `@param x,y` you'll only get the parameter + documentation if your function needs docs for both x and y (#950). + +* All warning messages have been reviewed to be more informative and + actionable (#1317). `@title` now checks for multiple paragraphs. + `@export` gives a more informative warning if it contains too many lines. + (#1074). All tags warn now if only provide whitespace (#1228), and + problems with the first tag in each block are reported with the correct line + number (#1235). + +* If you have a daily build of RStudio, roxygen2 warnings will now include a + clickable hyperlink that will take you directly to the problem (#1323). + This technology is under active development across the IDE and the cli + package but is extremely exciting. + +## Minor improvements and bug fixes + +* roxygen2 can once again read UTF-8 paths on windows (#1277). + +* `@author`s are de-duplicated in merged documentation (@DanChaltiel, #1333). + +* `@exportS3method pkg::generic` now works when `pkg::generic` isn't + imported by your package (#1085). + +* `@includeRmd` is now adapted to change in rmarkdown 2.12 regarding math + support in `github_document()` (#1304). + +* `@inherit` and friends perform less aggressive link tweaking, eliminating + many spurious warnings. Additionally, when you do get a warning, you'll + now always learn which topic it's coming from (#1135). Inherited + `\ifelse{}{}{}` tags are now inserted correctly (without additional `{}`) + (#1062). + +* `@inherit` now supports inheriting "Notes" with `@inherit pkg::fun note` + (@pat-s, #1218) + +* Automatic `@usage` now correctly wraps arguments containing syntactically + significant whitespace (e.g anonymous functions) (#1281) and non-syntactic + values surrounded by backticks (#1257). + +* Markdown: + + * Code blocks are always wrapped in `
` + even if the language is unknown (#1234). + + * Links with markup (e.g. ``[foo `bar`][target]``) now cause an informative + warning instead of generating invalid Rd. + + * Curly braces in links are now escaped (#1259). + + * Inline R code is now powered by knitr. Where available, (knit) print + methods are applied (#1179). This change alters outputs and brings roxygen + in line with console and R markdown behavior. `x <- "foo"` no longer + inserts anything into the resulting documentation, but `x <- "foo"; x` + will. This also means that returning a character vector will insert + commas between components, not newlines. + +* roxygen2 no longer generates invalid HTML (#1290). + +* DOIs, arXiv links, and urls in the `Description` field of the `DESCRIPTION` + are now converted to the appropriate Rd markup (@dieghernan, #1265, #1164). + DOIs in the `URL` field of the `DESCRIPTION` are now converted to Rd's + special `\doi{}` tag (@ThierryO, #1296). + +# roxygen2 7.1.2 + +* The new `@examplesIf` tag can be used to create conditional + examples. These examples only run if a specified condition + holds (#962). + +* roxygen2 is now licensed as MIT (#1163). + +* Bug fix for upcoming stringr 2.0.0 release. + +* Code blocks with language now add `sourceCode` to the generated div; this + makes syntax highlighting more consistent across downlit/pandoc/knitr/roxygen2. + +* Percent signs in markdown link targets, e.g. `[text](https://foo/ba%20r)` + are now handled correctly (#1209). + +# roxygen2 7.1.1 + +* When processing cross package markdown links (e.g. `[pkg::fun()]`), + roxygen2 now looks up the file it needs to link to, instead of linking to + the topic, to avoid "Non-file package-anchored links" `R CMD check` warnings. + +* R6 methods and re-exported functions are always sorted in the C locale; + this ensures they're always sorted the same way in every environment (#1077). + +* roxygen2 now supports inline markdown code and code chunks inside + Rd tags. In particular in `\out{}` (#1115). + +# roxygen2 7.1.0 + +## New features + +* roxygen2 now supports inline markdown code and also code chunks, + using the same notation as the knitr package. For example: + + ```R + #' This manual was generated at: `r Sys.time()`. + #' ... + #' `mtcars` is a data frame with `r ncol(mtcars)` columns, here + #' is a summary of them: + #' + #' ```{r} + #' summary(mtcars) + #' ``` + ``` + + See `vignette("rd-formatting")` for details. + +* roxygen2 now keeps using Windows (CR LF) line endings for files that + already have CR LF line endings, and uses LF for new files (#989). + +## Minor improvements and bug fixes + +* Auto-generated package documentation can now handle author ORCID comments + containing full url (#1040). + +* Hyperlinks to R6 methods are also added in the PDF manual (#1006). + +* Empty annotations (alternate text) for figures added via markdown are now + omitted. This caused issues when generating pkgdown web sites (#1051). + +* Roxygen metadata can now have a `packages` element, giving a character vector + of package names to load. This makes it easier to use extension package that + provide new tags for existing roclets (#1013). See `?load_options` for + more details. + + ```yaml + Roxygen: list(markdown = TRUE, packages = "roxygenlabs") + ``` + +* `@evalNamespace()` works again (#1022). + +* `@description NULL` and `@details NULL` no longer fail; instead, these tags + are ignored, except for `@description NULL` in package level documentation, + where it can be used to suppress the auto-generated Description section + (#1008). + +* Multiple `@format` tags are now combined (#1015). + +* The warning for `@section` titles spanning multiple lines now includes a + hint that you're missing a colon (@maelle, #994). + +* Can now document objects created with `delayedAssign()` by forcing + evaluation at documentation time (#1041) + +# roxygen2 7.0.2 + +* `\example{}` escaping has been improved (again!) so that special escapes + within strings are correctly escaped (#990). + +# roxygen2 7.0.1 + +* `@includeRmd` has now an optional second argument, the top level section + the included file will go to. It defaults to the details section (#970). + Code chunks are now evaluated in a child of the global environment (#972). + +* `@inheritParams` does a better job of munging links. + + Links of the form `\link[=topic]{text}` are now automatically converted to + `\link[pkg:topic]{text}` when inherited from other packages (#979). + + Internal `has_topic()` helper has a better implementation; this means that + links should no longer be munged unnecessarily (#973). + +* `\example{}` escaping has been considerably simplified (#967), and is now + documented in `escape_example()`. + +* In `\usage{}`, S3/S4 methods are no longer double-escaped (#976). + +* Markdown tables with cells that contain multiple elements (e.g. text and code) + are now rendered correctly (#985). + +* Markdown code blocks containing operators and other special syntax + (e.g. `function`, `if`, `+`) now converted to `\code{}` not `\verb{}` (#971). + +# roxygen2 7.0.0 + +## New features + +### New tags + +* `@includeRmd {path.Rmd}` converts an `.Rmd`/`.md` file to `.Rd` and includes + it in the manual page. This allows sharing text between vignettes, + `README.Rmd`, and the documentation. See `vignette("rd")` for details (#902). + +* `@order {n}` tag controls the order in which blocks are processed. You can + use it to override the usual ordering which proceeds from the top of + each file to the bottom. `@order 1` will be processed before `@order 2`, + and before any blocks that don't have an explicit order set (#863). + +* `@exportS3Method` tag allows you to generate `S3method()` namespace + directives (note the different in capitalisation) (#796). Its primary use is + for "delayed" method registration, which allows you to define methods for + generics found in suggested packages (available in R 3.6 and greater). + For example, + + ```R + #' @exportS3Method package::generic + generic.foo <- function(x, ...) { + + } + ``` + + will generate + + ``` + S3method(package::generic, foo) + ``` + + (See [`vctrs::s3_register()`](https://vctrs.r-lib.org/reference/s3_register.html) + you need a version that works for earlier versions of R). + + It also has a two argument form allows you generate arbitrary `S3method()` + directives: + + ```R + #' @exportS3Method generic class + NULL + ``` + + ``` + S3method(generic, class) + ``` + +* New `@returns` is an alias for `@return` (#952). + +### R6 + +roxygen2 can now document R6 classes (#922). See `vignette("rd")` for details. + +### Markdown improvements + +* Rd comments (`%`) are now automatically escaped. You will need to replace any + existing uses of `\%` with `%` (#879). + +* Markdown headings are supported in tags like `@description`, `@details`, + and `@return` (#907, #908). Level 1 headings create a new top-level + `\section{}`. Level 2 headings and below create nested `\subsections{}`. + +* Markdown tables are converted to a `\tabular{}` macro (#290). roxygen2 + supports the [GFM table syntax](https://github.github.com/gfm/#tables-extension-) + which looks like this: + + ```md + | foo | bar | + | --- | --- | + | baz | bim | + ``` + +* Markdown code (``` `foofy` ```) is converted to to either `\code{}` or + `\verb{}`, depending on whether it not it parses as R code. This better + matches the description of `\code{}` and `\verb{}` macros, solves a certain + class of escaping problems, and should make it easier to include arbitrary + "code" snippets in documentation without causing Rd failures (#654). + +* Markdown links can now contain formatting, e.g. `[*mean*][mean]` will now + generate `\link[=mean]{\emph{mean}}`. + +* Use of unsupported markdown features (e.g. blockquotes, inline HTML, + and horizontal rules) generates informative error messages (#804). + +### Default usage + +* The default formatting for function usage that spans multiple lines has + now changed. Previously, the usage was wrapped to produce the smallest number + of lines, e.g.: + + ```R + parse_package(path = ".", env = env_package(path), + registry = default_tags(), global_options = list()) + ``` + + Now it is wrapped so that each argument gets its own line (#820): + + ```R + parse_package( + path = ".", + env = env_package(path), + registry = default_tags(), + global_options = list() + ) + ``` + + If you prefer the old behaviour you can put the following in your + `DESCRIPTION`: + + ``` + Roxygen: list(old_usage = TRUE) + ``` + +### Code loading + +roxygen2 now provides three strategies for loading your code (#822): + +* `load_pkgload()`, the default, uses [pkgload](https://github.com/r-lib/pkgload). + Compared to the previous release, this now automatically recompiles your + package if needed. + +* `load_source()` attaches required packages and `source()`s all files in `R/`. + This is a cruder simulation of package loading than pkgload (and e.g. is + unreliable if you use S4 extensively), but it does not require that the + package be compiled. Use if the default strategy (used in roxygen2 6.1.0 + and above) causes you grief. + +* `load_installed()` assumes you have installed the package. This is best + used as part of a bigger automated workflow. + +You can override the default either by calling (e.g.) `roxygenise(load_code = "source"))` or by setting the `load` option in your DESCRIPTION: `Roxygen: list(load = "source")`. + +### Options + +* As well as storing roxygen options in the `Roxygen` field of the + `DESCRIPTION` you can now also store them in `man/roxygen/meta.R` (#889). + The evaluation of this file should produce a named list that maps option + names to values. + +* roxygen now also looks for templates in `man/roxygen/templates` (#888). + +* New `rd_family_title` option: this should be a named list, and is used to + overrides the default "Other family: " prefix that `@family` generates. + For example, to override the prefix generated by `@family foo` place + `rd_family_title <- list(foo = "Custom prefix: ")` in + `man/roxygen/meta.R` (#830, @kevinushey). + +## Breaking changes + +* Rd comments (`%`) are automatically escaped in markdown formatted text. + This is a backward incompatible change because you will need to replace + existing uses of `\%` with `%` (#879). + +* Using `@docType package` no longer automatically adds `-name`. Instead + document `_PACKAGE` to get all the defaults for package documentation, or + use `@name` to override the default file name. + +* `@S3method` has been removed. It was deprecated in roxygen2 4.0.0 + released 2014-05-02, over 5 years ago. + +* Using the old `wrap` option will now trigger a warning, as hasn't worked + for quite some time. Suppress the error by deleting the option from your + `DESCRIPTION`. + +### Extending roxygen2 + +The process for extending roxygen2 with new tags and new roclets has been completely overhauled, and is now documented in `vignette("extending")`. If you're one of the few people who have written a roxygen2 extension, this will break your code - but the documentation, object structure, and print methods are now so much better that I hope it's not too annoying! Because this interface is now documented, it will not change in the future without warning and a deprecation cycle. + +If you have previously made a new roclet, the major changes are: + +* The previously internal data structures used to represent blocks and tags + have been overhauled. They are now documented and stable. See `roxy_block()` + and `roxy_tag()` for details. + +* `roclet_tags()` is no longer used; instead define a `roxy_tag_parse()` method. + For example, if you create a new `@mytag` tag, it will generate a class of + `roxy_tag_mytag`, and will be parsed by `roxy_tag_parse.roxy_tag_mytag()` + method. The method should return a new `roxy_tag()` object with the + `val` field set. + + This means that the `registry` argument is no longer needed and has + been removed. + +* `rd_section()` and `roxy_tag_rd()` are now exported so that you can more + easily extend `rd_roclet()` with your own tags that generate output in + `.Rd` files. + +* `global_options` is no longer passed to all roclet methods. Instead, use + `roxy_meta_get()` to retrieve values stored in the options (#918). + +* `tag_two_part()` and `tag_words()` are now simple functions, not function + factories. + +* `tag_markdown_restricted()` has been removed because it did exactly the + same thing as `tag_markdown()`. + +A big thanks goes to @mikldk for starting on the vignette and motivating me to make the extension process much more pleasant (#882). + +## Bug fixes and minor improvements + +* Empty roxygen2 lines at the start of a block are now silently removed (#710). + +* Whitespace is automatically trimmed off the `RoxygenNote` field when + comparing the installed version of roxygen2 to the version used to + generate the documentation (#802). + +* Files generated on Windows systems now retain their existing line endings, or + use unix-style line endings for new files (@jonthegeek, @jimhester, #840). + +* roxygen2 now recognises fully qualified S4 functions like + `methods::setGeneric()`, `methods::setClass()` and `methods::setMethod()` + (#880). + +* Package documentation now converts ORCIDs into a useful link (#721). + The package logo (if found at `man/images/logo.png`) is now scaled to 120px + wide (@peterdesmet, #834). + +* Documenting an S4 method that has a `.local()` wrapper no longer fails with + an obscure error message (#847). + +* Functions documented in `reexports` are now sorted alphabetically by + package (#765). + +* `@describeIn` can now be used with any combination of function types + (#666, #848). + +* `@description` and `@detail` tags are automatically generated from the + leading description block, and now have correct line numbers (#917). + +* `@example` and `@examples` are interwoven in the order in which they + appear (#868). + +* In `@examples`, escaped `'` and `"` in strings are no longer doubly escaped + (#873). + +* `@family` automatically adds `()` when linking to functions (#815), + and print each link on its own line (to improve diffs). + +* When `@inherit`ing from external documentation, `\link{foo}` links + are automatically transformed to `\link{package}{foo}` so that they work in + the generated documentation (#635). `\href{}` links in external inherited are + now inserted correctly (without additional `{}`) (#778). + +* `@inherit`ing a a function with no arguments no longer throws a confusing + error message (#898). + +* `@inheritDotParams` automatically ignores arguments that can't be inherited + through `...` because they are used by the current function (@mjskay, #885). + +* `@inheritDotParams` includes link to function and wraps parameters + in `\code{}` (@halldc, #842). + +* `@inheritDotParams` can be repeated to inherit dot docs from multiple + functions (@gustavdelius, #767). + +* `@inheritDotParams` avoids multiple `...` arguments (@gustavdelius, #857). + +* `@inheritParams` ignores leading dots when comparing argument names (#862). + +* `@inheritParams` warns if there are no parameters that require + documentation (#836). + +* `@param` containing only whitespace gives a clear warning message (#869). + +* Multiple `@usage` statements in a single block now generate a warning. + Previously, the first was used without a warning. + +# roxygen2 6.1.1 + +* Now specifically imports recent version of desc package (>= 1.2.0) to + fix various parsing issues (@crsh, #773, #777, #779). Multi-line DESCRIPTION + collate directives now correctly parsed on windows (@brodieG, #790). + +* `roxygenise()` no longer recompiles packages containing src code (#784). + +* `roxygenise()` now stops with an informative error message when run in a + directory that's not the package root (@mikmart, #704). + +# roxygen2 6.1.0 + +## New features + +* The `NAMESPACE` roclet now works in two passes - it first generates the + `NAMESPACE` containing only import directives because this can be generated + without evaluating the code in the package. This alleviates a problem + where it was previously possible to get into a state that you could only + get out of by carefully editing the `NAMESPACE` by hand (#372). + +* `@evalRd foo()` evaluates `foo()` defined in the package namespace and inserts + the results into the current block (#645). The code should return a character + vector with one entry for each line (and they should not start with `#'`). + + There are two small limitations to the current implementation: + + 1. The generated roxygen will not affect the `@md`/`@noMd` status + 2. `@evalRd` does not work inside templates. + +* `@evalNamespace` does for `NAMESPACE` what `@evalRd` does for Rd files: + you give it R code that produces a literal entry in `NAMESPACE` when + run. This should make it easier to export functions that are generated by + other functions in your package (#531, @egnha). + +* `@inherits` can now inherit examples (#588). + +* `vignette("rd")` received a thorough updating for current best-practices. + The vignette still needs more work so pull requests are greatly appreciated + (#650). + +* `roxygenise()` uses `pkgload::load_all()` instead of a home grown solution + to simulate package loading (this is needed because roxygen2 uses run-time + information to generate the documentation). This should reduce S4 related + problems and ensures that `devtools::document()` and `roxygenise()` always + have exactly the same behaviour (#568, #595). + +* If an inherited section cannot be found, the warning contains the help + page from which that section was requested (#732, @krlmlr). + +* roxygen2 now always reads and writes using UTF-8 encoding. If used with a + package that does not have `Encoding: UTF-8` in the DESCRIPTION, you'll + now get a warning (#564, #592). + +## Extension API + +* Roxygen blocks now have an official structure as encoded in + `roxy_block()`. It is a named list containing the tags with attributes + providing other metadata. + +* The `parsed` argument to `roclet_process()` have been replaced with + separate `blocks` and `env` arguments. + +* New `roclet_preprocess()` generic makes it possible for roclets to perform + actions before code is evaluated. + +* `parse_package()`, `parse_file()` and `parse_code()` provide an exported API + that allows you to use roxygen's parsing code independently of creating + roclets. + +## Minor improvements and bug fixes + +* All tags (including `@alias`) are now de-duplicated and consistently sorted. + This reduces spurious diffs (#586, @flying-sheep). + +* `@concept` now generates one `\concept` per tag (#611). + +* The default `@description` (i.e. the title) is now added much later in the + process. That means that `@inherit description` now works when you have + specified a title for the inheritor (#629) and the default description + is slightly nicer when merging multiple blocks. + +* `@family` automatically adds its value to concepts (#611). + +* `@inherits`: The mechanism for extracting inherited Rd does a better job of + preserving escapes (#624) + +* Empty `.Rbuildignore` now handled correctly (#576). + +* Stricter regular expression ensures only files ending with `.R` or `.r` are + parsed for roxygen comments (#625). + +* Objects with names starting with a dot are now by default documented in + files with prefix 'dot-'. + +* Roclets can now access global options as designed. This allows templates to + use markdown formatting if set globally (#594). + +* You can now autogenerate package documentation even if you don't have + `Authors@R` (#606). + +* Multiple given and/or family names are now supported in the + `Authors@R` field of the DESCRIPTION file (#672, @sgibb). + +* If a package logo exists (`man/figures/logo.png`) it will be automatically + included in generated package docs (#609). + +* Usage for data objects now correctly generated, avoiding double escaping + other components of usage (#562). + +* Improvements to markdown translation: + + * Code in link text is now properly rendered as code (#620, @egnha). + + * Whitespace between words in link text is now preserved as single + space for links of the form `[text][fcn]` and `[text](URL)` + (#628, #754, #760, @egnha and @jennybc). + + * `%` in inline code (#640), code blocks (@nteetor, #699) and + links (#724) is now automatically escaped. + + * Parsing of markdown links has been tweaked to reduce false positives + (#555). If you still get a false positive, you can now put `\\` in front + of the `[` to avoid it being converted to a link (#720). Links can no + longer be followed by `{` to avoid spurious matches to Rd commands like + `\Sexpr{}`. + + * Unsupported markdown features now generate a mildly helpful warning + instead of throwing an utterly useless error (#560). + +* `person()` now supports all + [MARC Relator](https://www.loc.gov/marc/relators/relaterm.html) role codes + (#662, @publicus). + +* `topic_add_usage()` now outputs formatted "Usage" section with max + width of 80 characters thanks to a now more flexible `wrap_string()` + (@JoshOBrien, #719). + +# roxygen2 6.0.1 + +* Allowing empty lines in .Rbuildignore. Previously, empty lines caused all + files to be ignored. (#572, @jakob-r) + +* Automatically generating a usage section for an infix function containing "<-" + no longer removes "<-" from the function name (#554). + +# roxygen2 6.0.0 + +## Markdown + +* Most fields can now be written using Markdown markup instead of the + traditional Rd language. You can turn on Markdown globally by adding + `Roxygen: list(markdown = TRUE)` to `DESCRIPTION`. The `@md` / `@noMd` + tags turn Markdown parsing on / off for the given block. See + `vignette("markdown")` for more details (#364, #431, #499, #506, #507), + by @gaborcsardi + +## Improved inheritance + +* New `@inheritDotParams` allows you to automatically generate parameter + documentation for `...` for the common case where you pass `...` on to + another function (#512). Because you often override some arguments, it + comes with a flexible specification for argument selection: + + * `@inheritDotParams foo` takes all parameters from `foo()` + * `@inheritDotParams foo a b e:h` takes parameters `a`, `b`, and all + parameters between `e` and `h` + * `@inheritDotParams foo -x -y` takes all parameters except for `x` and `y`. + + The documentation generated is similar to the style used in `?plot` + and will eventually be incorporated in to RStudio's autocomplete. + +* New `@inherit` generalises `@inheritParams`, and allows to you inherit + parameters, return, references, title, description, details, sections, and + seealso. The default `@inherit my_fun` will inherit all, you can document + an object entirely by specifying only the `@inherit` tag. Alternatively, + you can select specific tags to inherit with `@inherit my_fun return params` + (#384). + +* New `@inheritSection fun title` allows you to inherit the contents of + a single section from another topic (#513). + +* `@inheritParams` now works recursively, so that you can inherit parameters + from a function that inherited its parameters from somewhere else. It + also better handles `\dots` as an alias for `...` (#504). + +## Minor improvements and bug fixes + +### Tags + +* `@aliases` are no longer sorted alphabetically, but instead match the + order of their usage. This gives you more control in pkgdown. + +* `@describeIn` now escapes special characters in function names (#450). + +* `@family` see alsos are added in the same order they appear, not + alphabetically (#315). Fixed an issue where `.`s were sometimes added + between words within a `@family` tag (#477, @kevinushey). + +* `@author` is rendered after `@seealso`. + +* `@example` gives a nice warning message if you accidentally use it instead + of `@examples` (#494). Multiple `@examples` sections are merged (#472, @krlmlr). + +* Roxygen will no longer write out topics that don't have a name or title, + and will instead generate a warning. This makes it easier to detect if + you've accidentally used `@rdname` with an incorrect value (#474). + +### S3 + +* Non-primitive, internal S3 generics (e.g. 'rbind', 'cbind') are now properly + detected as S3 generics. (#488, @kevinushey) + +* Ensure that `functions` with S3 class are still treated as functions (#455). + +* S3 method declarations via `R.methodS3::setMethodS3()` and function + declarations via `R.oo::setConstructorS3()` are now supported + (@HenrikBengtsson, #525). + +### S4 + +* You can now document `setClassUnion()`s (#514). + +* The default alias for S4 method now re-adds trailing ANY signatures + that are sometimes dropped (#460). + +* Back references are now wrapped over multiple lines, if long + (#493, @LiNk-NY). + +### Other + +* `"_PACKAGE"` documentation now generates a default `@seealso` combining + the `URL` and `BugReport` fields, and a default `@author` field generated + from the `Authors@R` field (#527). It now works from `roxygenise()`; before + it only worked from `devtools::document()` (#439, @krlmlr). + +* Manually created `NAMESPACE` or documentation files are never overwritten, + even if using `roxygen2` for the first time (@krlmlr, #436). + +* Changes to DESCRIPTION (i.e. `Collate:` and `RoxygenNote`) now use + the desc package. This will minimise spurious changes (#430). + +* `default_data_format()` has been renamed to `object_format()`. + +* New `roclet_find()` provides a more flexible way to specify roclets: + as roclet name (e.g. "rd_roclet"), in an package ("foo::roclet_bar"), + or with options ("foo::roclet_bar(baz = TRUE)"). + +* The usage of replacement functions uses non-breaking spaces so that `<-` + will never get put on its own line (#484). + +* Roxygen now parses nonASCII documentation correctly (as long as UTF-8 + encoded or specified Encoding in DESCRIPTION) (#532, @shrektan), + and ignores files listed in `.Rbuildignore` (#446, @fmichonneau). + +## Extending roxygen2 + +* Deprecated `register.preref.parser()` and `register.preref.parsers()` + have been removed. `register_tags()` has also been removed in favour of + a new `roclet_tags()` generic. + +* `roclet()` (the constructor), `roclet_tags()`, `roclet_process()` + `roclet_output()`, `roc_clean()` and now exported making it possible + to create roclets in other packages. Helper functions `roxy_tag()` and + `roxy_tag_warning()` are also exported. + +* `new_roclet()` is no longer exported - use `roclet()` instead. + +# roxygen2 5.0.1 + +* Use `ls()`, not `names()` to list elements of environment: fixes R 3.1.0 + incompatibility (#422, @kevinushey). + +* `@export` again allows trailing new line (#415). + +* Fixed bug in `@noRd`, where usage would cause error (#418). + +# roxygen2 5.0.0 + +## New features + +* Roxygen now records its version in a single place: the `RoxygenNote` + field in the `DESCRIPTION` (#338). This will be the last time an roxygen2 + upgrade changes every file in `man/`. + +* You can now easily re-export functions that you've imported from another + package: + + ```R + #' @export + magrittr::`%>%` + ``` + + All imported-and-re-exported functions will be documented in the same + file (`rexports.Rd`), containing a brief description and links to the + original documentation (#376). + +* You can more easily generate package documentation by documenting the + special string "_PACKAGE" (@krlmlr, #349): + + ```R + #' @details Details + "_PACKAGE" + ``` + + The title and description will be automatically filled in from the + `DESCRIPTION`. + +* New tags `@rawRd` and `@rawNamespace` allow you to insert raw (unescaped) + in Rd and the `NAMESPACE` (this is useful for conditional imports). + `@evalRd()` is similar, but instead of literal Rd, you give it R code that + produces literal Rd code when run. This should make it easier to experiment + with new types of output (#385). + +* roxygen2 now parses the source code files in the order specified in the + `Collate` field in `DESCRIPTION`. This improves the ordering of the generated + documentation when using `@describeIn` and/or `@rdname` split across several + `.R` files, as often happens when working with S4 (#323, #324). + +## Minor features and bug fixes + +* The contents of documented functions are now also parsed for roxygen comments. + This allows, e.g., documenting a parameter's type close to where this type is + checked, or documenting implementation details close to the source, and + simplifies future extensions such as the documentation of R6 classes + (#397, @krlmlr). + +* Data objects get a simpler default `@format` that describes only the + object's class and dimensions. The former default, generated by generated by + `str()`, didn't usually produce useful output and was quite slow. The new S3 + generic `default_data_format()` generates the format and can be overridden to + generate a custom format (#410, @krlmlr). + +* The roxygen parsers has been completely rewritten in C++ (#295). This gives a + nice performance boost and gives: + + * Better error messages: you now get the exact the line number of the + tag, not just the start of the block. + + * The parser has been simplified a little: tags now must always start + on a new line. This is recommended practice anyway, and it means + that escaping inline `@` (with `@@`) is now optional. (#235) + + * Unknown tags now emit a warning, rather than an error. + +* `@examples` no longer complains about non-matching braces inside + strings (#329). + +* `@family` now cross-links each manual page only once, instead of linking + to all aliases (@gaborcsardi, #283, #367). + +* The special `@include` parser has also been rewritten in C++, giving + a performance boost for larger packages (#401). This is particularly + important because it's also called from `devtools::load_all()`. + Additionally, a space before `@include` is no longer necessary + (@krlmlr, #342). + +* `@inheritParams foo::bar` ensures that `%` remains escaped (#313). + +* If you document multiple arguments with one `@param`, (e.g. `@param a,b,c`) + each parameter will get a space after it so it can be wrapped in the + generated Rd file (#373). + +* `@section`s with identical titles are now merged together, just like + `@description` and `@details`. This is useful in conjunction with the + `@rdname` tag. (@krlmlr, #300). + +* Automatic `@usage` is now correctly generated for functions with string + arguments containing `"\""` (#265). + +* `load_options()` is now exported so `devtools::document()` doesn't have to + run `update_collate()` twice (#395). + +* `update_collate()` only rewrites the `Collate` entry in the DESCRIPTION file + when it changes (#325, #723). + +* An empty `NAMESPACE` file is written if it is maintained by `roxygen2` + (@krlmlr, #348). + +* Data that is not lazy-loaded can be documented (@krlmlr, #390). + +## Internal changes + +* `register.preref.parser()` and `register.preref.parsers()` have been + deprecated - please use `register_tags()` instead. + +* Parser callbacks registered with `register_tags()` are now called for fields + parsed from the "introduction" (the text before the first tag) + (@gaborcsardi, #370). + +# roxygen2 4.1.1 + +* Formatting of the `Authors@R` field in the DESCRIPTION file is now retained + (@jranke, #330). + +* The collate roclet falls back to `base::strwrap()` when generating the + collate field. This makes roxygen2 compatible with the next version of + stringr. + +* New "vignette" roclet. This vignette automatically rebuilds all out of date + vignettes (#314). + +* An off-by-one error in the C++ Roxygen preparser was fixed. + +* The new `@backref` tag makes it possible to override the sourceref for + R code generators like `Rcpp` (@krlmlr, #291, #294). + +# roxygen2 4.1.0 + +* The source of the documentation is added to autogenerated `.Rd` files. + +* If there are no `@include` tags, roxygen2 leaves the collate field alone. + This makes it easier to convert an existing project that uses a predefined + collate, but if you start with `@include` and later remove them, you'll + need to also remove the collate field (#302, #303). + +* Protected a `dir()` with `sort_c()` - If you'd noticed an inconsistency in + ordering between `devtools::document()` and `devtools::check()` this + was the cause of that. + +* Fixed broken regular expression that caused problems with stringr 1.0.0. + +* The `Authors@R` field in `DESCRIPTION` is now longer wrapped(@krlmlr, #284). + +* `@describeIn` with plain functions now correctly includes the function name + and can be applied to data documentation. (@jimhester, #285, #288). + +* Works again when called from `Rscript` and `methods` is not loaded + (@krlmlr, #305). + +# roxygen2 4.0.2 + +* If you don't use `@exports` or other namespace directives, your namespace + file will not be touched (#276). + +* Methods no longer automatically attempt to inherit parameters from + their generic. It's too fraught with difficulty (#261). + +* Roxygen now understands what to do with `setReplaceMethod()` (#266). + +* Parameter documentation is ordered according to the order of the formals, if + possible (@krlmlr, #63). + +* Export `is_s3_method()`. + +* Roxygen no longer fails when run in non-UTF-8 locales on windows. + +# roxygen2 4.0.1 + +* Explicit `updateRoxygen()` is no longer needed - `roxygenize()` does the + right thing the first time it is run. + +* Exporting a S4 generic works (#246). + +* `roxygenise()` no longer complains about absence of `wrap` field because it's + so unlikely that anyone wants the old behaviour (#245). + +# roxygen2 4.0.0 + +roxygen2 4.0.0 is a major update to roxygen2 that makes provides enhanced error handling and considerably safer default behaviour. Now, roxygen2 will never overwrite a file that it did not create. This means that before you run it for the first time, you'll need to run `roxygen2::upgradeRoxygen()`. That will flag all existing files as being created by roxygen2. + +## New features + +* Six vignettes provide a comprehensive overview of using roxygen2 in + practice. Run `browseVignettes("roxygen2")` to access. + +* `@describeIn` makes it easier to describe multiple functions in + one file. This is especially useful if you want to document methods with + their generic, or with a common class, but it's also useful if you want + to document multiple related functions in one file (#185). + +* `@field` documents the fields on a reference class (#181). It works the + same way as `@slot` for S4 classes. + +* You can now document objects defined elsewhere (like datasets) by + documenting their name as a string (#221). For example, to document an + dataset called `mydata`, you can do: + + ```R + #' Mydata set + #' + #' Some data I collected about myself + "mydata" + ``` + +* roxygen2 now adds a comment to all generated files so that you know + they've been generated, and should not be hand edited. + +* roxygen2 no longer wraps the text in Rd files by default, i.e. the default + option is `wrap = FALSE` now. To override it, you have to specify a field + `Roxygen: list(wrap = TRUE)` in `DESCRIPTION` (#178). + +* Roxygenise automatically deletes out-of-date Rd files in `man/`. + +## Improved error handling + +* roxygen2 will never overwrite a file that was not generated by + roxygen2. This means that the first time you use this version of + roxygen, you'll need to delete all existing Rd files. `roxygenise()` + gains a clean argument that will automatically remove any files + previously created by roxygen2. + +* Parsing is stricter: many issues that were previously warnings are + now errors. All errors should now give you the line number of the + roxygen block associated with the error. + +* Every input is now checked to make sure that you have matching braces + (e.g. every `{` has a matching `}`). This should prevent frustrating + errors that require careful reading of `.Rd` files (#183). + +* `@section` titles and `@export` tags can now only span a single line + to prevent common bugs. + +* `@S3method` is deprecated - just use `@export` (#198). + +* Namespace tags now throw parsing errors if you give them bad inputs (#220). + +* Better error message if you try to document something other than NULL, + an assignment, a class, a generic or a method (#194). + +## Bug fixes and minor improvements + +* Better parsing of non-syntactic function names in other packages when + used in `@inheritParams` (#236). + +* Deprecated arguments to `roxygenise()` (`roxygen.dir`, `copy.package`, + `overwrite`, `unlink.target`) removed. + +* Remove unneeded codetools and tools dependencies. + +* Bump required Rcpp version to 0.11.0, and remove custom makefiles. + +* Non-syntactic argument names (like `_x`) are now surrounded by back-ticks + in the usage (#191). + +* The internal parsers are no longer part of the public roxygen2 interface. + +* Usage statements in generated roxygen statements non-longer contain + non-ASCII characters and will be wrapped if long (#180). + +* By default, reference classes now only document their own methods, + not their methods of parents (#201). + +* Default aliases always include the original name of the object, even if + overridden by `@name`. This also means that `A <- setClass("A")` will get + two aliases by default: `A` and `A-class` (#202). Use `@aliases NULL` to + suppress default alias. + +* Non-syntactic class names (like `<-`) are now escaped in the usage + section of S4 methods (#205). + +* Eliminated two more cases where wrapping occurred even when `wrap = FALSE`. + +# roxygen2 3.1.0 + +## Documentation for reference classes + +It's now possible to document reference classes, using the "docstring" +convention described in `?setRefClass`. If you want to provide a short +paragraph description of what a method does, make the first component of the +message a string containing the description, e.g.: + +```R +setRefClass("A", methods = list( + f = function(a, b) { + "Take numbers \code{a} and \code{b} and add them together" + a + b + } +)) +``` + +Unlike the documentation for R functions, the documentation for methods can +be quite succinct. + +Roxygen adopts the convention that documented methods are public, and will +be listed in the man page for the object. Undocumented methods are private and +will not be shown in the documentation. The methods for all superclasses are +also listed, so that you don't need to flip through multiple pages of +documentation to understand what you can do with an object. All documented +methods will be placed in a bulleted list in a section titled "Methods", the +method usage will be automatically prepended to the docstring. + +## Minor fixes and improvements + +* Fixes for Rcpp 0.11.0 compatibility. + +* `roxygenise()` now invisible returns a list of all files generated + by individual roclets. This is useful for tools that want to figure + out if there are extra files in the `man/` directory. + +* `is_s3_generic()` now recognises group generics (#166). + +* Don't try and add parameters for data objects (#165). + +* Sort output of families using C locale (#171). + +* `@family` now escapes function names in references (#172). + +# roxygen2 3.0.0 + +roxygen2 now fully supports S4 and RC (reference classes) - you should no +longer need to manually add `@alias` or `@usage` tags for S4 classes, methods +and generics, or for RC classes. + +* The default usage definitions are much better, generating the correct + usage for data sets (#122), S3 methods (without additional `@method` tag), + S4 generics, S4 methods, and for replacement (#119) and infix functions. + Backslashes in function arguments in are correctly escaped. Usage statements + also use a more sophisticated line wrapping algorithm so that they should + cause fewer problems with the R CMD check line limit. (#89, #125). + +* S4 classes, S4 methods, and RC classes are given better default topics, + and the file names corresponding to those topics are shorter. + +* S4 methods will automatically inherit parameter documentation from their + generic. + +* `@slot name description` allows you to document the slots of a S4 class. + +S3 support has also been improved: roxygen2 now figures out whether a function +is a S3 method or generic. (In the rare cases it does so incorrectly, use +`@method` to manually describe the generic and class associated with a method). This means you can remove existing uses of `@method`, and can replace +`@S3method` with `@export`. + +Roxygen now has support for package specific options through the `Roxygen` +field in the `DESCRIPTION`. The value of the field should be R code that +results in a list. Currently only `wrap` and `roclet` values are supported: + +* Turn off Rd re-wrapping with adding `Roxygen: list(wrap = FALSE)` + +* Change the default roclets by specifying + `Roxygen: list(roclets = c("collate", "rd"))` + +Roxygen 3.0 also includes a number of minor fixes and improvements: + +* Infix functions are now escaped correctly in the `NAMESPACE`. (Thanks to + @crowding, #111) + +* `roxygenise()` now works more like `devtools::document()` and only ever works + in the current directory. The arguments `roxygen.dir`, `overwrite`, + `copy.package` and `unlink.target` have been deprecated due to potential + data loss problems. + +* The collate roclet is no longer a roclet: it processes R files using custom + code (only statically, not dynamically) and is designed to be executed before + the code is sourced. Run `update_collate()` to update the Collate directive + based on `@include` tags - if there are none present, a collate directive + will not be generated. + +* `@useDynLib` now works with more possible specifications - if you include a + comma in the tag value, the output will be passed as is. This means that + `@useDynLib mypackage, .registration = TRUE` will now generate + `useDynLib(mypackage, .registration = TRUE)` in the `NAMESPACE`. (#124) + +* `inst` directory not created by default (#56). + +* Explicitly depend on `utils` and `methods` packages to make roxygen + compatible with `Rscript` (#72). Import `digest` package instead of + depending on it. + +* Always use C locale when sorting `NAMESPACE` file or tags in `.Rd` files. + This ensures a consistent ordering across systems (#127). + +* Templates with extension `.r` are supported on case-sensitive file systems + (#115). Template variables now actually work (#160, thanks to @bronaugh). + +* Suppress default aliases, format and usage with `@aliases NULL`, + `@format NULL` and `@usage NULL`. + +# roxygen2 2.2.2 + +* Correctly use keyword `datasets` not `dataset` (Fixes #60) + +* Reference classes no longer given incorrect docType (data). + +# roxygen2 2.2.1 + +* Use unicode escapes in test files so tests pass on all platforms. + +* Work around bug in `gsub` in C locale by manually specifying `Encoding()`. + +# roxygen2 2.2 + +## New features + +* Package docType will automatically add package alias, if needed. (Fixes #4) + +* Data docType will automatically add `datasets` keyword, default usage, and + default format. (Fixes #5). Data docType automatically added to data + objects. + +* New `@encoding` tag for manually setting non-ASCII encodings when needed. + (Fixes #7) + +## Bug fixes + +* `write.description()` now tries much harder to respect + users' original DESCRIPTION field formatting instead of forcibly + re-wrapping certain fields at 60 characters. + +* `@details` and `@description` now work correctly + +* `@useDynLib` now works correctly: + + @useDynLib packageName routine1 routine2 + + produces + + useDynLib(packageName, routine1) + useDynLib(packageName, routine2) + + in the `NAMESPACE` file, instead of separate (wrong) useDynLib statements as + before. + +* All namespace import directives now behave in the same way as the export + directives, producing multiple single directives instead one multiple + directive: `@importClassesFrom pkg a b` now produces + `importClassesFrom(pkg, a)` and `importClassesFrom(pkg, b)` + +* In example files included with `@example` you can now use infix operators + (e.g. %*%) or other things with %, because they will be preceded by a + backslash in the Rd file. This behaviour was already in place for examples + directly included with `@examples`. + +* Aliases are no longer quoted, and % is escaped with a backslash (Fixes #24). + Names also have % escaped (Fixes #50) + +* Replacement functions (e.g. `foo<-`) now get correct usage statements: + `foo() <- value` instead of `foo()<-value`. (Fixes #38) + +* Functions with no arguments now correctly get usage statements (Fixes #35) + +* Indentation in examples now preserved (Fixes #27) + +* roxygen2 will replace characters that are not valid in filenames with a + character substitute, e.g. `[]` becomes `sub`, `<-` becomes `set` (Fixes #6) + +* Usage strings use non-breaking spaces to prevent string default values + containing whitespace to be split across multiple lines. This may cause + problems in the unlikely event that you have default value containing a + non-breaking space (`"\uA0"') (Fixes #21) + +* Functions with quoted names now get correct usage statements (Fixes #41) + +* Objects that no longer exist are not documented (Fixes #42) + +* Errors now display file name and line number of roxygen block to help you + find the problem. Thanks to code contributions from Renaud Gaujoux. + (Fixes #13) + +* Documentation with no untagged text but with `@title`, `@description` and + `@details` tags now produces correct output. + +# roxygen2 2.1 + +## New features + +* package dependencies loaded automatically + +* added support for the `@source` tag + +## Bug fixes + +* `NAMESPACE` file no longer needs to exist + +* `Collate` field in `DESCRIPTION` no longer needs to exist + +* `=` now recognised as way of assigning functions + +* `x$y <- function() {...}` no longer causes error + +* `@example` no longer added extra new-lines. + +* Correct directory normalisation under windows fixes broken test. + +* A special thanks goes to Yihui Xie who contributed all of the fixes and + improvements (bar one) in this version! + +# roxygen2 2.0 + +## Major changes + +* now works with run-time details to give more accurate output. This requires + that the source code that roxygen is documenting be loaded prior to + documentation. roxygen will attempt to do so, but you need to ensure + required packages are loaded. + + Run-time data fixes some long standing bugs where roxygen couldn't correctly + figure out function usage. We are not aware of any cases where you still + need to use the `@usage` tag. + +* written in idiomatic R, and uses S3 instead of a homegrown class system. + +* roclets build up an internal data structure instead of writing to disk + directly. This means that you can now use the `@rdname` tag to merge + documentation for multiple functions into one file, and that only unique + namespace directives are written to `NAMESPACE` (which makes `@importFrom` + much more useful). + +* some features have been removed, and may or may not (based on your feedback) + be reincluded. These include the callgraph roclet, and `R CMD roxygen`, + which only worked on some systems. + +* a templating system: use the `@template` tag to insert a `brew` template + stored in `man-roxygen`. Template variables can be set using `@templateVar + name value` and retrieved from within the template with `<%= name %>` + +* extensive use of caching to make repeated runs as fast as possible. To clear + caches and guarantee a complete rebuild, use `clear_caches()`. + +* parsing of "introduction" (the text before the first tag) has changed. Now + the title consists of the first paragraph (i.e. all text before the first + empty line), the second paragraph is the description and all others are put + in the details. Any component can be overridden with `@title`, + `@description` and `@details` as appropriate. + +## Minor changes + +* `@name` is always output as an alias, even if `@aliases` are used. + +* `@export` correctly uses `@method` to generate `S3method` namespace + directive + +## New tags + +* `@rdname filename` sets the output filename (without extension). Use for + functions non-alphanumeric functions (e.g. `[<-`) or if you want to document + multiple functions in one file + +* `@template templatename` includes a documentation template (see above) + +* `@section Section title: contents` includes a section with any title. Don't + forget the colon! That separates the title of the section from its contents. + +* `@description` and `@details` tags allow you to specify description and + details components in a template + +* `@family family name` automatically adds see-also cross-references between + all functions in a family. A function can belong to multiple families. + +* `@inheritParams name` allows you to inherit the documentation for parameters + from another function, either within the current package (`function`) or in + any other installed package (`package:function`). Currently only supports + single inheritance (i.e. you can't inherit from a function that inherits + from another function), but you can have multiple @inheritParams tags. + +* `@format` has been implemented; it existed in the roxygen package but was + actually ignored diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/R/roxygen2 b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/R/roxygen2 new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/R/roxygen2 @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/R/roxygen2.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/R/roxygen2.rdb new file mode 100644 index 00000000..cd3e6d09 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/R/roxygen2.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/R/roxygen2.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/R/roxygen2.rdx new file mode 100644 index 00000000..22199f20 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/R/roxygen2.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/extending.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/extending.R new file mode 100644 index 00000000..13b3b68c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/extending.R @@ -0,0 +1,167 @@ +## ----include = FALSE---------------------------------------------------------- +knitr::opts_chunk$set(comment = "#>", collapse = TRUE) + +## ----setup-------------------------------------------------------------------- +library(roxygen2) + +## ----------------------------------------------------------------------------- +roxy_tag("name", "Hadley") +str(roxy_tag("name", "Hadley")) + +## ----------------------------------------------------------------------------- +text <- " + #' This is a title + #' + #' This is the description. + #' + #' @param x,y A number + #' @export + f <- function(x, y) x + y +" + +# parse_text() returns a list of blocks, so I extract the first +block <- parse_text(text)[[1]] +block + +## ----------------------------------------------------------------------------- +#' @tip The mean of a logical vector is the proportion of `TRUE` values. +#' @tip You can compute means of dates and date-times! + +## ----------------------------------------------------------------------------- +roxy_tag_parse.roxy_tag_tip <- function(x) { + tag_markdown(x) +} + +## ----include = FALSE---------------------------------------------------------- +# Needed for vignette +registerS3method("roxy_tag_parse", "roxy_tag_tip", roxy_tag_parse.roxy_tag_tip) + +## ----------------------------------------------------------------------------- +text <- " + #' Title + #' + #' @tip The mean of a logical vector is the proportion of `TRUE` values. + #' @tip You can compute means of dates and date-times! + #' @md + f <- function(x, y) { + # ... + } +" +block <- parse_text(text)[[1]] +block + +str(block$tags[[2]]) + +## ----------------------------------------------------------------------------- +roxy_tag_rd.roxy_tag_tip <- function(x, base_path, env) { + rd_section("tip", x$val) +} + +## ----include = FALSE---------------------------------------------------------- +# Needed for vignette +registerS3method("roxy_tag_rd", "roxy_tag_tip", roxy_tag_rd.roxy_tag_tip) + +## ----------------------------------------------------------------------------- +format.rd_section_tip <- function(x, ...) { + paste0( + "\\section{Tips and tricks}{\n", + "\\itemize{\n", + paste0(" \\item ", x$value, "\n", collapse = ""), + "}\n", + "}\n" + ) +} + +## ----include = FALSE---------------------------------------------------------- +# Needed for vignette +registerS3method("format", "rd_section_tip", format.rd_section_tip) + +## ----------------------------------------------------------------------------- +topic <- roc_proc_text(rd_roclet(), text)[[1]] +topic$get_section("tip") + +## ----------------------------------------------------------------------------- +roxy_tag_parse.roxy_tag_memo <- function(x) { + if (!grepl("^\\[.*\\].*$", x$raw)) { + roxy_tag_warning(x, "Invalid memo format") + return() + } + + parsed <- stringi::stri_match(str = x$raw, regex = "\\[(.*)\\](.*)")[1, ] + + x$val <- list( + header = parsed[[2]], + message = parsed[[3]] + ) + x +} + +## ----include = FALSE---------------------------------------------------------- +# Needed for vignette +registerS3method("roxy_tag_parse", "roxy_tag_memo", roxy_tag_parse.roxy_tag_memo) + +## ----------------------------------------------------------------------------- +text <- " + #' @memo [TBI] Remember to implement this! + #' @memo [API] Check best API + f <- function(x, y) { + # ... + } +" +block <- parse_text(text)[[1]] +block + +str(block$tags[[1]]) + +## ----------------------------------------------------------------------------- +memo_roclet <- function() { + roclet("memo") +} + +## ----------------------------------------------------------------------------- +roclet_process.roclet_memo <- function(x, blocks, env, base_path) { + results <- list() + + for (block in blocks) { + tags <- block_get_tags(block, "memo") + + for (tag in tags) { + msg <- paste0("[", tag$file, ":", tag$line, "] ", tag$val$message) + results[[tag$val$header]] <- c(results[[tag$val$header]], msg) + } + } + + results +} + +## ----------------------------------------------------------------------------- +roclet_output.roclet_memo <- function(x, results, base_path, ...) { + for (header in names(results)) { + messages <- results[[header]] + cat(paste0(header, ": ", "\n")) + cat(paste0(" * ", messages, "\n", collapse = "")) + } + + invisible(NULL) +} + +## ----include = FALSE---------------------------------------------------------- +# Needed for vignette +registerS3method("roclet_process", "roclet_memo", roclet_process.roclet_memo) +registerS3method("roclet_output", "roclet_memo", roclet_output.roclet_memo) + +## ----------------------------------------------------------------------------- +results <- roc_proc_text(memo_roclet(), " +#' @memo [TBI] Remember to implement this! +#' @memo [API] Check best API +f <- function(x, y) { + # ... +} + +#' @memo [API] Consider passing z option +g <- function(x, y) { + # ... +} +") +roclet_output(memo_roclet(), results) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/extending.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/extending.Rmd new file mode 100644 index 00000000..03531daa --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/extending.Rmd @@ -0,0 +1,357 @@ +--- +title: "Extending roxygen2" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Extending roxygen2} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set(comment = "#>", collapse = TRUE) +``` + +## Basics + +Roxygen is extensible with user-defined **roclets**. +It means that you can take advantage of Roxygen's parser and extend it with your own `@tags`. + +There are two primary ways to extend roxygen2: + +- Add a new tag that generates a new top-level section in `.Rd` files. + +- Add a new roclet that does anything you like. + +This vignette will introduce you to the key data structures in roxygen2, and then show you how to use these two extension points. +This vignette is very rough, so you are expected to have also read some roxygen2 source code to understand all the extension points. +Hopefully, it's useful enough to help you get started, and if you have problems, please [file an issue](https://github.com/r-lib/roxygen2/issues/new)! + +```{r setup} +library(roxygen2) +``` + +## Key data structures + +Before we talk about extending roxygen2, we need to first discuss two important data structures that power roxygen: tags and blocks. + +### Tags + +A tag (a list with S3 class `roxy_tag`) represents a single tag. +It has the following fields: + +- `tag`: the name of the tag. + +- `raw`: the raw contents of the tag (i.e. everything from the end of this tag to the beginning of the next). + +- `val`: the parsed value, which we'll come back to shortly. + +- `file` and `line`: the location of the tag in the package. + Used with `roxy_tag_warning()` to produce informative error messages. + +You *can* construct tag objects by hand with `roxy_tag()`: + +```{r} +roxy_tag("name", "Hadley") +str(roxy_tag("name", "Hadley")) +``` + +However, you should rarely need to do so, because you'll typically have them given to you in a block object, as you'll see shortly. + +### Blocks + +A block (a list with S3 class `roxy_block`) represents a single roxygen block. +It has the following fields: + +- `tags`: a list of `roxy_tags`. +- `call`: the R code associated with the block (usually a function call). +- `file` and `line`: the location of the R code. +- `object`: the evaluated R object associated with the code. + +The easiest way to see the basic structure of a `roxy_block()` is to generate one by parsing a roxygen block with `parse_text()`: + +```{r} +text <- " + #' This is a title + #' + #' This is the description. + #' + #' @param x,y A number + #' @export + f <- function(x, y) x + y +" + +# parse_text() returns a list of blocks, so I extract the first +block <- parse_text(text)[[1]] +block +``` + +## Adding a new `.Rd` tag + +The easiest way to extend roxygen2 is to create a new tag that adds output to `.Rd` files. +This requires two steps: + +1. Define a `roxy_tag_parse()` method that describes how to parse our new tag. + +2. Define a `roxy_tag_rd()` method that describes how to convert the tag into `.Rd` commands. + +To illustrate the basic idea, we'll create a new `@tip` tag that will create a bulleted list of tips about how to use a function. +The idea is to take something like this: + +```{r} +#' @tip The mean of a logical vector is the proportion of `TRUE` values. +#' @tip You can compute means of dates and date-times! +``` + +And generate Rd like this: + +``` latex +\section{Tips and tricks}{ +\itemize{ + \item The mean of a logical vector is the proportion of \code{TRUE} values. + \item You can compute means of dates and date-times! +} +} +``` + +The first step is to define a method for `roxy_tag_parse()` that describes how to parse the tag text. +The name of the class will be `roxy_tag_{tag}`, which in this case is `roxy_tag_tip`. +This function takes a `roxy_tag` as input, and it's job is to set `x$val` to a convenient parsed value that will be used later by the roclet. +Here we want to process the text using Markdown so we can just use `tag_markdown()`: + +```{r} +roxy_tag_parse.roxy_tag_tip <- function(x) { + tag_markdown(x) +} +``` + +```{r, include = FALSE} +# Needed for vignette +registerS3method("roxy_tag_parse", "roxy_tag_tip", roxy_tag_parse.roxy_tag_tip) +``` + +We check this works by using `parse_text()`: + +```{r} +text <- " + #' Title + #' + #' @tip The mean of a logical vector is the proportion of `TRUE` values. + #' @tip You can compute means of dates and date-times! + #' @md + f <- function(x, y) { + # ... + } +" +block <- parse_text(text)[[1]] +block + +str(block$tags[[2]]) +``` + +(Here I explicitly turn Markdown parsing on using `@md`; it's usually turned on for a package using roxygen options). + +Next, we define a method for `roxy_tag_rd()`, which must create an `rd_section()`. +We're going to create a new section called `tip`. +It will contain a character vector of tips: + +```{r} +roxy_tag_rd.roxy_tag_tip <- function(x, base_path, env) { + rd_section("tip", x$val) +} +``` + +```{r, include = FALSE} +# Needed for vignette +registerS3method("roxy_tag_rd", "roxy_tag_tip", roxy_tag_rd.roxy_tag_tip) +``` + +This additional layer is needed because there can be multiple tags of the same type in a single block, and multiple blocks can contribute to the same `.Rd` file. +The job of the `rd_section` is to combine all the tags into a single top-level Rd section. +Each tag generates an `rd_section` which is then combined with any previous section using `merge()`. +The default `merge.rd_section()` just concatenates the values together (`rd_section(x$type, c(x$value, y$value))`); you can override this method if you need more sophisticated behaviour. + +We then need to define a `format()` method to convert this object into text for the `.Rd` file: + +```{r} +format.rd_section_tip <- function(x, ...) { + paste0( + "\\section{Tips and tricks}{\n", + "\\itemize{\n", + paste0(" \\item ", x$value, "\n", collapse = ""), + "}\n", + "}\n" + ) +} +``` + +```{r, include = FALSE} +# Needed for vignette +registerS3method("format", "rd_section_tip", format.rd_section_tip) +``` + +We can now try this out with `roclet_text()`: + +```{r} +topic <- roc_proc_text(rd_roclet(), text)[[1]] +topic$get_section("tip") +``` + +Note that there is no namespacing so if you're defining multiple new tags I recommend using your package name as the common prefix. + +## Creating a new roclet + +Creating a new roclet is usually a two part process. +First, you define new tags that your roclet will work with. +Second, you define a roclet that tells roxygen how to process an entire package. + +### Custom tags + +In this example we will make a new `@memo` tag to enable printing the memos at the console when the roclet runs. +We choose that the `@memo` has this syntax: + + @memo [Headline] Description + +As an example: + + @memo [EFFICIENCY] Currently brute-force; find better algorithm. + +As above, we first define a parse method: + +```{r} +roxy_tag_parse.roxy_tag_memo <- function(x) { + if (!grepl("^\\[.*\\].*$", x$raw)) { + roxy_tag_warning(x, "Invalid memo format") + return() + } + + parsed <- stringi::stri_match(str = x$raw, regex = "\\[(.*)\\](.*)")[1, ] + + x$val <- list( + header = parsed[[2]], + message = parsed[[3]] + ) + x +} +``` + +```{r, include = FALSE} +# Needed for vignette +registerS3method("roxy_tag_parse", "roxy_tag_memo", roxy_tag_parse.roxy_tag_memo) +``` + +Then check if it works with `parse_text()`: + +```{r} +text <- " + #' @memo [TBI] Remember to implement this! + #' @memo [API] Check best API + f <- function(x, y) { + # ... + } +" +block <- parse_text(text)[[1]] +block + +str(block$tags[[1]]) +``` + +### The roclet + +Next, we create a constructor for the roclet, which uses `roclet()`. +Our `memo` roclet doesn't have any options so this is very simple: + +```{r} +memo_roclet <- function() { + roclet("memo") +} +``` + +To give the roclet behaviour, you need to define methods. +There are two methods that almost every roclet will use: + +- `roclet_process()` is called with a list of blocks, and returns an object of your choosing. + +- `roclet_output()` produces side-effects (usually writing to disk) using the result from `roclet_process()`. + +For this roclet, we'll have `roclet_process()` collect all the memo tags into a named list: + +```{r} +roclet_process.roclet_memo <- function(x, blocks, env, base_path) { + results <- list() + + for (block in blocks) { + tags <- block_get_tags(block, "memo") + + for (tag in tags) { + msg <- paste0("[", tag$file, ":", tag$line, "] ", tag$val$message) + results[[tag$val$header]] <- c(results[[tag$val$header]], msg) + } + } + + results +} +``` + +And then have `roclet_output()` just print them to the screen: + +```{r} +roclet_output.roclet_memo <- function(x, results, base_path, ...) { + for (header in names(results)) { + messages <- results[[header]] + cat(paste0(header, ": ", "\n")) + cat(paste0(" * ", messages, "\n", collapse = "")) + } + + invisible(NULL) +} +``` + +```{r, include = FALSE} +# Needed for vignette +registerS3method("roclet_process", "roclet_memo", roclet_process.roclet_memo) +registerS3method("roclet_output", "roclet_memo", roclet_output.roclet_memo) +``` + +Then you can test if it works by using `roc_proc_text()`: + +```{r} +results <- roc_proc_text(memo_roclet(), " +#' @memo [TBI] Remember to implement this! +#' @memo [API] Check best API +f <- function(x, y) { + # ... +} + +#' @memo [API] Consider passing z option +g <- function(x, y) { + # ... +} +") +roclet_output(memo_roclet(), results) +``` + + +## Adding a roclet to your workflow + +To use a roclet when developing a package, call + +```r +roxygen2::roxygenize(roclets = "yourPackage::roclet") +``` + +where `yourPackage::roclet` is the function which creates the roclet, e.g. `memo_roclet` +above. + +You can also add the roclet to the target package's DESCRIPTION file, like this: + +```r +Roxygen: list(roclets = c("collate", "rd", "namespace", "yourPackage::roclet")) +``` + +Optionally, you can add your roclet package to the target package as a `Suggests:` dependency: + +```r +usethis::use_dev_package("yourPackage", type = "Suggests", remote = "yourGithubID/yourPackage") +``` + +You don't have to do this, but it will help other developers working on the target package. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/extending.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/extending.html new file mode 100644 index 00000000..78fc823f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/extending.html @@ -0,0 +1,708 @@ + + + + + + + + + + + + + + +Extending roxygen2 + + + + + + + + + + + + + + + + + + + + + + + + + + +

Extending roxygen2

+ + + +
+

Basics

+

Roxygen is extensible with user-defined roclets. It +means that you can take advantage of Roxygen’s parser and extend it with +your own @tags.

+

There are two primary ways to extend roxygen2:

+
    +
  • Add a new tag that generates a new top-level section in +.Rd files.

  • +
  • Add a new roclet that does anything you like.

  • +
+

This vignette will introduce you to the key data structures in +roxygen2, and then show you how to use these two extension points. This +vignette is very rough, so you are expected to have also read some +roxygen2 source code to understand all the extension points. Hopefully, +it’s useful enough to help you get started, and if you have problems, +please file an +issue!

+
library(roxygen2)
+
+
+

Key data structures

+

Before we talk about extending roxygen2, we need to first discuss two +important data structures that power roxygen: tags and blocks.

+
+

Tags

+

A tag (a list with S3 class roxy_tag) represents a +single tag. It has the following fields:

+
    +
  • tag: the name of the tag.

  • +
  • raw: the raw contents of the tag (i.e. everything +from the end of this tag to the beginning of the next).

  • +
  • val: the parsed value, which we’ll come back to +shortly.

  • +
  • file and line: the location of the tag +in the package. Used with roxy_tag_warning() to produce +informative error messages.

  • +
+

You can construct tag objects by hand with +roxy_tag():

+
roxy_tag("name", "Hadley")
+#> [????:???] @name 'Hadley' {unparsed}
+str(roxy_tag("name", "Hadley"))
+#> List of 5
+#>  $ file: chr NA
+#>  $ line: chr NA
+#>  $ raw : chr "Hadley"
+#>  $ tag : chr "name"
+#>  $ val : NULL
+#>  - attr(*, "class")= chr [1:2] "roxy_tag_name" "roxy_tag"
+

However, you should rarely need to do so, because you’ll typically +have them given to you in a block object, as you’ll see shortly.

+
+
+

Blocks

+

A block (a list with S3 class roxy_block) represents a +single roxygen block. It has the following fields:

+
    +
  • tags: a list of roxy_tags.
  • +
  • call: the R code associated with the block (usually a +function call).
  • +
  • file and line: the location of the R +code.
  • +
  • object: the evaluated R object associated with the +code.
  • +
+

The easiest way to see the basic structure of a +roxy_block() is to generate one by parsing a roxygen block +with parse_text():

+
text <- "
+  #' This is a title
+  #'
+  #' This is the description.
+  #'
+  #' @param x,y A number
+  #' @export
+  f <- function(x, y) x + y
+"
+
+# parse_text() returns a list of blocks, so I extract the first
+block <- parse_text(text)[[1]]
+block
+#> <roxy_block> [<text>:8]
+#>   $tag
+#>     [line:  2] @title 'This is a title' {parsed}
+#>     [line:  4] @description 'This is the description.' {parsed}
+#>     [line:  6] @param 'x,y A number' {parsed}
+#>     [line:  7] @export '' {parsed}
+#>     [line:  8] @usage '<generated>' {parsed}
+#>     [line:  8] @.formals '<generated>' {parsed}
+#>     [line:  8] @backref '<generated>' {parsed}
+#>   $call   f <- function(x, y) x + y
+#>   $object <function> 
+#>     $topic f
+#>     $alias f
+
+
+
+

Adding a new .Rd tag

+

The easiest way to extend roxygen2 is to create a new tag that adds +output to .Rd files. This requires two steps:

+
    +
  1. Define a roxy_tag_parse() method that describes how +to parse our new tag.

  2. +
  3. Define a roxy_tag_rd() method that describes how to +convert the tag into .Rd commands.

  4. +
+

To illustrate the basic idea, we’ll create a new @tip +tag that will create a bulleted list of tips about how to use a +function. The idea is to take something like this:

+
#' @tip The mean of a logical vector is the proportion of `TRUE` values.
+#' @tip You can compute means of dates and date-times!
+

And generate Rd like this:

+
\section{Tips and tricks}{
+\itemize{
+  \item The mean of a logical vector is the proportion of \code{TRUE} values.
+  \item You can compute means of dates and date-times!
+}
+}
+

The first step is to define a method for +roxy_tag_parse() that describes how to parse the tag text. +The name of the class will be roxy_tag_{tag}, which in this +case is roxy_tag_tip. This function takes a +roxy_tag as input, and it’s job is to set +x$val to a convenient parsed value that will be used later +by the roclet. Here we want to process the text using Markdown so we can +just use tag_markdown():

+
roxy_tag_parse.roxy_tag_tip <- function(x) {
+  tag_markdown(x)
+}
+

We check this works by using parse_text():

+
text <- "
+  #' Title
+  #'
+  #' @tip The mean of a logical vector is the proportion of `TRUE` values.
+  #' @tip You can compute means of dates and date-times!
+  #' @md
+  f <- function(x, y) {
+    # ...
+  }
+"
+block <- parse_text(text)[[1]]
+block
+#> <roxy_block> [<text>:7]
+#>   $tag
+#>     [line:  2] @title 'Title' {parsed}
+#>     [line:  4] @tip 'The mean of a logical vector is the proportion ...' {parsed}
+#>     [line:  5] @tip 'You can compute means of dates and date-times!' {parsed}
+#>     [line:  6] @md '' {parsed}
+#>     [line:  7] @usage '<generated>' {parsed}
+#>     [line:  7] @.formals '<generated>' {parsed}
+#>     [line:  7] @backref '<generated>' {parsed}
+#>   $call   f <- function(x, y) { ...
+#>   $object <function> 
+#>     $topic f
+#>     $alias f
+
+str(block$tags[[2]])
+#> List of 5
+#>  $ file: chr "<text>"
+#>  $ line: int 4
+#>  $ tag : chr "tip"
+#>  $ raw : chr "The mean of a logical vector is the proportion of `TRUE` values."
+#>  $ val : chr "The mean of a logical vector is the proportion of \\code{TRUE} values."
+#>  - attr(*, "class")= chr [1:2] "roxy_tag_tip" "roxy_tag"
+

(Here I explicitly turn Markdown parsing on using @md; +it’s usually turned on for a package using roxygen options).

+

Next, we define a method for roxy_tag_rd(), which must +create an rd_section(). We’re going to create a new section +called tip. It will contain a character vector of tips:

+
roxy_tag_rd.roxy_tag_tip <- function(x, base_path, env) {
+  rd_section("tip", x$val)
+}
+

This additional layer is needed because there can be multiple tags of +the same type in a single block, and multiple blocks can contribute to +the same .Rd file. The job of the rd_section +is to combine all the tags into a single top-level Rd section. Each tag +generates an rd_section which is then combined with any +previous section using merge(). The default +merge.rd_section() just concatenates the values together +(rd_section(x$type, c(x$value, y$value))); you can override +this method if you need more sophisticated behaviour.

+

We then need to define a format() method to convert this +object into text for the .Rd file:

+
format.rd_section_tip <- function(x, ...) {
+  paste0(
+    "\\section{Tips and tricks}{\n",
+    "\\itemize{\n",
+    paste0("  \\item ", x$value, "\n", collapse = ""),
+    "}\n",
+    "}\n"
+  )
+}
+

We can now try this out with roclet_text():

+
topic <- roc_proc_text(rd_roclet(), text)[[1]]
+topic$get_section("tip")
+#> \section{Tips and tricks}{
+#> \itemize{
+#>   \item The mean of a logical vector is the proportion of \code{TRUE} values.
+#>   \item You can compute means of dates and date-times!
+#> }
+#> }
+#> 
+

Note that there is no namespacing so if you’re defining multiple new +tags I recommend using your package name as the common prefix.

+
+
+

Creating a new roclet

+

Creating a new roclet is usually a two part process. First, you +define new tags that your roclet will work with. Second, you define a +roclet that tells roxygen how to process an entire package.

+
+

Custom tags

+

In this example we will make a new @memo tag to enable +printing the memos at the console when the roclet runs. We choose that +the @memo has this syntax:

+
@memo [Headline] Description
+

As an example:

+
@memo [EFFICIENCY] Currently brute-force; find better algorithm.
+

As above, we first define a parse method:

+
roxy_tag_parse.roxy_tag_memo <- function(x) {
+  if (!grepl("^\\[.*\\].*$", x$raw)) {
+    roxy_tag_warning(x, "Invalid memo format")
+    return()
+  }
+
+  parsed <- stringi::stri_match(str = x$raw, regex = "\\[(.*)\\](.*)")[1, ]
+
+  x$val <- list(
+    header = parsed[[2]], 
+    message = parsed[[3]]
+  )
+  x
+}
+

Then check if it works with parse_text():

+
text <- "
+  #' @memo [TBI] Remember to implement this!
+  #' @memo [API] Check best API
+  f <- function(x, y) {
+    # ...
+  }
+"
+block <- parse_text(text)[[1]]
+block
+#> <roxy_block> [<text>:4]
+#>   $tag
+#>     [line:  2] @memo '[TBI] Remember to implement this!' {parsed}
+#>     [line:  3] @memo '[API] Check best API' {parsed}
+#>     [line:  4] @usage '<generated>' {parsed}
+#>     [line:  4] @.formals '<generated>' {parsed}
+#>     [line:  4] @backref '<generated>' {parsed}
+#>   $call   f <- function(x, y) { ...
+#>   $object <function> 
+#>     $topic f
+#>     $alias f
+
+str(block$tags[[1]])
+#> List of 5
+#>  $ file: chr "<text>"
+#>  $ line: int 2
+#>  $ tag : chr "memo"
+#>  $ raw : chr "[TBI] Remember to implement this!"
+#>  $ val :List of 2
+#>   ..$ header : chr "TBI"
+#>   ..$ message: chr " Remember to implement this!"
+#>  - attr(*, "class")= chr [1:2] "roxy_tag_memo" "roxy_tag"
+
+
+

The roclet

+

Next, we create a constructor for the roclet, which uses +roclet(). Our memo roclet doesn’t have any +options so this is very simple:

+
memo_roclet <- function() {
+  roclet("memo")
+}
+

To give the roclet behaviour, you need to define methods. There are +two methods that almost every roclet will use:

+
    +
  • roclet_process() is called with a list of blocks, +and returns an object of your choosing.

  • +
  • roclet_output() produces side-effects (usually +writing to disk) using the result from +roclet_process().

  • +
+

For this roclet, we’ll have roclet_process() collect all +the memo tags into a named list:

+
roclet_process.roclet_memo <- function(x, blocks, env, base_path) {
+  results <- list()
+  
+  for (block in blocks) {
+    tags <- block_get_tags(block, "memo")
+
+    for (tag in tags) {
+      msg <- paste0("[", tag$file, ":", tag$line, "] ", tag$val$message)
+      results[[tag$val$header]] <- c(results[[tag$val$header]], msg)
+    }
+  }
+  
+  results
+}
+

And then have roclet_output() just print them to the +screen:

+
roclet_output.roclet_memo <- function(x, results, base_path, ...) {
+  for (header in names(results)) {
+    messages <- results[[header]]
+    cat(paste0(header, ": ", "\n"))
+    cat(paste0(" * ", messages, "\n", collapse = ""))
+  }
+
+  invisible(NULL)
+}
+

Then you can test if it works by using +roc_proc_text():

+
results <- roc_proc_text(memo_roclet(), "
+#' @memo [TBI] Remember to implement this!
+#' @memo [API] Check best API
+f <- function(x, y) {
+  # ...
+}
+
+#' @memo [API] Consider passing z option
+g <- function(x, y) {
+  # ...
+}
+")
+roclet_output(memo_roclet(), results)
+#> TBI: 
+#>  * [<text>:2]  Remember to implement this!
+#> API: 
+#>  * [<text>:3]  Check best API
+#>  * [<text>:8]  Consider passing z option
+
+
+
+

Adding a roclet to your workflow

+

To use a roclet when developing a package, call

+
roxygen2::roxygenize(roclets = "yourPackage::roclet")
+

where yourPackage::roclet is the function which creates +the roclet, e.g. memo_roclet above.

+

You can also add the roclet to the target package’s DESCRIPTION file, +like this:

+
Roxygen: list(roclets = c("collate", "rd", "namespace", "yourPackage::roclet")) 
+

Optionally, you can add your roclet package to the target package as +a Suggests: dependency:

+
usethis::use_dev_package("yourPackage", type = "Suggests", remote = "yourGithubID/yourPackage")
+

You don’t have to do this, but it will help other developers working +on the target package.

+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/index-crossref.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/index-crossref.R new file mode 100644 index 00000000..16f8300f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/index-crossref.R @@ -0,0 +1,19 @@ +## ----include = FALSE---------------------------------------------------------- +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) + +## ----------------------------------------------------------------------------- +#' @seealso [prod()] for products, [cumsum()] for cumulative sums, and +#' [colSums()]/[rowSums()] marginal sums over high-dimensional arrays. + +## ----eval = FALSE------------------------------------------------------------- +# list( +# rd_family_title = list(aggregations = "Aggregation functions") +# ) + +## ----------------------------------------------------------------------------- +#' @backref src/file.cpp +#' @backref src/file.h + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/index-crossref.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/index-crossref.Rmd new file mode 100644 index 00000000..98a7ad4b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/index-crossref.Rmd @@ -0,0 +1,87 @@ +--- +title: "Indexing and cross-references" +output: rmarkdown::html_vignette +description: > + Make it easier for users to find your functions + by cross-referencing them and control their + indexing. +vignette: > + %\VignetteIndexEntry{Indexing and cross-references} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + +This vignette discusses tags that help users finding documentation through cross-references and indexes. + +## See also + +`@seealso` allows you to point to other useful resources, either on the web (using a url) or to related functions (with a function link like `[function_name()])`. +For `sum()`, this might look like: + +```{r} +#' @seealso [prod()] for products, [cumsum()] for cumulative sums, and +#' [colSums()]/[rowSums()] marginal sums over high-dimensional arrays. +``` + +## Family + +If you have a family of related functions, you can use `@family {family}` to cross-reference each function to every member of the family. +A function can be a member of multiple families. + +By default `@family {family}`, will generate the see also text "Other {family}:", so the `@family` name should be plural (i.e., "model building helpers" not "model building helper"). + +If you want to override the default title, you can provide an `rd_family_title` element in a list stored in `man/roxygen/meta.R`: + +```{r, eval = FALSE} +list( + rd_family_title = list(aggregations = "Aggregation functions") +) +``` + +## References + +If the object you're documenting has connections to the scientific literature, use `@reference` to provide a citation. + +## Aliases + +`?` and `help()` look for topic aliases; `?foo` will find any topic that contains the `foo` alias. + +roxygen2 generates a default alias for you based on the object you're documenting. +You can add additional aliases with `@aliases alias1 alias2 alias3` or remove default alias with `@aliases NULL`. + +## Search + +As well as looking in the aliases, `help.search()` and `???` also look in the `@title`, `@keywords`, and `@concept`s tags. + +- `@keywords` adds standard keywords, which must be present in `file.path(R.home("doc"), "KEYWORDS")`. + +- `@concept` adds arbitrary key words or phrases. + Each `@concept` should contain a single word or phrase. + +Generally speaking, `@keywords` and `@concepts` are not terribly useful because most people find documentation using Google, not R's built-in search. + +There's one exception: `@keywords internal`. +It's useful because it removes the function from the documentation index; it's useful for functions aimed primarily at other developers, not typical users of the package. + +## Back references + +The original source location is added as a comment to the second line of each generated `.Rd` file in the following form: + + % Please edit documentation in ... + +`roxygen2` tries to capture all locations from which the documentation is assembled. +For code that *generates* R code with Roxygen comments (e.g., the Rcpp package), the `@backref` tag is provided. +This allows specifying the "true" source of the documentation, and will substitute the default list of source files. +Use one tag per source file: + +```{r} +#' @backref src/file.cpp +#' @backref src/file.h +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/index-crossref.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/index-crossref.html new file mode 100644 index 00000000..adef2854 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/index-crossref.html @@ -0,0 +1,435 @@ + + + + + + + + + + + + + + +Indexing and cross-references + + + + + + + + + + + + + + + + + + + + + + + + + + +

Indexing and cross-references

+ + + +

This vignette discusses tags that help users finding documentation +through cross-references and indexes.

+
+

See also

+

@seealso allows you to point to other useful resources, +either on the web (using a url) or to related functions (with a function +link like [function_name()]). For sum(), this +might look like:

+
#' @seealso [prod()] for products, [cumsum()] for cumulative sums, and
+#'   [colSums()]/[rowSums()] marginal sums over high-dimensional arrays.
+
+
+

Family

+

If you have a family of related functions, you can use +@family {family} to cross-reference each function to every +member of the family. A function can be a member of multiple +families.

+

By default @family {family}, will generate the see also +text “Other {family}:”, so the @family name should be +plural (i.e., “model building helpers” not “model building helper”).

+

If you want to override the default title, you can provide an +rd_family_title element in a list stored in +man/roxygen/meta.R:

+
list(
+  rd_family_title = list(aggregations = "Aggregation functions")
+)
+
+
+

References

+

If the object you’re documenting has connections to the scientific +literature, use @reference to provide a citation.

+
+
+

Aliases

+

? and help() look for topic aliases; +?foo will find any topic that contains the foo +alias.

+

roxygen2 generates a default alias for you based on the object you’re +documenting. You can add additional aliases with +@aliases alias1 alias2 alias3 or remove default alias with +@aliases NULL.

+
+ +
+

Back references

+

The original source location is added as a comment to the second line +of each generated .Rd file in the following form:

+
% Please edit documentation in ...
+

roxygen2 tries to capture all locations from which the +documentation is assembled. For code that generates R code with +Roxygen comments (e.g., the Rcpp package), the @backref tag +is provided. This allows specifying the “true” source of the +documentation, and will substitute the default list of source files. Use +one tag per source file:

+
#' @backref src/file.cpp
+#' @backref src/file.h
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/index.html new file mode 100644 index 00000000..fb2511e2 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/index.html @@ -0,0 +1,64 @@ + + +R: Vignettes and other documentation + + + +
+

Vignettes and other documentation + +

+
+
+[Top] +
+

Vignettes from package 'roxygen2'

+ +++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
roxygen2::extendingExtending roxygen2HTMLsourceR code
roxygen2::index-crossrefIndexing and cross-referencesHTMLsourceR code
roxygen2::namespaceManaging imports and exportsHTMLsourceR code
roxygen2::rd-formatting(R)Markdown supportHTMLsourceR code
roxygen2::rd-otherDocumenting other objectsHTMLsourceR code
roxygen2::rdDocumenting functionsHTMLsourceR code
roxygen2::reuseReusing documentationHTMLsourceR code
roxygen2::roxygen2Get started with roxygen2HTMLsourceR code
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/namespace.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/namespace.R new file mode 100644 index 00000000..cb452851 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/namespace.R @@ -0,0 +1,71 @@ +## ----include = FALSE---------------------------------------------------------- +knitr::opts_chunk$set(comment = "#>", collapse = TRUE) + +## ----------------------------------------------------------------------------- +#' Add two numbers together +#' +#' @param x,y A pair of numbers. +#' @export +add <- function(x, y) { + x + y +} + +## ----------------------------------------------------------------------------- +#' Take an object to bizarro world +#' +#' @param x A vector. +#' @export +bizarro <- function(x, ...) { + UseMethod("bizarro") +} + +## ----------------------------------------------------------------------------- +#' @export +bizarro.character <- function(x, ...) { + letters <- strsplit(x, "") + letters_rev <- lapply(letters, rev) + vapply(letters_rev, paste, collapse = "", FUN.VALUE = character(1)) +} + +## ----------------------------------------------------------------------------- +#' Take an object to bizarro world +#' +#' @description +#' This is an S3 generic. This package provides methods for the +#' following classes: +#' +#' * `character`: reverses the order of the letters in each element of +#' the vector. +#' +#' @param x A vector. +#' @export +bizarro <- function(x, ...) { + UseMethod("bizarro") +} + +#' @export +#' @rdname bizarro +bizarro.character <- function(x, ...) { + letters <- strsplit(x, "") + letters_rev <- lapply(letters, rev) + vapply(letters_rev, paste, collapse = "", FUN.VALUE = character(1)) +} + +## ----------------------------------------------------------------------------- +#' @exportS3Method pkg::generic +generic.foo <- function(x, ...) { +} + +## ----------------------------------------------------------------------------- +# From dplyr: +#' @rawNamespace import(vctrs, except = data_frame) + +# From backports: +#' @rawNamespace if (getRversion() < "4.0.0") export(stopifnot) + +## ----------------------------------------------------------------------------- +#' @importFrom pkg fun1 fun2 +#' @importFrom pkg2 fun3 +#' @importFrom pkg3 fun4 +NULL + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/namespace.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/namespace.Rmd new file mode 100644 index 00000000..b040ccc8 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/namespace.Rmd @@ -0,0 +1,215 @@ +--- +title: "Managing imports and exports" +description: > + Generating the `NAMESPACE` file with roxygen2. +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Managing imports and exports} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set(comment = "#>", collapse = TRUE) +``` + +The package `NAMESPACE` is one of the most confusing parts of building a package. +roxygen2 aims to make it as easy as possible to build a package that is a well-behaved member of the R ecosystem. +This is a little frustrating at first, but soon becomes second-nature. + +## Exports + +In order for your users to use a function[^1] in your package, you must **export** it. +In most cases, you can just use the `@export` tag, and roxygen2 will automatically figure out which `NAMESPACE` directive (i.e. `export()`, `exportS3method()`, `exportClasses()`, or`exportMethods()`) you need. + +[^1]: Including S3 and S4 generics and methods. + +Note that datasets should never be exported as they are not found in `NAMESPACE`. +Instead, datasets will either be automatically exported if you set `LazyData: true` in your `DESCRIPTION`, or made available after calling `data()` if not. + +### Functions + +A function should be exported if it is user facing; it should not be exported if it's for internal use only. +If you export a function, you must also document it, and since other people will use it, you need to be careful if you later change the function interface. + +```{r} +#' Add two numbers together +#' +#' @param x,y A pair of numbers. +#' @export +add <- function(x, y) { + x + y +} +``` + +### S3 + +An S3 generic works like a regular R function so export it following the advice above: if you want users to call it, export; otherwise, don't. + +```{r} +#' Take an object to bizarro world +#' +#' @param x A vector. +#' @export +bizarro <- function(x, ...) { + UseMethod("bizarro") +} +``` + +While S3 methods are regular functions with a special naming scheme, their "export" works a bit differently. +S3 methods are exported only in the sense that calling the generic with the appropriate class will call the method; a user can't directly access the method definition by typing its name. +A more technically correctly term would be to say that the method is **registered** so that the generics can find it. + +You must register, i.e. `@export`, every S3 method regardless of whether or not the generic is exported. +roxygen2 will warn you if you have forgotten. + +```{r} +#' @export +bizarro.character <- function(x, ...) { + letters <- strsplit(x, "") + letters_rev <- lapply(letters, rev) + vapply(letters_rev, paste, collapse = "", FUN.VALUE = character(1)) +} +``` + +If you are exporting a method in some other way, you can use `@exportS3Method NULL` to suppress the warning. + +You have four options for documenting an S3 method: + +- Don't document it; it's not required, and not needed for simple generics where the user won't care about the details. +- If the method is particularly complex or has many arguments that the generic does not, you can document it in its own file. In this case, just document it as if it's a function. +- You can use `@rdname` to document it with other methods for the generic. This is a good option if it's your generic, and you're providing a bunch of methods for different classes. +- You can use `@rdname` to document it with other methods for the class. This is typically the least appealing option because the different generics will have different arguments, leading to a cluttered and potentially confusing page. + +```{r} +#' Take an object to bizarro world +#' +#' @description +#' This is an S3 generic. This package provides methods for the +#' following classes: +#' +#' * `character`: reverses the order of the letters in each element of +#' the vector. +#' +#' @param x A vector. +#' @export +bizarro <- function(x, ...) { + UseMethod("bizarro") +} + +#' @export +#' @rdname bizarro +bizarro.character <- function(x, ...) { + letters <- strsplit(x, "") + letters_rev <- lapply(letters, rev) + vapply(letters_rev, paste, collapse = "", FUN.VALUE = character(1)) +} +``` + +Typically, you will write methods for generics that are either defined in the current package or a package that is a hard dependency[^2] of your package. +Sometimes, however, you will want to write a method for a suggested dependency. +In this case, `@export` will not work because it assumes the generic is included or imported in your `NAMESPACE`. Instead, use `@exportS3Method`. This will use "delayed" method registration, which means the method will only be registered when the suggested package is loaded. + +[^2]: i.e. it is listed in either the `Imports` or `Depends` fields in your `DESCRIPTION`. + +To use `@exportS3Method` you must provide the package and generic name in the following format: + +```{r} +#' @exportS3Method pkg::generic +generic.foo <- function(x, ...) { +} +``` + +### S4 + +- **Classes**: export the class object if you want others to be able to extend it. + +- **Generics:** treat it like a function and `@export` if user facing. + +- **Methods**: you only need to `@export` a method, if the generic lives in another package. + Unlike S3, you must document S4 methods. + Because method details are often not that important, it's common to use `@rdname` to put the documentation for unimportant methods into a single topic with `@keywords internal`. + +### Manual exports + +If `@export` does not automatically generate the correct `NAMESPACE` directive, you can use one of the tags below to exercise greater control: + +- `@export foo` generates `export(foo)` +- `@exportS3Method generic method` generates `S3method(generic, method)` +- `@exportClass foo` generates `exportClasses(foo)` +- `@exportMethod foo` generates `exportMethods(foo)` +- `@exportPattern foo` generates `exportPattern(foo)` + +For even more specialised cases you can use `@rawNamespace code` which inserts `code` literally into the `NAMESPACE`. +This is useful if you need a conditional import or export, e.g. + +```{r} +# From dplyr: +#' @rawNamespace import(vctrs, except = data_frame) + +# From backports: +#' @rawNamespace if (getRversion() < "4.0.0") export(stopifnot) +``` + +If you need to automate this, `@evalNamespace fun()` will evaluate `fun()` in the package environment and insert the results into `NAMESPACE`. +Note that because `evalNamespace()` is run in the package environment, it can only generate exports, not imports. + +## Imports + +The `NAMESPACE` also controls which functions from other packages are made available to your package. + +### Functions + +If you are using just a few functions from another package, we recommending adding the package to the `Imports:` field of the `DESCRIPTION` file and calling the functions explicitly using `::`, e.g., `pkg::fun()`. + +``` r +my_function <- function(x, y) { + pkg::fun(x) * y +} +``` + +If the repetition of the package name becomes annoying you can `@importFrom` and drop the `::`: + +``` r +#' @importFrom pkg fun +my_function <- function(x, y) { + fun(x) * y +} +``` + +Imports affect every function in a package, so it's common to collect them in a central place, like `{packagename}-package.R`. +This is automated by `usethis::use_import_from()`. + +```{r} +#' @importFrom pkg fun1 fun2 +#' @importFrom pkg2 fun3 +#' @importFrom pkg3 fun4 +NULL +``` + +Note the use of `NULL` here: you must provide something for roxygen2 to document, so we use `NULL` as place holder. + +It is possible, but not generally recommended to import all functions from a package with `@import package`. +This is risky if you import functions from more than one package, because while it might be ok today, in the future the packages might end up with a function having the same name, and your users will get a warning every time your package is loaded. + +### S3 + +S3 generics are just functions, so the same rules for functions apply. +S3 methods always accompany the generic, so as long as you can access the generic (either implicitly or explicitly), the methods will also be available. +In other words, you don't need to do anything special for S3 methods. +As long as you've imported the generic, all the methods will also be available. + +### S4 + +- To use classes defined in another package, place `@importClassesFrom package ClassA ClassB ...` next to the classes that inherit from the imported classes, or next to the methods that implement a generic for the imported classes. +- To use generics defined in another package, place `@importMethodsFrom package GenericA GenericB ...` next to the methods that use the imported generics. + +### Compiled code + +To import compiled code from another package, use `@useDynLib` + +- `@useDynLib package` imports all compiled functions. + +- `@useDynLib package routinea routineb` imports selected compiled functions. + +- Any `@useDynLib` specification containing a comma, e.g. `@useDynLib mypackage, .registration = TRUE` will be inserted as is into the the NAMESPACE, e.g. `useDynLib(mypackage, .registration = TRUE)` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/namespace.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/namespace.html new file mode 100644 index 00000000..68130a3a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/namespace.html @@ -0,0 +1,601 @@ + + + + + + + + + + + + + + +Managing imports and exports + + + + + + + + + + + + + + + + + + + + + + + + + + +

Managing imports and exports

+ + + +

The package NAMESPACE is one of the most confusing parts +of building a package. roxygen2 aims to make it as easy as possible to +build a package that is a well-behaved member of the R ecosystem. This +is a little frustrating at first, but soon becomes second-nature.

+
+

Exports

+

In order for your users to use a function1 in your package, you +must export it. In most cases, you can just use the +@export tag, and roxygen2 will automatically figure out +which NAMESPACE directive (i.e. export(), +exportS3method(), exportClasses(), +orexportMethods()) you need.

+

Note that datasets should never be exported as they are not found in +NAMESPACE. Instead, datasets will either be automatically +exported if you set LazyData: true in your +DESCRIPTION, or made available after calling +data() if not.

+
+

Functions

+

A function should be exported if it is user facing; it should not be +exported if it’s for internal use only. If you export a function, you +must also document it, and since other people will use it, you need to +be careful if you later change the function interface.

+
#' Add two numbers together
+#' 
+#' @param x,y A pair of numbers.
+#' @export
+add <- function(x, y) {
+  x + y
+}
+
+
+

S3

+

An S3 generic works like a regular R function so export it following +the advice above: if you want users to call it, export; otherwise, +don’t.

+
#' Take an object to bizarro world
+#' 
+#' @param x A vector.
+#' @export
+bizarro <- function(x, ...) {
+  UseMethod("bizarro")
+}
+

While S3 methods are regular functions with a special naming scheme, +their “export” works a bit differently. S3 methods are exported only in +the sense that calling the generic with the appropriate class will call +the method; a user can’t directly access the method definition by typing +its name. A more technically correctly term would be to say that the +method is registered so that the generics can find +it.

+

You must register, i.e. @export, every S3 method +regardless of whether or not the generic is exported. roxygen2 will warn +you if you have forgotten.

+
#' @export
+bizarro.character <- function(x, ...) {
+  letters <- strsplit(x, "")
+  letters_rev <- lapply(letters, rev)
+  vapply(letters_rev, paste, collapse = "", FUN.VALUE = character(1))
+}
+

If you are exporting a method in some other way, you can use +@exportS3Method NULL to suppress the warning.

+

You have four options for documenting an S3 method:

+
    +
  • Don’t document it; it’s not required, and not needed for simple +generics where the user won’t care about the details.
  • +
  • If the method is particularly complex or has many arguments that the +generic does not, you can document it in its own file. In this case, +just document it as if it’s a function.
  • +
  • You can use @rdname to document it with other methods +for the generic. This is a good option if it’s your generic, and you’re +providing a bunch of methods for different classes.
  • +
  • You can use @rdname to document it with other methods +for the class. This is typically the least appealing option because the +different generics will have different arguments, leading to a cluttered +and potentially confusing page.
  • +
+
#' Take an object to bizarro world
+#' 
+#' @description
+#' This is an S3 generic. This package provides methods for the 
+#' following classes:
+#' 
+#' * `character`: reverses the order of the letters in each element of 
+#'    the vector.
+#' 
+#' @param x A vector.
+#' @export
+bizarro <- function(x, ...) {
+  UseMethod("bizarro")
+}
+
+#' @export
+#' @rdname bizarro
+bizarro.character <- function(x, ...) {
+  letters <- strsplit(x, "")
+  letters_rev <- lapply(letters, rev)
+  vapply(letters_rev, paste, collapse = "", FUN.VALUE = character(1))
+}
+

Typically, you will write methods for generics that are either +defined in the current package or a package that is a hard dependency2 of your +package. Sometimes, however, you will want to write a method for a +suggested dependency. In this case, @export will not work +because it assumes the generic is included or imported in your +NAMESPACE. Instead, use @exportS3Method. This +will use “delayed” method registration, which means the method will only +be registered when the suggested package is loaded.

+

To use @exportS3Method you must provide the package and +generic name in the following format:

+
#' @exportS3Method pkg::generic
+generic.foo <- function(x, ...) {
+}
+
+
+

S4

+
    +
  • Classes: export the class object if you want +others to be able to extend it.

  • +
  • Generics: treat it like a function and +@export if user facing.

  • +
  • Methods: you only need to @export a +method, if the generic lives in another package. Unlike S3, you must +document S4 methods. Because method details are often not that +important, it’s common to use @rdname to put the +documentation for unimportant methods into a single topic with +@keywords internal.

  • +
+
+
+

Manual exports

+

If @export does not automatically generate the correct +NAMESPACE directive, you can use one of the tags below to +exercise greater control:

+
    +
  • @export foo generates export(foo)
  • +
  • @exportS3Method generic method generates +S3method(generic, method)
  • +
  • @exportClass foo generates +exportClasses(foo)
  • +
  • @exportMethod foo generates +exportMethods(foo)
  • +
  • @exportPattern foo generates +exportPattern(foo)
  • +
+

For even more specialised cases you can use +@rawNamespace code which inserts code +literally into the NAMESPACE. This is useful if you need a +conditional import or export, e.g.

+
# From dplyr:
+#' @rawNamespace import(vctrs, except = data_frame)
+
+# From backports:
+#' @rawNamespace if (getRversion() < "4.0.0") export(stopifnot)
+

If you need to automate this, @evalNamespace fun() will +evaluate fun() in the package environment and insert the +results into NAMESPACE. Note that because +evalNamespace() is run in the package environment, it can +only generate exports, not imports.

+
+
+
+

Imports

+

The NAMESPACE also controls which functions from other +packages are made available to your package.

+
+

Functions

+

If you are using just a few functions from another package, we +recommending adding the package to the Imports: field of +the DESCRIPTION file and calling the functions explicitly +using ::, e.g., pkg::fun().

+
my_function <- function(x, y) {
+  pkg::fun(x) * y
+}
+

If the repetition of the package name becomes annoying you can +@importFrom and drop the :::

+
#' @importFrom pkg fun 
+my_function <- function(x, y) {
+  fun(x) * y
+}
+

Imports affect every function in a package, so it’s common to collect +them in a central place, like {packagename}-package.R. This +is automated by usethis::use_import_from().

+
#' @importFrom pkg fun1 fun2
+#' @importFrom pkg2 fun3
+#' @importFrom pkg3 fun4
+NULL
+#> NULL
+

Note the use of NULL here: you must provide something +for roxygen2 to document, so we use NULL as place +holder.

+

It is possible, but not generally recommended to import all functions +from a package with @import package. This is risky if you +import functions from more than one package, because while it might be +ok today, in the future the packages might end up with a function having +the same name, and your users will get a warning every time your package +is loaded.

+
+
+

S3

+

S3 generics are just functions, so the same rules for functions +apply. S3 methods always accompany the generic, so as long as you can +access the generic (either implicitly or explicitly), the methods will +also be available. In other words, you don’t need to do anything special +for S3 methods. As long as you’ve imported the generic, all the methods +will also be available.

+
+
+

S4

+
    +
  • To use classes defined in another package, +place @importClassesFrom package ClassA ClassB ... next to +the classes that inherit from the imported classes, or next to the +methods that implement a generic for the imported classes.
  • +
  • To use generics defined in another package, +place @importMethodsFrom package GenericA GenericB ... next +to the methods that use the imported generics.
  • +
+
+
+

Compiled code

+

To import compiled code from another package, use +@useDynLib

+
    +
  • @useDynLib package imports all compiled +functions.

  • +
  • @useDynLib package routinea routineb imports +selected compiled functions.

  • +
  • Any @useDynLib specification containing a comma, +e.g. @useDynLib mypackage, .registration = TRUE will be +inserted as is into the the NAMESPACE, +e.g. useDynLib(mypackage, .registration = TRUE)

  • +
+
+
+
+
+
    +
  1. Including S3 and S4 generics and methods.↩︎

  2. +
  3. i.e. it is listed in either the Imports or +Depends fields in your DESCRIPTION.↩︎

  4. +
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd-formatting.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd-formatting.R new file mode 100644 index 00000000..aabbe8c3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd-formatting.R @@ -0,0 +1,33 @@ +## ----include = FALSE---------------------------------------------------------- +knitr::opts_chunk$set(comment = "#>", collapse = TRUE) + +## ----echo=FALSE--------------------------------------------------------------- +simple_fenced <- "#' @title Title +#' @details Details +#' ```{r lorem} +#' 1+1 +#' ``` +#' @md +foo <- function() NULL +" + +## ----code=simple_fenced------------------------------------------------------- +#' @title Title +#' @details Details +#' ```{r lorem} +#' 1+1 +#' ``` +#' @md +foo <- function() NULL + + +## ----lorem-------------------------------------------------------------------- +1+1 + +## ----echo=FALSE, results="asis"----------------------------------------------- +cat( + "\x60\x60\x60rd\n", + format(roxygen2:::roc_proc_text(roxygen2::rd_roclet(), simple_fenced)[[1]]), + "\n\x60\x60\x60" +) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd-formatting.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd-formatting.Rmd new file mode 100644 index 00000000..6bedea16 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd-formatting.Rmd @@ -0,0 +1,365 @@ +--- +title: "(R)Markdown support" +description: > + The details of the (R)Markdown support provided by roxygen2. +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{(R)Markdown support} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set(comment = "#>", collapse = TRUE) +``` + +We expect most roxygen2 users will write documentation using markdown rather than Rd syntax, since it's familiar, and doesn't require learning any new syntax. +In most cases, you can just use your existing RMarkdown knowledge and it'll work as you expect. +When it doesn't, you can read this vignette to figure out what's going on and how to fix it. + +## Enabling markdown support + +To turn on Markdown support for a package, insert this entry into the `DESCRIPTION` file of the package: + + Roxygen: list(markdown = TRUE) + +If you use devtools/usethis, this will be automatically inserted for you when you create a new package. +If you're updating an existing package, we recommend `usethis::use_roxygen_md()` which will modify the `DESCRIPTION` and prompt you to use the [roxygen2md](https://roxygen2md.r-lib.org) package to convert your existing docs. + +If needed, you can also use `@md` or `@noMd` to turn markdown support on or off for a documentation block. + +Here is an example roxygen chunk that uses Markdown. + +``` r +#' Use roxygen to document a package +#' +#' This function is a wrapper for the [roxygen2::roxygenize()] function from +#' the roxygen2 package. See the documentation and vignettes of +#' that package to learn how to use roxygen. +#' +#' @param pkg package description, can be path or package name. See +#' [as.package()] for more information. +#' @param clean,reload Deprecated. +#' @inheritParams roxygen2::roxygenise +#' @seealso [roxygen2::roxygenize()], `browseVignettes("roxygen2")` +#' @export +``` + +## Basic syntax + +roxygen uses the [commonmark package](https://github.com/r-lib/commonmark), based on the "CommonMark Reference Implementation". +See for more about the parser and the markdown language it supports. +The most important details are described below. + +### Sections and subsections + +The usual Markdown heading markup creates sections and subsections. +Top level headings (e.g. `# title`) create sections with the `\section{}` Rd tag. +This largely supersedes use of the older `@section` tag. + +Top-level headings can only appear after the `@description` and `@details` tags. +Since `@details` can appear multiple times in a block, you can always precede a '`#`' section with `@details`, if you want put it near the end of the block, after `@return` for example: + +``` r +#' @details +#' Trim the leading and trailing whitespace from a character vector. +#' +#' @param x Character vector. +#' @return Character vector, with the whitespace trimmed. +#' +#' @details # This will be a new section +#' ... +``` + +Top level sections are placed at a fixed position in the manual page, after the parameters and the details, but before `\note{}`, `\seealso{}` and the `\examples{}`. +Their order will be the same as in the roxygen block. + +Headings at level two and above may appear inside any roxygen tag that formats lines of text, e.g. `@description`, `@details`, `@return`, and create subsections with the `\subsection{}` Rd tag. + +``` r +#' @details +#' ## Subsection within details +#' ### Sub-subsection +#' ... text ... +``` + +### Inline formatting + +For *emphasis*, put the text between asterisks or underline characters. +For **strong** text, use two asterisks at both sides. + +``` r +#' @references +#' Robert E Tarjan and Mihalis Yannakakis. (1984). Simple +#' linear-time algorithms to test chordality of graphs, test acyclicity +#' of hypergraphs, and selectively reduce acyclic hypergraphs. +#' *SIAM Journal of Computation* **13**, 566-579. +``` + +``` r +#' See `::is_falsy` for the definition of what is _falsy_ +#' and what is _truthy_. +``` + +### Code + +Inline code is supported via backticks. + +``` r +#' @param ns Optionally, a named vector giving prefix-url pairs, as +#' produced by `xml_ns`. If provided, all names will be explicitly +#' qualified with the ns prefix, i.e. if the element `bar` is defined ... +``` + +For blocks of code, put your code between triple backticks: + +``` r +#' ``` +#' pkg <- make_packages( +#' foo1 = { f <- function() print("hello!") ; d <- 1:10 }, +#' foo2 = { f <- function() print("hello again!") ; d <- 11:20 } +#' ) +#' foo1::f() +#' foo2::f() +#' foo1::d +#' foo2::d +#' dispose_packages(pkg) +#' ``` +``` + +You can also include executable code chunks using the usual knitr syntax. +See below for more details. + +### Lists + +Regular Markdown lists are recognized and converted to `\enumerate{}` or `\itemize{}` lists: + +``` r +#' There are two ways to use this function: +#' 1. If its first argument is not named, then it returns a function +#' that can be used to color strings. +#' 1. If its first argument is named, then it also creates a +#' style with the given name. This style can be used in +#' `style`. One can still use the return value +#' of the function, to create a style function. +``` + +``` r +#' The style (the `...` argument) can be anything of the +#' following: +#' * An R color name, see `colors()`. +#' * A 6- or 8-digit hexa color string, e.g. `#ff0000` means +#' red. Transparency (alpha channel) values are ignored. +#' * A one-column matrix with three rows for the red, green, +#' and blue channels, as returned by [grDevices::col2rgb()]. +``` + +Note that you do not have to leave an empty line before the list. +This is different from some Markdown parsers. + +### Tables + +Use [GFM table formatting](https://github.github.com/gfm/#tables-extension-): + +``` md +| foo | bar | +| --- | --- | +| baz | bim | +``` + +By default, columns are left-aligned. +Use colons to generate right and center aligned columns: + +``` md +| left | center | right | +| :--- | :----: | ----: | +| 1 | 2 | 3 | +``` + +### Links + +Markdown hyperlinks work as usual: + +``` r +#' See more about the Markdown markup at the +#' [Commonmark web site](http://commonmark.org/help) +``` + +URLs inside angle brackets are also automatically converted to hyperlinks: + +``` r +#' The main R web site is at . +``` + +### Images + +Markdown syntax for inline images works. +The image files must be in the `man/figures` directory: + +``` r +#' Here is an example plot: +#' ![](example-plot.jpg "Example Plot Title") +``` + +## Function links + +Markdown notation can also be used to create links to other help topics. +There are two basic forms: + +- `[topic]`: The link text is automatically generated from the topic. +- `[text][topic]`: You supply the link text. + +### Default link text + +First we explore the simplest form: `[ref]`. +The presence of trailing parentheses, e.g., `[func()]`, signals that the target `func` is a function, which causes two things to happen: + +- The link text `func()` is automatically typeset as code. +- The parentheses are stripped in the derived Rd link target. + ++----------------------+---------------------+---------------------------------------------+ +| Markdown | Links to help\ | Notes | +| | topic for ... | | ++:=====================+:====================+:============================================+ +| `[func()]`\ | a function in same\ | Always typeset as code.\ | +| `[pkg::func()]` | package or in `pkg` | Produces Rd: `\code{\link[=func]{func()}}`\ | +| | | or `\code{\link[pkg:func]{pkg::func()}}` | ++----------------------+---------------------+---------------------------------------------+ +| `[thing]`\ | a topic in same\ | Use for a dataset or general doc page.\ | +| `[pkg::thing]` | package or in `pkg` | Not typeset as code.\ | +| | | Produces Rd: `\link{thing}` or\ | +| | | `\link[pkg:thing]{pkg::thing}` | ++----------------------+---------------------+---------------------------------------------+ +| `` [`thing`] ``\ | a topic in same\ | Same as above, but explicit backticks\ | +| `` [`pkg::thing`] `` | package or in `pkg` | mean that it **is** typeset as code.\ | +| | | Good for documenting a class.\ | +| | | Produces Rd: `\code{\link{thing}}` or\ | +| | | `\code{\link[pkg:thing]{pkg::thing}}` | ++----------------------+---------------------+---------------------------------------------+ + +### Custom link text + +Use the second form `[text][ref]` to link to the topic specified by `ref`, but with `text` as the link text. + ++----------------------------+---------------------+-----------------------------------------+ +| Markdown | Links to help\ | Notes | +| | topic for ... | | ++:===========================+:====================+:========================================+ +| `[text][func()]`\ | a function in same\ | Text is not typeset as code.\ | +| `[text][pkg::func()]` | package or in `pkg` | Produces Rd: `\link[=func]{text}` or\ | +| | | `\link[pkg:func]{text}` | ++----------------------------+---------------------+-----------------------------------------+ +| `[text][thing]`\ | a topic in same\ | Text is not typeset as code.\ | +| `[text][pkg::thing]` | package or in `pkg` | Use for a topic that documents `NULL`\ | +| | | and name is set via `@name`,\ | +| | | e.g., a dataset or concept.\ | +| | | Produces Rd: `\link[=thing]{text}` or\ | +| | | `\link[pkg:thing]{text}` | ++----------------------------+---------------------+-----------------------------------------+ +| `` [`text`][thing] ``\ | a topic in same\ | Same as above, but explicit backticks\ | +| `` [`text`][pkg::thing] `` | package or in `pkg` | mean that text is typeset as code.\ | +| | | Produces Rd: `\code{\link{=thing}}` or\ | +| | | `\code{\link[pkg:thing]{pkg::thing}}` | ++----------------------------+---------------------+-----------------------------------------+ + +### Operators + +Links to operators or objects that contain special characters do not currently work. +So to link to (e.g.) the `%>%` operator in the `magrittr` package, instead of `[magrittr::%>%]`, you will need to use the `Rd` notation: `\code{\link[magrittr]{\%>\%}}`. + +## Code chunks + +You can insert executable code with ```` ```{r} ````, just like in knitr documents. +For example: + +```{r echo=FALSE} +simple_fenced <- "#' @title Title +#' @details Details +#' ```{r lorem} +#' 1+1 +#' ``` +#' @md +foo <- function() NULL +" +``` + +```{r code=simple_fenced} +``` + +becomes: + +```{r, echo=FALSE, results="asis"} +cat( + "\x60\x60\x60rd\n", + format(roxygen2:::roc_proc_text(roxygen2::rd_roclet(), simple_fenced)[[1]]), + "\n\x60\x60\x60" +) +``` + +This code is run every time you call `roxygenize()` (or `devtools::document()`) to generate the Rd files. +This potentially makes `roxygenize()` (much) slower. +Either avoid expensive computations, or turn on knitr caching with `cache = TRUE`. +Make sure to omit the cache from the package with `usethis::use_build_ignore()`. + +Note that knitr will call the appropriate `print()` or (if available) `knitr::knit_print()` method on the result. +This may generate markdown not supported by roxygen2. +If needed, override the automatic methods to have your R calls return your own markdown as a character vector, wrapped in `knitr::asis_output()`. + +### Chunk options + +Code blocks support some knitr chunk options, e.g. to keep the output of several expressions together, you can specify `results="hold"`: + +``` r +#' ```{r results="hold"} +#' names(mtcars) +#' nrow(mtcars) +#' ``` +``` + +Some knitr chunk options are reset at the start of every code block, so if you want to change these, you'll have to specify them for every chunk. +These are currently `r paste0("\x60", names(roxygen2:::knitr_chunk_defaults()), "\x60")`. + +Alternatively, you can set the `knitr_chunk_options` option to override these defaults, or add new chunk options that are used for the whole package. +See `?load_options` for specifying roxygen2 options. + +### Images + +Plots will create `.png` files in the `man/figures` directory with file names coming from the chunk name. +Be aware that plots can quickly increase the size of your package leading to challenges for CRAN submission. + +``` r +#' ```{r iris-pairs-plot} +#' pairs(iris[1:4], main = "Anderson's Iris Data -- 3 species", +#' pch = 21, bg = c("red", "green3", "blue")[unclass(iris$Species)]) +#' ``` +``` + +By default roxygen2 only includes PDF images in the PDF manual, and SVG images in the HTML manual. +If you want to avoid this restriction, set the `restrict_image_formats` roxygen2 option to `FALSE`, see `?load_options`. + +## Possible problems + +### Some Rd tags can't contain markdown + +When mixing `Rd` and Markdown notation, most `Rd` tags may contain Markdown markup, the ones that can *not* are: `r paste0("\x60", roxygen2:::escaped_for_md, "\x60", collapse = ", ")`. + +### Mixing Markdown and `Rd` markup + +Note that turning on Markdown does *not* turn off the standard `Rd` syntax. +We suggest that you use the regular `Rd` tags in a Markdown roxygen chunk only if necessary. +The two parsers do occasionally interact, and the Markdown parser can pick up and reformat Rd syntax, causing an error, or corrupted manuals. + +### Leading white space + +Leading white space is interpreted by the commonmark parser, but is ignored by the `Rd` parser (except in `\preformatted{}`). +Make sure that you only include leading white space intentionally, for example, in nested lists. + +### Spurious lists + +The commonmark parser does not require an empty line before lists, and this might lead to unintended lists if a line starts with a number followed by a dot, or with an asterisk followed by white space: + +``` r +#' You can see more about this topic in the book cited below, on page +#' 42. Clearly, the numbered list that starts here is not intentional. +``` + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd-formatting.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd-formatting.html new file mode 100644 index 00000000..848c18dd --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd-formatting.html @@ -0,0 +1,772 @@ + + + + + + + + + + + + + + +(R)Markdown support + + + + + + + + + + + + + + + + + + + + + + + + + + +

(R)Markdown support

+ + + +

We expect most roxygen2 users will write documentation using markdown +rather than Rd syntax, since it’s familiar, and doesn’t require learning +any new syntax. In most cases, you can just use your existing RMarkdown +knowledge and it’ll work as you expect. When it doesn’t, you can read +this vignette to figure out what’s going on and how to fix it.

+
+

Enabling markdown support

+

To turn on Markdown support for a package, insert this entry into the +DESCRIPTION file of the package:

+
Roxygen: list(markdown = TRUE)
+

If you use devtools/usethis, this will be automatically inserted for +you when you create a new package. If you’re updating an existing +package, we recommend usethis::use_roxygen_md() which will +modify the DESCRIPTION and prompt you to use the roxygen2md package to convert +your existing docs.

+

If needed, you can also use @md or @noMd to +turn markdown support on or off for a documentation block.

+

Here is an example roxygen chunk that uses Markdown.

+
#' Use roxygen to document a package
+#'
+#' This function is a wrapper for the [roxygen2::roxygenize()] function from
+#' the roxygen2 package. See the documentation and vignettes of
+#' that package to learn how to use roxygen.
+#'
+#' @param pkg package description, can be path or package name.  See
+#'   [as.package()] for more information.
+#' @param clean,reload Deprecated.
+#' @inheritParams roxygen2::roxygenise
+#' @seealso [roxygen2::roxygenize()], `browseVignettes("roxygen2")`
+#' @export
+
+
+

Basic syntax

+

roxygen uses the commonmark package, based +on the “CommonMark Reference Implementation”. See https://commonmark.org/help/ for more about the parser +and the markdown language it supports. The most important details are +described below.

+
+

Sections and subsections

+

The usual Markdown heading markup creates sections and subsections. +Top level headings (e.g. # title) create sections with the +\section{} Rd tag. This largely supersedes use of the older +@section tag.

+

Top-level headings can only appear after the +@description and @details tags. Since +@details can appear multiple times in a block, you can +always precede a ‘#’ section with @details, if +you want put it near the end of the block, after @return +for example:

+
#' @details
+#' Trim the leading and trailing whitespace from a character vector.
+#'
+#' @param x Character vector.
+#' @return Character vector, with the whitespace trimmed.
+#'
+#' @details # This will be a new section
+#' ...
+

Top level sections are placed at a fixed position in the manual page, +after the parameters and the details, but before \note{}, +\seealso{} and the \examples{}. Their order +will be the same as in the roxygen block.

+

Headings at level two and above may appear inside any roxygen tag +that formats lines of text, e.g. @description, +@details, @return, and create subsections with +the \subsection{} Rd tag.

+
#' @details
+#' ## Subsection within details
+#' ### Sub-subsection
+#' ... text ...
+
+
+

Inline formatting

+

For emphasis, put the text between asterisks or underline +characters. For strong text, use two asterisks at both +sides.

+
#' @references
+#' Robert E Tarjan and Mihalis Yannakakis. (1984). Simple
+#' linear-time algorithms to test chordality of graphs, test acyclicity
+#' of hypergraphs, and selectively reduce acyclic hypergraphs.
+#' *SIAM Journal of Computation* **13**, 566-579.
+
#' See `::is_falsy` for the definition of what is _falsy_
+#' and what is _truthy_.
+
+
+

Code

+

Inline code is supported via backticks.

+
#' @param ns Optionally, a named vector giving prefix-url pairs, as
+#'   produced by `xml_ns`. If provided, all names will be explicitly
+#'   qualified with the ns prefix, i.e. if the element `bar` is defined ...
+

For blocks of code, put your code between triple backticks:

+
#' ```
+#' pkg <- make_packages(
+#'   foo1 = { f <- function() print("hello!") ; d <- 1:10 },
+#'   foo2 = { f <- function() print("hello again!") ; d <- 11:20 }
+#' )
+#' foo1::f()
+#' foo2::f()
+#' foo1::d
+#' foo2::d
+#' dispose_packages(pkg)
+#' ```
+

You can also include executable code chunks using the usual knitr +syntax. See below for more details.

+
+
+

Lists

+

Regular Markdown lists are recognized and converted to +\enumerate{} or \itemize{} lists:

+
#' There are two ways to use this function:
+#' 1. If its first argument is not named, then it returns a function
+#'    that can be used to color strings.
+#' 1. If its first argument is named, then it also creates a
+#'    style with the given name. This style can be used in
+#'    `style`. One can still use the return value
+#'    of the function, to create a style function.
+
#' The style (the `...` argument) can be anything of the
+#' following:
+#' * An R color name, see `colors()`.
+#' * A 6- or 8-digit hexa color string, e.g. `#ff0000` means
+#'   red. Transparency (alpha channel) values are ignored.
+#' * A one-column matrix with three rows for the red, green,
+#'   and blue channels, as returned by [grDevices::col2rgb()].
+

Note that you do not have to leave an empty line before the list. +This is different from some Markdown parsers.

+
+
+

Tables

+

Use GFM +table formatting:

+
| foo | bar |
+| --- | --- |
+| baz | bim |
+

By default, columns are left-aligned. Use colons to generate right +and center aligned columns:

+
| left | center | right |
+| :--- | :----: | ----: |
+| 1    | 2      | 3     |
+
+ +
+

Images

+

Markdown syntax for inline images works. The image files must be in +the man/figures directory:

+
#' Here is an example plot:
+#' ![](example-plot.jpg "Example Plot Title")
+
+
+ +
+

Code chunks

+

You can insert executable code with ```{r}, just like in +knitr documents. For example:

+
#' @title Title
+#' @details Details
+#' ```{r lorem}
+#' 1+1
+#' ```
+#' @md
+foo <- function() NULL
+

becomes:

+
 % Generated by roxygen2: do not edit by hand
+% Please edit documentation in ./<text>
+\name{foo}
+\alias{foo}
+\title{Title}
+\usage{
+foo()
+}
+\description{
+Title
+}
+\details{
+Details
+
+\if{html}{\out{<div class="sourceCode r">}}\preformatted{1+1
+#> [1] 2
+}\if{html}{\out{</div>}}
+} 
+

This code is run every time you call roxygenize() (or +devtools::document()) to generate the Rd files. This +potentially makes roxygenize() (much) slower. Either avoid +expensive computations, or turn on knitr caching with +cache = TRUE. Make sure to omit the cache from the package +with usethis::use_build_ignore().

+

Note that knitr will call the appropriate print() or (if +available) knitr::knit_print() method on the result. This +may generate markdown not supported by roxygen2. If needed, override the +automatic methods to have your R calls return your own markdown as a +character vector, wrapped in knitr::asis_output().

+
+

Chunk options

+

Code blocks support some knitr chunk options, e.g. to keep the output +of several expressions together, you can specify +results="hold":

+
#' ```{r results="hold"}
+#' names(mtcars)
+#' nrow(mtcars)
+#' ```
+

Some knitr chunk options are reset at the start of every code block, +so if you want to change these, you’ll have to specify them for every +chunk. These are currently error, fig.path, +fig.process, comment, +collapse.

+

Alternatively, you can set the knitr_chunk_options +option to override these defaults, or add new chunk options that are +used for the whole package. See ?load_options for +specifying roxygen2 options.

+
+
+

Images

+

Plots will create .png files in the +man/figures directory with file names coming from the chunk +name. Be aware that plots can quickly increase the size of your package +leading to challenges for CRAN submission.

+
#' ```{r iris-pairs-plot}
+#' pairs(iris[1:4], main = "Anderson's Iris Data -- 3 species",
+#'   pch = 21, bg = c("red", "green3", "blue")[unclass(iris$Species)])
+#' ```
+

By default roxygen2 only includes PDF images in the PDF manual, and +SVG images in the HTML manual. If you want to avoid this restriction, +set the restrict_image_formats roxygen2 option to +FALSE, see ?load_options.

+
+
+
+

Possible problems

+
+

Some Rd tags can’t contain markdown

+

When mixing Rd and Markdown notation, most +Rd tags may contain Markdown markup, the ones that can +not are: \acronym, \code, +\command, \CRANpkg, \deqn, +\doi, \dontrun, \dontshow, +\donttest, \email, \env, +\eqn, \figure, \file, +\if, \ifelse, \kbd, +\link, \linkS4class, \method, +\mjeqn, \mjdeqn, \mjseqn, +\mjsdeqn, \mjteqn, \mjtdeqn, +\newcommand, \option, \out, +\packageAuthor, \packageDescription, +\packageDESCRIPTION, \packageIndices, +\packageMaintainer, \packageTitle, +\pkg, \PR, \preformatted, +\renewcommand, \S3method, +\S4method, \samp, \special, +\testonly, \url, \var, +\verb.

+
+
+

Mixing Markdown and Rd markup

+

Note that turning on Markdown does not turn off the standard +Rd syntax. We suggest that you use the regular +Rd tags in a Markdown roxygen chunk only if necessary. The +two parsers do occasionally interact, and the Markdown parser can pick +up and reformat Rd syntax, causing an error, or corrupted manuals.

+
+
+

Leading white space

+

Leading white space is interpreted by the commonmark parser, but is +ignored by the Rd parser (except in +\preformatted{}). Make sure that you only include leading +white space intentionally, for example, in nested lists.

+
+
+

Spurious lists

+

The commonmark parser does not require an empty line before lists, +and this might lead to unintended lists if a line starts with a number +followed by a dot, or with an asterisk followed by white space:

+
#' You can see more about this topic in the book cited below, on page
+#' 42. Clearly, the numbered list that starts here is not intentional.
+
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd-other.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd-other.R new file mode 100644 index 00000000..a101157a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd-other.R @@ -0,0 +1,90 @@ +## ----include = FALSE---------------------------------------------------------- +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) + +## ----------------------------------------------------------------------------- +#' Prices of over 50,000 round cut diamonds +#' +#' A dataset containing the prices and other attributes of almost 54,000 +#' diamonds. The variables are as follows: +#' +#' @format A data frame with 53940 rows and 10 variables: +#' \describe{ +#' \item{price}{price in US dollars ($326--$18,823)} +#' \item{carat}{weight of the diamond (0.2--5.01)} +#' \item{cut}{quality of the cut (Fair, Good, Very Good, Premium, Ideal)} +#' \item{color}{diamond colour, from D (best) to J (worst)} +#' \item{clarity}{a measurement of how clear the diamond is (I1 (worst), SI2, +#' SI1, VS2, VS1, VVS2, VVS1, IF (best))} +#' \item{x}{length in mm (0--10.74)} +#' \item{y}{width in mm (0--58.9)} +#' \item{z}{depth in mm (0--31.8)} +#' \item{depth}{total depth percentage = z / mean(x, y) = 2 * z / (x + y) (43--79)} +#' \item{table}{width of top of diamond relative to widest point (43--95)} +#' } +#' +#' @source {ggplot2} tidyverse R package. + +## ----eval = FALSE------------------------------------------------------------- +# #' @keywords internal +# "_PACKAGE" + +## ----------------------------------------------------------------------------- +#' An S4 class to represent a bank account +#' +#' @slot balance A length-one numeric vector +Account <- setClass("Account", + slots = list(balance = "numeric") +) + +## ----------------------------------------------------------------------------- +#' R6 Class Representing a Person +#' +#' @description +#' A person has a name and a hair color. +#' +#' @details +#' A person can also greet you. + +Person <- R6::R6Class("Person", +public = list( + + #' @field name First or full name of the person. + name = NULL, + + #' @field hair Hair color of the person. + hair = NULL, + + #' @description + #' Create a new person object. + #' @param name Name. + #' @param hair Hair color. + #' @return A new `Person` object. + initialize = function(name = NA, hair = NA) { + self$name <- name + self$hair <- hair + self$greet() + }, + + #' @description + #' Change hair color. + #' @param val New hair color. + #' @examples + #' P <- Person("Ann", "black") + #' P$hair + #' P$set_hair("red") + #' P$hair + set_hair = function(val) { + self$hair <- val + }, + + #' @description + #' Say hi. + greet = function() { + cat(paste0("Hello, my name is ", self$name, ".\n")) + } + ) +) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd-other.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd-other.Rmd new file mode 100644 index 00000000..372de6a8 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd-other.Rmd @@ -0,0 +1,209 @@ +--- +title: "Documenting other objects" +description: > + How to document datasets, packages, and the classes, + generics, and methods of S3, S4, and R6. +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Documenting other objects} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + +## Datasets + +Datasets are stored in `data/`, not as regular R objects in the package. +This means you need to document them in a slightly different way: instead of documenting the data directly, you quote the dataset's name. + +```{r} +#' Prices of over 50,000 round cut diamonds +#' +#' A dataset containing the prices and other attributes of almost 54,000 +#' diamonds. The variables are as follows: +#' +#' @format A data frame with 53940 rows and 10 variables: +#' \describe{ +#' \item{price}{price in US dollars ($326--$18,823)} +#' \item{carat}{weight of the diamond (0.2--5.01)} +#' \item{cut}{quality of the cut (Fair, Good, Very Good, Premium, Ideal)} +#' \item{color}{diamond colour, from D (best) to J (worst)} +#' \item{clarity}{a measurement of how clear the diamond is (I1 (worst), SI2, +#' SI1, VS2, VS1, VVS2, VVS1, IF (best))} +#' \item{x}{length in mm (0--10.74)} +#' \item{y}{width in mm (0--58.9)} +#' \item{z}{depth in mm (0--31.8)} +#' \item{depth}{total depth percentage = z / mean(x, y) = 2 * z / (x + y) (43--79)} +#' \item{table}{width of top of diamond relative to widest point (43--95)} +#' } +#' +#' @source {ggplot2} tidyverse R package. +``` + +Note the use of two additional tags that are particularly useful for documenting data: + +- `@format`, which gives an overview of the structure of the dataset. + This should include a **definition list** that describes each variable. + There's currently no way to generate this with Markdown, so this is one of the few places you'll need to Rd markup directly. + +- `@source` where you got the data form, often a URL. + +## Packages + +As well as documenting every object inside the package, you can also document the package itself by documenting the special sentinel `"_PACKAGE"`. +This automatically includes information parsed from the `DESCRIPTION`, including title, description, list of authors, and useful URLs. + +We recommend placing package documentation in `{pkgname}-package.R`, and have `@keywords internal`. +Use `usethis::use_package_doc()` to set up automatically. + +Here's an example: + +```{r, eval = FALSE} +#' @keywords internal +"_PACKAGE" +``` + +Package documentation is a good place to put `# Package options` that documents options used by the package. + +Some notes: + +- By default, aliases will be added so that both `?pkgname` and `package?pkgname` will find the package help. + If there's an existing function called `pkgname`, use `@aliases {pkgname}-package NULL` to override the default. + +- Use `@references` to point to published material about the package that users might find helpful. + +## S3 + +- S3 **generics** are regular functions, so document them as such. + If necessary, include a section that provides additional details for developers implementing methods. + +- S3 **classes** have no formal definition, so document the [constructor](https://adv-r.hadley.nz/s3.html#s3-constructor). + +- It is your choice whether or not to document S3 **methods**. + Generally, it's not necessary to document straightforward methods for common generics like `print()`. + (You should, however, always `@export` S3 methods). + + If your method is more complicated, you should document it by setting `@rdname` or `@describeIn`. + For complicated methods, you might document in their own file (i.e. `@rdname generic.class`; for simpler methods you might document with the generic (i.e. `@describeIn generic)`. + Learn more about these tags in `vignette("reuse")`. + +- Generally, roxygen2 will automatically figure out the generic that the method belongs to, and you should only need to use `@method` if there is ambiguity. + For example, is `all.equal.data.frame()` the `equal.data.frame` method for `all()`, or the `data.frame` method for `all.equal()`?. + If this happens to you, disambiguate with (e.g.) `@method all.equal data.frame`. + +## S4 + +S4 **generics** are also functions, so document them as such. + +Document **S4 classes** by adding a roxygen block before `setClass()`. +Use `@slot` to document the slots of the class. +Here's a simple example: + +```{r} +#' An S4 class to represent a bank account +#' +#' @slot balance A length-one numeric vector +Account <- setClass("Account", + slots = list(balance = "numeric") +) +``` + +S4 **methods** are a little more complicated. +Unlike S3 methods, all S4 methods must be documented. +You can document them in three places: + +- In the class. + Most appropriate if the corresponding generic uses single dispatch and you created the class. + +- In the generic. + Most appropriate if the generic uses multiple dispatches and you control it. + +- In its own file. + Most appropriate if the method is complex. + or the either two options don't apply. + +Use either `@rdname` or `@describeIn` to control where method documentation goes. +See the next section for more details. + +## R6 + +- R6 methods can be documented in-line, i.e. the method's documentation comments come right before the definition of the method. + +- Method documentation can use the `@description`, `@details`, `@param`, `@return` and `@examples` tags. + These are used to create a subsection for the method, within a separate 'Methods' section. + All roxygen comment lines of a method documentation must appear after a tag. + +- `@param` tags that appear before the class definition are automatically inherited by all methods, if needed. + +- R6 fields and active bindings can make use of the `@field` tag. + Their documentation should also be in-line. + +- roxygen2 checks that all public methods, public fields, active bindings and all method arguments are documented, and issues warnings otherwise. + +- To turn off the special handling of R6 classes and go back to the roxygen2 6.x.x behavior, use the `r6 = FALSE` option in `DESCRIPTION`, in the `Roxygen` entry: `Roxygen: list(r6 = FALSE)`. + +roxygen2 automatically generates additional sections for an R6 class: + +- A section with information about the superclass(es) of the class, with links. + In HTML this includes a list of all inherited methods, with links. + +- An 'Examples' section that contains all class and method examples. + This section is run by `R CMD check`, so method examples must work without errors. + +An example from the R6 tutorial: + +```{r} +#' R6 Class Representing a Person +#' +#' @description +#' A person has a name and a hair color. +#' +#' @details +#' A person can also greet you. + +Person <- R6::R6Class("Person", +public = list( + + #' @field name First or full name of the person. + name = NULL, + + #' @field hair Hair color of the person. + hair = NULL, + + #' @description + #' Create a new person object. + #' @param name Name. + #' @param hair Hair color. + #' @return A new `Person` object. + initialize = function(name = NA, hair = NA) { + self$name <- name + self$hair <- hair + self$greet() + }, + + #' @description + #' Change hair color. + #' @param val New hair color. + #' @examples + #' P <- Person("Ann", "black") + #' P$hair + #' P$set_hair("red") + #' P$hair + set_hair = function(val) { + self$hair <- val + }, + + #' @description + #' Say hi. + greet = function() { + cat(paste0("Hello, my name is ", self$name, ".\n")) + } + ) +) +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd-other.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd-other.html new file mode 100644 index 00000000..710e4129 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd-other.html @@ -0,0 +1,565 @@ + + + + + + + + + + + + + + +Documenting other objects + + + + + + + + + + + + + + + + + + + + + + + + + + +

Documenting other objects

+ + + +
+

Datasets

+

Datasets are stored in data/, not as regular R objects +in the package. This means you need to document them in a slightly +different way: instead of documenting the data directly, you quote the +dataset’s name.

+
#' Prices of over 50,000 round cut diamonds
+#'
+#' A dataset containing the prices and other attributes of almost 54,000
+#'  diamonds. The variables are as follows:
+#'
+#' @format A data frame with 53940 rows and 10 variables:
+#' \describe{
+#'   \item{price}{price in US dollars ($326--$18,823)}
+#'   \item{carat}{weight of the diamond (0.2--5.01)}
+#'   \item{cut}{quality of the cut (Fair, Good, Very Good, Premium, Ideal)}
+#'   \item{color}{diamond colour, from D (best) to J (worst)}
+#'   \item{clarity}{a measurement of how clear the diamond is (I1 (worst), SI2,
+#'     SI1, VS2, VS1, VVS2, VVS1, IF (best))}
+#'   \item{x}{length in mm (0--10.74)}
+#'   \item{y}{width in mm (0--58.9)}
+#'   \item{z}{depth in mm (0--31.8)}
+#'   \item{depth}{total depth percentage = z / mean(x, y) = 2 * z / (x + y) (43--79)}
+#'   \item{table}{width of top of diamond relative to widest point (43--95)}
+#' }
+#' 
+#' @source {ggplot2} tidyverse R package.
+

Note the use of two additional tags that are particularly useful for +documenting data:

+
    +
  • @format, which gives an overview of the structure of +the dataset. This should include a definition list that +describes each variable. There’s currently no way to generate this with +Markdown, so this is one of the few places you’ll need to Rd markup +directly.

  • +
  • @source where you got the data form, often a +URL.

  • +
+
+
+

Packages

+

As well as documenting every object inside the package, you can also +document the package itself by documenting the special sentinel +"_PACKAGE". This automatically includes information parsed +from the DESCRIPTION, including title, description, list of +authors, and useful URLs.

+

We recommend placing package documentation in +{pkgname}-package.R, and have +@keywords internal. Use +usethis::use_package_doc() to set up automatically.

+

Here’s an example:

+
#' @keywords internal 
+"_PACKAGE"
+

Package documentation is a good place to put +# Package options that documents options used by the +package.

+

Some notes:

+
    +
  • By default, aliases will be added so that both +?pkgname and package?pkgname will find the +package help. If there’s an existing function called +pkgname, use @aliases {pkgname}-package NULL +to override the default.

  • +
  • Use @references to point to published material about +the package that users might find helpful.

  • +
+
+
+

S3

+
    +
  • S3 generics are regular functions, so document +them as such. If necessary, include a section that provides additional +details for developers implementing methods.

  • +
  • S3 classes have no formal definition, so +document the constructor.

  • +
  • It is your choice whether or not to document S3 +methods. Generally, it’s not necessary to document +straightforward methods for common generics like print(). +(You should, however, always @export S3 methods).

    +

    If your method is more complicated, you should document it by setting +@rdname or @describeIn. For complicated +methods, you might document in their own file +(i.e. @rdname generic.class; for simpler methods you might +document with the generic (i.e. @describeIn generic). Learn +more about these tags in vignette("reuse").

  • +
  • Generally, roxygen2 will automatically figure out the generic +that the method belongs to, and you should only need to use +@method if there is ambiguity. For example, is +all.equal.data.frame() the equal.data.frame +method for all(), or the data.frame method for +all.equal()?. If this happens to you, disambiguate with +(e.g.) @method all.equal data.frame.

  • +
+
+
+

S4

+

S4 generics are also functions, so document them as +such.

+

Document S4 classes by adding a roxygen block before +setClass(). Use @slot to document the slots of +the class. Here’s a simple example:

+
#' An S4 class to represent a bank account
+#'
+#' @slot balance A length-one numeric vector
+Account <- setClass("Account",
+  slots = list(balance = "numeric")
+)
+

S4 methods are a little more complicated. Unlike S3 +methods, all S4 methods must be documented. You can document them in +three places:

+
    +
  • In the class. Most appropriate if the corresponding generic uses +single dispatch and you created the class.

  • +
  • In the generic. Most appropriate if the generic uses multiple +dispatches and you control it.

  • +
  • In its own file. Most appropriate if the method is complex. or +the either two options don’t apply.

  • +
+

Use either @rdname or @describeIn to +control where method documentation goes. See the next section for more +details.

+
+
+

R6

+
    +
  • R6 methods can be documented in-line, i.e. the method’s +documentation comments come right before the definition of the +method.

  • +
  • Method documentation can use the @description, +@details, @param, @return and +@examples tags. These are used to create a subsection for +the method, within a separate ‘Methods’ section. All roxygen comment +lines of a method documentation must appear after a tag.

  • +
  • @param tags that appear before the class definition +are automatically inherited by all methods, if needed.

  • +
  • R6 fields and active bindings can make use of the +@field tag. Their documentation should also be +in-line.

  • +
  • roxygen2 checks that all public methods, public fields, active +bindings and all method arguments are documented, and issues warnings +otherwise.

  • +
  • To turn off the special handling of R6 classes and go back to the +roxygen2 6.x.x behavior, use the r6 = FALSE option in +DESCRIPTION, in the Roxygen entry: +Roxygen: list(r6 = FALSE).

  • +
+

roxygen2 automatically generates additional sections for an R6 +class:

+
    +
  • A section with information about the superclass(es) of the class, +with links. In HTML this includes a list of all inherited methods, with +links.

  • +
  • An ‘Examples’ section that contains all class and method +examples. This section is run by R CMD check, so method +examples must work without errors.

  • +
+

An example from the R6 tutorial:

+
#' R6 Class Representing a Person
+#'
+#' @description
+#' A person has a name and a hair color.
+#'
+#' @details
+#' A person can also greet you.
+
+Person <- R6::R6Class("Person",
+public = list(
+
+    #' @field name First or full name of the person.
+    name = NULL,
+
+    #' @field hair Hair color of the person.
+    hair = NULL,
+
+    #' @description
+    #' Create a new person object.
+    #' @param name Name.
+    #' @param hair Hair color.
+    #' @return A new `Person` object.
+    initialize = function(name = NA, hair = NA) {
+      self$name <- name
+      self$hair <- hair
+      self$greet()
+    },
+
+    #' @description
+    #' Change hair color.
+    #' @param val New hair color.
+    #' @examples
+    #' P <- Person("Ann", "black")
+    #' P$hair
+    #' P$set_hair("red")
+    #' P$hair
+    set_hair = function(val) {
+      self$hair <- val
+    },
+
+    #' @description
+    #' Say hi.
+    greet = function() {
+      cat(paste0("Hello, my name is ", self$name, ".\n"))
+    }
+  )
+)
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd.R new file mode 100644 index 00000000..3c11111f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd.R @@ -0,0 +1,26 @@ +## ----include = FALSE---------------------------------------------------------- +knitr::opts_chunk$set(comment = "#>", collapse = TRUE) + +## ----------------------------------------------------------------------------- +#' Sum of vector elements +#' +#' `sum` returns the sum of all the values present in its arguments. +#' +#' This is a generic function: methods can be defined for it directly +#' or via the [Summary()] group generic. For this to work properly, +#' the arguments `...` should be unnamed, and dispatch is on the +#' first argument. +sum <- function(..., na.rm = TRUE) {} + +## ----------------------------------------------------------------------------- +#' Sum of vector elements +#' +#' @description +#' `sum` returns the sum of all the values present in its arguments. +#' +#' @details +#' This is a generic function: methods can be defined for it directly +#' or via the [Summary()] group generic. For this to work properly, +#' the arguments `...` should be unnamed, and dispatch is on the +#' first argument. + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd.Rmd new file mode 100644 index 00000000..d1b8b745 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd.Rmd @@ -0,0 +1,138 @@ +--- +title: "Documenting functions" +description: > + The basics of roxygen2 tags and how to use them for + documenting functions. +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Documenting functions} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set(comment = "#>", collapse = TRUE) +``` + +This vignette introduces the basics of roxygen2 for documenting functions. +See `vignette("rd-other")` for documenting other types of objects and `vignette("reuse")` for reusing documentation across topics. + +## Basics + +A roxygen **block** is a sequence of lines starting with `#'` (optionally preceded by white space). + +The first lines of the block is called the **introduction** and forms the title, description, and details, as described below. +The introduction continues until the first **tag**. + +Tags start with `@`, like `@details` or `@param`. +Tags must appear at the beginning of a line and their content extends to the start of the next tag or the end of the block. +Text within the description or tags can be formatted using Markdown or `Rd` commands; see `vignette("rd-formatting")` for details. + +A block ends when it hits R code, usually a function or object assignment. +Blocks ignore empty lines, including lines made up of non-roxygen comments. +If you need to separate two blocks, use `NULL`. + +If you want to use roxygen2 documentation tags without generating an `.Rd` file, you can use `@noRd` to suppress file generation for a given topic. This is useful if you want to use roxygen2 conventions for documenting an internal function; only people reading the source doc will be able to read the docs. + + +## The introduction + +Each documentation block starts with some text which defines the title, the description, and the details. +Here's an example showing what the documentation for `sum()` might look like if it had been written with roxygen: + +```{r} +#' Sum of vector elements +#' +#' `sum` returns the sum of all the values present in its arguments. +#' +#' This is a generic function: methods can be defined for it directly +#' or via the [Summary()] group generic. For this to work properly, +#' the arguments `...` should be unnamed, and dispatch is on the +#' first argument. +sum <- function(..., na.rm = TRUE) {} +``` + +This introductory block is broken up as follows: + +- The first sentence is the **title**: that's what you see when you look at `help(package = mypackage)` and is shown at the top of each help file. + It should generally fit on one line, be written in sentence case, and not end in a full stop. + +- The second paragraph is the **description**: this comes first in the documentation and should briefly describe what the function does. + +- The third and subsequent paragraphs go into the **details**: this is a (often long) section that comes after the argument description and should provide any other important details of how the function operates. + The details are optional. + +You can also use explicit `@title`, `@description`, and `@details` tags. +This is unnecessary unless you want to have a multi-paragraph description, bulleted list, or other more exotic structure. + +```{r} +#' Sum of vector elements +#' +#' @description +#' `sum` returns the sum of all the values present in its arguments. +#' +#' @details +#' This is a generic function: methods can be defined for it directly +#' or via the [Summary()] group generic. For this to work properly, +#' the arguments `...` should be unnamed, and dispatch is on the +#' first argument. +``` + +## Functions + +Functions are the most commonly documented objects. +Functions require three tags: `@param`, `@returns`, and `@examples`. + +### Inputs + +Use `@param name description` to describe each input to the function. +The description should provide a succinct summary of parameter type (e.g. a string, a numeric vector), and if not obvious from the name, what the parameter does. +The description is a sentence so should start with a capital letter and end with a full stop. +It can span multiple lines (or even paragraphs) if necessary. +All parameters must be documented. + +If two or more arguments are tightly coupled, you can document them in one place by separating the names with commas (no spaces). +For example, to document both `x` and `y`, you can say `@param x,y Numeric vectors`. + +### Outputs + +`@returns description` describes the output from the function. +Briefly describe the type/shape of the output, not the details. + +All functions must have a documented return value for initial CRAN submission. + +### Examples + +`@examples` provides executable R code showing how to use the function in practice. +This is a very important part of the documentation because many people look at the examples before reading anything. +Example code must work without errors as it is run automatically as part of `R CMD check`. + +For the purpose of illustration, it's often useful to include code that causes an error. +You can do this by wrapping the code in `try()` or using `\dontrun{}` to exclude from the executed example code. + +For finer control, you can use `@examplesIf`: + +``` r +#' @examplesIf interactive() +#' browseURL("https://roxygen2.r-lib.org") +``` + +This generates + + \examples{ + \dontshow{if (interactive() (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} + gh_organizations(since = 42) + \dontshow{\}) # examplesIf} + } + +This way, the code evaluating whether the example can be run is not shown to users reading the help, but it still prevents R CMD check failures. + +Instead of including examples directly in the documentation, you can put them in separate files and use `@example path/relative/to/package/root` to insert them into the documentation. + +All functions must have examples for initial CRAN submission. + +### Usage + +In most case, the function usage (which appears beneath the description in the generates docs) will be automatically derived from the function specification. +For the cases where it is not, please [file an issue](https://github.com/r-lib/roxygen2/issues) and use `@usage` to override the default with what you want. +If you want to suppress the usage altogether (which is sometimes useful for internal or deprecated functions), you can use `@usage NULL`. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd.html new file mode 100644 index 00000000..4c3eb692 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/rd.html @@ -0,0 +1,499 @@ + + + + + + + + + + + + + + +Documenting functions + + + + + + + + + + + + + + + + + + + + + + + + + + +

Documenting functions

+ + + +

This vignette introduces the basics of roxygen2 for documenting +functions. See vignette("rd-other") for documenting other +types of objects and vignette("reuse") for reusing +documentation across topics.

+
+

Basics

+

A roxygen block is a sequence of lines starting with +#' (optionally preceded by white space).

+

The first lines of the block is called the +introduction and forms the title, description, and +details, as described below. The introduction continues until the first +tag.

+

Tags start with @, like @details or +@param. Tags must appear at the beginning of a line and +their content extends to the start of the next tag or the end of the +block. Text within the description or tags can be formatted using +Markdown or Rd commands; see +vignette("rd-formatting") for details.

+

A block ends when it hits R code, usually a function or object +assignment. Blocks ignore empty lines, including lines made up of +non-roxygen comments. If you need to separate two blocks, use +NULL.

+

If you want to use roxygen2 documentation tags without generating an +.Rd file, you can use @noRd to suppress file +generation for a given topic. This is useful if you want to use roxygen2 +conventions for documenting an internal function; only people reading +the source doc will be able to read the docs.

+
+
+

The introduction

+

Each documentation block starts with some text which defines the +title, the description, and the details. Here’s an example showing what +the documentation for sum() might look like if it had been +written with roxygen:

+
#' Sum of vector elements
+#'
+#' `sum` returns the sum of all the values present in its arguments.
+#'
+#' This is a generic function: methods can be defined for it directly
+#' or via the [Summary()] group generic. For this to work properly,
+#' the arguments `...` should be unnamed, and dispatch is on the
+#' first argument.
+sum <- function(..., na.rm = TRUE) {}
+

This introductory block is broken up as follows:

+
    +
  • The first sentence is the title: that’s what you +see when you look at help(package = mypackage) and is shown +at the top of each help file. It should generally fit on one line, be +written in sentence case, and not end in a full stop.

  • +
  • The second paragraph is the description: this +comes first in the documentation and should briefly describe what the +function does.

  • +
  • The third and subsequent paragraphs go into the +details: this is a (often long) section that comes +after the argument description and should provide any other important +details of how the function operates. The details are optional.

  • +
+

You can also use explicit @title, +@description, and @details tags. This is +unnecessary unless you want to have a multi-paragraph description, +bulleted list, or other more exotic structure.

+
#' Sum of vector elements
+#' 
+#' @description
+#' `sum` returns the sum of all the values present in its arguments.
+#'
+#' @details
+#' This is a generic function: methods can be defined for it directly
+#' or via the [Summary()] group generic. For this to work properly,
+#' the arguments `...` should be unnamed, and dispatch is on the
+#' first argument.
+
+
+

Functions

+

Functions are the most commonly documented objects. Functions require +three tags: @param, @returns, and +@examples.

+
+

Inputs

+

Use @param name description to describe each input to +the function. The description should provide a succinct summary of +parameter type (e.g. a string, a numeric vector), and if not obvious +from the name, what the parameter does. The description is a sentence so +should start with a capital letter and end with a full stop. It can span +multiple lines (or even paragraphs) if necessary. All parameters must be +documented.

+

If two or more arguments are tightly coupled, you can document them +in one place by separating the names with commas (no spaces). For +example, to document both x and y, you can say +@param x,y Numeric vectors.

+
+
+

Outputs

+

@returns description describes the output from the +function. Briefly describe the type/shape of the output, not the +details.

+

All functions must have a documented return value for initial CRAN +submission.

+
+
+

Examples

+

@examples provides executable R code showing how to use +the function in practice. This is a very important part of the +documentation because many people look at the examples before reading +anything. Example code must work without errors as it is run +automatically as part of R CMD check.

+

For the purpose of illustration, it’s often useful to include code +that causes an error. You can do this by wrapping the code in +try() or using \dontrun{} to exclude from the +executed example code.

+

For finer control, you can use @examplesIf:

+
#' @examplesIf interactive()
+#' browseURL("https://roxygen2.r-lib.org")
+

This generates

+
\examples{
+\dontshow{if (interactive() (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
+gh_organizations(since = 42)
+\dontshow{\}) # examplesIf}
+}
+

This way, the code evaluating whether the example can be run is not +shown to users reading the help, but it still prevents R CMD check +failures.

+

Instead of including examples directly in the documentation, you can +put them in separate files and use +@example path/relative/to/package/root to insert them into +the documentation.

+

All functions must have examples for initial CRAN submission.

+
+
+

Usage

+

In most case, the function usage (which appears beneath the +description in the generates docs) will be automatically derived from +the function specification. For the cases where it is not, please file an issue and +use @usage to override the default with what you want. If +you want to suppress the usage altogether (which is sometimes useful for +internal or deprecated functions), you can use +@usage NULL.

+
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/reuse.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/reuse.R new file mode 100644 index 00000000..2ea3b529 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/reuse.R @@ -0,0 +1,135 @@ +## ----include = FALSE---------------------------------------------------------- +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) + +## ----------------------------------------------------------------------------- +#' Trigonometric approximations +#' @param x Input, in radians. +#' @name trig +NULL + +#' @rdname trig +#' @export +sin_ish <- function(x) x - x^3 / 6 + +#' @rdname trig +#' @export +cos_ish <- function(x) 1 - x^2 / 2 + +#' @rdname trig +#' @export +tan_ish <- function(x) x + x^3 / 3 + +## ----------------------------------------------------------------------------- +#' Logarithms +#' +#' @param x A numeric vector +#' @export +log <- function(x, base) ... + +#' @rdname log +#' @export +log2 <- function(x) log(x, 2) + +#' @rdname log +#' @export +ln <- function(x) log(x, exp(1)) + +## ----------------------------------------------------------------------------- +#' @rdname arith +#' @order 2 +add <- function(x, y) x + y + +#' @rdname arith +#' @order 1 +times <- function(x, y) x * y + +## ----------------------------------------------------------------------------- +#' @param .data A data frame, data frame extension (e.g. a tibble), or a +#' lazy data frame (e.g. from dbplyr or dtplyr). See *Methods*, below, for +#' more details. +#' @param ... <[`data-masking`][rlang::args_data_masking]> Variables, or +#' functions of variables. Use [desc()] to sort a variable in descending +#' order. +arrange <- function(.data, ...) {} + +## ----------------------------------------------------------------------------- +#' @inheritParams arrange +mutate <- function(.data, ...) {} + +#' @inheritParams arrange +summarise <- function(.data, ...) {} + +## ----------------------------------------------------------------------------- +#' @inheritParams arrange +#' @param ... <[`data-masking`][rlang::args_data_masking]> Name-value pairs. +#' The name gives the name of the column in the output. +#' +#' The value can be: +#' +#' * A vector of length 1, which will be recycled to the correct length. +#' * A vector the same length as the current group (or the whole data frame +#' if ungrouped). +#' * `NULL`, to remove the column. +#' * A data frame or tibble, to create multiple columns in the output. +mutate <- function(.data, ...) {} + +## ----------------------------------------------------------------------------- +#' @param x,y A pair of data frames, data frame extensions (e.g. a tibble), or +#' lazy data frames (e.g. from dbplyr or dtplyr). See *Methods*, below, for +#' more details. + +## ----include = FALSE---------------------------------------------------------- +roxygen2:::markdown_on() + +simple_inline <- "#' Title `r 1 + 1` +#' +#' Description `r 2 + 2` +foo <- function() NULL +" + +## ----code=simple_inline------------------------------------------------------- +#' Title `r 1 + 1` +#' +#' Description `r 2 + 2` +foo <- function() NULL + + +## ----code = roxygen2:::markdown(simple_inline)-------------------------------- +#' Title 2 +#' +#' Description 4 +foo <- function() NULL + +## ----------------------------------------------------------------------------- +alphabet <- function(n) { + paste0("`", letters[1:n], "`", collapse = ", ") +} + +## ----echo=FALSE--------------------------------------------------------------- +env <- new.env() +env$alphabet <- alphabet +roxygen2:::roxy_meta_set("evalenv", env) + +backtick <- "#' Title +#' +#' @param x A string. Must be one of `r alphabet(5)` +foo <- function(x) NULL +" + +## ----code = backtick---------------------------------------------------------- +#' Title +#' +#' @param x A string. Must be one of `r alphabet(5)` +foo <- function(x) NULL + + +## ----code = roxygen2:::markdown_pass1(backtick)------------------------------- +#' Title +#' +#' @param x A string. Must be one of `a`, `b`, `c`, `d`, `e` +foo <- function(x) NULL + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/reuse.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/reuse.Rmd new file mode 100644 index 00000000..e283fa02 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/reuse.Rmd @@ -0,0 +1,342 @@ +--- +title: "Reusing documentation" +description: > + Tools for reusing documentation across topics, and between + documentation and vignettes. +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Reusing documentation} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + +roxygen2 provides several ways to avoid repeating yourself in code documentation, while assembling information from multiple places in one documentation file: + +- Combine documentation for closely related functions into a single file with `@describeIn` or `@rdname`. + +- Automatically copy tags with `@inheritParams`, `@inheritSection`, or `@inherit`. + +- Use functions to generate repeated text with inline R code. + +- Share text between documentation and vignettes with child documents. + +The chapter concludes by showing you how to update superseded reuse mechanisms that we no longer recommend: `@includeRmd`, `@eval`/`@evalRd`, and `@template`. + +## Multiple functions in the same topic + +You can document multiple functions in the same file by using either `@rdname` or `@describeIn` tag. +It's a technique best used with care: documenting too many functions in one place leads to confusion. +Use it when all functions have the same (or very similar) arguments. + +### `@rdname` + +Use `@rdname `[^1] to include multiple functions in the same page. +Tags (e.g. `@title`, `@description`, `@examples`) will be combined, across blocks but often this yields text that is hard to understand. +So we recommend that you make one block that contains the title, description, common parameters, examples and so on, and then only document individual parameters in the other blocks. + +[^1]: The destination is a topic name. + There's a one-to-one correspondence between topic names and `.Rd` files where a topic called `foo` will produce a file called `man/foo.Rd`. + +There are two basic ways to do that. +You can create a standalone documentation block and then add the functions to it. +This typically works best when you have a family of related functions and you want to link to that family from other functions (i.e. `trig` in the examples below). + +```{r} +#' Trigonometric approximations +#' @param x Input, in radians. +#' @name trig +NULL + +#' @rdname trig +#' @export +sin_ish <- function(x) x - x^3 / 6 + +#' @rdname trig +#' @export +cos_ish <- function(x) 1 - x^2 / 2 + +#' @rdname trig +#' @export +tan_ish <- function(x) x + x^3 / 3 +``` + +Alternatively, you can add docs to an existing function. +This tends to work better if you have a "primary" function with some variants or some helpers. + +```{r} +#' Logarithms +#' +#' @param x A numeric vector +#' @export +log <- function(x, base) ... + +#' @rdname log +#' @export +log2 <- function(x) log(x, 2) + +#' @rdname log +#' @export +ln <- function(x) log(x, exp(1)) +``` + +### `@describeIn` + +An alternative to `@rdname` is `@describeIn`. +It has a slightly different syntax because as well as a topic name, you also provide a brief description for the function, like `@describein topic one sentence description`. +The primary difference between `@rdname` and `@describeIn`, is that `@describeIn` creates a new section containing a bulleted list all of each function, along with its description. +It uses a number of heuristics to determine the heading of this section, depending on you're documenting related functions, methods for a generic, or methods for a class. + +In general, I no longer recommend `@describeIn` because I don't think the heuristics it uses are as good as a thoughtful hand-crafted summary. +If you're currently using `@describeIn`, you can general replace it with `@rdname`, as long as you give some thought to the multiple-function `@description`. + +### Order of includes + +By default, roxygen blocks are processed in the order in which they appear in the file. +When you're combining multiple files, this can sometimes cause the function usage to appear in a suboptimal order. +You can override the default ordering with `@order`. +For example, the following the block would place `times` first in `arith.Rd` because 1 comes before 2. + +```{r} +#' @rdname arith +#' @order 2 +add <- function(x, y) x + y + +#' @rdname arith +#' @order 1 +times <- function(x, y) x * y +``` + +## Automatically copy tags + +If two or more functions share have similarities but are different or complex enough that you don't want to document them in a single file, you can use one of the four `@inherit` tags to automatically copy various components from another topic: + +- `@inheritParams foo` will copy `@param` contents from `foo`. +- `@inherit foo` will copy all supported components from `foo`. +- `@inheritSection foo {Section title}` will copy the `@section {Section title}` section from `foo`. +- `@inheritDotParams foo` will generate documentation for `…` by copying the documentation for `foo()`'s arguments. + +We think of this as "inheritance" rather than just copying, because anything you inherit can be overridden by a more specific definition in the documentation. +This applies particularly to `@inheritParams` which allows you to copy the documentation for some parameters while documenting others directly. +We'll focus on this first. + +### Parameters + +The oldest, and most frequently used, inherits tag is `@inheritParams`. +It's particularly useful when multiple functions use the same argument name for the same task, as you can document the argument once, then inherit those docs elsewhere. +For example, take the dplyr functions `arrange()`, `mutate()`, and `summarise()` which all have an argument called `.data`. +`arrange()` is documented like so: + +```{r} +#' @param .data A data frame, data frame extension (e.g. a tibble), or a +#' lazy data frame (e.g. from dbplyr or dtplyr). See *Methods*, below, for +#' more details. +#' @param ... <[`data-masking`][rlang::args_data_masking]> Variables, or +#' functions of variables. Use [desc()] to sort a variable in descending +#' order. +arrange <- function(.data, ...) {} +``` + +Then `mutate()` and `summarise()` don't need to provide `@param .data` but can instead inherit the documentation from `arrange()`: + +```{r} +#' @inheritParams arrange +mutate <- function(.data, ...) {} + +#' @inheritParams arrange +summarise <- function(.data, ...) {} +``` + +If this was all you wrote it wouldn't be quite right because `mutate()` and `summarise()` would also inherit the documentation for `...`, which has a different interpretation in these functions. +So, for example, `mutate()` provides its own definition for `...`: + +```{r} +#' @inheritParams arrange +#' @param ... <[`data-masking`][rlang::args_data_masking]> Name-value pairs. +#' The name gives the name of the column in the output. +#' +#' The value can be: +#' +#' * A vector of length 1, which will be recycled to the correct length. +#' * A vector the same length as the current group (or the whole data frame +#' if ungrouped). +#' * `NULL`, to remove the column. +#' * A data frame or tibble, to create multiple columns in the output. +mutate <- function(.data, ...) {} +``` + +Note that only the documentation for arguments with the same names are inherited. +For example, `arrange()` also has a `.by_group` argument. +Since no other function in dplyr has an argument with this name, its documentation will never be inherited. + +### Multiple parameters + +Sometimes you document two (or more) tightly coupled parameters together. +For example, `dplyr::left_join()` has: + +```{r} +#' @param x,y A pair of data frames, data frame extensions (e.g. a tibble), or +#' lazy data frames (e.g. from dbplyr or dtplyr). See *Methods*, below, for +#' more details. +``` + +When joint parameter documentation is inherited, it's all or nothing, i.e. if a function has `@inheritParams left_join` it will only inherit the documentation for `x` and `y` if it has both `x` and `y` arguments and neither is documented by the inheriting function. + +### The dot prefix + +Many tidyverse functions that accept named arguments in `...` also use a `.` prefix for their own arguments. +This reduces the risk of an argument going to the wrong place. +For example, `dplyr::mutate()` has `.by`, `.keep`, `.before`, and `.after` arguments, because if they didn't have that prefix, you wouldn't be able to create new variables called `by`, `keep`, `before`, or `after`. +We call this pattern the [dot prefix](https://design.tidyverse.org/dots-prefix.html). + +This means that an argument with the same meaning can come in one of two forms: with and without the `.`. +`@inheritParams` knows about this common pattern so ignores a `.` prefix when matching argument name. +In other words, `.x` will inherit documentation for `x`, and `x` will inherit documentation from `.x`. + +### Inheriting other components + +You can use `@inherits foo` to inherit the documentation for every supported tag from another topic. +Currently, `@inherits` supports inheriting the following tags: `r paste0("\x60", roxygen2:::inherit_components, "\x60", collapse = ", ")`. + +By supplying a space separated list of components after the function name, you can also choose to inherit only selected components. +For example, `@inherit foo returns` would just inherit the `@returns` tag, and `@inherit foo seealso source` would inherit the `@seealso` and `@source` tags. + +`@inherit foo sections` will inherit *every* `@section` tag (which can also be specified in markdown by using the top-level heading spec, `#`). +To inherit a *specific* section from another function, use `@inheritSection foo Section title`. +For example, all the "adverbs" in purrr use `#' @inheritSection safely Adverbs` to inherit a standard section that provides advice on using an adverb in package code. + +### Documenting `...` + +When your function passes `...` on to another function, it can be useful to inline the documentation for some of the most common arguments. +This technique is inspired by the documentation for `plot()`, where `...` can take any graphical parameter; `?plot` describes some of the most common arguments so that you don't have to look them up in `?par`. + +`@inheritDotParams` has two components: the function to inherit from and the arguments to inherit. +Since you'll typically only want to document the most important arguments, `@inheritDotParams` comes with a flexible specification for argument selection inspired by `dplyr::select()`: + +- `@inheritDotParams foo` takes all parameters from `foo()`. +- `@inheritDotParams foo a b e:h` takes parameters `a`, `b`, and all parameters between `e` and `h`. +- `@inheritDotParams foo -x -y` takes all parameters except for `x` and `y`. + +### Inheriting from other packages + +It's most common to inherit from other documentation topics within the current package, but roxygen2 also supports inheriting documentation from other packages by using `package::function` syntax, e.g.: + +- `@inheritParams package::function` + +- `@inherit package::function` + +- `@inheritSection package::function Section title` + +- `@inheritDotParams package::function` + +When inheriting documentation from another package bear in mind that you're now taking a fairly strong dependency on an external package, and to ensure every developer produces the same documentation you'll need to make sure that they all have the same version of the package installed. +And if the package changes the name of the topic or section, your documentation will require an update. +For those reasons, this technique is best used sparingly. + +## Inline code + +To insert code inline, enclose it in `` `r ` ``. +Roxygen will interpret the rest of the text within backticks as R code and evaluate it, and replace the backtick expression with its value. +Here's a simple example: + +```{r include = FALSE} +roxygen2:::markdown_on() + +simple_inline <- "#' Title `r 1 + 1` +#' +#' Description `r 2 + 2` +foo <- function() NULL +" +``` + +```{r code=simple_inline} +``` + +This is equivalent to writing: + +```{r code = roxygen2:::markdown(simple_inline)} +``` + +The resulting text, together with the whole tag is interpreted as markdown, as usual. +This means that you can use R to dynamically write markdown. +For example if you defined this function in your package: + +```{r} +alphabet <- function(n) { + paste0("`", letters[1:n], "`", collapse = ", ") +} +``` + +You could then write: + +```{r echo=FALSE} +env <- new.env() +env$alphabet <- alphabet +roxygen2:::roxy_meta_set("evalenv", env) + +backtick <- "#' Title +#' +#' @param x A string. Must be one of `r alphabet(5)` +foo <- function(x) NULL +" +``` + +```{r code = backtick} +``` + +The result is equivalent to writing the following by hand: + +```{r code = roxygen2:::markdown_pass1(backtick)} +``` + +This is a powerful technique for reducing duplication because you can flexibly parameterise the function however best meets your needs. +Note that the evaluation environment is deliberately a child of the package that you're documenting so you can call internal functions. + +## Child documents + +You can use the same `.Rmd` or `.md` document in the documentation, `README.Rmd`, and vignettes by using child documents: + +```` +```{r child = "common.Rmd"}`r ''` +``` +```` + +The included Rmd file can have roxygen Markdown-style links to other help topics. +E.g. `[roxygen2::roxygenize()]` will link to the manual page of the `roxygenize` function in roxygen2. +See `vignette("rd-formatting")` for details. + +If the Rmd file contains roxygen (Markdown-style) links to other help topics, then some care is needed, as those links will not work in Rmd files by default. +A workaround is to specify external HTML links for them. +These external locations will *not* be used for the manual which instead always links to the help topics in the manual. +Example: + +``` +See also the [roxygen2::roxygenize()] function. + +[roxygen2::roxygenize()]: https://roxygen2.r-lib.org/reference/roxygenize.html +``` + +This example will link to the supplied URLs in HTML / Markdown files and it will link to the `roxygenize` help topic in the manual. + +Note that if you add external link targets like these, then roxygen will emit a warning about these link references being defined multiple times (once externally, and once to the help topic). +This warning originates in Pandoc, and it is harmless. + +## Superseded + +Over the years, we have experimented with a number of other ways to reduce duplication across documentation files. +A number of these are now superseded and we recommend changing them to use the techniques described above: + +- Instead of `@includeRmd man/rmd/example.Rmd`, use a child document. + +- Instead of `@eval` or `@evalRd`, use inline R code. + +- Instead of `@template` and `@templateVars` write your own function and call it from inline R code. + +Inline R markdown can only generate markdown text within a tag so in principle it is less flexible than `@eval`/`@evalRd`/`@template`. +However, our experience has revealed that generating multiple tags at once tends to be rather inflexible, and you often end up refactoring into smaller pieces so we don't believe this reflects a real loss of functionality. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/reuse.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/reuse.html new file mode 100644 index 00000000..107ec4b8 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/reuse.html @@ -0,0 +1,734 @@ + + + + + + + + + + + + + + +Reusing documentation + + + + + + + + + + + + + + + + + + + + + + + + + + +

Reusing documentation

+ + + +

roxygen2 provides several ways to avoid repeating yourself in code +documentation, while assembling information from multiple places in one +documentation file:

+
    +
  • Combine documentation for closely related functions into a single +file with @describeIn or @rdname.

  • +
  • Automatically copy tags with @inheritParams, +@inheritSection, or @inherit.

  • +
  • Use functions to generate repeated text with inline R +code.

  • +
  • Share text between documentation and vignettes with child +documents.

  • +
+

The chapter concludes by showing you how to update superseded reuse +mechanisms that we no longer recommend: @includeRmd, +@eval/@evalRd, and @template.

+
+

Multiple functions in the same topic

+

You can document multiple functions in the same file by using either +@rdname or @describeIn tag. It’s a technique +best used with care: documenting too many functions in one place leads +to confusion. Use it when all functions have the same (or very similar) +arguments.

+
+

@rdname

+

Use @rdname <destination>1 to include multiple +functions in the same page. Tags (e.g. @title, +@description, @examples) will be combined, +across blocks but often this yields text that is hard to understand. So +we recommend that you make one block that contains the title, +description, common parameters, examples and so on, and then only +document individual parameters in the other blocks.

+

There are two basic ways to do that. You can create a standalone +documentation block and then add the functions to it. This typically +works best when you have a family of related functions and you want to +link to that family from other functions (i.e. trig in the +examples below).

+
#' Trigonometric approximations
+#' @param x Input, in radians.
+#' @name trig
+NULL
+#> NULL
+
+#' @rdname trig
+#' @export
+sin_ish <- function(x) x - x^3 / 6
+
+#' @rdname trig
+#' @export
+cos_ish <- function(x) 1 - x^2 / 2
+
+#' @rdname trig
+#' @export
+tan_ish <- function(x) x + x^3 / 3
+

Alternatively, you can add docs to an existing function. This tends +to work better if you have a “primary” function with some variants or +some helpers.

+
#' Logarithms
+#' 
+#' @param x A numeric vector
+#' @export
+log <- function(x, base) ...
+
+#' @rdname log
+#' @export
+log2 <- function(x) log(x, 2)
+
+#' @rdname log
+#' @export
+ln <- function(x) log(x, exp(1))
+
+
+

@describeIn

+

An alternative to @rdname is @describeIn. +It has a slightly different syntax because as well as a topic name, you +also provide a brief description for the function, like +@describein topic one sentence description. The primary +difference between @rdname and @describeIn, is +that @describeIn creates a new section containing a +bulleted list all of each function, along with its description. It uses +a number of heuristics to determine the heading of this section, +depending on you’re documenting related functions, methods for a +generic, or methods for a class.

+

In general, I no longer recommend @describeIn because I +don’t think the heuristics it uses are as good as a thoughtful +hand-crafted summary. If you’re currently using +@describeIn, you can general replace it with +@rdname, as long as you give some thought to the +multiple-function @description.

+
+
+

Order of includes

+

By default, roxygen blocks are processed in the order in which they +appear in the file. When you’re combining multiple files, this can +sometimes cause the function usage to appear in a suboptimal order. You +can override the default ordering with @order. For example, +the following the block would place times first in +arith.Rd because 1 comes before 2.

+
#' @rdname arith
+#' @order 2
+add <- function(x, y) x + y
+
+#' @rdname arith
+#' @order 1
+times <- function(x, y) x * y
+
+
+
+

Automatically copy tags

+

If two or more functions share have similarities but are different or +complex enough that you don’t want to document them in a single file, +you can use one of the four @inherit tags to automatically +copy various components from another topic:

+
    +
  • @inheritParams foo will copy @param +contents from foo.
  • +
  • @inherit foo will copy all supported components from +foo.
  • +
  • @inheritSection foo {Section title} will copy the +@section {Section title} section from +foo.
  • +
  • @inheritDotParams foo will generate documentation for + by copying the documentation for foo()’s +arguments.
  • +
+

We think of this as “inheritance” rather than just copying, because +anything you inherit can be overridden by a more specific definition in +the documentation. This applies particularly to +@inheritParams which allows you to copy the documentation +for some parameters while documenting others directly. We’ll focus on +this first.

+
+

Parameters

+

The oldest, and most frequently used, inherits tag is +@inheritParams. It’s particularly useful when multiple +functions use the same argument name for the same task, as you can +document the argument once, then inherit those docs elsewhere. For +example, take the dplyr functions arrange(), +mutate(), and summarise() which all have an +argument called .data. arrange() is documented +like so:

+
#' @param .data A data frame, data frame extension (e.g. a tibble), or a
+#'   lazy data frame (e.g. from dbplyr or dtplyr). See *Methods*, below, for
+#'   more details.
+#' @param ... <[`data-masking`][rlang::args_data_masking]> Variables, or
+#'   functions of variables. Use [desc()] to sort a variable in descending
+#'   order.
+arrange <- function(.data, ...) {}
+

Then mutate() and summarise() don’t need to +provide @param .data but can instead inherit the +documentation from arrange():

+
#' @inheritParams arrange
+mutate <- function(.data, ...) {}
+
+#' @inheritParams arrange
+summarise <- function(.data, ...) {}
+

If this was all you wrote it wouldn’t be quite right because +mutate() and summarise() would also inherit +the documentation for ..., which has a different +interpretation in these functions. So, for example, +mutate() provides its own definition for +...:

+
#' @inheritParams arrange
+#' @param ... <[`data-masking`][rlang::args_data_masking]> Name-value pairs.
+#'   The name gives the name of the column in the output.
+#'
+#'   The value can be:
+#'
+#'   * A vector of length 1, which will be recycled to the correct length.
+#'   * A vector the same length as the current group (or the whole data frame
+#'     if ungrouped).
+#'   * `NULL`, to remove the column.
+#'   * A data frame or tibble, to create multiple columns in the output.
+mutate <- function(.data, ...) {}
+

Note that only the documentation for arguments with the same names +are inherited. For example, arrange() also has a +.by_group argument. Since no other function in dplyr has an +argument with this name, its documentation will never be inherited.

+
+
+

Multiple parameters

+

Sometimes you document two (or more) tightly coupled parameters +together. For example, dplyr::left_join() has:

+
#' @param x,y A pair of data frames, data frame extensions (e.g. a tibble), or
+#'   lazy data frames (e.g. from dbplyr or dtplyr). See *Methods*, below, for
+#'   more details.
+

When joint parameter documentation is inherited, it’s all or nothing, +i.e. if a function has @inheritParams left_join it will +only inherit the documentation for x and y if +it has both x and y arguments and neither is +documented by the inheriting function.

+
+
+

The dot prefix

+

Many tidyverse functions that accept named arguments in +... also use a . prefix for their own +arguments. This reduces the risk of an argument going to the wrong +place. For example, dplyr::mutate() has .by, +.keep, .before, and .after +arguments, because if they didn’t have that prefix, you wouldn’t be able +to create new variables called by, keep, +before, or after. We call this pattern the dot prefix.

+

This means that an argument with the same meaning can come in one of +two forms: with and without the .. +@inheritParams knows about this common pattern so ignores a +. prefix when matching argument name. In other words, +.x will inherit documentation for x, and +x will inherit documentation from .x.

+
+
+

Inheriting other components

+

You can use @inherits foo to inherit the documentation +for every supported tag from another topic. Currently, +@inherits supports inheriting the following tags: +params, return, title, +description, details, seealso, +sections, references, examples, +author, source, note, +format.

+

By supplying a space separated list of components after the function +name, you can also choose to inherit only selected components. For +example, @inherit foo returns would just inherit the +@returns tag, and @inherit foo seealso source +would inherit the @seealso and @source +tags.

+

@inherit foo sections will inherit every +@section tag (which can also be specified in markdown by +using the top-level heading spec, #). To inherit a +specific section from another function, use +@inheritSection foo Section title. For example, all the +“adverbs” in purrr use #' @inheritSection safely Adverbs to +inherit a standard section that provides advice on using an adverb in +package code.

+
+
+

Documenting ...

+

When your function passes ... on to another function, it +can be useful to inline the documentation for some of the most common +arguments. This technique is inspired by the documentation for +plot(), where ... can take any graphical +parameter; ?plot describes some of the most common +arguments so that you don’t have to look them up in +?par.

+

@inheritDotParams has two components: the function to +inherit from and the arguments to inherit. Since you’ll typically only +want to document the most important arguments, +@inheritDotParams comes with a flexible specification for +argument selection inspired by dplyr::select():

+
    +
  • @inheritDotParams foo takes all parameters from +foo().
  • +
  • @inheritDotParams foo a b e:h takes parameters +a, b, and all parameters between +e and h.
  • +
  • @inheritDotParams foo -x -y takes all parameters except +for x and y.
  • +
+
+
+

Inheriting from other packages

+

It’s most common to inherit from other documentation topics within +the current package, but roxygen2 also supports inheriting documentation +from other packages by using package::function syntax, +e.g.:

+
    +
  • @inheritParams package::function

  • +
  • @inherit package::function

  • +
  • @inheritSection package::function Section title

  • +
  • @inheritDotParams package::function

  • +
+

When inheriting documentation from another package bear in mind that +you’re now taking a fairly strong dependency on an external package, and +to ensure every developer produces the same documentation you’ll need to +make sure that they all have the same version of the package installed. +And if the package changes the name of the topic or section, your +documentation will require an update. For those reasons, this technique +is best used sparingly.

+
+
+
+

Inline code

+

To insert code inline, enclose it in `r `. Roxygen will +interpret the rest of the text within backticks as R code and evaluate +it, and replace the backtick expression with its value. Here’s a simple +example:

+
#' Title `r 1 + 1`
+#'
+#' Description `r 2 + 2`
+foo <- function() NULL
+

This is equivalent to writing:

+
#' Title 2
+#'
+#' Description 4
+foo <- function() NULL
+

The resulting text, together with the whole tag is interpreted as +markdown, as usual. This means that you can use R to dynamically write +markdown. For example if you defined this function in your package:

+
alphabet <- function(n) {
+  paste0("`", letters[1:n], "`", collapse = ", ")
+}
+

You could then write:

+
#' Title
+#' 
+#' @param x A string. Must be one of `r alphabet(5)`
+foo <- function(x) NULL
+

The result is equivalent to writing the following by hand:

+
#' Title
+#' 
+#' @param x A string. Must be one of `a`, `b`, `c`, `d`, `e`
+foo <- function(x) NULL
+

This is a powerful technique for reducing duplication because you can +flexibly parameterise the function however best meets your needs. Note +that the evaluation environment is deliberately a child of the package +that you’re documenting so you can call internal functions.

+
+
+

Child documents

+

You can use the same .Rmd or .md document +in the documentation, README.Rmd, and vignettes by using +child documents:

+
```{r child = "common.Rmd"}
+```
+

The included Rmd file can have roxygen Markdown-style links to other +help topics. E.g. [roxygen2::roxygenize()] will link to the +manual page of the roxygenize function in roxygen2. See +vignette("rd-formatting") for details.

+

If the Rmd file contains roxygen (Markdown-style) links to other help +topics, then some care is needed, as those links will not work in Rmd +files by default. A workaround is to specify external HTML links for +them. These external locations will not be used for the manual +which instead always links to the help topics in the manual. +Example:

+
See also the [roxygen2::roxygenize()] function.
+
+[roxygen2::roxygenize()]: https://roxygen2.r-lib.org/reference/roxygenize.html
+

This example will link to the supplied URLs in HTML / Markdown files +and it will link to the roxygenize help topic in the +manual.

+

Note that if you add external link targets like these, then roxygen +will emit a warning about these link references being defined multiple +times (once externally, and once to the help topic). This warning +originates in Pandoc, and it is harmless.

+
+
+

Superseded

+

Over the years, we have experimented with a number of other ways to +reduce duplication across documentation files. A number of these are now +superseded and we recommend changing them to use the techniques +described above:

+
    +
  • Instead of @includeRmd man/rmd/example.Rmd, use a +child document.

  • +
  • Instead of @eval or @evalRd, use inline +R code.

  • +
  • Instead of @template and @templateVars +write your own function and call it from inline R code.

  • +
+

Inline R markdown can only generate markdown text within a tag so in +principle it is less flexible than +@eval/@evalRd/@template. However, +our experience has revealed that generating multiple tags at once tends +to be rather inflexible, and you often end up refactoring into smaller +pieces so we don’t believe this reflects a real loss of +functionality.

+
+
+
+
    +
  1. The destination is a topic name. There’s a one-to-one +correspondence between topic names and .Rd files where a +topic called foo will produce a file called +man/foo.Rd.↩︎

  2. +
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/roxygen2.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/roxygen2.R new file mode 100644 index 00000000..e4a1e71b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/roxygen2.R @@ -0,0 +1,38 @@ +## ----include = FALSE---------------------------------------------------------- +knitr::opts_chunk$set(comment = "#>", collapse = TRUE) + +## ----echo = FALSE------------------------------------------------------------- +example <- "#' Add together two numbers +#' +#' @param x A number. +#' @param y A number. +#' @return A number. +#' @examples +#' add(1, 1) +#' add(10, 1) +add <- function(x, y) { + x + y +} +" + +## ----code=example------------------------------------------------------------- +#' Add together two numbers +#' +#' @param x A number. +#' @param y A number. +#' @return A number. +#' @examples +#' add(1, 1) +#' add(10, 1) +add <- function(x, y) { + x + y +} + + +## ----echo=FALSE, results="asis"----------------------------------------------- +cat( + "\x60\x60\x60rd\n", + format(roxygen2::roc_proc_text(roxygen2::rd_roclet(), example)[[1]]), + "\n\x60\x60\x60", sep = "" +) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/roxygen2.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/roxygen2.Rmd new file mode 100644 index 00000000..c8a3af9a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/roxygen2.Rmd @@ -0,0 +1,108 @@ +--- +title: "Get started with roxygen2" +description: > + Learn the big picture of roxygen2 and the basic workflow + you'll use with it. +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Get started with roxygen2} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set(comment = "#>", collapse = TRUE) +``` + +Documentation is one of the most important aspects of good code. +Without it, users won't know how to use your package, and are unlikely to do so. +Documentation is also useful for you in the future (so you remember what the heck you were thinking!), and for other developers working on your package. +The goal of roxygen2 is to make documenting your code as easy as possible. + +R provides a standard way of documenting packages: you write `.Rd` files in the `man/` directory. +These files use a custom syntax, loosely based on LaTeX. +roxygen2 provides a number of advantages over writing `.Rd` files by hand: + +- Code and documentation are adjacent so when you modify your code, it's easy to remember that you need to update the documentation. + +- roxygen2 dynamically inspects the objects that it's documenting, so it can automatically add data that you'd otherwise have to write by hand. + +- It abstracts over the differences in documenting S3 and S4 methods, generics and classes, so you need to learn fewer details. + +As well as generating `.Rd` files, roxygen will also create a `NAMESPACE` for you, and will manage the `Collate` field in `DESCRIPTION`. + +## Learn more + +This vignette provides a high-level description of roxygen2 and the overall workflow you'll use with it. +The other vignettes provide more detail on the most important individual components: + +- Start with `vignette("rd")` to learn how document your functions with roxygen2. + +- `vignette("rd-other")` discusses how to document other things like datasets, the package itself, and the various pieces used by R's OOP systems. + +- `vignette("rd-formatting")` gives the details of roxygen2's rmarkdown support. + +- `vignette("reuse")` demonstrates the tools available to reuse documentation in multiple places. + +- `vignette("namespace")` describes how to generate a `NAMESPACE` file, how namespacing works in R, and how you can use roxygen2 to be specific about what your package needs and supplies. + +## Running roxygen + +There are three main ways to run roxygen: + +- `roxygen2::roxygenise()`. + +- `devtools::document()`. + +- `Ctrl + Shift + D`, if you're using RStudio. + +You can mix handwritten Rd and roxygen2; roxygen2 will never overwrite a file it didn't create. + +## Basic process + +There are three steps in the transformation from roxygen comments in your source file to human readable documentation: + +1. You add roxygen comments to your source file. +2. `roxygen2::roxygenise()` converts roxygen comments to `.Rd` files. +3. R converts `.Rd` files to human readable documentation. + +The process starts when you add specially formatted roxygen comments to your source file. +Roxygen comments start with `#'` so you can continue to use regular comments for other purposes. + +```{r, echo = FALSE} +example <- "#' Add together two numbers +#' +#' @param x A number. +#' @param y A number. +#' @return A number. +#' @examples +#' add(1, 1) +#' add(10, 1) +add <- function(x, y) { + x + y +} +" +``` + +```{r code=example} +``` + +For the example above, this will generate `man/add.Rd` that looks like: + +```{r, echo=FALSE, results="asis"} +cat( + "\x60\x60\x60rd\n", + format(roxygen2::roc_proc_text(roxygen2::rd_roclet(), example)[[1]]), + "\n\x60\x60\x60", sep = "" +) +``` + +Rd files are a special file format loosely based on LaTeX. +You can read more about the Rd format in the [R extensions](https://cran.r-project.org/doc/manuals/R-exts.html#Rd-format) manual. +With roxygen2, there are few reasons to know about Rd files, so here I'll avoid discussing them as much as possible, focusing instead on what you need to know about roxygen2. + +When you use `?x`, `help("x")` or `example("x")` R looks for an Rd file containing `\alias{x}`. +It then parses the file, converts it into HTML and displays it. +These functions look for an Rd file in *installed* packages. +This isn't very useful for package development, because you want to use the `.Rd` files in the *source* package. +For this reason, we recommend that you use roxygen2 in conjunction with devtools: `devtools::load_all()` automatically adds shims so that `?` and friends will look in the development package. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/roxygen2.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/roxygen2.html new file mode 100644 index 00000000..a8c1f713 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/doc/roxygen2.html @@ -0,0 +1,482 @@ + + + + + + + + + + + + + + +Get started with roxygen2 + + + + + + + + + + + + + + + + + + + + + + + + + + +

Get started with roxygen2

+ + + +

Documentation is one of the most important aspects of good code. +Without it, users won’t know how to use your package, and are unlikely +to do so. Documentation is also useful for you in the future (so you +remember what the heck you were thinking!), and for other developers +working on your package. The goal of roxygen2 is to make documenting +your code as easy as possible.

+

R provides a standard way of documenting packages: you write +.Rd files in the man/ directory. These files +use a custom syntax, loosely based on LaTeX. roxygen2 provides a number +of advantages over writing .Rd files by hand:

+
    +
  • Code and documentation are adjacent so when you modify your code, +it’s easy to remember that you need to update the +documentation.

  • +
  • roxygen2 dynamically inspects the objects that it’s documenting, +so it can automatically add data that you’d otherwise have to write by +hand.

  • +
  • It abstracts over the differences in documenting S3 and S4 +methods, generics and classes, so you need to learn fewer +details.

  • +
+

As well as generating .Rd files, roxygen will also +create a NAMESPACE for you, and will manage the +Collate field in DESCRIPTION.

+
+

Learn more

+

This vignette provides a high-level description of roxygen2 and the +overall workflow you’ll use with it. The other vignettes provide more +detail on the most important individual components:

+
    +
  • Start with vignette("rd") to learn how document your +functions with roxygen2.

  • +
  • vignette("rd-other") discusses how to document other +things like datasets, the package itself, and the various pieces used by +R’s OOP systems.

  • +
  • vignette("rd-formatting") gives the details of +roxygen2’s rmarkdown support.

  • +
  • vignette("reuse") demonstrates the tools available +to reuse documentation in multiple places.

  • +
  • vignette("namespace") describes how to generate a +NAMESPACE file, how namespacing works in R, and how you can +use roxygen2 to be specific about what your package needs and +supplies.

  • +
+
+
+

Running roxygen

+

There are three main ways to run roxygen:

+
    +
  • roxygen2::roxygenise().

  • +
  • devtools::document().

  • +
  • Ctrl + Shift + D, if you’re using RStudio.

  • +
+

You can mix handwritten Rd and roxygen2; roxygen2 will never +overwrite a file it didn’t create.

+
+
+

Basic process

+

There are three steps in the transformation from roxygen comments in +your source file to human readable documentation:

+
    +
  1. You add roxygen comments to your source file.
  2. +
  3. roxygen2::roxygenise() converts roxygen comments to +.Rd files.
  4. +
  5. R converts .Rd files to human readable +documentation.
  6. +
+

The process starts when you add specially formatted roxygen comments +to your source file. Roxygen comments start with #' so you +can continue to use regular comments for other purposes.

+
#' Add together two numbers
+#'
+#' @param x A number.
+#' @param y A number.
+#' @return A number.
+#' @examples
+#' add(1, 1)
+#' add(10, 1)
+add <- function(x, y) {
+  x + y
+}
+

For the example above, this will generate man/add.Rd +that looks like:

+
% Generated by roxygen2: do not edit by hand
+% Please edit documentation in ./<text>
+\name{add}
+\alias{add}
+\title{Add together two numbers}
+\usage{
+add(x, y)
+}
+\arguments{
+\item{x}{A number.}
+
+\item{y}{A number.}
+}
+\value{
+A number.
+}
+\description{
+Add together two numbers
+}
+\examples{
+add(1, 1)
+add(10, 1)
+}
+

Rd files are a special file format loosely based on LaTeX. You can +read more about the Rd format in the R +extensions manual. With roxygen2, there are few reasons to know +about Rd files, so here I’ll avoid discussing them as much as possible, +focusing instead on what you need to know about roxygen2.

+

When you use ?x, help("x") or +example("x") R looks for an Rd file containing +\alias{x}. It then parses the file, converts it into HTML +and displays it. These functions look for an Rd file in +installed packages. This isn’t very useful for package +development, because you want to use the .Rd files in the +source package. For this reason, we recommend that you use +roxygen2 in conjunction with devtools: devtools::load_all() +automatically adds shims so that ? and friends will look in +the development package.

+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/help/AnIndex new file mode 100644 index 00000000..d725c974 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/help/AnIndex @@ -0,0 +1,122 @@ +roxygen2-package roxygen2-package +@aliases tags-index-crossref +@backref tags-index-crossref +@concept tags-index-crossref +@describeIn tags-reuse +@description tags-rd +@details tags-rd +@eval tags-reuse +@evalNamespace tags-namespace +@evalRd tags-reuse +@example tags-rd +@examples tags-rd +@examplesIf tags-rd +@export tags-namespace +@exportClass tags-namespace +@exportMethod tags-namespace +@exportPattern tags-namespace +@exportS3Method tags-namespace +@family tags-index-crossref +@field tags-rd-other +@format tags-rd-other +@import tags-namespace +@importClassesFrom tags-namespace +@importFrom tags-namespace +@importMethodsFrom tags-namespace +@include update_collate +@includeRmd tags-reuse +@inherit tags-reuse +@inheritDotParams tags-reuse +@inheritParams tags-reuse +@inheritSection tags-reuse +@keywords tags-index-crossref +@md tags-rd-formatting +@method tags-rd-other +@noMd tags-rd-formatting +@noRd tags-rd +@order tags-reuse +@param tags-rd +@rawNamespace tags-namespace +@rawRd tags-rd +@rdname tags-reuse +@references tags-index-crossref +@return tags-rd +@returns tags-rd +@section tags-rd-formatting +@seealso tags-index-crossref +@slot tags-rd-other +@source tags-rd-other +@template tags-reuse +@templateVar tags-reuse +@title tags-rd +@usage tags-rd +@useDynLib tags-namespace +block_get_tag roxy_block +block_get_tags roxy_block +block_get_tag_value roxy_block +block_has_tags roxy_block +double_escape_md double_escape_md +env_file parse_package +env_package parse_package +escape_examples escape_examples +escape_rd_for_md markdown-internals +is_s3_generic is_s3_generic +is_s3_method is_s3_generic +load load +load_installed load +load_options load_options +load_pkgload load +load_source load +markdown-test markdown-test +markdown_pass1 markdown_pass1 +namespace_roclet namespace_roclet +object object +object_format object_format +parse_file parse_package +parse_package parse_package +parse_text parse_package +rd_roclet rd_roclet +rd_section rd_section +roclet roclet +roclet_clean roclet +roclet_find roclet_find +roclet_output roclet +roclet_preprocess roclet +roclet_process roclet +roclet_tags roclet +roc_proc_text roc_proc_text +roxygen2 roxygen2-package +roxygenise roxygenize +roxygenize roxygenize +RoxyTopic RoxyTopic +roxy_block roxy_block +roxy_meta_get load_options +roxy_tag roxy_tag +roxy_tag_parse roxy_tag +roxy_tag_rd roxy_tag_rd +roxy_tag_warning roxy_tag +tags-index-crossref tags-index-crossref +tags-namespace tags-namespace +tags-rd tags-rd +tags-rd-formatting tags-rd-formatting +tags-rd-other tags-rd-other +tags-reuse tags-reuse +tags_list tags_list +tags_metadata tags_list +tag_code tag_parsers +tag_examples tag_parsers +tag_inherit tag_parsers +tag_markdown tag_parsers +tag_markdown_with_sections tag_parsers +tag_name tag_parsers +tag_name_description tag_parsers +tag_parsers tag_parsers +tag_toggle tag_parsers +tag_two_part tag_parsers +tag_value tag_parsers +tag_words tag_parsers +tag_words_line tag_parsers +unescape_rd_for_md markdown-internals +update_collate update_collate +vignette_roclet vignette_roclet +warn_roxy_tag roxy_tag diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/help/aliases.rds new file mode 100644 index 00000000..8e6ff1ce Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/help/figures/logo.png b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/help/figures/logo.png new file mode 100644 index 00000000..13709c5e Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/help/figures/logo.png differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/help/figures/test-figure-1.png b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/help/figures/test-figure-1.png new file mode 100644 index 00000000..931036c9 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/help/figures/test-figure-1.png differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/help/paths.rds new file mode 100644 index 00000000..7bacd05f Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/help/roxygen2.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/help/roxygen2.rdb new file mode 100644 index 00000000..b518d98e Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/help/roxygen2.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/help/roxygen2.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/help/roxygen2.rdx new file mode 100644 index 00000000..a47f83f9 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/help/roxygen2.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/html/00Index.html new file mode 100644 index 00000000..268b15c3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/html/00Index.html @@ -0,0 +1,161 @@ + + +R: In-Line Documentation for R + + + +
+

In-Line Documentation for R + +

+
+
+[Up] +[Top] +

Documentation for package ‘roxygen2’ version 7.3.2

+ + + +

Help Pages

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
@aliasesTags for indexing and cross-references
@backrefTags for indexing and cross-references
@conceptTags for indexing and cross-references
@describeInTags that help you reuse documentation
@descriptionTags for documenting functions
@detailsTags for documenting functions
@evalTags that help you reuse documentation
@evalNamespaceTags for managing the 'NAMESPACE'
@evalRdTags that help you reuse documentation
@exampleTags for documenting functions
@examplesTags for documenting functions
@examplesIfTags for documenting functions
@exportTags for managing the 'NAMESPACE'
@exportClassTags for managing the 'NAMESPACE'
@exportMethodTags for managing the 'NAMESPACE'
@exportPatternTags for managing the 'NAMESPACE'
@exportS3MethodTags for managing the 'NAMESPACE'
@familyTags for indexing and cross-references
@fieldTags for documenting datasets and classes
@formatTags for documenting datasets and classes
@importTags for managing the 'NAMESPACE'
@importClassesFromTags for managing the 'NAMESPACE'
@importFromTags for managing the 'NAMESPACE'
@importMethodsFromTags for managing the 'NAMESPACE'
@includeUpdate Collate field in DESCRIPTION
@includeRmdTags that help you reuse documentation
@inheritTags that help you reuse documentation
@inheritDotParamsTags that help you reuse documentation
@inheritParamsTags that help you reuse documentation
@inheritSectionTags that help you reuse documentation
@keywordsTags for indexing and cross-references
@mdTags related to markdown support
@methodTags for documenting datasets and classes
@noMdTags related to markdown support
@noRdTags for documenting functions
@orderTags that help you reuse documentation
@paramTags for documenting functions
@rawNamespaceTags for managing the 'NAMESPACE'
@rawRdTags for documenting functions
@rdnameTags that help you reuse documentation
@referencesTags for indexing and cross-references
@returnTags for documenting functions
@returnsTags for documenting functions
@sectionTags related to markdown support
@seealsoTags for indexing and cross-references
@slotTags for documenting datasets and classes
@sourceTags for documenting datasets and classes
@templateTags that help you reuse documentation
@templateVarTags that help you reuse documentation
@titleTags for documenting functions
@usageTags for documenting functions
@useDynLibTags for managing the 'NAMESPACE'
loadLoad package code
load_installedLoad package code
load_pkgloadLoad package code
load_sourceLoad package code
namespace_rocletRoclet: make 'NAMESPACE'
rd_rocletRoclet: make Rd files
roxygeniseProcess a package with the Rd, namespace and collate roclets
roxygenizeProcess a package with the Rd, namespace and collate roclets
tags-index-crossrefTags for indexing and cross-references
tags-namespaceTags for managing the 'NAMESPACE'
tags-rdTags for documenting functions
tags-rd-formattingTags related to markdown support
tags-rd-otherTags for documenting datasets and classes
tags-reuseTags that help you reuse documentation
update_collateUpdate Collate field in DESCRIPTION
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/libs/roxygen2.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/libs/roxygen2.so new file mode 100755 index 00000000..36146cc9 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/libs/roxygen2.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/libs/roxygen2.so.dSYM/Contents/Info.plist b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/libs/roxygen2.so.dSYM/Contents/Info.plist new file mode 100644 index 00000000..38127c1b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/libs/roxygen2.so.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.roxygen2.so + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/libs/roxygen2.so.dSYM/Contents/Resources/DWARF/roxygen2.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/libs/roxygen2.so.dSYM/Contents/Resources/DWARF/roxygen2.so new file mode 100644 index 00000000..8400689f Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/libs/roxygen2.so.dSYM/Contents/Resources/DWARF/roxygen2.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/roxygen2-tags.yml b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/roxygen2-tags.yml new file mode 100644 index 00000000..db439ac0 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/roxygen2/roxygen2-tags.yml @@ -0,0 +1,416 @@ +- name: aliases + description: > + Add additional aliases to the topic. + + Use `NULL` to suppress the default alias automatically generated by roxygen2. + template: ' ${1:alias}' + vignette: index-crossref + recommend: true + +- name: author + description: > + Topic author(s), if different from the package author(s). + template: ' ${1:author}' + recommend: true + +- name: backref + description: > + Manually override the backreference that points from the `.Rd` file back to + the source `.R` file. Only needed when generating code. + template: ' ${1:path}' + vignette: index-crossref + +- name: concept + description: > + Add additional keywords or phrases to be included in the `help.search()` + index. Each `@concept` should be a single term or phrase. + template: ' ${1:concept}' + vignette: index-crossref + recommend: true + +- name: describeIn + description: > + Document a function or method in the `destination` topic. + template: ' ${1:destination} ${2:description}' + vignette: reuse + recommend: true + +- name: description + description: > + A short description of the purpose of the function. Usually around + a paragraph, but can be longer if needed. + template: "\n${1:A short description...}\n" + vignette: rd + recommend: true + +- name: details + description: > + Additional details about the function. Generally superseded by instead + using a level 1 heading. + template: "\n${1:Additional details...}\n" + vignette: rd + +- name: docType + description: > + Set documentation type. One of `data`, `package`, `class`, or `methods`. + + Usually added automatically; for expert use only. + template: ' ${1:data|package|class|methods}' + +- name: encoding + description: > + Override encoding of single `.Rd` file. No longer recommended since + all documentation should use UTF-8. + template: ' ${1:encoding}' + +- name: eval + description: > + Evaluate arbitrary code in the package namespace and insert the results + back into the block. Should return a character vector of lines. + template: ' ${1:r-code}' + vignette: reuse + +- name: evalNamespace + description: > + Evaluate arbitrary code in the package namespace and insert the results + into the `NAMESPACE`. Should return a character vector of directives. + template: ' ${1:r-code}' + vignette: namespace + +- name: evalRd + description: > + Evaluate arbitrary code in the package namespace and insert the results + back as into the block. Should return a character vector of lines. + template: ' ${1:r-code}' + vignette: reuse + +- name: example + description: > + Embed examples stored in another file. + template: ' ${1:path}.R' + vignette: rd + recommend: true + +- name: examples + description: > + Executable R code that demonstrates how the function works. Code must run + without error. + template: "\n${1:# example code}\n" + vignette: rd + recommend: true + +- name: examplesIf + description: > + Run examples only when `condition` is `TRUE`. + template: " ${1:condition}\n${2:# example code}\n" + vignette: rd + recommend: true + +- name: export + description: > + Export this function, method, generic, or class so it's available + outside of the package. + vignette: namespace + recommend: true + +- name: exportClass + description: > + Export an S4 class. For expert use only; in most cases you should use + `@export` so roxygen2 can automatically generate the correct directive. + template: ' ${1:class}' + vignette: namespace + +- name: exportMethod + description: > + Export S4 methods. For expert use only; in most cases you should use + `@export` so roxygen2 can automatically generate the correct directive. + template: ' ${1:generic}' + vignette: namespace + +- name: exportPattern + description: > + Export all objects matching a regular expression. + template: ' ${1:pattern}' + vignette: namespace + +- name: exportS3Method + description: > + Export an S3 method. Only needed when the method is for a generic from a + suggested package. + template: ' ${1:package}::${2:generic}' + vignette: namespace + recommend: true + +- name: family + description: > + Generate `@seealso` entries to all other functions in `family name`. + template: ' ${1:family name}' + vignette: index-crossref + recommend: true + +- name: field + description: > + Describe a R6 or refClass field. + template: ' ${1:name} ${2:description}' + vignette: rd-other + recommend: true + +- name: format + description: > + Describe the type/shape of a dataset. If the dataset is a data frame, + include a description of each column. If not supplied, will be + automatically generated by `object_format()`. + template: ' ${1:description}' + vignette: rd-other + recommend: true + +- name: import + description: > + Import all functions from a package. Use with extreme care. + template: ' ${1:package}' + vignette: namespace + +- name: importClassesFrom + description: > + Import S4 classes from another package. + template: ' ${1:package} ${2:class}' + vignette: namespace + +- name: importFrom + description: > + Import specific functions from a package. + template: ' ${1:package} ${2:function}' + vignette: namespace + recommend: true + +- name: importMethodsFrom + description: > + Import S4 methods from a package. + template: ' ${1:package} ${2:generic}' + vignette: namespace + +- name: include + description: > + Declare that `filename.R` must be loaded before the current file. + template: ' ${1:filename}.R' + recommend: true + +- name: includeRmd + description: > + Insert the contents of an `.Rmd` into the current block. Superseded + in favour of using a code chunk with a child document. + template: ' man/rmd/${1:filename}.Rmd' + vignette: reuse + +- name: inherit + description: > + Inherit one or more documentation components from another topic. + If `components` is omitted, all supported components will be inherited. + + Otherwise, specify individual components to inherit by picking one or + more of `params`, `return`, `title`, `description`, `details`, `seealso`, + `sections`, `references`, `examples`, `author`, `source`, `note`, + and `format`. + template: ' ${1:source} ${2:components}' + vignette: reuse + recommend: true + +- name: inheritDotParams + description: > + Automatically generate documentation for `...` when you're passing dots + along to another function. + template: ' ${1:source} ${2:arg1 arg2 arg3}' + vignette: reuse + recommend: true + +- name: inheritParams + description: > + Inherit argument documentation from another function. Only inherits + documentation for arguments that aren't already documented locally. + template: ' ${1:source}' + vignette: reuse + recommend: true + +- name: inheritSection + description: > + Inherit a specific named section from another topic. + template: ' ${1:source} ${2:section name}' + vignette: reuse + recommend: true + +- name: keywords + description: > + Add a standardised keyword, indexed by `help.search()`. These are generally + not useful apart from `@keywords internal` which flags the topic as internal + and removes from topic indexes. + template: ' ${1:keyword}' + vignette: index-crossref + recommend: true + +- name: md + description: > + Force markdown processing for a block. + vignette: rd-formatting + +- name: method + description: > + Force a function to be recognised as an S3 method. This affects the + default usage and the `NAMESPACE` directive produced by `@export`. + Only needed if automatic detection fails. + template: ' ${1:generic} ${2:class}' + vignette: rd-other + recommend: true + +- name: name + description: > + Define (or override the topic) name. + + Typically only needed for synthetic topics where you are documenting `NULL`. + template: ' ${1:name}' + +- name: noMd + description: > + Suppress markdown processing for a block. + vignette: 'rd-formatting' + +- name: noRd + description: > + Suppress `.Rd` generation for a block. Use for documentation + blocks that should only be visible in the source code. + vignette: 'rd' + recommend: true + +- name: note + description: > + Add an optional note. Now generally superseded by + using a level 1 markdown heading. + template: "\n" + +- name: order + description: > + Override the default (lexigraphic) order in which multiple blocks + are combined into a single topic. + template: ' ${1:number}' + vignette: reuse + recommend: true + +- name: param + description: > + Describe a function input. Should describe acceptable input types + and how it affects the output. `description` is usually one or two + sentences but can be as long as needed. + + Document multiple arguments by separating their names with commas + without spaces. + template: ' ${1:name} ${2:description}' + vignette: rd + recommend: true + +- name: rawNamespace + description: > + Insert literal text directly into the `NAMESPACE`. + template: ' ${1:namespace directives}' + vignette: namespace + +- name: rawRd + description: > + Insert literal text directly into the `.Rd` file. + template: ' ${1:rd}' + vignette: rd + +- name: rdname + description: > + Override the file name of generated `.Rd` file. Can be used to + combine multiple blocks into a single documentation topic. + template: ' ${1:topic-name}' + vignette: reuse + recommend: true + +- name: references + description: > + Pointers to the related literature. Usually formatted like a bibliography. + template: ' ${1:reference}' + vignette: index-crossref + recommend: true + +- name: return + description: > + Describe the function's output. Superseded in favour of `@returns`. + template: ' ${1:description}' + vignette: rd + +- name: returns + description: > + Describe the function's output. Typically will be a 1-2 sentence + description of the output type, but might also include discussion + of important errors or warnings. + template: ' ${1:description}' + vignette: rd + recommend: true + +- name: section + description: > + Add an arbitrary section to the documentation. Now generally superseded + in favour of using a level 1 heading. + template: " ${1:section title}: \n" + vignette: rd-formatting + +- name: seealso + description: > + Link to other related functions or urls. Usually a sentence or two, or + a bulleted list. + template: ' [${1:func}()]' + vignette: index-crossref + recommend: true + +- name: slot + description: > + Describe the slot of an S4 class. + template: ' ${1:name} ${2:description}' + vignette: rd-other + recommend: true + +- name: source + description: > + Describe where the dataset came from. Provide a link to the original + source (if possible) and briefly describe any manipulation that you + performed when importing the data. + template: ' ${1:description}' + vignette: rd-other + recommend: true + +- name: template + description: > + Use a roxygen2 template. Now superseded in favour of inline R code. + template: ' ${1:path-to-template}' + vignette: reuse + +- name: templateVar + description: > + Define variables for use in a roxygen2 template. + template: ' ${1:name} ${2:value}' + vignette: reuse + +- name: title + description: > + A one-line description of the function shown in various indexes. + An explicit `@title` is not usually needed as by default it is taken from + the first paragraph in the roxygen block. + template: ' ${1:title}' + vignette: rd + recommend: true + +- name: usage + description: > + Override the default usage generated by roxygen2. Only needed when + roxygen2 fails to correctly derive the usage of your function. + template: ' ${1:fun}(${2:arg1, arg2 = default, ...})' + vignette: rd + recommend: true + +- name: useDynLib + description: > + Import compiled code from another package. + template: ' ${1:package}' + vignette: namespace + recommend: true diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/DESCRIPTION new file mode 100644 index 00000000..783862a7 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/DESCRIPTION @@ -0,0 +1,35 @@ +Package: rprojroot +Title: Finding Files in Project Subdirectories +Version: 2.0.4 +Authors@R: + person(given = "Kirill", + family = "M\u00fcller", + role = c("aut", "cre"), + email = "kirill@cynkra.com", + comment = c(ORCID = "0000-0002-1416-3412")) +Description: Robust, reliable and flexible paths to files below + a project root. The 'root' of a project is defined as a directory that + matches a certain criterion, e.g., it contains a certain regular file. +License: MIT + file LICENSE +URL: https://rprojroot.r-lib.org/, https://github.com/r-lib/rprojroot +BugReports: https://github.com/r-lib/rprojroot/issues +Depends: R (>= 3.0.0) +Suggests: covr, knitr, lifecycle, mockr, rlang, rmarkdown, testthat (>= + 3.0.0), withr +VignetteBuilder: knitr +Config/testthat/edition: 3 +Encoding: UTF-8 +RoxygenNote: 7.2.3 +NeedsCompilation: no +Packaged: 2023-11-05 06:47:23 UTC; kirill +Author: Kirill Müller [aut, cre] () +Maintainer: Kirill Müller +Repository: CRAN +Date/Publication: 2023-11-05 10:20:02 UTC +Built: R 4.4.1; ; 2025-01-25 18:39:46 UTC; unix +RemoteType: standard +RemotePkgRef: rprojroot +RemoteRef: rprojroot +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 2.0.4 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/INDEX new file mode 100644 index 00000000..642ecc52 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/INDEX @@ -0,0 +1,7 @@ +criteria Prespecified criteria +find_root Find the root of a directory hierarchy +find_root_file File paths relative to the root of a directory + hierarchy +root_criterion Is a directory the project root? +rprojroot-package rprojroot: Finding Files in Project + Subdirectories diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/LICENSE new file mode 100644 index 00000000..797bc14a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2020 +COPYRIGHT HOLDER: rprojroot authors diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/Meta/Rd.rds new file mode 100644 index 00000000..535abed2 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/Meta/hsearch.rds new file mode 100644 index 00000000..233843f5 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/Meta/links.rds new file mode 100644 index 00000000..8c2c23da Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/Meta/nsInfo.rds new file mode 100644 index 00000000..983a954a Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/Meta/package.rds new file mode 100644 index 00000000..4d3190ab Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/Meta/vignette.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/Meta/vignette.rds new file mode 100644 index 00000000..50b326f7 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/Meta/vignette.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/NAMESPACE new file mode 100644 index 00000000..0e096ecc --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/NAMESPACE @@ -0,0 +1,46 @@ +# Generated by roxygen2: do not edit by hand + +S3method("|",root_criterion) +S3method(as_root_criterion,character) +S3method(as_root_criterion,default) +S3method(as_root_criterion,root_criterion) +S3method(format,root_criterion) +S3method(print,root_criterion) +S3method(str,root_criteria) +export(as.root_criterion) +export(as_root_criterion) +export(criteria) +export(find_package_root_file) +export(find_remake_root_file) +export(find_root) +export(find_root_file) +export(find_rstudio_root_file) +export(find_testthat_root_file) +export(from_wd) +export(get_root_desc) +export(has_basename) +export(has_dir) +export(has_file) +export(has_file_pattern) +export(is.root_criterion) +export(is_drake_project) +export(is_git_root) +export(is_pkgdown_project) +export(is_projectile_project) +export(is_quarto_project) +export(is_r_package) +export(is_remake_project) +export(is_renv_project) +export(is_root_criterion) +export(is_rstudio_project) +export(is_svn_root) +export(is_testthat) +export(is_vcs_root) +export(root_criterion) +export(thisfile) +export(thisfile_knit) +export(thisfile_r) +export(thisfile_rscript) +export(thisfile_source) +importFrom(utils,str) +importFrom(utils,tail) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/NEWS.md new file mode 100644 index 00000000..4e06e1f0 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/NEWS.md @@ -0,0 +1,139 @@ + + +# rprojroot 2.0.4 (2023-11-05) + +## Features + +- Add `is_renv_project` criterion looking for an `renv.lock` file (@gadenbuie, #86). +- Add `is_quarto_project` criterion looking for a Quarto project (@olivroy, #91, #92). + +## Chore + +- Update maintainer e-mail address. + +## Testing + +- Wrap `::` to skip if not installed in tests (#94). + + +# rprojroot 2.0.3 (2022-03-25) + +- Add `is_pkgdown_project` root criterion looking for a `_pkgdown.yml`, `_pkgdown.yaml`, `pkgdown/_pkgdown.yml` and/or `inst/_pkgdown.yml` file (#79, @salim-b). +- Avoid `LazyData` in `DESCRIPTION`. + + +# rprojroot 2.0.2 (2020-11-15) + +## Features + +- In `find_root_file()`, if the first path component is already an absolute path, the path is returned unchanged without referring to the root. This allows using both root-relative and absolute paths in `here::here()`. Mixing root-relative and absolute paths in the same call returns an error (#59). +- `find_root_file()` propagates `NA` values in path components. Using tidyverse recycling rules for path components of length different from one (#66). +- `has_file()` and `has_file_pattern()` gain `fixed` argument (#75). +- New `is_drake_project` criterion (#34). +- Add `subdir` argument to `make_fix_file()` (#33, @BarkleyBG). +- Update documentation for version control criteria (#35, @uribo). + +## Breaking changes + +- `has_file()` and `has_dir()` now throw an error if the `filepath` argument is an absolute path (#74). +- `has_basename()` replaces `has_dirname()` to avoid confusion (#63). +- `as_root_criterion()` and `is_root_criterion()` replace `as.` and `is.`, respectively. The latter are soft-deprecated. +- `thisfile()` and related functions are soft-deprecated, now available in the whereami package (#43). + +## Bug fixes + +- The `is_dirname()` criterion no longer considers sibling directories (#44). + +## Internal + +- Use testthat 3e (#70). +- The backports package is no longer imported (#68). +- Re-license as MIT (#50). +- Move checks to GitHub Actions (#52). +- Availability of suggested packages knitr and rmarkdown, and pandoc, is now checked before running the corresponding tests. + + +# rprojroot 1.3-2 (2017-12-22) + +- Availability of suggested packages knitr and rmarkdown, and pandoc, is now checked before running the corresponding tests. + + +# rprojroot 1.3-1 (2017-12-18) + +- Adapt to testthat 2.0.0. +- New `thisfile()`, moved from kimisc (#8). +- Add more examples to vignette (#26, @BarkleyBG). +- Detect `.git` directories created with `git clone --separate-git-dir=...` (#24, @karldw). + + +# rprojroot 1.2 (2017-01-15) + +- New root criteria + - `is_projectile_project` recognize projectile projects (#21). + - `has_dir()` constructs root criteria that check for existence of a directory. + - `is_git_root`, `is_svn_root` and `is_vcs_root` look for a version control system root (#19). + +- New function + - `get_root_desc()` returns the description of the criterion that applies to a given root, useful for composite criteria created with `|`. + +- Minor enhancements + - Improve formatting of alternative criteria (#18). + - If root cannot be found, the start path is shown in the error message. + +- Internal + - The `$testfun` member of the `rprojroot` S3 class is now a list of functions instead of a function. + + +# rprojroot 1.1 (2016-10-29) + +- Compatibility + - Compatible with R >= 3.0.0 with the help of the `backports` package. + +- New root criteria + - `is_remake_project` and `find_remake_root_file()` look for [remake](https://github.com/richfitz/remake) project (#17). + - `is_testthat` and `find_testthat_root_file()` that looks for `tests/testthat` root (#14). + - `from_wd`, useful for creating accessors to a known path (#11). + +- Minor enhancement + - Criteria can be combined with the `|` operator (#15). + +- Documentation + - Add package documentation with a few examples (#13). + - Clarify difference between `find_file()` and `make_fix_file()` in vignette (#9). + - Remove unexported functions from documentation and examples (#10). + - Use `pkgdown` to create website. + +- Testing + - Use Travis instead of wercker. Travis tests three R versions, and OS X. + - Improve AppVeyor testing. + + +# rprojroot 1.0-2 (2016-03-28) + +- Fix test that fails on Windows only on CRAN. + + +# rprojroot 1.0 (2016-03-26) + +Initial CRAN release. + +- S3 class `root_criterion`: + - Member functions: `find_file()` and `make_fix_file()` + - `root_criterion()` + - `as.root_criterion()` + - `is.root_criterion()` + - `has_file()` + - `has_file_pattern()` + - Built-in criteria: + - `is_r_package` + - `is_rstudio_project` + +- Getting started: + - `find_package_root_file()` + - `find_rstudio_root_file()` + +- Use a custom notion of a project root: + - `find_root()` + - `find_root_file()` + +- Vignette diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/R/rprojroot b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/R/rprojroot new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/R/rprojroot @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/R/rprojroot.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/R/rprojroot.rdb new file mode 100644 index 00000000..ae1ecd5d Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/R/rprojroot.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/R/rprojroot.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/R/rprojroot.rdx new file mode 100644 index 00000000..5faa659c Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/R/rprojroot.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/WORDLIST b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/WORDLIST new file mode 100644 index 00000000..746a1cf1 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/WORDLIST @@ -0,0 +1,19 @@ +Acknowledgement +AppVeyor +Codecov +Hadley +Lifecycle +ORCID +RStudio +Wickham +backports +kimisc +knitr +pandoc +rcc +readxl +rmarkdown +testthat +tidyverse +wercker +whereami diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/doc/index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/doc/index.html new file mode 100644 index 00000000..7b49bf80 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/doc/index.html @@ -0,0 +1,29 @@ + + +R: Vignettes and other documentation + + + +
+

Vignettes and other documentation + +

+
+
+[Top] +
+

Vignettes from package 'rprojroot'

+ +++++++ + + + + +
rprojroot::rprojrootFinding files in project subdirectoriesHTMLsourceR code
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/doc/rprojroot.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/doc/rprojroot.R new file mode 100644 index 00000000..31145b27 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/doc/rprojroot.R @@ -0,0 +1,168 @@ +## ----------------------------------------------------------------------------- +basename(getwd()) + +## ----------------------------------------------------------------------------- +rprojroot::is_r_package + +## ----------------------------------------------------------------------------- +rprojroot::is_rstudio_project + +## ----------------------------------------------------------------------------- +rprojroot::has_file(".git/index") + +## ----------------------------------------------------------------------------- +root <- rprojroot::is_r_package + +## ----------------------------------------------------------------------------- +basename(getwd()) +readLines(root$find_file("DESCRIPTION"), 3) + +## ----------------------------------------------------------------------------- +path <- root$find_file() +readLines(root$find_file(path, "DESCRIPTION"), 3) + +## ----------------------------------------------------------------------------- +root_file <- root$make_fix_file() + +## ----------------------------------------------------------------------------- +withr::with_dir( + "../..", + readLines(root_file("DESCRIPTION"), 3) +) + +## ----------------------------------------------------------------------------- +library(rprojroot) + +# List all files and directories below the root +dir(find_root(has_file("DESCRIPTION"))) + + +## ----eval = FALSE------------------------------------------------------------- +# rel_path_from_vignettes <- "../R/rrmake.R" +# rel_path_from_vignettes <- file.path("..", "R", "rrmake.R") ##identical +# + +## ----eval = FALSE------------------------------------------------------------- +# rel_path_from_root <- "R/rrmake.R" +# rel_path_from_root <- file.path("R", "rrmake.R") ##identical + +## ----------------------------------------------------------------------------- +has_file("DESCRIPTION") + +## ----------------------------------------------------------------------------- +# Specify a path/to/file relative to the root +rel_path_from_root <- find_root_file("R", "rrmake.R", criterion = has_file("DESCRIPTION")) + +## ----eval = FALSE------------------------------------------------------------- +# rel_path_from_testthat <- "../../R/rrmake.R" + +## ----------------------------------------------------------------------------- +# Specify a path/to/file relative to the root +rel_path_from_root <- find_root_file("R", "rrmake.R", criterion = has_file("DESCRIPTION")) + +## ----------------------------------------------------------------------------- +# Specify a path/to/file relative to the root +rel_path_from_root <- find_root_file("R", "rrmake.R", criterion = has_file("DESCRIPTION")) + +# Find a file relative to the root +file.exists(rel_path_from_root) + +## ----------------------------------------------------------------------------- +has_file("DESCRIPTION") + +## ----------------------------------------------------------------------------- +as_root_criterion("DESCRIPTION") + +## ----------------------------------------------------------------------------- +criteria + +## ----------------------------------------------------------------------------- +has_license <- has_file("LICENSE") +has_license + +is_projecttemplate_project <- has_file("config/global.dcf", "^version: ") +is_projecttemplate_project + +## ----------------------------------------------------------------------------- +is_r_package | is_rstudio_project + +## ----------------------------------------------------------------------------- +# Print first lines of the source for this document +head(readLines(find_package_root_file("vignettes", "rprojroot.Rmd"))) + +## ----------------------------------------------------------------------------- +P <- find_package_root_file + +# Use a shorter alias +file.exists(P("vignettes", "rprojroot.Rmd")) + +## ----error = TRUE------------------------------------------------------------- +# Use the has_license criterion to find the root +R <- has_license$find_file +R + +# Our package does not have a LICENSE file, trying to find the root results in an error +R() + +## ----eval = (Sys.getenv("IN_PKGDOWN") != "")---------------------------------- +# # Define a function that computes file paths below the current root +# F <- is_r_package$make_fix_file() +# F +# +# # Show contents of the NAMESPACE file in our project +# readLines(F("NAMESPACE")) + +## ----eval = (Sys.getenv("IN_PKGDOWN") != "")---------------------------------- +# # Print the size of the namespace file, working directory outside the project +# withr::with_dir( +# "../..", +# file.size(F("NAMESPACE")) +# ) + +## ----------------------------------------------------------------------------- +is_testthat + +## ----------------------------------------------------------------------------- +dir(is_testthat$find_file("hierarchy", path = is_r_package$find_file())) + +## ----eval = FALSE------------------------------------------------------------- +# my_fun_run <- do.call(my_fun, my_args) +# +# testthat::test_that( +# "my_fun() returns expected output", +# testthat::expect_equal( +# my_fun_run, +# expected_output +# ) +# ) + +## ----eval = FALSE------------------------------------------------------------- +# ## saved to tests/testthat/helper.R +# get_my_path <- function(file_name) { +# rprojroot::find_testthat_root_file( +# "testing_data", filename +# ) +# } + +## ----eval = FALSE------------------------------------------------------------- +# ## Find the correct path with your custom rprojroot helper function +# path_to_my_args_file <- get_my_path("my_args.Rdata") +# +# ## Load the input arguments +# load(file = path_to_my_args_file) +# +# ## Run the function with those arguments +# my_fun_run <- do.call(my_fun,my_args) +# +# ## Load the historical expectation with the helper +# load(file = get_my_path("expected_output.Rdata")) +# +# ## Pass all tests and achieve nirvana +# testthat::test_that( +# "my_fun() returns expected output", +# testthat::expect_equal( +# my_fun_run, +# expected_output +# ) +# ) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/doc/rprojroot.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/doc/rprojroot.Rmd new file mode 100644 index 00000000..1ba06f2b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/doc/rprojroot.Rmd @@ -0,0 +1,431 @@ +--- +title: "Finding files in project subdirectories" +author: "Kirill Müller" +date: "`r Sys.Date()`" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Finding files in project subdirectories} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +The *rprojroot* package solves a seemingly trivial but annoying problem +that occurs sooner or later +in any largish project: +How to find files in subdirectories? +Ideally, file paths are relative to the *project root*. + +Unfortunately, we cannot always be sure about the current working directory: +For instance, in RStudio it's sometimes: + +- the project root (when running R scripts), +- a subdirectory (when building vignettes), +- again the project root (when executing chunks of a vignette). + +```{r} +basename(getwd()) +``` + +In some cases, it's even outside the project root. + +This vignette starts with a very brief summary that helps you get started, +followed by a longer description of the features. + +## TL;DR + +What is your project: An R package? + +```{r} +rprojroot::is_r_package +``` + +Or an RStudio project? + +```{r} +rprojroot::is_rstudio_project +``` + +Or something else? + +```{r} +rprojroot::has_file(".git/index") +``` + +For now, we assume it's an R package: + +```{r} +root <- rprojroot::is_r_package +``` + +The `root` object contains a function that helps locating files below the root +of your package, regardless of your current working directory. +If you are sure that your working directory is somewhere below your project's root, +use the `root$find_file()` function. +In this example here, we're starting in the `vignettes` subdirectory and find the original `DESCRIPTION` file: + +```{r} +basename(getwd()) +readLines(root$find_file("DESCRIPTION"), 3) +``` + +There is one exception: if the first component passed to `find_file()` is already an absolute path. +This allows safely applying this function to paths that may be absolute or relative: + +```{r} +path <- root$find_file() +readLines(root$find_file(path, "DESCRIPTION"), 3) +``` + +You can also +construct an accessor to your root using the `root$make_fix_file()` function: + +```{r} +root_file <- root$make_fix_file() +``` + + +Note that `root_file()` is a *function* that works just like `$find_file()` but +will find the files even if the current working directory is outside your project: + +```{r} +withr::with_dir( + "../..", + readLines(root_file("DESCRIPTION"), 3) +) +``` + +If you know the absolute path of some directory below your project, +but cannot be sure of your current working directory, +pass that absolute path to `root$make_fix_file()`: + +```r +root_file <- root$make_fix_file("C:\\Users\\User Name\\...") +``` + +As a last resort, you can get the path of standalone R scripts or vignettes +using the `thisfile()` function: + +```r +root_file <- root$make_fix_file(dirname(thisfile())) +``` + +The remainder of this vignette describes implementation details and advanced features. + + +## Project root + +We assume a self-contained project +where all files and directories are located below a common *root* directory. +Also, there should be a way to unambiguously identify this root directory. +(Often, the root contains a regular file whose name matches a given pattern, +and/or whose contents match another pattern.) +In this case, the following method reliably finds our project root: + +- Start the search in any subdirectory of our project +- Proceed up the directory hierarchy until the root directory has been identified + +The Git version control system (and probably many other tools) use a similar +approach: A Git command can be executed from within any subdirectory of a +repository. + + +### A simple example + +The `find_root()` function implements the core functionality. +It returns the path to the first directory that matches the filtering criteria, +or throws an error if there is no such directory. +Filtering criteria are constructed in a generic fashion using the +`root_criterion()` function, +the `has_file()` function constructs a criterion that checks for the presence +of a file with a specific name and specific contents. + +```{r} +library(rprojroot) + +# List all files and directories below the root +dir(find_root(has_file("DESCRIPTION"))) + +``` + +#### Relative paths to a stable root + +Here we illustrate the power of *rprojroot* by demonstrating how to access the same file from two different working directories. Let your project be a package called `pkgname` and consider the desired file `rrmake.R` at `pkgname/R/rrmake.R`. First, we show how to access from the `vignettes` directory, and then from the `tests/testthat` directory. + + +##### Example A: From `vignettes` + +When your working directory is `pkgname/vignettes`, you can access the `rrmake.R` file by: + +1. Supplying a pathname relative to your working directory. Here's two ways to do that: + +```{r, eval = FALSE} +rel_path_from_vignettes <- "../R/rrmake.R" +rel_path_from_vignettes <- file.path("..", "R", "rrmake.R") ##identical + +``` + +2. Supplying a pathname to the file relative from the root of the package, e.g., + +```{r, eval = FALSE} +rel_path_from_root <- "R/rrmake.R" +rel_path_from_root <- file.path("R", "rrmake.R") ##identical +``` + +This second method requires finding the root of the package, which can be done with the `has_file()` function: + +```{r} +has_file("DESCRIPTION") +``` + +So, using *rprojroot* you can specify the path relative from root in the following manner: + +```{r} +# Specify a path/to/file relative to the root +rel_path_from_root <- find_root_file("R", "rrmake.R", criterion = has_file("DESCRIPTION")) +``` + + +##### Example B: From `tests/testthat` + +When your working directory is `pkgname/tests/testthat`, you can access the `rrmake.R` file by: + +1. Supplying a pathname relative to your working directory. + +```{r, eval = FALSE} +rel_path_from_testthat <- "../../R/rrmake.R" +``` + +Note that this is different than in the previous example! However, the second method is the same... + +2. Supplying a pathname to the file relative from the root of the package. With *rprojroot*, this is the exact same as in the previous example. + + +```{r} +# Specify a path/to/file relative to the root +rel_path_from_root <- find_root_file("R", "rrmake.R", criterion = has_file("DESCRIPTION")) +``` + +##### Summary of Examples A and B + +Since Examples A and B used different working directories, `rel_path_from_vignettes` and `rel_path_from_testthat` were different. This is an issue when trying to re-use the same code. This issue is solved by using *rprojroot*: the function `find_root_file()` finds a file relative from the root, where the root is determined from checking the criterion with `has_file()`. + + +Note that the follow code produces identical results when building the vignette *and* when sourcing the chunk in RStudio, provided that the current working directory is the project root or anywhere below. So, we can check to make sure that *rprojroot* has successfully determined the correct path: + +```{r} +# Specify a path/to/file relative to the root +rel_path_from_root <- find_root_file("R", "rrmake.R", criterion = has_file("DESCRIPTION")) + +# Find a file relative to the root +file.exists(rel_path_from_root) +``` + + +### Criteria + +The `has_file()` function (and the more general `root_criterion()`) +both return an S3 object of class `root_criterion`: + +```{r} +has_file("DESCRIPTION") +``` + +In addition, character values are coerced to `has_file` criteria by default, this coercion is applied automatically by `find_root()`. +(This feature is used by the introductory example.) + +```{r} +as_root_criterion("DESCRIPTION") +``` + +The return value of these functions can be stored and reused; +in fact, the package provides `r length(criteria)` such criteria: + +```{r} +criteria +``` + +Defining new criteria is easy: + +```{r} +has_license <- has_file("LICENSE") +has_license + +is_projecttemplate_project <- has_file("config/global.dcf", "^version: ") +is_projecttemplate_project +``` + +You can also combine criteria via the `|` operator: + +```{r} +is_r_package | is_rstudio_project +``` + + + +### Shortcuts + +To avoid specifying the search criteria for the project root every time, +shortcut functions can be created. +The `find_package_root_file()` is a shortcut for +`find_root_file(..., criterion = is_r_package)`: + +```{r} +# Print first lines of the source for this document +head(readLines(find_package_root_file("vignettes", "rprojroot.Rmd"))) +``` + +To save typing effort, define a shorter alias: + +```{r} +P <- find_package_root_file + +# Use a shorter alias +file.exists(P("vignettes", "rprojroot.Rmd")) +``` + +Each criterion actually contains a function that allows finding a file below the root specified by this criterion. +As our project does not have a file named `LICENSE`, querying the root results in an error: + +```{r error = TRUE} +# Use the has_license criterion to find the root +R <- has_license$find_file +R + +# Our package does not have a LICENSE file, trying to find the root results in an error +R() +``` + + +### Fixed root + +We can also create a function +that computes a path relative to the root *at creation time*. + +```{r eval = (Sys.getenv("IN_PKGDOWN") != "")} +# Define a function that computes file paths below the current root +F <- is_r_package$make_fix_file() +F + +# Show contents of the NAMESPACE file in our project +readLines(F("NAMESPACE")) +``` + +This is a more robust alternative to `$find_file()`, because it *fixes* the project +directory when `$make_fix_file()` is called, instead of searching for it every +time. (For that reason it is also slightly faster, but I doubt this matters +in practice.) + +This function can be used even if we later change the working directory to somewhere outside the project: + +```{r eval = (Sys.getenv("IN_PKGDOWN") != "")} +# Print the size of the namespace file, working directory outside the project +withr::with_dir( + "../..", + file.size(F("NAMESPACE")) +) +``` + +The `make_fix_file()` member function also accepts an optional `path` argument, +in case you know your project's root but the current working directory is somewhere outside. +The path to the current script or `knitr` document can be obtained using the `thisfile()` function, but it's much easier and much more robust to just run your scripts with the working directory somewhere below your project root. + + +## `testthat` files + +Tests run with [`testthat`](https://cran.r-project.org/package=testthat) +commonly use files that live below the `tests/testthat` directory. +Ideally, this should work in the following situation: + +- During package development (working directory: package root) +- When testing with `devtools::test()` (working directory: `tests/testthat`) +- When running `R CMD check` (working directory: a renamed recursive copy of `tests`) + +The `is_testthat` criterion allows robust lookup of test files. + +```{r} +is_testthat +``` + +The example code below lists all files in the +[hierarchy](https://github.com/r-lib/rprojroot/tree/main/tests/testthat/hierarchy) +test directory. +It uses two project root lookups in total, +so that it also works when rendering the vignette (*sigh*): + +```{r} +dir(is_testthat$find_file("hierarchy", path = is_r_package$find_file())) +``` + +### Another example: custom testing utilities + +The hassle of using saved data files for testing is made even easier by using *rprojroot* in a utility function. For example, suppose you have a testing file at `tests/testthat/test_my_fun.R` which tests the `my_fun()` function: + +```{r, eval = FALSE} +my_fun_run <- do.call(my_fun, my_args) + +testthat::test_that( + "my_fun() returns expected output", + testthat::expect_equal( + my_fun_run, + expected_output + ) +) +``` + +There are two pieces of information that you'll need every time `test_my_fun.R` is run: `my_args` and `expected_output`. Typically, these objects are saved to `.Rdata` files and saved to the same subdirectory. For example, you could save them to `my_args.Rdata` and `expected_output.Rdata` under the `tests/testthat/testing_data` subdirectory. And, to find them easily in any contexts, you can use *rprojroot*! + +Since all of the data files live in the same subdirectory, you can create a utility function `get_my_path()` that will always look in that directory for these types of files. And, since the *testthat* package will look for and source the `tests/testthat/helper.R` file before running any tests, you can place a `get_my_path()` in this file and use it throughout your tests: + +```{r, eval = FALSE} +## saved to tests/testthat/helper.R +get_my_path <- function(file_name) { + rprojroot::find_testthat_root_file( + "testing_data", filename + ) +} +``` + +Now you can ask `get_my_path()` to find your important data files by using the function within your test scripts! + +```{r, eval = FALSE} +## Find the correct path with your custom rprojroot helper function +path_to_my_args_file <- get_my_path("my_args.Rdata") + +## Load the input arguments +load(file = path_to_my_args_file) + +## Run the function with those arguments +my_fun_run <- do.call(my_fun,my_args) + +## Load the historical expectation with the helper +load(file = get_my_path("expected_output.Rdata")) + +## Pass all tests and achieve nirvana +testthat::test_that( + "my_fun() returns expected output", + testthat::expect_equal( + my_fun_run, + expected_output + ) +) +``` + +For an example in the wild, see the [`test_sheet()` function](https://github.com/tidyverse/readxl/blob/0d9ad4f570f6580ff716e0e9ba5048447048e9f0/tests/testthat/helper.R#L1-L3) in the *readxl* package. + +## Summary + +The *rprojroot* package allows easy access to files below a project root +if the project root can be identified easily, e.g. if it is the only directory +in the whole hierarchy that contains a specific file. +This is a robust solution for finding files in largish projects +with a subdirectory hierarchy if the current working directory cannot be assumed +fixed. +(However, at least initially, the current working directory must be +somewhere below the project root.) + + +## Acknowledgement + +This package was inspired by the gist +["Stop the working directory insanity"](https://gist.github.com/jennybc/362f52446fe1ebc4c49f) +by Jennifer Bryan, and by the way Git knows where its files are. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/doc/rprojroot.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/doc/rprojroot.html new file mode 100644 index 00000000..dab2bf08 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/doc/rprojroot.html @@ -0,0 +1,789 @@ + + + + + + + + + + + + + + + + +Finding files in project subdirectories + + + + + + + + + + + + + + + + + + + + + + + + + + +

Finding files in project +subdirectories

+

Kirill Müller

+

2023-11-05

+ + + +

The rprojroot package solves a seemingly trivial but +annoying problem that occurs sooner or later in any largish project: How +to find files in subdirectories? Ideally, file paths are relative to the +project root.

+

Unfortunately, we cannot always be sure about the current working +directory: For instance, in RStudio it’s sometimes:

+
    +
  • the project root (when running R scripts),
  • +
  • a subdirectory (when building vignettes),
  • +
  • again the project root (when executing chunks of a vignette).
  • +
+
basename(getwd())
+
## [1] "vignettes"
+

In some cases, it’s even outside the project root.

+

This vignette starts with a very brief summary that helps you get +started, followed by a longer description of the features.

+
+

TL;DR

+

What is your project: An R package?

+
rprojroot::is_r_package
+
## Root criterion: contains a file "DESCRIPTION" with contents matching "^Package: "
+

Or an RStudio project?

+
rprojroot::is_rstudio_project
+
## Root criterion: contains a file matching "[.]Rproj$" with contents matching "^Version: " in the first line
+

Or something else?

+
rprojroot::has_file(".git/index")
+
## Root criterion: contains a file ".git/index"
+

For now, we assume it’s an R package:

+
root <- rprojroot::is_r_package
+

The root object contains a function that helps locating +files below the root of your package, regardless of your current working +directory. If you are sure that your working directory is somewhere +below your project’s root, use the root$find_file() +function. In this example here, we’re starting in the +vignettes subdirectory and find the original +DESCRIPTION file:

+
basename(getwd())
+
## [1] "vignettes"
+
readLines(root$find_file("DESCRIPTION"), 3)
+
## [1] "Package: rprojroot"                            
+## [2] "Title: Finding Files in Project Subdirectories"
+## [3] "Version: 2.0.4"
+

There is one exception: if the first component passed to +find_file() is already an absolute path. This allows safely +applying this function to paths that may be absolute or relative:

+
path <- root$find_file()
+readLines(root$find_file(path, "DESCRIPTION"), 3)
+
## [1] "Package: rprojroot"                            
+## [2] "Title: Finding Files in Project Subdirectories"
+## [3] "Version: 2.0.4"
+

You can also construct an accessor to your root using the +root$make_fix_file() function:

+
root_file <- root$make_fix_file()
+

Note that root_file() is a function that works +just like $find_file() but will find the files even if the +current working directory is outside your project:

+
withr::with_dir(
+  "../..",
+  readLines(root_file("DESCRIPTION"), 3)
+)
+
## [1] "Package: rprojroot"                            
+## [2] "Title: Finding Files in Project Subdirectories"
+## [3] "Version: 2.0.4"
+

If you know the absolute path of some directory below your project, +but cannot be sure of your current working directory, pass that absolute +path to root$make_fix_file():

+
root_file <- root$make_fix_file("C:\\Users\\User Name\\...")
+

As a last resort, you can get the path of standalone R scripts or +vignettes using the thisfile() function:

+
root_file <- root$make_fix_file(dirname(thisfile()))
+

The remainder of this vignette describes implementation details and +advanced features.

+
+
+

Project root

+

We assume a self-contained project where all files and directories +are located below a common root directory. Also, there should +be a way to unambiguously identify this root directory. (Often, the root +contains a regular file whose name matches a given pattern, and/or whose +contents match another pattern.) In this case, the following method +reliably finds our project root:

+
    +
  • Start the search in any subdirectory of our project
  • +
  • Proceed up the directory hierarchy until the root directory has been +identified
  • +
+

The Git version control system (and probably many other tools) use a +similar approach: A Git command can be executed from within any +subdirectory of a repository.

+
+

A simple example

+

The find_root() function implements the core +functionality. It returns the path to the first directory that matches +the filtering criteria, or throws an error if there is no such +directory. Filtering criteria are constructed in a generic fashion using +the root_criterion() function, the has_file() +function constructs a criterion that checks for the presence of a file +with a specific name and specific contents.

+
library(rprojroot)
+
+# List all files and directories below the root
+dir(find_root(has_file("DESCRIPTION")))
+
##  [1] "DESCRIPTION"      "LICENSE"          "LICENSE.md"       "NAMESPACE"       
+##  [5] "NEWS.md"          "R"                "README.Rmd"       "README.md"       
+##  [9] "TODO.md"          "_pkgdown.yml"     "codecov.yml"      "cran-comments.md"
+## [13] "inst"             "man"              "revdep"           "rprojroot.Rcheck"
+## [17] "rprojroot.Rproj"  "tests"            "vignettes"
+
+

Relative paths to a stable root

+

Here we illustrate the power of rprojroot by demonstrating +how to access the same file from two different working directories. Let +your project be a package called pkgname and consider the +desired file rrmake.R at pkgname/R/rrmake.R. +First, we show how to access from the vignettes directory, +and then from the tests/testthat directory.

+
+
Example A: From vignettes
+

When your working directory is pkgname/vignettes, you +can access the rrmake.R file by:

+
    +
  1. Supplying a pathname relative to your working directory. Here’s two +ways to do that:
  2. +
+
rel_path_from_vignettes <- "../R/rrmake.R"
+rel_path_from_vignettes <- file.path("..", "R", "rrmake.R") ##identical
+
    +
  1. Supplying a pathname to the file relative from the root of the +package, e.g.,
  2. +
+
rel_path_from_root <- "R/rrmake.R"
+rel_path_from_root <- file.path("R", "rrmake.R") ##identical
+

This second method requires finding the root of the package, which +can be done with the has_file() function:

+
has_file("DESCRIPTION")
+
## Root criterion: contains a file "DESCRIPTION"
+

So, using rprojroot you can specify the path relative from +root in the following manner:

+
# Specify a path/to/file relative to the root
+rel_path_from_root <- find_root_file("R", "rrmake.R", criterion = has_file("DESCRIPTION"))
+
+
+
Example B: From tests/testthat
+

When your working directory is pkgname/tests/testthat, +you can access the rrmake.R file by:

+
    +
  1. Supplying a pathname relative to your working directory.
  2. +
+
rel_path_from_testthat <- "../../R/rrmake.R"
+

Note that this is different than in the previous example! However, +the second method is the same…

+
    +
  1. Supplying a pathname to the file relative from the root of the +package. With rprojroot, this is the exact same as in the +previous example.
  2. +
+
# Specify a path/to/file relative to the root
+rel_path_from_root <- find_root_file("R", "rrmake.R", criterion = has_file("DESCRIPTION"))
+
+
+
Summary of Examples A and B
+

Since Examples A and B used different working directories, +rel_path_from_vignettes and +rel_path_from_testthat were different. This is an issue +when trying to re-use the same code. This issue is solved by using +rprojroot: the function find_root_file() finds a +file relative from the root, where the root is determined from checking +the criterion with has_file().

+

Note that the follow code produces identical results when building +the vignette and when sourcing the chunk in RStudio, provided +that the current working directory is the project root or anywhere +below. So, we can check to make sure that rprojroot has +successfully determined the correct path:

+
# Specify a path/to/file relative to the root
+rel_path_from_root <- find_root_file("R", "rrmake.R", criterion = has_file("DESCRIPTION"))
+
+# Find a file relative to the root
+file.exists(rel_path_from_root)
+
## [1] FALSE
+
+
+
+
+

Criteria

+

The has_file() function (and the more general +root_criterion()) both return an S3 object of class +root_criterion:

+
has_file("DESCRIPTION")
+
## Root criterion: contains a file "DESCRIPTION"
+

In addition, character values are coerced to has_file +criteria by default, this coercion is applied automatically by +find_root(). (This feature is used by the introductory +example.)

+
as_root_criterion("DESCRIPTION")
+
## Root criterion: contains a file "DESCRIPTION"
+

The return value of these functions can be stored and reused; in +fact, the package provides 12 such criteria:

+
criteria
+
## $is_rstudio_project
+## Root criterion: contains a file matching "[.]Rproj$" with contents matching "^Version: " in the first line
+## 
+## $is_r_package
+## Root criterion: contains a file "DESCRIPTION" with contents matching "^Package: "
+## 
+## $is_remake_project
+## Root criterion: contains a file "remake.yml"
+## 
+## $is_pkgdown_project
+## Root criterion: one of
+## - contains a file "_pkgdown.yml"
+## - contains a file "_pkgdown.yaml"
+## - contains a file "pkgdown/_pkgdown.yml"
+## - contains a file "inst/_pkgdown.yml"
+## 
+## $is_renv_project
+## Root criterion: contains a file "renv.lock" with contents matching ""Packages":\s*\{"
+## 
+## $is_projectile_project
+## Root criterion: contains a file ".projectile"
+## 
+## $is_quarto_project
+## Root criterion: contains a file "_quarto.yml"
+## 
+## $is_git_root
+## Root criterion: one of
+## - contains a directory ".git"
+## - contains a file ".git" with contents matching "^gitdir: "
+## 
+## $is_svn_root
+## Root criterion: contains a directory ".svn"
+## 
+## $is_vcs_root
+## Root criterion: one of
+## - contains a directory ".git"
+## - contains a file ".git" with contents matching "^gitdir: "
+## - contains a directory ".svn"
+## 
+## $is_testthat
+## Root criterion: directory name is "testthat" (also look in subdirectories: `tests/testthat`, `testthat`)
+## 
+## $from_wd
+## Root criterion: from current working directory
+## 
+## attr(,"class")
+## [1] "root_criteria"
+

Defining new criteria is easy:

+
has_license <- has_file("LICENSE")
+has_license
+
## Root criterion: contains a file "LICENSE"
+
is_projecttemplate_project <- has_file("config/global.dcf", "^version: ")
+is_projecttemplate_project
+
## Root criterion: contains a file "config/global.dcf" with contents matching "^version: "
+

You can also combine criteria via the | operator:

+
is_r_package | is_rstudio_project
+
## Root criterion: one of
+## - contains a file "DESCRIPTION" with contents matching "^Package: "
+## - contains a file matching "[.]Rproj$" with contents matching "^Version: " in the first line
+
+
+

Shortcuts

+

To avoid specifying the search criteria for the project root every +time, shortcut functions can be created. The +find_package_root_file() is a shortcut for +find_root_file(..., criterion = is_r_package):

+
# Print first lines of the source for this document
+head(readLines(find_package_root_file("vignettes", "rprojroot.Rmd")))
+
## [1] "---"                                               
+## [2] "title: \"Finding files in project subdirectories\""
+## [3] "author: \"Kirill Müller\""                         
+## [4] "date: \"`r Sys.Date()`\""                          
+## [5] "output: rmarkdown::html_vignette"                  
+## [6] "vignette: >"
+

To save typing effort, define a shorter alias:

+
P <- find_package_root_file
+
+# Use a shorter alias
+file.exists(P("vignettes", "rprojroot.Rmd"))
+
## [1] TRUE
+

Each criterion actually contains a function that allows finding a +file below the root specified by this criterion. As our project does not +have a file named LICENSE, querying the root results in an +error:

+
# Use the has_license criterion to find the root
+R <- has_license$find_file
+R
+
## function (..., path = ".") 
+## {
+##     find_root_file(..., criterion = criterion, path = path)
+## }
+## <environment: 0x135adac48>
+
# Our package does not have a LICENSE file, trying to find the root results in an error
+R()
+
## [1] "/private/var/folders/dj/yhk9rkx97wn_ykqtnmk18xvc0000gn/T/RtmpDwUyx7/Rbuildf23e3bfc9008/rprojroot"
+
+
+

Fixed root

+

We can also create a function that computes a path relative to the +root at creation time.

+
# Define a function that computes file paths below the current root
+F <- is_r_package$make_fix_file()
+F
+
+# Show contents of the NAMESPACE file in our project
+readLines(F("NAMESPACE"))
+

This is a more robust alternative to $find_file(), +because it fixes the project directory when +$make_fix_file() is called, instead of searching for it +every time. (For that reason it is also slightly faster, but I doubt +this matters in practice.)

+

This function can be used even if we later change the working +directory to somewhere outside the project:

+
# Print the size of the namespace file, working directory outside the project
+withr::with_dir(
+  "../..",
+  file.size(F("NAMESPACE"))
+)
+

The make_fix_file() member function also accepts an +optional path argument, in case you know your project’s +root but the current working directory is somewhere outside. The path to +the current script or knitr document can be obtained using +the thisfile() function, but it’s much easier and much more +robust to just run your scripts with the working directory somewhere +below your project root.

+
+
+
+

testthat files

+

Tests run with testthat +commonly use files that live below the tests/testthat +directory. Ideally, this should work in the following situation:

+
    +
  • During package development (working directory: package root)
  • +
  • When testing with devtools::test() (working directory: +tests/testthat)
  • +
  • When running R CMD check (working directory: a renamed +recursive copy of tests)
  • +
+

The is_testthat criterion allows robust lookup of test +files.

+
is_testthat
+
## Root criterion: directory name is "testthat" (also look in subdirectories: `tests/testthat`, `testthat`)
+

The example code below lists all files in the hierarchy +test directory. It uses two project root lookups in total, so that it +also works when rendering the vignette (sigh):

+
dir(is_testthat$find_file("hierarchy", path = is_r_package$find_file()))
+
## [1] "DESCRIPTION"     "a"               "b"               "c"              
+## [5] "hierarchy.Rproj"
+
+

Another example: custom testing utilities

+

The hassle of using saved data files for testing is made even easier +by using rprojroot in a utility function. For example, suppose +you have a testing file at tests/testthat/test_my_fun.R +which tests the my_fun() function:

+
my_fun_run <- do.call(my_fun, my_args)
+
+testthat::test_that(
+  "my_fun() returns expected output",
+  testthat::expect_equal(
+    my_fun_run,
+    expected_output
+  )
+)
+

There are two pieces of information that you’ll need every time +test_my_fun.R is run: my_args and +expected_output. Typically, these objects are saved to +.Rdata files and saved to the same subdirectory. For +example, you could save them to my_args.Rdata and +expected_output.Rdata under the +tests/testthat/testing_data subdirectory. And, to find them +easily in any contexts, you can use rprojroot!

+

Since all of the data files live in the same subdirectory, you can +create a utility function get_my_path() that will always +look in that directory for these types of files. And, since the +testthat package will look for and source the +tests/testthat/helper.R file before running any tests, you +can place a get_my_path() in this file and use it +throughout your tests:

+
## saved to tests/testthat/helper.R
+get_my_path <- function(file_name) {
+  rprojroot::find_testthat_root_file(
+    "testing_data", filename
+  )
+}
+

Now you can ask get_my_path() to find your important +data files by using the function within your test scripts!

+
## Find the correct path with your custom rprojroot helper function
+path_to_my_args_file <- get_my_path("my_args.Rdata")
+
+## Load the input arguments
+load(file = path_to_my_args_file)
+
+## Run the function with those arguments
+my_fun_run <- do.call(my_fun,my_args)
+
+## Load the historical expectation with the helper
+load(file = get_my_path("expected_output.Rdata"))
+
+## Pass all tests and achieve nirvana
+testthat::test_that(
+  "my_fun() returns expected output",
+  testthat::expect_equal(
+    my_fun_run,
+    expected_output
+  )
+)
+

For an example in the wild, see the test_sheet() +function in the readxl package.

+
+
+
+

Summary

+

The rprojroot package allows easy access to files below a +project root if the project root can be identified easily, e.g. if it is +the only directory in the whole hierarchy that contains a specific file. +This is a robust solution for finding files in largish projects with a +subdirectory hierarchy if the current working directory cannot be +assumed fixed. (However, at least initially, the current working +directory must be somewhere below the project root.)

+
+
+

Acknowledgement

+

This package was inspired by the gist “Stop the +working directory insanity” by Jennifer Bryan, and by the way Git +knows where its files are.

+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/AnIndex new file mode 100644 index 00000000..d7c9bbb3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/AnIndex @@ -0,0 +1,41 @@ +rprojroot-package rprojroot-package +as.root_criterion deprecated +as_root_criterion root_criterion +as_root_criterion.character root_criterion +as_root_criterion.root_criterion root_criterion +criteria criteria +deprecated deprecated +find_package_root_file find_root_file +find_remake_root_file find_root_file +find_root find_root +find_root_file find_root_file +find_rstudio_root_file find_root_file +find_testthat_root_file find_root_file +from_wd criteria +get_root_desc find_root +has_basename root_criterion +has_dir root_criterion +has_file root_criterion +has_file_pattern root_criterion +is.root_criterion deprecated +is_drake_project criteria +is_git_root criteria +is_pkgdown_project criteria +is_projectile_project criteria +is_quarto_project criteria +is_remake_project criteria +is_renv_project criteria +is_root_criterion root_criterion +is_rstudio_project criteria +is_r_package criteria +is_svn_root criteria +is_testthat criteria +is_vcs_root criteria +root_criterion root_criterion +rprojroot rprojroot-package +thisfile thisfile +thisfile_knit thisfile +thisfile_r thisfile +thisfile_rscript thisfile +thisfile_source thisfile +|.root_criterion root_criterion diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/aliases.rds new file mode 100644 index 00000000..7a7eafbf Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-archived.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-archived.svg new file mode 100644 index 00000000..48f72a6f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-archived.svg @@ -0,0 +1 @@ + lifecyclelifecyclearchivedarchived \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-defunct.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-defunct.svg new file mode 100644 index 00000000..01452e5f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-defunct.svg @@ -0,0 +1 @@ +lifecyclelifecycledefunctdefunct \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-deprecated.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-deprecated.svg new file mode 100644 index 00000000..4baaee01 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-deprecated.svg @@ -0,0 +1 @@ +lifecyclelifecycledeprecateddeprecated \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-experimental.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-experimental.svg new file mode 100644 index 00000000..d1d060e9 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-experimental.svg @@ -0,0 +1 @@ +lifecyclelifecycleexperimentalexperimental \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-maturing.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-maturing.svg new file mode 100644 index 00000000..df713101 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-maturing.svg @@ -0,0 +1 @@ +lifecyclelifecyclematuringmaturing \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-questioning.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-questioning.svg new file mode 100644 index 00000000..08ee0c90 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-questioning.svg @@ -0,0 +1 @@ +lifecyclelifecyclequestioningquestioning \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-soft-deprecated.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-soft-deprecated.svg new file mode 100644 index 00000000..9f014fd1 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-soft-deprecated.svg @@ -0,0 +1 @@ +lifecyclelifecyclesoft-deprecatedsoft-deprecated \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-stable.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-stable.svg new file mode 100644 index 00000000..e015dc81 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-stable.svg @@ -0,0 +1 @@ +lifecyclelifecyclestablestable \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-superseded.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-superseded.svg new file mode 100644 index 00000000..75f24f55 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/figures/lifecycle-superseded.svg @@ -0,0 +1 @@ + lifecyclelifecyclesupersededsuperseded \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/paths.rds new file mode 100644 index 00000000..57bccf05 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/rprojroot.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/rprojroot.rdb new file mode 100644 index 00000000..884dce82 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/rprojroot.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/rprojroot.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/rprojroot.rdx new file mode 100644 index 00000000..bacd10a5 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/help/rprojroot.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/html/00Index.html new file mode 100644 index 00000000..59cff3f9 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/html/00Index.html @@ -0,0 +1,93 @@ + + +R: Finding Files in Project Subdirectories + + + +
+

Finding Files in Project Subdirectories + +

+
+
+[Up] +[Top] +

Documentation for package ‘rprojroot’ version 2.0.4

+ + + +

Help Pages

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
rprojroot-packagerprojroot: Finding Files in Project Subdirectories
as_root_criterionIs a directory the project root?
as_root_criterion.characterIs a directory the project root?
as_root_criterion.root_criterionIs a directory the project root?
criteriaPrespecified criteria
find_package_root_fileFile paths relative to the root of a directory hierarchy
find_remake_root_fileFile paths relative to the root of a directory hierarchy
find_rootFind the root of a directory hierarchy
find_root_fileFile paths relative to the root of a directory hierarchy
find_rstudio_root_fileFile paths relative to the root of a directory hierarchy
find_testthat_root_fileFile paths relative to the root of a directory hierarchy
from_wdPrespecified criteria
get_root_descFind the root of a directory hierarchy
has_basenameIs a directory the project root?
has_dirIs a directory the project root?
has_fileIs a directory the project root?
has_file_patternIs a directory the project root?
is_drake_projectPrespecified criteria
is_git_rootPrespecified criteria
is_pkgdown_projectPrespecified criteria
is_projectile_projectPrespecified criteria
is_quarto_projectPrespecified criteria
is_remake_projectPrespecified criteria
is_renv_projectPrespecified criteria
is_root_criterionIs a directory the project root?
is_rstudio_projectPrespecified criteria
is_r_packagePrespecified criteria
is_svn_rootPrespecified criteria
is_testthatPrespecified criteria
is_vcs_rootPrespecified criteria
root_criterionIs a directory the project root?
rprojrootrprojroot: Finding Files in Project Subdirectories
|.root_criterionIs a directory the project root?
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rprojroot/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/DESCRIPTION new file mode 100644 index 00000000..806dc905 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/DESCRIPTION @@ -0,0 +1,37 @@ +Package: rstudioapi +Title: Safely Access the RStudio API +Description: Access the RStudio API (if available) and provide informative error + messages when it's not. +Version: 0.17.1 +Authors@R: c( + person("Kevin", "Ushey", role = c("aut", "cre"), email = "kevin@rstudio.com"), + person("JJ", "Allaire", role = c("aut"), email = "jj@posit.co"), + person("Hadley", "Wickham", role = c("aut"), email = "hadley@posit.co"), + person("Gary", "Ritchie", role = c("aut"), email = "gary@posit.co"), + person(family = "RStudio", role = "cph") + ) +Maintainer: Kevin Ushey +License: MIT + file LICENSE +URL: https://rstudio.github.io/rstudioapi/, + https://github.com/rstudio/rstudioapi +BugReports: https://github.com/rstudio/rstudioapi/issues +RoxygenNote: 7.3.2 +Suggests: testthat, knitr, rmarkdown, clipr, covr +VignetteBuilder: knitr +Encoding: UTF-8 +NeedsCompilation: no +Packaged: 2024-10-22 20:55:52 UTC; kevin +Author: Kevin Ushey [aut, cre], + JJ Allaire [aut], + Hadley Wickham [aut], + Gary Ritchie [aut], + RStudio [cph] +Repository: CRAN +Date/Publication: 2024-10-22 22:40:02 UTC +Built: R 4.4.1; ; 2025-02-01 04:46:24 UTC; unix +RemoteType: standard +RemotePkgRef: rstudioapi +RemoteRef: rstudioapi +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 0.17.1 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/INDEX new file mode 100644 index 00000000..f392d829 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/INDEX @@ -0,0 +1,104 @@ +addTheme Add a Custom Editor Theme +applyTheme Apply an Editor Theme to RStudio +askForPassword Ask the user for a password interactively +askForSecret Prompt user for secret +bugReport File an RStudio Bug Report +build-tools Build Tools +callFun Call an RStudio API function +chunk-callbacks Register and Unregister a Chunk Callback +convertTheme Convert a tmTheme to an RStudio Theme +createProjectTemplate Create a Project Template +dictionaries Interact with RStudio's Dictionaries +document_position Create a Document Position +document_range Create a Range +executeCommand Execute Command +file-dialogs Select a file / folder +filesPaneNavigate Navigate to a Directory in the Files Pane +getActiveProject Retrieve path to active RStudio project +getDelegatedAzureToken + OAuth2 Tokens for Delegated Azure Resources +getMode Report whether RStudio Desktop or RStudio + Server is in use +getRStudioPackageDependencies + Get RStudio Package Dependencies +getThemeInfo Retrieve Themes +getThemes Get Theme List +getVersion Determine the version of RStudio +hasColorConsole Check if console supports ANSI color escapes. +hasFun Exists/get for RStudio functions +highlightUi Highlight UI Elements within the RStudio IDE +isAvailable Check if RStudio is running +isJob Detect RStudio Jobs +jobAdd Add a Job +jobAddOutput Add Background Job Output +jobAddProgress Add Background Job Progress +jobGetState Get Background Job State +jobList List Background Jobs +jobRemove Remove a Background Job +jobRunScript Run R Script As Background Job +jobSetProgress Set Background Job Progress +jobSetState Set Background Job State +jobSetStatus Set Background Job Status +launcherAvailable Check if Workbench Launcher is Available +launcherConfig Define a Workbench Launcher Configuration +launcherContainer Define a Workbench Launcher Container +launcherControlJob Interact with (Control) a Workbench Job +launcherGetInfo Retrieve Workbench Launcher Information +launcherGetJob Retrieve Workbench Job Information +launcherGetJobs Retrieve Workbench Job Information +launcherHostMount Define a Workbench Launcher Host Mount +launcherNfsMount Define a Workbench Launcher NFS Mount +launcherPlacementConstraint + Define a Workbench Launcher Placement + Constraint +launcherResourceLimit Define a Workbench Launcher Resource Limit +launcherSubmitJob Submit a Workbench Job +launcherSubmitR Execute an R Script as a Workbench Job +navigateToFile Navigate to file +persistent-values Persistent keys and values +previewRd Preview an Rd topic in the Help pane +previewSql Preview SQL statement +primary_selection Extract the Primary Selection +projects Open a project in RStudio +readPreference Read Preference +readRStudioPreference Read RStudio Preference +registerCommandCallback + Register Command Callback +registerCommandStreamCallback + Register Command Stream Callback +removeTheme Remove a custom theme from RStudio. +restartSession Restart the R Session +rstudio-documents Interact with Documents open in RStudio +rstudio-editors Retrieve Information about an RStudio Editor +savePlotAsImage Save active RStudio plot image +selections Manipulate User Selections in the RStudio IDE +sendToConsole Send code to the R console +setGhostText Set ghost text +showDialog Show Dialog Box +showPrompt Show Prompt Dialog Box +showQuestion Show Question Dialog Box +sourceMarkers Display source markers +systemUsername Get System Username +terminalActivate Activate Terminal +terminalBuffer Get Terminal Buffer +terminalBusy Is Terminal Busy +terminalClear Clear Terminal Buffer +terminalContext Retrieve Information about RStudio Terminals +terminalCreate Create a Terminal +terminalExecute Execute Command +terminalExitCode Terminal Exit Code +terminalKill Kill Terminal +terminalList Get All Terminal Ids +terminalRunning Is Terminal Running +terminalSend Send Text to a Terminal +terminalVisible Get Visible Terminal +translateLocalUrl Translate Local URL +unregisterCommandCallback + Unregister Command Callback +updateDialog Updates a Dialog Box +userIdentity Get User Identity +versionInfo RStudio version information +viewer View local web content within RStudio +writePreference Write Preference +writeRStudioPreference + Write RStudio Preference diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/LICENSE new file mode 100644 index 00000000..9b8dd6ae --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2015 +COPYRIGHT HOLDER: RStudio diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/Meta/Rd.rds new file mode 100644 index 00000000..3726daad Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/Meta/hsearch.rds new file mode 100644 index 00000000..775fb1dc Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/Meta/links.rds new file mode 100644 index 00000000..6a3fb1af Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/Meta/nsInfo.rds new file mode 100644 index 00000000..948959af Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/Meta/package.rds new file mode 100644 index 00000000..b93f0798 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/Meta/vignette.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/Meta/vignette.rds new file mode 100644 index 00000000..49c5cd41 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/Meta/vignette.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/NAMESPACE new file mode 100644 index 00000000..5934340b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/NAMESPACE @@ -0,0 +1,139 @@ +# Generated by roxygen2: do not edit by hand + +S3method(as.document_position,default) +S3method(as.document_position,document_position) +S3method(as.document_range,default) +S3method(as.document_range,document_range) +S3method(format,document_position) +S3method(format,document_range) +S3method(primary_selection,document_context) +S3method(primary_selection,document_selection) +S3method(print,document_context) +S3method(print,document_position) +S3method(print,document_range) +S3method(print,document_selection) +export(addTheme) +export(applyTheme) +export(as.document_position) +export(as.document_range) +export(askForPassword) +export(askForSecret) +export(bugReport) +export(buildToolsCheck) +export(buildToolsExec) +export(buildToolsInstall) +export(callFun) +export(convertTheme) +export(createProjectTemplate) +export(dictionariesPath) +export(documentClose) +export(documentId) +export(documentNew) +export(documentOpen) +export(documentPath) +export(documentSave) +export(documentSaveAll) +export(document_position) +export(document_range) +export(executeCommand) +export(filesPaneNavigate) +export(findFun) +export(getActiveDocumentContext) +export(getActiveProject) +export(getConsoleEditorContext) +export(getDelegatedAzureToken) +export(getMode) +export(getPersistentValue) +export(getRStudioPackageDependencies) +export(getSourceEditorContext) +export(getThemeInfo) +export(getThemes) +export(getVersion) +export(hasColorConsole) +export(hasFun) +export(highlightUi) +export(initializeProject) +export(insertText) +export(is.document_position) +export(is.document_range) +export(isAvailable) +export(isBackgroundJob) +export(isJob) +export(isWorkbenchJob) +export(jobAdd) +export(jobAddOutput) +export(jobAddProgress) +export(jobGetState) +export(jobList) +export(jobRemove) +export(jobRunScript) +export(jobSetProgress) +export(jobSetState) +export(jobSetStatus) +export(launcherAvailable) +export(launcherConfig) +export(launcherContainer) +export(launcherControlJob) +export(launcherGetInfo) +export(launcherGetJob) +export(launcherGetJobs) +export(launcherHostMount) +export(launcherNfsMount) +export(launcherPlacementConstraint) +export(launcherResourceLimit) +export(launcherSubmitJob) +export(launcherSubmitR) +export(modifyRange) +export(navigateToFile) +export(openProject) +export(previewRd) +export(previewSql) +export(primary_selection) +export(readPreference) +export(readRStudioPreference) +export(registerChunkCallback) +export(registerCommandCallback) +export(registerCommandStreamCallback) +export(removeTheme) +export(restartSession) +export(savePlotAsImage) +export(selectDirectory) +export(selectFile) +export(selectionGet) +export(selectionSet) +export(sendToConsole) +export(setCursorPosition) +export(setDocumentContents) +export(setGhostText) +export(setPersistentValue) +export(setSelectionRanges) +export(showDialog) +export(showPrompt) +export(showQuestion) +export(sourceMarkers) +export(systemUsername) +export(terminalActivate) +export(terminalBuffer) +export(terminalBusy) +export(terminalClear) +export(terminalContext) +export(terminalCreate) +export(terminalExecute) +export(terminalExitCode) +export(terminalKill) +export(terminalList) +export(terminalRunning) +export(terminalSend) +export(terminalVisible) +export(translateLocalUrl) +export(unregisterChunkCallback) +export(unregisterCommandCallback) +export(updateDialog) +export(userDictionariesPath) +export(userIdentity) +export(verifyAvailable) +export(versionInfo) +export(viewer) +export(writePreference) +export(writeRStudioPreference) +importFrom(utils,capture.output) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/NEWS.md new file mode 100644 index 00000000..d99a4fab --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/NEWS.md @@ -0,0 +1,165 @@ +# rstudioapi 0.17.1 + +* Ensure a more appropriate error message is emitted for calls to + `rstudioapi::getVersion()` and `rstudioapi::getMode()` outside + of RStudio. + + +# rstudioapi 0.17.0 + +* Added `getMode()`, which can be used to differentiate between Desktop + and Server installations of RStudio. (#280) + + +# rstudioapi 0.16.0 + +* `restartSession()` gains the `clean` argument, for RStudio 2024.04 + and newer. + +* Added `setGhostText()` for setting ghost text in the current editor. + + +# rstudioapi 0.15.0 + +* Added `getDelegatedAzureToken` for Posit Workbench users needing to expose + OAuth2 tokens for Azure services that have already had permissions configured + + +# rstudioapi 0.14 + +* `documentPath()` now marks the encoding of file paths as UTF-8. (#257) + +* `getSourceEditorContext()` gains the `id` argument, to be used to request + the editor context for a document with an already-known ID. (#251) + +* Added `documentOpen()`, for opening a document in RStudio and optionally + navigating the cursor to a particular point in the file. The method is + synchronous and returns the document ID upon completion. + +* Fixed an issue where `rstudioapi::askForSecret()` would erroneously fall back + to using `rstudioapi::askForPassword()` during Knit. + +* Added `registerCommandCallback`, `registerCommandStreamCallback`, and + `unregisterCommandCallback`, used to execute a callback after an IDE command + is executed. + + +# rstudioapi 0.13 + +* Fixed an issue where `rstudioapi::insertText()` would fail. (#208) + + +# rstudioapi 0.12 + +* Fixed an issue where remote `rstudioapi` calls would erroneously use + a previous response in some cases. + +* Allow `navigateToFile` to accept an empty file. This file will default to the file + currently in view in the active column. + +* Added `registerChunkExecCallback` and `unregisterChunkExecCallback`, used to + execute a callback after a chunk is ran. + + +# rstudioapi 0.11 + +* `rstudioapi::launcherResourceLimit()` now properly delegates the type + and memory arguments. (#164) + +* `rstudioapi` gains the function `highlightUi()`, used to highlight UI + elements in newer versions of RStudio. + +* Paths returned from `selectFile()` are now properly marked with + UTF-8 encoding. + +* It is now possible for `rstudioapi` to communicate with a parent RStudio + session, for R sessions launched as RStudio jobs. Use + `rstudioapi::isAvailable(child_ok = TRUE)` to assert that it's okay to check + that `rstudioapi` is available and is running within an RStudio job. + +* Added `bugReport()`, a helper function for reporting RStudio bugs + on the GitHub issue tracker with an issue template pre-populated + with some helpful diagnostic information. + +* Added `userIdentity` and `systemUsername`, used to retrieve information about + the current user. + + +# rstudioapi 0.10 + +* Added the parameters `echo` and `focus` to `sendToConsole()`. + + +# rstudioapi 0.9 + +* Added functions for displaying jobs in RStudio's Jobs pane: `jobAdd()`, `jobRemove()`, etc. + +* Added `translateLocalUrl()`, for translating localhost URLs to externally addressable ones on RStudio Server. + + +# rstudioapi 0.8 + +* Added functions for installing + using build tools: + `buildToolsCheck()`, `buildToolsInstall()`, `buildToolsExec()` + +* Added functions for installing + using themes: `addTheme()`, `applyTheme()`, + `convertTheme()`, `getThemes()`, `getThemeInfo()`. + +* Added `previewSql()`, for previewing output from executing a SQL query. + +* Added `askForSecret()`, for prompting the user to enter a password or otherwise privileged information. + +* Fixed an issue where `getActiveProject()` failed for non-ASCII paths. (#86) + +# rstudioapi 0.7 + +* Added methods for prompting the user for file paths: `selectFile()`, + `selectDirectory()`. + +* `askForPassword()` gains a default prompt (#41) + +* Add `createProjectTemplate()` function + +* Add `setPersistentValue()` / `getPersistentValue()` functions + +* Add methods for interacting with Terminal tab: + `terminalActivate()`, `terminalClear()`, `terminalCreate()`, `terminalList()`, + `terminalBuffer()`, `terminalContext()`, `terminalVisible()`, `terminalBusy()`, + `terminalRunning()`, `terminalKill()`, `terminalSend()`, `terminalExecute()`, + and `terminalExitCode()`. + + +# rstudioapi 0.6 + +* Add sendToConsole function + +* Add APIs for setting cursor position in document + + +# rstudioapi 0.5 + +* Add askForPassword function + +* Add getActiveProject function + + +# rstudioapi 0.4 + +* Add API methods for interacting with a document open in RStudio: 'insertText()', 'modifyRange()' and 'getActiveDocumentContext()'. + + +# rstudioapi 0.3 + +* Add stub and documentation for sourceMarker function + + +# rstudioapi 0.2 + +* Compatibility with calling conventions for RStudio v0.99 + +* Stubs and documentation for versionInfo, previewRd, and viewer functions + + +# rstudioapi 0.1 + +* Initial release to CRAN diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/R/rstudioapi b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/R/rstudioapi new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/R/rstudioapi @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/R/rstudioapi.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/R/rstudioapi.rdb new file mode 100644 index 00000000..653c7fb3 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/R/rstudioapi.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/R/rstudioapi.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/R/rstudioapi.rdx new file mode 100644 index 00000000..d405dd1b Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/R/rstudioapi.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/dialogs.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/dialogs.R new file mode 100644 index 00000000..7f8f98b6 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/dialogs.R @@ -0,0 +1,30 @@ +## ----setup, include=FALSE----------------------------------------------------- +knitr::opts_chunk$set(eval = FALSE) + +## ----------------------------------------------------------------------------- +# # request the path to an existing .csv file on disk +# path <- rstudioapi::selectFile(caption = "Select CSV File", +# filter = "CSV Files (*.csv)", +# existing = TRUE) +# +# # now, you could read the data using e.g. 'readr::read_csv()' +# data <- readr::read_csv(path) +# +# # request a file path (e.g. where you would like to save a new file) +# target <- rstudioapi::selectFile(caption = "Save File", +# label = "Save", +# existing = FALSE) +# +# # save data to the path provided by the user +# saveRDS(data, file = target) + +## ----------------------------------------------------------------------------- +# token <- rstudioapi::askForPassword( +# prompt = "Please provide your GitHub access token." +# ) + +## ----------------------------------------------------------------------------- +# rstudioapi::showDialog(title = "Hello, world!", +# message = "You're awesome!", +# url = "http://www.example.com") + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/dialogs.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/dialogs.Rmd new file mode 100644 index 00000000..974b5e3f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/dialogs.Rmd @@ -0,0 +1,50 @@ +--- +title: "File Dialogs" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{File Dialogs} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(eval = FALSE) +``` + +Using the `rstudioapi` package, you can request input from the user with various dialogs. + +The `selectFile()` and `selectDirectory()` APIs allow you to request the name of an existing or non-existing path on the system. + +```{r} +# request the path to an existing .csv file on disk +path <- rstudioapi::selectFile(caption = "Select CSV File", + filter = "CSV Files (*.csv)", + existing = TRUE) + +# now, you could read the data using e.g. 'readr::read_csv()' +data <- readr::read_csv(path) + +# request a file path (e.g. where you would like to save a new file) +target <- rstudioapi::selectFile(caption = "Save File", + label = "Save", + existing = FALSE) + +# save data to the path provided by the user +saveRDS(data, file = target) +``` + +Use `rstudioapi::askForPassword()` to request a password, or other credentials, from a user. + +```{r} +token <- rstudioapi::askForPassword( + prompt = "Please provide your GitHub access token." +) +``` + +Use `rstudioapi::showDialog()` to display an informative dialog to the user. This dialog is used to report some kind of status or information to the user; it does not request any input. + +```{r} +rstudioapi::showDialog(title = "Hello, world!", + message = "You're awesome!", + url = "http://www.example.com") +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/dialogs.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/dialogs.html new file mode 100644 index 00000000..edd36548 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/dialogs.html @@ -0,0 +1,391 @@ + + + + + + + + + + + + + + +File Dialogs + + + + + + + + + + + + + + + + + + + + + + + + + + +

File Dialogs

+ + + +

Using the rstudioapi package, you can request input from +the user with various dialogs.

+

The selectFile() and selectDirectory() APIs +allow you to request the name of an existing or non-existing path on the +system.

+
# request the path to an existing .csv file on disk
+path <- rstudioapi::selectFile(caption = "Select CSV File",
+                               filter = "CSV Files (*.csv)",
+                               existing = TRUE)
+
+# now, you could read the data using e.g. 'readr::read_csv()'
+data <- readr::read_csv(path)
+
+# request a file path (e.g. where you would like to save a new file)
+target <- rstudioapi::selectFile(caption = "Save File",
+                                 label = "Save",
+                                 existing = FALSE)
+
+# save data to the path provided by the user
+saveRDS(data, file = target)
+

Use rstudioapi::askForPassword() to request a password, +or other credentials, from a user.

+
token <- rstudioapi::askForPassword(
+  prompt = "Please provide your GitHub access token."
+)
+

Use rstudioapi::showDialog() to display an informative +dialog to the user. This dialog is used to report some kind of status or +information to the user; it does not request any input.

+
rstudioapi::showDialog(title = "Hello, world!",
+                       message = "You're <b>awesome!</b>",
+                       url = "http://www.example.com")
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/document-manipulation.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/document-manipulation.R new file mode 100644 index 00000000..61d60d40 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/document-manipulation.R @@ -0,0 +1,39 @@ +## ----setup-------------------------------------------------------------------- +knitr::opts_chunk$set(eval = FALSE) + +## ----------------------------------------------------------------------------- +# # construct the text to be inserted +# fmt <- "# This document was last modified on %s.\n" +# text <- sprintf(fmt, Sys.Date()) +# +# # specify a range where this text should be inserted; here, +# # we use the first line; that is, the 'range' between the start +# # of the first row, and the start of the second row +# range <- rstudioapi::document_range(c(1, 0), c(2, 0)) +# rstudioapi::insertText(range, text) + +## ----------------------------------------------------------------------------- +# # get console editor id +# context <- rstudioapi::getConsoleEditorContext() +# id <- context$id +# +# # send some R code to the console +# rstudioapi::insertText(text = "print(1 + 1)", id = id) +# +# # see also: `getActiveEditorContext()`, `getSourceEditorContext()` + +## ----------------------------------------------------------------------------- +# # put the cursor at the end of the document -- note that here, +# # `Inf` is automatically truncated to the actual length of the +# # document +# rstudioapi::setCursorPosition(Inf) +# +# # select the first 10 even lines in the document +# ranges <- lapply(seq(2, by = 2, length.out = 10), function(start) { +# rstudioapi::document_range( +# c(start, 0), +# c(start, Inf) +# ) +# }) +# rstudioapi::setSelectionRanges(ranges) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/document-manipulation.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/document-manipulation.Rmd new file mode 100644 index 00000000..48a4a09e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/document-manipulation.Rmd @@ -0,0 +1,59 @@ +--- +title: "Document Manipulation" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Document Manipulation} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r setup} +knitr::opts_chunk$set(eval = FALSE) +``` + +The `rstudioapi` package provides a small family of functions that can be used to interact with documents open in an RStudio session. For example, the following code could be used to insert a 'last modified' comment at the start of a document: + +```{r} +# construct the text to be inserted +fmt <- "# This document was last modified on %s.\n" +text <- sprintf(fmt, Sys.Date()) + +# specify a range where this text should be inserted; here, +# we use the first line; that is, the 'range' between the start +# of the first row, and the start of the second row +range <- rstudioapi::document_range(c(1, 0), c(2, 0)) +rstudioapi::insertText(range, text) +``` + +By default, these APIs target the editor instance either currently focused by the user, or when no such editor is currently focused, the last focused editor. If you need to target a specific editor instance (for example, you want to write code that inserts text into the console), you can use `getConsoleEditorContext()` to get the `id` for the console editor: + +```{r} +# get console editor id +context <- rstudioapi::getConsoleEditorContext() +id <- context$id + +# send some R code to the console +rstudioapi::insertText(text = "print(1 + 1)", id = id) + +# see also: `getActiveEditorContext()`, `getSourceEditorContext()` +``` + +You can also modify the cursor position through the use of the `setCursorPosition()` and `setSelectionRanges()` APIs. + +```{r} +# put the cursor at the end of the document -- note that here, +# `Inf` is automatically truncated to the actual length of the +# document +rstudioapi::setCursorPosition(Inf) + +# select the first 10 even lines in the document +ranges <- lapply(seq(2, by = 2, length.out = 10), function(start) { + rstudioapi::document_range( + c(start, 0), + c(start, Inf) + ) +}) +rstudioapi::setSelectionRanges(ranges) +``` + +See the `?"rstudio-documents"` help page for more details. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/document-manipulation.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/document-manipulation.html new file mode 100644 index 00000000..eab0c12d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/document-manipulation.html @@ -0,0 +1,406 @@ + + + + + + + + + + + + + + +Document Manipulation + + + + + + + + + + + + + + + + + + + + + + + + + + +

Document Manipulation

+ + + +
knitr::opts_chunk$set(eval = FALSE)
+

The rstudioapi package provides a small family of +functions that can be used to interact with documents open in an RStudio +session. For example, the following code could be used to insert a ‘last +modified’ comment at the start of a document:

+
# construct the text to be inserted
+fmt <- "# This document was last modified on %s.\n"
+text <- sprintf(fmt, Sys.Date())
+
+# specify a range where this text should be inserted; here,
+# we use the first line; that is, the 'range' between the start
+# of the first row, and the start of the second row
+range <- rstudioapi::document_range(c(1, 0), c(2, 0))
+rstudioapi::insertText(range, text)
+

By default, these APIs target the editor instance either currently +focused by the user, or when no such editor is currently focused, the +last focused editor. If you need to target a specific editor instance +(for example, you want to write code that inserts text into the +console), you can use getConsoleEditorContext() to get the +id for the console editor:

+
# get console editor id
+context <- rstudioapi::getConsoleEditorContext()
+id <- context$id
+
+# send some R code to the console
+rstudioapi::insertText(text = "print(1 + 1)", id = id)
+
+# see also: `getActiveEditorContext()`, `getSourceEditorContext()`
+

You can also modify the cursor position through the use of the +setCursorPosition() and setSelectionRanges() +APIs.

+
# put the cursor at the end of the document -- note that here,
+# `Inf` is automatically truncated to the actual length of the
+# document
+rstudioapi::setCursorPosition(Inf)
+
+# select the first 10 even lines in the document
+ranges <- lapply(seq(2, by = 2, length.out = 10), function(start) {
+  rstudioapi::document_range(
+    c(start, 0),
+    c(start, Inf)
+  )
+})
+rstudioapi::setSelectionRanges(ranges)
+

See the ?"rstudio-documents" help page for more +details.

+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/index.html new file mode 100644 index 00000000..ea65eddc --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/index.html @@ -0,0 +1,59 @@ + + +R: Vignettes and other documentation + + + +
+

Vignettes and other documentation + +

+
+
+[Top] +
+

Vignettes from package 'rstudioapi'

+ +++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
rstudioapi::dialogsFile DialogsHTMLsourceR code
rstudioapi::document-manipulationDocument ManipulationHTMLsourceR code
rstudioapi::introductionIntroduction to rstudioapiHTMLsource
rstudioapi::projectsInteracting with RStudio ProjectsHTMLsourceR code
rstudioapi::r-sessionInteract with the R SessionHTMLsourceR code
rstudioapi::terminalInteracting with TerminalsHTMLsourceR code
rstudioapi::visual-modeInterfacing with RStudio in Visual ModeHTMLsourceR code
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/introduction.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/introduction.Rmd new file mode 100644 index 00000000..b5576a79 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/introduction.Rmd @@ -0,0 +1,22 @@ +--- +title: "Introduction to rstudioapi" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Introduction to rstudioapi} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +The `rstudioapi` package provides an interface for interacting with the RStudio IDE with R code. Using `rstudioapi`, you can: + +- Examine, manipulate, and save the contents of documents currently open in RStudio, + +- Create, open, or re-open RStudio projects, + +- Prompt the user with different kinds of dialogs (e.g. for selecting a file or folder, or requesting a password from the user), + +- Interact with RStudio terminals, + +- Interact with the R session associated with the current RStudio instance. + +Please see the other articles for more detailed information. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/introduction.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/introduction.html new file mode 100644 index 00000000..08224dcb --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/introduction.html @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + +Introduction to rstudioapi + + + + + + + + + + + + + + + + + + + + + + + +

Introduction to rstudioapi

+ + + +

The rstudioapi package provides an interface for +interacting with the RStudio IDE with R code. Using +rstudioapi, you can:

+
    +
  • Examine, manipulate, and save the contents of documents currently +open in RStudio,

  • +
  • Create, open, or re-open RStudio projects,

  • +
  • Prompt the user with different kinds of dialogs (e.g. for +selecting a file or folder, or requesting a password from the +user),

  • +
  • Interact with RStudio terminals,

  • +
  • Interact with the R session associated with the current RStudio +instance.

  • +
+

Please see the other articles for more detailed information.

+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/projects.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/projects.R new file mode 100644 index 00000000..c8c62e76 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/projects.R @@ -0,0 +1,13 @@ +## ----setup, include=FALSE----------------------------------------------------- +knitr::opts_chunk$set(eval = FALSE) + +## ----------------------------------------------------------------------------- +# # open a project in another directory +# rstudioapi::openProject("~/projects/t-sne-gene-expression-2017") +# +# # re-open the current project +# rstudioapi::openProject() +# +# # initialize an RStudio project (without opening it) +# rstudioapi::initializeProject("~/scratch/testbed") + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/projects.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/projects.Rmd new file mode 100644 index 00000000..c2a32e32 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/projects.Rmd @@ -0,0 +1,26 @@ +--- +title: "Interacting with RStudio Projects" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Interacting with RStudio Projects} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(eval = FALSE) +``` + +Users can create and open RStudio projects using the `rstudioapi` package. + +```{r} +# open a project in another directory +rstudioapi::openProject("~/projects/t-sne-gene-expression-2017") + +# re-open the current project +rstudioapi::openProject() + +# initialize an RStudio project (without opening it) +rstudioapi::initializeProject("~/scratch/testbed") +``` + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/projects.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/projects.html new file mode 100644 index 00000000..2ab8be7e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/projects.html @@ -0,0 +1,370 @@ + + + + + + + + + + + + + + +Interacting with RStudio Projects + + + + + + + + + + + + + + + + + + + + + + + + + + +

Interacting with RStudio Projects

+ + + +

Users can create and open RStudio projects using the +rstudioapi package.

+
# open a project in another directory
+rstudioapi::openProject("~/projects/t-sne-gene-expression-2017")
+
+# re-open the current project
+rstudioapi::openProject()
+
+# initialize an RStudio project (without opening it)
+rstudioapi::initializeProject("~/scratch/testbed")
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/r-session.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/r-session.R new file mode 100644 index 00000000..a330e2a6 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/r-session.R @@ -0,0 +1,39 @@ +## ----setup, include=FALSE----------------------------------------------------- +knitr::opts_chunk$set(eval = FALSE) + +## ----eval=FALSE--------------------------------------------------------------- +# # check that RStudio is available via rstudioapi -- note that this must +# # be checked prior to calling any other rstudioapi APIs! +# if (rstudioapi::isAvailable()) { +# +# # determine more information via +# info <- rstudioapi::versionInfo() +# +# # check for desktop mode +# info$mode == "desktop" +# +# # check for server mode +# info$mode == "server" +# +# # check the version of RStudio in use +# info$version >= "1.4" +# +# } +# +# # check whether RStudio is running without relying on rstudioapi +# .Platform$GUI == "RStudio" # NOTE: may be unreliable in .Rprofile +# commandArgs()[[1]] == "RStudio" + +## ----------------------------------------------------------------------------- +# # restart R, then run some code after +# rstudioapi::restartSession(command = "print('Welcome back!')") +# +# # send some code to the console and execute it immediately +# rstudioapi::sendToConsole("1 + 1", execute = TRUE) + +## ----------------------------------------------------------------------------- +# setHook("rstudio.sessionInit", function(newSession) { +# if (newSession) +# message("Welcome to RStudio ", rstudioapi::getVersion()) +# }, action = "append") + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/r-session.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/r-session.Rmd new file mode 100644 index 00000000..c10bed05 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/r-session.Rmd @@ -0,0 +1,71 @@ +--- +title: "Interacting with the R Session" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Interact with the R Session} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(eval = FALSE) +``` + + +## Detecting RStudio + +R code may need to determine whether it's being run within an RStudio session, versus a plain R session or something similar. + +```{r eval=FALSE} +# check that RStudio is available via rstudioapi -- note that this must +# be checked prior to calling any other rstudioapi APIs! +if (rstudioapi::isAvailable()) { + + # determine more information via + info <- rstudioapi::versionInfo() + + # check for desktop mode + info$mode == "desktop" + + # check for server mode + info$mode == "server" + + # check the version of RStudio in use + info$version >= "1.4" + +} + +# check whether RStudio is running without relying on rstudioapi +.Platform$GUI == "RStudio" # NOTE: may be unreliable in .Rprofile +commandArgs()[[1]] == "RStudio" +``` + +A note: the `RSTUDIO` environment variable will be set both within the main RStudio session, but also within child processes launched by RStudio. If you need to specifically detect if your code is running within the main RStudio session, we recommend using an alternate mechanism. + + +## Session Interaction + +The `rstudioapi` package allows you to interact with the running R session in a couple useful ways: you can send code to the R console, or restart the R session. + +```{r} +# restart R, then run some code after +rstudioapi::restartSession(command = "print('Welcome back!')") + +# send some code to the console and execute it immediately +rstudioapi::sendToConsole("1 + 1", execute = TRUE) +``` + + +## Running at Startup + +Typically, code that you want to run at the start of an R session is placed into an `.Rprofile` file (see [Initialization at the Start of a Session](https://stat.ethz.ch/R-manual/R-devel/library/base/html/Startup.html) for details). However, RStudio's API hooks are not available until RStudio has fully started up, so most `rstudioapi` methods will not work inside `.Rprofile`. + +If you want to invoke `rstudioapi` methods on session startup, use the `rstudio.sessionInit` hook. For example, to print the RStudio version to the R console when the session begins: + +```{r} +setHook("rstudio.sessionInit", function(newSession) { + if (newSession) + message("Welcome to RStudio ", rstudioapi::getVersion()) +}, action = "append") +``` + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/r-session.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/r-session.html new file mode 100644 index 00000000..1c064fad --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/r-session.html @@ -0,0 +1,418 @@ + + + + + + + + + + + + + + +Interacting with the R Session + + + + + + + + + + + + + + + + + + + + + + + + + + +

Interacting with the R Session

+ + + +
+

Detecting RStudio

+

R code may need to determine whether it’s being run within an RStudio +session, versus a plain R session or something similar.

+
# check that RStudio is available via rstudioapi -- note that this must
+# be checked prior to calling any other rstudioapi APIs!
+if (rstudioapi::isAvailable()) {
+
+  # determine more information via 
+  info <- rstudioapi::versionInfo()
+  
+  # check for desktop mode
+  info$mode == "desktop"
+  
+  # check for server mode
+  info$mode == "server"
+  
+  # check the version of RStudio in use
+  info$version >= "1.4"
+  
+}
+
+# check whether RStudio is running without relying on rstudioapi
+.Platform$GUI == "RStudio"  # NOTE: may be unreliable in .Rprofile
+commandArgs()[[1]] == "RStudio"
+

A note: the RSTUDIO environment variable will be set +both within the main RStudio session, but also within child processes +launched by RStudio. If you need to specifically detect if your code is +running within the main RStudio session, we recommend using an alternate +mechanism.

+
+
+

Session Interaction

+

The rstudioapi package allows you to interact with the +running R session in a couple useful ways: you can send code to the R +console, or restart the R session.

+
# restart R, then run some code after
+rstudioapi::restartSession(command = "print('Welcome back!')")
+
+# send some code to the console and execute it immediately
+rstudioapi::sendToConsole("1 + 1", execute = TRUE)
+
+
+

Running at Startup

+

Typically, code that you want to run at the start of an R session is +placed into an .Rprofile file (see Initialization +at the Start of a Session for details). However, RStudio’s API hooks +are not available until RStudio has fully started up, so most +rstudioapi methods will not work inside +.Rprofile.

+

If you want to invoke rstudioapi methods on session +startup, use the rstudio.sessionInit hook. For example, to +print the RStudio version to the R console when the session begins:

+
setHook("rstudio.sessionInit", function(newSession) {
+  if (newSession)
+    message("Welcome to RStudio ", rstudioapi::getVersion())
+}, action = "append")
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/terminal.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/terminal.R new file mode 100644 index 00000000..7a499ed4 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/terminal.R @@ -0,0 +1,42 @@ +## ----setup, include=FALSE----------------------------------------------------- +knitr::opts_chunk$set(eval = FALSE) + +## ----------------------------------------------------------------------------- +# # Start a command with results displayed in a terminal buffer +# termId <- rstudioapi::terminalExecute("ping rstudio.com") +# +# # If viewing the result in the terminal buffer is sufficient, +# # then no need to do anything else. The command will continue +# # running and displaying its results without blocking the R session. +# +# # To obtain the results programmatically, wait for it to finish. +# while (is.null(rstudioapi::terminalExitCode(termId))) { +# Sys.sleep(0.1) +# } +# +# result <- rstudioapi::terminalBuffer(termId) +# +# # Delete the buffer and close the session in the IDE +# rstudioapi::terminalKill(termId) + +## ----------------------------------------------------------------------------- +# # start an interactive terminal using the shell selected in +# # RStudio global options +# myTerm <- rstudioapi::terminalCreate() +# +# # .... +# # sometime later +# # .... +# if (!rstudioapi::terminalRunning(myTerm)) { +# # start the terminal shell back up, but don't bring to front +# rstudioapi::terminalActivate(myTerm, show = FALSE) +# +# # wait for it to start +# while (!rstudioapi::terminalRunning(myTerm)) { +# Sys.sleep(0.1) +# } +# +# # send a new command +# rstudioapi::terminalSend(myTerm, "echo Hello\n") +# } + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/terminal.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/terminal.Rmd new file mode 100644 index 00000000..28b861ef --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/terminal.Rmd @@ -0,0 +1,98 @@ +--- +title: "Interacting with Terminals" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Interacting with Terminals} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(eval = FALSE) +``` +The `rstudioapi` package provides a collection of functions that can be used to interact with the RStudio terminal tab. + +There are two primary approaches to using these functions. + +1. Use `terminalExecute()` to run a specific process with the output shown in a new terminal buffer, without blocking the current R session. + +2. Create, query, and manipulate interactive terminals. This might be used to develop custom terminal behavior via an [RStudio addin](https://rstudio.github.io/rstudioaddins/). + +## TerminalExecute Scenario + +```{r} +# Start a command with results displayed in a terminal buffer +termId <- rstudioapi::terminalExecute("ping rstudio.com") + +# If viewing the result in the terminal buffer is sufficient, +# then no need to do anything else. The command will continue +# running and displaying its results without blocking the R session. + +# To obtain the results programmatically, wait for it to finish. +while (is.null(rstudioapi::terminalExitCode(termId))) { + Sys.sleep(0.1) +} + +result <- rstudioapi::terminalBuffer(termId) + +# Delete the buffer and close the session in the IDE +rstudioapi::terminalKill(termId) +``` + +## Interative Terminal Scenario + +Several concepts are important to understand to make full use of these functions. + +### Terminal Identifier + +Each terminal session has a unique **terminal identifier**, a required argument for most of the functions. A terminal identifier is generated and returned when a terminal is created via `terminalCreate()` or `terminalExecute()`, and identifiers of existing terminals can be obtained via `terminalList()` or `terminalVisible()`. + +### Terminal Session + +A **terminal session** is an instance of a terminal that can be displayed in the RStudio terminal tab. A terminal session consists of: + +* a unique terminal identifier +* a unique caption shown in the RStudio terminal dropdown (e.g. "Terminal 1") +* a shell process (e.g. bash) running as a child process of the R session +* zero or more processes running as children of the shell (e.g. commands) +* an xterm-compatible terminal emulator in the terminal tab +* a buffer of output shown in the terminal emulator (can be cleared via `terminalClear()`) + +### Busy Terminal +A terminal session with child processes running (excluding the shell), is considered **busy** and this is reflected in the IDE UI and can be queried with `terminalBusy()`. + +### Terminal States + +In the most common situation, a terminal session has all the above features; however, it is possible for terminals to be in other states. + +**No shell process or child processes**: This happens if the associated R session has been closed (or suspended in the case of an inactive RStudio Server session). + +The `terminalRunning()` function returns `TRUE` if a terminal is in this state. + +If a terminal is not running, it can be started via interacting with it in the RStudio IDE, or via `terminalActivate()`. + +```{r} +# start an interactive terminal using the shell selected in +# RStudio global options +myTerm <- rstudioapi::terminalCreate() + +# .... +# sometime later +# .... +if (!rstudioapi::terminalRunning(myTerm)) { + # start the terminal shell back up, but don't bring to front + rstudioapi::terminalActivate(myTerm, show = FALSE) + + # wait for it to start + while (!rstudioapi::terminalRunning(myTerm)) { + Sys.sleep(0.1) + } + + # send a new command + rstudioapi::terminalSend(myTerm, "echo Hello\n") +} +``` + +**Running but not loaded in the IDE**: On RStudio Server, the web browser can be closed but the R session and any associated terminal sessions keep running. If the web browser is reconnected, each terminal will be redisplayed in the IDE when it is selected. The `rstudioapi` functions may be used on a terminal in this state; for example, the buffer may still be fetched with `terminalBuffer()` even if the terminal isn't loaded in the IDE (so long as the R session is still alive). + +**Terminated but still visible**: Normally the terminal emulator for a given terminal session will close when the shell exits. If the option **Close Terminal When Shell Exits** is turned off, then the terminal buffer will remain loaded in the RStudio IDE until closed by the user or `terminalKill()`. Terminals started with `terminalExecute()` will always remain loaded when they finish running. To test a terminal for this state, `terminalExitCode()` will return a non-NULL value. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/terminal.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/terminal.html new file mode 100644 index 00000000..defc0912 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/terminal.html @@ -0,0 +1,477 @@ + + + + + + + + + + + + + + +Interacting with Terminals + + + + + + + + + + + + + + + + + + + + + + + + + + +

Interacting with Terminals

+ + + +

The rstudioapi package provides a collection of +functions that can be used to interact with the RStudio terminal +tab.

+

There are two primary approaches to using these functions.

+
    +
  1. Use terminalExecute() to run a specific process with +the output shown in a new terminal buffer, without blocking the current +R session.

  2. +
  3. Create, query, and manipulate interactive terminals. This might +be used to develop custom terminal behavior via an RStudio +addin.

  4. +
+
+

TerminalExecute Scenario

+
# Start a command with results displayed in a terminal buffer
+termId <- rstudioapi::terminalExecute("ping rstudio.com")
+
+# If viewing the result in the terminal buffer is sufficient,
+# then no need to do anything else. The command will continue
+# running and displaying its results without blocking the R session.
+
+# To obtain the results programmatically, wait for it to finish.
+while (is.null(rstudioapi::terminalExitCode(termId))) {
+  Sys.sleep(0.1)
+}
+
+result <- rstudioapi::terminalBuffer(termId)
+
+# Delete the buffer and close the session in the IDE
+rstudioapi::terminalKill(termId)
+
+
+

Interative Terminal Scenario

+

Several concepts are important to understand to make full use of +these functions.

+
+

Terminal Identifier

+

Each terminal session has a unique terminal +identifier, a required argument for most of the functions. A +terminal identifier is generated and returned when a terminal is created +via terminalCreate() or terminalExecute(), and +identifiers of existing terminals can be obtained via +terminalList() or terminalVisible().

+
+
+

Terminal Session

+

A terminal session is an instance of a terminal that +can be displayed in the RStudio terminal tab. A terminal session +consists of:

+
    +
  • a unique terminal identifier
  • +
  • a unique caption shown in the RStudio terminal dropdown +(e.g. “Terminal 1”)
  • +
  • a shell process (e.g. bash) running as a child process of the R +session
  • +
  • zero or more processes running as children of the shell +(e.g. commands)
  • +
  • an xterm-compatible terminal emulator in the terminal tab
  • +
  • a buffer of output shown in the terminal emulator (can be cleared +via terminalClear())
  • +
+
+
+

Busy Terminal

+

A terminal session with child processes running (excluding the +shell), is considered busy and this is reflected in the +IDE UI and can be queried with terminalBusy().

+
+
+

Terminal States

+

In the most common situation, a terminal session has all the above +features; however, it is possible for terminals to be in other +states.

+

No shell process or child processes: This happens if +the associated R session has been closed (or suspended in the case of an +inactive RStudio Server session).

+

The terminalRunning() function returns TRUE +if a terminal is in this state.

+

If a terminal is not running, it can be started via interacting with +it in the RStudio IDE, or via terminalActivate().

+
# start an interactive terminal using the shell selected in 
+# RStudio global options
+myTerm <- rstudioapi::terminalCreate()
+
+# ....
+# sometime later
+# ....
+if (!rstudioapi::terminalRunning(myTerm)) {
+  # start the terminal shell back up, but don't bring to front
+  rstudioapi::terminalActivate(myTerm, show = FALSE)
+  
+  # wait for it to start
+  while (!rstudioapi::terminalRunning(myTerm)) {
+    Sys.sleep(0.1)
+  }
+ 
+  # send a new command 
+  rstudioapi::terminalSend(myTerm, "echo Hello\n") 
+}
+

Running but not loaded in the IDE: On RStudio +Server, the web browser can be closed but the R session and any +associated terminal sessions keep running. If the web browser is +reconnected, each terminal will be redisplayed in the IDE when it is +selected. The rstudioapi functions may be used on a +terminal in this state; for example, the buffer may still be fetched +with terminalBuffer() even if the terminal isn’t loaded in +the IDE (so long as the R session is still alive).

+

Terminated but still visible: Normally the terminal +emulator for a given terminal session will close when the shell exits. +If the option Close Terminal When Shell Exits is turned +off, then the terminal buffer will remain loaded in the RStudio IDE +until closed by the user or terminalKill(). Terminals +started with terminalExecute() will always remain loaded +when they finish running. To test a terminal for this state, +terminalExitCode() will return a non-NULL value.

+
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/visual-mode.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/visual-mode.R new file mode 100644 index 00000000..5eabf707 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/visual-mode.R @@ -0,0 +1,17 @@ +## ----include = FALSE---------------------------------------------------------- +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) + +## ----setup-------------------------------------------------------------------- +library(rstudioapi) + +## ----eval=FALSE--------------------------------------------------------------- +# reformat <- function() { +# id <- rstudioapi::documentId(allowConsole = TRUE) +# selection <- rstudioapi::selectionGet(id = id) +# formatted <- styler::style_text(text = selection$value) +# rstudioapi::selectionSet(value = formatted, id = id) +# } + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/visual-mode.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/visual-mode.Rmd new file mode 100644 index 00000000..b9a7174c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/visual-mode.Rmd @@ -0,0 +1,44 @@ +--- +title: "Interfacing with RStudio in Visual Mode" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Interfacing with RStudio in Visual Mode} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + +```{r setup} +library(rstudioapi) +``` + + +RStudio v1.4 includes a new [visual editing mode](https://rstudio.github.io/visual-markdown-editing/#/), which provides a [WYSIWYM](https://en.wikipedia.org/wiki/WYSIWYM)-style editing interface for R Markdown documents. This vignette describes how `rstudioapi` can be used to interface with the RStudio visual mode editor. + +Most of the pre-existing `rstudioapi` functions used for interacting with a document (e.g. `rstudioapi::getSourceEditorContext()`) consume and / or produce objects which describe the position of the current selection in terms of row + column offsets into the document. Unfortunately, this abstraction does not neatly map into visual editing mode, as there is no notion of a "global" cursor position -- rather, a cursor might be placed into a particular cell, and could have an offset somewhere into that cell. + +If you are an [RStudio Addin](https://rstudio.github.io/rstudioaddins/) author, then you may want to ensure your addins are visual-mode-aware, so that they can function regardless of whether the user has enabled visual mode. To that end, we've introduced a small set of functions, which are more narrow in scope but can function in both source and visual mode: + +- `rstudioapi::documentId()`: Retrieve the ID associated with the document currently open and being edited in the RStudio IDE. +- `rstudioapi::documentPath()`: Retrieve the path on disk for a file currently open in the RStudio IDE. +- `rstudioapi::selectionGet()`: Get the contents of the user's selection. +- `rstudioapi::selectionSet()`: Set the contents of the user's selection. + +In addition, the `rstudioapi::insertText()` function will function in both source and visual mode, as long as only the `text` argument is supplied. + +Using this, you can build addins that modify the user's selected text. For example, a function that uses `rstudioapi` to reformat the user's current selection might look like this: + +```{r eval=FALSE} +reformat <- function() { + id <- rstudioapi::documentId(allowConsole = TRUE) + selection <- rstudioapi::selectionGet(id = id) + formatted <- styler::style_text(text = selection$value) + rstudioapi::selectionSet(value = formatted, id = id) +} +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/visual-mode.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/visual-mode.html new file mode 100644 index 00000000..8188f94a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/doc/visual-mode.html @@ -0,0 +1,405 @@ + + + + + + + + + + + + + + +Interfacing with RStudio in Visual Mode + + + + + + + + + + + + + + + + + + + + + + + + + + +

Interfacing with RStudio in Visual +Mode

+ + + +
library(rstudioapi)
+

RStudio v1.4 includes a new visual +editing mode, which provides a WYSIWYM-style editing +interface for R Markdown documents. This vignette describes how +rstudioapi can be used to interface with the RStudio visual +mode editor.

+

Most of the pre-existing rstudioapi functions used for +interacting with a document +(e.g. rstudioapi::getSourceEditorContext()) consume and / +or produce objects which describe the position of the current selection +in terms of row + column offsets into the document. Unfortunately, this +abstraction does not neatly map into visual editing mode, as there is no +notion of a “global” cursor position – rather, a cursor might be placed +into a particular cell, and could have an offset somewhere into that +cell.

+

If you are an RStudio Addin +author, then you may want to ensure your addins are visual-mode-aware, +so that they can function regardless of whether the user has enabled +visual mode. To that end, we’ve introduced a small set of functions, +which are more narrow in scope but can function in both source and +visual mode:

+
    +
  • rstudioapi::documentId(): Retrieve the ID associated +with the document currently open and being edited in the RStudio +IDE.
  • +
  • rstudioapi::documentPath(): Retrieve the path on disk +for a file currently open in the RStudio IDE.
  • +
  • rstudioapi::selectionGet(): Get the contents of the +user’s selection.
  • +
  • rstudioapi::selectionSet(): Set the contents of the +user’s selection.
  • +
+

In addition, the rstudioapi::insertText() function will +function in both source and visual mode, as long as only the +text argument is supplied.

+

Using this, you can build addins that modify the user’s selected +text. For example, a function that uses rstudioapi to +reformat the user’s current selection might look like this:

+
reformat <- function() {
+  id <- rstudioapi::documentId(allowConsole = TRUE)
+  selection <- rstudioapi::selectionGet(id = id)
+  formatted <- styler::style_text(text = selection$value)
+  rstudioapi::selectionSet(value = formatted, id = id)
+}
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/help/AnIndex new file mode 100644 index 00000000..5ca0a29d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/help/AnIndex @@ -0,0 +1,133 @@ +addTheme addTheme +applyTheme applyTheme +as.document_position document_position +as.document_range document_range +askForPassword askForPassword +askForSecret askForSecret +bugReport bugReport +build-tools build-tools +buildToolsCheck build-tools +buildToolsExec build-tools +buildToolsInstall build-tools +callFun callFun +chunk-callbacks chunk-callbacks +convertTheme convertTheme +createProjectTemplate createProjectTemplate +dictionaries dictionaries +dictionariesPath dictionaries +documentClose rstudio-documents +documentId rstudio-documents +documentNew rstudio-documents +documentOpen rstudio-documents +documentPath rstudio-documents +documentSave rstudio-documents +documentSaveAll rstudio-documents +document_position document_position +document_range document_range +executeCommand executeCommand +file-dialogs file-dialogs +filesPaneNavigate filesPaneNavigate +findFun hasFun +getActiveDocumentContext rstudio-editors +getActiveProject getActiveProject +getConsoleEditorContext rstudio-editors +getDelegatedAzureToken getDelegatedAzureToken +getMode getMode +getPersistentValue persistent-values +getRStudioPackageDependencies getRStudioPackageDependencies +getSourceEditorContext rstudio-editors +getThemeInfo getThemeInfo +getThemes getThemes +getVersion getVersion +hasColorConsole hasColorConsole +hasFun hasFun +highlightUi highlightUi +initializeProject projects +insertText rstudio-documents +is.document_position document_position +is.document_range document_range +isAvailable isAvailable +isBackgroundJob isJob +isJob isJob +isWorkbenchJob isJob +jobAdd jobAdd +jobAddOutput jobAddOutput +jobAddProgress jobAddProgress +jobGetState jobGetState +jobList jobList +jobRemove jobRemove +jobRunScript jobRunScript +jobSetProgress jobSetProgress +jobSetState jobSetState +jobSetStatus jobSetStatus +launcherAvailable launcherAvailable +launcherConfig launcherConfig +launcherContainer launcherContainer +launcherControlJob launcherControlJob +launcherGetInfo launcherGetInfo +launcherGetJob launcherGetJob +launcherGetJobs launcherGetJobs +launcherHostMount launcherHostMount +launcherNfsMount launcherNfsMount +launcherPlacementConstraint launcherPlacementConstraint +launcherResourceLimit launcherResourceLimit +launcherSubmitJob launcherSubmitJob +launcherSubmitR launcherSubmitR +modifyRange rstudio-documents +navigateToFile navigateToFile +openProject projects +persistent-values persistent-values +previewRd previewRd +previewSql previewSql +primary_selection primary_selection +projects projects +readPreference readPreference +readRStudioPreference readRStudioPreference +registerChunkCallback chunk-callbacks +registerCommandCallback registerCommandCallback +registerCommandStreamCallback registerCommandStreamCallback +removeTheme removeTheme +restartSession restartSession +rstudio-documents rstudio-documents +rstudio-editors rstudio-editors +savePlotAsImage savePlotAsImage +selectDirectory file-dialogs +selectFile file-dialogs +selectionGet selections +selections selections +selectionSet selections +sendToConsole sendToConsole +setCursorPosition rstudio-documents +setDocumentContents rstudio-documents +setGhostText setGhostText +setPersistentValue persistent-values +setSelectionRanges rstudio-documents +showDialog showDialog +showPrompt showPrompt +showQuestion showQuestion +sourceMarkers sourceMarkers +systemUsername systemUsername +terminalActivate terminalActivate +terminalBuffer terminalBuffer +terminalBusy terminalBusy +terminalClear terminalClear +terminalContext terminalContext +terminalCreate terminalCreate +terminalExecute terminalExecute +terminalExitCode terminalExitCode +terminalKill terminalKill +terminalList terminalList +terminalRunning terminalRunning +terminalSend terminalSend +terminalVisible terminalVisible +translateLocalUrl translateLocalUrl +unregisterChunkCallback chunk-callbacks +unregisterCommandCallback unregisterCommandCallback +updateDialog updateDialog +userDictionariesPath dictionaries +userIdentity userIdentity +verifyAvailable isAvailable +versionInfo versionInfo +viewer viewer +writePreference writePreference +writeRStudioPreference writeRStudioPreference diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/help/aliases.rds new file mode 100644 index 00000000..73ae865f Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/help/figures/logo.png b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/help/figures/logo.png new file mode 100644 index 00000000..b41033ed Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/help/figures/logo.png differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/help/figures/logo.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/help/figures/logo.svg new file mode 100644 index 00000000..5cf00ebf --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/help/figures/logo.svg @@ -0,0 +1,723 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/help/paths.rds new file mode 100644 index 00000000..37b7d821 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/help/rstudioapi.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/help/rstudioapi.rdb new file mode 100644 index 00000000..a3b7b563 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/help/rstudioapi.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/help/rstudioapi.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/help/rstudioapi.rdx new file mode 100644 index 00000000..60cdbc5d Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/help/rstudioapi.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/html/00Index.html new file mode 100644 index 00000000..99c802a6 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/html/00Index.html @@ -0,0 +1,420 @@ + + +R: Safely Access the RStudio API + + + +
+

Safely Access the RStudio API + +

+
+
+[Up] +[Top] +

Documentation for package ‘rstudioapi’ version 0.17.1

+ + + +

Help Pages

+ + +

+A +B +C +D +E +F +G +H +I +J +L +M +N +O +P +R +S +T +U +V +W +

+ + +

-- A --

+ + + + + + + + + + + + + + +
addThemeAdd a Custom Editor Theme
applyThemeApply an Editor Theme to RStudio
as.document_positionCreate a Document Position
as.document_rangeCreate a Range
askForPasswordAsk the user for a password interactively
askForSecretPrompt user for secret
+ +

-- B --

+ + + + + + + + + + + + +
bugReportFile an RStudio Bug Report
build-toolsBuild Tools
buildToolsCheckBuild Tools
buildToolsExecBuild Tools
buildToolsInstallBuild Tools
+ +

-- C --

+ + + + + + + + + + +
callFunCall an RStudio API function
chunk-callbacksRegister and Unregister a Chunk Callback
convertThemeConvert a tmTheme to an RStudio Theme
createProjectTemplateCreate a Project Template
+ +

-- D --

+ + + + + + + + + + + + + + + + + + + + + + + + +
dictionariesInteract with RStudio's Dictionaries
dictionariesPathInteract with RStudio's Dictionaries
documentCloseInteract with Documents open in RStudio
documentIdInteract with Documents open in RStudio
documentNewInteract with Documents open in RStudio
documentOpenInteract with Documents open in RStudio
documentPathInteract with Documents open in RStudio
documentSaveInteract with Documents open in RStudio
documentSaveAllInteract with Documents open in RStudio
document_positionCreate a Document Position
document_rangeCreate a Range
+ +

-- E --

+ + + + +
executeCommandExecute Command
+ +

-- F --

+ + + + + + + + +
file-dialogsSelect a file / folder
filesPaneNavigateNavigate to a Directory in the Files Pane
findFunExists/get for RStudio functions
+ +

-- G --

+ + + + + + + + + + + + + + + + + + + + + + + + +
getActiveDocumentContextRetrieve Information about an RStudio Editor
getActiveProjectRetrieve path to active RStudio project
getConsoleEditorContextRetrieve Information about an RStudio Editor
getDelegatedAzureTokenOAuth2 Tokens for Delegated Azure Resources
getModeReport whether RStudio Desktop or RStudio Server is in use
getPersistentValuePersistent keys and values
getRStudioPackageDependenciesGet RStudio Package Dependencies
getSourceEditorContextRetrieve Information about an RStudio Editor
getThemeInfoRetrieve Themes
getThemesGet Theme List
getVersionDetermine the version of RStudio
+ +

-- H --

+ + + + + + + + +
hasColorConsoleCheck if console supports ANSI color escapes.
hasFunExists/get for RStudio functions
highlightUiHighlight UI Elements within the RStudio IDE
+ +

-- I --

+ + + + + + + + + + + + + + + + + + +
initializeProjectOpen a project in RStudio
insertTextInteract with Documents open in RStudio
is.document_positionCreate a Document Position
is.document_rangeCreate a Range
isAvailableCheck if RStudio is running
isBackgroundJobDetect RStudio Jobs
isJobDetect RStudio Jobs
isWorkbenchJobDetect RStudio Jobs
+ +

-- J --

+ + + + + + + + + + + + + + + + + + + + + + +
jobAddAdd a Job
jobAddOutputAdd Background Job Output
jobAddProgressAdd Background Job Progress
jobGetStateGet Background Job State
jobListList Background Jobs
jobRemoveRemove a Background Job
jobRunScriptRun R Script As Background Job
jobSetProgressSet Background Job Progress
jobSetStateSet Background Job State
jobSetStatusSet Background Job Status
+ +

-- L --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
launcherAvailableCheck if Workbench Launcher is Available
launcherConfigDefine a Workbench Launcher Configuration
launcherContainerDefine a Workbench Launcher Container
launcherControlJobInteract with (Control) a Workbench Job
launcherGetInfoRetrieve Workbench Launcher Information
launcherGetJobRetrieve Workbench Job Information
launcherGetJobsRetrieve Workbench Job Information
launcherHostMountDefine a Workbench Launcher Host Mount
launcherNfsMountDefine a Workbench Launcher NFS Mount
launcherPlacementConstraintDefine a Workbench Launcher Placement Constraint
launcherResourceLimitDefine a Workbench Launcher Resource Limit
launcherSubmitJobSubmit a Workbench Job
launcherSubmitRExecute an R Script as a Workbench Job
+ +

-- M --

+ + + + +
modifyRangeInteract with Documents open in RStudio
+ +

-- N --

+ + + + +
navigateToFileNavigate to file
+ +

-- O --

+ + + + +
openProjectOpen a project in RStudio
+ +

-- P --

+ + + + + + + + + + + + +
persistent-valuesPersistent keys and values
previewRdPreview an Rd topic in the Help pane
previewSqlPreview SQL statement
primary_selectionExtract the Primary Selection
projectsOpen a project in RStudio
+ +

-- R --

+ + + + + + + + + + + + + + + + + + + + +
readPreferenceRead Preference
readRStudioPreferenceRead RStudio Preference
registerChunkCallbackRegister and Unregister a Chunk Callback
registerCommandCallbackRegister Command Callback
registerCommandStreamCallbackRegister Command Stream Callback
removeThemeRemove a custom theme from RStudio.
restartSessionRestart the R Session
rstudio-documentsInteract with Documents open in RStudio
rstudio-editorsRetrieve Information about an RStudio Editor
+ +

-- S --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
savePlotAsImageSave active RStudio plot image
selectDirectorySelect a file / folder
selectFileSelect a file / folder
selectionGetManipulate User Selections in the RStudio IDE
selectionsManipulate User Selections in the RStudio IDE
selectionSetManipulate User Selections in the RStudio IDE
sendToConsoleSend code to the R console
setCursorPositionInteract with Documents open in RStudio
setDocumentContentsInteract with Documents open in RStudio
setGhostTextSet ghost text
setPersistentValuePersistent keys and values
setSelectionRangesInteract with Documents open in RStudio
showDialogShow Dialog Box
showPromptShow Prompt Dialog Box
showQuestionShow Question Dialog Box
sourceMarkersDisplay source markers
systemUsernameGet System Username
+ +

-- T --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
terminalActivateActivate Terminal
terminalBufferGet Terminal Buffer
terminalBusyIs Terminal Busy
terminalClearClear Terminal Buffer
terminalContextRetrieve Information about RStudio Terminals
terminalCreateCreate a Terminal
terminalExecuteExecute Command
terminalExitCodeTerminal Exit Code
terminalKillKill Terminal
terminalListGet All Terminal Ids
terminalRunningIs Terminal Running
terminalSendSend Text to a Terminal
terminalVisibleGet Visible Terminal
translateLocalUrlTranslate Local URL
+ +

-- U --

+ + + + + + + + + + + + +
unregisterChunkCallbackRegister and Unregister a Chunk Callback
unregisterCommandCallbackUnregister Command Callback
updateDialogUpdates a Dialog Box
userDictionariesPathInteract with RStudio's Dictionaries
userIdentityGet User Identity
+ +

-- V --

+ + + + + + + + +
verifyAvailableCheck if RStudio is running
versionInfoRStudio version information
viewerView local web content within RStudio
+ +

-- W --

+ + + + + + +
writePreferenceWrite Preference
writeRStudioPreferenceWrite RStudio Preference
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/resources/bug-report.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/resources/bug-report.md new file mode 100644 index 00000000..27c92a49 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/rstudioapi/resources/bug-report.md @@ -0,0 +1,36 @@ + + +### System details + + RStudio Edition : ${RSTUDIO_EDITION} + RStudio Version : ${RSTUDIO_VERSION} + OS Version : ${OS_VERSION} + R Version : ${R_VERSION} + +### Steps to reproduce the problem + +### Describe the problem in detail + +### Describe the behavior you expected + + + + + +- [ ] I have read the guide for [submitting good bug reports](https://github.com/rstudio/rstudio/wiki/Writing-Good-Bug-Reports). +- [ ] I have installed the latest version of RStudio, and confirmed that the issue still persists. +- [ ] If I am reporting an RStudio crash, I have included a [diagnostics report](https://support.posit.co/hc/en-us/articles/200321257-Running-a-Diagnostics-Report). +- [ ] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/AUTHORS b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/AUTHORS new file mode 100644 index 00000000..d1fc9da1 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/AUTHORS @@ -0,0 +1,80 @@ +# stringi authors and contributors: + +* Marek Gagolewski (marek at gagolewski dot com) [aut,cre,cph] +* Bartek Tartanus [ctb] + +et al.; see . + + +# ICU source code contributors: + +ICU4C code has been contributed by Unicode, Inc., +and IBM employees, or by people under contract to IBM and Unicode, Inc. +Refer to https://icu.unicode.org/ for general information on the ICU project. + +The following lists the contributors included in +https://github.com/unicode-org/icu-docs/tree/main/legal/contributions, +see also the source files in the package's src/icu*/ directories +and https://github.com/unicode-org/icu/graphs/contributors. + +* Markus W. Scherer +* Steven R. Loomis +* @grhoten +* Alan Liu +* Yoshito Umaoka +* Ram Viswanadha +* Andy Heninger +* Peter Edberg +* @dougfelt +* John Emmons +* Shane F. Carr +* Mark Davis +* @keep94 +* Jeff Genovy +* Helena Shih Chapman +* Fredrik Roubert +* Sanjay Ghemawat +* Norbert Runge +* Frank Yung-Fong Tang +* Abhinav Gupta +* Hugo van der Merwe +* David Beaumont +* Younies Mahmoud +* Daniel Ju +* Bertrand A. Damiba +* Helena Shih +* Alan Liu +* Wilson Hsieh +* Mohamed Eldawy +* Laura Werner +* Mehran Mehr +* V. Weinstein +* D. Goldsmith +* Chen-Lieh Huang +* Dominic Ludlam +* Jonas Utterstrom +* Yves Arrouye +* Carl Brown +* Robert Buck +* Sean Hunter +* Michael Lecuyer +* Apple Computer +* Open Forum of Cambodia, represented by Javier Sola +* Software Ventures, Inc., represented by Scott Duchin +* Ge'ez Frontier Foundation, represented by Daniel Yacob +* Language Analysis Systems, Inc., represented by Richard T. Gillam + and Leonard A. Shaefer +* PalmSource, Inc., represented by Vivek Magotra; + contribution by Ken Krugler under PalmSource contract +* Department of Information Technology (DIT) - Royal Government of Bhutan, + represented by Pema Geyleg +* Adobe Systems Incorporated, represented by Niti Hantaweepant +* Yahoo!, Inc., represented by Badi Kumar Sudhakaran and Tex Texin +* Google, Inc. +* and others + + +# Unicode Character Database: + +UCD is provided and maintained by Unicode, Inc. +See http://www.unicode.org/copyright.html diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/CITATION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/CITATION new file mode 100644 index 00000000..44d75935 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/CITATION @@ -0,0 +1,12 @@ +bibentry( + bibtype = "article", + title = "{stringi}: {F}ast and portable character string processing in {R}", + author = c(person("Marek", "Gagolewski")), + journal = "Journal of Statistical Software", + year = "2022", + volume = "103", + number = "2", + pages = "1--59", + doi = "10.18637/jss.v103.i02", + header = "To cite stringi in publications, use:" +) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/DESCRIPTION new file mode 100644 index 00000000..302bbbb5 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/DESCRIPTION @@ -0,0 +1,41 @@ +Package: stringi +Version: 1.8.4 +Date: 2024-05-06 +Title: Fast and Portable Character String Processing Facilities +Description: A collection of character string/text/natural language + processing tools for pattern searching (e.g., with 'Java'-like regular + expressions or the 'Unicode' collation algorithm), random string generation, + case mapping, string transliteration, concatenation, sorting, padding, + wrapping, Unicode normalisation, date-time formatting and parsing, + and many more. They are fast, consistent, convenient, and - + thanks to 'ICU' (International Components for Unicode) - + portable across all locales and platforms. Documentation about 'stringi' is + provided via its website at and + the paper by Gagolewski (2022, ). +URL: https://stringi.gagolewski.com/, + https://github.com/gagolews/stringi, https://icu.unicode.org/ +BugReports: https://github.com/gagolews/stringi/issues +SystemRequirements: ICU4C (>= 61, optional) +Type: Package +Depends: R (>= 3.4) +Imports: tools, utils, stats +Biarch: TRUE +License: file LICENSE +Author: Marek Gagolewski [aut, cre, cph] (), + Bartek Tartanus [ctb], and others (stringi source code); + Unicode, Inc. and others (ICU4C source code, Unicode Character Database) +Maintainer: Marek Gagolewski +RoxygenNote: 7.2.3 +Encoding: UTF-8 +NeedsCompilation: yes +Packaged: 2024-05-06 12:50:25 UTC; gagolews +License_is_FOSS: yes +Repository: CRAN +Date/Publication: 2024-05-06 15:00:02 UTC +Built: R 4.4.1; aarch64-apple-darwin20; 2025-02-01 04:49:36 UTC; unix +RemoteType: standard +RemotePkgRef: stringi +RemoteRef: stringi +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 1.8.4 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/INDEX new file mode 100644 index 00000000..f7d1f6a7 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/INDEX @@ -0,0 +1,121 @@ +%s$% C-Style Formatting with 'stri_sprintf' as a + Binary Operator +%s+% Concatenate Two Character Vectors +%s<% Compare Strings with or without Collation +about_arguments Passing Arguments to Functions in 'stringi' +about_encoding Character Encodings and 'stringi' +about_locale Locales and 'stringi' +about_search String Searching +about_search_boundaries + Text Boundary Analysis in 'stringi' +about_search_charclass + Character Classes in 'stringi' +about_search_coll Locale-Sensitive Text Searching in 'stringi' +about_search_fixed Locale-Insensitive Fixed Pattern Matching in + 'stringi' +about_search_regex Regular Expressions in 'stringi' +about_stringi Fast and Portable Character String Processing + in R +stri_compare Compare Strings with or without Collation +stri_count Count the Number of Pattern Occurrences +stri_count_boundaries Count the Number of Text Boundaries +stri_datetime_add Date and Time Arithmetic +stri_datetime_create Create a Date-Time Object +stri_datetime_fields Get Values for Date and Time Fields +stri_datetime_format Date and Time Formatting and Parsing +stri_datetime_fstr Convert 'strptime'-Style Format Strings +stri_datetime_now Get Current Date and Time +stri_datetime_symbols List Localizable Date-Time Formatting Data +stri_detect Detect Pattern Occurrences +stri_dup Duplicate Strings +stri_duplicated Determine Duplicated Elements +stri_enc_detect Detect Character Set and Language +stri_enc_detect2 [DEPRECATED] Detect Locale-Sensitive Character + Encoding +stri_enc_fromutf32 Convert From UTF-32 +stri_enc_info Query a Character Encoding +stri_enc_isascii Check If a Data Stream Is Possibly in ASCII +stri_enc_isutf16be Check If a Data Stream Is Possibly in UTF-16 or + UTF-32 +stri_enc_isutf8 Check If a Data Stream Is Possibly in UTF-8 +stri_enc_list List Known Character Encodings +stri_enc_mark Get Declared Encodings of Each String +stri_enc_set Set or Get Default Character Encoding in + 'stringi' +stri_enc_toascii Convert To ASCII +stri_enc_tonative Convert Strings To Native Encoding +stri_enc_toutf32 Convert Strings To UTF-32 +stri_enc_toutf8 Convert Strings To UTF-8 +stri_encode Convert Strings Between Given Encodings +stri_escape_unicode Escape Unicode Code Points +stri_extract_all Extract Pattern Occurrences +stri_extract_all_boundaries + Extract Data Between Text Boundaries +stri_flatten Flatten a String +stri_info Query Default Settings for 'stringi' +stri_isempty Determine if a String is of Length Zero +stri_join Concatenate Character Vectors +stri_join_list Concatenate Strings in a List +stri_length Count the Number of Code Points +stri_list2matrix Convert a List to a Character Matrix +stri_locale_info Query Given Locale +stri_locale_list List Available Locales +stri_locale_set Set or Get Default Locale in 'stringi' +stri_locate_all Locate Pattern Occurrences +stri_locate_all_boundaries + Locate Text Boundaries +stri_match_all Extract Regex Pattern Matches, Together with + Capture Groups +stri_na2empty Replace NAs with Empty Strings +stri_numbytes Count the Number of Bytes +stri_opts_brkiter Generate a List with BreakIterator Settings +stri_opts_collator Generate a List with Collator Settings +stri_opts_fixed Generate a List with Fixed Pattern Search + Engine's Settings +stri_opts_regex Generate a List with Regex Matcher Settings +stri_order Ordering Permutation +stri_pad_both Pad (Center/Left/Right Align) a String +stri_rand_lipsum A Lorem Ipsum Generator +stri_rand_shuffle Randomly Shuffle Code Points in Each String +stri_rand_strings Generate Random Strings +stri_rank Ranking +stri_read_lines Read Text Lines from a Text File +stri_read_raw Read Text File as Raw +stri_remove_empty Remove All Empty Strings from a Character + Vector +stri_replace_all Replace Pattern Occurrences +stri_replace_na Replace Missing Values in a Character Vector +stri_replace_rstr Convert gsub-Style Replacement Strings +stri_reverse Reverse Each String +stri_sort String Sorting +stri_sort_key Sort Keys +stri_split Split a String By Pattern Matches +stri_split_boundaries Split a String at Text Boundaries +stri_split_lines Split a String Into Text Lines +stri_sprintf Format Strings +stri_startswith Determine if the Start or End of a String + Matches a Pattern +stri_stats_general General Statistics for a Character Vector +stri_stats_latex Statistics for a Character Vector Containing + LaTeX Commands +stri_sub Extract a Substring From or Replace a Substring + In a Character Vector +stri_sub_all Extract or Replace Multiple Substrings +stri_subset Select Elements that Match a Given Pattern +stri_timezone_get Set or Get Default Time Zone in 'stringi' +stri_timezone_info Query a Given Time Zone +stri_timezone_list List Available Time Zone Identifiers +stri_trans_char Translate Characters +stri_trans_general General Text Transforms, Including + Transliteration +stri_trans_list List Available Text Transforms and + Transliterators +stri_trans_nfc Perform or Check For Unicode Normalization +stri_trans_tolower Transform Strings with Case Mapping or Folding +stri_trim_both Trim Characters from the Left and/or Right Side + of a String +stri_unescape_unicode Un-escape All Escape Sequences +stri_unique Extract Unique Elements +stri_width Determine the Width of Code Points +stri_wrap Word Wrap Text to Format Paragraphs +stri_write_lines Write Text Lines to a Text File diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/LICENSE new file mode 100644 index 00000000..e9956fe7 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/LICENSE @@ -0,0 +1,493 @@ +# LICENSE + +******************************************************************************* + +# R and C++ source code of the stringi package + +``` +Copyright (c) 2013-2024, Marek Gagolewski +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +``` + + +# LaTeX Word Count Algorithm + +`stri_stats_latex()` in `src/stri_stats.cpp` uses a modified +Kile 2.1.3 LaTeX Word Count algorithm +(source file: `Kile/src/documentinfo.cpp`, +method: `void Info::count(const QString& line, long *stat)`), +see https://kile.sourceforge.io/. + +Copyright (C) 2013-2019 by the Kile Team (Holger Danielsson, Michel Ludwig, +Jeroen Wijnhout, and others). + +``` +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. +``` + + +# The ICU4C Library + +The files in `src/icu*/` are distributed under the following license. + +``` +UNICODE LICENSE V3 + +COPYRIGHT AND PERMISSION NOTICE + +Copyright © 2016-2023 Unicode, Inc. + +NOTICE TO USER: Carefully read the following legal agreement. BY +DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR +SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE +TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT +DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of data files and any associated documentation (the "Data Files") or +software and any associated documentation (the "Software") to deal in the +Data Files or Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, and/or sell +copies of the Data Files or Software, and to permit persons to whom the +Data Files or Software are furnished to do so, provided that either (a) +this copyright and permission notice appear with all copies of the Data +Files or Software, or (b) this copyright and permission notice appear in +associated Documentation. + +THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +THIRD PARTY RIGHTS. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE +BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, +OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA +FILES OR SOFTWARE. + +Except as contained in this notice, the name of a copyright holder shall +not be used in advertising or otherwise to promote the sale, use or other +dealings in these Data Files or Software without prior written +authorization of the copyright holder. + +---------------------------------------------------------------------- + +Third-Party Software Licenses + +This section contains third-party software notices and/or additional +terms for licensed third-party software components included within ICU +libraries. + +---------------------------------------------------------------------- + +ICU License - ICU 1.8.1 to ICU 57.1 + +COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 1995-2016 International Business Machines Corporation and others +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY +SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER +RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF +CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +of the copyright holder. + +All trademarks and registered trademarks mentioned herein are the +property of their respective owners. + +---------------------------------------------------------------------- + +Chinese/Japanese Word Break Dictionary Data (cjdict.txt) + + # The Google Chrome software developed by Google is licensed under + # the BSD license. Other software included in this distribution is + # provided under other licenses, as set forth below. + # + # The BSD License + # http://opensource.org/licenses/bsd-license.php + # Copyright (C) 2006-2008, Google Inc. + # + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are met: + # + # Redistributions of source code must retain the above copyright notice, + # this list of conditions and the following disclaimer. + # Redistributions in binary form must reproduce the above + # copyright notice, this list of conditions and the following + # disclaimer in the documentation and/or other materials provided with + # the distribution. + # Neither the name of Google Inc. nor the names of its + # contributors may be used to endorse or promote products derived from + # this software without specific prior written permission. + # + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + # + # + # The word list in cjdict.txt are generated by combining three word lists + # listed below with further processing for compound word breaking. The + # frequency is generated with an iterative training against Google web + # corpora. + # + # * Libtabe (Chinese) + # - https://sourceforge.net/project/?group_id=1519 + # - Its license terms and conditions are shown below. + # + # * IPADIC (Japanese) + # - http://chasen.aist-nara.ac.jp/chasen/distribution.html + # - Its license terms and conditions are shown below. + # + # ---------COPYING.libtabe ---- BEGIN-------------------- + # + # /* + # * Copyright (c) 1999 TaBE Project. + # * Copyright (c) 1999 Pai-Hsiang Hsiao. + # * All rights reserved. + # * + # * Redistribution and use in source and binary forms, with or without + # * modification, are permitted provided that the following conditions + # * are met: + # * + # * . Redistributions of source code must retain the above copyright + # * notice, this list of conditions and the following disclaimer. + # * . Redistributions in binary form must reproduce the above copyright + # * notice, this list of conditions and the following disclaimer in + # * the documentation and/or other materials provided with the + # * distribution. + # * . Neither the name of the TaBE Project nor the names of its + # * contributors may be used to endorse or promote products derived + # * from this software without specific prior written permission. + # * + # * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + # * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + # * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + # * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + # * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + # * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + # * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + # * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + # * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + # * OF THE POSSIBILITY OF SUCH DAMAGE. + # */ + # + # /* + # * Copyright (c) 1999 Computer Systems and Communication Lab, + # * Institute of Information Science, Academia + # * Sinica. All rights reserved. + # * + # * Redistribution and use in source and binary forms, with or without + # * modification, are permitted provided that the following conditions + # * are met: + # * + # * . Redistributions of source code must retain the above copyright + # * notice, this list of conditions and the following disclaimer. + # * . Redistributions in binary form must reproduce the above copyright + # * notice, this list of conditions and the following disclaimer in + # * the documentation and/or other materials provided with the + # * distribution. + # * . Neither the name of the Computer Systems and Communication Lab + # * nor the names of its contributors may be used to endorse or + # * promote products derived from this software without specific + # * prior written permission. + # * + # * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + # * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + # * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + # * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + # * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + # * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + # * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + # * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + # * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + # * OF THE POSSIBILITY OF SUCH DAMAGE. + # */ + # + # Copyright 1996 Chih-Hao Tsai @ Beckman Institute, + # University of Illinois + # c-tsai4@uiuc.edu http://casper.beckman.uiuc.edu/~c-tsai4 + # + # ---------------COPYING.libtabe-----END-------------------------------- + # + # + # ---------------COPYING.ipadic-----BEGIN------------------------------- + # + # Copyright 2000, 2001, 2002, 2003 Nara Institute of Science + # and Technology. All Rights Reserved. + # + # Use, reproduction, and distribution of this software is permitted. + # Any copy of this software, whether in its original form or modified, + # must include both the above copyright notice and the following + # paragraphs. + # + # Nara Institute of Science and Technology (NAIST), + # the copyright holders, disclaims all warranties with regard to this + # software, including all implied warranties of merchantability and + # fitness, in no event shall NAIST be liable for + # any special, indirect or consequential damages or any damages + # whatsoever resulting from loss of use, data or profits, whether in an + # action of contract, negligence or other tortuous action, arising out + # of or in connection with the use or performance of this software. + # + # A large portion of the dictionary entries + # originate from ICOT Free Software. The following conditions for ICOT + # Free Software applies to the current dictionary as well. + # + # Each User may also freely distribute the Program, whether in its + # original form or modified, to any third party or parties, PROVIDED + # that the provisions of Section 3 ("NO WARRANTY") will ALWAYS appear + # on, or be attached to, the Program, which is distributed substantially + # in the same form as set out herein and that such intended + # distribution, if actually made, will neither violate or otherwise + # contravene any of the laws and regulations of the countries having + # jurisdiction over the User or the intended distribution itself. + # + # NO WARRANTY + # + # The program was produced on an experimental basis in the course of the + # research and development conducted during the project and is provided + # to users as so produced on an experimental basis. Accordingly, the + # program is provided without any warranty whatsoever, whether express, + # implied, statutory or otherwise. The term "warranty" used herein + # includes, but is not limited to, any warranty of the quality, + # performance, merchantability and fitness for a particular purpose of + # the program and the nonexistence of any infringement or violation of + # any right of any third party. + # + # Each user of the program will agree and understand, and be deemed to + # have agreed and understood, that there is no warranty whatsoever for + # the program and, accordingly, the entire risk arising from or + # otherwise connected with the program is assumed by the user. + # + # Therefore, neither ICOT, the copyright holder, or any other + # organization that participated in or was otherwise related to the + # development of the program and their respective officials, directors, + # officers and other employees shall be held liable for any and all + # damages, including, without limitation, general, special, incidental + # and consequential damages, arising out of or otherwise in connection + # with the use or inability to use the program or any product, material + # or result produced or otherwise obtained by using the program, + # regardless of whether they have been advised of, or otherwise had + # knowledge of, the possibility of such damages at any time during the + # project or thereafter. Each user will be deemed to have agreed to the + # foregoing by his or her commencement of use of the program. The term + # "use" as used herein includes, but is not limited to, the use, + # modification, copying and distribution of the program and the + # production of secondary products from the program. + # + # In the case where the program, whether in its original form or + # modified, was distributed or delivered to or received by a user from + # any person, organization or entity other than ICOT, unless it makes or + # grants independently of ICOT any specific warranty to the user in + # writing, such person, organization or entity, will also be exempted + # from and not be held liable to the user for any such damages as noted + # above as far as the program is concerned. + # + # ---------------COPYING.ipadic-----END---------------------------------- + +---------------------------------------------------------------------- + +Lao Word Break Dictionary Data (laodict.txt) + + # Copyright (C) 2016 and later: Unicode, Inc. and others. + # License & terms of use: http://www.unicode.org/copyright.html + # Copyright (c) 2015 International Business Machines Corporation + # and others. All Rights Reserved. + # + # Project: https://github.com/rober42539/lao-dictionary + # Dictionary: https://github.com/rober42539/lao-dictionary/laodict.txt + # License: https://github.com/rober42539/lao-dictionary/LICENSE.txt + # (copied below) + # + # This file is derived from the above dictionary version of Nov 22, 2020 + # ---------------------------------------------------------------------- + # Copyright (C) 2013 Brian Eugene Wilson, Robert Martin Campbell. + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are met: + # + # Redistributions of source code must retain the above copyright notice, this + # list of conditions and the following disclaimer. Redistributions in binary + # form must reproduce the above copyright notice, this list of conditions and + # the following disclaimer in the documentation and/or other materials + # provided with the distribution. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + # OF THE POSSIBILITY OF SUCH DAMAGE. + # -------------------------------------------------------------------------- + +---------------------------------------------------------------------- + +Burmese Word Break Dictionary Data (burmesedict.txt) + + # Copyright (c) 2014 International Business Machines Corporation + # and others. All Rights Reserved. + # + # This list is part of a project hosted at: + # github.com/kanyawtech/myanmar-karen-word-lists + # + # -------------------------------------------------------------------------- + # Copyright (c) 2013, LeRoy Benjamin Sharon + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions + # are met: Redistributions of source code must retain the above + # copyright notice, this list of conditions and the following + # disclaimer. Redistributions in binary form must reproduce the + # above copyright notice, this list of conditions and the following + # disclaimer in the documentation and/or other materials provided + # with the distribution. + # + # Neither the name Myanmar Karen Word Lists, nor the names of its + # contributors may be used to endorse or promote products derived + # from this software without specific prior written permission. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS + # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + # SUCH DAMAGE. + # -------------------------------------------------------------------------- + +---------------------------------------------------------------------- + +Time Zone Database + + ICU uses the public domain data and code derived from Time Zone +Database for its time zone support. The ownership of the TZ database +is explained in BCP 175: Procedure for Maintaining the Time Zone +Database section 7. + + # 7. Database Ownership + # + # The TZ database itself is not an IETF Contribution or an IETF + # document. Rather it is a pre-existing and regularly updated work + # that is in the public domain, and is intended to remain in the + # public domain. Therefore, BCPs 78 [RFC5378] and 79 [RFC3979] do + # not apply to the TZ Database or contributions that individuals make + # to it. Should any claims be made and substantiated against the TZ + # Database, the organization that is providing the IANA + # Considerations defined in this RFC, under the memorandum of + # understanding with the IETF, currently ICANN, may act in accordance + # with all competent court orders. No ownership claims will be made + # by ICANN or the IETF Trust on the database or the code. Any person + # making a contribution to the database or code waives all rights to + # future claims in that contribution or in the TZ Database. + +---------------------------------------------------------------------- + +Google double-conversion + +Copyright 2006-2011, the V8 project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/Meta/Rd.rds new file mode 100644 index 00000000..eed2bf77 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/Meta/hsearch.rds new file mode 100644 index 00000000..9d3e064f Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/Meta/links.rds new file mode 100644 index 00000000..b0a0a7c6 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/Meta/nsInfo.rds new file mode 100644 index 00000000..feea02e5 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/Meta/package.rds new file mode 100644 index 00000000..bc3e8f37 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/NAMESPACE new file mode 100644 index 00000000..868bd66d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/NAMESPACE @@ -0,0 +1,265 @@ +# Generated by roxygen2: do not edit by hand + +export("%s!=%") +export("%s!==%") +export("%s$%") +export("%s*%") +export("%s+%") +export("%s<%") +export("%s<=%") +export("%s==%") +export("%s===%") +export("%s>%") +export("%s>=%") +export("%stri!=%") +export("%stri!==%") +export("%stri$%") +export("%stri*%") +export("%stri+%") +export("%stri<%") +export("%stri<=%") +export("%stri==%") +export("%stri===%") +export("%stri>%") +export("%stri>=%") +export("stri_datetime_add<-") +export("stri_sub<-") +export("stri_sub_all<-") +export("stri_subset<-") +export("stri_subset_charclass<-") +export("stri_subset_coll<-") +export("stri_subset_fixed<-") +export("stri_subset_regex<-") +export(stri_c) +export(stri_c_list) +export(stri_cmp) +export(stri_cmp_eq) +export(stri_cmp_equiv) +export(stri_cmp_ge) +export(stri_cmp_gt) +export(stri_cmp_le) +export(stri_cmp_lt) +export(stri_cmp_neq) +export(stri_cmp_nequiv) +export(stri_coll) +export(stri_compare) +export(stri_conv) +export(stri_count) +export(stri_count_boundaries) +export(stri_count_charclass) +export(stri_count_coll) +export(stri_count_fixed) +export(stri_count_regex) +export(stri_count_words) +export(stri_datetime_add) +export(stri_datetime_create) +export(stri_datetime_fields) +export(stri_datetime_format) +export(stri_datetime_fstr) +export(stri_datetime_now) +export(stri_datetime_parse) +export(stri_datetime_symbols) +export(stri_detect) +export(stri_detect_charclass) +export(stri_detect_coll) +export(stri_detect_fixed) +export(stri_detect_regex) +export(stri_dup) +export(stri_duplicated) +export(stri_duplicated_any) +export(stri_enc_detect) +export(stri_enc_detect2) +export(stri_enc_fromutf32) +export(stri_enc_get) +export(stri_enc_info) +export(stri_enc_isascii) +export(stri_enc_isutf16be) +export(stri_enc_isutf16le) +export(stri_enc_isutf32be) +export(stri_enc_isutf32le) +export(stri_enc_isutf8) +export(stri_enc_list) +export(stri_enc_mark) +export(stri_enc_set) +export(stri_enc_toascii) +export(stri_enc_tonative) +export(stri_enc_toutf32) +export(stri_enc_toutf8) +export(stri_encode) +export(stri_endswith) +export(stri_endswith_charclass) +export(stri_endswith_coll) +export(stri_endswith_fixed) +export(stri_escape_unicode) +export(stri_extract) +export(stri_extract_all) +export(stri_extract_all_boundaries) +export(stri_extract_all_charclass) +export(stri_extract_all_coll) +export(stri_extract_all_fixed) +export(stri_extract_all_regex) +export(stri_extract_all_words) +export(stri_extract_first) +export(stri_extract_first_boundaries) +export(stri_extract_first_charclass) +export(stri_extract_first_coll) +export(stri_extract_first_fixed) +export(stri_extract_first_regex) +export(stri_extract_first_words) +export(stri_extract_last) +export(stri_extract_last_boundaries) +export(stri_extract_last_charclass) +export(stri_extract_last_coll) +export(stri_extract_last_fixed) +export(stri_extract_last_regex) +export(stri_extract_last_words) +export(stri_flatten) +export(stri_info) +export(stri_isempty) +export(stri_join) +export(stri_join_list) +export(stri_length) +export(stri_list2matrix) +export(stri_locale_get) +export(stri_locale_info) +export(stri_locale_list) +export(stri_locale_set) +export(stri_locate) +export(stri_locate_all) +export(stri_locate_all_boundaries) +export(stri_locate_all_charclass) +export(stri_locate_all_coll) +export(stri_locate_all_fixed) +export(stri_locate_all_regex) +export(stri_locate_all_words) +export(stri_locate_first) +export(stri_locate_first_boundaries) +export(stri_locate_first_charclass) +export(stri_locate_first_coll) +export(stri_locate_first_fixed) +export(stri_locate_first_regex) +export(stri_locate_first_words) +export(stri_locate_last) +export(stri_locate_last_boundaries) +export(stri_locate_last_charclass) +export(stri_locate_last_coll) +export(stri_locate_last_fixed) +export(stri_locate_last_regex) +export(stri_locate_last_words) +export(stri_match) +export(stri_match_all) +export(stri_match_all_regex) +export(stri_match_first) +export(stri_match_first_regex) +export(stri_match_last) +export(stri_match_last_regex) +export(stri_na2empty) +export(stri_numbytes) +export(stri_omit_empty) +export(stri_omit_empty_na) +export(stri_omit_na) +export(stri_opts_brkiter) +export(stri_opts_collator) +export(stri_opts_fixed) +export(stri_opts_regex) +export(stri_order) +export(stri_pad) +export(stri_pad_both) +export(stri_pad_left) +export(stri_pad_right) +export(stri_paste) +export(stri_paste_list) +export(stri_printf) +export(stri_rand_lipsum) +export(stri_rand_shuffle) +export(stri_rand_strings) +export(stri_rank) +export(stri_read_lines) +export(stri_read_raw) +export(stri_remove_empty) +export(stri_remove_empty_na) +export(stri_remove_na) +export(stri_replace) +export(stri_replace_all) +export(stri_replace_all_charclass) +export(stri_replace_all_coll) +export(stri_replace_all_fixed) +export(stri_replace_all_regex) +export(stri_replace_first) +export(stri_replace_first_charclass) +export(stri_replace_first_coll) +export(stri_replace_first_fixed) +export(stri_replace_first_regex) +export(stri_replace_last) +export(stri_replace_last_charclass) +export(stri_replace_last_coll) +export(stri_replace_last_fixed) +export(stri_replace_last_regex) +export(stri_replace_na) +export(stri_replace_rstr) +export(stri_reverse) +export(stri_sort) +export(stri_sort_key) +export(stri_split) +export(stri_split_boundaries) +export(stri_split_charclass) +export(stri_split_coll) +export(stri_split_fixed) +export(stri_split_lines) +export(stri_split_lines1) +export(stri_split_regex) +export(stri_sprintf) +export(stri_startswith) +export(stri_startswith_charclass) +export(stri_startswith_coll) +export(stri_startswith_fixed) +export(stri_stats_general) +export(stri_stats_latex) +export(stri_string_format) +export(stri_sub) +export(stri_sub_all) +export(stri_sub_all_replace) +export(stri_sub_replace) +export(stri_sub_replace_all) +export(stri_subset) +export(stri_subset_charclass) +export(stri_subset_coll) +export(stri_subset_fixed) +export(stri_subset_regex) +export(stri_timezone_get) +export(stri_timezone_info) +export(stri_timezone_list) +export(stri_timezone_set) +export(stri_trans_casefold) +export(stri_trans_char) +export(stri_trans_general) +export(stri_trans_isnfc) +export(stri_trans_isnfd) +export(stri_trans_isnfkc) +export(stri_trans_isnfkc_casefold) +export(stri_trans_isnfkd) +export(stri_trans_list) +export(stri_trans_nfc) +export(stri_trans_nfd) +export(stri_trans_nfkc) +export(stri_trans_nfkc_casefold) +export(stri_trans_nfkd) +export(stri_trans_tolower) +export(stri_trans_totitle) +export(stri_trans_toupper) +export(stri_trim) +export(stri_trim_both) +export(stri_trim_left) +export(stri_trim_right) +export(stri_unescape_unicode) +export(stri_unique) +export(stri_width) +export(stri_wrap) +export(stri_write_lines) +importFrom(stats,rnorm) +importFrom(stats,runif) +importFrom(tools,md5sum) +importFrom(utils,download.file) +importFrom(utils,packageVersion) +importFrom(utils,unzip) +useDynLib(stringi, .registration = TRUE) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/NEWS b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/NEWS new file mode 100644 index 00000000..fb9f3af8 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/NEWS @@ -0,0 +1,1034 @@ +# Changelog + + +## 1.8.4 (2024-05-06) + +* [BUILD TIME] [BUGFIX] #508: Fixed build errors on Windows + (thanks to @jeoren and @kalibera). + + +## 1.8.3 (2023-12-10) + +* [BUILD TIME] [BUGFIX] Fixed the *format string is not a string literal + (potentially insecure)* warnings. + + +## 1.8.2 (2023-11-22) + +* [BUILD TIME] [BUGFIX] #501: Fixed failing build on 32-bit Windows + (Windows API `ResolveLocaleName` function not available). + +* [BUILD TIME] [BUGFIX] #502: `PKG_CPPFLAGS` are now considered + before other `CPPFLAGS` (the same with other flag types) in + the `configure` script to make it compatible with what happens in `Makevars`. + +* [BUILD TIME] [BUGFIX] Support for ICU's `double` conversion on Loongarch + has been restored (see #463). + + +## 1.8.1 (2023-11-09) + +* [GENERAL] ICU bundle updated to version 74.1 (Unicode 15.1, CLDR 44). + +* [BACKWARD INCOMPATIBILITY] [BUILD TIME] Support for Solaris has now been + dropped. The package is no longer shipped with the very outdated ICU55 bundle. + A compiler supporting at least C++11 as well as ICU >= 61 are now required. + +* [BACKWARD INCOMPATIBILITY] #469: Missing date-time fields in + `stri_datetime_parse` and `stri_datetime_create` now default to today's + midnight local time. + +* [BACKWARD INCOMPATIBILITY] Removed the long-deprecated and defunct + `fallback_encoding` parameter of `stri_read_lines` and the ellipsis + parameter of `stri_opts_collator`, `stri_opts_regex`, `stri_opts_fixed`, + `stri_opts_brkiter`, and `stri_opts_regex`. + +* [BUILD TIME] As per the suggestion of Prof. Brian Ripley, `icudt74l` + (ICU data - little endian) is now included in the source tarball (compressed + with xz to save space). This allows for building **`stringi`** on systems with + no internet access. + +* [NEW FEATURE] #476: In break iterator-, date-time-, and collator-based + operations (e.g., `stri_sort`), a warning is emitted when the *root* ICU + resource bundle is returned when using an *explicitly* requested locale. + This might happen when we pass an 'unknown' `locale` argument to these + functions. Note that when relying on the default `locale=NULL` argument, + no warning is emitted. In such a case, checking + if the default locale as returned by `stri_enc_get` is amongst + those listed in `stri_enc_list` is recommended. + +* [NEW FEATURE] The `C` locale identifier now resolves to `en_US_POSIX`. + +* [BUGFIX] #469: `stri_datetime_parse` did not reset the `Calendar` + object when parsing multiple dates. + +* [BUGFIX] #487: Some functions did not accept ASCII strings longer than + 858993457 characters on input. + + +## 1.7.12 (2023-01-09) + +* [BUGFIX] Fixed a few issues reported by `rchk`. + +* [NOTE] [BACKWARD INCOMPATIBLE CHANGE IF ICU >= 72] + If building against ICU >= 72, note a backward incompatible change: + `@` is no longer considered a word break; for more details, see + . + + +## 1.7.8 (2022-07-11) + +* [DOCUMENTATION] Paper on **`stringi`** has been published in + the *Journal of Statistical Software*; + see . + +* [BUGFIX] #473, #397: Fixed buffer overflow in `stri_dup`; Also, + `stri_dup`, `stri_paste`, ... fail more graciously on attempts to + generate strings of length >= 2^31 each. + +* [BUILD TIME] #480: Using `Rf_isNull` instead of `isNull`. + +* [DOCUMENTATION] #462: That the `numeric=TRUE` collator + does not handle negative numbers correctly is now mentioned in the manual. + + +## 1.7.6 (2021-11-29) + +* [BUILD TIME] #463: Added Loongarch support in ICU's double conversion + (@liuxiang88). + +* [BUGFIX] #467: The UCRT build on Windows was not marking strings as `latin1`. + + +## 1.7.5 (2021-10-04) + +* [DOCUMENTATION] Paper on **`stringi`** has been accepted for + publication in the *Journal of Statistical Software*, + see + for a draft version. + +* [DOCUMENTATION] The **`stringi`** website at + now features a comprehensive tutorial based on the aforementioned paper. + +* [DOCUMENTATION] The *ICU* Project site has been moved to + . + +* [BUILD TIME] #457: The `autoconf` macros `AC_LANG_CPLUSPLUS` + and `AC_TRY_COMPILE` were obsolete. + +* [BUGFIX] #458: Passing ALTREP objects no longer yields + 'embeded nul in string' errors. + + +## 1.7.4 (2021-08-12) + +* [BUGFIX] #449: Fixed segfaults generated by `stri_sprintf`. + +* [BUILD TIME] No longer defining `USE_RINTERNALS` and `R_NO_REMAP`. + + +## 1.7.3 (2021-07-15) + +* [BUGFIX] Fixed the previous patch of ICU55 causing a build failure on, + amongst others, CRAN's Solaris-based target. + + +## 1.7.2 (2021-07-14) + +* [BUGFIX] Workaround for a bug in `tools::checkFF` failing + when `NA_character_` is passed to `.Call`. + + +## 1.7.1 (2021-07-14) + +* [BACKWARD INCOMPATIBILITY] `%s$%` and `%stri$%` now use the new `stri_sprintf` + (see below) function instead of `base::sprintf`. + +* [BACKWARD INCOMPATIBILITY, NEW FEATURE] In `stri_sub<-` and `stri_sub_all<-`, + providing a negative `length` from now on does not result in the corresponding + input string being altered. + +* [BACKWARD INCOMPATIBILITY, NEW FEATURE] In `stri_sub` and `stri_sub_all`, + negative `length` results in the corresponding output being `NA` + or not extracted at all, depending on the setting of the new argument + `ignore_negative_length`. + +* [BACKWARD INCOMPATIBILITY, BUGFIX, NEW FEATURE] In `stri_subset*` + and their replacement versions, `pattern` and `value` cannot be longer + than `str` (but now they are recycled if necessary). + +* [BACKWARD INCOMPATIBILITY, NEW FEATURE] `stri_sub*` now accept the + `from` argument being a matrix like `cbind(from, length=length)`. + Unnamed columns or any other names are still interpreted as `cbind(from, to)`. + Also, the new argument `use_matrix` can be used to disable + the special treatment of such matrices. + +* [DOCUMENTATION] It has been clarified that the syntax of `*_charclass` + (e.g., used in `stri_trim*`) differs slightly from regex character + classes. + +* [NEW FEATURE] #420: `stri_sprintf` (alias: `stri_string_format`) + is a Unicode-aware replacement for and enhancement of the base `sprintf`: + it adds a customised handling of `NA`s (on demand), computing field size + based on code point width, outputting substrings of at most given width, + variable width and precision (both at the same time), etc. Moreover, + `stri_printf` can be used to display formatted strings conveniently. + +* [NEW FEATURE] #153: `stri_match_*_regex` now extract capture group names. + +* [NEW FEATURE] #25: `stri_locate_*_regex` now have a new argument, + `capture_groups`, which allows for extracting positions of matches + to parenthesised subexpressions. + +* [NEW FEATURE] `stri_locate_*` now have a new argument, `get_length`, + whose setting may result in generating *from-length* matrices + (instead of *from-to* ones). + +* [NEW FEATURE] #438: `stri_trans_general` now supports rule-based + as well as reverse-direction transliteration. + +* [NEW FEATURE] #434: `stri_datetime_format` and `stri_datetime_parse` + are now vectorised also with respect to the `format` argument. + +* [NEW FEATURE] `stri_datetime_fstr` has a new argument, `ignore_special`, + which defaults to `TRUE` for backward compatibility. + +* [NEW FEATURE] `stri_datetime_format`, `stri_datetime_add`, and + `stri_datetime_fields` now call `as.POSIXct` more eagerly. + +* [NEW FEATURE] `stri_trim*` now have a new argument, `negate`. + +* [NEW FEATURE] `stri_replace_rstr` converts `gsub`-style replacement strings + to `stri_replace`-style. + +* [INTERNAL] `stri_prepare_arg*` have been refactored, buffer overruns + in the exception handling subsystem are now avoided. + +* [BUGFIX] Few functions (`stri_length`, `stri_enc_toutf32`, etc.) + did not throw an exception on an invalid UTF-8 + byte sequence (and merely issued a warning instead). + +* [BUGFIX] `stri_datetime_fstr` did not honour `NA_character_` + and did not parse format strings such as `"%Y%m%d"` correctly. + It has now been completely rewritten (in C). + +* [BUGFIX] `stri_wrap` did not recognise the width of certain Unicode sequences + correctly. + + +## 1.6.2 (2021-05-14) + +* [BACKWARD INCOMPATIBILITY] In `stri_enc_list()`, + `simplify` now defaults to `TRUE`. + +* [NEW FEATURE] #425: The outputs of `stri_enc_list()`, `stri_locale_list()`, + `stri_timezone_list()`, and `stri_trans_list()` are now sorted. + +* [NEW FEATURE] #428: In `stri_flatten`, `na_empty=NA` now omits missing values. + +* [BUILD TIME] #431: Pre-4.9.0 GCC has `::max_align_t`, + but not `std::max_align_t`, added a (possible) workaround, see the `INSTALL` + file. + +* [BUGFIX] #429: `stri_width()` misclassified the width of certain + code points (including grave accent, Eszett, etc.); + General category *Sk* (Symbol, modifier) is no longer of width 0, + `UCHAR_EAST_ASIAN_WIDTH` of `U_EA_AMBIGUOUS` is no longer of width 2. + +* [BUGFIX] #354: `ALTREP` `CHARSXP`s were not copied, and thus could have been + garbage collected in the so-called meanwhile (with thanks to @jimhester). + + +## 1.6.1 (2021-05-05) + +* [GENERAL] #401: stringi is now bundled with ICU4C 69.1 (upgraded from 61.1), + which is used on most Windows and OS X builds as well as on *nix systems + not equipped with system ICU. However, if the C++11 support is disabled, + stringi will be built against the battle-tested ICU4C 55.1. + The update to ICU brings Unicode 13.0 and CLDR 39 support. + +* [DOCUMENTATION] A draft version of a paper on **`stringi`** is now available + at . + +* [GENERAL] stringi now requires R >= 3.1 (`CXX_STD` of `CXX11` or `CXX1X`). + +* [NEW FEATURE] #408: `stri_trans_casefold()` performs case folding; + this is different from case mapping, which is locale-dependent. + Folding makes two pieces of text that differ only in case identical. + This can come in handy when comparing strings. + +* [NEW FEATURE] #421: `stri_rank()` ranks strings in a character vector + (e.g., for ordering data frames with regards to multiple criteria, + the ranks can be passed to `order()`, see #219). + +* [NEW FEATURE] #266: `stri_width()` now supports emojis. + +* [NEW FEATURE] `%s$%` and `%stri$%` are now vectorised with respect to + both arguments. + +* [BUGFIX] `stri_sort_key()` now outputs `bytes`-encoded strings. + +* [BUGFIX] #415: `locale=''` was not equivalent to `locale=NULL` + in `stri_opts_collator()`. + +* [INTERNAL] #414: Use `LEVELS(x)` macro instead of accessing `(x)->sxpinfo.gp` + directly (@lukaszdaniel). + + +## 1.5.3 (2020-09-04) + +* [DOCUMENTATION] stringi home page has moved to + and now includes a comprehensive reference + manual. + +* [NEW FEATURE] #400: `%s$%` and `%stri$%` are now binary operators + that call base R's `sprintf()`. + +* [NEW FEATURE] #399: The `%s*%` and `%stri*%` operators can be used + in addition to `stri_dup()`, for the very same purpose. + +* [NEW FEATURE] #355: `stri_opts_regex()` now accepts the `time_limit` and + `stack_limit` options so as to prevent malformed or malicious regexes + from running for too long. + +* [NEW FEATURE] #345: `stri_startswith()` and `stri_endswith()` are now equipped + with the `negate` parameter. + +* [NEW FEATURE] #382: Incorrect regexes are now reported to ease debugging. + +* [DEPRECATION WARNING] #347: Any unknown option passed to `stri_opts_fixed()`, + `stri_opts_regex()`, `stri_opts_coll()`, and `stri_opts_brkiter()` now + generates a warning. In the future, the `...` parameter will be removed, + so that will be an error. + +* [DEPRECATION WARNING] `stri_duplicated()`'s `fromLast` argument + has been renamed `from_last`. `fromLast` is now its alias scheduled + for removal in a future version of the package. + +* [DEPRECATION WARNING] `stri_enc_detect2()` + is scheduled for removal in a future version of the package. + Use `stri_enc_detect()` or the more targeted `stri_enc_isutf8()`, + `stri_enc_isascii()`, etc., instead. + +* [DEPRECATION WARNING] `stri_read_lines()`, `stri_write_lines()`, + `stri_read_raw()`: use `con` argument instead of `fname` now. + The argument `fallback_encoding` is scheduled for removal and is no longer + used. `stri_read_lines()` does not support `encoding="auto"` anymore. + +* [DEPRECATION WARNING] `nparagraphs` in `stri_rand_lipsum()` has been renamed + `n_paragraphs`. + +* [NEW FEATURE] #398: Alternative, British spelling of function parameters + has been introduced, e.g., `stri_opts_coll()` now supports both + `normalization` and `normalisation`. + +* [NEW FEATURE] #393: `stri_read_bin()`, `stri_read_lines()`, and + `stri_write_lines()` are no longer marked as draft API. + +* [NEW FEATURE] #187: `stri_read_bin()`, `stri_read_lines()`, and + `stri_write_lines()` now support connection objects as well. + +* [NEW FEATURE] #386: New function `stri_sort_key()` for generating + locale-dependent sort keys which can be ordered at the byte level and + return an equivalent ordering to the original string (@DavisVaughan). + +* [BUGFIX] #138: `stri_encode()` and `stri_rand_strings()` + now can generate strings of much larger lengths. + +* [BUGFIX] `stri_wrap()` did not honour `indent` correctly when + `use_width` was `TRUE`. + + +## 1.4.6 (2020-02-17) + +* [BACKWARD INCOMPATIBILITY] #369: `stri_c()` now returns an empty string +when input is empty and `collapse` is set. + +* [BUGFIX] #370: fixed an issue in `stri_prepare_arg_POSIXct()` +reported by rchk. + +* [DOCUMENTATION] #372: documented arguments not in `\usage` in +documentation object `stri_datetime_format`: `...` + + +## 1.4.5 (2020-01-11) + +* [BUGFIX] #366: fix for #363 required ICU >= 55 . + + +## 1.4.4 (2020-01-06) + +* [BUGFIX] #348: Avoid copying 0 bytes to a nil-buffer in `stri_sub_all()`. + +* [BUGFIX] #362: Removed `configure` variable `CXXCPP` as it is now deprecated. + +* [BUGFIX] #318: PROTECTing objects from gcing as reported by `rchk`. + +* [BUGFIX] #344, #364: Removed compiler warnings in icu61/common/cstring.h. + +* [BUGFIX] #363: Status of `RegexMatcher` is now checked after its use. + + +## 1.4.3 (2019-03-12) + +* [NEW FEATURE] #30: New function `stri_sub_all()` - a version of + `stri_sub()` accepting list `from`/`to`/`length` arguments for extracting + multiple substrings from each string in a character vector. + +* [NEW FEATURE] #30: New function `stri_sub_all<-()` (and its `%<%`-friendly + version, `stri_sub_replace_all()`) - for replacing multiple substrings + with corresponding replacement strings. + +* [NEW FEATURE] In `stri_sub_replace()`, `value` parameter + has a new alias, `replacement`. + +* [NEW FEATURE] New convenience functions based on `stri_remove_empty()`: + `stri_omit_empty_na()`, `stri_remove_empty_na()`, `stri_omit_empty()`, + and also `stri_remove_na()`, `stri_omit_na()`. + +* [BUGFIX] #343: `stri_trans_char()` did not yield correct results + for overlapping pattern and replacement strings. + +* [WARNFIX] #205: `configure.ac` is now included in the source bundle. + + +## 1.3.1 (2019-02-10) + +* [BACKWARD INCOMPATIBILITY] #335: A fix to #314 prevented (by design) the use + of the system ICU if the library had been compiled with `U_CHARSET_IS_UTF8=1`. + However, this is the default setting in `libicu`>=61. From now on, in such + cases the system ICU is used more eagerly, but `stri_enc_set()` issues + a warning stating that the default (UTF-8) encoding cannot be changed. + +* [NEW FEATURE] #232: All `stri_detect_*` functions now have the `max_count` + argument that allows for, e.g., stopping at the first pattern occurrence. + +* [NEW FEATURE] #338: `stri_sub_replace()` is now an alias for `stri_sub<-()` + which makes it much more easily pipable (@yutannihilation, @BastienFR). + +* [NEW FEATURE] #334: Added missing `icudt61b.dat` to support big-endian + platforms (thanks to Dimitri John Ledkov @xnox). + +* [BUGFIX] #296: Out-of-the box build used to fail on CentOS 6, upgraded + `configure` to `--disable-cxx11` more eagerly at an early stage. + +* [BUGFIX] #341: Fixed possible buffer overflows when calling `strncpy()` + from within ICU 61. + +* [BUGFIX] #325: Made `configure` more portable so that it works + under `/bin/dash` now. + +* [BUGFIX] #319: Fixed overflow in `stri_rand_shuffle()`. + +* [BUGFIX] #337: Empty search patterns in search functions (e.g., + `stri_split_regex()` and `stri_count_fixed()`) used to raise + too many warnings on empty search patterns. + + +## 1.2.4 (2018-07-20) + +* [BUGFIX] #314: Testing `U_CHARSET_IS_UTF8` in `configure` when + using `pkg-build`. + +* [BUILD TIME] #317: Included `icudt61l.zip` in the source bundle to solve + the frequent `icudt download failed` error (also on CRAN's `windows-release` + and `windows-oldrel`). (reverted in version 1.3.1, the `winbuilder` + errors were caused by a build chain bug). + + +## 1.2.3 (2018-05-16) + +* [BUGFIX] #296: Fixed the behaviour of the `configure` script on CentOS 6. + +* [BUGFIX] Fixed broken Windows build by updating the `icudt` mirror list. + + +## 1.2.2 (2018-05-01) + +* [GENERAL] #193: stringi is now bundled with ICU4C 61.1, + which is used on most Windows and OS X builds as well as on *nix systems + not equipped with ICU. However, if the C++11 support is disabled, + stringi will be built against ICU4C 55.1. The update to ICU brings + Unicode 10.0 support, including new emoji characters. + +* [BUGFIX] #288: `stri_match()` did not return the correct number of columns + when input was empty. + +* [NEW FEATURE] #188: `stri_enc_detect()` now returns a list of data frames. + +* [NEW FEATURE] #289: `stri_flatten()` how has `na_empty` and `omit_empty` + arguments. + +* [NEW FEATURE] New functions: `stri_remove_empty()`, `stri_na2empty()`. + +* [NEW FEATURE] #285: Coercion from a non-trivial list (one that consists + of atomic vectors, each of length 1) to an atomic vector now issues a warning. + +* [WARN] Removed `-Wparentheses` warnings in `icu55/common/cstring.h:38:63` + and `icu55/i18n/windtfmt.cpp` in the ICU4C 55.1 bundle. + + +## 1.1.7 (2018-03-06) + +* [BUGFIX] Fixed ICU4C 55.1 generating some *significant warnings* + (`icu55/i18n/winnmfmt.cpp`) and *suppressing important diagnostics* + (`src/icu55/i18n/decNumber.c`). + + +## 1.1.6 (2017-11-10) + +* [WINDOWS SPECIFIC] #270: Strings marked with `latin1` encoding + are now converted internally to UTF-8 using the WINDOWS-1252 codec. + This fixes problems with - among others - displaying the Euro sign. + +* [NEW FEATURE] #263: Added support for custom rule-based break iteration, + see `?stri_opts_brkiter`. + +* [NEW FEATURE] #267: `omit_na=TRUE` in `stri_sub<-()` now ignores missing + values in any of the arguments provided. + +* [BUGFIX] Fixed unPROTECTed variable names and stack imbalances + as reported by `rchk`. + + +## 1.1.5 (2017-04-07) + +* [GENERAL] stringi now requires ICU4C >= 52. + +* [BUGFIX] Fixed errors pointed out by `clang-UBSAN` in `stri_brkiter.h`. + +* [GENERAL] stringi now requires R >= 2.14. + +* [BUILD TIME] #238, #220: Now trying *standard* ICU4C build flags if a call + to `pkg-config` fails. + +* [BUILD TIME] #258: Use `CXX11` instead of `CXX1X` on R >= 3.4. + +* [BUILD TIME, BUGFIX] #254: `dir.exists()` is R >= 3.2. + + +## 1.1.3 (2017-03-21) + +* [REMOVE DEPRECATED] `stri_install_check()` and `stri_install_icudt()` + marked as deprecated in stringi 0.5-5 are no longer being exported. + +* [BUGFIX] #227: Incorrect behaviour of `stri_sub()` and `stri_sub<-()` + if the empty string was the result. + +* [BUILD TIME] #231: The `configure` (Linux/Unix only) script now reads the + following environment variables: `STRINGI_CFLAGS`, `STRINGI_CPPFLAGS`, + `STRINGI_CXXFLAGS`, `STRINGI_LDFLAGS`, `STRINGI_LIBS`, + `STRINGI_DISABLE_CXX11`, `STRINGI_DISABLE_ICU_BUNDLE`, + `STRINGI_DISABLE_PKG_CONFIG`, `PKG_CONFIG`, + see `INSTALL` for more information. + +* [BUILD TIME] #253: Call to `R_useDynamicSymbols()` added. + +* [BUILD TIME] #230: `icudt` is now being downloaded by + `configure` (*NIX only) *before* building. + +* [BUILD TIME] #242: `_COUNT/_LIMIT` enum constants have been deprecated + as of ICU 58.2, stringi code has been upgraded accordingly. + + +## 1.1.2 (2016-09-30) + +* [BUGFIX] `round()`, `snprintf()` is not C++98. + + +## 1.1.1 (2016-05-25) + +* [BUGFIX] #214: Allow a regex pattern like `.*` to match an empty string. + +* [BUGFIX] #210: `stri_replace_all_fixed(c("1", "NULL"), "NULL", NA)` + now results in `c("1", NA)`. + +* [NEW FEATURE] #199: `stri_sub<-()` now allows for ignoring `NA` locations + (a new `omit_na` argument added). + +* [NEW FEATURE] #207: `stri_sub<-()` now allows for substring insertions + (via `length=0`). + +* [NEW FUNCTION] #124: `stri_subset<-()` functions added. + +* [NEW FEATURE] #216: `stri_detect()`, `stri_subset()`, `stri_subset<-()` + now all have the `negate` argument. + +* [NEW FUNCTION] #175: `stri_join_list()` concatenates all strings + in a list of character vectors. Useful in conjunction with, e.g., + `stri_extract_all_regex()`, `stri_extract_all_words()`, etc. + + +## 1.0-1 (2015-10-22) + +* [GENERAL] #88: C API is now available for use in, e.g., Rcpp packages, see + for an example. + +* [BUGFIX] #183: Floating point exception raised in `stri_sub()` and + `stri_sub<-()` when `to` or `length` was a zero-length numeric vector. + +* [BUGFIX] #180: `stri_c()` warned incorrectly (recycling rule) when using more + than two elements. + + +## 0.5-5 (2015-06-28) + +* [BACKWARD INCOMPATIBILITY] `stri_install_check()` and `stri_install_icudt()` + are now deprecated. From now on they are supposed to be used only + by the stringi installer. + +* [BUGFIX] #176: A patch for `sys/feature_tests.h` no longer included + (the original file was copyrighted by Sun Microsystems); fixed the *Compiler + or options invalid for pre-Unix 03 X/Open applications and pre-2001 POSIX + applications* error by forcing (conditionally) `_XPG6` conformance. + +* [BUGFIX] #174: `stri_paste()` did not generate any warning when + the recycling rule is violated and `sep==""`. + +* [BUGFIX] #170: `icu::setDataDirectory` is no longer called if our ICU + source bundle is not used (this used to cause build problems on openSUSE). + +* [BUILD TIME] #169: `configure` now tries to switch to the *standard* + C++ compiler if a C++11 one is not configured correctly. + +* [BUILD TIME] `configure.win` (`Biarch: TRUE`) now mimics `autoconf`'s + `AC_SUBST` and `AC_CONFIG_FILES` so that the build process is now + more similar across different platforms. + +* [NEW FEATURE] `stri_info()` now also gives information about which version + of ICU4C is in use (system or bundle). + + +## 0.5-2 (2015-06-21) + +* [BACKWARD INCOMPATIBILITY] The second argument to `stri_pad_*()` has + been renamed `width`. + +* [GENERAL] #69: stringi is now bundled with ICU4C 55.1. + +* [NEW FUNCTIONS] `stri_extract_*_boundaries()` extract text between text + boundaries. + +* [NEW FUNCTION] #46: `stri_trans_char()` is a stringi-flavoured + `chartr()` equivalent. + +* [NEW FUNCTION] #8: `stri_width()` approximates the *width* of a string + in a more Unicode-ish fashion than `nchar(..., "width")` + +* [NEW FEATURE] #149: `stri_pad()` and `stri_wrap()` is now (by default) + based on code point widths instead of the number of code points. + Moreover, the default behaviour of `stri_wrap()` is now such that it + does not get rid of non-breaking, zero width, etc., spaces. + +* [NEW FEATURE] #133: `stri_wrap()` silently allows for `width <= 0` + (for compatibility with `strwrap()`). + +* [NEW FEATURE] #139: `stri_wrap()` gained a new argument: `whitespace_only`. + +* [NEW FUNCTIONS] #137: Date-time formatting/parsing: + + * `stri_timezone_list()` - lists all known time zone identifiers; + * `stri_timezone_set()`, `stri_timezone_get()` - manage the current + default time zone; + * `stri_timezone_info()` - basic information on a given time zone; + * `stri_datetime_symbols()` - gives localizable date-time formatting data; + * `stri_datetime_fstr()` - converts a `strptime`-like format string + to an ICU date/time format string; + * `stri_datetime_format()` - converts date/time to string; + * `stri_datetime_parse()` - converts string to date/time object; + * `stri_datetime_create()` - constructs date-time objects + from numeric representations; + * `stri_datetime_now()` - returns current date-time; + * `stri_datetime_fields()` - returns date-time fields' values; + * `stri_datetime_add()` - adds specific number of date-time units + to a date-time object. + +* [GENERAL] #144: Performance improvements in handling ASCII strings + (these affect `stri_sub()`, `stri_locate()` and other string index-based + operations) + +* [GENERAL] #143: Searching for short fixed patterns (`stri_*_fixed()`) now + relies on the current `libC`'s implementation of `strchr()` and `strstr()`. + This is very fast, e.g., on `glibc` using the `SSE2/3/4` instruction set. + +* [BUILD TIME] #141: A local copy of `icudt*.zip` may be used on package + install; see the `INSTALL` file for more information. + +* [BUILD TIME] #165: The `configure` option `--disable-icu-bundle` + forces the use of system ICU when building the package. + +* [BUGFIX] Locale specifiers are now normalized in a more intelligent way: + e.g., `@calendar=gregorian` expands to `DEFAULT_LOCALE@calendar=gregorian`. + +* [BUGFIX] #134: `stri_extract_all_words()` did not accept `simplify=NA`. + +* [BUGFIX] #132: Incorrect behaviour in `stri_locate_regex()` for matches + of zero lengths. + +* [BUGFIX] stringr/#73: `stri_wrap()` returned `CHARSXP` instead of `STRSXP` + on empty string input with `simplify=FALSE` argument. + +* [BUGFIX] #164: Using `libicu-dev` failed on Ubuntu + (`LIBS` shall be passed after `LDFLAGS` and the list of `.o` files). + +* [BUGFIX] #168: Build now fails if `icudt` is not available. + +* [BUGFIX] #135: C++11 is now used by default (see the `INSTALL` file, + however) to build stringi from sources. This is because ICU4C uses the + `long long` type which is not part of the C++98 standard. + +* [BUGFIX] #154: Dates and other objects with a custom class attribute + were not coerced to the character type correctly. + +* [BUGFIX] Force ICU `u_init()` call on the stringi dynlib load. + +* [BUGFIX] #157: Many overfull `hbox`es in the package PDF manual have been + corrected. + + +## 0.4-1 (2014-12-11) + +* [IMPORTANT CHANGE] `n_max` argument in `stri_split_*()` has been renamed `n`. + +* [IMPORTANT CHANGE] `simplify=FALSE` in `stri_extract_all_*()` and + `stri_split_*()` now calls `stri_list2matrix()` with `fill=""`. + `fill=NA_character_` may be obtained by using `simplify=NA`. + +* [IMPORTANT CHANGE, NEW FUNCTIONS] #120: `stri_extract_words()` has been + renamed `stri_extract_all_words()` and `stri_locate_boundaries()` - + `stri_locate_all_boundaries()` as well as `stri_locate_words()` - + `stri_locate_all_words()`. New functions are now available: + `stri_locate_first_boundaries()`, `stri_locate_last_boundaries()`, + `stri_locate_first_words()`, `stri_locate_last_words()`, + `stri_extract_first_words()`, `stri_extract_last_words()`. + +* [IMPORTANT CHANGE] #111: `opts_regex`, `opts_collator`, `opts_fixed`, and + `opts_brkiter` can now be supplied individually via `...`. + In other words, you may now simply call, e.g., + `stri_detect_regex(str, pattern, case_insensitive=TRUE)` instead of + `stri_detect_regex(str, pattern, + opts_regex=stri_opts_regex(case_insensitive=TRUE))`. + +* [NEW FEATURE] #110: Fixed pattern search engine's settings can + now be supplied via `opts_fixed` argument in `stri_*_fixed()`, + see `stri_opts_fixed()`. A simple (not suitable for natural language + processing) yet very fast `case_insensitive` pattern matching can be + performed now. `stri_extract_*_fixed()` is again available. + +* [NEW FEATURE] #23: `stri_extract_all_fixed()`, `stri_count()`, and + `stri_locate_all_fixed()` may now also look for overlapping pattern + matches, see `?stri_opts_fixed`. + +* [NEW FEATURE] #129: `stri_match_*_regex()` gained a `cg_missing` argument. + +* [NEW FEATURE] #117: `stri_extract_all_*()`, `stri_locate_all_*()`, + `stri_match_all_*()` gained a new argument: `omit_no_match`. + Setting it to `TRUE` makes these functions compatible with their + **`stringr`** equivalents. + +* [NEW FEATURE] #118: `stri_wrap()` gained `indent`, `exdent`, `initial`, + and `prefix` arguments. Moreover, Knuth's dynamic word wrapping algorithm + now assumes that the cost of printing the last line is zero, see #128. + +* [NEW FEATURE] #122: `stri_subset()` gained an `omit_na` argument. + +* [NEW FEATURE] `stri_list2matrix()` gained an `n_min` argument. + +* [NEW FEATURE] #126: `stri_split()` is now also able to act + just like `stringr::str_split_fixed()`. + +* [NEW FEATURE] #119: `stri_split_boundaries()` now has + `n`, `tokens_only`, and `simplify` arguments. Additionally, + `stri_extract_all_words()` is now equipped with `simplify` arg. + +* [NEW FEATURE] #116: `stri_paste()` gained a new argument: + `ignore_null`. Setting it to `TRUE` makes this function more compatible + with `paste()`. + +* [OTHER] #123: `useDynLib` is used to speed up symbol look-up in + the compiled dynamic library. + +* [BUGFIX] #114: `stri_paste()`: could return result in an incorrect order. + +* [BUGFIX] #94: Run-time errors on Solaris caused by setting + `-DU_DISABLE_RENAMING=1` - memory allocation errors in, among others, + the ICU `UnicodeString`. This setting also caused some `ASAN` sanity check + failures within ICU code. + + +## 0.3-1 (2014-11-06) + +* [IMPORTANT CHANGE] #87: `%>%` overlapped with the pipe operator from + the `magrittr` package; now each operator like `%>%` has been renamed `%s>%`. + +* [IMPORTANT CHANGE] #108: Now the `BreakIterator` (for text boundary analysis) + may be more easily controlled via `stri_opts_brkiter()` (see options `type` + and `locale` which aim to replace now-removed `boundary` and `locale` + parameters to `stri_locate_boundaries()`, `stri_split_boundaries()`, + `stri_trans_totitle()`, `stri_extract_words()`, and `stri_locate_words()`). + +* [NEW FUNCTIONS] #109: `stri_count_boundaries()` and `stri_count_words()` + count the number of text boundaries in a string. + +* [NEW FUNCTIONS] #41: `stri_startswith_*()` and `stri_endswith_*()` + determine whether a string starts or ends with a given pattern. + +* [NEW FEATURE] #102: `stri_replace_all_*()` now all have the `vectorize_all` + parameter, which defaults to `TRUE` for backward compatibility. + +* [NEW FUNCTION] #91: Added `stri_subset_*()` - a convenient and more efficient + substitute for `str[stri_detect_*(str, ...)]`. + +* [NEW FEATURE] #100: `stri_split_fixed()`, `stri_split_charclass()`, + `stri_split_regex()`, `stri_split_coll()` gained a `tokens_only` parameter, + which defaults to `FALSE` for backward compatibility. + +* [NEW FUNCTION] #105: `stri_list2matrix()` converts lists of atomic vectors + to character matrices, useful in conjunction with `stri_split()` + and `stri_extract()`. + +* [NEW FEATURE] #107: `stri_split_*()` now allow + setting an `omit_empty=NA` argument. + +* [NEW FEATURE] #106: `stri_split()` and `stri_extract_all()` + gained a `simplify` argument + (if `TRUE`, then `stri_list2matrix(..., byrow=TRUE)` + is called on the resulting list). + +* [NEW FUNCTION] #77: `stri_rand_lipsum()` generates + a (pseudo)random dummy *lorem ipsum* text. + +* [NEW FEATURE] #98: `stri_trans_totitle()` gained a `opts_brkiter` + parameter; it indicates which ICU `BreakIterator` should be used when + case mapping. + +* [NEW FEATURE] `stri_wrap()` gained a new parameter: `normalize`. + +* [BUGFIX] #86: `stri_*_fixed()`, `stri_*_coll()`, and `stri_*_regex()` could + give incorrect results if one of search strings were of length 0. + +* [BUGFIX] #99: `stri_replace_all()` did not use the `replacement` arg. + +* [BUGFIX] #112: Some of the objects were not PROTECTed from + garbage collection - this could have led to spontaneous SEGFAULTS. + +* [BUGFIX] Some collator's options were not passed correctly to ICU services. + +* [BUGFIX] Memory leaks as detected by + `valgrind --tool=memcheck --leak-check=full` have been removed. + +* [DOCUMENTATION] Significant extensions/clean ups in the stringi manual. + + +## 0.2-5 (2014-05-16) + +* Some examples are no longer run if `icudt` is not available + (this was reverted in a future version though). + + +## 0.2-4 (2014-05-15) + +* [BUGFIX] Fixed issues with loading of misaligned addresses + in `stri_*_fixed()`. + + +## 0.2-3 (2014-05-14) + +* [IMPORTANT CHANGE] `stri_cmp*()` now do not allow for passing + `opts_collator=NA`. From now on, `stri_cmp_eq()`, `stri_cmp_neq()`, + and the new operators `%===%`, `%!==%`, `%stri===%`, and `%stri!==%` + are locale-independent operations, which base on code point comparisons. + New functions `stri_cmp_equiv()` and `stri_cmp_nequiv()` + (and from now on also `%==%`, `%!=%`, `%stri==%`, and `%stri!=%`) + test for canonical equivalence. + +* [IMPORTANT CHANGE] `stri_*_fixed()` search functions now perform + a locale-independent exact (byte-wise, of course after conversion to UTF-8) + pattern search. All the `Collator`-based, locale-dependent search routines + are now available via `stri_*_coll()`. The reason behind this is that + ICU's `USearch` has currently very poor performance. What is more, + in many search tasks exact pattern matching is sufficient anyway. + +* [GENERAL] `stri_*_fixed` now use a tweaked Knuth-Morris-Pratt search + algorithm which improves the search performance drastically. + +* [IMPORTANT CHANGE] `stri_enc_nf*()` and `stri_enc_isnf*()` function families + have been renamed `stri_trans_nf*()` and `stri_trans_isnf*()`, + respectively -- they deal with text transforming, + and not with character encoding. Note that all of these may + be performed by ICU's `Transliterator` too (see below). + +* [NEW FUNCTION] `stri_trans_general()` and `stri_trans_list()` give access + to ICU's `Transliterator`: they may be used to perform some generic + text transforms, like Unicode normalisation, case folding, etc. + +* [NEW FUNCTION `stri_split_boundaries()` uses ICU's `BreakIterator` + to split strings at specific text boundaries. Moreover, + `stri_locate_boundaries()` indicates positions of these boundaries. + +* [NEW FUNCTION] `stri_extract_words()` uses ICU's `BreakIterator` to + extract all words from a text. Additionally, `stri_locate_words()` + locates start and end positions of words in a text. + +* [NEW FUNCTION] `stri_pad()`, `stri_pad_left()`, `stri_pad_right()`, + and `stri_pad_both()` pad a string with a specific code point. + +* [NEW FUNCTION] `stri_wrap()` breaks paragraphs of text into lines. + Two algorithms (greedy and minimal raggedness) are available. + +* [IMPORTANT CHANGE] `stri_*_charclass()` search functions now + rely solely on ICU's `UnicodeSet` patterns. All the previously accepted + charclass identifiers became invalid. However, new patterns + should now be more familiar to the users (they are regex-like). + Moreover, we observe a very nice performance gain. + +* [IMPORTANT CHANGE] `stri_sort()` now does not include `NA`s + in output vectors by default, for compatibility with `sort()`. + Moreover, currently none of the input vector's attributes are preserved. + +* [NEW FUNCTION] `stri_unique()` extracts unique elements from + a character vector. + +* [NEW FUNCTIONS] `stri_duplicated()` and `stri_duplicated_any()` + determine duplicate elements in a character vector. + +* [NEW FUNCTION] `stri_replace_na()` replaces `NA`s in a character vector + with a given string, useful for emulating, e.g., R's `paste()` behaviour. + +* [NEW FUNCTION] `stri_rand_shuffle()` generates a random permutation + of code points in a string. + +* [NEW FUNCTION] `stri_rand_strings()` generates random strings. + +* [NEW FUNCTIONS] New functions and binary operators for string comparison: + `stri_cmp_eq()`, `stri_cmp_neq()`, `stri_cmp_lt()`, `stri_cmp_le()`, + `stri_cmp_gt()`, `stri_cmp_ge()`, `%==%`, `%!=%`, `%<%`, `%<=%`, + `%>%`, `%>=%`. + +* [NEW FUNCTION] `stri_enc_mark()` reads declared encodings of character + strings as seen by stringi. + +* [NEW FUNCTION] `stri_enc_tonative(str)` is an alias to + `stri_encode(str, NULL, NULL)`. + +* [NEW FEATURE] `stri_order()` and `stri_sort()` now have an additional + argument `na_last` (defaults to `TRUE` and `NA`, respectively). + +* [NEW FEATURE] `stri_replace_all_charclass()`, `stri_extract_all_charclass()`, + and `stri_locate_all_charclass()` now have a new argument, `merge` + (defaults to `FALSE` for backward-compatibility). It may be used + to, e.g., replace sequences of white spaces with a single space. + +* [NEW FEATURE] `stri_enc_toutf8()` now has a new `validate` argument + (which defaults to `FALSE` for backward-compatibility). It may be used + in a (rare) case where a user wants to fix an invalid UTF-8 byte sequence. + `stri_length()` (among others) now detects invalid UTF-8 byte sequences. + +* [NEW FEATURE] All binary operators `%???%` now also have aliases `%stri???%`. + +* [GENERAL] Performance improvements in `StriContainerUTF8` + and `StriContainerUTF16` (they affect most other functions). + +* [GENERAL] Significant performance improvements in `stri_join()`, + `stri_flatten()`, `stri_cmp()`, `stri_trans_to*()`, and others. + +* [GENERAL] Added 3rd mirror site for our `icudt` binary distribution. + +* `U_MISSING_RESOURCE_ERROR` message in `StriException` now suggests + calling `stri_install_check()`. + +* [BUGFIX] UTF-8 BOMs are now silently removed from input strings. + +* [BUGFIX] No more attempts to re-encode UTF-8 encoded strings + if native encoding is UTF-8 in `StriContainerUTF8`. + +* [BUGFIX] Possible memory leaks when throwing errors via `Rf_error()`. + +* [BUGFIX] `stri_order()` and `stri_cmp()` could return incorrect results + for `opts_collator=NA`. + +* [BUGFIX] `stri_sort()` did not guarantee to return strings in UTF-8. + + +## 0.1-25 (2014-03-12) + +* LICENSE tweaks. + +* First CRAN release. + + +## 0.1-24 (2014-03-11) + +* Fixed bugs detected with `ASAN` and `UBSAN`, + e.g., fixed `CharClass::gcmask` type (`enum` -> `uint32_t`) + (reported by `UBSAN`). + +* Fixed array over-runs detected with `valgrind` in `string8.h`. + +* Fixed uninitialised class fields in `StriContainerUTF8` + (reported by `valgrind`). + + +## 0.1-23 (2014-03-11) + +* License changed to BSD-3-clause, COPYRIGHTS updated. + +* `icudt` is not shipped with stringi anymore; + it is now downloaded in `install.libs.R` from one of our servers. + +* New functions: `stri_install_check()`, `stri_install_icudt()`. + + +## 0.1-22 (2014-02-20) + +* System ICU is used on systems which do have one (version >= 50 needed). + ICU is auto-detected with `pkg-config` in `configure`. + Pass `'--disable-pkg-config'` to `configure` to force building + ICU from sources. + +* `icudt52b` (custom subset) is now shipped with stringi + (for big-endian, ASCII systems). + + +## 0.1-21 (2014-02-19) + +* Fixed some issues on Solaris while preparing stringi + for CRAN submission. + + +## 0.1-20 (2014-02-17) + +* ICU4C 52.1 sources included (common, i18n, stubdata + `icu52dt.dat` + loaded dynamically). Compilation via Makevars. + +* stringi does not depend on any external libraries anymore. + + +## 0.1-11 (2013-11-16) + +* ICU4C is now statically linked on Windows. + +* First OS X binary build. + +* The package is being intensively tested by our students at Warsaw + University of Technology. + + +## 0.1-10 (2013-11-13) + +* Using `pkg-config` via `configure` to look for ICU4C libs. + + +## 0.1-6 (2013-07-05) + +* First Windows binary build. + +* Compilation passed on Oracle Sun Studio compiler collection. + +* By now we have implemented most of the functionality + scheduled for milestone 0.1. + + +## 0.1-1 (2013-01-05) + +* The stringi project has been started. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/R/stringi b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/R/stringi new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/R/stringi @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/R/stringi.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/R/stringi.rdb new file mode 100644 index 00000000..0269b554 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/R/stringi.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/R/stringi.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/R/stringi.rdx new file mode 100644 index 00000000..f83f7f7d Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/R/stringi.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/help/AnIndex new file mode 100644 index 00000000..7e6e5bbb --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/help/AnIndex @@ -0,0 +1,296 @@ +stringi-package about_stringi +%s!=% operator_compare +%s!==% operator_compare +%s$% operator_dollar +%s*% stri_dup +%s+% operator_add +%s<% operator_compare +%s<=% operator_compare +%s==% operator_compare +%s===% operator_compare +%s>% operator_compare +%s>=% operator_compare +%stri!=% operator_compare +%stri!==% operator_compare +%stri$% operator_dollar +%stri*% stri_dup +%stri+% operator_add +%stri<% operator_compare +%stri<=% operator_compare +%stri==% operator_compare +%stri===% operator_compare +%stri>% operator_compare +%stri>=% operator_compare +about_arguments about_arguments +about_encoding about_encoding +about_locale about_locale +about_search about_search +about_search_boundaries about_search_boundaries +about_search_charclass about_search_charclass +about_search_coll about_search_coll +about_search_fixed about_search_fixed +about_search_regex about_search_regex +about_stringi about_stringi +arguments about_arguments +encoding about_encoding +locale about_locale +operator_add operator_add +operator_compare operator_compare +operator_dollar operator_dollar +operator_multiply stri_dup +operator_plus operator_add +oper_compare operator_compare +oper_comparison operator_compare +oper_dollar operator_dollar +oper_multiply stri_dup +oper_plus operator_add +search about_search +search_boundaries about_search_boundaries +search_charclass about_search_charclass +search_coll about_search_coll +search_fixed about_search_fixed +search_regex about_search_regex +stringi about_stringi +stringi-arguments about_arguments +stringi-encoding about_encoding +stringi-locale about_locale +stringi-search about_search +stringi-search-boundaries about_search_boundaries +stringi-search-charclass about_search_charclass +stringi-search-coll about_search_coll +stringi-search-fixed about_search_fixed +stringi-search-regex about_search_regex +stri_c stri_join +stri_cmp stri_compare +stri_cmp_eq stri_compare +stri_cmp_equiv stri_compare +stri_cmp_ge stri_compare +stri_cmp_gt stri_compare +stri_cmp_le stri_compare +stri_cmp_lt stri_compare +stri_cmp_neq stri_compare +stri_cmp_nequiv stri_compare +stri_coll stri_opts_collator +stri_compare stri_compare +stri_conv stri_encode +stri_count stri_count +stri_count_boundaries stri_count_boundaries +stri_count_charclass stri_count +stri_count_coll stri_count +stri_count_fixed stri_count +stri_count_regex stri_count +stri_count_words stri_count_boundaries +stri_c_list stri_join_list +stri_datetime_add stri_datetime_add +stri_datetime_add<- stri_datetime_add +stri_datetime_create stri_datetime_create +stri_datetime_fields stri_datetime_fields +stri_datetime_format stri_datetime_format +stri_datetime_fstr stri_datetime_fstr +stri_datetime_now stri_datetime_now +stri_datetime_parse stri_datetime_format +stri_datetime_symbols stri_datetime_symbols +stri_detect stri_detect +stri_detect_charclass stri_detect +stri_detect_coll stri_detect +stri_detect_fixed stri_detect +stri_detect_regex stri_detect +stri_dup stri_dup +stri_duplicated stri_duplicated +stri_duplicated_any stri_duplicated +stri_encode stri_encode +stri_enc_detect stri_enc_detect +stri_enc_detect2 stri_enc_detect2 +stri_enc_fromutf32 stri_enc_fromutf32 +stri_enc_get stri_enc_set +stri_enc_info stri_enc_info +stri_enc_isascii stri_enc_isascii +stri_enc_isutf16be stri_enc_isutf16 +stri_enc_isutf16le stri_enc_isutf16 +stri_enc_isutf32be stri_enc_isutf16 +stri_enc_isutf32le stri_enc_isutf16 +stri_enc_isutf8 stri_enc_isutf8 +stri_enc_list stri_enc_list +stri_enc_mark stri_enc_mark +stri_enc_set stri_enc_set +stri_enc_toascii stri_enc_toascii +stri_enc_tonative stri_enc_tonative +stri_enc_toutf32 stri_enc_toutf32 +stri_enc_toutf8 stri_enc_toutf8 +stri_endswith stri_startsendswith +stri_endswith_charclass stri_startsendswith +stri_endswith_coll stri_startsendswith +stri_endswith_fixed stri_startsendswith +stri_escape_unicode stri_escape_unicode +stri_extract stri_extract +stri_extract_all stri_extract +stri_extract_all_boundaries stri_extract_boundaries +stri_extract_all_charclass stri_extract +stri_extract_all_coll stri_extract +stri_extract_all_fixed stri_extract +stri_extract_all_regex stri_extract +stri_extract_all_words stri_extract_boundaries +stri_extract_first stri_extract +stri_extract_first_boundaries stri_extract_boundaries +stri_extract_first_charclass stri_extract +stri_extract_first_coll stri_extract +stri_extract_first_fixed stri_extract +stri_extract_first_regex stri_extract +stri_extract_first_words stri_extract_boundaries +stri_extract_last stri_extract +stri_extract_last_boundaries stri_extract_boundaries +stri_extract_last_charclass stri_extract +stri_extract_last_coll stri_extract +stri_extract_last_fixed stri_extract +stri_extract_last_regex stri_extract +stri_extract_last_words stri_extract_boundaries +stri_flatten stri_flatten +stri_info stri_info +stri_isempty stri_isempty +stri_join stri_join +stri_join_list stri_join_list +stri_length stri_length +stri_list2matrix stri_list2matrix +stri_locale_get stri_locale_set +stri_locale_info stri_locale_info +stri_locale_list stri_locale_list +stri_locale_set stri_locale_set +stri_locate stri_locate +stri_locate_all stri_locate +stri_locate_all_boundaries stri_locate_boundaries +stri_locate_all_charclass stri_locate +stri_locate_all_coll stri_locate +stri_locate_all_fixed stri_locate +stri_locate_all_regex stri_locate +stri_locate_all_words stri_locate_boundaries +stri_locate_first stri_locate +stri_locate_first_boundaries stri_locate_boundaries +stri_locate_first_charclass stri_locate +stri_locate_first_coll stri_locate +stri_locate_first_fixed stri_locate +stri_locate_first_regex stri_locate +stri_locate_first_words stri_locate_boundaries +stri_locate_last stri_locate +stri_locate_last_boundaries stri_locate_boundaries +stri_locate_last_charclass stri_locate +stri_locate_last_coll stri_locate +stri_locate_last_fixed stri_locate +stri_locate_last_regex stri_locate +stri_locate_last_words stri_locate_boundaries +stri_match stri_match +stri_match_all stri_match +stri_match_all_regex stri_match +stri_match_first stri_match +stri_match_first_regex stri_match +stri_match_last stri_match +stri_match_last_regex stri_match +stri_na2empty stri_na2empty +stri_numbytes stri_numbytes +stri_omit_empty stri_remove_empty +stri_omit_empty_na stri_remove_empty +stri_omit_na stri_remove_empty +stri_opts_brkiter stri_opts_brkiter +stri_opts_collator stri_opts_collator +stri_opts_fixed stri_opts_fixed +stri_opts_regex stri_opts_regex +stri_order stri_order +stri_pad stri_pad +stri_pad_both stri_pad +stri_pad_left stri_pad +stri_pad_right stri_pad +stri_paste stri_join +stri_paste_list stri_join_list +stri_printf stri_sprintf +stri_rand_lipsum stri_rand_lipsum +stri_rand_shuffle stri_rand_shuffle +stri_rand_strings stri_rand_strings +stri_rank stri_rank +stri_read_lines stri_read_lines +stri_read_raw stri_read_raw +stri_remove_empty stri_remove_empty +stri_remove_empty_na stri_remove_empty +stri_remove_na stri_remove_empty +stri_replace stri_replace +stri_replace_all stri_replace +stri_replace_all_charclass stri_replace +stri_replace_all_coll stri_replace +stri_replace_all_fixed stri_replace +stri_replace_all_regex stri_replace +stri_replace_first stri_replace +stri_replace_first_charclass stri_replace +stri_replace_first_coll stri_replace +stri_replace_first_fixed stri_replace +stri_replace_first_regex stri_replace +stri_replace_last stri_replace +stri_replace_last_charclass stri_replace +stri_replace_last_coll stri_replace +stri_replace_last_fixed stri_replace +stri_replace_last_regex stri_replace +stri_replace_na stri_replace_na +stri_replace_rstr stri_replace_rstr +stri_reverse stri_reverse +stri_sort stri_sort +stri_sort_key stri_sort_key +stri_split stri_split +stri_split_boundaries stri_split_boundaries +stri_split_charclass stri_split +stri_split_coll stri_split +stri_split_fixed stri_split +stri_split_lines stri_split_lines +stri_split_lines1 stri_split_lines +stri_split_regex stri_split +stri_sprintf stri_sprintf +stri_startswith stri_startsendswith +stri_startswith_charclass stri_startsendswith +stri_startswith_coll stri_startsendswith +stri_startswith_fixed stri_startsendswith +stri_stats_general stri_stats_general +stri_stats_latex stri_stats_latex +stri_string_format stri_sprintf +stri_sub stri_sub +stri_sub<- stri_sub +stri_subset stri_subset +stri_subset<- stri_subset +stri_subset_charclass stri_subset +stri_subset_charclass<- stri_subset +stri_subset_coll stri_subset +stri_subset_coll<- stri_subset +stri_subset_fixed stri_subset +stri_subset_fixed<- stri_subset +stri_subset_regex stri_subset +stri_subset_regex<- stri_subset +stri_sub_all stri_sub_all +stri_sub_all<- stri_sub_all +stri_sub_all_replace stri_sub_all +stri_sub_replace stri_sub +stri_sub_replace_all stri_sub_all +stri_timezone_get stri_timezone_set +stri_timezone_info stri_timezone_info +stri_timezone_list stri_timezone_list +stri_timezone_set stri_timezone_set +stri_trans_casefold stri_trans_casemap +stri_trans_char stri_trans_char +stri_trans_general stri_trans_general +stri_trans_isnfc stri_trans_nf +stri_trans_isnfd stri_trans_nf +stri_trans_isnfkc stri_trans_nf +stri_trans_isnfkc_casefold stri_trans_nf +stri_trans_isnfkd stri_trans_nf +stri_trans_list stri_trans_list +stri_trans_nfc stri_trans_nf +stri_trans_nfd stri_trans_nf +stri_trans_nfkc stri_trans_nf +stri_trans_nfkc_casefold stri_trans_nf +stri_trans_nfkd stri_trans_nf +stri_trans_tolower stri_trans_casemap +stri_trans_totitle stri_trans_casemap +stri_trans_toupper stri_trans_casemap +stri_trim stri_trim +stri_trim_both stri_trim +stri_trim_left stri_trim +stri_trim_right stri_trim +stri_unescape_unicode stri_unescape_unicode +stri_unique stri_unique +stri_width stri_width +stri_wrap stri_wrap +stri_write_lines stri_write_lines diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/help/aliases.rds new file mode 100644 index 00000000..fb665a9d Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/help/paths.rds new file mode 100644 index 00000000..999e7356 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/help/stringi.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/help/stringi.rdb new file mode 100644 index 00000000..ce850a0b Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/help/stringi.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/help/stringi.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/help/stringi.rdx new file mode 100644 index 00000000..885db423 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/help/stringi.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/html/00Index.html new file mode 100644 index 00000000..b161d2ea --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/html/00Index.html @@ -0,0 +1,658 @@ + + +R: Fast and Portable Character String Processing Facilities + + + +
+

Fast and Portable Character String Processing Facilities + +

+
+
+[Up] +[Top] +

Documentation for package ‘stringi’ version 1.8.4

+ + + +

Help Pages

+ + +

+ +A +E +L +O +S +misc +

+ + + + +
stringi-packageFast and Portable Character String Processing in R
+ +

-- A --

+ + + + + + + + + + + + + + + + + + + + + + + + +
about_argumentsPassing Arguments to Functions in 'stringi'
about_encodingCharacter Encodings and 'stringi'
about_localeLocales and 'stringi'
about_searchString Searching
about_search_boundariesText Boundary Analysis in 'stringi'
about_search_charclassCharacter Classes in 'stringi'
about_search_collLocale-Sensitive Text Searching in 'stringi'
about_search_fixedLocale-Insensitive Fixed Pattern Matching in 'stringi'
about_search_regexRegular Expressions in 'stringi'
about_stringiFast and Portable Character String Processing in R
argumentsPassing Arguments to Functions in 'stringi'
+ +

-- E --

+ + + + +
encodingCharacter Encodings and 'stringi'
+ +

-- L --

+ + + + +
localeLocales and 'stringi'
+ +

-- O --

+ + + + + + + + + + + + + + + + + + + + + + +
operator_addConcatenate Two Character Vectors
operator_compareCompare Strings with or without Collation
operator_dollarC-Style Formatting with 'stri_sprintf' as a Binary Operator
operator_multiplyDuplicate Strings
operator_plusConcatenate Two Character Vectors
oper_compareCompare Strings with or without Collation
oper_comparisonCompare Strings with or without Collation
oper_dollarC-Style Formatting with 'stri_sprintf' as a Binary Operator
oper_multiplyDuplicate Strings
oper_plusConcatenate Two Character Vectors
+ +

-- S --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
searchString Searching
search_boundariesText Boundary Analysis in 'stringi'
search_charclassCharacter Classes in 'stringi'
search_collLocale-Sensitive Text Searching in 'stringi'
search_fixedLocale-Insensitive Fixed Pattern Matching in 'stringi'
search_regexRegular Expressions in 'stringi'
stringiFast and Portable Character String Processing in R
stringi-argumentsPassing Arguments to Functions in 'stringi'
stringi-encodingCharacter Encodings and 'stringi'
stringi-localeLocales and 'stringi'
stringi-searchString Searching
stringi-search-boundariesText Boundary Analysis in 'stringi'
stringi-search-charclassCharacter Classes in 'stringi'
stringi-search-collLocale-Sensitive Text Searching in 'stringi'
stringi-search-fixedLocale-Insensitive Fixed Pattern Matching in 'stringi'
stringi-search-regexRegular Expressions in 'stringi'
stri_cConcatenate Character Vectors
stri_cmpCompare Strings with or without Collation
stri_cmp_eqCompare Strings with or without Collation
stri_cmp_equivCompare Strings with or without Collation
stri_cmp_geCompare Strings with or without Collation
stri_cmp_gtCompare Strings with or without Collation
stri_cmp_leCompare Strings with or without Collation
stri_cmp_ltCompare Strings with or without Collation
stri_cmp_neqCompare Strings with or without Collation
stri_cmp_nequivCompare Strings with or without Collation
stri_collGenerate a List with Collator Settings
stri_compareCompare Strings with or without Collation
stri_convConvert Strings Between Given Encodings
stri_countCount the Number of Pattern Occurrences
stri_count_boundariesCount the Number of Text Boundaries
stri_count_charclassCount the Number of Pattern Occurrences
stri_count_collCount the Number of Pattern Occurrences
stri_count_fixedCount the Number of Pattern Occurrences
stri_count_regexCount the Number of Pattern Occurrences
stri_count_wordsCount the Number of Text Boundaries
stri_c_listConcatenate Strings in a List
stri_datetime_addDate and Time Arithmetic
stri_datetime_add<-Date and Time Arithmetic
stri_datetime_createCreate a Date-Time Object
stri_datetime_fieldsGet Values for Date and Time Fields
stri_datetime_formatDate and Time Formatting and Parsing
stri_datetime_fstrConvert 'strptime'-Style Format Strings
stri_datetime_nowGet Current Date and Time
stri_datetime_parseDate and Time Formatting and Parsing
stri_datetime_symbolsList Localizable Date-Time Formatting Data
stri_detectDetect Pattern Occurrences
stri_detect_charclassDetect Pattern Occurrences
stri_detect_collDetect Pattern Occurrences
stri_detect_fixedDetect Pattern Occurrences
stri_detect_regexDetect Pattern Occurrences
stri_dupDuplicate Strings
stri_duplicatedDetermine Duplicated Elements
stri_duplicated_anyDetermine Duplicated Elements
stri_encodeConvert Strings Between Given Encodings
stri_enc_detectDetect Character Set and Language
stri_enc_detect2[DEPRECATED] Detect Locale-Sensitive Character Encoding
stri_enc_fromutf32Convert From UTF-32
stri_enc_getSet or Get Default Character Encoding in 'stringi'
stri_enc_infoQuery a Character Encoding
stri_enc_isasciiCheck If a Data Stream Is Possibly in ASCII
stri_enc_isutf16beCheck If a Data Stream Is Possibly in UTF-16 or UTF-32
stri_enc_isutf16leCheck If a Data Stream Is Possibly in UTF-16 or UTF-32
stri_enc_isutf32beCheck If a Data Stream Is Possibly in UTF-16 or UTF-32
stri_enc_isutf32leCheck If a Data Stream Is Possibly in UTF-16 or UTF-32
stri_enc_isutf8Check If a Data Stream Is Possibly in UTF-8
stri_enc_listList Known Character Encodings
stri_enc_markGet Declared Encodings of Each String
stri_enc_setSet or Get Default Character Encoding in 'stringi'
stri_enc_toasciiConvert To ASCII
stri_enc_tonativeConvert Strings To Native Encoding
stri_enc_toutf32Convert Strings To UTF-32
stri_enc_toutf8Convert Strings To UTF-8
stri_endswithDetermine if the Start or End of a String Matches a Pattern
stri_endswith_charclassDetermine if the Start or End of a String Matches a Pattern
stri_endswith_collDetermine if the Start or End of a String Matches a Pattern
stri_endswith_fixedDetermine if the Start or End of a String Matches a Pattern
stri_escape_unicodeEscape Unicode Code Points
stri_extractExtract Pattern Occurrences
stri_extract_allExtract Pattern Occurrences
stri_extract_all_boundariesExtract Data Between Text Boundaries
stri_extract_all_charclassExtract Pattern Occurrences
stri_extract_all_collExtract Pattern Occurrences
stri_extract_all_fixedExtract Pattern Occurrences
stri_extract_all_regexExtract Pattern Occurrences
stri_extract_all_wordsExtract Data Between Text Boundaries
stri_extract_firstExtract Pattern Occurrences
stri_extract_first_boundariesExtract Data Between Text Boundaries
stri_extract_first_charclassExtract Pattern Occurrences
stri_extract_first_collExtract Pattern Occurrences
stri_extract_first_fixedExtract Pattern Occurrences
stri_extract_first_regexExtract Pattern Occurrences
stri_extract_first_wordsExtract Data Between Text Boundaries
stri_extract_lastExtract Pattern Occurrences
stri_extract_last_boundariesExtract Data Between Text Boundaries
stri_extract_last_charclassExtract Pattern Occurrences
stri_extract_last_collExtract Pattern Occurrences
stri_extract_last_fixedExtract Pattern Occurrences
stri_extract_last_regexExtract Pattern Occurrences
stri_extract_last_wordsExtract Data Between Text Boundaries
stri_flattenFlatten a String
stri_infoQuery Default Settings for 'stringi'
stri_isemptyDetermine if a String is of Length Zero
stri_joinConcatenate Character Vectors
stri_join_listConcatenate Strings in a List
stri_lengthCount the Number of Code Points
stri_list2matrixConvert a List to a Character Matrix
stri_locale_getSet or Get Default Locale in 'stringi'
stri_locale_infoQuery Given Locale
stri_locale_listList Available Locales
stri_locale_setSet or Get Default Locale in 'stringi'
stri_locateLocate Pattern Occurrences
stri_locate_allLocate Pattern Occurrences
stri_locate_all_boundariesLocate Text Boundaries
stri_locate_all_charclassLocate Pattern Occurrences
stri_locate_all_collLocate Pattern Occurrences
stri_locate_all_fixedLocate Pattern Occurrences
stri_locate_all_regexLocate Pattern Occurrences
stri_locate_all_wordsLocate Text Boundaries
stri_locate_firstLocate Pattern Occurrences
stri_locate_first_boundariesLocate Text Boundaries
stri_locate_first_charclassLocate Pattern Occurrences
stri_locate_first_collLocate Pattern Occurrences
stri_locate_first_fixedLocate Pattern Occurrences
stri_locate_first_regexLocate Pattern Occurrences
stri_locate_first_wordsLocate Text Boundaries
stri_locate_lastLocate Pattern Occurrences
stri_locate_last_boundariesLocate Text Boundaries
stri_locate_last_charclassLocate Pattern Occurrences
stri_locate_last_collLocate Pattern Occurrences
stri_locate_last_fixedLocate Pattern Occurrences
stri_locate_last_regexLocate Pattern Occurrences
stri_locate_last_wordsLocate Text Boundaries
stri_matchExtract Regex Pattern Matches, Together with Capture Groups
stri_match_allExtract Regex Pattern Matches, Together with Capture Groups
stri_match_all_regexExtract Regex Pattern Matches, Together with Capture Groups
stri_match_firstExtract Regex Pattern Matches, Together with Capture Groups
stri_match_first_regexExtract Regex Pattern Matches, Together with Capture Groups
stri_match_lastExtract Regex Pattern Matches, Together with Capture Groups
stri_match_last_regexExtract Regex Pattern Matches, Together with Capture Groups
stri_na2emptyReplace NAs with Empty Strings
stri_numbytesCount the Number of Bytes
stri_omit_emptyRemove All Empty Strings from a Character Vector
stri_omit_empty_naRemove All Empty Strings from a Character Vector
stri_omit_naRemove All Empty Strings from a Character Vector
stri_opts_brkiterGenerate a List with BreakIterator Settings
stri_opts_collatorGenerate a List with Collator Settings
stri_opts_fixedGenerate a List with Fixed Pattern Search Engine's Settings
stri_opts_regexGenerate a List with Regex Matcher Settings
stri_orderOrdering Permutation
stri_padPad (Center/Left/Right Align) a String
stri_pad_bothPad (Center/Left/Right Align) a String
stri_pad_leftPad (Center/Left/Right Align) a String
stri_pad_rightPad (Center/Left/Right Align) a String
stri_pasteConcatenate Character Vectors
stri_paste_listConcatenate Strings in a List
stri_printfFormat Strings
stri_rand_lipsumA Lorem Ipsum Generator
stri_rand_shuffleRandomly Shuffle Code Points in Each String
stri_rand_stringsGenerate Random Strings
stri_rankRanking
stri_read_linesRead Text Lines from a Text File
stri_read_rawRead Text File as Raw
stri_remove_emptyRemove All Empty Strings from a Character Vector
stri_remove_empty_naRemove All Empty Strings from a Character Vector
stri_remove_naRemove All Empty Strings from a Character Vector
stri_replaceReplace Pattern Occurrences
stri_replace_allReplace Pattern Occurrences
stri_replace_all_charclassReplace Pattern Occurrences
stri_replace_all_collReplace Pattern Occurrences
stri_replace_all_fixedReplace Pattern Occurrences
stri_replace_all_regexReplace Pattern Occurrences
stri_replace_firstReplace Pattern Occurrences
stri_replace_first_charclassReplace Pattern Occurrences
stri_replace_first_collReplace Pattern Occurrences
stri_replace_first_fixedReplace Pattern Occurrences
stri_replace_first_regexReplace Pattern Occurrences
stri_replace_lastReplace Pattern Occurrences
stri_replace_last_charclassReplace Pattern Occurrences
stri_replace_last_collReplace Pattern Occurrences
stri_replace_last_fixedReplace Pattern Occurrences
stri_replace_last_regexReplace Pattern Occurrences
stri_replace_naReplace Missing Values in a Character Vector
stri_replace_rstrConvert gsub-Style Replacement Strings
stri_reverseReverse Each String
stri_sortString Sorting
stri_sort_keySort Keys
stri_splitSplit a String By Pattern Matches
stri_split_boundariesSplit a String at Text Boundaries
stri_split_charclassSplit a String By Pattern Matches
stri_split_collSplit a String By Pattern Matches
stri_split_fixedSplit a String By Pattern Matches
stri_split_linesSplit a String Into Text Lines
stri_split_lines1Split a String Into Text Lines
stri_split_regexSplit a String By Pattern Matches
stri_sprintfFormat Strings
stri_startswithDetermine if the Start or End of a String Matches a Pattern
stri_startswith_charclassDetermine if the Start or End of a String Matches a Pattern
stri_startswith_collDetermine if the Start or End of a String Matches a Pattern
stri_startswith_fixedDetermine if the Start or End of a String Matches a Pattern
stri_stats_generalGeneral Statistics for a Character Vector
stri_stats_latexStatistics for a Character Vector Containing LaTeX Commands
stri_string_formatFormat Strings
stri_subExtract a Substring From or Replace a Substring In a Character Vector
stri_sub<-Extract a Substring From or Replace a Substring In a Character Vector
stri_subsetSelect Elements that Match a Given Pattern
stri_subset<-Select Elements that Match a Given Pattern
stri_subset_charclassSelect Elements that Match a Given Pattern
stri_subset_charclass<-Select Elements that Match a Given Pattern
stri_subset_collSelect Elements that Match a Given Pattern
stri_subset_coll<-Select Elements that Match a Given Pattern
stri_subset_fixedSelect Elements that Match a Given Pattern
stri_subset_fixed<-Select Elements that Match a Given Pattern
stri_subset_regexSelect Elements that Match a Given Pattern
stri_subset_regex<-Select Elements that Match a Given Pattern
stri_sub_allExtract or Replace Multiple Substrings
stri_sub_all<-Extract or Replace Multiple Substrings
stri_sub_all_replaceExtract or Replace Multiple Substrings
stri_sub_replaceExtract a Substring From or Replace a Substring In a Character Vector
stri_sub_replace_allExtract or Replace Multiple Substrings
stri_timezone_getSet or Get Default Time Zone in 'stringi'
stri_timezone_infoQuery a Given Time Zone
stri_timezone_listList Available Time Zone Identifiers
stri_timezone_setSet or Get Default Time Zone in 'stringi'
stri_trans_casefoldTransform Strings with Case Mapping or Folding
stri_trans_charTranslate Characters
stri_trans_generalGeneral Text Transforms, Including Transliteration
stri_trans_isnfcPerform or Check For Unicode Normalization
stri_trans_isnfdPerform or Check For Unicode Normalization
stri_trans_isnfkcPerform or Check For Unicode Normalization
stri_trans_isnfkc_casefoldPerform or Check For Unicode Normalization
stri_trans_isnfkdPerform or Check For Unicode Normalization
stri_trans_listList Available Text Transforms and Transliterators
stri_trans_nfcPerform or Check For Unicode Normalization
stri_trans_nfdPerform or Check For Unicode Normalization
stri_trans_nfkcPerform or Check For Unicode Normalization
stri_trans_nfkc_casefoldPerform or Check For Unicode Normalization
stri_trans_nfkdPerform or Check For Unicode Normalization
stri_trans_tolowerTransform Strings with Case Mapping or Folding
stri_trans_totitleTransform Strings with Case Mapping or Folding
stri_trans_toupperTransform Strings with Case Mapping or Folding
stri_trimTrim Characters from the Left and/or Right Side of a String
stri_trim_bothTrim Characters from the Left and/or Right Side of a String
stri_trim_leftTrim Characters from the Left and/or Right Side of a String
stri_trim_rightTrim Characters from the Left and/or Right Side of a String
stri_unescape_unicodeUn-escape All Escape Sequences
stri_uniqueExtract Unique Elements
stri_widthDetermine the Width of Code Points
stri_wrapWord Wrap Text to Format Paragraphs
stri_write_linesWrite Text Lines to a Text File
+ +

-- misc --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
%s!=%Compare Strings with or without Collation
%s!==%Compare Strings with or without Collation
%s$%C-Style Formatting with 'stri_sprintf' as a Binary Operator
%s*%Duplicate Strings
%s+%Concatenate Two Character Vectors
%s<%Compare Strings with or without Collation
%s<=%Compare Strings with or without Collation
%s==%Compare Strings with or without Collation
%s===%Compare Strings with or without Collation
%s>%Compare Strings with or without Collation
%s>=%Compare Strings with or without Collation
%stri!=%Compare Strings with or without Collation
%stri!==%Compare Strings with or without Collation
%stri$%C-Style Formatting with 'stri_sprintf' as a Binary Operator
%stri*%Duplicate Strings
%stri+%Concatenate Two Character Vectors
%stri<%Compare Strings with or without Collation
%stri<=%Compare Strings with or without Collation
%stri==%Compare Strings with or without Collation
%stri===%Compare Strings with or without Collation
%stri>%Compare Strings with or without Collation
%stri>=%Compare Strings with or without Collation
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/include/stringi.cpp b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/include/stringi.cpp new file mode 100644 index 00000000..da5431bc --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/include/stringi.cpp @@ -0,0 +1,1314 @@ +/* This file is part of the 'stringi' project. + * Copyright (c) 2013-2024, Marek Gagolewski + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +SEXP stri_cmp(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_cmp"); + return fun(e1, e2, e3); + } + +SEXP stri_cmp_le(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_cmp_le"); + return fun(e1, e2, e3); + } + +SEXP stri_cmp_lt(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_cmp_lt"); + return fun(e1, e2, e3); + } + +SEXP stri_cmp_ge(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_cmp_ge"); + return fun(e1, e2, e3); + } + +SEXP stri_cmp_gt(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_cmp_gt"); + return fun(e1, e2, e3); + } + +SEXP stri_cmp_equiv(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_cmp_equiv"); + return fun(e1, e2, e3); + } + +SEXP stri_cmp_nequiv(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_cmp_nequiv"); + return fun(e1, e2, e3); + } + +SEXP stri_cmp_eq(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_cmp_eq"); + return fun(e1, e2); + } + +SEXP stri_cmp_neq(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_cmp_neq"); + return fun(e1, e2); + } + +SEXP stri_sort(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_sort"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_rank(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_rank"); + return fun(e1, e2); + } + +SEXP stri_order(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_order"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_sort_key(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_sort_key"); + return fun(e1, e2); + } + +SEXP stri_unique(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_unique"); + return fun(e1, e2); + } + +SEXP stri_duplicated(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_duplicated"); + return fun(e1, e2, e3); + } + +SEXP stri_duplicated_any(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_duplicated_any"); + return fun(e1, e2, e3); + } + +SEXP stri_info() { + static SEXP(*fun)() = NULL; + if (!fun) + fun = (SEXP(*)()) R_GetCCallable("stringi", "C_stri_info"); + return fun(); + } + +SEXP stri_escape_unicode(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_escape_unicode"); + return fun(e1); + } + +SEXP stri_unescape_unicode(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_unescape_unicode"); + return fun(e1); + } + +SEXP stri_flatten(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_flatten"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_join(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_join"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_join_list(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_join_list"); + return fun(e1, e2, e3); + } + +SEXP stri_join2(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_join2"); + return fun(e1, e2); + } + +SEXP stri_dup(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_dup"); + return fun(e1, e2); + } + +SEXP stri_numbytes(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_numbytes"); + return fun(e1); + } + +SEXP stri_length(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_length"); + return fun(e1); + } + +SEXP stri_isempty(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_isempty"); + return fun(e1); + } + +SEXP stri_width(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_width"); + return fun(e1); + } + +SEXP stri_reverse(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_reverse"); + return fun(e1); + } + +SEXP stri_sub(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5, SEXP e6) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_sub"); + return fun(e1, e2, e3, e4, e5, e6); + } + +SEXP stri_sub_replacement(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5, SEXP e6, SEXP e7) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_sub_replacement"); + return fun(e1, e2, e3, e4, e5, e6, e7); + } + +SEXP stri_sub_all(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5, SEXP e6) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_sub_all"); + return fun(e1, e2, e3, e4, e5, e6); + } + +SEXP stri_sub_replacement_all(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5, SEXP e6, SEXP e7) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_sub_replacement_all"); + return fun(e1, e2, e3, e4, e5, e6, e7); + } + +SEXP stri_enc_list() { + static SEXP(*fun)() = NULL; + if (!fun) + fun = (SEXP(*)()) R_GetCCallable("stringi", "C_stri_enc_list"); + return fun(); + } + +SEXP stri_enc_info(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_enc_info"); + return fun(e1); + } + +SEXP stri_enc_set(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_enc_set"); + return fun(e1); + } + +SEXP stri_enc_mark(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_enc_mark"); + return fun(e1); + } + +SEXP stri_locale_info(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_locale_info"); + return fun(e1); + } + +SEXP stri_locale_list() { + static SEXP(*fun)() = NULL; + if (!fun) + fun = (SEXP(*)()) R_GetCCallable("stringi", "C_stri_locale_list"); + return fun(); + } + +SEXP stri_locale_set(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_locale_set"); + return fun(e1); + } + +SEXP stri_trim_both(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_trim_both"); + return fun(e1, e2, e3); + } + +SEXP stri_trim_left(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_trim_left"); + return fun(e1, e2, e3); + } + +SEXP stri_trim_right(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_trim_right"); + return fun(e1, e2, e3); + } + +SEXP stri_rand_shuffle(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_rand_shuffle"); + return fun(e1); + } + +SEXP stri_rand_strings(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_rand_strings"); + return fun(e1, e2, e3); + } + +SEXP stri_stats_general(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_stats_general"); + return fun(e1); + } + +SEXP stri_stats_latex(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_stats_latex"); + return fun(e1); + } + +SEXP stri_trans_list() { + static SEXP(*fun)() = NULL; + if (!fun) + fun = (SEXP(*)()) R_GetCCallable("stringi", "C_stri_trans_list"); + return fun(); + } + +SEXP stri_trans_general(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_trans_general"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_list2matrix(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_list2matrix"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_encode(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_encode"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_enc_fromutf32(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_enc_fromutf32"); + return fun(e1); + } + +SEXP stri_enc_toutf32(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_enc_toutf32"); + return fun(e1); + } + +SEXP stri_enc_toutf8(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_enc_toutf8"); + return fun(e1, e2, e3); + } + +SEXP stri_enc_toascii(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_enc_toascii"); + return fun(e1); + } + +SEXP stri_enc_detect2(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_enc_detect2"); + return fun(e1, e2); + } + +SEXP stri_enc_detect(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_enc_detect"); + return fun(e1, e2); + } + +SEXP stri_enc_isascii(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_enc_isascii"); + return fun(e1); + } + +SEXP stri_enc_isutf8(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_enc_isutf8"); + return fun(e1); + } + +SEXP stri_enc_isutf16le(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_enc_isutf16le"); + return fun(e1); + } + +SEXP stri_enc_isutf16be(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_enc_isutf16be"); + return fun(e1); + } + +SEXP stri_enc_isutf32le(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_enc_isutf32le"); + return fun(e1); + } + +SEXP stri_enc_isutf32be(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_enc_isutf32be"); + return fun(e1); + } + +SEXP stri_pad(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_pad"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_sprintf(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5, SEXP e6) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_sprintf"); + return fun(e1, e2, e3, e4, e5, e6); + } + +SEXP stri_wrap(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5, SEXP e6, SEXP e7, SEXP e8, SEXP e9, SEXP e10) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_wrap"); + return fun(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10); + } + +SEXP stri_trans_char(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_trans_char"); + return fun(e1, e2, e3); + } + +SEXP stri_trans_totitle(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_trans_totitle"); + return fun(e1, e2); + } + +SEXP stri_trans_tolower(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_trans_tolower"); + return fun(e1, e2); + } + +SEXP stri_trans_toupper(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_trans_toupper"); + return fun(e1, e2); + } + +SEXP stri_trans_casefold(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_trans_casefold"); + return fun(e1); + } + +SEXP stri_trans_nfc(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_trans_nfc"); + return fun(e1); + } + +SEXP stri_trans_nfd(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_trans_nfd"); + return fun(e1); + } + +SEXP stri_trans_nfkc(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_trans_nfkc"); + return fun(e1); + } + +SEXP stri_trans_nfkd(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_trans_nfkd"); + return fun(e1); + } + +SEXP stri_trans_nfkc_casefold(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_trans_nfkc_casefold"); + return fun(e1); + } + +SEXP stri_trans_isnfc(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_trans_isnfc"); + return fun(e1); + } + +SEXP stri_trans_isnfd(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_trans_isnfd"); + return fun(e1); + } + +SEXP stri_trans_isnfkc(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_trans_isnfkc"); + return fun(e1); + } + +SEXP stri_trans_isnfkd(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_trans_isnfkd"); + return fun(e1); + } + +SEXP stri_trans_isnfkc_casefold(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_trans_isnfkc_casefold"); + return fun(e1); + } + +SEXP stri_split_lines(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_split_lines"); + return fun(e1, e2); + } + +SEXP stri_split_lines1(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_split_lines1"); + return fun(e1); + } + +SEXP stri_replace_na(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_replace_na"); + return fun(e1, e2); + } + +SEXP stri_replace_rstr(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_replace_rstr"); + return fun(e1); + } + +SEXP stri_detect_coll(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_detect_coll"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_count_coll(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_count_coll"); + return fun(e1, e2, e3); + } + +SEXP stri_locate_all_coll(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_locate_all_coll"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_locate_first_coll(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_locate_first_coll"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_locate_last_coll(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_locate_last_coll"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_extract_first_coll(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_extract_first_coll"); + return fun(e1, e2, e3); + } + +SEXP stri_extract_last_coll(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_extract_last_coll"); + return fun(e1, e2, e3); + } + +SEXP stri_extract_all_coll(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_extract_all_coll"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_replace_all_coll(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_replace_all_coll"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_replace_first_coll(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_replace_first_coll"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_replace_last_coll(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_replace_last_coll"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_split_coll(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5, SEXP e6, SEXP e7) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_split_coll"); + return fun(e1, e2, e3, e4, e5, e6, e7); + } + +SEXP stri_endswith_coll(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_endswith_coll"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_startswith_coll(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_startswith_coll"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_subset_coll(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_subset_coll"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_subset_coll_replacement(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_subset_coll_replacement"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_detect_fixed(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_detect_fixed"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_count_fixed(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_count_fixed"); + return fun(e1, e2, e3); + } + +SEXP stri_locate_all_fixed(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_locate_all_fixed"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_locate_first_fixed(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_locate_first_fixed"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_locate_last_fixed(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_locate_last_fixed"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_extract_first_fixed(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_extract_first_fixed"); + return fun(e1, e2, e3); + } + +SEXP stri_extract_last_fixed(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_extract_last_fixed"); + return fun(e1, e2, e3); + } + +SEXP stri_extract_all_fixed(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_extract_all_fixed"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_replace_all_fixed(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_replace_all_fixed"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_replace_first_fixed(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_replace_first_fixed"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_replace_last_fixed(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_replace_last_fixed"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_split_fixed(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5, SEXP e6, SEXP e7) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_split_fixed"); + return fun(e1, e2, e3, e4, e5, e6, e7); + } + +SEXP stri_subset_fixed(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_subset_fixed"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_endswith_fixed(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_endswith_fixed"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_startswith_fixed(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_startswith_fixed"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_subset_fixed_replacement(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_subset_fixed_replacement"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_detect_regex(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_detect_regex"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_count_regex(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_count_regex"); + return fun(e1, e2, e3); + } + +SEXP stri_locate_all_regex(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5, SEXP e6) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_locate_all_regex"); + return fun(e1, e2, e3, e4, e5, e6); + } + +SEXP stri_locate_first_regex(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_locate_first_regex"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_locate_last_regex(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_locate_last_regex"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_replace_all_regex(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_replace_all_regex"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_replace_first_regex(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_replace_first_regex"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_replace_last_regex(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_replace_last_regex"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_split_regex(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5, SEXP e6, SEXP e7) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_split_regex"); + return fun(e1, e2, e3, e4, e5, e6, e7); + } + +SEXP stri_subset_regex(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_subset_regex"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_extract_first_regex(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_extract_first_regex"); + return fun(e1, e2, e3); + } + +SEXP stri_extract_last_regex(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_extract_last_regex"); + return fun(e1, e2, e3); + } + +SEXP stri_extract_all_regex(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_extract_all_regex"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_match_first_regex(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_match_first_regex"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_match_last_regex(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_match_last_regex"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_match_all_regex(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_match_all_regex"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_subset_regex_replacement(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_subset_regex_replacement"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_detect_charclass(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_detect_charclass"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_count_charclass(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_count_charclass"); + return fun(e1, e2); + } + +SEXP stri_extract_first_charclass(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_extract_first_charclass"); + return fun(e1, e2); + } + +SEXP stri_extract_last_charclass(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_extract_last_charclass"); + return fun(e1, e2); + } + +SEXP stri_extract_all_charclass(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_extract_all_charclass"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_locate_first_charclass(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_locate_first_charclass"); + return fun(e1, e2, e3); + } + +SEXP stri_locate_last_charclass(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_locate_last_charclass"); + return fun(e1, e2, e3); + } + +SEXP stri_locate_all_charclass(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_locate_all_charclass"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_replace_last_charclass(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_replace_last_charclass"); + return fun(e1, e2, e3); + } + +SEXP stri_replace_first_charclass(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_replace_first_charclass"); + return fun(e1, e2, e3); + } + +SEXP stri_replace_all_charclass(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_replace_all_charclass"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_split_charclass(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5, SEXP e6) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_split_charclass"); + return fun(e1, e2, e3, e4, e5, e6); + } + +SEXP stri_endswith_charclass(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_endswith_charclass"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_startswith_charclass(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_startswith_charclass"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_subset_charclass(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_subset_charclass"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_subset_charclass_replacement(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_subset_charclass_replacement"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_extract_all_boundaries(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_extract_all_boundaries"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_extract_first_boundaries(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_extract_first_boundaries"); + return fun(e1, e2); + } + +SEXP stri_extract_last_boundaries(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_extract_last_boundaries"); + return fun(e1, e2); + } + +SEXP stri_locate_all_boundaries(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_locate_all_boundaries"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_locate_first_boundaries(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_locate_first_boundaries"); + return fun(e1, e2, e3); + } + +SEXP stri_locate_last_boundaries(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_locate_last_boundaries"); + return fun(e1, e2, e3); + } + +SEXP stri_split_boundaries(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_split_boundaries"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_count_boundaries(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_count_boundaries"); + return fun(e1, e2); + } + +SEXP stri_timezone_list(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_timezone_list"); + return fun(e1, e2); + } + +SEXP stri_timezone_set(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_timezone_set"); + return fun(e1); + } + +SEXP stri_timezone_info(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_timezone_info"); + return fun(e1, e2, e3); + } + +SEXP stri_datetime_symbols(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_datetime_symbols"); + return fun(e1, e2, e3); + } + +SEXP stri_datetime_now() { + static SEXP(*fun)() = NULL; + if (!fun) + fun = (SEXP(*)()) R_GetCCallable("stringi", "C_stri_datetime_now"); + return fun(); + } + +SEXP stri_datetime_add(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_datetime_add"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_datetime_fields(SEXP e1, SEXP e2, SEXP e3) { + static SEXP(*fun)(SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_datetime_fields"); + return fun(e1, e2, e3); + } + +SEXP stri_datetime_create(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5, SEXP e6, SEXP e7, SEXP e8, SEXP e9) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_datetime_create"); + return fun(e1, e2, e3, e4, e5, e6, e7, e8, e9); + } + +SEXP stri_datetime_format(SEXP e1, SEXP e2, SEXP e3, SEXP e4) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_datetime_format"); + return fun(e1, e2, e3, e4); + } + +SEXP stri_datetime_parse(SEXP e1, SEXP e2, SEXP e3, SEXP e4, SEXP e5) { + static SEXP(*fun)(SEXP,SEXP,SEXP,SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP,SEXP,SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_datetime_parse"); + return fun(e1, e2, e3, e4, e5); + } + +SEXP stri_datetime_fstr(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_datetime_fstr"); + return fun(e1); + } + +SEXP stri_prepare_arg_string_1(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_prepare_arg_string_1"); + return fun(e1, e2); + } + +SEXP stri_prepare_arg_double_1(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_prepare_arg_double_1"); + return fun(e1, e2); + } + +SEXP stri_prepare_arg_integer_1(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_prepare_arg_integer_1"); + return fun(e1, e2); + } + +SEXP stri_prepare_arg_logical_1(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_prepare_arg_logical_1"); + return fun(e1, e2); + } + +SEXP stri_prepare_arg_string(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_prepare_arg_string"); + return fun(e1, e2); + } + +SEXP stri_prepare_arg_double(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_prepare_arg_double"); + return fun(e1, e2); + } + +SEXP stri_prepare_arg_integer(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_prepare_arg_integer"); + return fun(e1, e2); + } + +SEXP stri_prepare_arg_logical(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_prepare_arg_logical"); + return fun(e1, e2); + } + +SEXP stri_prepare_arg_raw(SEXP e1, SEXP e2) { + static SEXP(*fun)(SEXP,SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP,SEXP)) R_GetCCallable("stringi", "C_stri_prepare_arg_raw"); + return fun(e1, e2); + } + +SEXP stri_test_Rmark(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_test_Rmark"); + return fun(e1); + } + +SEXP stri_test_UnicodeContainer16(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_test_UnicodeContainer16"); + return fun(e1); + } + +SEXP stri_test_UnicodeContainer16b(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_test_UnicodeContainer16b"); + return fun(e1); + } + +SEXP stri_test_UnicodeContainer8(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_test_UnicodeContainer8"); + return fun(e1); + } + +SEXP stri_test_returnasis(SEXP e1) { + static SEXP(*fun)(SEXP) = NULL; + if (!fun) + fun = (SEXP(*)(SEXP)) R_GetCCallable("stringi", "C_stri_test_returnasis"); + return fun(e1); + } + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/include/stringi.h b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/include/stringi.h new file mode 100644 index 00000000..f2dacf43 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/include/stringi.h @@ -0,0 +1,453 @@ +/* This file is part of the 'stringi' project. + * Copyright (c) 2013-2024, Marek Gagolewski + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#ifndef __stri_exports_h +#define __stri_exports_h + +#include +#include + +// compare.cpp: +SEXP stri_cmp(SEXP e1, SEXP e2, SEXP opts_collator=R_NilValue); +SEXP stri_cmp_le(SEXP e1, SEXP e2, SEXP opts_collator=R_NilValue); +SEXP stri_cmp_lt(SEXP e1, SEXP e2, SEXP opts_collator=R_NilValue); +SEXP stri_cmp_ge(SEXP e1, SEXP e2, SEXP opts_collator=R_NilValue); +SEXP stri_cmp_gt(SEXP e1, SEXP e2, SEXP opts_collator=R_NilValue); +SEXP stri_cmp_equiv(SEXP e1, SEXP e2, SEXP opts_collator=R_NilValue); +SEXP stri_cmp_nequiv(SEXP e1, SEXP e2, SEXP opts_collator=R_NilValue); +SEXP stri_cmp_eq(SEXP e1, SEXP e2); +SEXP stri_cmp_neq(SEXP e1, SEXP e2); + +// sort.cpp +SEXP stri_sort(SEXP str, SEXP decreasing=Rf_ScalarLogical(FALSE), + SEXP na_last=Rf_ScalarLogical(NA_LOGICAL), SEXP opts_collator=R_NilValue); +SEXP stri_rank(SEXP str, SEXP opts_collator=R_NilValue); +SEXP stri_order(SEXP str, SEXP decreasing=Rf_ScalarLogical(FALSE), + SEXP na_last=Rf_ScalarLogical(TRUE), SEXP opts_collator=R_NilValue); +SEXP stri_sort_key(SEXP str, SEXP opts_collator=R_NilValue); + +SEXP stri_unique(SEXP str, SEXP opts_collator=R_NilValue); +SEXP stri_duplicated(SEXP str, SEXP fromLast=Rf_ScalarLogical(FALSE), + SEXP opts_collator=R_NilValue); +SEXP stri_duplicated_any(SEXP str, SEXP fromLast=Rf_ScalarLogical(FALSE), + SEXP opts_collator=R_NilValue); + +// ICU_settings.cpp: +SEXP stri_info(); + +// escape.cpp +SEXP stri_escape_unicode(SEXP str); +SEXP stri_unescape_unicode(SEXP str); + +// join.cpp: +SEXP stri_flatten(SEXP str, SEXP collapse=Rf_mkString(""), + SEXP na_empty=Rf_ScalarLogical(FALSE), SEXP omit_empty=Rf_ScalarLogical(FALSE)); +SEXP stri_join(SEXP strlist, SEXP sep=Rf_mkString(""), + SEXP collapse=R_NilValue, SEXP ignore_null=Rf_ScalarLogical(FALSE)); +SEXP stri_join_list(SEXP x, SEXP sep=Rf_mkString(""), + SEXP collapse=R_NilValue); +SEXP stri_join2(SEXP e1, SEXP e2); +SEXP stri_dup(SEXP str, SEXP times); + +// length.cpp +SEXP stri_numbytes(SEXP str); +SEXP stri_length(SEXP str); +SEXP stri_isempty(SEXP str); +SEXP stri_width(SEXP str); + +// reverse.cpp +SEXP stri_reverse(SEXP s); + +// sub.cpp +SEXP stri_sub(SEXP str, SEXP from, SEXP to, SEXP length, SEXP use_matrix=Rf_ScalarLogical(TRUE), SEXP ignore_negative_length=Rf_ScalarLogical(FALSE)); +SEXP stri_sub_replacement(SEXP str, SEXP from, SEXP to, SEXP length, SEXP omit_na, SEXP value, SEXP use_matrix=Rf_ScalarLogical(TRUE)); +SEXP stri_sub_all(SEXP str, SEXP from, SEXP to, SEXP length, SEXP use_matrix=Rf_ScalarLogical(TRUE), SEXP ignore_negative_length=Rf_ScalarLogical(TRUE)); +SEXP stri_sub_replacement_all(SEXP str, SEXP from, SEXP to, SEXP length, SEXP omit_na, SEXP value, SEXP use_matrix=Rf_ScalarLogical(TRUE)); + +// encoding_management.cpp: +SEXP stri_enc_list(); +SEXP stri_enc_info(SEXP enc=R_NilValue); +SEXP stri_enc_set(SEXP enc); +SEXP stri_enc_mark(SEXP str); + +// uloc.cpp: +SEXP stri_locale_info(SEXP loc=R_NilValue); +SEXP stri_locale_list(); +SEXP stri_locale_set(SEXP loc); + +// trim.cpp: +SEXP stri_trim_both(SEXP str, SEXP pattern, SEXP negate=Rf_ScalarLogical(FALSE)); +SEXP stri_trim_left(SEXP str, SEXP pattern, SEXP negate=Rf_ScalarLogical(FALSE)); +SEXP stri_trim_right(SEXP str, SEXP pattern, SEXP negate=Rf_ScalarLogical(FALSE)); + +// random.cpp +SEXP stri_rand_shuffle(SEXP str); +SEXP stri_rand_strings(SEXP n, SEXP length, SEXP pattern=Rf_mkString("[A-Za-z0-9]")); + +// stats.cpp +SEXP stri_stats_general(SEXP str); +SEXP stri_stats_latex(SEXP str); + +// trans_transliterate.cpp: +SEXP stri_trans_list(); +SEXP stri_trans_general(SEXP str, SEXP id, SEXP rules, SEXP forward); + +// utils.cpp +SEXP stri_list2matrix(SEXP x, SEXP byrow=Rf_ScalarLogical(FALSE), + SEXP fill=Rf_ScalarString(NA_STRING), SEXP n_min=Rf_ScalarInteger(0)); + + +// encoding_conversion.cpp: +SEXP stri_encode(SEXP str, SEXP from=R_NilValue, SEXP to=R_NilValue, + SEXP to_raw=Rf_ScalarLogical(FALSE)); +SEXP stri_enc_fromutf32(SEXP str); +SEXP stri_enc_toutf32(SEXP str); +SEXP stri_enc_toutf8(SEXP str, SEXP is_unknown_8bit=Rf_ScalarLogical(FALSE), + SEXP validate=Rf_ScalarLogical(FALSE)); +SEXP stri_enc_toascii(SEXP str); + + +// encoding_detection.cpp: +SEXP stri_enc_detect2(SEXP str, SEXP loc=R_NilValue); +SEXP stri_enc_detect(SEXP str, SEXP filter_angle_brackets=Rf_ScalarLogical(FALSE)); +SEXP stri_enc_isascii(SEXP str); +SEXP stri_enc_isutf8(SEXP str); +SEXP stri_enc_isutf16le(SEXP str); +SEXP stri_enc_isutf16be(SEXP str); +SEXP stri_enc_isutf32le(SEXP str); +SEXP stri_enc_isutf32be(SEXP str); + +// pad.cpp +SEXP stri_pad(SEXP str, SEXP width, SEXP side=Rf_mkString("left"), + SEXP pad=Rf_mkString(" "), SEXP use_length=Rf_ScalarLogical(FALSE)); + + +// sprintf.cpp +SEXP stri_sprintf(SEXP format, SEXP x, + SEXP na_string=Rf_ScalarString(NA_STRING), + SEXP inf_string=Rf_mkString("Inf"), + SEXP nan_string=Rf_mkString("NaN"), + SEXP use_length=Rf_ScalarLogical(FALSE)); + +// wrap.cpp +SEXP stri_wrap(SEXP str, SEXP width, SEXP cost_exponent=Rf_ScalarInteger(2), + SEXP indent=Rf_ScalarInteger(0), SEXP exdent=Rf_ScalarInteger(0), + SEXP prefix=Rf_mkString(""), SEXP initial=Rf_mkString(""), + SEXP whitespace_only=Rf_ScalarLogical(FALSE), + SEXP use_length=Rf_ScalarLogical(FALSE), SEXP locale=R_NilValue); + +// trans_other.cpp: +SEXP stri_trans_char(SEXP str, SEXP pattern, SEXP replacement); + +// trans_casemap.cpp: +SEXP stri_trans_totitle(SEXP str, SEXP opts_brkiter=R_NilValue); +SEXP stri_trans_tolower(SEXP str, SEXP locale=R_NilValue); +SEXP stri_trans_toupper(SEXP str, SEXP locale=R_NilValue); +SEXP stri_trans_casefold(SEXP str); + +// trans_normalization.cpp: +SEXP stri_trans_nfc(SEXP s); +SEXP stri_trans_nfd(SEXP s); +SEXP stri_trans_nfkc(SEXP s); +SEXP stri_trans_nfkd(SEXP s); +SEXP stri_trans_nfkc_casefold(SEXP s); +SEXP stri_trans_isnfc(SEXP s); +SEXP stri_trans_isnfd(SEXP s); +SEXP stri_trans_isnfkc(SEXP s); +SEXP stri_trans_isnfkd(SEXP s); +SEXP stri_trans_isnfkc_casefold(SEXP s); + +// search +SEXP stri_split_lines(SEXP str, SEXP omit_empty=Rf_ScalarLogical(FALSE)); +SEXP stri_split_lines1(SEXP str); + +SEXP stri_replace_na(SEXP str, SEXP replacement=Rf_mkString("NA")); + +SEXP stri_replace_rstr(SEXP x); + +SEXP stri_detect_coll(SEXP str, SEXP pattern, + SEXP negate=Rf_ScalarLogical(FALSE), SEXP max_count=Rf_ScalarInteger(-1), + SEXP opts_collator=R_NilValue); +SEXP stri_count_coll(SEXP str, SEXP pattern, SEXP opts_collator=R_NilValue); +SEXP stri_locate_all_coll(SEXP str, SEXP pattern, + SEXP omit_no_match=Rf_ScalarLogical(FALSE), + SEXP opts_collator=R_NilValue, + SEXP get_length=Rf_ScalarLogical(FALSE) +); +SEXP stri_locate_first_coll( + SEXP str, SEXP pattern, SEXP opts_collator=R_NilValue, + SEXP get_length=Rf_ScalarLogical(FALSE) +); +SEXP stri_locate_last_coll( + SEXP str, SEXP pattern, SEXP opts_collator=R_NilValue, + SEXP get_length=Rf_ScalarLogical(FALSE) +); +SEXP stri_extract_first_coll(SEXP str, SEXP pattern, SEXP opts_collator=R_NilValue); +SEXP stri_extract_last_coll(SEXP str, SEXP pattern, SEXP opts_collator=R_NilValue); +SEXP stri_extract_all_coll(SEXP str, SEXP pattern, + SEXP simplify=Rf_ScalarLogical(FALSE), + SEXP omit_no_match=Rf_ScalarLogical(FALSE), SEXP opts_collator=R_NilValue); +SEXP stri_replace_all_coll(SEXP str, SEXP pattern, SEXP replacement, + SEXP vectorize_all=Rf_ScalarLogical(TRUE), SEXP opts_collator=R_NilValue); +SEXP stri_replace_first_coll(SEXP str, SEXP pattern, SEXP replacement, + SEXP opts_collator=R_NilValue); +SEXP stri_replace_last_coll(SEXP str, SEXP pattern, SEXP replacement, + SEXP opts_collator=R_NilValue); +SEXP stri_split_coll(SEXP str, SEXP split, SEXP n=Rf_ScalarInteger(-1), + SEXP omit_empty=Rf_ScalarLogical(FALSE), SEXP tokens_only=Rf_ScalarLogical(FALSE), + SEXP simplify=Rf_ScalarLogical(FALSE), SEXP opts_collator=R_NilValue); +SEXP stri_endswith_coll(SEXP str, SEXP pattern, SEXP to=Rf_ScalarInteger(-1), + SEXP negate=Rf_ScalarLogical(FALSE), + SEXP opts_collator=R_NilValue); +SEXP stri_startswith_coll(SEXP str, SEXP pattern, SEXP from=Rf_ScalarInteger(1), + SEXP negate=Rf_ScalarLogical(FALSE), + SEXP opts_collator=R_NilValue); +SEXP stri_subset_coll(SEXP str, SEXP pattern, + SEXP omit_na=Rf_ScalarLogical(FALSE), SEXP negate=Rf_ScalarLogical(FALSE), SEXP opts_collator=R_NilValue); +SEXP stri_subset_coll_replacement(SEXP str, SEXP pattern, SEXP negate, SEXP opts_collator, SEXP value); + +SEXP stri_detect_fixed(SEXP str, SEXP pattern, + SEXP negate=Rf_ScalarLogical(FALSE), SEXP max_count=Rf_ScalarInteger(-1), + SEXP opts_fixed=R_NilValue); +SEXP stri_count_fixed(SEXP str, SEXP pattern, SEXP opts_fixed=R_NilValue); +SEXP stri_locate_all_fixed( + SEXP str, SEXP pattern, + SEXP omit_no_match=Rf_ScalarLogical(FALSE), SEXP opts_fixed=R_NilValue, + SEXP get_length=Rf_ScalarLogical(FALSE) +); +SEXP stri_locate_first_fixed( + SEXP str, SEXP pattern, SEXP opts_fixed=R_NilValue, + SEXP get_length=Rf_ScalarLogical(FALSE) +); +SEXP stri_locate_last_fixed( + SEXP str, SEXP pattern, SEXP opts_fixed=R_NilValue, + SEXP get_length=Rf_ScalarLogical(FALSE) +); +SEXP stri_extract_first_fixed( + SEXP str, SEXP pattern, SEXP opts_fixed=R_NilValue +); +SEXP stri_extract_last_fixed( + SEXP str, SEXP pattern, SEXP opts_fixed=R_NilValue +); +SEXP stri_extract_all_fixed( + SEXP str, SEXP pattern, + SEXP simplify=Rf_ScalarLogical(FALSE), + SEXP omit_no_match=Rf_ScalarLogical(FALSE), SEXP opts_fixed=R_NilValue +); +SEXP stri_replace_all_fixed(SEXP str, SEXP pattern, SEXP replacement, + SEXP vectorize_all=Rf_ScalarLogical(TRUE), SEXP opts_fixed=R_NilValue); +SEXP stri_replace_first_fixed(SEXP str, SEXP pattern, SEXP replacement, + SEXP opts_fixed=R_NilValue); +SEXP stri_replace_last_fixed(SEXP str, SEXP pattern, SEXP replacement, + SEXP opts_fixed=R_NilValue); +SEXP stri_split_fixed(SEXP str, SEXP split, SEXP n=Rf_ScalarInteger(-1), + SEXP omit_empty=Rf_ScalarLogical(FALSE), SEXP tokens_only=Rf_ScalarLogical(FALSE), + SEXP simplify=Rf_ScalarLogical(FALSE), SEXP opts_fixed=R_NilValue); +SEXP stri_subset_fixed(SEXP str, SEXP pattern, + SEXP omit_na=Rf_ScalarLogical(FALSE), SEXP negate=Rf_ScalarLogical(FALSE), SEXP opts_fixed=R_NilValue); +SEXP stri_endswith_fixed(SEXP str, SEXP pattern, SEXP to=Rf_ScalarInteger(-1), + SEXP negate=Rf_ScalarLogical(FALSE), + SEXP opts_fixed=R_NilValue); +SEXP stri_startswith_fixed(SEXP str, SEXP pattern, SEXP from=Rf_ScalarInteger(1), + SEXP negate=Rf_ScalarLogical(FALSE), + SEXP opts_fixed=R_NilValue); +SEXP stri_subset_fixed_replacement(SEXP str, SEXP pattern, SEXP negate, SEXP opts_fixed, SEXP value); + +SEXP stri_detect_regex( + SEXP str, SEXP pattern, + SEXP negate=Rf_ScalarLogical(FALSE), + SEXP max_count=Rf_ScalarInteger(-1), + SEXP opts_regex=R_NilValue +); +SEXP stri_count_regex(SEXP str, SEXP pattern, SEXP opts_regex=R_NilValue); +SEXP stri_locate_all_regex( + SEXP str, SEXP pattern, + SEXP omit_no_match=Rf_ScalarLogical(FALSE), + SEXP opts_regex=R_NilValue, + SEXP capture_groups=Rf_ScalarLogical(FALSE), + SEXP get_length=Rf_ScalarLogical(FALSE) +); +SEXP stri_locate_first_regex( + SEXP str, SEXP pattern, SEXP opts_regex=R_NilValue, + SEXP capture_groups=Rf_ScalarLogical(FALSE), + SEXP get_length=Rf_ScalarLogical(FALSE) +); +SEXP stri_locate_last_regex( + SEXP str, SEXP pattern, SEXP opts_regex=R_NilValue, + SEXP capture_groups=Rf_ScalarLogical(FALSE), + SEXP get_length=Rf_ScalarLogical(FALSE) +); +SEXP stri_replace_all_regex( + SEXP str, SEXP pattern, SEXP replacement, + SEXP vectorize_all=Rf_ScalarLogical(FALSE), SEXP opts_regex=R_NilValue +); +SEXP stri_replace_first_regex( + SEXP str, SEXP pattern, SEXP replacement, + SEXP opts_regex=R_NilValue +); +SEXP stri_replace_last_regex( + SEXP str, SEXP pattern, SEXP replacement, + SEXP opts_regex=R_NilValue +); +SEXP stri_split_regex( + SEXP str, SEXP pattern, SEXP n=Rf_ScalarInteger(-1), + SEXP omit_empty=Rf_ScalarLogical(FALSE), SEXP tokens_only=Rf_ScalarLogical(FALSE), + SEXP simplify=Rf_ScalarLogical(FALSE), SEXP opts_regex=R_NilValue +); +SEXP stri_subset_regex( + SEXP str, SEXP pattern, SEXP omit_na=Rf_ScalarLogical(FALSE), + SEXP negate=Rf_ScalarLogical(FALSE), SEXP opts_regex=R_NilValue +); +SEXP stri_extract_first_regex(SEXP str, SEXP pattern, SEXP opts_regex=R_NilValue); +SEXP stri_extract_last_regex(SEXP str, SEXP pattern, SEXP opts_regex=R_NilValue); +SEXP stri_extract_all_regex(SEXP str, SEXP pattern, + SEXP simplify=Rf_ScalarLogical(FALSE), SEXP omit_no_match=Rf_ScalarLogical(FALSE), + SEXP opts_regex=R_NilValue); +SEXP stri_match_first_regex(SEXP str, SEXP pattern, + SEXP cg_missing=Rf_ScalarString(NA_STRING), SEXP opts_regex=R_NilValue); +SEXP stri_match_last_regex(SEXP str, SEXP pattern, + SEXP cg_missing=Rf_ScalarString(NA_STRING), SEXP opts_regex=R_NilValue); +SEXP stri_match_all_regex(SEXP str, SEXP pattern, + SEXP omit_no_match=Rf_ScalarLogical(FALSE), + SEXP cg_missing=Rf_ScalarString(NA_STRING), SEXP opts_regex=R_NilValue); +SEXP stri_subset_regex_replacement(SEXP str, SEXP pattern, SEXP negate, SEXP opts_regex, SEXP value); + +SEXP stri_detect_charclass(SEXP str, SEXP pattern, + SEXP negate=Rf_ScalarLogical(FALSE), SEXP max_count=Rf_ScalarInteger(-1)); +SEXP stri_count_charclass(SEXP str, SEXP pattern); +SEXP stri_extract_first_charclass(SEXP str, SEXP pattern); +SEXP stri_extract_last_charclass(SEXP str, SEXP pattern); +SEXP stri_extract_all_charclass(SEXP str, SEXP pattern, + SEXP merge=Rf_ScalarLogical(TRUE), SEXP simplify=Rf_ScalarLogical(FALSE), + SEXP omit_no_match=Rf_ScalarLogical(FALSE)); +SEXP stri_locate_first_charclass( + SEXP str, SEXP pattern, SEXP get_length=Rf_ScalarLogical(FALSE) +); +SEXP stri_locate_last_charclass( + SEXP str, SEXP pattern, SEXP get_length=Rf_ScalarLogical(FALSE) +); +SEXP stri_locate_all_charclass( + SEXP str, SEXP pattern, + SEXP merge=Rf_ScalarLogical(TRUE), + SEXP omit_no_match=Rf_ScalarLogical(FALSE), + SEXP get_length=Rf_ScalarLogical(FALSE) +); +SEXP stri_replace_last_charclass(SEXP str, SEXP pattern, SEXP replacement); +SEXP stri_replace_first_charclass(SEXP str, SEXP pattern, SEXP replacement); +SEXP stri_replace_all_charclass(SEXP str, SEXP pattern, SEXP replacement, + SEXP merge=Rf_ScalarLogical(FALSE), SEXP vectorize_all=Rf_ScalarLogical(TRUE)); +SEXP stri_split_charclass(SEXP str, SEXP pattern, SEXP n=Rf_ScalarInteger(-1), + SEXP omit_empty=Rf_ScalarLogical(FALSE), + SEXP tokens_only=Rf_ScalarLogical(FALSE), SEXP simplify=Rf_ScalarLogical(FALSE)); +SEXP stri_endswith_charclass(SEXP str, SEXP pattern, SEXP to=Rf_ScalarInteger(-1), + SEXP negate=Rf_ScalarLogical(FALSE)); +SEXP stri_startswith_charclass(SEXP str, SEXP pattern, SEXP from=Rf_ScalarInteger(1), + SEXP negate=Rf_ScalarLogical(FALSE)); +SEXP stri_subset_charclass(SEXP str, SEXP pattern, SEXP omit_na=Rf_ScalarLogical(FALSE), SEXP negate=Rf_ScalarLogical(FALSE)); +SEXP stri_subset_charclass_replacement(SEXP str, SEXP pattern, SEXP negate, SEXP value); + +SEXP stri_extract_all_boundaries(SEXP str, SEXP simplify, + SEXP omit_no_match=Rf_ScalarLogical(FALSE), SEXP opts_brkiter=R_NilValue); +SEXP stri_extract_first_boundaries(SEXP str, SEXP opts_brkiter=R_NilValue); +SEXP stri_extract_last_boundaries(SEXP str, SEXP opts_brkiter=R_NilValue); +SEXP stri_locate_all_boundaries( + SEXP str, SEXP omit_no_match=Rf_ScalarLogical(FALSE), + SEXP opts_brkiter=R_NilValue, + SEXP get_length=Rf_ScalarLogical(FALSE) +); +SEXP stri_locate_first_boundaries( + SEXP str, + SEXP opts_brkiter=R_NilValue, + SEXP get_length=Rf_ScalarLogical(FALSE) +); +SEXP stri_locate_last_boundaries( + SEXP str, + SEXP opts_brkiter=R_NilValue, + SEXP get_length=Rf_ScalarLogical(FALSE) +); +SEXP stri_split_boundaries(SEXP str, SEXP n=Rf_ScalarInteger(-1), + SEXP tokens_only=Rf_ScalarLogical(FALSE), + SEXP simplify=Rf_ScalarLogical(FALSE), SEXP opts_brkiter=R_NilValue); +SEXP stri_count_boundaries(SEXP str, SEXP opts_brkiter=R_NilValue); + + +// date/time +SEXP stri_timezone_list(SEXP region=Rf_ScalarString(NA_STRING), + SEXP offset=Rf_ScalarInteger(NA_INTEGER)); +SEXP stri_timezone_set(SEXP tz); +SEXP stri_timezone_info(SEXP tz=R_NilValue, SEXP locale=R_NilValue, + SEXP display_type=Rf_mkString("long")); + +SEXP stri_datetime_symbols(SEXP locale=R_NilValue, + SEXP context=Rf_mkString("standalone"), SEXP width=Rf_mkString("wide")); + +SEXP stri_datetime_now(); +SEXP stri_datetime_add(SEXP time, SEXP value=Rf_ScalarInteger(1), + SEXP units=Rf_mkString("seconds"), SEXP tz=R_NilValue, SEXP locale=R_NilValue); +SEXP stri_datetime_fields(SEXP time, SEXP tz=R_NilValue, SEXP locale=R_NilValue); +SEXP stri_datetime_create(SEXP year, SEXP month, SEXP day, + SEXP hour=Rf_ScalarInteger(12), SEXP minute=Rf_ScalarInteger(0), + SEXP second=Rf_ScalarInteger(0), SEXP lenient=Rf_ScalarLogical(FALSE), + SEXP tz=R_NilValue, SEXP locale=R_NilValue); +SEXP stri_datetime_format(SEXP time, SEXP format=Rf_mkString("uuuu-MM-dd HH:mm:ss"), + SEXP tz=R_NilValue, SEXP locale=R_NilValue); +SEXP stri_datetime_parse(SEXP str, SEXP format=Rf_mkString("uuuu-MM-dd HH:mm:ss"), + SEXP lenient=Rf_ScalarLogical(FALSE), SEXP tz=R_NilValue, SEXP locale=R_NilValue); +SEXP stri_datetime_fstr(SEXP x); +// SEXP stri_c_posixst(SEXP x); // internal + + +// prepare_arg.cpp: +SEXP stri_prepare_arg_string_1(SEXP x, SEXP argname); +SEXP stri_prepare_arg_double_1(SEXP x, SEXP argname); // TODO: factors_as_strings +SEXP stri_prepare_arg_integer_1(SEXP x, SEXP argname); // TODO: factors_as_strings +SEXP stri_prepare_arg_logical_1(SEXP x, SEXP argname); +SEXP stri_prepare_arg_string(SEXP x, SEXP argname); +SEXP stri_prepare_arg_double(SEXP x, SEXP argname); // TODO: factors_as_strings +SEXP stri_prepare_arg_integer(SEXP x, SEXP argname); // TODO: factors_as_strings +SEXP stri_prepare_arg_logical(SEXP x, SEXP argname); +SEXP stri_prepare_arg_raw(SEXP x, SEXP argname); // TODO: factors_as_strings +// TODO: other prepare args + + +// encoding_conversion.cpp: +// SEXP stri_encode_from_marked(SEXP str, SEXP to, SEXP to_raw); // internal + + +// test.cpp /* internal, but in namespace: for testing */ +SEXP stri_test_Rmark(SEXP str); +SEXP stri_test_UnicodeContainer16(SEXP str); +SEXP stri_test_UnicodeContainer16b(SEXP str); +SEXP stri_test_UnicodeContainer8(SEXP str); +SEXP stri_test_returnasis(SEXP x); + +#endif diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/libs/stringi.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/libs/stringi.so new file mode 100755 index 00000000..7819d9a3 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringi/libs/stringi.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/DESCRIPTION new file mode 100644 index 00000000..628a0dbe --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/DESCRIPTION @@ -0,0 +1,41 @@ +Package: stringr +Title: Simple, Consistent Wrappers for Common String Operations +Version: 1.5.1 +Authors@R: c( + person("Hadley", "Wickham", , "hadley@posit.co", role = c("aut", "cre", "cph")), + person("Posit Software, PBC", role = c("cph", "fnd")) + ) +Description: A consistent, simple and easy to use set of wrappers around + the fantastic 'stringi' package. All function and argument names (and + positions) are consistent, all functions deal with "NA"'s and zero + length vectors in the same way, and the output from one function is + easy to feed into the input of another. +License: MIT + file LICENSE +URL: https://stringr.tidyverse.org, + https://github.com/tidyverse/stringr +BugReports: https://github.com/tidyverse/stringr/issues +Depends: R (>= 3.6) +Imports: cli, glue (>= 1.6.1), lifecycle (>= 1.0.3), magrittr, rlang + (>= 1.0.0), stringi (>= 1.5.3), vctrs (>= 0.4.0) +Suggests: covr, dplyr, gt, htmltools, htmlwidgets, knitr, rmarkdown, + testthat (>= 3.0.0), tibble +VignetteBuilder: knitr +Config/Needs/website: tidyverse/tidytemplate +Config/testthat/edition: 3 +Encoding: UTF-8 +LazyData: true +RoxygenNote: 7.2.3 +NeedsCompilation: no +Packaged: 2023-11-14 15:03:52 UTC; hadleywickham +Author: Hadley Wickham [aut, cre, cph], + Posit Software, PBC [cph, fnd] +Maintainer: Hadley Wickham +Repository: CRAN +Date/Publication: 2023-11-14 23:10:02 UTC +Built: R 4.4.0; ; 2024-04-06 06:42:00 UTC; unix +RemoteType: standard +RemotePkgRef: stringr +RemoteRef: stringr +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 1.5.1 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/INDEX new file mode 100644 index 00000000..68b02741 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/INDEX @@ -0,0 +1,41 @@ +case Convert string to upper case, lower case, title + case, or sentence case +invert_match Switch location of matches to location of + non-matches +modifiers Control matching behaviour with modifier + functions +str_c Join multiple strings into one string +str_conv Specify the encoding of a string +str_count Count number of matches +str_detect Detect the presence/absence of a match +str_dup Duplicate a string +str_equal Determine if two strings are equivalent +str_escape Escape regular expression metacharacters +str_extract Extract the complete match +str_flatten Flatten a string +str_glue Interpolation with glue +str_length Compute the length/width +str_like Detect a pattern in the same way as 'SQL"s + 'LIKE' operator +str_locate Find location of match +str_match Extract components (capturing groups) from a + match +str_order Order, rank, or sort a character vector +str_pad Pad a string to minimum width +str_remove Remove matched patterns +str_replace Replace matches with new text +str_replace_na Turn NA into "NA" +str_split Split up a string into pieces +str_starts Detect the presence/absence of a match at the + start/end +str_sub Get and set substrings using their positions +str_subset Find matching elements +str_trim Remove whitespace +str_trunc Truncate a string to maximum width +str_unique Remove duplicated strings +str_view View strings and matches +str_which Find matching indices +str_wrap Wrap words into nicely formatted paragraphs +stringr-data Sample character vectors for practicing string + manipulations +word Extract words from a sentence diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/LICENSE new file mode 100644 index 00000000..f09b11aa --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2023 +COPYRIGHT HOLDER: stringr authors diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/Rd.rds new file mode 100644 index 00000000..54a1be4d Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/data.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/data.rds new file mode 100644 index 00000000..4bcb2fe9 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/data.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/features.rds new file mode 100644 index 00000000..ded31532 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/hsearch.rds new file mode 100644 index 00000000..4107dd65 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/links.rds new file mode 100644 index 00000000..74c2a716 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/nsInfo.rds new file mode 100644 index 00000000..8f1aade2 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/package.rds new file mode 100644 index 00000000..75232a36 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/vignette.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/vignette.rds new file mode 100644 index 00000000..c86c8855 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/Meta/vignette.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/NAMESPACE new file mode 100644 index 00000000..07f842ab --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/NAMESPACE @@ -0,0 +1,75 @@ +# Generated by roxygen2: do not edit by hand + +S3method("[",stringr_pattern) +S3method("[",stringr_view) +S3method(print,stringr_view) +S3method(type,character) +S3method(type,default) +S3method(type,stringr_boundary) +S3method(type,stringr_coll) +S3method(type,stringr_fixed) +S3method(type,stringr_regex) +export("%>%") +export("str_sub<-") +export(boundary) +export(coll) +export(fixed) +export(invert_match) +export(regex) +export(str_c) +export(str_conv) +export(str_count) +export(str_detect) +export(str_dup) +export(str_ends) +export(str_equal) +export(str_escape) +export(str_extract) +export(str_extract_all) +export(str_flatten) +export(str_flatten_comma) +export(str_glue) +export(str_glue_data) +export(str_interp) +export(str_length) +export(str_like) +export(str_locate) +export(str_locate_all) +export(str_match) +export(str_match_all) +export(str_order) +export(str_pad) +export(str_rank) +export(str_remove) +export(str_remove_all) +export(str_replace) +export(str_replace_all) +export(str_replace_na) +export(str_sort) +export(str_split) +export(str_split_1) +export(str_split_fixed) +export(str_split_i) +export(str_squish) +export(str_starts) +export(str_sub) +export(str_sub_all) +export(str_subset) +export(str_to_lower) +export(str_to_sentence) +export(str_to_title) +export(str_to_upper) +export(str_trim) +export(str_trunc) +export(str_unique) +export(str_view) +export(str_view_all) +export(str_which) +export(str_width) +export(str_wrap) +export(word) +import(rlang) +import(stringi) +importFrom(glue,glue) +importFrom(lifecycle,deprecated) +importFrom(magrittr,"%>%") diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/NEWS.md new file mode 100644 index 00000000..ca660ff1 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/NEWS.md @@ -0,0 +1,366 @@ +# stringr 1.5.1 + +* Some minor documentation improvements. + +* `str_trunc()` now correctly truncates strings when `side` is `"left"` or + `"center"` (@UchidaMizuki, #512). + +# stringr 1.5.0 + +## Breaking changes + +* stringr functions now consistently implement the tidyverse recycling rules + (#372). There are two main changes: + + * Only vectors of length 1 are recycled. Previously, (e.g.) + `str_detect(letters, c("x", "y"))` worked, but it now errors. + + * `str_c()` ignores `NULLs`, rather than treating them as length 0 + vectors. + + Additionally, many more arguments now throw errors, rather than warnings, + if supplied the wrong type of input. + +* `regex()` and friends now generate class names with `stringr_` prefix (#384). + +* `str_detect()`, `str_starts()`, `str_ends()` and `str_subset()` now error + when used with either an empty string (`""`) or a `boundary()`. These + operations didn't really make sense (`str_detect(x, "")` returned `TRUE` + for all non-empty strings) and made it easy to make mistakes when programming. + +## New features + +* Many tweaks to the documentation to make it more useful and consistent. + +* New `vignette("from-base")` by @sastoudt provides a comprehensive comparison + between base R functions and their stringr equivalents. It's designed to + help you move to stringr if you're already familiar with base R string + functions (#266). + +* New `str_escape()` escapes regular expression metacharacters, providing + an alternative to `fixed()` if you want to compose a pattern from user + supplied strings (#408). + +* New `str_equal()` compares two character vectors using unicode rules, + optionally ignoring case (#381). + +* `str_extract()` can now optionally extract a capturing group instead of + the complete match (#420). + +* New `str_flatten_comma()` is a special case of `str_flatten()` designed for + comma separated flattening and can correctly apply the Oxford commas + when there are only two elements (#444). + +* New `str_split_1()` is tailored for the special case of splitting up a single + string (#409). + +* New `str_split_i()` extract a single piece from a string (#278, @bfgray3). + +* New `str_like()` allows the use of SQL wildcards (#280, @rjpat). + +* New `str_rank()` to complete the set of order/rank/sort functions (#353). + +* New `str_sub_all()` to extract multiple substrings from each string. + +* New `str_unique()` is a wrapper around `stri_unique()` and returns unique + string values in a character vector (#249, @seasmith). + +* `str_view()` uses ANSI colouring rather than an HTML widget (#370). This + works in more places and requires fewer dependencies. It includes a number + of other small improvements: + + * It no longer requires a pattern so you can use it to display strings with + special characters. + * It highlights unusual whitespace characters. + * It's vectorised over both string` and `pattern` (#407). + * It defaults to displaying all matches, making `str_view_all()` redundant + (and hence deprecated) (#455). + +* New `str_width()` returns the display width of a string (#380). + +* stringr is now licensed as MIT (#351). + +## Minor improvements and bug fixes + +* Better error message if you supply a non-string pattern (#378). + +* A new data source for `sentences` has fixed many small errors. + +* `str_extract()` and `str_exctract_all()` now work correctly when `pattern` + is a `boundary()`. + +* `str_flatten()` gains a `last` argument that optionally override the + final separator (#377). It gains a `na.rm` argument to remove missing + values (since it's a summary function) (#439). + +* `str_pad()` gains `use_width` argument to control whether to use the total + code point width or the number of code points as "width" of a string (#190). + +* `str_replace()` and `str_replace_all()` can use standard tidyverse formula + shorthand for `replacement` function (#331). + +* `str_starts()` and `str_ends()` now correctly respect regex operator + precedence (@carlganz). + +* `str_wrap()` breaks only at whitespace by default; set + `whitespace_only = FALSE` to return to the previous behaviour (#335, @rjpat). + +* `word()` now returns all the sentence when using a negative `start` parameter + that is greater or equal than the number of words. (@pdelboca, #245) + +# stringr 1.4.1 + +Hot patch release to resolve R CMD check failures. + +# stringr 1.4.0 + +* `str_interp()` now renders lists consistently independent on the presence of + additional placeholders (@amhrasmussen). + +* New `str_starts()` and `str_ends()` functions to detect patterns at the + beginning or end of strings (@jonthegeek, #258). + +* `str_subset()`, `str_detect()`, and `str_which()` get `negate` argument, + which is useful when you want the elements that do NOT match (#259, + @yutannihilation). + +* New `str_to_sentence()` function to capitalize with sentence case + (@jonthegeek, #202). + +# stringr 1.3.1 + +* `str_replace_all()` with a named vector now respects modifier functions (#207) + +* `str_trunc()` is once again vectorised correctly (#203, @austin3dickey). + +* `str_view()` handles `NA` values more gracefully (#217). I've also + tweaked the sizing policy so hopefully it should work better in notebooks, + while preserving the existing behaviour in knit documents (#232). + +# stringr 1.3.0 + +## API changes + +* During package build, you may see + `Error : object ‘ignore.case’ is not exported by 'namespace:stringr'`. + This is because the long deprecated `str_join()`, `ignore.case()` and + `perl()` have now been removed. + +## New features + +* `str_glue()` and `str_glue_data()` provide convenient wrappers around + `glue` and `glue_data()` from the [glue](https://glue.tidyverse.org/) package + (#157). + +* `str_flatten()` is a wrapper around `stri_flatten()` and clearly + conveys flattening a character vector into a single string (#186). + +* `str_remove()` and `str_remove_all()` functions. These wrap + `str_replace()` and `str_replace_all()` to remove patterns from strings. + (@Shians, #178) + +* `str_squish()` removes spaces from both the left and right side of strings, + and also converts multiple space (or space-like characters) to a single + space within strings (@stephlocke, #197). + +* `str_sub()` gains `omit_na` argument for ignoring `NA`. Accordingly, + `str_replace()` now ignores `NA`s and keeps the original strings. + (@yutannihilation, #164) + +## Bug fixes and minor improvements + +* `str_trunc()` now preserves NAs (@ClaytonJY, #162) + +* `str_trunc()` now throws an error when `width` is shorter than `ellipsis` + (@ClaytonJY, #163). + +* Long deprecated `str_join()`, `ignore.case()` and `perl()` have now been + removed. + +# stringr 1.2.0 + +## API changes + +* `str_match_all()` now returns NA if an optional group doesn't match + (previously it returned ""). This is more consistent with `str_match()` + and other match failures (#134). + +## New features + +* In `str_replace()`, `replacement` can now be a function that is called once + for each match and whose return value is used to replace the match. + +* New `str_which()` mimics `grep()` (#129). + +* A new vignette (`vignette("regular-expressions")`) describes the + details of the regular expressions supported by stringr. + The main vignette (`vignette("stringr")`) has been updated to + give a high-level overview of the package. + +## Minor improvements and bug fixes + +* `str_order()` and `str_sort()` gain explicit `numeric` argument for sorting + mixed numbers and strings. + +* `str_replace_all()` now throws an error if `replacement` is not a character + vector. If `replacement` is `NA_character_` it replaces the complete string + with replaces with `NA` (#124). + +* All functions that take a locale (e.g. `str_to_lower()` and `str_sort()`) + default to "en" (English) to ensure that the default is consistent across + platforms. + +# stringr 1.1.0 + +* Add sample datasets: `fruit`, `words` and `sentences`. + +* `fixed()`, `regex()`, and `coll()` now throw an error if you use them with + anything other than a plain string (#60). I've clarified that the replacement + for `perl()` is `regex()` not `regexp()` (#61). `boundary()` has improved + defaults when splitting on non-word boundaries (#58, @lmullen). + +* `str_detect()` now can detect boundaries (by checking for a `str_count()` > 0) + (#120). `str_subset()` works similarly. + +* `str_extract()` and `str_extract_all()` now work with `boundary()`. This is + particularly useful if you want to extract logical constructs like words + or sentences. `str_extract_all()` respects the `simplify` argument + when used with `fixed()` matches. + +* `str_subset()` now respects custom options for `fixed()` patterns + (#79, @gagolews). + +* `str_replace()` and `str_replace_all()` now behave correctly when a + replacement string contains `$`s, `\\\\1`, etc. (#83, #99). + +* `str_split()` gains a `simplify` argument to match `str_extract_all()` + etc. + +* `str_view()` and `str_view_all()` create HTML widgets that display regular + expression matches (#96). + +* `word()` returns `NA` for indexes greater than number of words (#112). + +# stringr 1.0.0 + +* stringr is now powered by [stringi](https://github.com/gagolews/stringi) + instead of base R regular expressions. This improves unicode and support, and + makes most operations considerably faster. If you find stringr inadequate for + your string processing needs, I highly recommend looking at stringi in more + detail. + +* stringr gains a vignette, currently a straight forward update of the article + that appeared in the R Journal. + +* `str_c()` now returns a zero length vector if any of its inputs are + zero length vectors. This is consistent with all other functions, and + standard R recycling rules. Similarly, using `str_c("x", NA)` now + yields `NA`. If you want `"xNA"`, use `str_replace_na()` on the inputs. + +* `str_replace_all()` gains a convenient syntax for applying multiple pairs of + pattern and replacement to the same vector: + + ```R + input <- c("abc", "def") + str_replace_all(input, c("[ad]" = "!", "[cf]" = "?")) + ``` + +* `str_match()` now returns NA if an optional group doesn't match + (previously it returned ""). This is more consistent with `str_extract()` + and other match failures. + +* New `str_subset()` keeps values that match a pattern. It's a convenient + wrapper for `x[str_detect(x)]` (#21, @jiho). + +* New `str_order()` and `str_sort()` allow you to sort and order strings + in a specified locale. + +* New `str_conv()` to convert strings from specified encoding to UTF-8. + +* New modifier `boundary()` allows you to count, locate and split by + character, word, line and sentence boundaries. + +* The documentation got a lot of love, and very similar functions (e.g. + first and all variants) are now documented together. This should hopefully + make it easier to locate the function you need. + +* `ignore.case(x)` has been deprecated in favour of + `fixed|regex|coll(x, ignore.case = TRUE)`, `perl(x)` has been deprecated in + favour of `regex(x)`. + +* `str_join()` is deprecated, please use `str_c()` instead. + +# stringr 0.6.2 + +* fixed path in `str_wrap` example so works for more R installations. + +* remove dependency on plyr + +# stringr 0.6.1 + +* Zero input to `str_split_fixed` returns 0 row matrix with `n` columns + +* Export `str_join` + +# stringr 0.6 + +* new modifier `perl` that switches to Perl regular expressions + +* `str_match` now uses new base function `regmatches` to extract matches - + this should hopefully be faster than my previous pure R algorithm + +# stringr 0.5 + +* new `str_wrap` function which gives `strwrap` output in a more convenient + format + +* new `word` function extract words from a string given user defined + separator (thanks to suggestion by David Cooper) + +* `str_locate` now returns consistent type when matching empty string (thanks + to Stavros Macrakis) + +* new `str_count` counts number of matches in a string. + +* `str_pad` and `str_trim` receive performance tweaks - for large vectors this + should give at least a two order of magnitude speed up + +* str_length returns NA for invalid multibyte strings + +* fix small bug in internal `recyclable` function + +# stringr 0.4 + + * all functions now vectorised with respect to string, pattern (and + where appropriate) replacement parameters + * fixed() function now tells stringr functions to use fixed matching, rather + than escaping the regular expression. Should improve performance for + large vectors. + * new ignore.case() modifier tells stringr functions to ignore case of + pattern. + * str_replace renamed to str_replace_all and new str_replace function added. + This makes str_replace consistent with all functions. + * new str_sub<- function (analogous to substring<-) for substring replacement + * str_sub now understands negative positions as a position from the end of + the string. -1 replaces Inf as indicator for string end. + * str_pad side argument can be left, right, or both (instead of center) + * str_trim gains side argument to better match str_pad + * stringr now has a namespace and imports plyr (rather than requiring it) + +# stringr 0.3 + + * fixed() now also escapes | + * str_join() renamed to str_c() + * all functions more carefully check input and return informative error + messages if not as expected. + * add invert_match() function to convert a matrix of location of matches to + locations of non-matches + * add fixed() function to allow matching of fixed strings. + +# stringr 0.2 + + * str_length now returns correct results when used with factors + * str_sub now correctly replaces Inf in end argument with length of string + * new function str_split_fixed returns fixed number of splits in a character + matrix + * str_split no longer uses strsplit to preserve trailing breaks diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/R/stringr b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/R/stringr new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/R/stringr @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/R/stringr.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/R/stringr.rdb new file mode 100644 index 00000000..be224780 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/R/stringr.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/R/stringr.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/R/stringr.rdx new file mode 100644 index 00000000..fa4d5f59 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/R/stringr.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/data/Rdata.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/data/Rdata.rdb new file mode 100644 index 00000000..3b868953 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/data/Rdata.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/data/Rdata.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/data/Rdata.rds new file mode 100644 index 00000000..2a40bfa7 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/data/Rdata.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/data/Rdata.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/data/Rdata.rdx new file mode 100644 index 00000000..9bd5c7fe Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/data/Rdata.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/from-base.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/from-base.R new file mode 100644 index 00000000..444fc77a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/from-base.R @@ -0,0 +1,326 @@ +## ----------------------------------------------------------------------------- +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) + +library(stringr) +library(magrittr) + +## ----------------------------------------------------------------------------- +data_stringr_base_diff <- tibble::tribble( + ~stringr, ~base_r, + "str_detect(string, pattern)", "grepl(pattern, x)", + "str_dup(string, times)", "strrep(x, times)", + "str_extract(string, pattern)", "regmatches(x, m = regexpr(pattern, text))", + "str_extract_all(string, pattern)", "regmatches(x, m = gregexpr(pattern, text))", + "str_length(string)", "nchar(x)", + "str_locate(string, pattern)", "regexpr(pattern, text)", + "str_locate_all(string, pattern)", "gregexpr(pattern, text)", + "str_match(string, pattern)", "regmatches(x, m = regexec(pattern, text))", + "str_order(string)", "order(...)", + "str_replace(string, pattern, replacement)", "sub(pattern, replacement, x)", + "str_replace_all(string, pattern, replacement)", "gsub(pattern, replacement, x)", + "str_sort(string)", "sort(x)", + "str_split(string, pattern)", "strsplit(x, split)", + "str_sub(string, start, end)", "substr(x, start, stop)", + "str_subset(string, pattern)", "grep(pattern, x, value = TRUE)", + "str_to_lower(string)", "tolower(x)", + "str_to_title(string)", "tools::toTitleCase(text)", + "str_to_upper(string)", "toupper(x)", + "str_trim(string)", "trimws(x)", + "str_which(string, pattern)", "grep(pattern, x)", + "str_wrap(string)", "strwrap(x)" +) + +# create MD table, arranged alphabetically by stringr fn name +data_stringr_base_diff %>% + dplyr::mutate(dplyr::across(.fns = ~ paste0("`", .x, "`"))) %>% + dplyr::arrange(stringr) %>% + dplyr::rename(`base R` = base_r) %>% + gt::gt() %>% + gt::fmt_markdown(columns = everything()) %>% + gt::tab_options(column_labels.font.weight = "bold") + +## ----------------------------------------------------------------------------- +fruit <- c("apple", "banana", "pear", "pineapple") + +# base +grepl(pattern = "a", x = fruit) + +# stringr +str_detect(fruit, pattern = "a") + +## ----------------------------------------------------------------------------- +# base +grep(pattern = "a", x = fruit) + +# stringr +str_which(fruit, pattern = "a") + +## ----------------------------------------------------------------------------- +# base +loc <- gregexpr(pattern = "a", text = fruit, fixed = TRUE) +sapply(loc, function(x) length(attr(x, "match.length"))) + +# stringr +str_count(fruit, pattern = "a") + +## ----------------------------------------------------------------------------- +fruit3 <- c("papaya", "lime", "apple") + +# base +str(gregexpr(pattern = "p", text = fruit3)) + +# stringr +str_locate(fruit3, pattern = "p") +str_locate_all(fruit3, pattern = "p") + +## ----------------------------------------------------------------------------- +hw <- "Hadley Wickham" + +# base +substr(hw, start = 1, stop = 6) +substring(hw, first = 1) + +# stringr +str_sub(hw, start = 1, end = 6) +str_sub(hw, start = 1) +str_sub(hw, end = 6) + +## ----------------------------------------------------------------------------- +str_sub(hw, start = 1, end = -1) +str_sub(hw, start = -5, end = -2) + +## ----------------------------------------------------------------------------- +al <- "Ada Lovelace" + +# base +substr(c(hw,al), start = 1, stop = 6) +substr(c(hw,al), start = c(1,1), stop = c(6,7)) + +# stringr +str_sub(c(hw,al), start = 1, end = -1) +str_sub(c(hw,al), start = c(1,1), end = c(-1,-2)) + +## ----------------------------------------------------------------------------- +str_sub(hw, start = 1:5) + +## ----------------------------------------------------------------------------- +substr(hw, start = 1:5, stop = 15) + +## ----------------------------------------------------------------------------- +# base +x <- "ABCDEF" +substr(x, 1, 3) <- "x" +x + +## ----------------------------------------------------------------------------- +# stringr +x <- "ABCDEF" +str_sub(x, 1, 3) <- "x" +x + +## ----------------------------------------------------------------------------- +# base +grep(pattern = "g", x = fruit, value = TRUE) + +# stringr +str_subset(fruit, pattern = "g") + +## ----------------------------------------------------------------------------- +shopping_list <- c("apples x4", "bag of flour", "10", "milk x2") + +# base +matches <- regexpr(pattern = "\\d+", text = shopping_list) # digits +regmatches(shopping_list, m = matches) + +matches <- gregexpr(pattern = "[a-z]+", text = shopping_list) # words +regmatches(shopping_list, m = matches) + +# stringr +str_extract(shopping_list, pattern = "\\d+") +str_extract_all(shopping_list, "[a-z]+") + +## ----------------------------------------------------------------------------- +head(sentences) +noun <- "([A]a|[Tt]he) ([^ ]+)" + +# base +matches <- regexec(pattern = noun, text = head(sentences)) +do.call("rbind", regmatches(x = head(sentences), m = matches)) + +# stringr +str_match(head(sentences), pattern = noun) + +## ----------------------------------------------------------------------------- +# base +nchar(letters) + +# stringr +str_length(letters) + +## ----------------------------------------------------------------------------- +# base +nchar(factor("abc")) + +## ----------------------------------------------------------------------------- +# stringr +str_length(factor("abc")) + +## ----------------------------------------------------------------------------- +x <- c("\u00fc", "u\u0308") +x + +nchar(x) +str_length(x) + +## ----------------------------------------------------------------------------- +# base +sprintf("%30s", "hadley") +sprintf("%-30s", "hadley") +# "both" is not as straightforward + +# stringr +rbind( + str_pad("hadley", 30, "left"), + str_pad("hadley", 30, "right"), + str_pad("hadley", 30, "both") +) + +## ----------------------------------------------------------------------------- +x <- "This string is moderately long" + +# stringr +rbind( + str_trunc(x, 20, "right"), + str_trunc(x, 20, "left"), + str_trunc(x, 20, "center") +) + +## ----------------------------------------------------------------------------- +# base +trimws(" String with trailing and leading white space\t") +trimws("\n\nString with trailing and leading white space\n\n") + +# stringr +str_trim(" String with trailing and leading white space\t") +str_trim("\n\nString with trailing and leading white space\n\n") + +## ----------------------------------------------------------------------------- +# stringr +str_squish(" String with trailing, middle, and leading white space\t") +str_squish("\n\nString with excess, trailing and leading white space\n\n") + +## ----------------------------------------------------------------------------- +gettysburg <- "Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal." + +# base +cat(strwrap(gettysburg, width = 60), sep = "\n") + +# stringr +cat(str_wrap(gettysburg, width = 60), "\n") + +## ----------------------------------------------------------------------------- +fruits <- c("apple", "banana", "pear", "pineapple") + +# base +sub("[aeiou]", "-", fruits) +gsub("[aeiou]", "-", fruits) + +# stringr +str_replace(fruits, "[aeiou]", "-") +str_replace_all(fruits, "[aeiou]", "-") + +## ----------------------------------------------------------------------------- +dog <- "The quick brown dog" + +# base +toupper(dog) +tolower(dog) +tools::toTitleCase(dog) + +# stringr +str_to_upper(dog) +str_to_lower(dog) +str_to_title(dog) + +## ----------------------------------------------------------------------------- +# stringr +str_to_upper("i") # English +str_to_upper("i", locale = "tr") # Turkish + +## ----------------------------------------------------------------------------- +# base +paste0(letters, collapse = "-") + +# stringr +str_flatten(letters, collapse = "-") + +## ----------------------------------------------------------------------------- +fruit <- c("apple", "pear", "banana") + +# base +strrep(fruit, 2) +strrep(fruit, 1:3) + +# stringr +str_dup(fruit, 2) +str_dup(fruit, 1:3) + +## ----------------------------------------------------------------------------- +fruits <- c( + "apples and oranges and pears and bananas", + "pineapples and mangos and guavas" +) +# base +strsplit(fruits, " and ") + +# stringr +str_split(fruits, " and ") + +## ----------------------------------------------------------------------------- +# stringr +str_split(fruits, " and ", n = 3) +str_split(fruits, " and ", n = 2) + +## ----------------------------------------------------------------------------- +name <- "Fred" +age <- 50 +anniversary <- as.Date("1991-10-12") + +# base +sprintf( + "My name is %s my age next year is %s and my anniversary is %s.", + name, + age + 1, + format(anniversary, "%A, %B %d, %Y") +) + +# stringr +str_glue( + "My name is {name}, ", + "my age next year is {age + 1}, ", + "and my anniversary is {format(anniversary, '%A, %B %d, %Y')}." +) + +## ----------------------------------------------------------------------------- +# base +order(letters) +sort(letters) + +# stringr +str_order(letters) +str_sort(letters) + +## ----------------------------------------------------------------------------- +x <- c("å", "a", "z") +str_sort(x) +str_sort(x, locale = "no") + +## ----------------------------------------------------------------------------- +# stringr +x <- c("100a10", "100a5", "2b", "2a") +str_sort(x) +str_sort(x, numeric = TRUE) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/from-base.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/from-base.Rmd new file mode 100644 index 00000000..40319869 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/from-base.Rmd @@ -0,0 +1,547 @@ +--- +title: "From base R" +author: "Sara Stoudt" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{From base R} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r} +#| label: setup +#| include: false + +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) + +library(stringr) +library(magrittr) +``` + +This vignette compares stringr functions to their base R equivalents to help users transitioning from using base R to stringr. + +# Overall differences + +We'll begin with a lookup table between the most important stringr functions and their base R equivalents. + +```{r} +#| label: stringr-base-r-diff +#| echo: false + +data_stringr_base_diff <- tibble::tribble( + ~stringr, ~base_r, + "str_detect(string, pattern)", "grepl(pattern, x)", + "str_dup(string, times)", "strrep(x, times)", + "str_extract(string, pattern)", "regmatches(x, m = regexpr(pattern, text))", + "str_extract_all(string, pattern)", "regmatches(x, m = gregexpr(pattern, text))", + "str_length(string)", "nchar(x)", + "str_locate(string, pattern)", "regexpr(pattern, text)", + "str_locate_all(string, pattern)", "gregexpr(pattern, text)", + "str_match(string, pattern)", "regmatches(x, m = regexec(pattern, text))", + "str_order(string)", "order(...)", + "str_replace(string, pattern, replacement)", "sub(pattern, replacement, x)", + "str_replace_all(string, pattern, replacement)", "gsub(pattern, replacement, x)", + "str_sort(string)", "sort(x)", + "str_split(string, pattern)", "strsplit(x, split)", + "str_sub(string, start, end)", "substr(x, start, stop)", + "str_subset(string, pattern)", "grep(pattern, x, value = TRUE)", + "str_to_lower(string)", "tolower(x)", + "str_to_title(string)", "tools::toTitleCase(text)", + "str_to_upper(string)", "toupper(x)", + "str_trim(string)", "trimws(x)", + "str_which(string, pattern)", "grep(pattern, x)", + "str_wrap(string)", "strwrap(x)" +) + +# create MD table, arranged alphabetically by stringr fn name +data_stringr_base_diff %>% + dplyr::mutate(dplyr::across(.fns = ~ paste0("`", .x, "`"))) %>% + dplyr::arrange(stringr) %>% + dplyr::rename(`base R` = base_r) %>% + gt::gt() %>% + gt::fmt_markdown(columns = everything()) %>% + gt::tab_options(column_labels.font.weight = "bold") +``` + +Overall the main differences between base R and stringr are: + +1. stringr functions start with `str_` prefix; base R string functions have no + consistent naming scheme. + +1. The order of inputs is usually different between base R and stringr. + In base R, the `pattern` to match usually comes first; in stringr, the + `string` to manupulate always comes first. This makes stringr easier + to use in pipes, and with `lapply()` or `purrr::map()`. + +1. Functions in stringr tend to do less, where many of the string processing + functions in base R have multiple purposes. + +1. The output and input of stringr functions has been carefully designed. + For example, the output of `str_locate()` can be fed directly into + `str_sub()`; the same is not true of `regpexpr()` and `substr()`. + +1. Base functions use arguments (like `perl`, `fixed`, and `ignore.case`) + to control how the pattern is interpreted. To avoid dependence between + arguments, stringr instead uses helper functions (like `fixed()`, + `regex()`, and `coll()`). + +Next we'll walk through each of the functions, noting the similarities and important differences. These examples are adapted from the stringr documentation and here they are contrasted with the analogous base R operations. + +# Detect matches + +## `str_detect()`: Detect the presence or absence of a pattern in a string + +Suppose you want to know whether each word in a vector of fruit names contains an "a". + +```{r} +fruit <- c("apple", "banana", "pear", "pineapple") + +# base +grepl(pattern = "a", x = fruit) + +# stringr +str_detect(fruit, pattern = "a") +``` + +In base you would use `grepl()` (see the "l" and think logical) while in stringr you use `str_detect()` (see the verb "detect" and think of a yes/no action). + +## `str_which()`: Find positions matching a pattern + +Now you want to identify the positions of the words in a vector of fruit names that contain an "a". + +```{r} +# base +grep(pattern = "a", x = fruit) + +# stringr +str_which(fruit, pattern = "a") +``` + +In base you would use `grep()` while in stringr you use `str_which()` (by analogy to `which()`). + +## `str_count()`: Count the number of matches in a string + +How many "a"s are in each fruit? + +```{r} +# base +loc <- gregexpr(pattern = "a", text = fruit, fixed = TRUE) +sapply(loc, function(x) length(attr(x, "match.length"))) + +# stringr +str_count(fruit, pattern = "a") +``` + +This information can be gleaned from `gregexpr()` in base, but you need to look at the `match.length` attribute as the vector uses a length-1 integer vector (`-1`) to indicate no match. + +## `str_locate()`: Locate the position of patterns in a string + +Within each fruit, where does the first "p" occur? Where are all of the "p"s? + +```{r} +fruit3 <- c("papaya", "lime", "apple") + +# base +str(gregexpr(pattern = "p", text = fruit3)) + +# stringr +str_locate(fruit3, pattern = "p") +str_locate_all(fruit3, pattern = "p") +``` + +# Subset strings + +## `str_sub()`: Extract and replace substrings from a character vector + +What if we want to grab part of a string? + +```{r} +hw <- "Hadley Wickham" + +# base +substr(hw, start = 1, stop = 6) +substring(hw, first = 1) + +# stringr +str_sub(hw, start = 1, end = 6) +str_sub(hw, start = 1) +str_sub(hw, end = 6) +``` + +In base you could use `substr()` or `substring()`. The former requires both a start and stop of the substring while the latter assumes the stop will be the end of the string. The stringr version, `str_sub()` has the same functionality, but also gives a default start value (the beginning of the string). Both the base and stringr functions have the same order of expected inputs. + +In stringr you can use negative numbers to index from the right-hand side string: -1 is the last letter, -2 is the second to last, and so on. + +```{r} +str_sub(hw, start = 1, end = -1) +str_sub(hw, start = -5, end = -2) +``` + +Both base R and stringr subset are vectorized over their parameters. This means you can either choose the same subset across multiple strings or specify different subsets for different strings. + +```{r} +al <- "Ada Lovelace" + +# base +substr(c(hw,al), start = 1, stop = 6) +substr(c(hw,al), start = c(1,1), stop = c(6,7)) + +# stringr +str_sub(c(hw,al), start = 1, end = -1) +str_sub(c(hw,al), start = c(1,1), end = c(-1,-2)) +``` + +stringr will automatically recycle the first argument to the same length as `start` and `stop`: + +```{r} +str_sub(hw, start = 1:5) +``` + +Whereas the base equivalent silently uses just the first value: + +```{r} +substr(hw, start = 1:5, stop = 15) +``` + +## `str_sub() <- `: Subset assignment + +`substr()` behaves in a surprising way when you replace a substring with a different number of characters: + +```{r} +# base +x <- "ABCDEF" +substr(x, 1, 3) <- "x" +x +``` + +`str_sub()` does what you would expect: + +```{r} +# stringr +x <- "ABCDEF" +str_sub(x, 1, 3) <- "x" +x +``` + +## `str_subset()`: Keep strings matching a pattern, or find positions + +We may want to retrieve strings that contain a pattern of interest: + +```{r} +# base +grep(pattern = "g", x = fruit, value = TRUE) + +# stringr +str_subset(fruit, pattern = "g") +``` + +## `str_extract()`: Extract matching patterns from a string + +We may want to pick out certain patterns from a string, for example, the digits in a shopping list: + +```{r} +shopping_list <- c("apples x4", "bag of flour", "10", "milk x2") + +# base +matches <- regexpr(pattern = "\\d+", text = shopping_list) # digits +regmatches(shopping_list, m = matches) + +matches <- gregexpr(pattern = "[a-z]+", text = shopping_list) # words +regmatches(shopping_list, m = matches) + +# stringr +str_extract(shopping_list, pattern = "\\d+") +str_extract_all(shopping_list, "[a-z]+") +``` + +Base R requires the combination of `regexpr()` with `regmatches()`; but note that the strings without matches are dropped from the output. stringr provides `str_extract()` and `str_extract_all()`, and the output is always the same length as the input. + +## `str_match()`: Extract matched groups from a string + +We may also want to extract groups from a string. Here I'm going to use the scenario from Section 14.4.3 in [R for Data Science](https://r4ds.had.co.nz/strings.html). + +```{r} +head(sentences) +noun <- "([A]a|[Tt]he) ([^ ]+)" + +# base +matches <- regexec(pattern = noun, text = head(sentences)) +do.call("rbind", regmatches(x = head(sentences), m = matches)) + +# stringr +str_match(head(sentences), pattern = noun) +``` + +As for extracting the full match base R requires the combination of two functions, and inputs with no matches are dropped from the output. + +# Manage lengths + +## `str_length()`: The length of a string + +To determine the length of a string, base R uses `nchar()` (not to be confused with `length()` which gives the length of vectors, etc.) while stringr uses `str_length()`. + +```{r} +# base +nchar(letters) + +# stringr +str_length(letters) +``` + +There are some subtle differences between base and stringr here. `nchar()` requires a character vector, so it will return an error if used on a factor. `str_length()` can handle a factor input. + +```{r} +#| error: true + +# base +nchar(factor("abc")) +``` + +```{r} +# stringr +str_length(factor("abc")) +``` + +Note that "characters" is a poorly defined concept, and technically both `nchar()` and `str_length()` returns the number of code points. This is usually the same as what you'd consider to be a charcter, but not always: + +```{r} +x <- c("\u00fc", "u\u0308") +x + +nchar(x) +str_length(x) +``` + +## `str_pad()`: Pad a string + +To pad a string to a certain width, use stringr's `str_pad()`. In base R you could use `sprintf()`, but unlike `str_pad()`, `sprintf()` has many other functionalities. + +```{r} +# base +sprintf("%30s", "hadley") +sprintf("%-30s", "hadley") +# "both" is not as straightforward + +# stringr +rbind( + str_pad("hadley", 30, "left"), + str_pad("hadley", 30, "right"), + str_pad("hadley", 30, "both") +) +``` + +## `str_trunc()`: Truncate a character string + +The stringr package provides an easy way to truncate a character string: `str_trunc()`. Base R has no function to do this directly. + +```{r} +x <- "This string is moderately long" + +# stringr +rbind( + str_trunc(x, 20, "right"), + str_trunc(x, 20, "left"), + str_trunc(x, 20, "center") +) +``` + +## `str_trim()`: Trim whitespace from a string + +Similarly, stringr provides `str_trim()` to trim whitespace from a string. This is analogous to base R's `trimws()` added in R 3.3.0. + +```{r} +# base +trimws(" String with trailing and leading white space\t") +trimws("\n\nString with trailing and leading white space\n\n") + +# stringr +str_trim(" String with trailing and leading white space\t") +str_trim("\n\nString with trailing and leading white space\n\n") +``` + +The stringr function `str_squish()` allows for extra whitespace within a string to be trimmed (in contrast to `str_trim()` which removes whitespace at the beginning and/or end of string). In base R, one might take advantage of `gsub()` to accomplish the same effect. + +```{r} +# stringr +str_squish(" String with trailing, middle, and leading white space\t") +str_squish("\n\nString with excess, trailing and leading white space\n\n") +``` + +## `str_wrap()`: Wrap strings into nicely formatted paragraphs + +`strwrap()` and `str_wrap()` use different algorithms. `str_wrap()` uses the famous [Knuth-Plass algorithm](http://litherum.blogspot.com/2015/07/knuth-plass-line-breaking-algorithm.html). + +```{r} +gettysburg <- "Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal." + +# base +cat(strwrap(gettysburg, width = 60), sep = "\n") + +# stringr +cat(str_wrap(gettysburg, width = 60), "\n") +``` + +Note that `strwrap()` returns a character vector with one element for each line; `str_wrap()` returns a single string containing line breaks. + +# Mutate strings + +## `str_replace()`: Replace matched patterns in a string + +To replace certain patterns within a string, stringr provides the functions `str_replace()` and `str_replace_all()`. The base R equivalents are `sub()` and `gsub()`. Note the difference in default input order again. + +```{r} +fruits <- c("apple", "banana", "pear", "pineapple") + +# base +sub("[aeiou]", "-", fruits) +gsub("[aeiou]", "-", fruits) + +# stringr +str_replace(fruits, "[aeiou]", "-") +str_replace_all(fruits, "[aeiou]", "-") +``` + +## case: Convert case of a string + +Both stringr and base R have functions to convert to upper and lower case. Title case is also provided in stringr. + +```{r} +dog <- "The quick brown dog" + +# base +toupper(dog) +tolower(dog) +tools::toTitleCase(dog) + +# stringr +str_to_upper(dog) +str_to_lower(dog) +str_to_title(dog) +``` + +In stringr we can control the locale, while in base R locale distinctions are controlled with global variables. Therefore, the output of your base R code may vary across different computers with different global settings. + +```{r} +# stringr +str_to_upper("i") # English +str_to_upper("i", locale = "tr") # Turkish +``` + +# Join and split + +## `str_flatten()`: Flatten a string + +If we want to take elements of a string vector and collapse them to a single string we can use the `collapse` argument in `paste()` or use stringr's `str_flatten()`. + +```{r} +# base +paste0(letters, collapse = "-") + +# stringr +str_flatten(letters, collapse = "-") +``` + +The advantage of `str_flatten()` is that it always returns a vector the same length as its input; to predict the return length of `paste()` you must carefully read all arguments. + +## `str_dup()`: duplicate strings within a character vector + +To duplicate strings within a character vector use `strrep()` (in R 3.3.0 or greater) or `str_dup()`: + +```{r} +#| eval: !expr getRversion() >= "3.3.0" + +fruit <- c("apple", "pear", "banana") + +# base +strrep(fruit, 2) +strrep(fruit, 1:3) + +# stringr +str_dup(fruit, 2) +str_dup(fruit, 1:3) +``` + +## `str_split()`: Split up a string into pieces + +To split a string into pieces with breaks based on a particular pattern match stringr uses `str_split()` and base R uses `strsplit()`. Unlike most other functions, `strsplit()` starts with the character vector to modify. + +```{r} +fruits <- c( + "apples and oranges and pears and bananas", + "pineapples and mangos and guavas" +) +# base +strsplit(fruits, " and ") + +# stringr +str_split(fruits, " and ") +``` + +The stringr package's `str_split()` allows for more control over the split, including restricting the number of possible matches. + +```{r} +# stringr +str_split(fruits, " and ", n = 3) +str_split(fruits, " and ", n = 2) +``` + +## `str_glue()`: Interpolate strings + +It's often useful to interpolate varying values into a fixed string. In base R, you can use `sprintf()` for this purpose; stringr provides a wrapper for the more general purpose [glue](https://glue.tidyverse.org) package. + +```{r} +name <- "Fred" +age <- 50 +anniversary <- as.Date("1991-10-12") + +# base +sprintf( + "My name is %s my age next year is %s and my anniversary is %s.", + name, + age + 1, + format(anniversary, "%A, %B %d, %Y") +) + +# stringr +str_glue( + "My name is {name}, ", + "my age next year is {age + 1}, ", + "and my anniversary is {format(anniversary, '%A, %B %d, %Y')}." +) +``` + +# Order strings + +## `str_order()`: Order or sort a character vector + +Both base R and stringr have separate functions to order and sort strings. + +```{r} +# base +order(letters) +sort(letters) + +# stringr +str_order(letters) +str_sort(letters) +``` + +Some options in `str_order()` and `str_sort()` don't have analogous base R options. For example, the stringr functions have a `locale` argument to control how to order or sort. In base R the locale is a global setting, so the outputs of `sort()` and `order()` may differ across different computers. For example, in the Norwegian alphabet, å comes after z: + +```{r} +x <- c("å", "a", "z") +str_sort(x) +str_sort(x, locale = "no") +``` + +The stringr functions also have a `numeric` argument to sort digits numerically instead of treating them as strings. + +```{r} +# stringr +x <- c("100a10", "100a5", "2b", "2a") +str_sort(x) +str_sort(x, numeric = TRUE) +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/from-base.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/from-base.html new file mode 100644 index 00000000..57b992dc --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/from-base.html @@ -0,0 +1,1488 @@ + + + + + + + + + + + + + + + +From base R + + + + + + + + + + + + + + + + + + + + + + + + + + +

From base R

+

Sara Stoudt

+ + + +

This vignette compares stringr functions to their base R equivalents +to help users transitioning from using base R to stringr.

+
+

Overall differences

+

We’ll begin with a lookup table between the most important stringr +functions and their base R equivalents.

+
#> Warning: There was 1 warning in `dplyr::mutate()`.
+#> ℹ In argument: `dplyr::across(.fns = ~paste0("`", .x, "`"))`.
+#> Caused by warning:
+#> ! Using `across()` without supplying `.cols` was deprecated in dplyr 1.1.0.
+#> ℹ Please supply `.cols` instead.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
stringrbase R

str_detect(string, pattern)

+

grepl(pattern, x)

+

str_dup(string, times)

+

strrep(x, times)

+

str_extract(string, pattern)

+

regmatches(x, m = regexpr(pattern, text))

+

str_extract_all(string, pattern)

+

regmatches(x, m = gregexpr(pattern, text))

+

str_length(string)

+

nchar(x)

+

str_locate(string, pattern)

+

regexpr(pattern, text)

+

str_locate_all(string, pattern)

+

gregexpr(pattern, text)

+

str_match(string, pattern)

+

regmatches(x, m = regexec(pattern, text))

+

str_order(string)

+

order(...)

+

str_replace(string, pattern, replacement)

+

sub(pattern, replacement, x)

+

str_replace_all(string, pattern, replacement)

+

gsub(pattern, replacement, x)

+

str_sort(string)

+

sort(x)

+

str_split(string, pattern)

+

strsplit(x, split)

+

str_sub(string, start, end)

+

substr(x, start, stop)

+

str_subset(string, pattern)

+

grep(pattern, x, value = TRUE)

+

str_to_lower(string)

+

tolower(x)

+

str_to_title(string)

+

tools::toTitleCase(text)

+

str_to_upper(string)

+

toupper(x)

+

str_trim(string)

+

trimws(x)

+

str_which(string, pattern)

+

grep(pattern, x)

+

str_wrap(string)

+

strwrap(x)

+
+
+

Overall the main differences between base R and stringr are:

+
    +
  1. stringr functions start with str_ prefix; base R +string functions have no consistent naming scheme.

  2. +
  3. The order of inputs is usually different between base R and +stringr. In base R, the pattern to match usually comes +first; in stringr, the string to manupulate always comes +first. This makes stringr easier to use in pipes, and with +lapply() or purrr::map().

  4. +
  5. Functions in stringr tend to do less, where many of the string +processing functions in base R have multiple purposes.

  6. +
  7. The output and input of stringr functions has been carefully +designed. For example, the output of str_locate() can be +fed directly into str_sub(); the same is not true of +regpexpr() and substr().

  8. +
  9. Base functions use arguments (like perl, +fixed, and ignore.case) to control how the +pattern is interpreted. To avoid dependence between arguments, stringr +instead uses helper functions (like fixed(), +regex(), and coll()).

  10. +
+

Next we’ll walk through each of the functions, noting the +similarities and important differences. These examples are adapted from +the stringr documentation and here they are contrasted with the +analogous base R operations.

+
+
+

Detect matches

+
+

str_detect(): Detect the presence or absence of a +pattern in a string

+

Suppose you want to know whether each word in a vector of fruit names +contains an “a”.

+
fruit <- c("apple", "banana", "pear", "pineapple")
+
+# base
+grepl(pattern = "a", x = fruit)
+#> [1] TRUE TRUE TRUE TRUE
+
+# stringr
+str_detect(fruit, pattern = "a")
+#> [1] TRUE TRUE TRUE TRUE
+

In base you would use grepl() (see the “l” and think +logical) while in stringr you use str_detect() (see the +verb “detect” and think of a yes/no action).

+
+
+

str_which(): Find positions matching a pattern

+

Now you want to identify the positions of the words in a vector of +fruit names that contain an “a”.

+
# base
+grep(pattern = "a", x = fruit)
+#> [1] 1 2 3 4
+
+# stringr
+str_which(fruit, pattern = "a")
+#> [1] 1 2 3 4
+

In base you would use grep() while in stringr you use +str_which() (by analogy to which()).

+
+
+

str_count(): Count the number of matches in a +string

+

How many “a”s are in each fruit?

+
# base 
+loc <- gregexpr(pattern = "a", text = fruit, fixed = TRUE)
+sapply(loc, function(x) length(attr(x, "match.length")))
+#> [1] 1 3 1 1
+
+# stringr
+str_count(fruit, pattern = "a")
+#> [1] 1 3 1 1
+

This information can be gleaned from gregexpr() in base, +but you need to look at the match.length attribute as the +vector uses a length-1 integer vector (-1) to indicate no +match.

+
+
+

str_locate(): Locate the position of patterns in a +string

+

Within each fruit, where does the first “p” occur? Where are all of +the “p”s?

+
fruit3 <- c("papaya", "lime", "apple")
+
+# base
+str(gregexpr(pattern = "p", text = fruit3))
+#> List of 3
+#>  $ : int [1:2] 1 3
+#>   ..- attr(*, "match.length")= int [1:2] 1 1
+#>   ..- attr(*, "index.type")= chr "chars"
+#>   ..- attr(*, "useBytes")= logi TRUE
+#>  $ : int -1
+#>   ..- attr(*, "match.length")= int -1
+#>   ..- attr(*, "index.type")= chr "chars"
+#>   ..- attr(*, "useBytes")= logi TRUE
+#>  $ : int [1:2] 2 3
+#>   ..- attr(*, "match.length")= int [1:2] 1 1
+#>   ..- attr(*, "index.type")= chr "chars"
+#>   ..- attr(*, "useBytes")= logi TRUE
+
+# stringr
+str_locate(fruit3, pattern = "p")
+#>      start end
+#> [1,]     1   1
+#> [2,]    NA  NA
+#> [3,]     2   2
+str_locate_all(fruit3, pattern = "p")
+#> [[1]]
+#>      start end
+#> [1,]     1   1
+#> [2,]     3   3
+#> 
+#> [[2]]
+#>      start end
+#> 
+#> [[3]]
+#>      start end
+#> [1,]     2   2
+#> [2,]     3   3
+
+
+
+

Subset strings

+
+

str_sub(): Extract and replace substrings from a +character vector

+

What if we want to grab part of a string?

+
hw <- "Hadley Wickham"
+
+# base
+substr(hw, start = 1, stop = 6)
+#> [1] "Hadley"
+substring(hw, first = 1) 
+#> [1] "Hadley Wickham"
+
+# stringr
+str_sub(hw, start = 1, end = 6)
+#> [1] "Hadley"
+str_sub(hw, start = 1)
+#> [1] "Hadley Wickham"
+str_sub(hw, end = 6)
+#> [1] "Hadley"
+

In base you could use substr() or +substring(). The former requires both a start and stop of +the substring while the latter assumes the stop will be the end of the +string. The stringr version, str_sub() has the same +functionality, but also gives a default start value (the beginning of +the string). Both the base and stringr functions have the same order of +expected inputs.

+

In stringr you can use negative numbers to index from the right-hand +side string: -1 is the last letter, -2 is the second to last, and so +on.

+
str_sub(hw, start = 1, end = -1)
+#> [1] "Hadley Wickham"
+str_sub(hw, start = -5, end = -2)
+#> [1] "ckha"
+

Both base R and stringr subset are vectorized over their parameters. +This means you can either choose the same subset across multiple strings +or specify different subsets for different strings.

+
al <- "Ada Lovelace"
+
+# base
+substr(c(hw,al), start = 1, stop = 6)
+#> [1] "Hadley" "Ada Lo"
+substr(c(hw,al), start = c(1,1), stop = c(6,7))
+#> [1] "Hadley"  "Ada Lov"
+
+# stringr
+str_sub(c(hw,al), start = 1, end = -1)
+#> [1] "Hadley Wickham" "Ada Lovelace"
+str_sub(c(hw,al), start = c(1,1), end = c(-1,-2))
+#> [1] "Hadley Wickham" "Ada Lovelac"
+

stringr will automatically recycle the first argument to the same +length as start and stop:

+
str_sub(hw, start = 1:5)
+#> [1] "Hadley Wickham" "adley Wickham"  "dley Wickham"   "ley Wickham"   
+#> [5] "ey Wickham"
+

Whereas the base equivalent silently uses just the first value:

+
substr(hw, start = 1:5, stop = 15)
+#> [1] "Hadley Wickham"
+
+
+

str_sub() <-: Subset assignment

+

substr() behaves in a surprising way when you replace a +substring with a different number of characters:

+
# base
+x <- "ABCDEF"
+substr(x, 1, 3) <- "x"
+x
+#> [1] "xBCDEF"
+

str_sub() does what you would expect:

+
# stringr
+x <- "ABCDEF"
+str_sub(x, 1, 3) <- "x"
+x
+#> [1] "xDEF"
+
+
+

str_subset(): Keep strings matching a pattern, or find +positions

+

We may want to retrieve strings that contain a pattern of +interest:

+
# base
+grep(pattern = "g", x = fruit, value = TRUE)
+#> character(0)
+
+# stringr
+str_subset(fruit, pattern = "g")
+#> character(0)
+
+
+

str_extract(): Extract matching patterns from a +string

+

We may want to pick out certain patterns from a string, for example, +the digits in a shopping list:

+
shopping_list <- c("apples x4", "bag of flour", "10", "milk x2")
+
+# base
+matches <- regexpr(pattern = "\\d+", text = shopping_list) # digits
+regmatches(shopping_list, m = matches)
+#> [1] "4"  "10" "2"
+
+matches <- gregexpr(pattern = "[a-z]+", text = shopping_list) # words
+regmatches(shopping_list, m = matches)
+#> [[1]]
+#> [1] "apples" "x"     
+#> 
+#> [[2]]
+#> [1] "bag"   "of"    "flour"
+#> 
+#> [[3]]
+#> character(0)
+#> 
+#> [[4]]
+#> [1] "milk" "x"
+
+# stringr
+str_extract(shopping_list, pattern = "\\d+") 
+#> [1] "4"  NA   "10" "2"
+str_extract_all(shopping_list, "[a-z]+")
+#> [[1]]
+#> [1] "apples" "x"     
+#> 
+#> [[2]]
+#> [1] "bag"   "of"    "flour"
+#> 
+#> [[3]]
+#> character(0)
+#> 
+#> [[4]]
+#> [1] "milk" "x"
+

Base R requires the combination of regexpr() with +regmatches(); but note that the strings without matches are +dropped from the output. stringr provides str_extract() and +str_extract_all(), and the output is always the same length +as the input.

+
+
+

str_match(): Extract matched groups from a string

+

We may also want to extract groups from a string. Here I’m going to +use the scenario from Section 14.4.3 in R for Data Science.

+
head(sentences)
+#> [1] "The birch canoe slid on the smooth planks." 
+#> [2] "Glue the sheet to the dark blue background."
+#> [3] "It's easy to tell the depth of a well."     
+#> [4] "These days a chicken leg is a rare dish."   
+#> [5] "Rice is often served in round bowls."       
+#> [6] "The juice of lemons makes fine punch."
+noun <- "([A]a|[Tt]he) ([^ ]+)"
+
+# base
+matches <- regexec(pattern = noun, text = head(sentences))
+do.call("rbind", regmatches(x = head(sentences), m = matches))
+#>      [,1]        [,2]  [,3]   
+#> [1,] "The birch" "The" "birch"
+#> [2,] "the sheet" "the" "sheet"
+#> [3,] "the depth" "the" "depth"
+#> [4,] "The juice" "The" "juice"
+
+# stringr
+str_match(head(sentences), pattern = noun)
+#>      [,1]        [,2]  [,3]   
+#> [1,] "The birch" "The" "birch"
+#> [2,] "the sheet" "the" "sheet"
+#> [3,] "the depth" "the" "depth"
+#> [4,] NA          NA    NA     
+#> [5,] NA          NA    NA     
+#> [6,] "The juice" "The" "juice"
+

As for extracting the full match base R requires the combination of +two functions, and inputs with no matches are dropped from the +output.

+
+
+
+

Manage lengths

+
+

str_length(): The length of a string

+

To determine the length of a string, base R uses nchar() +(not to be confused with length() which gives the length of +vectors, etc.) while stringr uses str_length().

+
# base
+nchar(letters)
+#>  [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
+
+# stringr
+str_length(letters)
+#>  [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
+

There are some subtle differences between base and stringr here. +nchar() requires a character vector, so it will return an +error if used on a factor. str_length() can handle a factor +input.

+
# base
+nchar(factor("abc")) 
+#> Error in nchar(factor("abc")): 'nchar()' requires a character vector
+
# stringr
+str_length(factor("abc"))
+#> [1] 3
+

Note that “characters” is a poorly defined concept, and technically +both nchar() and str_length() returns the +number of code points. This is usually the same as what you’d consider +to be a charcter, but not always:

+
x <- c("\u00fc", "u\u0308")
+x
+#> [1] "ü" "ü"
+
+nchar(x)
+#> [1] 1 2
+str_length(x)
+#> [1] 1 2
+
+
+

str_pad(): Pad a string

+

To pad a string to a certain width, use stringr’s +str_pad(). In base R you could use sprintf(), +but unlike str_pad(), sprintf() has many other +functionalities.

+
# base
+sprintf("%30s", "hadley")
+#> [1] "                        hadley"
+sprintf("%-30s", "hadley")
+#> [1] "hadley                        "
+# "both" is not as straightforward
+
+# stringr
+rbind(
+  str_pad("hadley", 30, "left"),
+  str_pad("hadley", 30, "right"),
+  str_pad("hadley", 30, "both")
+)
+#>      [,1]                            
+#> [1,] "                        hadley"
+#> [2,] "hadley                        "
+#> [3,] "            hadley            "
+
+
+

str_trunc(): Truncate a character string

+

The stringr package provides an easy way to truncate a character +string: str_trunc(). Base R has no function to do this +directly.

+
x <- "This string is moderately long"
+
+# stringr
+rbind(
+  str_trunc(x, 20, "right"),
+  str_trunc(x, 20, "left"),
+  str_trunc(x, 20, "center")
+)
+#>      [,1]                  
+#> [1,] "This string is mo..."
+#> [2,] "...s moderately long"
+#> [3,] "This stri...ely long"
+
+
+

str_trim(): Trim whitespace from a string

+

Similarly, stringr provides str_trim() to trim +whitespace from a string. This is analogous to base R’s +trimws() added in R 3.3.0.

+
# base
+trimws(" String with trailing and leading white space\t")
+#> [1] "String with trailing and leading white space"
+trimws("\n\nString with trailing and leading white space\n\n")
+#> [1] "String with trailing and leading white space"
+
+# stringr
+str_trim(" String with trailing and leading white space\t")
+#> [1] "String with trailing and leading white space"
+str_trim("\n\nString with trailing and leading white space\n\n")
+#> [1] "String with trailing and leading white space"
+

The stringr function str_squish() allows for extra +whitespace within a string to be trimmed (in contrast to +str_trim() which removes whitespace at the beginning and/or +end of string). In base R, one might take advantage of +gsub() to accomplish the same effect.

+
# stringr
+str_squish(" String with trailing, middle,   and leading white space\t")
+#> [1] "String with trailing, middle, and leading white space"
+str_squish("\n\nString with excess, trailing and leading white space\n\n")
+#> [1] "String with excess, trailing and leading white space"
+
+
+

str_wrap(): Wrap strings into nicely formatted +paragraphs

+

strwrap() and str_wrap() use different +algorithms. str_wrap() uses the famous Knuth-Plass +algorithm.

+
gettysburg <- "Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal."
+
+# base
+cat(strwrap(gettysburg, width = 60), sep = "\n")
+#> Four score and seven years ago our fathers brought forth on
+#> this continent, a new nation, conceived in Liberty, and
+#> dedicated to the proposition that all men are created
+#> equal.
+
+# stringr
+cat(str_wrap(gettysburg, width = 60), "\n")
+#> Four score and seven years ago our fathers brought forth
+#> on this continent, a new nation, conceived in Liberty, and
+#> dedicated to the proposition that all men are created equal.
+

Note that strwrap() returns a character vector with one +element for each line; str_wrap() returns a single string +containing line breaks.

+
+
+
+

Mutate strings

+
+

str_replace(): Replace matched patterns in a +string

+

To replace certain patterns within a string, stringr provides the +functions str_replace() and str_replace_all(). +The base R equivalents are sub() and gsub(). +Note the difference in default input order again.

+
fruits <- c("apple", "banana", "pear", "pineapple")
+
+# base
+sub("[aeiou]", "-", fruits)
+#> [1] "-pple"     "b-nana"    "p-ar"      "p-neapple"
+gsub("[aeiou]", "-", fruits)
+#> [1] "-ppl-"     "b-n-n-"    "p--r"      "p-n--ppl-"
+
+# stringr
+str_replace(fruits, "[aeiou]", "-")
+#> [1] "-pple"     "b-nana"    "p-ar"      "p-neapple"
+str_replace_all(fruits, "[aeiou]", "-")
+#> [1] "-ppl-"     "b-n-n-"    "p--r"      "p-n--ppl-"
+
+
+

case: Convert case of a string

+

Both stringr and base R have functions to convert to upper and lower +case. Title case is also provided in stringr.

+
dog <- "The quick brown dog"
+
+# base
+toupper(dog)
+#> [1] "THE QUICK BROWN DOG"
+tolower(dog)
+#> [1] "the quick brown dog"
+tools::toTitleCase(dog)
+#> [1] "The Quick Brown Dog"
+
+# stringr
+str_to_upper(dog)
+#> [1] "THE QUICK BROWN DOG"
+str_to_lower(dog)
+#> [1] "the quick brown dog"
+str_to_title(dog)
+#> [1] "The Quick Brown Dog"
+

In stringr we can control the locale, while in base R locale +distinctions are controlled with global variables. Therefore, the output +of your base R code may vary across different computers with different +global settings.

+
# stringr
+str_to_upper("i") # English
+#> [1] "I"
+str_to_upper("i", locale = "tr") # Turkish
+#> [1] "İ"
+
+
+
+

Join and split

+
+

str_flatten(): Flatten a string

+

If we want to take elements of a string vector and collapse them to a +single string we can use the collapse argument in +paste() or use stringr’s str_flatten().

+
# base
+paste0(letters, collapse = "-")
+#> [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"
+
+# stringr
+str_flatten(letters, collapse = "-")
+#> [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"
+

The advantage of str_flatten() is that it always returns +a vector the same length as its input; to predict the return length of +paste() you must carefully read all arguments.

+
+
+

str_dup(): duplicate strings within a character +vector

+

To duplicate strings within a character vector use +strrep() (in R 3.3.0 or greater) or +str_dup():

+
fruit <- c("apple", "pear", "banana")
+
+# base
+strrep(fruit, 2)
+#> [1] "appleapple"   "pearpear"     "bananabanana"
+strrep(fruit, 1:3)
+#> [1] "apple"              "pearpear"           "bananabananabanana"
+
+# stringr
+str_dup(fruit, 2)
+#> [1] "appleapple"   "pearpear"     "bananabanana"
+str_dup(fruit, 1:3)
+#> [1] "apple"              "pearpear"           "bananabananabanana"
+
+
+

str_split(): Split up a string into pieces

+

To split a string into pieces with breaks based on a particular +pattern match stringr uses str_split() and base R uses +strsplit(). Unlike most other functions, +strsplit() starts with the character vector to modify.

+
fruits <- c(
+  "apples and oranges and pears and bananas",
+  "pineapples and mangos and guavas"
+)
+# base
+strsplit(fruits, " and ")
+#> [[1]]
+#> [1] "apples"  "oranges" "pears"   "bananas"
+#> 
+#> [[2]]
+#> [1] "pineapples" "mangos"     "guavas"
+
+# stringr
+str_split(fruits, " and ")
+#> [[1]]
+#> [1] "apples"  "oranges" "pears"   "bananas"
+#> 
+#> [[2]]
+#> [1] "pineapples" "mangos"     "guavas"
+

The stringr package’s str_split() allows for more +control over the split, including restricting the number of possible +matches.

+
# stringr
+str_split(fruits, " and ", n = 3)
+#> [[1]]
+#> [1] "apples"            "oranges"           "pears and bananas"
+#> 
+#> [[2]]
+#> [1] "pineapples" "mangos"     "guavas"
+str_split(fruits, " and ", n = 2)
+#> [[1]]
+#> [1] "apples"                        "oranges and pears and bananas"
+#> 
+#> [[2]]
+#> [1] "pineapples"        "mangos and guavas"
+
+
+

str_glue(): Interpolate strings

+

It’s often useful to interpolate varying values into a fixed string. +In base R, you can use sprintf() for this purpose; stringr +provides a wrapper for the more general purpose glue package.

+
name <- "Fred"
+age <- 50
+anniversary <- as.Date("1991-10-12")
+
+# base
+sprintf(
+  "My name is %s my age next year is %s and my anniversary is %s.", 
+  name,
+  age + 1,
+  format(anniversary, "%A, %B %d, %Y")
+)
+#> [1] "My name is Fred my age next year is 51 and my anniversary is Saturday, October 12, 1991."
+
+# stringr
+str_glue(
+  "My name is {name}, ",
+  "my age next year is {age + 1}, ",
+  "and my anniversary is {format(anniversary, '%A, %B %d, %Y')}."
+)
+#> My name is Fred, my age next year is 51, and my anniversary is Saturday, October 12, 1991.
+
+
+
+

Order strings

+
+

str_order(): Order or sort a character vector

+

Both base R and stringr have separate functions to order and sort +strings.

+
# base
+order(letters)
+#>  [1]  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] 26
+sort(letters)
+#>  [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s"
+#> [20] "t" "u" "v" "w" "x" "y" "z"
+
+# stringr
+str_order(letters)
+#>  [1]  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] 26
+str_sort(letters)
+#>  [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s"
+#> [20] "t" "u" "v" "w" "x" "y" "z"
+

Some options in str_order() and str_sort() +don’t have analogous base R options. For example, the stringr functions +have a locale argument to control how to order or sort. In +base R the locale is a global setting, so the outputs of +sort() and order() may differ across different +computers. For example, in the Norwegian alphabet, å comes after z:

+
x <- c("å", "a", "z")
+str_sort(x)
+#> [1] "a" "å" "z"
+str_sort(x, locale = "no")
+#> [1] "a" "z" "å"
+

The stringr functions also have a numeric argument to +sort digits numerically instead of treating them as strings.

+
# stringr
+x <- c("100a10", "100a5", "2b", "2a")
+str_sort(x)
+#> [1] "100a10" "100a5"  "2a"     "2b"
+str_sort(x, numeric = TRUE)
+#> [1] "2a"     "2b"     "100a5"  "100a10"
+
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/index.html new file mode 100644 index 00000000..0ca66283 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/index.html @@ -0,0 +1,39 @@ + + +R: Vignettes and other documentation + + + +
+

Vignettes and other documentation + +

+
+
+[Top] +
+

Vignettes from package 'stringr'

+ +++++++ + + + + + + + + + + + + + + +
stringr::from-baseFrom base RHTMLsourceR code
stringr::regular-expressionsRegular expressionsHTMLsourceR code
stringr::stringrIntroduction to stringrHTMLsourceR code
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/regular-expressions.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/regular-expressions.R new file mode 100644 index 00000000..08b6ac7d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/regular-expressions.R @@ -0,0 +1,153 @@ +## ----setup, include = FALSE--------------------------------------------------- +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +library(stringr) + +## ----eval = FALSE------------------------------------------------------------- +# # The regular call: +# str_extract(fruit, "nana") +# # Is shorthand for +# str_extract(fruit, regex("nana")) + +## ----------------------------------------------------------------------------- +x <- c("apple", "banana", "pear") +str_extract(x, "an") + +## ----------------------------------------------------------------------------- +bananas <- c("banana", "Banana", "BANANA") +str_detect(bananas, "banana") +str_detect(bananas, regex("banana", ignore_case = TRUE)) + +## ----------------------------------------------------------------------------- +str_extract(x, ".a.") + +## ----------------------------------------------------------------------------- +str_detect("\nX\n", ".X.") +str_detect("\nX\n", regex(".X.", dotall = TRUE)) + +## ----------------------------------------------------------------------------- +# To create the regular expression, we need \\ +dot <- "\\." + +# But the expression itself only contains one: +writeLines(dot) + +# And this tells R to look for an explicit . +str_extract(c("abc", "a.c", "bef"), "a\\.c") + +## ----------------------------------------------------------------------------- +x <- "a\\b" +writeLines(x) + +str_extract(x, "\\\\") + +## ----------------------------------------------------------------------------- +x <- c("a.b.c.d", "aeb") +starts_with <- "a.b" + +str_detect(x, paste0("^", starts_with)) +str_detect(x, paste0("^\\Q", starts_with, "\\E")) + +## ----------------------------------------------------------------------------- +x <- "a\u0301" +str_extract(x, ".") +str_extract(x, "\\X") + +## ----------------------------------------------------------------------------- +str_extract_all("1 + 2 = 3", "\\d+")[[1]] + +## ----------------------------------------------------------------------------- +# Some Laotian numbers +str_detect("១២៣", "\\d") + +## ----------------------------------------------------------------------------- +(text <- "Some \t badly\n\t\tspaced \f text") +str_replace_all(text, "\\s+", " ") + +## ----------------------------------------------------------------------------- +(text <- c('"Double quotes"', "«Guillemet»", "“Fancy quotes”")) +str_replace_all(text, "\\p{quotation mark}", "'") + +## ----------------------------------------------------------------------------- +str_extract_all("Don't eat that!", "\\w+")[[1]] +str_split("Don't eat that!", "\\W")[[1]] + +## ----------------------------------------------------------------------------- +str_replace_all("The quick brown fox", "\\b", "_") +str_replace_all("The quick brown fox", "\\B", "_") + +## ----------------------------------------------------------------------------- +str_detect(c("abc", "def", "ghi"), "abc|def") + +## ----------------------------------------------------------------------------- +str_extract(c("grey", "gray"), "gre|ay") +str_extract(c("grey", "gray"), "gr(e|a)y") + +## ----------------------------------------------------------------------------- +pattern <- "(..)\\1" +fruit %>% + str_subset(pattern) + +fruit %>% + str_subset(pattern) %>% + str_match(pattern) + +## ----------------------------------------------------------------------------- +str_match(c("grey", "gray"), "gr(e|a)y") +str_match(c("grey", "gray"), "gr(?:e|a)y") + +## ----------------------------------------------------------------------------- +x <- c("apple", "banana", "pear") +str_extract(x, "^a") +str_extract(x, "a$") + +## ----------------------------------------------------------------------------- +x <- "Line 1\nLine 2\nLine 3\n" +str_extract_all(x, "^Line..")[[1]] +str_extract_all(x, regex("^Line..", multiline = TRUE))[[1]] +str_extract_all(x, regex("\\ALine..", multiline = TRUE))[[1]] + +## ----------------------------------------------------------------------------- +x <- "1888 is the longest year in Roman numerals: MDCCCLXXXVIII" +str_extract(x, "CC?") +str_extract(x, "CC+") +str_extract(x, 'C[LX]+') + +## ----------------------------------------------------------------------------- +str_extract(x, "C{2}") +str_extract(x, "C{2,}") +str_extract(x, "C{2,3}") + +## ----------------------------------------------------------------------------- +str_extract(x, c("C{2,3}", "C{2,3}?")) +str_extract(x, c("C[LX]+", "C[LX]+?")) + +## ----------------------------------------------------------------------------- +str_detect("ABC", "(?>A|.B)C") +str_detect("ABC", "(?:A|.B)C") + +## ----------------------------------------------------------------------------- +x <- c("1 piece", "2 pieces", "3") +str_extract(x, "\\d+(?= pieces?)") + +y <- c("100", "$400") +str_extract(y, "(?<=\\$)\\d+") + +## ----------------------------------------------------------------------------- +str_detect("xyz", "x(?#this is a comment)") + +## ----------------------------------------------------------------------------- +phone <- regex(" + \\(? # optional opening parens + (\\d{3}) # area code + \\)? # optional closing parens + (?:-|\\ )? # optional dash or space + (\\d{3}) # another three numbers + (?:-|\\ )? # optional dash or space + (\\d{3}) # three more numbers + ", comments = TRUE) + +str_match(c("514-791-8141", "(514) 791 8141"), phone) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/regular-expressions.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/regular-expressions.Rmd new file mode 100644 index 00000000..ccc0fb94 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/regular-expressions.Rmd @@ -0,0 +1,416 @@ +--- +title: "Regular expressions" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Regular expressions} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r setup, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +library(stringr) +``` + +Regular expressions are a concise and flexible tool for describing patterns in strings. This vignette describes the key features of stringr's regular expressions, as implemented by [stringi](https://github.com/gagolews/stringi). It is not a tutorial, so if you're unfamiliar regular expressions, I'd recommend starting at . If you want to master the details, I'd recommend reading the classic [_Mastering Regular Expressions_](https://www.amazon.com/Mastering-Regular-Expressions-Jeffrey-Friedl/dp/0596528124) by Jeffrey E. F. Friedl. + +Regular expressions are the default pattern engine in stringr. That means when you use a pattern matching function with a bare string, it's equivalent to wrapping it in a call to `regex()`: + +```{r, eval = FALSE} +# The regular call: +str_extract(fruit, "nana") +# Is shorthand for +str_extract(fruit, regex("nana")) +``` + +You will need to use `regex()` explicitly if you want to override the default options, as you'll see in examples below. + +## Basic matches + +The simplest patterns match exact strings: + +```{r} +x <- c("apple", "banana", "pear") +str_extract(x, "an") +``` + +You can perform a case-insensitive match using `ignore_case = TRUE`: + +```{r} +bananas <- c("banana", "Banana", "BANANA") +str_detect(bananas, "banana") +str_detect(bananas, regex("banana", ignore_case = TRUE)) +``` + +The next step up in complexity is `.`, which matches any character except a newline: + +```{r} +str_extract(x, ".a.") +``` + +You can allow `.` to match everything, including `\n`, by setting `dotall = TRUE`: + +```{r} +str_detect("\nX\n", ".X.") +str_detect("\nX\n", regex(".X.", dotall = TRUE)) +``` + +## Escaping + +If "`.`" matches any character, how do you match a literal "`.`"? You need to use an "escape" to tell the regular expression you want to match it exactly, not use its special behaviour. Like strings, regexps use the backslash, `\`, to escape special behaviour. So to match an `.`, you need the regexp `\.`. Unfortunately this creates a problem. We use strings to represent regular expressions, and `\` is also used as an escape symbol in strings. So to create the regular expression `\.` we need the string `"\\."`. + +```{r} +# To create the regular expression, we need \\ +dot <- "\\." + +# But the expression itself only contains one: +writeLines(dot) + +# And this tells R to look for an explicit . +str_extract(c("abc", "a.c", "bef"), "a\\.c") +``` + +If `\` is used as an escape character in regular expressions, how do you match a literal `\`? Well you need to escape it, creating the regular expression `\\`. To create that regular expression, you need to use a string, which also needs to escape `\`. That means to match a literal `\` you need to write `"\\\\"` --- you need four backslashes to match one! + +```{r} +x <- "a\\b" +writeLines(x) + +str_extract(x, "\\\\") +``` + +In this vignette, I use `\.` to denote the regular expression, and `"\\."` to denote the string that represents the regular expression. + +An alternative quoting mechanism is `\Q...\E`: all the characters in `...` are treated as exact matches. This is useful if you want to exactly match user input as part of a regular expression. + +```{r} +x <- c("a.b.c.d", "aeb") +starts_with <- "a.b" + +str_detect(x, paste0("^", starts_with)) +str_detect(x, paste0("^\\Q", starts_with, "\\E")) +``` + +## Special characters + +Escapes also allow you to specify individual characters that are otherwise hard to type. You can specify individual unicode characters in five ways, either as a variable number of hex digits (four is most common), or by name: + +* `\xhh`: 2 hex digits. + +* `\x{hhhh}`: 1-6 hex digits. + +* `\uhhhh`: 4 hex digits. + +* `\Uhhhhhhhh`: 8 hex digits. + +* `\N{name}`, e.g. `\N{grinning face}` matches the basic smiling emoji. + +Similarly, you can specify many common control characters: + +* `\a`: bell. + +* `\cX`: match a control-X character. + +* `\e`: escape (`\u001B`). + +* `\f`: form feed (`\u000C`). + +* `\n`: line feed (`\u000A`). + +* `\r`: carriage return (`\u000D`). + +* `\t`: horizontal tabulation (`\u0009`). + +* `\0ooo` match an octal character. 'ooo' is from one to three octal digits, + from 000 to 0377. The leading zero is required. + +(Many of these are only of historical interest and are only included here for the sake of completeness.) + +## Matching multiple characters + +There are a number of patterns that match more than one character. You've already seen `.`, which matches any character (except a newline). A closely related operator is `\X`, which matches a __grapheme cluster__, a set of individual elements that form a single symbol. For example, one way of representing "á" is as the letter "a" plus an accent: `.` will match the component "a", while `\X` will match the complete symbol: + +```{r} +x <- "a\u0301" +str_extract(x, ".") +str_extract(x, "\\X") +``` + +There are five other escaped pairs that match narrower classes of characters: + +* `\d`: matches any digit. The complement, `\D`, matches any character that + is not a decimal digit. + + ```{r} + str_extract_all("1 + 2 = 3", "\\d+")[[1]] + ``` + + Technically, `\d` includes any character in the Unicode Category of Nd + ("Number, Decimal Digit"), which also includes numeric symbols from other + languages: + + ```{r} + # Some Laotian numbers + str_detect("១២៣", "\\d") + ``` + +* `\s`: matches any whitespace. This includes tabs, newlines, form feeds, + and any character in the Unicode Z Category (which includes a variety of + space characters and other separators.). The complement, `\S`, matches any + non-whitespace character. + + ```{r} + (text <- "Some \t badly\n\t\tspaced \f text") + str_replace_all(text, "\\s+", " ") + ``` + +* `\p{property name}` matches any character with specific unicode property, + like `\p{Uppercase}` or `\p{Diacritic}`. The complement, + `\P{property name}`, matches all characters without the property. + A complete list of unicode properties can be found at + . + + ```{r} + (text <- c('"Double quotes"', "«Guillemet»", "“Fancy quotes”")) + str_replace_all(text, "\\p{quotation mark}", "'") + ``` + +* `\w` matches any "word" character, which includes alphabetic characters, + marks and decimal numbers. The complement, `\W`, matches any non-word + character. + + ```{r} + str_extract_all("Don't eat that!", "\\w+")[[1]] + str_split("Don't eat that!", "\\W")[[1]] + ``` + + Technically, `\w` also matches connector punctuation, `\u200c` (zero width + connector), and `\u200d` (zero width joiner), but these are rarely seen in + the wild. + +* `\b` matches word boundaries, the transition between word and non-word + characters. `\B` matches the opposite: boundaries that have either both + word or non-word characters on either side. + + ```{r} + str_replace_all("The quick brown fox", "\\b", "_") + str_replace_all("The quick brown fox", "\\B", "_") + ``` + +You can also create your own __character classes__ using `[]`: + +* `[abc]`: matches a, b, or c. +* `[a-z]`: matches every character between a and z + (in Unicode code point order). +* `[^abc]`: matches anything except a, b, or c. +* `[\^\-]`: matches `^` or `-`. + +There are a number of pre-built classes that you can use inside `[]`: + +* `[:punct:]`: punctuation. +* `[:alpha:]`: letters. +* `[:lower:]`: lowercase letters. +* `[:upper:]`: upperclass letters. +* `[:digit:]`: digits. +* `[:xdigit:]`: hex digits. +* `[:alnum:]`: letters and numbers. +* `[:cntrl:]`: control characters. +* `[:graph:]`: letters, numbers, and punctuation. +* `[:print:]`: letters, numbers, punctuation, and whitespace. +* `[:space:]`: space characters (basically equivalent to `\s`). +* `[:blank:]`: space and tab. + +These all go inside the `[]` for character classes, i.e. `[[:digit:]AX]` matches all digits, A, and X. + +You can also using Unicode properties, like `[\p{Letter}]`, and various set operations, like `[\p{Letter}--\p{script=latin}]`. See `?"stringi-search-charclass"` for details. + +## Alternation + +`|` is the __alternation__ operator, which will pick between one or more possible matches. For example, `abc|def` will match `abc` or `def`: + +```{r} +str_detect(c("abc", "def", "ghi"), "abc|def") +``` + +Note that the precedence for `|` is low: `abc|def` is equivalent to `(abc)|(def)` not `ab(c|d)ef`. + +## Grouping + +You can use parentheses to override the default precedence rules: + +```{r} +str_extract(c("grey", "gray"), "gre|ay") +str_extract(c("grey", "gray"), "gr(e|a)y") +``` + +Parenthesis also define "groups" that you can refer to with __backreferences__, like `\1`, `\2` etc, and can be extracted with `str_match()`. For example, the following regular expression finds all fruits that have a repeated pair of letters: + +```{r} +pattern <- "(..)\\1" +fruit %>% + str_subset(pattern) + +fruit %>% + str_subset(pattern) %>% + str_match(pattern) +``` + +You can use `(?:...)`, the non-grouping parentheses, to control precedence but not capture the match in a group. This is slightly more efficient than capturing parentheses. + +```{r} +str_match(c("grey", "gray"), "gr(e|a)y") +str_match(c("grey", "gray"), "gr(?:e|a)y") +``` + +This is most useful for more complex cases where you need to capture matches and control precedence independently. + +## Anchors + +By default, regular expressions will match any part of a string. It's often useful to __anchor__ the regular expression so that it matches from the start or end of the string: + +* `^` matches the start of string. +* `$` matches the end of the string. + +```{r} +x <- c("apple", "banana", "pear") +str_extract(x, "^a") +str_extract(x, "a$") +``` + +To match a literal "$" or "^", you need to escape them, `\$`, and `\^`. + +For multiline strings, you can use `regex(multiline = TRUE)`. This changes the behaviour of `^` and `$`, and introduces three new operators: + +* `^` now matches the start of each line. + +* `$` now matches the end of each line. + +* `\A` matches the start of the input. + +* `\z` matches the end of the input. + +* `\Z` matches the end of the input, but before the final line terminator, + if it exists. + +```{r} +x <- "Line 1\nLine 2\nLine 3\n" +str_extract_all(x, "^Line..")[[1]] +str_extract_all(x, regex("^Line..", multiline = TRUE))[[1]] +str_extract_all(x, regex("\\ALine..", multiline = TRUE))[[1]] +``` + +## Repetition + +You can control how many times a pattern matches with the repetition operators: + +* `?`: 0 or 1. +* `+`: 1 or more. +* `*`: 0 or more. + +```{r} +x <- "1888 is the longest year in Roman numerals: MDCCCLXXXVIII" +str_extract(x, "CC?") +str_extract(x, "CC+") +str_extract(x, 'C[LX]+') +``` + +Note that the precedence of these operators is high, so you can write: `colou?r` to match either American or British spellings. That means most uses will need parentheses, like `bana(na)+`. + +You can also specify the number of matches precisely: + +* `{n}`: exactly n +* `{n,}`: n or more +* `{n,m}`: between n and m + +```{r} +str_extract(x, "C{2}") +str_extract(x, "C{2,}") +str_extract(x, "C{2,3}") +``` + +By default these matches are "greedy": they will match the longest string possible. You can make them "lazy", matching the shortest string possible by putting a `?` after them: + +* `??`: 0 or 1, prefer 0. +* `+?`: 1 or more, match as few times as possible. +* `*?`: 0 or more, match as few times as possible. +* `{n,}?`: n or more, match as few times as possible. +* `{n,m}?`: between n and m, , match as few times as possible, but at least n. + +```{r} +str_extract(x, c("C{2,3}", "C{2,3}?")) +str_extract(x, c("C[LX]+", "C[LX]+?")) +``` + +You can also make the matches possessive by putting a `+` after them, which means that if later parts of the match fail, the repetition will not be re-tried with a smaller number of characters. This is an advanced feature used to improve performance in worst-case scenarios (called "catastrophic backtracking"). + +* `?+`: 0 or 1, possessive. +* `++`: 1 or more, possessive. +* `*+`: 0 or more, possessive. +* `{n}+`: exactly n, possessive. +* `{n,}+`: n or more, possessive. +* `{n,m}+`: between n and m, possessive. + +A related concept is the __atomic-match__ parenthesis, `(?>...)`. If a later match fails and the engine needs to back-track, an atomic match is kept as is: it succeeds or fails as a whole. Compare the following two regular expressions: + +```{r} +str_detect("ABC", "(?>A|.B)C") +str_detect("ABC", "(?:A|.B)C") +``` + +The atomic match fails because it matches A, and then the next character is a C so it fails. The regular match succeeds because it matches A, but then C doesn't match, so it back-tracks and tries B instead. + +## Look arounds + +These assertions look ahead or behind the current match without "consuming" any characters (i.e. changing the input position). + +* `(?=...)`: positive look-ahead assertion. Matches if `...` matches at the + current input. + +* `(?!...)`: negative look-ahead assertion. Matches if `...` __does not__ + match at the current input. + +* `(?<=...)`: positive look-behind assertion. Matches if `...` matches text + preceding the current position, with the last character of the match + being the character just before the current position. Length must be bounded + (i.e. no `*` or `+`). + +* `(? + + + + + + + + + + + + + +Regular expressions + + + + + + + + + + + + + + + + + + + + + + + + + + +

Regular expressions

+ + + +

Regular expressions are a concise and flexible tool for describing +patterns in strings. This vignette describes the key features of +stringr’s regular expressions, as implemented by stringi. It is not a +tutorial, so if you’re unfamiliar regular expressions, I’d recommend +starting at https://r4ds.had.co.nz/strings.html. If you want to +master the details, I’d recommend reading the classic Mastering +Regular Expressions by Jeffrey E. F. Friedl.

+

Regular expressions are the default pattern engine in stringr. That +means when you use a pattern matching function with a bare string, it’s +equivalent to wrapping it in a call to regex():

+
# The regular call:
+str_extract(fruit, "nana")
+# Is shorthand for
+str_extract(fruit, regex("nana"))
+

You will need to use regex() explicitly if you want to +override the default options, as you’ll see in examples below.

+
+

Basic matches

+

The simplest patterns match exact strings:

+
x <- c("apple", "banana", "pear")
+str_extract(x, "an")
+#> [1] NA   "an" NA
+

You can perform a case-insensitive match using +ignore_case = TRUE:

+
bananas <- c("banana", "Banana", "BANANA")
+str_detect(bananas, "banana")
+#> [1]  TRUE FALSE FALSE
+str_detect(bananas, regex("banana", ignore_case = TRUE))
+#> [1] TRUE TRUE TRUE
+

The next step up in complexity is ., which matches any +character except a newline:

+
str_extract(x, ".a.")
+#> [1] NA    "ban" "ear"
+

You can allow . to match everything, including +\n, by setting dotall = TRUE:

+
str_detect("\nX\n", ".X.")
+#> [1] FALSE
+str_detect("\nX\n", regex(".X.", dotall = TRUE))
+#> [1] TRUE
+
+
+

Escaping

+

If “.” matches any character, how do you match a literal +“.”? You need to use an “escape” to tell the regular +expression you want to match it exactly, not use its special behaviour. +Like strings, regexps use the backslash, \, to escape +special behaviour. So to match an ., you need the regexp +\.. Unfortunately this creates a problem. We use strings to +represent regular expressions, and \ is also used as an +escape symbol in strings. So to create the regular expression +\. we need the string "\\.".

+
# To create the regular expression, we need \\
+dot <- "\\."
+
+# But the expression itself only contains one:
+writeLines(dot)
+#> \.
+
+# And this tells R to look for an explicit .
+str_extract(c("abc", "a.c", "bef"), "a\\.c")
+#> [1] NA    "a.c" NA
+

If \ is used as an escape character in regular +expressions, how do you match a literal \? Well you need to +escape it, creating the regular expression \\. To create +that regular expression, you need to use a string, which also needs to +escape \. That means to match a literal \ you +need to write "\\\\" — you need four backslashes to match +one!

+
x <- "a\\b"
+writeLines(x)
+#> a\b
+
+str_extract(x, "\\\\")
+#> [1] "\\"
+

In this vignette, I use \. to denote the regular +expression, and "\\." to denote the string that represents +the regular expression.

+

An alternative quoting mechanism is \Q...\E: all the +characters in ... are treated as exact matches. This is +useful if you want to exactly match user input as part of a regular +expression.

+
x <- c("a.b.c.d", "aeb")
+starts_with <- "a.b"
+
+str_detect(x, paste0("^", starts_with))
+#> [1] TRUE TRUE
+str_detect(x, paste0("^\\Q", starts_with, "\\E"))
+#> [1]  TRUE FALSE
+
+
+

Special characters

+

Escapes also allow you to specify individual characters that are +otherwise hard to type. You can specify individual unicode characters in +five ways, either as a variable number of hex digits (four is most +common), or by name:

+
    +
  • \xhh: 2 hex digits.

  • +
  • \x{hhhh}: 1-6 hex digits.

  • +
  • \uhhhh: 4 hex digits.

  • +
  • \Uhhhhhhhh: 8 hex digits.

  • +
  • \N{name}, e.g. \N{grinning face} +matches the basic smiling emoji.

  • +
+

Similarly, you can specify many common control characters:

+
    +
  • \a: bell.

  • +
  • \cX: match a control-X character.

  • +
  • \e: escape (\u001B).

  • +
  • \f: form feed (\u000C).

  • +
  • \n: line feed (\u000A).

  • +
  • \r: carriage return (\u000D).

  • +
  • \t: horizontal tabulation +(\u0009).

  • +
  • \0ooo match an octal character. ‘ooo’ is from one to +three octal digits, from 000 to 0377. The leading zero is +required.

  • +
+

(Many of these are only of historical interest and are only included +here for the sake of completeness.)

+
+
+

Matching multiple characters

+

There are a number of patterns that match more than one character. +You’ve already seen ., which matches any character (except +a newline). A closely related operator is \X, which matches +a grapheme cluster, a set of individual elements that +form a single symbol. For example, one way of representing “á” is as the +letter “a” plus an accent: . will match the component “a”, +while \X will match the complete symbol:

+
x <- "a\u0301"
+str_extract(x, ".")
+#> [1] "a"
+str_extract(x, "\\X")
+#> [1] "á"
+

There are five other escaped pairs that match narrower classes of +characters:

+
    +
  • \d: matches any digit. The complement, +\D, matches any character that is not a decimal digit.

    +
    str_extract_all("1 + 2 = 3", "\\d+")[[1]]
    +#> [1] "1" "2" "3"
    +

    Technically, \d includes any character in the Unicode +Category of Nd (“Number, Decimal Digit”), which also includes numeric +symbols from other languages:

    +
    # Some Laotian numbers
    +str_detect("១២៣", "\\d")
    +#> [1] TRUE
  • +
  • \s: matches any whitespace. This includes tabs, +newlines, form feeds, and any character in the Unicode Z Category (which +includes a variety of space characters and other separators.). The +complement, \S, matches any non-whitespace character.

    +
    (text <- "Some  \t badly\n\t\tspaced \f text")
    +#> [1] "Some  \t badly\n\t\tspaced \f text"
    +str_replace_all(text, "\\s+", " ")
    +#> [1] "Some badly spaced text"
  • +
  • \p{property name} matches any character with +specific unicode property, like \p{Uppercase} or +\p{Diacritic}. The complement, +\P{property name}, matches all characters without the +property. A complete list of unicode properties can be found at http://www.unicode.org/reports/tr44/#Property_Index.

    +
    (text <- c('"Double quotes"', "«Guillemet»", "“Fancy quotes”"))
    +#> [1] "\"Double quotes\"" "«Guillemet»"       "“Fancy quotes”"
    +str_replace_all(text, "\\p{quotation mark}", "'")
    +#> [1] "'Double quotes'" "'Guillemet'"     "'Fancy quotes'"
  • +
  • \w matches any “word” character, which includes +alphabetic characters, marks and decimal numbers. The complement, +\W, matches any non-word character.

    +
    str_extract_all("Don't eat that!", "\\w+")[[1]]
    +#> [1] "Don"  "t"    "eat"  "that"
    +str_split("Don't eat that!", "\\W")[[1]]
    +#> [1] "Don"  "t"    "eat"  "that" ""
    +

    Technically, \w also matches connector punctuation, +\u200c (zero width connector), and \u200d +(zero width joiner), but these are rarely seen in the wild.

  • +
  • \b matches word boundaries, the transition between +word and non-word characters. \B matches the opposite: +boundaries that have either both word or non-word characters on either +side.

    +
    str_replace_all("The quick brown fox", "\\b", "_")
    +#> [1] "_The_ _quick_ _brown_ _fox_"
    +str_replace_all("The quick brown fox", "\\B", "_")
    +#> [1] "T_h_e q_u_i_c_k b_r_o_w_n f_o_x"
  • +
+

You can also create your own character classes using +[]:

+
    +
  • [abc]: matches a, b, or c.
  • +
  • [a-z]: matches every character between a and z (in +Unicode code point order).
  • +
  • [^abc]: matches anything except a, b, or c.
  • +
  • [\^\-]: matches ^ or -.
  • +
+

There are a number of pre-built classes that you can use inside +[]:

+
    +
  • [:punct:]: punctuation.
  • +
  • [:alpha:]: letters.
  • +
  • [:lower:]: lowercase letters.
  • +
  • [:upper:]: upperclass letters.
  • +
  • [:digit:]: digits.
  • +
  • [:xdigit:]: hex digits.
  • +
  • [:alnum:]: letters and numbers.
  • +
  • [:cntrl:]: control characters.
  • +
  • [:graph:]: letters, numbers, and punctuation.
  • +
  • [:print:]: letters, numbers, punctuation, and +whitespace.
  • +
  • [:space:]: space characters (basically equivalent to +\s).
  • +
  • [:blank:]: space and tab.
  • +
+

These all go inside the [] for character classes, +i.e. [[:digit:]AX] matches all digits, A, and X.

+

You can also using Unicode properties, like +[\p{Letter}], and various set operations, like +[\p{Letter}--\p{script=latin}]. See +?"stringi-search-charclass" for details.

+
+
+

Alternation

+

| is the alternation operator, which +will pick between one or more possible matches. For example, +abc|def will match abc or +def:

+
str_detect(c("abc", "def", "ghi"), "abc|def")
+#> [1]  TRUE  TRUE FALSE
+

Note that the precedence for | is low: +abc|def is equivalent to (abc)|(def) not +ab(c|d)ef.

+
+
+

Grouping

+

You can use parentheses to override the default precedence rules:

+
str_extract(c("grey", "gray"), "gre|ay")
+#> [1] "gre" "ay"
+str_extract(c("grey", "gray"), "gr(e|a)y")
+#> [1] "grey" "gray"
+

Parenthesis also define “groups” that you can refer to with +backreferences, like \1, \2 +etc, and can be extracted with str_match(). For example, +the following regular expression finds all fruits that have a repeated +pair of letters:

+
pattern <- "(..)\\1"
+fruit %>% 
+  str_subset(pattern)
+#> [1] "banana"
+
+fruit %>% 
+  str_subset(pattern) %>% 
+  str_match(pattern)
+#>      [,1]   [,2]
+#> [1,] "anan" "an"
+

You can use (?:...), the non-grouping parentheses, to +control precedence but not capture the match in a group. This is +slightly more efficient than capturing parentheses.

+
str_match(c("grey", "gray"), "gr(e|a)y")
+#>      [,1]   [,2]
+#> [1,] "grey" "e" 
+#> [2,] "gray" "a"
+str_match(c("grey", "gray"), "gr(?:e|a)y")
+#>      [,1]  
+#> [1,] "grey"
+#> [2,] "gray"
+

This is most useful for more complex cases where you need to capture +matches and control precedence independently.

+
+
+

Anchors

+

By default, regular expressions will match any part of a string. It’s +often useful to anchor the regular expression so that +it matches from the start or end of the string:

+
    +
  • ^ matches the start of string.
  • +
  • $ matches the end of the string.
  • +
+
x <- c("apple", "banana", "pear")
+str_extract(x, "^a")
+#> [1] "a" NA  NA
+str_extract(x, "a$")
+#> [1] NA  "a" NA
+

To match a literal “$” or “^”, you need to escape them, +\$, and \^.

+

For multiline strings, you can use +regex(multiline = TRUE). This changes the behaviour of +^ and $, and introduces three new +operators:

+
    +
  • ^ now matches the start of each line.

  • +
  • $ now matches the end of each line.

  • +
  • \A matches the start of the input.

  • +
  • \z matches the end of the input.

  • +
  • \Z matches the end of the input, but before the +final line terminator, if it exists.

  • +
+
x <- "Line 1\nLine 2\nLine 3\n"
+str_extract_all(x, "^Line..")[[1]]
+#> [1] "Line 1"
+str_extract_all(x, regex("^Line..", multiline = TRUE))[[1]]
+#> [1] "Line 1" "Line 2" "Line 3"
+str_extract_all(x, regex("\\ALine..", multiline = TRUE))[[1]]
+#> [1] "Line 1"
+
+
+

Repetition

+

You can control how many times a pattern matches with the repetition +operators:

+
    +
  • ?: 0 or 1.
  • +
  • +: 1 or more.
  • +
  • *: 0 or more.
  • +
+
x <- "1888 is the longest year in Roman numerals: MDCCCLXXXVIII"
+str_extract(x, "CC?")
+#> [1] "CC"
+str_extract(x, "CC+")
+#> [1] "CCC"
+str_extract(x, 'C[LX]+')
+#> [1] "CLXXX"
+

Note that the precedence of these operators is high, so you can +write: colou?r to match either American or British +spellings. That means most uses will need parentheses, like +bana(na)+.

+

You can also specify the number of matches precisely:

+
    +
  • {n}: exactly n
  • +
  • {n,}: n or more
  • +
  • {n,m}: between n and m
  • +
+
str_extract(x, "C{2}")
+#> [1] "CC"
+str_extract(x, "C{2,}")
+#> [1] "CCC"
+str_extract(x, "C{2,3}")
+#> [1] "CCC"
+

By default these matches are “greedy”: they will match the longest +string possible. You can make them “lazy”, matching the shortest string +possible by putting a ? after them:

+
    +
  • ??: 0 or 1, prefer 0.
  • +
  • +?: 1 or more, match as few times as possible.
  • +
  • *?: 0 or more, match as few times as possible.
  • +
  • {n,}?: n or more, match as few times as possible.
  • +
  • {n,m}?: between n and m, , match as few times as +possible, but at least n.
  • +
+
str_extract(x, c("C{2,3}", "C{2,3}?"))
+#> [1] "CCC" "CC"
+str_extract(x, c("C[LX]+", "C[LX]+?"))
+#> [1] "CLXXX" "CL"
+

You can also make the matches possessive by putting a + +after them, which means that if later parts of the match fail, the +repetition will not be re-tried with a smaller number of characters. +This is an advanced feature used to improve performance in worst-case +scenarios (called “catastrophic backtracking”).

+
    +
  • ?+: 0 or 1, possessive.
  • +
  • ++: 1 or more, possessive.
  • +
  • *+: 0 or more, possessive.
  • +
  • {n}+: exactly n, possessive.
  • +
  • {n,}+: n or more, possessive.
  • +
  • {n,m}+: between n and m, possessive.
  • +
+

A related concept is the atomic-match parenthesis, +(?>...). If a later match fails and the engine needs to +back-track, an atomic match is kept as is: it succeeds or fails as a +whole. Compare the following two regular expressions:

+
str_detect("ABC", "(?>A|.B)C")
+#> [1] FALSE
+str_detect("ABC", "(?:A|.B)C")
+#> [1] TRUE
+

The atomic match fails because it matches A, and then the next +character is a C so it fails. The regular match succeeds because it +matches A, but then C doesn’t match, so it back-tracks and tries B +instead.

+
+
+

Look arounds

+

These assertions look ahead or behind the current match without +“consuming” any characters (i.e. changing the input position).

+
    +
  • (?=...): positive look-ahead assertion. Matches if +... matches at the current input.

  • +
  • (?!...): negative look-ahead assertion. Matches if +... does not match at the current +input.

  • +
  • (?<=...): positive look-behind assertion. Matches +if ... matches text preceding the current position, with +the last character of the match being the character just before the +current position. Length must be bounded
    +(i.e. no * or +).

  • +
  • (?<!...): negative look-behind assertion. Matches +if ... does not match text preceding the +current position. Length must be bounded
    +(i.e. no * or +).

  • +
+

These are useful when you want to check that a pattern exists, but +you don’t want to include it in the result:

+
x <- c("1 piece", "2 pieces", "3")
+str_extract(x, "\\d+(?= pieces?)")
+#> [1] "1" "2" NA
+
+y <- c("100", "$400")
+str_extract(y, "(?<=\\$)\\d+")
+#> [1] NA    "400"
+
+
+

Comments

+

There are two ways to include comments in a regular expression. The +first is with (?#...):

+
str_detect("xyz", "x(?#this is a comment)")
+#> [1] TRUE
+

The second is to use regex(comments = TRUE). This form +ignores spaces and newlines, and anything everything after +#. To match a literal space, you’ll need to escape it: +"\\ ". This is a useful way of describing complex regular +expressions:

+
phone <- regex("
+  \\(?       # optional opening parens
+  (\\d{3})   # area code
+  \\)?       # optional closing parens
+  (?:-|\\ )? # optional dash or space
+  (\\d{3})   # another three numbers
+  (?:-|\\ )? # optional dash or space
+  (\\d{3})   # three more numbers
+  ", comments = TRUE)
+
+str_match(c("514-791-8141", "(514) 791 8141"), phone)
+#>      [,1]            [,2]  [,3]  [,4] 
+#> [1,] "514-791-814"   "514" "791" "814"
+#> [2,] "(514) 791 814" "514" "791" "814"
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/stringr.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/stringr.R new file mode 100644 index 00000000..522c6396 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/stringr.R @@ -0,0 +1,142 @@ +## ----include = FALSE---------------------------------------------------------- +library(stringr) +knitr::opts_chunk$set( + comment = "#>", + collapse = TRUE +) + +## ----------------------------------------------------------------------------- +str_length("abc") + +## ----------------------------------------------------------------------------- +x <- c("abcdef", "ghifjk") + +# The 3rd letter +str_sub(x, 3, 3) + +# The 2nd to 2nd-to-last character +str_sub(x, 2, -2) + + +## ----------------------------------------------------------------------------- +str_sub(x, 3, 3) <- "X" +x + +## ----------------------------------------------------------------------------- +str_dup(x, c(2, 3)) + +## ----------------------------------------------------------------------------- +x <- c("abc", "defghi") +str_pad(x, 10) # default pads on left +str_pad(x, 10, "both") + +## ----------------------------------------------------------------------------- +str_pad(x, 4) + +## ----------------------------------------------------------------------------- +x <- c("Short", "This is a long string") + +x %>% + str_trunc(10) %>% + str_pad(10, "right") + +## ----------------------------------------------------------------------------- +x <- c(" a ", "b ", " c") +str_trim(x) +str_trim(x, "left") + +## ----------------------------------------------------------------------------- +jabberwocky <- str_c( + "`Twas brillig, and the slithy toves ", + "did gyre and gimble in the wabe: ", + "All mimsy were the borogoves, ", + "and the mome raths outgrabe. " +) +cat(str_wrap(jabberwocky, width = 40)) + +## ----------------------------------------------------------------------------- +x <- "I like horses." +str_to_upper(x) +str_to_title(x) + +str_to_lower(x) +# Turkish has two sorts of i: with and without the dot +str_to_lower(x, "tr") + +## ----------------------------------------------------------------------------- +x <- c("y", "i", "k") +str_order(x) + +str_sort(x) +# In Lithuanian, y comes between i and k +str_sort(x, locale = "lt") + +## ----------------------------------------------------------------------------- +strings <- c( + "apple", + "219 733 8965", + "329-293-8753", + "Work: 579-499-7527; Home: 543.355.3679" +) +phone <- "([2-9][0-9]{2})[- .]([0-9]{3})[- .]([0-9]{4})" + +## ----------------------------------------------------------------------------- +# Which strings contain phone numbers? +str_detect(strings, phone) +str_subset(strings, phone) + +## ----------------------------------------------------------------------------- +# How many phone numbers in each string? +str_count(strings, phone) + +## ----------------------------------------------------------------------------- +# Where in the string is the phone number located? +(loc <- str_locate(strings, phone)) +str_locate_all(strings, phone) + +## ----------------------------------------------------------------------------- +# What are the phone numbers? +str_extract(strings, phone) +str_extract_all(strings, phone) +str_extract_all(strings, phone, simplify = TRUE) + +## ----------------------------------------------------------------------------- +# Pull out the three components of the match +str_match(strings, phone) +str_match_all(strings, phone) + +## ----------------------------------------------------------------------------- +str_replace(strings, phone, "XXX-XXX-XXXX") +str_replace_all(strings, phone, "XXX-XXX-XXXX") + +## ----------------------------------------------------------------------------- +str_split("a-b-c", "-") +str_split_fixed("a-b-c", "-", n = 2) + +## ----------------------------------------------------------------------------- +a1 <- "\u00e1" +a2 <- "a\u0301" +c(a1, a2) +a1 == a2 + +## ----------------------------------------------------------------------------- +str_detect(a1, fixed(a2)) +str_detect(a1, coll(a2)) + +## ----------------------------------------------------------------------------- +i <- c("I", "İ", "i", "ı") +i + +str_subset(i, coll("i", ignore_case = TRUE)) +str_subset(i, coll("i", ignore_case = TRUE, locale = "tr")) + +## ----------------------------------------------------------------------------- +x <- "This is a sentence." +str_split(x, boundary("word")) +str_count(x, boundary("word")) +str_extract_all(x, boundary("word")) + +## ----------------------------------------------------------------------------- +str_split(x, "") +str_count(x, "") + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/stringr.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/stringr.Rmd new file mode 100644 index 00000000..5ecd53e1 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/stringr.Rmd @@ -0,0 +1,300 @@ +--- +title: "Introduction to stringr" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Introduction to stringr} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +library(stringr) +knitr::opts_chunk$set( + comment = "#>", + collapse = TRUE +) +``` + +There are four main families of functions in stringr: + +1. Character manipulation: these functions allow you to manipulate + individual characters within the strings in character vectors. + +1. Whitespace tools to add, remove, and manipulate whitespace. + +1. Locale sensitive operations whose operations will vary from locale + to locale. + +1. Pattern matching functions. These recognise four engines of + pattern description. The most common is regular expressions, but there + are three other tools. + +## Getting and setting individual characters + +You can get the length of the string with `str_length()`: + +```{r} +str_length("abc") +``` + +This is now equivalent to the base R function `nchar()`. Previously it was needed to work around issues with `nchar()` such as the fact that it returned 2 for `nchar(NA)`. This has been fixed as of R 3.3.0, so it is no longer so important. + +You can access individual character using `str_sub()`. It takes three arguments: a character vector, a `start` position and an `end` position. Either position can either be a positive integer, which counts from the left, or a negative integer which counts from the right. The positions are inclusive, and if longer than the string, will be silently truncated. + +```{r} +x <- c("abcdef", "ghifjk") + +# The 3rd letter +str_sub(x, 3, 3) + +# The 2nd to 2nd-to-last character +str_sub(x, 2, -2) + +``` + +You can also use `str_sub()` to modify strings: + +```{r} +str_sub(x, 3, 3) <- "X" +x +``` + +To duplicate individual strings, you can use `str_dup()`: + +```{r} +str_dup(x, c(2, 3)) +``` + +## Whitespace + +Three functions add, remove, or modify whitespace: + +1. `str_pad()` pads a string to a fixed length by adding extra whitespace on + the left, right, or both sides. + + ```{r} + x <- c("abc", "defghi") + str_pad(x, 10) # default pads on left + str_pad(x, 10, "both") + ``` + + (You can pad with other characters by using the `pad` argument.) + + `str_pad()` will never make a string shorter: + + ```{r} + str_pad(x, 4) + ``` + + So if you want to ensure that all strings are the same length (often useful + for print methods), combine `str_pad()` and `str_trunc()`: + + ```{r} + x <- c("Short", "This is a long string") + + x %>% + str_trunc(10) %>% + str_pad(10, "right") + ``` + +1. The opposite of `str_pad()` is `str_trim()`, which removes leading and + trailing whitespace: + + ```{r} + x <- c(" a ", "b ", " c") + str_trim(x) + str_trim(x, "left") + ``` + +1. You can use `str_wrap()` to modify existing whitespace in order to wrap + a paragraph of text, such that the length of each line is as similar as + possible. + + ```{r} + jabberwocky <- str_c( + "`Twas brillig, and the slithy toves ", + "did gyre and gimble in the wabe: ", + "All mimsy were the borogoves, ", + "and the mome raths outgrabe. " + ) + cat(str_wrap(jabberwocky, width = 40)) + ``` + +## Locale sensitive + +A handful of stringr functions are locale-sensitive: they will perform differently in different regions of the world. These functions are case transformation functions: + +```{r} +x <- "I like horses." +str_to_upper(x) +str_to_title(x) + +str_to_lower(x) +# Turkish has two sorts of i: with and without the dot +str_to_lower(x, "tr") +``` + +String ordering and sorting: + +```{r} +x <- c("y", "i", "k") +str_order(x) + +str_sort(x) +# In Lithuanian, y comes between i and k +str_sort(x, locale = "lt") +``` + +The locale always defaults to English to ensure that the default behaviour is identical across systems. Locales always include a two letter ISO-639-1 language code (like "en" for English or "zh" for Chinese), and optionally a ISO-3166 country code (like "en_UK" vs "en_US"). You can see a complete list of available locales by running `stringi::stri_locale_list()`. + +## Pattern matching + +The vast majority of stringr functions work with patterns. These are parameterised by the task they perform and the types of patterns they match. + +### Tasks + +Each pattern matching function has the same first two arguments, a character vector of `string`s to process and a single `pattern` to match. stringr provides pattern matching functions to **detect**, **locate**, **extract**, **match**, **replace**, and **split** strings. I'll illustrate how they work with some strings and a regular expression designed to match (US) phone numbers: + +```{r} +strings <- c( + "apple", + "219 733 8965", + "329-293-8753", + "Work: 579-499-7527; Home: 543.355.3679" +) +phone <- "([2-9][0-9]{2})[- .]([0-9]{3})[- .]([0-9]{4})" +``` + +- `str_detect()` detects the presence or absence of a pattern and returns a + logical vector (similar to `grepl()`). `str_subset()` returns the elements + of a character vector that match a regular expression (similar to `grep()` + with `value = TRUE`)`. + + ```{r} + # Which strings contain phone numbers? + str_detect(strings, phone) + str_subset(strings, phone) + ``` + +- `str_count()` counts the number of matches: + + ```{r} + # How many phone numbers in each string? + str_count(strings, phone) + ``` + +- `str_locate()` locates the **first** position of a pattern and returns a numeric + matrix with columns start and end. `str_locate_all()` locates all matches, + returning a list of numeric matrices. Similar to `regexpr()` and `gregexpr()`. + + ```{r} + # Where in the string is the phone number located? + (loc <- str_locate(strings, phone)) + str_locate_all(strings, phone) + ``` + +- `str_extract()` extracts text corresponding to the **first** match, returning a + character vector. `str_extract_all()` extracts all matches and returns a + list of character vectors. + + ```{r} + # What are the phone numbers? + str_extract(strings, phone) + str_extract_all(strings, phone) + str_extract_all(strings, phone, simplify = TRUE) + ``` + +- `str_match()` extracts capture groups formed by `()` from the **first** match. + It returns a character matrix with one column for the complete match and + one column for each group. `str_match_all()` extracts capture groups from + all matches and returns a list of character matrices. Similar to + `regmatches()`. + + ```{r} + # Pull out the three components of the match + str_match(strings, phone) + str_match_all(strings, phone) + ``` + +- `str_replace()` replaces the **first** matched pattern and returns a character + vector. `str_replace_all()` replaces all matches. Similar to `sub()` and + `gsub()`. + + ```{r} + str_replace(strings, phone, "XXX-XXX-XXXX") + str_replace_all(strings, phone, "XXX-XXX-XXXX") + ``` + +- `str_split_fixed()` splits a string into a **fixed** number of pieces based + on a pattern and returns a character matrix. `str_split()` splits a string + into a **variable** number of pieces and returns a list of character vectors. + + ```{r} + str_split("a-b-c", "-") + str_split_fixed("a-b-c", "-", n = 2) + ``` + +### Engines + +There are four main engines that stringr can use to describe patterns: + +* Regular expressions, the default, as shown above, and described in + `vignette("regular-expressions")`. + +* Fixed bytewise matching, with `fixed()`. + +* Locale-sensitive character matching, with `coll()` + +* Text boundary analysis with `boundary()`. + +#### Fixed matches + +`fixed(x)` only matches the exact sequence of bytes specified by `x`. This is a very limited "pattern", but the restriction can make matching much faster. Beware using `fixed()` with non-English data. It is problematic because there are often multiple ways of representing the same character. For example, there are two ways to define "á": either as a single character or as an "a" plus an accent: + +```{r} +a1 <- "\u00e1" +a2 <- "a\u0301" +c(a1, a2) +a1 == a2 +``` + +They render identically, but because they're defined differently, +`fixed()` doesn't find a match. Instead, you can use `coll()`, explained +below, to respect human character comparison rules: + +```{r} +str_detect(a1, fixed(a2)) +str_detect(a1, coll(a2)) +``` + +#### Collation search + +`coll(x)` looks for a match to `x` using human-language **coll**ation rules, and is particularly important if you want to do case insensitive matching. Collation rules differ around the world, so you'll also need to supply a `locale` parameter. + +```{r} +i <- c("I", "İ", "i", "ı") +i + +str_subset(i, coll("i", ignore_case = TRUE)) +str_subset(i, coll("i", ignore_case = TRUE, locale = "tr")) +``` + +The downside of `coll()` is speed. Because the rules for recognising which characters are the same are complicated, `coll()` is relatively slow compared to `regex()` and `fixed()`. Note that when both `fixed()` and `regex()` have `ignore_case` arguments, they perform a much simpler comparison than `coll()`. + +#### Boundary + +`boundary()` matches boundaries between characters, lines, sentences or words. It's most useful with `str_split()`, but can be used with all pattern matching functions: + +```{r} +x <- "This is a sentence." +str_split(x, boundary("word")) +str_count(x, boundary("word")) +str_extract_all(x, boundary("word")) +``` + +By convention, `""` is treated as `boundary("character")`: + +```{r} +str_split(x, "") +str_count(x, "") +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/stringr.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/stringr.html new file mode 100644 index 00000000..1f7d6cff --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/doc/stringr.html @@ -0,0 +1,718 @@ + + + + + + + + + + + + + + +Introduction to stringr + + + + + + + + + + + + + + + + + + + + + + + + + + +

Introduction to stringr

+ + + +

There are four main families of functions in stringr:

+
    +
  1. Character manipulation: these functions allow you to manipulate +individual characters within the strings in character vectors.

  2. +
  3. Whitespace tools to add, remove, and manipulate +whitespace.

  4. +
  5. Locale sensitive operations whose operations will vary from +locale to locale.

  6. +
  7. Pattern matching functions. These recognise four engines of +pattern description. The most common is regular expressions, but there +are three other tools.

  8. +
+
+

Getting and setting individual characters

+

You can get the length of the string with +str_length():

+
str_length("abc")
+#> [1] 3
+

This is now equivalent to the base R function nchar(). +Previously it was needed to work around issues with nchar() +such as the fact that it returned 2 for nchar(NA). This has +been fixed as of R 3.3.0, so it is no longer so important.

+

You can access individual character using str_sub(). It +takes three arguments: a character vector, a start position +and an end position. Either position can either be a +positive integer, which counts from the left, or a negative integer +which counts from the right. The positions are inclusive, and if longer +than the string, will be silently truncated.

+
x <- c("abcdef", "ghifjk")
+
+# The 3rd letter
+str_sub(x, 3, 3)
+#> [1] "c" "i"
+
+# The 2nd to 2nd-to-last character
+str_sub(x, 2, -2)
+#> [1] "bcde" "hifj"
+

You can also use str_sub() to modify strings:

+
str_sub(x, 3, 3) <- "X"
+x
+#> [1] "abXdef" "ghXfjk"
+

To duplicate individual strings, you can use +str_dup():

+
str_dup(x, c(2, 3))
+#> [1] "abXdefabXdef"       "ghXfjkghXfjkghXfjk"
+
+
+

Whitespace

+

Three functions add, remove, or modify whitespace:

+
    +
  1. str_pad() pads a string to a fixed length by adding +extra whitespace on the left, right, or both sides.

    +
    x <- c("abc", "defghi")
    +str_pad(x, 10) # default pads on left
    +#> [1] "       abc" "    defghi"
    +str_pad(x, 10, "both")
    +#> [1] "   abc    " "  defghi  "
    +

    (You can pad with other characters by using the pad +argument.)

    +

    str_pad() will never make a string shorter:

    +
    str_pad(x, 4)
    +#> [1] " abc"   "defghi"
    +

    So if you want to ensure that all strings are the same length (often +useful for print methods), combine str_pad() and +str_trunc():

    +
    x <- c("Short", "This is a long string")
    +
    +x %>% 
    +  str_trunc(10) %>% 
    +  str_pad(10, "right")
    +#> [1] "Short     " "This is..."
  2. +
  3. The opposite of str_pad() is +str_trim(), which removes leading and trailing +whitespace:

    +
    x <- c("  a   ", "b   ",  "   c")
    +str_trim(x)
    +#> [1] "a" "b" "c"
    +str_trim(x, "left")
    +#> [1] "a   " "b   " "c"
  4. +
  5. You can use str_wrap() to modify existing whitespace +in order to wrap a paragraph of text, such that the length of each line +is as similar as possible.

    +
    jabberwocky <- str_c(
    +  "`Twas brillig, and the slithy toves ",
    +  "did gyre and gimble in the wabe: ",
    +  "All mimsy were the borogoves, ",
    +  "and the mome raths outgrabe. "
    +)
    +cat(str_wrap(jabberwocky, width = 40))
    +#> `Twas brillig, and the slithy toves did
    +#> gyre and gimble in the wabe: All mimsy
    +#> were the borogoves, and the mome raths
    +#> outgrabe.
  6. +
+
+
+

Locale sensitive

+

A handful of stringr functions are locale-sensitive: they will +perform differently in different regions of the world. These functions +are case transformation functions:

+
x <- "I like horses."
+str_to_upper(x)
+#> [1] "I LIKE HORSES."
+str_to_title(x)
+#> [1] "I Like Horses."
+
+str_to_lower(x)
+#> [1] "i like horses."
+# Turkish has two sorts of i: with and without the dot
+str_to_lower(x, "tr")
+#> [1] "ı like horses."
+

String ordering and sorting:

+
x <- c("y", "i", "k")
+str_order(x)
+#> [1] 2 3 1
+
+str_sort(x)
+#> [1] "i" "k" "y"
+# In Lithuanian, y comes between i and k
+str_sort(x, locale = "lt")
+#> [1] "i" "y" "k"
+

The locale always defaults to English to ensure that the default +behaviour is identical across systems. Locales always include a two +letter ISO-639-1 language code (like “en” for English or “zh” for +Chinese), and optionally a ISO-3166 country code (like “en_UK” vs +“en_US”). You can see a complete list of available locales by running +stringi::stri_locale_list().

+
+
+

Pattern matching

+

The vast majority of stringr functions work with patterns. These are +parameterised by the task they perform and the types of patterns they +match.

+
+

Tasks

+

Each pattern matching function has the same first two arguments, a +character vector of strings to process and a single +pattern to match. stringr provides pattern matching +functions to detect, locate, +extract, match, +replace, and split strings. I’ll +illustrate how they work with some strings and a regular expression +designed to match (US) phone numbers:

+
strings <- c(
+  "apple", 
+  "219 733 8965", 
+  "329-293-8753", 
+  "Work: 579-499-7527; Home: 543.355.3679"
+)
+phone <- "([2-9][0-9]{2})[- .]([0-9]{3})[- .]([0-9]{4})"
+
    +
  • str_detect() detects the presence or absence of a +pattern and returns a logical vector (similar to grepl()). +str_subset() returns the elements of a character vector +that match a regular expression (similar to grep() with +value = TRUE)`.

    +
    # Which strings contain phone numbers?
    +str_detect(strings, phone)
    +#> [1] FALSE  TRUE  TRUE  TRUE
    +str_subset(strings, phone)
    +#> [1] "219 733 8965"                          
    +#> [2] "329-293-8753"                          
    +#> [3] "Work: 579-499-7527; Home: 543.355.3679"
  • +
  • str_count() counts the number of matches:

    +
    # How many phone numbers in each string?
    +str_count(strings, phone)
    +#> [1] 0 1 1 2
  • +
  • str_locate() locates the first +position of a pattern and returns a numeric matrix with columns start +and end. str_locate_all() locates all matches, returning a +list of numeric matrices. Similar to regexpr() and +gregexpr().

    +
    # Where in the string is the phone number located?
    +(loc <- str_locate(strings, phone))
    +#>      start end
    +#> [1,]    NA  NA
    +#> [2,]     1  12
    +#> [3,]     1  12
    +#> [4,]     7  18
    +str_locate_all(strings, phone)
    +#> [[1]]
    +#>      start end
    +#> 
    +#> [[2]]
    +#>      start end
    +#> [1,]     1  12
    +#> 
    +#> [[3]]
    +#>      start end
    +#> [1,]     1  12
    +#> 
    +#> [[4]]
    +#>      start end
    +#> [1,]     7  18
    +#> [2,]    27  38
  • +
  • str_extract() extracts text corresponding to the +first match, returning a character vector. +str_extract_all() extracts all matches and returns a list +of character vectors.

    +
    # What are the phone numbers?
    +str_extract(strings, phone)
    +#> [1] NA             "219 733 8965" "329-293-8753" "579-499-7527"
    +str_extract_all(strings, phone)
    +#> [[1]]
    +#> character(0)
    +#> 
    +#> [[2]]
    +#> [1] "219 733 8965"
    +#> 
    +#> [[3]]
    +#> [1] "329-293-8753"
    +#> 
    +#> [[4]]
    +#> [1] "579-499-7527" "543.355.3679"
    +str_extract_all(strings, phone, simplify = TRUE)
    +#>      [,1]           [,2]          
    +#> [1,] ""             ""            
    +#> [2,] "219 733 8965" ""            
    +#> [3,] "329-293-8753" ""            
    +#> [4,] "579-499-7527" "543.355.3679"
  • +
  • str_match() extracts capture groups formed by +() from the first match. It returns a +character matrix with one column for the complete match and one column +for each group. str_match_all() extracts capture groups +from all matches and returns a list of character matrices. Similar to +regmatches().

    +
    # Pull out the three components of the match
    +str_match(strings, phone)
    +#>      [,1]           [,2]  [,3]  [,4]  
    +#> [1,] NA             NA    NA    NA    
    +#> [2,] "219 733 8965" "219" "733" "8965"
    +#> [3,] "329-293-8753" "329" "293" "8753"
    +#> [4,] "579-499-7527" "579" "499" "7527"
    +str_match_all(strings, phone)
    +#> [[1]]
    +#>      [,1] [,2] [,3] [,4]
    +#> 
    +#> [[2]]
    +#>      [,1]           [,2]  [,3]  [,4]  
    +#> [1,] "219 733 8965" "219" "733" "8965"
    +#> 
    +#> [[3]]
    +#>      [,1]           [,2]  [,3]  [,4]  
    +#> [1,] "329-293-8753" "329" "293" "8753"
    +#> 
    +#> [[4]]
    +#>      [,1]           [,2]  [,3]  [,4]  
    +#> [1,] "579-499-7527" "579" "499" "7527"
    +#> [2,] "543.355.3679" "543" "355" "3679"
  • +
  • str_replace() replaces the first +matched pattern and returns a character vector. +str_replace_all() replaces all matches. Similar to +sub() and gsub().

    +
    str_replace(strings, phone, "XXX-XXX-XXXX")
    +#> [1] "apple"                                 
    +#> [2] "XXX-XXX-XXXX"                          
    +#> [3] "XXX-XXX-XXXX"                          
    +#> [4] "Work: XXX-XXX-XXXX; Home: 543.355.3679"
    +str_replace_all(strings, phone, "XXX-XXX-XXXX")
    +#> [1] "apple"                                 
    +#> [2] "XXX-XXX-XXXX"                          
    +#> [3] "XXX-XXX-XXXX"                          
    +#> [4] "Work: XXX-XXX-XXXX; Home: XXX-XXX-XXXX"
  • +
  • str_split_fixed() splits a string into a +fixed number of pieces based on a pattern and returns a +character matrix. str_split() splits a string into a +variable number of pieces and returns a list of +character vectors.

    +
    str_split("a-b-c", "-")
    +#> [[1]]
    +#> [1] "a" "b" "c"
    +str_split_fixed("a-b-c", "-", n = 2)
    +#>      [,1] [,2] 
    +#> [1,] "a"  "b-c"
  • +
+
+
+

Engines

+

There are four main engines that stringr can use to describe +patterns:

+
    +
  • Regular expressions, the default, as shown above, and described +in vignette("regular-expressions").

  • +
  • Fixed bytewise matching, with fixed().

  • +
  • Locale-sensitive character matching, with +coll()

  • +
  • Text boundary analysis with boundary().

  • +
+
+

Fixed matches

+

fixed(x) only matches the exact sequence of bytes +specified by x. This is a very limited “pattern”, but the +restriction can make matching much faster. Beware using +fixed() with non-English data. It is problematic because +there are often multiple ways of representing the same character. For +example, there are two ways to define “á”: either as a single character +or as an “a” plus an accent:

+
a1 <- "\u00e1"
+a2 <- "a\u0301"
+c(a1, a2)
+#> [1] "á" "á"
+a1 == a2
+#> [1] FALSE
+

They render identically, but because they’re defined differently, +fixed() doesn’t find a match. Instead, you can use +coll(), explained below, to respect human character +comparison rules:

+
str_detect(a1, fixed(a2))
+#> [1] FALSE
+str_detect(a1, coll(a2))
+#> [1] TRUE
+
+ +
+

Boundary

+

boundary() matches boundaries between characters, lines, +sentences or words. It’s most useful with str_split(), but +can be used with all pattern matching functions:

+
x <- "This is a sentence."
+str_split(x, boundary("word"))
+#> [[1]]
+#> [1] "This"     "is"       "a"        "sentence"
+str_count(x, boundary("word"))
+#> [1] 4
+str_extract_all(x, boundary("word"))
+#> [[1]]
+#> [1] "This"     "is"       "a"        "sentence"
+

By convention, "" is treated as +boundary("character"):

+
str_split(x, "")
+#> [[1]]
+#>  [1] "T" "h" "i" "s" " " "i" "s" " " "a" " " "s" "e" "n" "t" "e" "n" "c" "e" "."
+str_count(x, "")
+#> [1] 19
+
+
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/AnIndex new file mode 100644 index 00000000..dbaee5b0 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/AnIndex @@ -0,0 +1,67 @@ +stringr-package stringr-package +%>% pipe +boundary modifiers +case case +coll modifiers +fixed modifiers +fruit stringr-data +invert_match invert_match +modifiers modifiers +regex modifiers +sentences stringr-data +stringr stringr-package +stringr-data stringr-data +str_c str_c +str_conv str_conv +str_count str_count +str_detect str_detect +str_dup str_dup +str_ends str_starts +str_equal str_equal +str_escape str_escape +str_extract str_extract +str_extract_all str_extract +str_flatten str_flatten +str_flatten_comma str_flatten +str_glue str_glue +str_glue_data str_glue +str_interp str_interp +str_length str_length +str_like str_like +str_locate str_locate +str_locate_all str_locate +str_match str_match +str_match_all str_match +str_order str_order +str_pad str_pad +str_rank str_order +str_remove str_remove +str_remove_all str_remove +str_replace str_replace +str_replace_all str_replace +str_replace_na str_replace_na +str_sort str_order +str_split str_split +str_split_1 str_split +str_split_fixed str_split +str_split_i str_split +str_squish str_trim +str_starts str_starts +str_sub str_sub +str_sub<- str_sub +str_subset str_subset +str_sub_all str_sub +str_to_lower case +str_to_sentence case +str_to_title case +str_to_upper case +str_trim str_trim +str_trunc str_trunc +str_unique str_unique +str_view str_view +str_view_all str_view +str_which str_which +str_width str_length +str_wrap str_wrap +word word +words stringr-data diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/aliases.rds new file mode 100644 index 00000000..bcc568cc Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-archived.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-archived.svg new file mode 100644 index 00000000..48f72a6f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-archived.svg @@ -0,0 +1 @@ + lifecyclelifecyclearchivedarchived \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-defunct.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-defunct.svg new file mode 100644 index 00000000..01452e5f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-defunct.svg @@ -0,0 +1 @@ +lifecyclelifecycledefunctdefunct \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-deprecated.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-deprecated.svg new file mode 100644 index 00000000..4baaee01 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-deprecated.svg @@ -0,0 +1 @@ +lifecyclelifecycledeprecateddeprecated \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-experimental.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-experimental.svg new file mode 100644 index 00000000..d1d060e9 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-experimental.svg @@ -0,0 +1 @@ +lifecyclelifecycleexperimentalexperimental \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-maturing.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-maturing.svg new file mode 100644 index 00000000..df713101 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-maturing.svg @@ -0,0 +1 @@ +lifecyclelifecyclematuringmaturing \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-questioning.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-questioning.svg new file mode 100644 index 00000000..08ee0c90 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-questioning.svg @@ -0,0 +1 @@ +lifecyclelifecyclequestioningquestioning \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-stable.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-stable.svg new file mode 100644 index 00000000..e015dc81 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-stable.svg @@ -0,0 +1 @@ +lifecyclelifecyclestablestable \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-superseded.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-superseded.svg new file mode 100644 index 00000000..75f24f55 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/lifecycle-superseded.svg @@ -0,0 +1 @@ + lifecyclelifecyclesupersededsuperseded \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/logo.png b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/logo.png new file mode 100644 index 00000000..e8ab9576 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/figures/logo.png differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/paths.rds new file mode 100644 index 00000000..96c58710 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/stringr.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/stringr.rdb new file mode 100644 index 00000000..6e6925cd Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/stringr.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/stringr.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/stringr.rdx new file mode 100644 index 00000000..bb26e00b Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/help/stringr.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/html/00Index.html new file mode 100644 index 00000000..824106cd --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/html/00Index.html @@ -0,0 +1,153 @@ + + +R: Simple, Consistent Wrappers for Common String Operations + + + +
+

Simple, Consistent Wrappers for Common String Operations + +

+
+
+[Up] +[Top] +

Documentation for package ‘stringr’ version 1.5.1

+ + + +

Help Pages

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
boundaryControl matching behaviour with modifier functions
caseConvert string to upper case, lower case, title case, or sentence case
collControl matching behaviour with modifier functions
fixedControl matching behaviour with modifier functions
fruitSample character vectors for practicing string manipulations
invert_matchSwitch location of matches to location of non-matches
modifiersControl matching behaviour with modifier functions
regexControl matching behaviour with modifier functions
sentencesSample character vectors for practicing string manipulations
stringr-dataSample character vectors for practicing string manipulations
str_cJoin multiple strings into one string
str_convSpecify the encoding of a string
str_countCount number of matches
str_detectDetect the presence/absence of a match
str_dupDuplicate a string
str_endsDetect the presence/absence of a match at the start/end
str_equalDetermine if two strings are equivalent
str_escapeEscape regular expression metacharacters
str_extractExtract the complete match
str_extract_allExtract the complete match
str_flattenFlatten a string
str_flatten_commaFlatten a string
str_glueInterpolation with glue
str_glue_dataInterpolation with glue
str_lengthCompute the length/width
str_likeDetect a pattern in the same way as 'SQL"s 'LIKE' operator
str_locateFind location of match
str_locate_allFind location of match
str_matchExtract components (capturing groups) from a match
str_match_allExtract components (capturing groups) from a match
str_orderOrder, rank, or sort a character vector
str_padPad a string to minimum width
str_rankOrder, rank, or sort a character vector
str_removeRemove matched patterns
str_remove_allRemove matched patterns
str_replaceReplace matches with new text
str_replace_allReplace matches with new text
str_replace_naTurn NA into "NA"
str_sortOrder, rank, or sort a character vector
str_splitSplit up a string into pieces
str_split_1Split up a string into pieces
str_split_fixedSplit up a string into pieces
str_split_iSplit up a string into pieces
str_squishRemove whitespace
str_startsDetect the presence/absence of a match at the start/end
str_subGet and set substrings using their positions
str_sub<-Get and set substrings using their positions
str_subsetFind matching elements
str_sub_allGet and set substrings using their positions
str_to_lowerConvert string to upper case, lower case, title case, or sentence case
str_to_sentenceConvert string to upper case, lower case, title case, or sentence case
str_to_titleConvert string to upper case, lower case, title case, or sentence case
str_to_upperConvert string to upper case, lower case, title case, or sentence case
str_trimRemove whitespace
str_truncTruncate a string to maximum width
str_uniqueRemove duplicated strings
str_viewView strings and matches
str_view_allView strings and matches
str_whichFind matching indices
str_widthCompute the length/width
str_wrapWrap words into nicely formatted paragraphs
wordExtract words from a sentence
wordsSample character vectors for practicing string manipulations
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/htmlwidgets/lib/str_view.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/htmlwidgets/lib/str_view.css new file mode 100644 index 00000000..42cb1170 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/htmlwidgets/lib/str_view.css @@ -0,0 +1,20 @@ +.str_view ul { + font-size: 16px; +} + +.str_view ul, .str_view li { + list-style: none; + padding: 0; + margin: 0.5em 0; +} + +.str_view .match { + border: 1px solid #ccc; + background-color: #eee; + border-color: #ccc; + border-radius: 3px; +} + +.str_view .special { + background-color: red; +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/htmlwidgets/str_view.js b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/htmlwidgets/str_view.js new file mode 100644 index 00000000..9e33abfa --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/htmlwidgets/str_view.js @@ -0,0 +1,17 @@ +HTMLWidgets.widget({ + + name: 'str_view', + + type: 'output', + + initialize: function(el, width, height) { + }, + + renderValue: function(el, x, instance) { + el.innerHTML = x.html; + }, + + resize: function(el, width, height, instance) { + } + +}); diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/htmlwidgets/str_view.yaml b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/htmlwidgets/str_view.yaml new file mode 100644 index 00000000..1fbf4980 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/stringr/htmlwidgets/str_view.yaml @@ -0,0 +1,5 @@ +dependencies: + - name: str_view + version: 0.1.0 + src: htmlwidgets/lib/ + stylesheet: str_view.css diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/DESCRIPTION new file mode 100644 index 00000000..d16e2384 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/DESCRIPTION @@ -0,0 +1,49 @@ +Package: vctrs +Title: Vector Helpers +Version: 0.6.5 +Authors@R: c( + person("Hadley", "Wickham", , "hadley@posit.co", role = "aut"), + person("Lionel", "Henry", , "lionel@posit.co", role = "aut"), + person("Davis", "Vaughan", , "davis@posit.co", role = c("aut", "cre")), + person("data.table team", role = "cph", + comment = "Radix sort based on data.table's forder() and their contribution to R's order()"), + person("Posit Software, PBC", role = c("cph", "fnd")) + ) +Description: Defines new notions of prototype and size that are used to + provide tools for consistent and well-founded type-coercion and + size-recycling, and are in turn connected to ideas of type- and + size-stability useful for analysing function interfaces. +License: MIT + file LICENSE +URL: https://vctrs.r-lib.org/, https://github.com/r-lib/vctrs +BugReports: https://github.com/r-lib/vctrs/issues +Depends: R (>= 3.5.0) +Imports: cli (>= 3.4.0), glue, lifecycle (>= 1.0.3), rlang (>= 1.1.0) +Suggests: bit64, covr, crayon, dplyr (>= 0.8.5), generics, knitr, + pillar (>= 1.4.4), pkgdown (>= 2.0.1), rmarkdown, testthat (>= + 3.0.0), tibble (>= 3.1.3), waldo (>= 0.2.0), withr, xml2, + zeallot +VignetteBuilder: knitr +Config/Needs/website: tidyverse/tidytemplate +Config/testthat/edition: 3 +Encoding: UTF-8 +Language: en-GB +RoxygenNote: 7.2.3 +NeedsCompilation: yes +Packaged: 2023-12-01 16:27:12 UTC; davis +Author: Hadley Wickham [aut], + Lionel Henry [aut], + Davis Vaughan [aut, cre], + data.table team [cph] (Radix sort based on data.table's forder() and + their contribution to R's order()), + Posit Software, PBC [cph, fnd] +Maintainer: Davis Vaughan +Repository: CRAN +Date/Publication: 2023-12-01 23:50:02 UTC +Built: R 4.4.0; aarch64-apple-darwin20; 2024-04-06 02:48:37 UTC; unix +Archs: vctrs.so.dSYM +RemoteType: standard +RemotePkgRef: vctrs +RemoteRef: vctrs +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 0.6.5 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/INDEX new file mode 100644 index 00000000..0f23b3f5 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/INDEX @@ -0,0 +1,67 @@ +%0% Default value for empty vectors +data_frame Construct a data frame +df_list Collect columns for data frame construction +df_ptype2 Coercion between two data frames +faq-compatibility-types + FAQ - How is the compatibility of vector types + decided? +faq-error-incompatible-attributes + FAQ - Error/Warning: Some attributes are + incompatible +faq-error-scalar-type FAQ - Error: Input must be a vector +howto-faq-coercion FAQ - How to implement ptype2 and cast methods? +howto-faq-coercion-data-frame + FAQ - How to implement ptype2 and cast methods? + (Data frames) +howto-faq-fix-scalar-type-error + FAQ - Why isn't my class treated as a vector? +internal-faq-matches-algorithm + Internal FAQ - Implementation of + 'vec_locate_matches()' +internal-faq-ptype2-identity + Internal FAQ - 'vec_ptype2()', 'NULL', and + unspecified vectors +list_drop_empty Drop empty elements from a list +list_of 'list_of' S3 class for homogenous lists +missing Missing values +name_spec Name specifications +new_data_frame Assemble attributes for data frame construction +obj_is_list List checks +reference-faq-compatibility + FAQ - Is my class compatible with vctrs? +runs Runs +theory-faq-coercion FAQ - How does coercion work in vctrs? +theory-faq-recycling FAQ - How does recycling work in vctrs and the + tidyverse? +vec-rep Repeat a vector +vec-set Set operations +vec_as_names Retrieve and repair names +vec_bind Combine many data frames into one data frame +vec_c Combine many vectors into one vector +vec_cast Cast a vector to a specified type +vec_chop Chopping +vec_compare Compare two vectors +vec_count Count unique values in a vector +vec_detect_complete Complete +vec_duplicate Find duplicated values +vec_equal Equality +vec_expand_grid Create a data frame from all combinations of + the inputs +vec_fill_missing Fill in missing values with the previous or + following value +vec_init Initialize a vector +vec_interleave Interleave many vectors into one vector +vec_locate_matches Locate observations matching specified + conditions +vec_match Find matching observations across vectors +vec_names Get or set the names of a vector +vec_order Order and sort vectors +vec_ptype Find the prototype of a set of vectors +vec_ptype2.logical Find the common type for a pair of vectors +vec_rank Compute ranks +vec_recycle Vector recycling +vec_seq_along Useful sequences +vec_size Number of observations +vec_split Split a vector into groups +vec_unique Find and count unique values +vector-checks Vector checks diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/LICENSE new file mode 100644 index 00000000..a0952ae3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2023 +COPYRIGHT HOLDER: vctrs authors diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/Meta/Rd.rds new file mode 100644 index 00000000..968ac4fc Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/Meta/features.rds new file mode 100644 index 00000000..ded31532 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/Meta/hsearch.rds new file mode 100644 index 00000000..7ee27bed Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/Meta/links.rds new file mode 100644 index 00000000..84bf7448 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/Meta/nsInfo.rds new file mode 100644 index 00000000..4f3979b4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/Meta/package.rds new file mode 100644 index 00000000..15e40cc6 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/Meta/vignette.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/Meta/vignette.rds new file mode 100644 index 00000000..4c0ef0f4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/Meta/vignette.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/NAMESPACE new file mode 100644 index 00000000..85dd9fe8 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/NAMESPACE @@ -0,0 +1,659 @@ +# Generated by roxygen2: do not edit by hand + +S3method("!",vctrs_vctr) +S3method("!=",vctrs_vctr) +S3method("$",vctrs_list_of) +S3method("$",vctrs_rcrd) +S3method("$",vctrs_sclr) +S3method("$",vctrs_vctr) +S3method("$<-",vctrs_list_of) +S3method("$<-",vctrs_rcrd) +S3method("$<-",vctrs_sclr) +S3method("$<-",vctrs_vctr) +S3method("%%",vctrs_vctr) +S3method("%/%",vctrs_vctr) +S3method("&",vctrs_vctr) +S3method("*",vctrs_vctr) +S3method("+",vctrs_vctr) +S3method("-",vctrs_vctr) +S3method("/",vctrs_vctr) +S3method("<",vctrs_vctr) +S3method("<=",vctrs_vctr) +S3method("==",vctrs_vctr) +S3method(">",vctrs_vctr) +S3method(">=",vctrs_vctr) +S3method("[",vctrs_rcrd) +S3method("[",vctrs_sclr) +S3method("[",vctrs_unspecified) +S3method("[",vctrs_vctr) +S3method("[<-",vctrs_list_of) +S3method("[<-",vctrs_rcrd) +S3method("[<-",vctrs_sclr) +S3method("[<-",vctrs_vctr) +S3method("[[",vctrs_list_of) +S3method("[[",vctrs_rcrd) +S3method("[[",vctrs_sclr) +S3method("[[",vctrs_vctr) +S3method("[[<-",vctrs_list_of) +S3method("[[<-",vctrs_rcrd) +S3method("[[<-",vctrs_sclr) +S3method("[[<-",vctrs_vctr) +S3method("^",vctrs_vctr) +S3method("dim<-",vctrs_sclr) +S3method("dim<-",vctrs_vctr) +S3method("dimnames<-",vctrs_sclr) +S3method("dimnames<-",vctrs_vctr) +S3method("is.na<-",vctrs_sclr) +S3method("is.na<-",vctrs_vctr) +S3method("length<-",vctrs_rcrd) +S3method("length<-",vctrs_vctr) +S3method("levels<-",vctrs_sclr) +S3method("levels<-",vctrs_vctr) +S3method("names<-",vctrs_rcrd) +S3method("names<-",vctrs_sclr) +S3method("names<-",vctrs_vctr) +S3method("|",vctrs_vctr) +S3method(Complex,vctrs_sclr) +S3method(Math,vctrs_sclr) +S3method(Math,vctrs_vctr) +S3method(Ops,vctrs_sclr) +S3method(Summary,vctrs_sclr) +S3method(Summary,vctrs_vctr) +S3method(anyDuplicated,vctrs_sclr) +S3method(anyDuplicated,vctrs_vctr) +S3method(anyNA,vctrs_vctr) +S3method(as.Date,vctrs_sclr) +S3method(as.Date,vctrs_vctr) +S3method(as.POSIXct,vctrs_sclr) +S3method(as.POSIXct,vctrs_vctr) +S3method(as.POSIXlt,vctrs_vctr) +S3method(as.character,vctrs_list_of) +S3method(as.character,vctrs_sclr) +S3method(as.character,vctrs_vctr) +S3method(as.data.frame,vctrs_sclr) +S3method(as.data.frame,vctrs_vctr) +S3method(as.double,vctrs_sclr) +S3method(as.double,vctrs_vctr) +S3method(as.integer,vctrs_sclr) +S3method(as.integer,vctrs_vctr) +S3method(as.list,vctrs_list_of) +S3method(as.list,vctrs_sclr) +S3method(as.list,vctrs_vctr) +S3method(as.logical,vctrs_sclr) +S3method(as.logical,vctrs_vctr) +S3method(as_list_of,list) +S3method(as_list_of,vctrs_list_of) +S3method(c,vctrs_sclr) +S3method(c,vctrs_vctr) +S3method(can_fall_back,"vctrs:::common_class_fallback") +S3method(can_fall_back,data.frame) +S3method(can_fall_back,default) +S3method(can_fall_back,ts) +S3method(can_fall_back,vctrs_vctr) +S3method(cnd_body,vctrs_error_cast_lossy) +S3method(cnd_body,vctrs_error_incompatible_size) +S3method(cnd_body,vctrs_error_matches_incomplete) +S3method(cnd_body,vctrs_error_matches_multiple) +S3method(cnd_body,vctrs_error_matches_nothing) +S3method(cnd_body,vctrs_error_matches_relationship_many_to_one) +S3method(cnd_body,vctrs_error_matches_relationship_one_to_many) +S3method(cnd_body,vctrs_error_matches_relationship_one_to_one) +S3method(cnd_body,vctrs_error_matches_remaining) +S3method(cnd_body,vctrs_error_names_cannot_be_dot_dot) +S3method(cnd_body,vctrs_error_names_cannot_be_empty) +S3method(cnd_body,vctrs_error_names_must_be_unique) +S3method(cnd_body,vctrs_error_subscript_oob) +S3method(cnd_body,vctrs_error_subscript_type) +S3method(cnd_header,vctrs_error_cast_lossy) +S3method(cnd_header,vctrs_error_incompatible_size) +S3method(cnd_header,vctrs_error_matches_incomplete) +S3method(cnd_header,vctrs_error_matches_multiple) +S3method(cnd_header,vctrs_error_matches_nothing) +S3method(cnd_header,vctrs_error_matches_relationship_many_to_one) +S3method(cnd_header,vctrs_error_matches_relationship_one_to_many) +S3method(cnd_header,vctrs_error_matches_relationship_one_to_one) +S3method(cnd_header,vctrs_error_matches_remaining) +S3method(cnd_header,vctrs_error_names_cannot_be_dot_dot) +S3method(cnd_header,vctrs_error_names_cannot_be_empty) +S3method(cnd_header,vctrs_error_names_must_be_unique) +S3method(cnd_header,vctrs_error_subscript_oob) +S3method(cnd_header,vctrs_error_subscript_size) +S3method(cnd_header,vctrs_error_subscript_type) +S3method(diff,vctrs_vctr) +S3method(duplicated,vctrs_sclr) +S3method(duplicated,vctrs_vctr) +S3method(format,vctrs_bytes) +S3method(format,vctrs_group_rle) +S3method(format,vctrs_list_of) +S3method(format,vctrs_rcrd) +S3method(format,vctrs_vctr) +S3method(is.finite,vctrs_vctr) +S3method(is.infinite,vctrs_vctr) +S3method(is.na,vctrs_vctr) +S3method(is.nan,vctrs_vctr) +S3method(length,vctrs_rcrd) +S3method(levels,vctrs_sclr) +S3method(levels,vctrs_vctr) +S3method(max,vctrs_vctr) +S3method(mean,vctrs_vctr) +S3method(median,vctrs_vctr) +S3method(min,vctrs_vctr) +S3method(na.exclude,vctrs_vctr) +S3method(na.fail,vctrs_vctr) +S3method(na.omit,vctrs_vctr) +S3method(names,vctrs_rcrd) +S3method(obj_print_data,default) +S3method(obj_print_data,vctrs_list_of) +S3method(obj_print_data,vctrs_partial) +S3method(obj_print_footer,default) +S3method(obj_print_header,default) +S3method(obj_print_header,vctrs_group_rle) +S3method(obj_print_header,vctrs_partial) +S3method(obj_str_data,default) +S3method(obj_str_data,vctrs_rcrd) +S3method(obj_str_footer,default) +S3method(obj_str_header,default) +S3method(print,vctrs_bytes) +S3method(print,vctrs_sclr) +S3method(print,vctrs_unspecified) +S3method(print,vctrs_vctr) +S3method(quantile,vctrs_vctr) +S3method(range,vctrs_vctr) +S3method(rep,vctrs_rcrd) +S3method(rep,vctrs_vctr) +S3method(str,vctrs_vctr) +S3method(summary,vctrs_sclr) +S3method(summary,vctrs_vctr) +S3method(t,vctrs_sclr) +S3method(t,vctrs_vctr) +S3method(unique,vctrs_sclr) +S3method(unique,vctrs_vctr) +S3method(vec_arith,Date) +S3method(vec_arith,POSIXct) +S3method(vec_arith,POSIXlt) +S3method(vec_arith,default) +S3method(vec_arith,difftime) +S3method(vec_arith,factor) +S3method(vec_arith,logical) +S3method(vec_arith,numeric) +S3method(vec_arith.Date,Date) +S3method(vec_arith.Date,POSIXct) +S3method(vec_arith.Date,POSIXlt) +S3method(vec_arith.Date,default) +S3method(vec_arith.Date,difftime) +S3method(vec_arith.Date,numeric) +S3method(vec_arith.POSIXct,Date) +S3method(vec_arith.POSIXct,POSIXct) +S3method(vec_arith.POSIXct,POSIXlt) +S3method(vec_arith.POSIXct,default) +S3method(vec_arith.POSIXct,difftime) +S3method(vec_arith.POSIXct,numeric) +S3method(vec_arith.POSIXlt,Date) +S3method(vec_arith.POSIXlt,POSIXct) +S3method(vec_arith.POSIXlt,POSIXlt) +S3method(vec_arith.POSIXlt,default) +S3method(vec_arith.POSIXlt,difftime) +S3method(vec_arith.POSIXlt,numeric) +S3method(vec_arith.difftime,Date) +S3method(vec_arith.difftime,MISSING) +S3method(vec_arith.difftime,POSIXct) +S3method(vec_arith.difftime,POSIXlt) +S3method(vec_arith.difftime,default) +S3method(vec_arith.difftime,difftime) +S3method(vec_arith.difftime,numeric) +S3method(vec_arith.logical,default) +S3method(vec_arith.logical,logical) +S3method(vec_arith.logical,numeric) +S3method(vec_arith.numeric,Date) +S3method(vec_arith.numeric,POSIXct) +S3method(vec_arith.numeric,POSIXlt) +S3method(vec_arith.numeric,default) +S3method(vec_arith.numeric,difftime) +S3method(vec_arith.numeric,logical) +S3method(vec_arith.numeric,numeric) +S3method(vec_cast,Date) +S3method(vec_cast,POSIXct) +S3method(vec_cast,POSIXlt) +S3method(vec_cast,character) +S3method(vec_cast,character.factor) +S3method(vec_cast,character.ordered) +S3method(vec_cast,complex) +S3method(vec_cast,data.frame) +S3method(vec_cast,data.frame.data.table) +S3method(vec_cast,data.table.data.frame) +S3method(vec_cast,data.table.data.table) +S3method(vec_cast,difftime) +S3method(vec_cast,double) +S3method(vec_cast,double.exclude) +S3method(vec_cast,double.omit) +S3method(vec_cast,exclude.double) +S3method(vec_cast,exclude.exclude) +S3method(vec_cast,exclude.integer) +S3method(vec_cast,factor) +S3method(vec_cast,factor.character) +S3method(vec_cast,factor.factor) +S3method(vec_cast,integer) +S3method(vec_cast,integer.exclude) +S3method(vec_cast,integer.omit) +S3method(vec_cast,integer64) +S3method(vec_cast,list) +S3method(vec_cast,list.vctrs_list_of) +S3method(vec_cast,logical) +S3method(vec_cast,omit.double) +S3method(vec_cast,omit.integer) +S3method(vec_cast,omit.omit) +S3method(vec_cast,ordered) +S3method(vec_cast,ordered.character) +S3method(vec_cast,ordered.ordered) +S3method(vec_cast,raw) +S3method(vec_cast,table.table) +S3method(vec_cast,vctrs_list_of) +S3method(vec_cast,vctrs_list_of.list) +S3method(vec_cast,vctrs_rcrd) +S3method(vec_cast,vctrs_rcrd.vctrs_rcrd) +S3method(vec_cast,vctrs_vctr) +S3method(vec_cast.Date,Date) +S3method(vec_cast.Date,POSIXct) +S3method(vec_cast.Date,POSIXlt) +S3method(vec_cast.POSIXct,Date) +S3method(vec_cast.POSIXct,POSIXct) +S3method(vec_cast.POSIXct,POSIXlt) +S3method(vec_cast.POSIXlt,Date) +S3method(vec_cast.POSIXlt,POSIXct) +S3method(vec_cast.POSIXlt,POSIXlt) +S3method(vec_cast.character,character) +S3method(vec_cast.complex,complex) +S3method(vec_cast.complex,double) +S3method(vec_cast.complex,integer) +S3method(vec_cast.complex,logical) +S3method(vec_cast.data.frame,data.frame) +S3method(vec_cast.difftime,difftime) +S3method(vec_cast.double,double) +S3method(vec_cast.double,integer) +S3method(vec_cast.double,integer64) +S3method(vec_cast.double,logical) +S3method(vec_cast.integer,double) +S3method(vec_cast.integer,integer) +S3method(vec_cast.integer,integer64) +S3method(vec_cast.integer,logical) +S3method(vec_cast.integer64,double) +S3method(vec_cast.integer64,integer) +S3method(vec_cast.integer64,integer64) +S3method(vec_cast.integer64,logical) +S3method(vec_cast.list,list) +S3method(vec_cast.logical,double) +S3method(vec_cast.logical,integer) +S3method(vec_cast.logical,integer64) +S3method(vec_cast.logical,logical) +S3method(vec_cast.raw,raw) +S3method(vec_cast.vctrs_list_of,vctrs_list_of) +S3method(vec_cbind_frame_ptype,default) +S3method(vec_cbind_frame_ptype,sf) +S3method(vec_math,Date) +S3method(vec_math,POSIXct) +S3method(vec_math,POSIXlt) +S3method(vec_math,default) +S3method(vec_math,factor) +S3method(vec_math,vctrs_rcrd) +S3method(vec_proxy,"vctrs:::common_class_fallback") +S3method(vec_proxy,AsIs) +S3method(vec_proxy,Date) +S3method(vec_proxy,POSIXct) +S3method(vec_proxy,POSIXlt) +S3method(vec_proxy,default) +S3method(vec_proxy,exclude) +S3method(vec_proxy,factor) +S3method(vec_proxy,numeric_version) +S3method(vec_proxy,omit) +S3method(vec_proxy,ordered) +S3method(vec_proxy,vctrs_list_of) +S3method(vec_proxy,vctrs_rcrd) +S3method(vec_proxy,vctrs_vctr) +S3method(vec_proxy_compare,AsIs) +S3method(vec_proxy_compare,POSIXlt) +S3method(vec_proxy_compare,array) +S3method(vec_proxy_compare,default) +S3method(vec_proxy_compare,list) +S3method(vec_proxy_compare,raw) +S3method(vec_proxy_equal,AsIs) +S3method(vec_proxy_equal,POSIXlt) +S3method(vec_proxy_equal,array) +S3method(vec_proxy_equal,default) +S3method(vec_proxy_equal,integer64) +S3method(vec_proxy_equal,numeric_version) +S3method(vec_proxy_order,AsIs) +S3method(vec_proxy_order,array) +S3method(vec_proxy_order,default) +S3method(vec_proxy_order,list) +S3method(vec_proxy_order,raw) +S3method(vec_ptype2,AsIs) +S3method(vec_ptype2,Date) +S3method(vec_ptype2,POSIXct) +S3method(vec_ptype2,POSIXlt) +S3method(vec_ptype2,character) +S3method(vec_ptype2,character.factor) +S3method(vec_ptype2,character.ordered) +S3method(vec_ptype2,complex) +S3method(vec_ptype2,data.frame) +S3method(vec_ptype2,data.frame.data.table) +S3method(vec_ptype2,data.table.data.frame) +S3method(vec_ptype2,data.table.data.table) +S3method(vec_ptype2,difftime) +S3method(vec_ptype2,double) +S3method(vec_ptype2,double.exclude) +S3method(vec_ptype2,double.omit) +S3method(vec_ptype2,exclude.double) +S3method(vec_ptype2,exclude.exclude) +S3method(vec_ptype2,exclude.integer) +S3method(vec_ptype2,factor) +S3method(vec_ptype2,factor.character) +S3method(vec_ptype2,factor.factor) +S3method(vec_ptype2,factor.ordered) +S3method(vec_ptype2,integer) +S3method(vec_ptype2,integer.exclude) +S3method(vec_ptype2,integer.omit) +S3method(vec_ptype2,integer64) +S3method(vec_ptype2,list) +S3method(vec_ptype2,list.vctrs_list_of) +S3method(vec_ptype2,logical) +S3method(vec_ptype2,omit.double) +S3method(vec_ptype2,omit.integer) +S3method(vec_ptype2,omit.omit) +S3method(vec_ptype2,ordered) +S3method(vec_ptype2,ordered.character) +S3method(vec_ptype2,ordered.factor) +S3method(vec_ptype2,ordered.ordered) +S3method(vec_ptype2,raw) +S3method(vec_ptype2,table.table) +S3method(vec_ptype2,vctrs_list_of) +S3method(vec_ptype2,vctrs_list_of.list) +S3method(vec_ptype2,vctrs_partial_factor) +S3method(vec_ptype2,vctrs_partial_frame) +S3method(vec_ptype2.AsIs,AsIs) +S3method(vec_ptype2.Date,Date) +S3method(vec_ptype2.Date,POSIXct) +S3method(vec_ptype2.Date,POSIXlt) +S3method(vec_ptype2.POSIXct,Date) +S3method(vec_ptype2.POSIXct,POSIXct) +S3method(vec_ptype2.POSIXct,POSIXlt) +S3method(vec_ptype2.POSIXlt,Date) +S3method(vec_ptype2.POSIXlt,POSIXct) +S3method(vec_ptype2.POSIXlt,POSIXlt) +S3method(vec_ptype2.character,character) +S3method(vec_ptype2.complex,complex) +S3method(vec_ptype2.complex,double) +S3method(vec_ptype2.complex,integer) +S3method(vec_ptype2.data.frame,data.frame) +S3method(vec_ptype2.data.frame,vctrs_partial_frame) +S3method(vec_ptype2.difftime,difftime) +S3method(vec_ptype2.double,complex) +S3method(vec_ptype2.double,double) +S3method(vec_ptype2.double,integer) +S3method(vec_ptype2.double,logical) +S3method(vec_ptype2.factor,vctrs_partial_factor) +S3method(vec_ptype2.integer,complex) +S3method(vec_ptype2.integer,double) +S3method(vec_ptype2.integer,integer) +S3method(vec_ptype2.integer,integer64) +S3method(vec_ptype2.integer,logical) +S3method(vec_ptype2.integer64,integer) +S3method(vec_ptype2.integer64,integer64) +S3method(vec_ptype2.integer64,logical) +S3method(vec_ptype2.list,list) +S3method(vec_ptype2.logical,double) +S3method(vec_ptype2.logical,integer) +S3method(vec_ptype2.logical,integer64) +S3method(vec_ptype2.logical,logical) +S3method(vec_ptype2.raw,raw) +S3method(vec_ptype2.vctrs_list_of,vctrs_list_of) +S3method(vec_ptype2.vctrs_partial_factor,factor) +S3method(vec_ptype2.vctrs_partial_factor,vctrs_partial_factor) +S3method(vec_ptype2.vctrs_partial_frame,data.frame) +S3method(vec_ptype2.vctrs_partial_frame,vctrs_partial_frame) +S3method(vec_ptype_abbr,"NULL") +S3method(vec_ptype_abbr,AsIs) +S3method(vec_ptype_abbr,Date) +S3method(vec_ptype_abbr,POSIXct) +S3method(vec_ptype_abbr,POSIXlt) +S3method(vec_ptype_abbr,data.frame) +S3method(vec_ptype_abbr,data.table) +S3method(vec_ptype_abbr,default) +S3method(vec_ptype_abbr,difftime) +S3method(vec_ptype_abbr,factor) +S3method(vec_ptype_abbr,integer64) +S3method(vec_ptype_abbr,ordered) +S3method(vec_ptype_abbr,table) +S3method(vec_ptype_abbr,vctrs_list_of) +S3method(vec_ptype_abbr,vctrs_partial_factor) +S3method(vec_ptype_abbr,vctrs_partial_frame) +S3method(vec_ptype_abbr,vctrs_unspecified) +S3method(vec_ptype_finalise,default) +S3method(vec_ptype_finalise,vctrs_partial) +S3method(vec_ptype_finalise,vctrs_partial_factor) +S3method(vec_ptype_finalise,vctrs_partial_frame) +S3method(vec_ptype_full,"NULL") +S3method(vec_ptype_full,AsIs) +S3method(vec_ptype_full,Date) +S3method(vec_ptype_full,POSIXct) +S3method(vec_ptype_full,POSIXlt) +S3method(vec_ptype_full,default) +S3method(vec_ptype_full,difftime) +S3method(vec_ptype_full,factor) +S3method(vec_ptype_full,integer64) +S3method(vec_ptype_full,ordered) +S3method(vec_ptype_full,table) +S3method(vec_ptype_full,vctrs_list_of) +S3method(vec_ptype_full,vctrs_partial_factor) +S3method(vec_ptype_full,vctrs_partial_frame) +S3method(vec_restore,AsIs) +S3method(vec_restore,Date) +S3method(vec_restore,POSIXct) +S3method(vec_restore,POSIXlt) +S3method(vec_restore,data.frame) +S3method(vec_restore,default) +S3method(vec_restore,exclude) +S3method(vec_restore,factor) +S3method(vec_restore,omit) +S3method(vec_restore,ordered) +S3method(vec_restore,table) +S3method(vec_restore,vctrs_rcrd) +S3method(vec_restore,vctrs_vctr) +S3method(xtfrm,vctrs_sclr) +S3method(xtfrm,vctrs_vctr) +export("%0%") +export("field<-") +export("vec_slice<-") +export(MISSING) +export(allow_lossy_cast) +export(as_list_of) +export(data_frame) +export(df_cast) +export(df_list) +export(df_ptype2) +export(field) +export(fields) +export(is_list_of) +export(is_partial) +export(list_all_size) +export(list_all_vectors) +export(list_check_all_size) +export(list_check_all_vectors) +export(list_drop_empty) +export(list_of) +export(list_sizes) +export(list_unchop) +export(maybe_lossy_cast) +export(n_fields) +export(new_data_frame) +export(new_date) +export(new_datetime) +export(new_duration) +export(new_factor) +export(new_list_of) +export(new_ordered) +export(new_partial) +export(new_rcrd) +export(new_vctr) +export(num_as_location) +export(num_as_location2) +export(obj_check_list) +export(obj_check_vector) +export(obj_is_list) +export(obj_is_vector) +export(obj_print) +export(obj_print_data) +export(obj_print_footer) +export(obj_print_header) +export(obj_str) +export(obj_str_data) +export(obj_str_footer) +export(obj_str_header) +export(partial_factor) +export(partial_frame) +export(s3_register) +export(stop_incompatible_cast) +export(stop_incompatible_op) +export(stop_incompatible_size) +export(stop_incompatible_type) +export(tib_cast) +export(tib_ptype2) +export(unspecified) +export(vec_any_missing) +export(vec_arith) +export(vec_arith.Date) +export(vec_arith.POSIXct) +export(vec_arith.POSIXlt) +export(vec_arith.difftime) +export(vec_arith.logical) +export(vec_arith.numeric) +export(vec_arith_base) +export(vec_as_index) +export(vec_as_location) +export(vec_as_location2) +export(vec_as_names) +export(vec_as_names_legacy) +export(vec_as_subscript) +export(vec_as_subscript2) +export(vec_assert) +export(vec_assign) +export(vec_c) +export(vec_cast) +export(vec_cast.Date) +export(vec_cast.POSIXct) +export(vec_cast.POSIXlt) +export(vec_cast.character) +export(vec_cast.complex) +export(vec_cast.data.frame) +export(vec_cast.difftime) +export(vec_cast.double) +export(vec_cast.factor) +export(vec_cast.integer) +export(vec_cast.integer64) +export(vec_cast.list) +export(vec_cast.logical) +export(vec_cast.ordered) +export(vec_cast.raw) +export(vec_cast.vctrs_list_of) +export(vec_cast_common) +export(vec_cbind) +export(vec_cbind_frame_ptype) +export(vec_check_list) +export(vec_check_size) +export(vec_chop) +export(vec_compare) +export(vec_count) +export(vec_data) +export(vec_default_cast) +export(vec_default_ptype2) +export(vec_detect_complete) +export(vec_detect_missing) +export(vec_duplicate_any) +export(vec_duplicate_detect) +export(vec_duplicate_id) +export(vec_empty) +export(vec_equal) +export(vec_equal_na) +export(vec_expand_grid) +export(vec_fill_missing) +export(vec_group_id) +export(vec_group_loc) +export(vec_group_rle) +export(vec_identify_runs) +export(vec_in) +export(vec_init) +export(vec_init_along) +export(vec_interleave) +export(vec_is) +export(vec_is_empty) +export(vec_is_list) +export(vec_locate_matches) +export(vec_locate_sorted_groups) +export(vec_match) +export(vec_math) +export(vec_math_base) +export(vec_names) +export(vec_names2) +export(vec_order) +export(vec_proxy) +export(vec_proxy_compare) +export(vec_proxy_equal) +export(vec_proxy_order) +export(vec_ptype) +export(vec_ptype2) +export(vec_ptype2.AsIs) +export(vec_ptype2.Date) +export(vec_ptype2.POSIXct) +export(vec_ptype2.POSIXlt) +export(vec_ptype2.character) +export(vec_ptype2.complex) +export(vec_ptype2.data.frame) +export(vec_ptype2.difftime) +export(vec_ptype2.double) +export(vec_ptype2.factor) +export(vec_ptype2.integer) +export(vec_ptype2.integer64) +export(vec_ptype2.list) +export(vec_ptype2.logical) +export(vec_ptype2.ordered) +export(vec_ptype2.raw) +export(vec_ptype2.vctrs_list_of) +export(vec_ptype_abbr) +export(vec_ptype_common) +export(vec_ptype_finalise) +export(vec_ptype_full) +export(vec_ptype_show) +export(vec_rank) +export(vec_rbind) +export(vec_recycle) +export(vec_recycle_common) +export(vec_rep) +export(vec_rep_each) +export(vec_repeat) +export(vec_restore) +export(vec_run_sizes) +export(vec_seq_along) +export(vec_set_difference) +export(vec_set_intersect) +export(vec_set_names) +export(vec_set_symmetric_difference) +export(vec_set_union) +export(vec_size) +export(vec_size_common) +export(vec_slice) +export(vec_sort) +export(vec_split) +export(vec_type) +export(vec_type2) +export(vec_type_common) +export(vec_unchop) +export(vec_unique) +export(vec_unique_count) +export(vec_unique_loc) +export(vec_unrep) +import(rlang) +importFrom(stats,median) +importFrom(stats,na.exclude) +importFrom(stats,na.fail) +importFrom(stats,na.omit) +importFrom(stats,quantile) +useDynLib(vctrs, .registration = TRUE) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/NEWS.md new file mode 100644 index 00000000..48107b5b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/NEWS.md @@ -0,0 +1,1395 @@ +# vctrs 0.6.5 + +* Internal changes requested by CRAN around C level format strings (#1896). + +* Fixed tests related to changes to `dim<-()` in R-devel (#1889). + +# vctrs 0.6.4 + +* Fixed a performance issue with `vec_c()` and ALTREP vectors (in particular, + the new ALTREP list vectors in R-devel) (#1884). + +* Fixed an issue with complex vector tests related to changes in R-devel + (#1883). + +* Added a class to the `vec_locate_matches()` error that is thrown when an + overflow would otherwise occur (#1845). + +* Fixed an issue with `vec_rank()` and 0-column data frames (#1863). + +# vctrs 0.6.3 + +* Fixed an issue where certain ALTREP row names were being materialized when + passed to `new_data_frame()`. We've fixed this by removing a safeguard in + `new_data_frame()` that performed a compatibility check when both `n` and + `row.names` were provided. Because this is a low level function designed for + performance, it is up to the caller to ensure these inputs are compatible + (tidyverse/dplyr#6596). + +* Fixed an issue where `vec_set_*()` used with data frames could accidentally + return an object with the type of the proxy rather than the type of the + original inputs (#1837). + +* Fixed a rare `vec_locate_matches()` bug that could occur when using a max/min + `filter` (tidyverse/dplyr#6835). + +# vctrs 0.6.2 + +* Fixed conditional S3 registration to avoid a CRAN check NOTE that appears in + R >=4.3.0 (#1832). + +* Fixed tests to maintain compatibility with the next version of waldo (#1829). + +# vctrs 0.6.1 + +* Fixed a test related to `c.sfc()` changes in sf 1.0-10 (#1817). + +# vctrs 0.6.0 + +* New `vec_run_sizes()` for computing the size of each run within a vector. It + is identical to the `times` column from `vec_unrep()`, but is faster if you + don't need the run key (#1210). + +* New `sizes` argument to `vec_chop()` which allows you to partition a vector + using an integer vector describing the size of each expected slice. It is + particularly useful in combination with `vec_run_sizes()` and `list_sizes()` + (#1210, #1598). + +* New `obj_is_vector()`, `obj_check_vector()`, and `vec_check_size()` validation + helpers. We believe these are a better approach to vector validation than + `vec_assert()` and `vec_is()`, which have been marked as questioning because + the semantics of their `ptype` arguments are hard to define and can often be + replaced by `vec_cast()` or a type predicate function like + `rlang::is_logical()` (#1784). + +* `vec_is_list()` and `vec_check_list()` have been renamed to `obj_is_list()` + and `obj_check_list()`, in line with the new `obj_is_vector()` helper. The + old functions have been silently deprecated, but an official deprecation + process will start in the next vctrs release (#1803). + +* `vec_locate_matches()` gains a new `relationship` argument that holistically + handles multiple matches between `needles` and `haystack`. In particular, + `relationship = "many-to-one"` replaces `multiple = "error"` and + `multiple = "warning"`, which have been removed from the documentation and + silently soft-deprecated. Official deprecation for those options will start in + a future release (#1791). + +* `vec_locate_matches()` has changed its default `needles_arg` and + `haystack_arg` values from `""` to `"needles"` and `"haystack"`, respectively. + This generally generates more informative error messages (#1792). + +* `vec_chop()` has gained empty `...` between `x` and the optional `indices` + argument. For backwards compatibility, supplying `vec_chop(x, indices)` + without naming `indices` still silently works, but will be deprecated in a + future release (#1813). + +* `vec_slice()` has gained an `error_call` argument (#1785). + +* The `numeric_version` type from base R is now better supported in equality, + comparison, and order based operations (tidyverse/dplyr#6680). + +* R >=3.5.0 is now explicitly required. This is in line with the tidyverse + policy of supporting the [5 most recent versions of + R](https://www.tidyverse.org/blog/2019/04/r-version-support/). + +# vctrs 0.5.2 + +* New `vec_expand_grid()`, which is a lower level helper that is similar to + `tidyr::expand_grid()` (#1325). + +* New `vec_set_intersect()`, `vec_set_difference()`, `vec_set_union()`, and + `vec_set_symmetric_difference()` which compute set operations like + `intersect()`, `setdiff()`, and `union()`, but the vctrs variants don't strip + attributes and work with data frames (#1755, #1765). + +* `vec_identify_runs()` is now faster when used with data frames (#1684). + +* The maximum load factor of the internal dictionary was reduced from 77% to + 50%, which improves performance of functions like `vec_match()`, + `vec_set_intersect()`, and `vec_unique()` in some cases (#1760). + +* Fixed a bug with the internal `vec_order_radix()` function related to matrix + columns (#1753). + +# vctrs 0.5.1 + +* Fix for CRAN checks. + + +# vctrs 0.5.0 + +* vctrs is now compliant with `-Wstrict-prototypes` as requested by CRAN + (#1729). + +* `vec_ptype2()` now consistently falls back to bare data frame in + case of incompatible data frame subclasses. This is part of a + general move towards relaxed coercion rules. + +* Common type and cast errors now inherit from `"vctrs_error_ptype2"` + and `"vctrs_error_cast"` respectively. They are still both + subclasses from `"vctrs_error_incompatible_type"` (which used to be + their most specific class and is now a parent class). + +* New `list_all_size()` and `list_check_all_size()` to quickly determine if a + list contains elements of a particular `size` (#1582). + +* `list_unchop()` has gained empty `...` to force optional arguments to be + named (#1715). + +* `vec_rep_each(times = 0)` now works correctly with logical vectors that are + considered unspecified and with named vectors (#1673). + +* `list_of()` was relaxed to make it easier to combine. It is now + coercible with `list()` (#1161). When incompatible `list_of()` types + are combined, the result is now a bare `list()`. + + Following this change, the role of `list_of()` is mainly to carry + type information for potential optimisations, rather than to + guarantee a certain type throughout an analysis. + +* `validate_list_of()` has been removed. It hasn't proven to be practically + useful, and isn't used by any packages on CRAN (#1697). + +* Directed calls to `vec_c()`, like `vec_c(.ptype = )`, now mention the + position of the problematic argument when there are cast errors (#1690). + +* `list_unchop()` no longer drops names in some cases when `indices` were + supplied (#1689). + +* `"unique_quiet"` and `"universal_quiet"` are newly accepted by + `vec_as_names(repair =)` and `vec_names2(repair =)`. These options exist to + help users who call these functions indirectly, via another function which + only exposes `repair` but not `quiet`. Specifying `repair = "unique_quiet"` is + like specifying `repair = "unique", quiet = TRUE`. When the `"*_quiet"` + options are used, any setting of `quiet` is silently overridden (@jennybc, + #1629). + + `"unique_quiet"` and `"universal_quiet"` are also newly accepted for the name + repair argument of several other functions that do not expose a `quiet` + argument: `data_frame()`, `df_list()`, `vec_c()`, `list_unchop()`, + `vec_interleave()`, `vec_rbind()`, and `vec_cbind()` (@jennybc, #1716). + +* `list_unchop()` has gained `error_call` and `error_arg` arguments (#1641, + #1692). + +* `vec_c()` has gained `.error_call` and `.error_arg` arguments (#1641, #1692). + +* Improved the performance of list-of common type methods (#1686, #875). + +* The list-of method for `as_list_of()` now places the optional `.ptype` + argument after the `...` (#1686). + +* `vec_rbind()` now applies `base::c()` fallback recursively within + packed df-cols (#1331, #1462, #1640). + +* `vec_c()`, `vec_unchop()`, and `vec_rbind()` now proxy and restore + recursively (#1107). This prevents `vec_restore()` from being called + with partially filled vectors and improves performance (#1217, + #1496). + +* New `vec_any_missing()` for quickly determining if a vector has any missing + values (#1672). + +* `vec_equal_na()` has been renamed to `vec_detect_missing()` to align better + with vctrs naming conventions. `vec_equal_na()` will stick around for a few + minor versions, but has been formally soft-deprecated (#1672). + +* `vec_c(outer = c(inner = 1))` now produces correct error messages (#522). + +* If a data frame is returned as the proxy from `vec_proxy_equal()`, + `vec_proxy_compare()`, or `vec_proxy_order()`, then the corresponding proxy + function is now automatically applied recursively along all of the columns. + Additionally, packed data frame columns will be unpacked, and 1 column data + frames will be unwrapped. This ensures that the simplest possible types are + provided to the native C algorithms, improving both correctness and + performance (#1664). + +* When used with record vectors, `vec_proxy_compare()` and `vec_proxy_order()` + now call the correct proxy function while recursing over the fields (#1664). + +* The experimental function `vec_list_cast()` has been removed from + the package (#1382). + +* Native classes like dates and datetimes now accept dimensions (#1290, #1329). + +* `vec_compare()` now throws a more informative error when attempting to compare + complex vectors (#1655). + +* `vec_rep()` and friends gain `error_call`, `x_arg`, and `times_arg` + arguments so they can be embedded in frontends (#1303). + +* Record vectors now fail as expected when indexed along dimensions + greater than 1 (#1295). + +* `vec_order()` and `vec_sort()` now have `...` between the required and + optional arguments to make them easier to extend (#1647). + +* S3 vignette was extended to show how to make the polynomial class + atomic instead of a list (#1030). + +* The experimental `n` argument of `vec_restore()` has been + removed. It was only used to inform on the size of data frames in + case a bare list is restored. It is now expected that bare lists be + initialised to data frame so that the size is carried through row + attributes. This makes the generic simpler and fixes some + performance issues (#650). + +* The `anyNA()` method for `vctrs_vctr` (and thus `vctrs_list_of`) now + supports the `recursive` argument (#1278). + +* `vec_as_location()` and `num_as_location()` have gained a `missing = "remove"` + option (#1595). + +* `vec_as_location()` no longer matches `NA_character_` and `""` indices if + those invalid names appear in `names` (#1489). + +* `vec_unchop()` has been renamed to `list_unchop()` to better indicate that it + requires list input. `vec_unchop()` will stick around for a few minor + versions, but has been formally soft-deprecated (#1209). + +* Lossy cast errors during scalar subscript validation now have the + correct message (#1606). + +* Fixed confusing error message with logical `[[` subscripts (#1608). + +* New `vec_rank()` to compute various types of sample ranks (#1600). + +* `num_as_location()` now throws the right error when there are out-of-bounds + negative values and `oob = "extend"` and `negative = "ignore"` are set + (#1614, #1630). + +* `num_as_location()` now works correctly when a combination of `zero = "error"` + and `negative = "invert"` are used (#1612). + +* `data_frame()` and `df_list()` have gained `.error_call` arguments (#1610). + +* `vec_locate_matches()` has gained an `error_call` argument (#1611). + +* `"select"` and `"relocate"` have been added as valid subscript actions to + support tidyselect and dplyr (#1596). + +* `num_as_location()` has a new `oob = "remove"` argument to remove + out-of-bounds locations (#1595). + +* `vec_rbind()` and `vec_cbind()` now have `.error_call` arguments (#1597). + +* `df_list()` has gained a new `.unpack` argument to optionally disable data + frame unpacking (#1616). + +* `vec_check_list(arg = "")` now throws the correct error (#1604). + +* The `difftime` to `difftime` `vec_cast()` method now standardizes the internal + storage type to double, catching potentially corrupt integer storage + `difftime` vectors (#1602). + +* `vec_as_location2()` and `vec_as_subscript2()` more correctly utilize their + `call` arguments (#1605). + +* `vec_count(sort = "count")` now uses a stable sorting method. This ensures + that different keys with the same count are sorted in the order that they + originally appeared in (#1588). + +* Lossy cast error conditions now show the correct message when + `conditionMessage()` is called on them (#1592). + +* Fixed inconsistent reporting of conflicting inputs in + `vec_ptype_common()` (#1570). + +* `vec_ptype_abbr()` and `vec_ptype_full()` now suffix 1d arrays + with `[1d]`. + +* `vec_ptype_abbr()` and `vec_ptype_full()` methods are no longer + inherited (#1549). + +* `vec_cast()` now throws the correct error when attempting to cast a subclassed + data frame to a non-data frame type (#1568). + +* `vec_locate_matches()` now uses a more conservative heuristic when taking the + joint ordering proxy. This allows it to work correctly with sf's sfc vectors + and the classes from the bignum package (#1558). + +* An sfc method for `vec_proxy_order()` was added to better support the sf + package. These vectors are generally treated like list-columns even though + they don't explicitly have a `"list"` class, and the `vec_proxy_order()` + method now forwards to the list method to reflect that (#1558). + +* `vec_proxy_compare()` now works correctly for raw vectors wrapped in `I()`. + `vec_proxy_order()` now works correctly for raw and list vectors wrapped in + `I()` (#1557). + + +# vctrs 0.4.2 + +* HTML documentation fixes for CRAN checks. + + +# vctrs 0.4.1 + +* OOB errors with `character()` indexes use "that don't exist" instead + of "past the end" (#1543). + +* Fixed memory protection issues related to common type + determination (#1551, tidyverse/tidyr#1348). + +# vctrs 0.4.0 + +* New experimental `vec_locate_sorted_groups()` for returning the locations of + groups in sorted order. This is equivalent to, but faster than, calling + `vec_group_loc()` and then sorting by the `key` column of the result. + +* New experimental `vec_locate_matches()` for locating where each observation + in one vector matches one or more observations in another vector. It is + similar to `vec_match()`, but returns all matches by default (rather than just + the first), and can match on binary conditions other than equality. The + algorithm is inspired by data.table's very fast binary merge procedure. + +* The `vec_proxy_equal()`, `vec_proxy_compare()`, and `vec_proxy_order()` + methods for `vctrs_rcrd` are now applied recursively over the fields (#1503). + +* Lossy cast errors now inherit from incompatible type errors. + +* `vec_is_list()` now returns `TRUE` for `AsIs` lists (#1463). + +* `vec_assert()`, `vec_ptype2()`, `vec_cast()`, and `vec_as_location()` + now use `caller_arg()` to infer a default `arg` value from the + caller. + + This may result in unhelpful arguments being mentioned in error + messages. In general, you should consider snapshotting vctrs error + messages thrown in your package and supply `arg` and `call` + arguments if the error context is not adequately reported to your + users. + +* `vec_ptype_common()`, `vec_cast_common()`, `vec_size_common()`, and + `vec_recycle_common()` gain `call` and `arg` arguments for + specifying an error context. + +* `vec_compare()` can now compare zero column data frames (#1500). + +* `new_data_frame()` now errors on negative and missing `n` values (#1477). + +* `vec_order()` now correctly orders zero column data frames (#1499). + +* vctrs now depends on cli to help with error message generation. + +* New `vec_check_list()` and `list_check_all_vectors()` input + checkers, and an accompanying `list_all_vectors()` predicate. + +* New `vec_interleave()` for combining multiple vectors together, interleaving + their elements in the process (#1396). + +* `vec_equal_na(NULL)` now returns `logical(0)` rather than erroring (#1494). + +* `vec_as_location(missing = "error")` now fails with `NA` and `NA_character_` + in addition to `NA_integer_` (#1420, @krlmlr). + +* Starting with rlang 1.0.0, errors are displayed with the contextual + function call. Several vctrs operations gain a `call` argument that + makes it possible to report the correct context in error messages. + This concerns: + + - `vec_cast()` and `vec_ptype2()` + - `vec_default_cast()` and `vec_default_ptype2()` + - `vec_assert()` + - `vec_as_names()` + - `stop_` constructors like `stop_incompatible_type()` + + Note that default `vec_cast()` and `vec_ptype2()` methods + automatically support this if they pass `...` to the corresponding + `vec_default_` functions. If you throw a non-internal error from a + non-default method, add a `call = caller_env()` argument in the + method and pass it to `rlang::abort()`. + +* If `NA_character_` is specified as a name for `vctrs_vctr` objects, it is + now automatically repaired to `""` (#780). + +* `""` is now an allowed name for `vctrs_vctr` objects and all its + subclasses (`vctrs_list_of` in particular) (#780). + +* `list_of()` is now much faster when many values are provided. + +* `vec_as_location()` evaluates `arg` only in case of error, for performance + (#1150, @krlmlr). + +* `levels.vctrs_vctr()` now returns `NULL` instead of failing (#1186, @krlmlr). + +* `vec_assert()` produces a more informative error when `size` is invalid + (#1470). + +* `vec_duplicate_detect()` is a bit faster when there are many unique values. + +* `vec_proxy_order()` is described in `vignette("s3-vectors")` (#1373, @krlmlr). + +* `vec_chop()` now materializes ALTREP vectors before chopping, which is more + efficient than creating many small ALTREP pieces (#1450). + +* New `list_drop_empty()` for removing empty elements from a list (#1395). + +* `list_sizes()` now propagates the names of the list onto the result. + +* Name repair messages are now signaled by `rlang::names_inform_repair()`. This + means that the messages are now sent to stdout by default rather than to + stderr, resulting in prettier messages. Additionally, name repair messages can + now be silenced through the global option `rlib_name_repair_verbosity`, which + is useful for testing purposes. See `?names_inform_repair` for more + information (#1429). + +* `vctrs_vctr` methods for `na.omit()`, `na.exclude()`, and `na.fail()` have + been added (#1413). + +* `vec_init()` is now slightly faster (#1423). + +* `vec_set_names()` no longer corrupts `vctrs_rcrd` types (#1419). + +* `vec_detect_complete()` now computes completeness for `vctrs_rcrd` types in + the same way as data frames, which means that if any field is missing, the + entire record is considered incomplete (#1386). + +* The `na_value` argument of `vec_order()` and `vec_sort()` now correctly + respect missing values in lists (#1401). + +* `vec_rep()` and `vec_rep_each()` are much faster for `times = 0` and + `times = 1` (@mgirlich, #1392). + +* `vec_equal_na()` and `vec_fill_missing()` now work with integer64 vectors + (#1304). + +* The `xtfrm()` method for vctrs_vctr objects no longer accidentally breaks + ties (#1354). + +* `min()`, `max()` and `range()` no longer throw an error if `na.rm = TRUE` is + set and all values are `NA` (@gorcha, #1357). In this case, and where an empty + input is given, it will return `Inf`/`-Inf`, or `NA` if `Inf` can't be cast + to the input type. + +* `vec_group_loc()`, used for grouping in dplyr, now correctly handles + vectors with billions of elements (up to `.Machine$integer.max`) (#1133). + + +# vctrs 0.3.8 + +* Compatibility with next version of rlang. + + +# vctrs 0.3.7 + +* `vec_ptype_abbr()` gains arguments to control whether to indicate + named vectors with a prefix (`prefix_named`) and indicate shaped + vectors with a suffix (`suffix_shape`) (#781, @krlmlr). + +* `vec_ptype()` is now an optional _performance_ generic. It is not necessary + to implement, but if your class has a static prototype, you might consider + implementing a custom `vec_ptype()` method that returns a constant to + improve performance in some cases (such as common type imputation). + +* New `vec_detect_complete()`, inspired by `stats::complete.cases()`. For most + vectors, this is identical to `!vec_equal_na()`. For data frames and + matrices, this detects rows that only contain non-missing values. + +* `vec_order()` can now order complex vectors (#1330). + +* Removed dependency on digest in favor of `rlang::hash()`. + +* Fixed an issue where `vctrs_rcrd` objects were not being proxied correctly + when used as a data frame column (#1318). + +* `register_s3()` is now licensed with the "unlicense" which makes it very + clear that it's fine to copy and paste into your own package + (@maxheld83, #1254). + +# vctrs 0.3.6 + +* Fixed an issue with tibble 3.0.0 where removing column names with + `names(x) <- NULL` is now deprecated (#1298). + +* Fixed a GCC 11 issue revealed by CRAN checks. + + +# vctrs 0.3.5 + +* New experimental `vec_fill_missing()` for filling in missing values with + the previous or following value. It is similar to `tidyr::fill()`, but + also works with data frames and has an additional `max_fill` argument to + limit the number of sequential missing values to fill. + +* New `vec_unrep()` to compress a vector with repeated values. It is very + similar to run length encoding, and works nicely alongside `vec_rep_each()` + as a way to invert the compression. + +* `vec_cbind()` with only empty data frames now preserves the common size of + the inputs in the result (#1281). + +* `vec_c()` now correctly returns a named result with named empty inputs + (#1263). + +* vctrs has been relicensed as MIT (#1259). + +* Functions that make comparisons within a single vector, such as + `vec_unique()`, or between two vectors, such as `vec_match()`, now + convert all character input to UTF-8 before making comparisons (#1246). + +* New `vec_identify_runs()` which returns a vector of identifiers for the + elements of `x` that indicate which run of repeated values they fall in + (#1081). + +* Fixed an encoding translation bug with lists containing data frames which + have columns where `vec_size()` is different from the low level + `Rf_length()` (#1233). + + +# vctrs 0.3.4 + +* Fixed a GCC sanitiser error revealed by CRAN checks. + + +# vctrs 0.3.3 + +* The `table` class is now implemented as a wrapper type that + delegates its coercion methods. It used to be restricted to integer + tables (#1190). + +* Named one-dimensional arrays now behave consistently with simple + vectors in `vec_names()` and `vec_rbind()`. + +* `new_rcrd()` now uses `df_list()` to validate the fields. This makes + it more flexible as the fields can now be of any type supported by + vctrs, including data frames. + +* Thanks to the previous change the `[[` method of records now + preserves list fields (#1205). + +* `vec_data()` now preserves data frames. This is consistent with the + notion that data frames are a primitive vector type in vctrs. This + shouldn't affect code that uses `[[` and `length()` to manipulate + the data. On the other hand, the vctrs primitives like `vec_slice()` + will now operate rowwise when `vec_data()` returns a data frame. + +* `outer` is now passed unrecycled to name specifications. Instead, + the return value is recycled (#1099). + +* Name specifications can now return `NULL`. The names vector will + only be allocated if the spec function returns non-`NULL` during the + concatenation. This makes it possible to ignore outer names without + having to create an empty names vector when there are no inner + names: + + ``` + zap_outer_spec <- function(outer, inner) if (is_character(inner)) inner + + # `NULL` names rather than a vector of "" + names(vec_c(a = 1:2, .name_spec = zap_outer_spec)) + #> NULL + + # Names are allocated when inner names exist + names(vec_c(a = 1:2, c(b = 3L), .name_spec = zap_outer_spec)) + #> [1] "" "" "b" + ``` + +* Fixed several performance issues in `vec_c()` and `vec_unchop()` + with named vectors. + +* The restriction that S3 lists must have a list-based proxy to be considered + lists by `vec_is_list()` has been removed (#1208). + +* New performant `data_frame()` constructor for creating data frames in a way + that follows tidyverse semantics. Among other things, inputs are recycled + using tidyverse recycling rules, strings are never converted to factors, + list-columns are easier to create, and unnamed data frame input is + automatically spliced. + +* New `df_list()` for safely and consistently constructing the data structure + underlying a data frame, a named list of equal-length vectors. It is useful + in combination with `new_data_frame()` for creating user-friendly + constructors for data frame subclasses that use the tidyverse rules for + recycling and determining types. + +* Fixed performance issue with `vec_order()` on classed vectors which + affected `dplyr::group_by()` (tidyverse/dplyr#5423). + +* `vec_set_names()` no longer alters the input in-place (#1194). + +* New `vec_proxy_order()` that provides an ordering proxy for use in + `vec_order()` and `vec_sort()`. The default method falls through to + `vec_proxy_compare()`. Lists are special cased, and return an integer + vector proxy that orders by first appearance. + +* List columns in data frames are no longer comparable through `vec_compare()`. + +* The experimental `relax` argument has been removed from + `vec_proxy_compare()`. + + +# vctrs 0.3.2 + +* Fixed a performance issue in `bind_rows()` with S3 columns (#1122, + #1124, #1151, tidyverse/dplyr#5327). + +* `vec_slice()` now checks sizes of data frame columns in case the + data structure is corrupt (#552). + +* The native routines in vctrs now dispatch and evaluate in the vctrs + namespace. This improves the continuity of evaluation in backtraces. + +* `new_data_frame()` is now twice as fast when `class` is supplied. + +* New `vec_names2()`, `vec_names()` and `vec_set_names()` (#1173). + + +# vctrs 0.3.1 + +* `vec_slice()` no longer restores attributes of foreign objects for + which a `[` method exist. This fixes an issue with `ts` objects + which were previously incorrectly restored. + +* The `as.list()` method for `vctrs_rcrd` objects has been removed in favor + of directly using the method for `vctrs_vctr`, which calls `vec_chop()`. + +* `vec_c()` and `vec_rbind()` now fall back to `base::c()` if the + inputs have a common class hierarchy for which a `c()` method is + implemented but no self-to-self `vec_ptype2()` method is + implemented. + +* `vec_rbind()` now internally calls `vec_proxy()` and `vec_restore()` on + the data frame common type that is used to create the output (#1109). + +* `vec_as_location2("0")` now works correctly (#1131). + +* `?reference-faq-compatibility` is a new reference guide on vctrs + primitives. It includes an overview of the fallbacks to base R + generics implemented in vctrs for compatibility with existing + classes. + +* The documentation of vctrs functions now includes a Dependencies + section to reference which other vctrs operations are called from + that function. By following the dependencies links recursively, you + will find the vctrs primitives on which an operation relies. + + +## CRAN results + +* Fixed type declaration mismatches revealed by LTO build. +* Fixed r-devel issue with new `c.factor()` method. + + +# vctrs 0.3.0 + +This version features an overhaul of the coercion system to make it +more consistent and easier to implement. See the _Breaking changes_ +and _Type system_ sections for details. + +There are three new documentation topics if you'd like to learn how to +implement coercion methods to make your class compatible with +tidyverse packages like dplyr: + +* https://vctrs.r-lib.org/reference/theory-faq-coercion.html for an + overview of the coercion mechanism in vctrs. + +* https://vctrs.r-lib.org/reference/howto-faq-coercion.html for a + practical guide about implementing methods for vectors. + +* https://vctrs.r-lib.org/reference/howto-faq-coercion-data-frame.html + for a practical guide about implementing methods for data frames. + + +## Reverse dependencies troubleshooting + +The following errors are caused by breaking changes. + +* `"Can't convert to ."` + + `vec_cast()` no longer converts to list. Use `vec_chop()` or + `as.list()` instead. + +* `"Can't convert to ."` + + `vec_cast()` no longer converts to character. Use `as.character()`to + deparse objects. + +* `"names for target but not for current"` + + Names of list-columns are now preserved by `vec_rbind()`. Adjust + tests accordingly. + + +## Breaking changes + +* Double-dispatch methods for `vec_ptype2()` and `vec_cast()` are no + longer inherited (#710). Class implementers must implement one set + of methods for each compatible class. + + For example, a tibble subclass no longer inherits from the + `vec_ptype2()` methods between `tbl_df` and `data.frame`. This means + that you explicitly need to implement `vec_ptype2()` methods with + `tbl_df` and `data.frame`. + + This change requires a bit more work from class maintainers but is + safer because the coercion hierarchies are generally different from + class hierarchies. See the S3 dispatch section of `?vec_ptype2` for + more information. + +* `vec_cast()` is now restricted to the same conversions as + `vec_ptype2()` methods (#606, #741). This change is motivated by + safety and performance: + + - It is generally sloppy to generically convert arbitrary inputs to + one type. Restricted coercions are more predictable and allow your + code to fail earlier when there is a type issue. + + - When unrestricted conversions are useful, this is generally + towards a known type. For example, `glue::glue()` needs to convert + arbitrary inputs to the known character type. In this case, using + double dispatch instead of a single dispatch generic like + `as.character()` is wasteful. + + - To implement the useful semantics of coercible casts (already used + in `vec_assign()`), two double dispatch were needed. Now it can be + done with one double dispatch by calling `vec_cast()` directly. + +* `stop_incompatible_cast()` now throws an error of class + `vctrs_error_incompatible_type` rather than `vctrs_error_incompatible_cast`. + This means that `vec_cast()` also throws errors of this class, which better + aligns it with `vec_ptype2()` now that they are restricted to the same + conversions. + +* The `y` argument of `stop_incompatible_cast()` has been renamed to `to` to + better match `to_arg`. + + +## Type system + +* Double-dispatch methods for `vec_ptype2()` and `vec_cast()` are now + easier to implement. They no longer need any the boiler plate. + Implementing a method for classes `foo` and `bar` is now as simple as: + + ``` + #' @export + vec_ptype2.foo.bar <- function(x, y, ...) new_foo() + ``` + + vctrs also takes care of implementing the default and unspecified + methods. If you have implemented these methods, they are no longer + called and can now be removed. + + One consequence of the new dispatch mechanism is that `NextMethod()` + is now completely unsupported. This is for the best as it never + worked correctly in a double-dispatch setting. Parent methods must + now be called manually. + +* `vec_ptype2()` methods now get zero-size prototypes as inputs. This + guarantees that methods do not peek at the data to determine the + richer type. + +* `vec_is_list()` no longer allows S3 lists that implement a `vec_proxy()` + method to automatically be considered lists. A S3 list must explicitly + inherit from `"list"` in the base class to be considered a list. + +* `vec_restore()` no longer restores row names if the target is not a + data frame. This fixes an issue where `POSIXlt` objects would carry + a `row.names` attribute after a proxy/restore roundtrip. + +* `vec_cast()` to and from data frames preserves the row names of + inputs. + +* The internal function `vec_names()` now returns row names if the + input is a data frame. Similarly, `vec_set_names()` sets row names + on data frames. This is part of a general effort at making row names + the vector names of data frames in vctrs. + + If necessary, the row names are repaired verbosely but without error + to make them unique. This should be a mostly harmless change for + users, but it could break unit tests in packages if they make + assumptions about the row names. + + +## Compatibility and fallbacks + +* With the double dispatch changes, the coercion methods are no longer + inherited from parent classes. This is because the coercion + hierarchy is in principle different from the S3 hierarchy. A + consequence of this change is that subclasses that don't implement + coercion methods are now in principle incompatible. + + This is particularly problematic with subclasses of data frames for + which throwing incompatible errors would be too incovenient for + users. To work around this, we have implemented a fallback to the + relevant base data frame class (either `data.frame` or `tbl_df`) in + coercion methods (#981). This fallback is silent unless you set the + `vctrs:::warn_on_fallback` option to `TRUE`. + + In the future we may extend this fallback principle to other base + types when they are explicitly included in the class vector (such as + `"list"`). + +* Improved support for foreign classes in the combining operations + `vec_c()`, `vec_rbind()`, and `vec_unchop()`. A foreign class is a + class that doesn't implement `vec_ptype2()`. When all the objects to + combine have the same foreign class, one of these fallbacks is invoked: + + - If the class implements a `base::c()` method, the method is used + for the combination. (FIXME: `vec_rbind()` currently doesn't use + this fallback.) + + - Otherwise if the objects have identical attributes and the same + base type, we consider them to be compatible. The vectors are + concatenated and the attributes are restored (#776). + + These fallbacks do not make your class completely compatible with + vctrs-powered packages, but they should help in many simple cases. + +* `vec_c()` and `vec_unchop()` now fall back to `base::c()` for S4 objects if + the object doesn't implement `vec_ptype2()` but sets an S4 `c()` + method (#919). + + +## Vector operations + +* `vec_rbind()` and `vec_c()` with data frame inputs now consistently + preserve the names of list-columns, df-columns, and matrix-columns + (#689). This can cause some false positives in unit tests, if they + are sensitive to internal names (#1007). + +* `vec_rbind()` now repairs row names silently to avoid confusing + messages when the row names are not informative and were not created + on purpose. + +* `vec_rbind()` gains option to treat input names as row names. This + is disabled by default (#966). + +* New `vec_rep()` and `vec_rep_each()` for repeating an entire vector + and elements of a vector, respectively. These two functions provide + a clearer interface for the functionality of `vec_repeat()`, which + is now deprecated. + +* `vec_cbind()` now calls `vec_restore()` on inputs emptied of their + columns before computing the common type. This has + consequences for data frame classes with special columns that + devolve into simpler classes when the columns are subsetted + out. These classes are now always simplified by `vec_cbind()`. + + For instance, column-binding a grouped data frame with a data frame + now produces a tibble (the simplified class of a grouped data + frame). + +* `vec_match()` and `vec_in()` gain parameters for argument tags (#944). + +* The internal version of `vec_assign()` now has support for assigning + names and inner names. For data frames, the names are assigned + recursively. + +* `vec_assign()` gains `x_arg` and `value_arg` parameters (#918). + +* `vec_group_loc()`, which powers `dplyr::group_by()`, now has more + efficient vector access (#911). + +* `vec_ptype()` gained an `x_arg` argument. + +* New `list_sizes()` for computing the size of every element in a list. + `list_sizes()` is to `vec_size()` as `lengths()` is to `length()`, except + that it only supports lists. Atomic vectors and data frames result in an + error. + +* `new_data_frame()` infers size from row names when `n = NULL` (#894). + +* `vec_c()` now accepts `rlang::zap()` as `.name_spec` input. The + returned vector is then always unnamed, and the names do not cause + errors when they can't be combined. They are still used to create + more informative messages when the inputs have incompatible types (#232). + + +## Classes + +* vctrs now supports the `data.table` class. The common type of a data + frame and a data table is a data table. + +* `new_vctr()` now always appends a base `"list"` class to list `.data` to + be compatible with changes to `vec_is_list()`. This affects `new_list_of()`, + which now returns an object with a base class of `"list"`. + +* dplyr methods are now implemented for `vec_restore()`, + `vec_ptype2()`, and `vec_cast()`. The user-visible consequence (and + breaking change) is that row-binding a grouped data frame and a data + frame or tibble now returns a grouped data frame. It would + previously return a tibble. + +* The `is.na<-()` method for `vctrs_vctr` now supports numeric and + character subscripts to indicate where to insert missing values (#947). + +* Improved support for vector-like S4 objects (#550, #551). + +* The base classes `AsIs` and `table` have vctrs methods (#904, #906). + +* `POSIXlt` and `POSIXct` vectors are handled more consistently (#901). + +* Ordered factors that do not have identical levels are now incompatible. + They are now incompatible with all factors. + + +## Indexing and names + +* `vec_as_subscript()` now fails when the subscript is a matrix or an + array, consistently with `vec_as_location()`. + +* Improved error messages in `vec_as_location()` when subscript is a + matrix or array (#936). + +* `vec_as_location2()` properly picks up `subscript_arg` + (tidyverse/tibble#735). + +* `vec_as_names()` now has more informative error messages when names + are not unique (#882). + +* `vec_as_names()` gains a `repair_arg` argument that when set will cause + `repair = "check_unique"` to generate an informative hint (#692). + + +## Conditions + +* `stop_incompatible_type()` now has an `action` argument for customizing + whether the coercion error came from `vec_ptype2()` or `vec_cast()`. + `stop_incompatible_cast()` is now a thin wrapper around + `stop_incompatible_type(action = "convert")`. + +* `stop_` functions now take `details` after the dots. This argument + can no longer be passed by position. + +* Supplying both `details` and `message` to the `stop_` functions is + now an internal error. + +* `x_arg`, `y_arg`, and `to_arg` are now compulsory arguments in + `stop_` functions like `stop_incompatible_type()`. + +* Lossy cast errors are now considered internal. Please don't test for + the class or explicitly handle them. + +* New argument `loss_type` for the experimental function + `maybe_lossy_cast()`. It can take the values "precision" or + "generality" to indicate in the error message which kind of loss is + the error about (double to integer loses precision, character to + factor loses generality). + +* Coercion and recycling errors are now more consistent. + + +## CRAN results + +* Fixed clang-UBSAN error "nan is outside the range of representable + values of type 'int'" (#902). + +* Fixed compilation of stability vignette following the date + conversion changes on R-devel. + + +# vctrs 0.2.4 + +* Factors and dates methods are now implemented in C for efficiency. + +* `new_data_frame()` now correctly updates attributes and supports merging + of the `"names"` and `"row.names"` arguments (#883). + +* `vec_match()` gains an `na_equal` argument (#718). + +* `vec_chop()`'s `indices` argument has been restricted to positive integer + vectors. Character and logical subscripts haven't proven useful, and this + aligns `vec_chop()` with `vec_unchop()`, for which only positive integer + vectors make sense. + +* New `vec_unchop()` for combining a list of vectors into a single vector. It + is similar to `vec_c()`, but gives greater control over how the elements + are placed in the output through the use of a secondary `indices` argument. + +* Breaking change: When `.id` is supplied, `vec_rbind()` now creates + the identifier column at the start of the data frame rather than at + the end. + +* `numeric_version` and `package_version` lists are now treated as + vectors (#723). + +* `vec_slice()` now properly handles symbols and S3 subscripts. + +* `vec_as_location()` and `vec_as_subscript()` are now fully + implemented in C for efficiency. + +* `num_as_location()` gains a new argument, `zero`, for controlling whether + to `"remove"`, `"ignore"`, or `"error"` on zero values (#852). + + +# vctrs 0.2.3 + +* The main feature of this release is considerable performance + improvements with factors and dates. + +* `vec_c()` now falls back to `base::c()` if the vector doesn't + implement `vec_ptype2()` but implements `c()`. This should improve + the compatibility of vctrs-based functions with foreign classes + (#801). + +* `new_data_frame()` is now faster. + +* New `vec_is_list()` for detecting if a vector is a list in the vctrs sense. + For instance, objects of class `lm` are not lists. In general, classes need + to explicitly inherit from `"list"` to be considered as lists by vctrs. + +* Unspecified vectors of `NA` can now be assigned into a list (#819). + + ``` + x <- list(1, 2) + vec_slice(x, 1) <- NA + x + #> [[1]] + #> NULL + #> + #> [[2]] + #> 2 + ``` + +* `vec_ptype()` now errors on scalar inputs (#807). + +* `vec_ptype_finalise()` is now recursive over all data frame types, ensuring + that unspecified columns are correctly finalised to logical (#800). + +* `vec_ptype()` now correctly handles unspecified columns in data frames, and + will always return an unspecified column type (#800). + +* `vec_slice()` and `vec_chop()` now work correctly with `bit64::integer64()` + objects when an `NA` subscript is supplied. By extension, this means that + `vec_init()` now works with these objects as well (#813). + +* `vec_rbind()` now binds row names. When named inputs are supplied + and `names_to` is `NULL`, the names define row names. If `names_to` + is supplied, they are assigned in the column name as before. + +* `vec_cbind()` now uses the row names of the first named input. + +* The `c()` method for `vctrs_vctr` now throws an error when + `recursive` or `use.names` is supplied (#791). + + +# vctrs 0.2.2 + +* New `vec_as_subscript()` function to cast inputs to the base type + of a subscript (logical, numeric, or character). `vec_as_index()` + has been renamed to `vec_as_location()`. Use `num_as_location()` if + you need more options to control how numeric subscripts are + converted to a vector of locations. + +* New `vec_as_subscript2()`, `vec_as_location2()`, and + `num_as_location2()` variants for validating scalar subscripts and + locations (e.g. for indexing with `[[`). + +* `vec_as_location()` now preserves names of its inputs if possible. + +* `vec_ptype2()` methods for base classes now prevent + inheritance. This makes sense because the subtyping graph created by + `vec_ptype2()` methods is generally not the same as the inheritance + relationships defined by S3 classes. For instance, subclasses are + often a richer type than their superclasses, and should often be + declared as supertypes (e.g. `vec_ptype2()` should return the + subclass). + + We introduced this breaking change in a patch release because + `new_vctr()` now adds the base type to the class vector by default, + which caused `vec_ptype2()` to dispatch erroneously to the methods + for base types. We'll finish switching to this approach in vctrs + 0.3.0 for the rest of the base S3 classes (dates, data frames, ...). + +* `vec_equal_na()` now works with complex vectors. + +* `vctrs_vctr` class gains an `as.POSIXlt()` method (#717). + +* `vec_is()` now ignores names and row names (#707). + +* `vec_slice()` now support Altvec vectors (@jimhester, #696). + +* `vec_proxy_equal()` is now applied recursively across the columns of + data frames (#641). + +* `vec_split()` no longer returns the `val` column as a `list_of`. It is now + returned as a bare list (#660). + +* Complex numbers are now coercible with integer and double (#564). + +* zeallot has been moved from Imports to Suggests, meaning that `%<-%` is no + longer re-exported from vctrs. + +* `vec_equal()` no longer propagates missing values when comparing list + elements. This means that `vec_equal(list(NULL), list(NULL))` will continue to + return `NA` because `NULL` is the missing element for a list, but now + `vec_equal(list(NA), list(NA))` returns `TRUE` because the `NA` values are + compared directly without checking for missingness. + +* Lists of expressions are now supported in `vec_equal()` and functions that + compare elements, such as `vec_unique()` and `vec_match()`. This ensures that + they work with the result of modeling functions like `glm()` and `mgcv::gam()` + which store "family" objects containing expressions (#643). + +* `new_vctr()` gains an experimental `inherit_base_type` argument + which determines whether or not the class of the underlying type + will be included in the class. + +* `list_of()` now inherits explicitly from "list" (#593). + +* `vec_ptype()` has relaxed default behaviour for base types; now if two + vectors both inherit from (e.g.) "character", the common type is also + "character" (#497). + +* `vec_equal()` now correctly treats `NULL` as the missing value element for + lists (#653). + +* `vec_cast()` now casts data frames to lists rowwise, i.e. to a list of + data frames of size 1. This preserves the invariant of + `vec_size(vec_cast(x, to)) == vec_size(x)` (#639). + +* Positive and negative 0 are now considered equivalent by all functions that + check for equality or uniqueness (#637). + +* New experimental functions `vec_group_rle()` for returning run + length encoded groups; `vec_group_id()` for constructing group + identifiers from a vector; `vec_group_loc()` for computing the + locations of unique groups in a vector (#514). + +* New `vec_chop()` for repeatedly slicing a vector. It efficiently captures + the pattern of `map(indices, vec_slice, x = x)`. + +* Support for multiple character encodings has been added to functions that + compare elements within a single vector, such as `vec_unique()`, and across + multiple vectors, such as `vec_match()`. When multiple encodings are + encountered, a translation to UTF-8 is performed before any comparisons are + made (#600, #553). + +* Equality and ordering methods are now implemented for raw and + complex vectors (@romainfrancois). + + +# vctrs 0.2.1 + +Maintenance release for CRAN checks. + + +# vctrs 0.2.0 + +With the 0.2.0 release, many vctrs functions have been rewritten with +native C code to improve performance. Functions like `vec_c()` and +`vec_rbind()` should now be fast enough to be used in packages. This +is an ongoing effort, for instance the handling of factors and dates +has not been rewritten yet. These classes still slow down vctrs +primitives. + +The API in 0.2.0 has been updated, please see a list of breaking +changes below. vctrs has now graduated from experimental to a maturing +package. +Please note that API changes are still planned for future releases, +for instance `vec_ptype2()` and `vec_cast()` might need to return a +sentinel instead of failing with an error when there is no common type +or possible cast. + + +## Breaking changes + +* Lossy casts now throw errors of type `vctrs_error_cast_lossy`. + Previously these were warnings. You can suppress these errors + selectively with `allow_lossy_cast()` to get the partial cast + results. To implement your own lossy cast operation, call the new + exported function `maybe_lossy_cast()`. + +* `vec_c()` now fails when an input is supplied with a name but has + internal names or is length > 1: + + ``` + vec_c(foo = c(a = 1)) + #> Error: Can't merge the outer name `foo` with a named vector. + #> Please supply a `.name_spec` specification. + + vec_c(foo = 1:3) + #> Error: Can't merge the outer name `foo` with a vector of length > 1. + #> Please supply a `.name_spec` specification. + ``` + + You can supply a name specification that describes how to combine + the external name of the input with its internal names or positions: + + ``` + # Name spec as glue string: + vec_c(foo = c(a = 1), .name_spec = "{outer}_{inner}") + + # Name spec as a function: + vec_c(foo = c(a = 1), .name_spec = function(outer, inner) paste(outer, inner, sep = "_")) + vec_c(foo = c(a = 1), .name_spec = ~ paste(.x, .y, sep = "_")) + ``` + +* `vec_empty()` has been renamed to `vec_is_empty()`. + +* `vec_dim()` and `vec_dims()` are no longer exported. + +* `vec_na()` has been renamed to `vec_init()`, as the primary use case + is to initialize an output container. + +* `vec_slice<-` is now type stable (#140). It always returns the same + type as the LHS. If needed, the RHS is cast to the correct type, but + only if both inputs are coercible. See examples in `?vec_slice`. + +* We have renamed the `type` particle to `ptype`: + + - `vec_type()` => `vec_ptype()` + - `vec_type2()` => `vec_ptype2()` + - `vec_type_common()` => `vec_ptype_common()` + + Consequently, `vec_ptype()` was renamed to `vec_ptype_show()`. + + +## New features + +* New `vec_proxy()` generic. This is the main customisation point in + vctrs along with `vec_restore()`. You should only implement it when + your type is designed around a non-vector class (atomic vectors, + bare lists, data frames). In this case, `vec_proxy()` should return + such a vector class. The vctrs operations will be applied on the + proxy and `vec_restore()` is called to restore the original + representation of your type. + + The most common case where you need to implement `vec_proxy()` is + for S3 lists. In vctrs, S3 lists are treated as scalars by + default. This way we don't treat objects like model fits as + vectors. To prevent vctrs from treating your S3 list as a scalar, + unclass it from the `vec_proxy()` method. For instance here is the + definition for `list_of`: + + ``` + #' @export + vec_proxy.vctrs_list_of <- function(x) { + unclass(x) + } + ``` + + If you inherit from `vctrs_vctr` or `vctrs_rcrd` you don't need to + implement `vec_proxy()`. + +* `vec_c()`, `vec_rbind()`, and `vec_cbind()` gain a `.name_repair` + argument (#227, #229). + +* `vec_c()`, `vec_rbind()`, `vec_cbind()`, and all functions relying + on `vec_ptype_common()` now have more informative error messages + when some of the inputs have nested data frames that are not + convergent: + + ``` + df1 <- tibble(foo = tibble(bar = tibble(x = 1:3, y = letters[1:3]))) + df2 <- tibble(foo = tibble(bar = tibble(x = 1:3, y = 4:6))) + + vec_rbind(df1, df2) + #> Error: No common type for `..1$foo$bar$y` and `..2$foo$bar$y` . + ``` + +* `vec_cbind()` now turns named data frames to packed columns. + + ```r + data <- tibble::tibble(x = 1:3, y = letters[1:3]) + data <- vec_cbind(data, packed = data) + data + # A tibble: 3 x 3 + x y packed$x $y + + 1 1 a 1 a + 2 2 b 2 b + 3 3 c 3 c + ``` + + Packed data frames are nested in a single column. This makes it + possible to access it through a single name: + + ```r + data$packed + # A tibble: 3 x 2 + x y + + 1 1 a + 2 2 b + 3 3 c + ``` + + We are planning to use this syntax more widely in the tidyverse. + +* New `vec_is()` function to check whether a vector conforms to a + prototype and/or a size. Unlike `vec_assert()`, it doesn't throw + errors but returns `TRUE` or `FALSE` (#79). + + Called without a specific type or size, `vec_assert()` tests whether + an object is a data vector or a scalar. S3 lists are treated as + scalars by default. Implement a `vec_is_vector()` for your class to + override this property (or derive from `vctrs_vctr`). + +* New `vec_order()` and `vec_sort()` for ordering and sorting + generalised vectors. + +* New `.names_to` parameter for `vec_rbind()`. If supplied, this + should be the name of a column where the names of the inputs are + copied. This is similar to the `.id` parameter of + `dplyr::bind_rows()`. + +* New `vec_seq_along()` and `vec_init_along()` create useful sequences (#189). + +* `vec_slice()` now preserves character row names, if present. + +* New `vec_split(x, by)` is a generalisation of `split()` that can divide + a vector into groups formed by the unique values of another vector. Returns + a two-column data frame containing unique values of `by` aligned with + matching `x` values (#196). + + +## Other features and bug fixes + +* Using classed errors of class `"vctrs_error_assert"` for failed + assertions, and of class `"vctrs_error_incompatible"` (with + subclasses `_type`, `_cast` and `_op`) for errors on incompatible + types (#184). + +* Character indexing is now only supported for named objects, an error + is raised for unnamed objects (#171). + +* Predicate generics now consistently return logical vectors when + passed a `vctrs_vctr` class. They used to restore the output to + their input type (#251). + +* `list_of()` now has an `as.character()` method. It uses + `vec_ptype_abbr()` to collapse complex objects into their type + representation (tidyverse/tidyr#654). + +* New `stop_incompatible_size()` to signal a failure due to mismatched sizes. + +* New `validate_list_of()` (#193). + +* `vec_arith()` is consistent with base R when combining `difftime` + and `date`, with a warning if casts are lossy (#192). + +* `vec_c()` and `vec_rbind()` now handle data.frame columns properly + (@yutannihilation, #182). + +* `vec_cast(x, data.frame())` preserves the number of rows in `x`. + +* `vec_equal()` now handles missing values symmetrically (#204). + +* `vec_equal_na()` now returns `TRUE` for data frames and records when + every component is missing, not when _any_ component is missing + (#201). + +* `vec_init()` checks input is a vector. + +* `vec_proxy_compare()` gains an experimental `relax` argument, which + allows data frames to be orderable even if all their columns are not + (#210). + +* `vec_size()` now works with positive short row names. This fixes + issues with data frames created with jsonlite (#220). + +* `vec_slice<-` now has a `vec_assign()` alias. Use `vec_assign()` + when you don't want to modify the original input. + +* `vec_slice()` now calls `vec_restore()` automatically. Unlike the + default `[` method from base R, attributes are preserved by default. + +* `vec_slice()` can correct slice 0-row data frames (#179). + +* New `vec_repeat()` for repeating each element of a vector the same number + of times. + +* `vec_type2(x, data.frame())` ensures that the returned object has + names that are a length-0 character vector. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/R/vctrs b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/R/vctrs new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/R/vctrs @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/R/vctrs.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/R/vctrs.rdb new file mode 100644 index 00000000..b4fb0907 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/R/vctrs.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/R/vctrs.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/R/vctrs.rdx new file mode 100644 index 00000000..f72e7af1 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/R/vctrs.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/WORDLIST b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/WORDLIST new file mode 100644 index 00000000..110b5f47 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/WORDLIST @@ -0,0 +1 @@ +vectorised diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/index.html new file mode 100644 index 00000000..1dfbf1f8 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/index.html @@ -0,0 +1,44 @@ + + +R: Vignettes and other documentation + + + +
+

Vignettes and other documentation + +

+
+
+[Top] +
+

Vignettes from package 'vctrs'

+ +++++++ + + + + + + + + + + + + + + + + + + + +
vctrs::pillarPrinting vectors nicely in tibblesHTMLsourceR code
vctrs::s3-vectorS3 vectorsHTMLsourceR code
vctrs::stabilityType and size stabilityHTMLsourceR code
vctrs::type-sizePrototypes and sizesHTMLsourceR code
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/pillar.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/pillar.R new file mode 100644 index 00000000..a614f478 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/pillar.R @@ -0,0 +1,155 @@ +## ----include = FALSE---------------------------------------------------------- +knitr::opts_chunk$set(collapse = TRUE, comment = "#>") + +## ----setup-------------------------------------------------------------------- +library(vctrs) +library(pillar) + +## ----eval = FALSE------------------------------------------------------------- +# usethis::use_package("vctrs") +# usethis::use_package("pillar") + +## ----------------------------------------------------------------------------- +#' @export +latlon <- function(lat, lon) { + new_rcrd(list(lat = lat, lon = lon), class = "earth_latlon") +} + +#' @export +format.earth_latlon <- function(x, ..., formatter = deg_min) { + x_valid <- which(!is.na(x)) + + lat <- field(x, "lat")[x_valid] + lon <- field(x, "lon")[x_valid] + + ret <- rep(NA_character_, vec_size(x)) + ret[x_valid] <- paste0(formatter(lat, "lat"), " ", formatter(lon, "lon")) + # It's important to keep NA in the vector! + ret +} + +deg_min <- function(x, direction) { + pm <- if (direction == "lat") c("N", "S") else c("E", "W") + + sign <- sign(x) + x <- abs(x) + deg <- trunc(x) + x <- x - deg + min <- round(x * 60) + + # Ensure the columns are always the same width so they line up nicely + ret <- sprintf("%d°%.2d'%s", deg, min, ifelse(sign >= 0, pm[[1]], pm[[2]])) + format(ret, justify = "right") +} + +latlon(c(32.71, 2.95), c(-117.17, 1.67)) + +## ----------------------------------------------------------------------------- +library(tibble) + +loc <- latlon( + c(28.3411783, 32.7102978, 30.2622356, 37.7859102, 28.5, NA), + c(-81.5480348, -117.1704058, -97.7403327, -122.4131357, -81.4, NA) +) + +data <- tibble(venue = "rstudio::conf", year = 2017:2022, loc = loc) + +data + +## ----------------------------------------------------------------------------- +#' @export +vec_ptype_abbr.earth_latlon <- function(x) { + "latlon" +} + +data + +## ----------------------------------------------------------------------------- +deg_min_color <- function(x, direction) { + pm <- if (direction == "lat") c("N", "S") else c("E", "W") + + sign <- sign(x) + x <- abs(x) + deg <- trunc(x) + x <- x - deg + rad <- round(x * 60) + ret <- sprintf( + "%d%s%.2d%s%s", + deg, + pillar::style_subtle("°"), + rad, + pillar::style_subtle("'"), + pm[ifelse(sign >= 0, 1, 2)] + ) + format(ret, justify = "right") +} + +## ----------------------------------------------------------------------------- +#' @importFrom pillar pillar_shaft +#' @export +pillar_shaft.earth_latlon <- function(x, ...) { + out <- format(x, formatter = deg_min_color) + pillar::new_pillar_shaft_simple(out, align = "right") +} + +## ----------------------------------------------------------------------------- +data + +## ----------------------------------------------------------------------------- +print(data, width = 30) + +## ----------------------------------------------------------------------------- +#' @importFrom pillar pillar_shaft +#' @export +pillar_shaft.earth_latlon <- function(x, ...) { + out <- format(x) + pillar::new_pillar_shaft_simple(out, align = "right", min_width = 10) +} + +print(data, width = 30) + +## ----------------------------------------------------------------------------- +deg <- function(x, direction) { + pm <- if (direction == "lat") c("N", "S") else c("E", "W") + + sign <- sign(x) + x <- abs(x) + deg <- round(x) + + ret <- sprintf("%d°%s", deg, pm[ifelse(sign >= 0, 1, 2)]) + format(ret, justify = "right") +} + +## ----------------------------------------------------------------------------- +#' @importFrom pillar pillar_shaft +#' @export +pillar_shaft.earth_latlon <- function(x, ...) { + deg <- format(x, formatter = deg) + deg_min <- format(x) + + pillar::new_pillar_shaft( + list(deg = deg, deg_min = deg_min), + width = pillar::get_max_extent(deg_min), + min_width = pillar::get_max_extent(deg), + class = "pillar_shaft_latlon" + ) +} + +## ----------------------------------------------------------------------------- +#' @export +format.pillar_shaft_latlon <- function(x, width, ...) { + if (get_max_extent(x$deg_min) <= width) { + ornament <- x$deg_min + } else { + ornament <- x$deg + } + + pillar::new_ornament(ornament, align = "right") +} + +data +print(data, width = 30) + +## ----eval = FALSE------------------------------------------------------------- +# expect_snapshot(pillar_shaft(data$loc)) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/pillar.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/pillar.Rmd new file mode 100644 index 00000000..77ebbb11 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/pillar.Rmd @@ -0,0 +1,273 @@ +--- +title: "Printing vectors nicely in tibbles" +author: "Kirill Müller, Hadley Wickham" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Printing vectors nicely in tibbles} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set(collapse = TRUE, comment = "#>") +``` + +You can get basic control over how a vector is printed in a tibble by providing a `format()` method. +If you want greater control, you need to understand how printing works. +The presentation of a column in a tibble is controlled by two S3 generics: + +* `vctrs::vec_ptype_abbr()` determines what goes into the column header. +* `pillar::pillar_shaft()` determines what goes into the body, or the shaft, of the column. + +Technically a [*pillar*](https://en.wikipedia.org/wiki/Column#Nomenclature) is composed of a *shaft* (decorated with an *ornament*), with a *capital* above and a *base* below. +Multiple pillars form a *colonnade*, which can be stacked in multiple *tiers*. +This is the motivation behind the names in our API. + +This short vignette shows the basics of column styling using a `"latlon"` vector. +The vignette imagines the code is in a package, so that you can see the roxygen2 commands you'll need to create documentation and the `NAMESPACE` file. +In this vignette, we'll attach pillar and vctrs: + +```{r setup} +library(vctrs) +library(pillar) +``` + +You don't need to do this in a package. +Instead, you'll need to _import_ the packages by then to the `Imports:` section of your `DESCRIPTION`. +The following helper does this for you: + +```{r, eval = FALSE} +usethis::use_package("vctrs") +usethis::use_package("pillar") +``` + +## Prerequisites + +To illustrate the basic ideas we're going to create a `"latlon"` class that encodes geographic coordinates in a record. +We'll pretend that this code lives in a package called earth. +For simplicity, the values are printed as degrees and minutes only. +By using `vctrs_rcrd()`, we already get the infrastructure to make this class fully compatible with data frames for free. +See `vignette("s3-vector", package = "vctrs")` for details on the record data type. + +```{r} +#' @export +latlon <- function(lat, lon) { + new_rcrd(list(lat = lat, lon = lon), class = "earth_latlon") +} + +#' @export +format.earth_latlon <- function(x, ..., formatter = deg_min) { + x_valid <- which(!is.na(x)) + + lat <- field(x, "lat")[x_valid] + lon <- field(x, "lon")[x_valid] + + ret <- rep(NA_character_, vec_size(x)) + ret[x_valid] <- paste0(formatter(lat, "lat"), " ", formatter(lon, "lon")) + # It's important to keep NA in the vector! + ret +} + +deg_min <- function(x, direction) { + pm <- if (direction == "lat") c("N", "S") else c("E", "W") + + sign <- sign(x) + x <- abs(x) + deg <- trunc(x) + x <- x - deg + min <- round(x * 60) + + # Ensure the columns are always the same width so they line up nicely + ret <- sprintf("%d°%.2d'%s", deg, min, ifelse(sign >= 0, pm[[1]], pm[[2]])) + format(ret, justify = "right") +} + +latlon(c(32.71, 2.95), c(-117.17, 1.67)) +``` + +## Using in a tibble + +Columns of this class can be used in a tibble right away because we've made a class using the vctrs infrastructure and have provided a `format()` method: + +```{r} +library(tibble) + +loc <- latlon( + c(28.3411783, 32.7102978, 30.2622356, 37.7859102, 28.5, NA), + c(-81.5480348, -117.1704058, -97.7403327, -122.4131357, -81.4, NA) +) + +data <- tibble(venue = "rstudio::conf", year = 2017:2022, loc = loc) + +data +``` + +This output is ok, but we could improve it by: + +1. Using a more description type abbreviation than ``. + +1. Using a dash of colour to highlight the most important parts of the value. + +1. Providing a narrower view when horizontal space is at a premium. + +The following sections show how to enhance the rendering. + +## Fixing the data type + +Instead of `` we'd prefer to use ``. +We can do that by implementing the `vec_ptype_abbr()` method, which should return a string that can be used in a column header. +For your own classes, strive for an evocative abbreviation that's under 6 characters. + +```{r} +#' @export +vec_ptype_abbr.earth_latlon <- function(x) { + "latlon" +} + +data +``` + + +## Custom rendering + +The `format()` method is used by default for rendering. +For custom formatting you need to implement the `pillar_shaft()` method. +This function should always return a pillar shaft object, created by `new_pillar_shaft_simple()` or similar. +`new_pillar_shaft_simple()` accepts ANSI escape codes for colouring, and pillar includes some built in styles like `style_subtle()`. +We can use subtle style for the degree and minute separators to make the data more obvious. + +First we define a degree formatter that makes use of `style_subtle()`: + +```{r} +deg_min_color <- function(x, direction) { + pm <- if (direction == "lat") c("N", "S") else c("E", "W") + + sign <- sign(x) + x <- abs(x) + deg <- trunc(x) + x <- x - deg + rad <- round(x * 60) + ret <- sprintf( + "%d%s%.2d%s%s", + deg, + pillar::style_subtle("°"), + rad, + pillar::style_subtle("'"), + pm[ifelse(sign >= 0, 1, 2)] + ) + format(ret, justify = "right") +} +``` + +And then we pass that to our `format()` method: + +```{r} +#' @importFrom pillar pillar_shaft +#' @export +pillar_shaft.earth_latlon <- function(x, ...) { + out <- format(x, formatter = deg_min_color) + pillar::new_pillar_shaft_simple(out, align = "right") +} +``` + +Currently, ANSI escapes are not rendered in vignettes, so this result doesn't look any different, but if you run the code yourself you'll see an improved display. + +```{r} +data +``` + +As well as the functions in pillar, the [cli](https://cli.r-lib.org/) package provides a variety of tools for styling text. + +## Truncation + +Tibbles can automatically compacts columns when there's no enough horizontal space to display everything: + +```{r} +print(data, width = 30) +``` + +Currently the latlon class isn't ever compacted because we haven't specified a minimum width when constructing the shaft. +Let's fix that and re-print the data: + +```{r} +#' @importFrom pillar pillar_shaft +#' @export +pillar_shaft.earth_latlon <- function(x, ...) { + out <- format(x) + pillar::new_pillar_shaft_simple(out, align = "right", min_width = 10) +} + +print(data, width = 30) +``` +## Adaptive rendering + +Truncation may be useful for character data, but for lat-lon data it'd be nicer to show full degrees and remove the minutes. +We'll first write a function that does this: + +```{r} +deg <- function(x, direction) { + pm <- if (direction == "lat") c("N", "S") else c("E", "W") + + sign <- sign(x) + x <- abs(x) + deg <- round(x) + + ret <- sprintf("%d°%s", deg, pm[ifelse(sign >= 0, 1, 2)]) + format(ret, justify = "right") +} +``` + +Then use it as part of more sophisticated implementation of the `pillar_shaft()` method: + +```{r} +#' @importFrom pillar pillar_shaft +#' @export +pillar_shaft.earth_latlon <- function(x, ...) { + deg <- format(x, formatter = deg) + deg_min <- format(x) + + pillar::new_pillar_shaft( + list(deg = deg, deg_min = deg_min), + width = pillar::get_max_extent(deg_min), + min_width = pillar::get_max_extent(deg), + class = "pillar_shaft_latlon" + ) +} +``` + +Now the `pillar_shaft()` method returns an object of class `"pillar_shaft_latlon"` created by `new_pillar_shaft()`. +This object contains the necessary information to render the values, and also minimum and maximum width values. +For simplicity, both formats are pre-rendered, and the minimum and maximum widths are computed from there. +(`get_max_extent()` is a helper that computes the maximum display width occupied by the values in a character vector.) + +All that's left to do is to implement a `format()` method for our new `"pillar_shaft_latlon"` class. +This method will be called with a `width` argument, which then determines which of the formats to choose. +The formatting of our choice is passed to the `new_ornament()` function: + +```{r} +#' @export +format.pillar_shaft_latlon <- function(x, width, ...) { + if (get_max_extent(x$deg_min) <= width) { + ornament <- x$deg_min + } else { + ornament <- x$deg + } + + pillar::new_ornament(ornament, align = "right") +} + +data +print(data, width = 30) +``` + +## Testing + +If you want to test the output of your code, you can compare it with a known state recorded in a text file. The `testthat::expect_snapshot()` function offers an easy way to test output-generating functions. It takes care about details such as Unicode, ANSI escapes, and output width. Furthermore it won't make the tests fail on CRAN. This is important because your output may rely on details out of your control, which should be fixed eventually but should not lead to your package being removed from CRAN. + +Use this testthat expectation in one of your test files to create a snapshot test: + +```{r eval = FALSE} +expect_snapshot(pillar_shaft(data$loc)) +``` + +See for more information. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/pillar.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/pillar.html new file mode 100644 index 00000000..c93169be --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/pillar.html @@ -0,0 +1,678 @@ + + + + + + + + + + + + + + + +Printing vectors nicely in tibbles + + + + + + + + + + + + + + + + + + + + + + + + + + +

Printing vectors nicely in tibbles

+

Kirill Müller, Hadley Wickham

+ + + +

You can get basic control over how a vector is printed in a tibble by +providing a format() method. If you want greater control, +you need to understand how printing works. The presentation of a column +in a tibble is controlled by two S3 generics:

+
    +
  • vctrs::vec_ptype_abbr() determines what goes into the +column header.
  • +
  • pillar::pillar_shaft() determines what goes into the +body, or the shaft, of the column.
  • +
+

Technically a pillar +is composed of a shaft (decorated with an ornament), +with a capital above and a base below. Multiple +pillars form a colonnade, which can be stacked in multiple +tiers. This is the motivation behind the names in our API.

+

This short vignette shows the basics of column styling using a +"latlon" vector. The vignette imagines the code is in a +package, so that you can see the roxygen2 commands you’ll need to create +documentation and the NAMESPACE file. In this vignette, +we’ll attach pillar and vctrs:

+
library(vctrs)
+library(pillar)
+

You don’t need to do this in a package. Instead, you’ll need to +import the packages by then to the Imports: +section of your DESCRIPTION. The following helper does this +for you:

+
usethis::use_package("vctrs")
+usethis::use_package("pillar")
+
+

Prerequisites

+

To illustrate the basic ideas we’re going to create a +"latlon" class that encodes geographic coordinates in a +record. We’ll pretend that this code lives in a package called earth. +For simplicity, the values are printed as degrees and minutes only. By +using vctrs_rcrd(), we already get the infrastructure to +make this class fully compatible with data frames for free. See +vignette("s3-vector", package = "vctrs") for details on the +record data type.

+
#' @export
+latlon <- function(lat, lon) {
+  new_rcrd(list(lat = lat, lon = lon), class = "earth_latlon")
+}
+
+#' @export
+format.earth_latlon <- function(x, ..., formatter = deg_min) {
+  x_valid <- which(!is.na(x))
+
+  lat <- field(x, "lat")[x_valid]
+  lon <- field(x, "lon")[x_valid]
+
+  ret <- rep(NA_character_, vec_size(x))
+  ret[x_valid] <- paste0(formatter(lat, "lat"), " ", formatter(lon, "lon"))
+  # It's important to keep NA in the vector!
+  ret
+}
+
+deg_min <- function(x, direction) {
+  pm <- if (direction == "lat") c("N", "S") else c("E", "W")
+
+  sign <- sign(x)
+  x <- abs(x)
+  deg <- trunc(x)
+  x <- x - deg
+  min <- round(x * 60)
+
+  # Ensure the columns are always the same width so they line up nicely
+  ret <- sprintf("%d°%.2d'%s", deg, min, ifelse(sign >= 0, pm[[1]], pm[[2]]))
+  format(ret, justify = "right")
+}
+
+latlon(c(32.71, 2.95), c(-117.17, 1.67))
+#> <earth_latlon[2]>
+#> [1] 32°43'N 117°10'W  2°57'N   1°40'E
+
+
+

Using in a tibble

+

Columns of this class can be used in a tibble right away because +we’ve made a class using the vctrs infrastructure and have provided a +format() method:

+
library(tibble)
+#> 
+#> Attaching package: 'tibble'
+#> The following object is masked from 'package:vctrs':
+#> 
+#>     data_frame
+
+loc <- latlon(
+  c(28.3411783, 32.7102978, 30.2622356, 37.7859102, 28.5, NA),
+  c(-81.5480348, -117.1704058, -97.7403327, -122.4131357, -81.4, NA)
+)
+
+data <- tibble(venue = "rstudio::conf", year = 2017:2022, loc = loc)
+
+data
+#> # A tibble: 6 × 3
+#>   venue          year              loc
+#>   <chr>         <int>       <erth_ltl>
+#> 1 rstudio::conf  2017 28°20'N  81°33'W
+#> 2 rstudio::conf  2018 32°43'N 117°10'W
+#> 3 rstudio::conf  2019 30°16'N  97°44'W
+#> 4 rstudio::conf  2020 37°47'N 122°25'W
+#> 5 rstudio::conf  2021 28°30'N  81°24'W
+#> 6 rstudio::conf  2022               NA
+

This output is ok, but we could improve it by:

+
    +
  1. Using a more description type abbreviation than +<erth_ltl>.

  2. +
  3. Using a dash of colour to highlight the most important parts of +the value.

  4. +
  5. Providing a narrower view when horizontal space is at a +premium.

  6. +
+

The following sections show how to enhance the rendering.

+
+
+

Fixing the data type

+

Instead of <erth_ltl> we’d prefer to use +<latlon>. We can do that by implementing the +vec_ptype_abbr() method, which should return a string that +can be used in a column header. For your own classes, strive for an +evocative abbreviation that’s under 6 characters.

+
#' @export
+vec_ptype_abbr.earth_latlon <- function(x) {
+  "latlon"
+}
+
+data
+#> # A tibble: 6 × 3
+#>   venue          year              loc
+#>   <chr>         <int>         <latlon>
+#> 1 rstudio::conf  2017 28°20'N  81°33'W
+#> 2 rstudio::conf  2018 32°43'N 117°10'W
+#> 3 rstudio::conf  2019 30°16'N  97°44'W
+#> 4 rstudio::conf  2020 37°47'N 122°25'W
+#> 5 rstudio::conf  2021 28°30'N  81°24'W
+#> 6 rstudio::conf  2022               NA
+
+
+

Custom rendering

+

The format() method is used by default for rendering. +For custom formatting you need to implement the +pillar_shaft() method. This function should always return a +pillar shaft object, created by new_pillar_shaft_simple() +or similar. new_pillar_shaft_simple() accepts ANSI escape +codes for colouring, and pillar includes some built in styles like +style_subtle(). We can use subtle style for the degree and +minute separators to make the data more obvious.

+

First we define a degree formatter that makes use of +style_subtle():

+
deg_min_color <- function(x, direction) {
+  pm <- if (direction == "lat") c("N", "S") else c("E", "W")
+
+  sign <- sign(x)
+  x <- abs(x)
+  deg <- trunc(x)
+  x <- x - deg
+  rad <- round(x * 60)
+  ret <- sprintf(
+    "%d%s%.2d%s%s",
+    deg,
+    pillar::style_subtle("°"),
+    rad,
+    pillar::style_subtle("'"),
+    pm[ifelse(sign >= 0, 1, 2)]
+  )
+  format(ret, justify = "right")
+}
+

And then we pass that to our format() method:

+
#' @importFrom pillar pillar_shaft
+#' @export
+pillar_shaft.earth_latlon <- function(x, ...) {
+  out <- format(x, formatter = deg_min_color)
+  pillar::new_pillar_shaft_simple(out, align = "right")
+}
+

Currently, ANSI escapes are not rendered in vignettes, so this result +doesn’t look any different, but if you run the code yourself you’ll see +an improved display.

+
data
+#> # A tibble: 6 × 3
+#>   venue          year              loc
+#>   <chr>         <int>         <latlon>
+#> 1 rstudio::conf  2017 28°20'N  81°33'W
+#> 2 rstudio::conf  2018 32°43'N 117°10'W
+#> 3 rstudio::conf  2019 30°16'N  97°44'W
+#> 4 rstudio::conf  2020 37°47'N 122°25'W
+#> 5 rstudio::conf  2021 28°30'N  81°24'W
+#> 6 rstudio::conf  2022               NA
+

As well as the functions in pillar, the cli package provides a variety of +tools for styling text.

+
+
+

Truncation

+

Tibbles can automatically compacts columns when there’s no enough +horizontal space to display everything:

+
print(data, width = 30)
+#> # A tibble: 6 × 3
+#>   venue  year              loc
+#>   <chr> <int>         <latlon>
+#> 1 rstu…  2017 28°20'N  81°33'W
+#> 2 rstu…  2018 32°43'N 117°10'W
+#> 3 rstu…  2019 30°16'N  97°44'W
+#> 4 rstu…  2020 37°47'N 122°25'W
+#> 5 rstu…  2021 28°30'N  81°24'W
+#> 6 rstu…  2022               NA
+

Currently the latlon class isn’t ever compacted because we haven’t +specified a minimum width when constructing the shaft. Let’s fix that +and re-print the data:

+
#' @importFrom pillar pillar_shaft
+#' @export
+pillar_shaft.earth_latlon <- function(x, ...) {
+  out <- format(x)
+  pillar::new_pillar_shaft_simple(out, align = "right", min_width = 10)
+}
+
+print(data, width = 30)
+#> # A tibble: 6 × 3
+#>   venue        year        loc
+#>   <chr>       <int>   <latlon>
+#> 1 rstudio::c…  2017 28°20'N  …
+#> 2 rstudio::c…  2018 32°43'N 1…
+#> 3 rstudio::c…  2019 30°16'N  …
+#> 4 rstudio::c…  2020 37°47'N 1…
+#> 5 rstudio::c…  2021 28°30'N  …
+#> 6 rstudio::c…  2022         NA
+
+
+

Adaptive rendering

+

Truncation may be useful for character data, but for lat-lon data +it’d be nicer to show full degrees and remove the minutes. We’ll first +write a function that does this:

+
deg <- function(x, direction) {
+  pm <- if (direction == "lat") c("N", "S") else c("E", "W")
+
+  sign <- sign(x)
+  x <- abs(x)
+  deg <- round(x)
+
+  ret <- sprintf("%d°%s", deg, pm[ifelse(sign >= 0, 1, 2)])
+  format(ret, justify = "right")
+}
+

Then use it as part of more sophisticated implementation of the +pillar_shaft() method:

+
#' @importFrom pillar pillar_shaft
+#' @export
+pillar_shaft.earth_latlon <- function(x, ...) {
+  deg <- format(x, formatter = deg)
+  deg_min <- format(x)
+
+  pillar::new_pillar_shaft(
+    list(deg = deg, deg_min = deg_min),
+    width = pillar::get_max_extent(deg_min),
+    min_width = pillar::get_max_extent(deg),
+    class = "pillar_shaft_latlon"
+  )
+}
+

Now the pillar_shaft() method returns an object of class +"pillar_shaft_latlon" created by +new_pillar_shaft(). This object contains the necessary +information to render the values, and also minimum and maximum width +values. For simplicity, both formats are pre-rendered, and the minimum +and maximum widths are computed from there. +(get_max_extent() is a helper that computes the maximum +display width occupied by the values in a character vector.)

+

All that’s left to do is to implement a format() method +for our new "pillar_shaft_latlon" class. This method will +be called with a width argument, which then determines +which of the formats to choose. The formatting of our choice is passed +to the new_ornament() function:

+
#' @export
+format.pillar_shaft_latlon <- function(x, width, ...) {
+  if (get_max_extent(x$deg_min) <= width) {
+    ornament <- x$deg_min
+  } else {
+    ornament <- x$deg
+  }
+
+  pillar::new_ornament(ornament, align = "right")
+}
+
+data
+#> # A tibble: 6 × 3
+#>   venue          year              loc
+#>   <chr>         <int>         <latlon>
+#> 1 rstudio::conf  2017 28°20'N  81°33'W
+#> 2 rstudio::conf  2018 32°43'N 117°10'W
+#> 3 rstudio::conf  2019 30°16'N  97°44'W
+#> 4 rstudio::conf  2020 37°47'N 122°25'W
+#> 5 rstudio::conf  2021 28°30'N  81°24'W
+#> 6 rstudio::conf  2022               NA
+print(data, width = 30)
+#> # A tibble: 6 × 3
+#>   venue        year        loc
+#>   <chr>       <int>   <latlon>
+#> 1 rstudio::c…  2017 28°N  82°W
+#> 2 rstudio::c…  2018 33°N 117°W
+#> 3 rstudio::c…  2019 30°N  98°W
+#> 4 rstudio::c…  2020 38°N 122°W
+#> 5 rstudio::c…  2021 28°N  81°W
+#> 6 rstudio::c…  2022         NA
+
+
+

Testing

+

If you want to test the output of your code, you can compare it with +a known state recorded in a text file. The +testthat::expect_snapshot() function offers an easy way to +test output-generating functions. It takes care about details such as +Unicode, ANSI escapes, and output width. Furthermore it won’t make the +tests fail on CRAN. This is important because your output may rely on +details out of your control, which should be fixed eventually but should +not lead to your package being removed from CRAN.

+

Use this testthat expectation in one of your test files to create a +snapshot test:

+
expect_snapshot(pillar_shaft(data$loc))
+

See https://testthat.r-lib.org/articles/snapshotting.html +for more information.

+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/s3-vector.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/s3-vector.R new file mode 100644 index 00000000..fb192cd5 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/s3-vector.R @@ -0,0 +1,717 @@ +## ----include = FALSE---------------------------------------------------------- +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +set.seed(1014) + +## ----setup-------------------------------------------------------------------- +library(vctrs) +library(rlang) +library(zeallot) + +## ----------------------------------------------------------------------------- +new_percent <- function(x = double()) { + if (!is_double(x)) { + abort("`x` must be a double vector.") + } + new_vctr(x, class = "vctrs_percent") +} + +x <- new_percent(c(seq(0, 1, length.out = 4), NA)) +x + +str(x) + +## ----------------------------------------------------------------------------- +percent <- function(x = double()) { + x <- vec_cast(x, double()) + new_percent(x) +} + +## ----------------------------------------------------------------------------- +new_percent() +percent() + +## ----------------------------------------------------------------------------- +is_percent <- function(x) { + inherits(x, "vctrs_percent") +} + +## ----------------------------------------------------------------------------- +format.vctrs_percent <- function(x, ...) { + out <- formatC(signif(vec_data(x) * 100, 3)) + out[is.na(x)] <- NA + out[!is.na(x)] <- paste0(out[!is.na(x)], "%") + out +} + +## ----include = FALSE---------------------------------------------------------- +# As of R 3.5, print.vctr can not find format.percent since it's not in +# its lexical environment. We fix that problem by manually registering. +s3_register("base::format", "vctrs_percent") + +## ----------------------------------------------------------------------------- +x + +## ----------------------------------------------------------------------------- +data.frame(x) + +## ----------------------------------------------------------------------------- +vec_ptype_abbr.vctrs_percent <- function(x, ...) { + "prcnt" +} + +tibble::tibble(x) + +str(x) + +## ----error = TRUE------------------------------------------------------------- +vec_ptype2("bogus", percent()) +vec_ptype2(percent(), NA) +vec_ptype2(NA, percent()) + +## ----------------------------------------------------------------------------- +vec_ptype2(percent(), percent()) + +## ----------------------------------------------------------------------------- +vec_ptype2.vctrs_percent.vctrs_percent <- function(x, y, ...) new_percent() + +## ----------------------------------------------------------------------------- +vec_ptype2.vctrs_percent.double <- function(x, y, ...) double() +vec_ptype2.double.vctrs_percent <- function(x, y, ...) double() + +## ----------------------------------------------------------------------------- +vec_ptype_show(percent(), double(), percent()) + +## ----------------------------------------------------------------------------- +vec_cast.vctrs_percent.vctrs_percent <- function(x, to, ...) x + +## ----------------------------------------------------------------------------- +vec_cast.vctrs_percent.double <- function(x, to, ...) percent(x) +vec_cast.double.vctrs_percent <- function(x, to, ...) vec_data(x) + +## ----------------------------------------------------------------------------- +vec_cast(0.5, percent()) +vec_cast(percent(0.5), double()) + +## ----error = TRUE------------------------------------------------------------- +vec_c(percent(0.5), 1) +vec_c(NA, percent(0.5)) +# but +vec_c(TRUE, percent(0.5)) + +x <- percent(c(0.5, 1, 2)) +x[1:2] <- 2:1 +x[[3]] <- 0.5 +x + +## ----error = TRUE------------------------------------------------------------- +# Correct +c(percent(0.5), 1) +c(percent(0.5), factor(1)) + +# Incorrect +c(factor(1), percent(0.5)) + +## ----------------------------------------------------------------------------- +as_percent <- function(x) { + vec_cast(x, new_percent()) +} + +## ----------------------------------------------------------------------------- +as_percent <- function(x, ...) { + UseMethod("as_percent") +} + +as_percent.default <- function(x, ...) { + vec_cast(x, new_percent()) +} + +as_percent.character <- function(x) { + value <- as.numeric(gsub(" *% *$", "", x)) / 100 + new_percent(value) +} + +## ----------------------------------------------------------------------------- +new_decimal <- function(x = double(), digits = 2L) { + if (!is_double(x)) { + abort("`x` must be a double vector.") + } + if (!is_integer(digits)) { + abort("`digits` must be an integer vector.") + } + vec_check_size(digits, size = 1L) + + new_vctr(x, digits = digits, class = "vctrs_decimal") +} + +decimal <- function(x = double(), digits = 2L) { + x <- vec_cast(x, double()) + digits <- vec_recycle(vec_cast(digits, integer()), 1L) + + new_decimal(x, digits = digits) +} + +digits <- function(x) attr(x, "digits") + +format.vctrs_decimal <- function(x, ...) { + sprintf(paste0("%-0.", digits(x), "f"), x) +} + +vec_ptype_abbr.vctrs_decimal <- function(x, ...) { + "dec" +} + +x <- decimal(runif(10), 1L) +x + +## ----------------------------------------------------------------------------- +x[1:2] +x[[1]] + +## ----------------------------------------------------------------------------- +vec_ptype_full.vctrs_decimal <- function(x, ...) { + paste0("decimal<", digits(x), ">") +} + +x + +## ----------------------------------------------------------------------------- +vec_ptype2.vctrs_decimal.vctrs_decimal <- function(x, y, ...) { + new_decimal(digits = max(digits(x), digits(y))) +} +vec_cast.vctrs_decimal.vctrs_decimal <- function(x, to, ...) { + new_decimal(vec_data(x), digits = digits(to)) +} + +vec_c(decimal(1/100, digits = 3), decimal(2/100, digits = 2)) + +## ----------------------------------------------------------------------------- +vec_ptype2.vctrs_decimal.double <- function(x, y, ...) x +vec_ptype2.double.vctrs_decimal <- function(x, y, ...) y + +vec_cast.vctrs_decimal.double <- function(x, to, ...) new_decimal(x, digits = digits(to)) +vec_cast.double.vctrs_decimal <- function(x, to, ...) vec_data(x) + +vec_c(decimal(1, digits = 1), pi) +vec_c(pi, decimal(1, digits = 1)) + +## ----error = TRUE------------------------------------------------------------- +vec_cast(c(1, 2, 10), to = integer()) + +vec_cast(c(1.5, 2, 10.5), to = integer()) + +## ----------------------------------------------------------------------------- +new_cached_sum <- function(x = double(), sum = 0L) { + if (!is_double(x)) { + abort("`x` must be a double vector.") + } + if (!is_double(sum)) { + abort("`sum` must be a double vector.") + } + vec_check_size(sum, size = 1L) + + new_vctr(x, sum = sum, class = "vctrs_cached_sum") +} + +cached_sum <- function(x) { + x <- vec_cast(x, double()) + new_cached_sum(x, sum(x)) +} + +## ----------------------------------------------------------------------------- +obj_print_footer.vctrs_cached_sum <- function(x, ...) { + cat("# Sum: ", format(attr(x, "sum"), digits = 3), "\n", sep = "") +} + +x <- cached_sum(runif(10)) +x + +## ----------------------------------------------------------------------------- +vec_math.vctrs_cached_sum <- function(.fn, .x, ...) { + cat("Using cache\n") + switch(.fn, + sum = attr(.x, "sum"), + mean = attr(.x, "sum") / length(.x), + vec_math_base(.fn, .x, ...) + ) +} + +sum(x) + +## ----------------------------------------------------------------------------- +x[1:2] + +## ----------------------------------------------------------------------------- +vec_restore.vctrs_cached_sum <- function(x, to, ..., i = NULL) { + new_cached_sum(x, sum(x)) +} + +x[1] + +## ----------------------------------------------------------------------------- +x <- as.POSIXlt(ISOdatetime(2020, 1, 1, 0, 0, 1:3)) +x + +length(x) +length(unclass(x)) + +x[[1]] # the first date time +unclass(x)[[1]] # the first component, the number of seconds + +## ----------------------------------------------------------------------------- +new_rational <- function(n = integer(), d = integer()) { + if (!is_integer(n)) { + abort("`n` must be an integer vector.") + } + if (!is_integer(d)) { + abort("`d` must be an integer vector.") + } + + new_rcrd(list(n = n, d = d), class = "vctrs_rational") +} + +## ----------------------------------------------------------------------------- +rational <- function(n = integer(), d = integer()) { + c(n, d) %<-% vec_cast_common(n, d, .to = integer()) + c(n, d) %<-% vec_recycle_common(n, d) + + new_rational(n, d) +} + +x <- rational(1, 1:10) + +## ----------------------------------------------------------------------------- +names(x) +length(x) + +## ----------------------------------------------------------------------------- +fields(x) +field(x, "n") + +## ----error = TRUE------------------------------------------------------------- +x + +str(x) + +## ----------------------------------------------------------------------------- +vec_data(x) + +str(vec_data(x)) + +## ----------------------------------------------------------------------------- +format.vctrs_rational <- function(x, ...) { + n <- field(x, "n") + d <- field(x, "d") + + out <- paste0(n, "/", d) + out[is.na(n) | is.na(d)] <- NA + + out +} + +vec_ptype_abbr.vctrs_rational <- function(x, ...) "rtnl" +vec_ptype_full.vctrs_rational <- function(x, ...) "rational" + +x + +## ----------------------------------------------------------------------------- +str(x) + +## ----------------------------------------------------------------------------- +vec_ptype2.vctrs_rational.vctrs_rational <- function(x, y, ...) new_rational() +vec_ptype2.vctrs_rational.integer <- function(x, y, ...) new_rational() +vec_ptype2.integer.vctrs_rational <- function(x, y, ...) new_rational() + +vec_cast.vctrs_rational.vctrs_rational <- function(x, to, ...) x +vec_cast.double.vctrs_rational <- function(x, to, ...) field(x, "n") / field(x, "d") +vec_cast.vctrs_rational.integer <- function(x, to, ...) rational(x, 1) + +vec_c(rational(1, 2), 1L, NA) + +## ----------------------------------------------------------------------------- +new_decimal2 <- function(l, r, scale = 2L) { + if (!is_integer(l)) { + abort("`l` must be an integer vector.") + } + if (!is_integer(r)) { + abort("`r` must be an integer vector.") + } + if (!is_integer(scale)) { + abort("`scale` must be an integer vector.") + } + vec_check_size(scale, size = 1L) + + new_rcrd(list(l = l, r = r), scale = scale, class = "vctrs_decimal2") +} + +decimal2 <- function(l, r, scale = 2L) { + l <- vec_cast(l, integer()) + r <- vec_cast(r, integer()) + c(l, r) %<-% vec_recycle_common(l, r) + scale <- vec_cast(scale, integer()) + + # should check that r < 10^scale + new_decimal2(l = l, r = r, scale = scale) +} + +format.vctrs_decimal2 <- function(x, ...) { + val <- field(x, "l") + field(x, "r") / 10^attr(x, "scale") + sprintf(paste0("%.0", attr(x, "scale"), "f"), val) +} + +decimal2(10, c(0, 5, 99)) + +## ----------------------------------------------------------------------------- +x <- rational(c(1, 2, 1, 2), c(1, 1, 2, 2)) +x + +vec_proxy(x) + +x == rational(1, 1) + +## ----------------------------------------------------------------------------- +# Thanks to Matthew Lundberg: https://stackoverflow.com/a/21504113/16632 +gcd <- function(x, y) { + r <- x %% y + ifelse(r, gcd(y, r), y) +} + +vec_proxy_equal.vctrs_rational <- function(x, ...) { + n <- field(x, "n") + d <- field(x, "d") + gcd <- gcd(n, d) + + data.frame(n = n / gcd, d = d / gcd) +} +vec_proxy_equal(x) + +x == rational(1, 1) + +## ----------------------------------------------------------------------------- +unique(x) + +## ----------------------------------------------------------------------------- +rational(1, 2) < rational(2, 3) +rational(2, 4) < rational(2, 3) + +## ----------------------------------------------------------------------------- +vec_proxy_compare.vctrs_rational <- function(x, ...) { + field(x, "n") / field(x, "d") +} + +rational(2, 4) < rational(2, 3) + +## ----------------------------------------------------------------------------- +sort(x) + +## ----------------------------------------------------------------------------- +poly <- function(...) { + x <- vec_cast_common(..., .to = integer()) + new_poly(x) +} +new_poly <- function(x) { + new_list_of(x, ptype = integer(), class = "vctrs_poly_list") +} + +vec_ptype_full.vctrs_poly_list <- function(x, ...) "polynomial" +vec_ptype_abbr.vctrs_poly_list <- function(x, ...) "poly" + +format.vctrs_poly_list <- function(x, ...) { + format_one <- function(x) { + if (length(x) == 0) { + return("") + } + + if (length(x) == 1) { + format(x) + } else { + suffix <- c(paste0("\u22C5x^", seq(length(x) - 1, 1)), "") + out <- paste0(x, suffix) + out <- out[x != 0L] + paste0(out, collapse = " + ") + } + } + + vapply(x, format_one, character(1)) +} + +obj_print_data.vctrs_poly_list <- function(x, ...) { + if (length(x) != 0) { + print(format(x), quote = FALSE) + } +} + +p <- poly(1, c(1, 0, 0, 0, 2), c(1, 0, 1)) +p + +## ----------------------------------------------------------------------------- +class(p) +p[2] +p[[2]] + +## ----------------------------------------------------------------------------- +obj_is_list(p) + +## ----------------------------------------------------------------------------- +poly <- function(...) { + x <- vec_cast_common(..., .to = integer()) + x <- new_poly(x) + new_rcrd(list(data = x), class = "vctrs_poly") +} +format.vctrs_poly <- function(x, ...) { + format(field(x, "data")) +} + +## ----------------------------------------------------------------------------- +p <- poly(1, c(1, 0, 0, 0, 2), c(1, 0, 1)) +p + +## ----------------------------------------------------------------------------- +obj_is_list(p) + +## ----------------------------------------------------------------------------- +p[[2]] + +## ----------------------------------------------------------------------------- +p == poly(c(1, 0, 1)) + +## ----error = TRUE------------------------------------------------------------- +p < p[2] + +## ----------------------------------------------------------------------------- +vec_proxy_compare.vctrs_poly <- function(x, ...) { + # Get the list inside the record vector + x_raw <- vec_data(field(x, "data")) + + # First figure out the maximum length + n <- max(vapply(x_raw, length, integer(1))) + + # Then expand all vectors to this length by filling in with zeros + full <- lapply(x_raw, function(x) c(rep(0L, n - length(x)), x)) + + # Then turn into a data frame + as.data.frame(do.call(rbind, full)) +} + +p < p[2] + +## ----------------------------------------------------------------------------- +sort(p) +sort(p[c(1:3, 1:2)]) + +## ----------------------------------------------------------------------------- +vec_proxy_order.vctrs_poly <- function(x, ...) { + vec_proxy_compare(x, ...) +} + +sort(p) + +## ----------------------------------------------------------------------------- +vec_arith.MYCLASS <- function(op, x, y, ...) { + UseMethod("vec_arith.MYCLASS", y) +} +vec_arith.MYCLASS.default <- function(op, x, y, ...) { + stop_incompatible_op(op, x, y) +} + +## ----------------------------------------------------------------------------- +vec_math.vctrs_cached_sum <- function(.fn, .x, ...) { + switch(.fn, + sum = attr(.x, "sum"), + mean = attr(.x, "sum") / length(.x), + vec_math_base(.fn, .x, ...) + ) +} + +## ----------------------------------------------------------------------------- +new_meter <- function(x) { + stopifnot(is.double(x)) + new_vctr(x, class = "vctrs_meter") +} + +format.vctrs_meter <- function(x, ...) { + paste0(format(vec_data(x)), " m") +} + +meter <- function(x) { + x <- vec_cast(x, double()) + new_meter(x) +} + +x <- meter(1:10) +x + +## ----------------------------------------------------------------------------- +sum(x) +mean(x) + +## ----error = TRUE------------------------------------------------------------- +x + 1 +meter(10) + meter(1) +meter(10) * 3 + +## ----------------------------------------------------------------------------- +vec_arith.vctrs_meter <- function(op, x, y, ...) { + UseMethod("vec_arith.vctrs_meter", y) +} +vec_arith.vctrs_meter.default <- function(op, x, y, ...) { + stop_incompatible_op(op, x, y) +} + +## ----error = TRUE------------------------------------------------------------- +vec_arith.vctrs_meter.vctrs_meter <- function(op, x, y, ...) { + switch( + op, + "+" = , + "-" = new_meter(vec_arith_base(op, x, y)), + "/" = vec_arith_base(op, x, y), + stop_incompatible_op(op, x, y) + ) +} + +meter(10) + meter(1) +meter(10) - meter(1) +meter(10) / meter(1) +meter(10) * meter(1) + +## ----error = TRUE------------------------------------------------------------- +vec_arith.vctrs_meter.numeric <- function(op, x, y, ...) { + switch( + op, + "/" = , + "*" = new_meter(vec_arith_base(op, x, y)), + stop_incompatible_op(op, x, y) + ) +} +vec_arith.numeric.vctrs_meter <- function(op, x, y, ...) { + switch( + op, + "*" = new_meter(vec_arith_base(op, x, y)), + stop_incompatible_op(op, x, y) + ) +} + +meter(2) * 10 +meter(2) * as.integer(10) +10 * meter(2) +meter(20) / 10 +10 / meter(20) +meter(20) + 10 + +## ----------------------------------------------------------------------------- +vec_arith.vctrs_meter.MISSING <- function(op, x, y, ...) { + switch(op, + `-` = x * -1, + `+` = x, + stop_incompatible_op(op, x, y) + ) +} +-meter(1) ++meter(1) + +## ----eval = FALSE------------------------------------------------------------- +# #' Internal vctrs methods +# #' +# #' @import vctrs +# #' @keywords internal +# #' @name pizza-vctrs +# NULL + +## ----------------------------------------------------------------------------- +new_percent <- function(x = double()) { + if (!is_double(x)) { + abort("`x` must be a double vector.") + } + new_vctr(x, class = "pizza_percent") +} + +## ----------------------------------------------------------------------------- +# for compatibility with the S4 system +methods::setOldClass(c("pizza_percent", "vctrs_vctr")) + +## ----------------------------------------------------------------------------- +#' `percent` vector +#' +#' This creates a double vector that represents percentages so when it is +#' printed, it is multiplied by 100 and suffixed with `%`. +#' +#' @param x A numeric vector +#' @return An S3 vector of class `pizza_percent`. +#' @export +#' @examples +#' percent(c(0.25, 0.5, 0.75)) +percent <- function(x = double()) { + x <- vec_cast(x, double()) + new_percent(x) +} + +## ----------------------------------------------------------------------------- +#' @export +#' @rdname percent +is_percent <- function(x) { + inherits(x, "pizza_percent") +} + +## ----------------------------------------------------------------------------- +#' @param x +#' * For `percent()`: A numeric vector +#' * For `is_percent()`: An object to test. + +## ----eval = FALSE------------------------------------------------------------- +# #' @export +# format.pizza_percent <- function(x, ...) { +# out <- formatC(signif(vec_data(x) * 100, 3)) +# out[is.na(x)] <- NA +# out[!is.na(x)] <- paste0(out[!is.na(x)], "%") +# out +# } +# +# #' @export +# vec_ptype_abbr.pizza_percent <- function(x, ...) { +# "prcnt" +# } + +## ----eval = FALSE------------------------------------------------------------- +# #' @export +# vec_ptype2.vctrs_percent.vctrs_percent <- function(x, y, ...) new_percent() +# #' @export +# vec_ptype2.double.vctrs_percent <- function(x, y, ...) double() +# +# #' @export +# vec_cast.pizza_percent.pizza_percent <- function(x, to, ...) x +# #' @export +# vec_cast.pizza_percent.double <- function(x, to, ...) percent(x) +# #' @export +# vec_cast.double.pizza_percent <- function(x, to, ...) vec_data(x) + +## ----eval=FALSE--------------------------------------------------------------- +# #' @export +# #' @method vec_arith my_type +# vec_arith.my_type <- function(op, x, y, ...) { +# UseMethod("vec_arith.my_type", y) +# } + +## ----eval=FALSE--------------------------------------------------------------- +# #' @export +# #' @method vec_arith.my_type my_type +# vec_arith.my_type.my_type <- function(op, x, y, ...) { +# # implementation here +# } +# +# #' @export +# #' @method vec_arith.my_type integer +# vec_arith.my_type.integer <- function(op, x, y, ...) { +# # implementation here +# } +# +# #' @export +# #' @method vec_arith.integer my_type +# vec_arith.integer.my_type <- function(op, x, y, ...) { +# # implementation here +# } + +## ----eval = FALSE------------------------------------------------------------- +# expect_error(vec_c(1, "a"), class = "vctrs_error_incompatible_type") + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/s3-vector.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/s3-vector.Rmd new file mode 100644 index 00000000..dce4b162 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/s3-vector.Rmd @@ -0,0 +1,1352 @@ +--- +title: "S3 vectors" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{S3 vectors} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +set.seed(1014) +``` + +This vignette shows you how to create your own S3 vector classes. +It focuses on the aspects of making a vector class that every class needs to worry about; you'll also need to provide methods that actually make the vector useful. + +I assume that you're already familiar with the basic machinery of S3, and the vocabulary I use in Advanced R: constructor, helper, and validator. +If not, I recommend reading at least the first two sections of [the S3 chapter](https://adv-r.hadley.nz/s3.html) of *Advanced R*. + +This article refers to "vectors of numbers" as *double vectors*. +Here, "double" stands for ["double precision floating point number"](https://en.wikipedia.org/wiki/Double-precision_floating-point_format), see also `double()`. + +```{r setup} +library(vctrs) +library(rlang) +library(zeallot) +``` + +This vignette works through five big topics: + +- The basics of creating a new vector class with vctrs. +- The coercion and casting system. +- The record and list-of types. +- Equality and comparison proxies. +- Arithmetic operators. + +They're collectively demonstrated with a number of simple S3 classes: + +- Percent: a double vector that prints as a percentage. + This illustrates the basic mechanics of class creation, coercion, and casting. + +- Decimal: a double vector that always prints with a fixed number of decimal places. + This class has an attribute which needs a little extra care in casts and coercions. + +- Cached sum: a double vector that caches the total sum in an attribute. + The attribute depends on the data, so needs extra care. + +- Rational: a pair of integer vectors that defines a rational number like `2 / 3`. + This introduces you to the record style, and to the equality and comparison operators. + It also needs special handling for `+`, `-`, and friends. + +- Polynomial: a list of integer vectors that define polynomials like `1 + x - x^3`. + Sorting such vectors correctly requires a custom equality method. + +- Meter: a numeric vector with meter units. + This is the simplest possible class with interesting algebraic properties. + +- Period and frequency: a pair of classes represent a period, or its inverse, frequency. + This allows us to explore more arithmetic operators. + +## Basics + +In this section you'll learn how to create a new vctrs class by calling `new_vctr()`. +This creates an object with class `vctrs_vctr` which has a number of methods. +These are designed to make your life as easy as possible. +For example: + +- The `print()` and `str()` methods are defined in terms of `format()` so you get a pleasant, consistent display as soon as you've made your `format()` method. + +- You can immediately put your new vector class in a data frame because `as.data.frame.vctrs_vctr()` does the right thing. + +- Subsetting (`[`, `[[`, and `$`), `length<-`, and `rep()` methods automatically preserve attributes because they use `vec_restore()`. + A default `vec_restore()` works for all classes where the attributes are data-independent, and can easily be customised when the attributes do depend on the data. + +- Default subset-assignment methods (`[<-`, `[[<-`, and `$<-`) follow the principle that the new values should be coerced to match the existing vector. + This gives predictable behaviour and clear error messages. + +### Percent class + +In this section, I'll show you how to make a `percent` class, i.e., a double vector that is printed as a percentage. +We start by defining a low-level [constructor](https://adv-r.hadley.nz/s3.html#s3-constrcutor) to check types and/or sizes and call `new_vctr()`. + +`percent` is built on a double vector of any length and doesn't have any attributes. + +```{r} +new_percent <- function(x = double()) { + if (!is_double(x)) { + abort("`x` must be a double vector.") + } + new_vctr(x, class = "vctrs_percent") +} + +x <- new_percent(c(seq(0, 1, length.out = 4), NA)) +x + +str(x) +``` + +Note that we prefix the name of the class with the name of the package. +This prevents conflicting definitions between packages. +For packages that implement only one class (such as [blob](https://blob.tidyverse.org/)), it's fine to use the package name without prefix as the class name. + +We then follow up with a user friendly [helper](https://adv-r.hadley.nz/s3.html#helpers). +Here we'll use `vec_cast()` to allow it to accept anything coercible to a double: + +```{r} +percent <- function(x = double()) { + x <- vec_cast(x, double()) + new_percent(x) +} +``` + +Before you go on, check that user-friendly constructor returns a zero-length vector when called with no arguments. +This makes it easy to use as a prototype. + +```{r} +new_percent() +percent() +``` + +For the convenience of your users, consider implementing an `is_percent()` function: + +```{r} +is_percent <- function(x) { + inherits(x, "vctrs_percent") +} +``` + +### `format()` method + +The first method for every class should almost always be a `format()` method. +This should return a character vector the same length as `x`. +The easiest way to do this is to rely on one of R's low-level formatting functions like `formatC()`: + +```{r} +format.vctrs_percent <- function(x, ...) { + out <- formatC(signif(vec_data(x) * 100, 3)) + out[is.na(x)] <- NA + out[!is.na(x)] <- paste0(out[!is.na(x)], "%") + out +} +``` + +```{r, include = FALSE} +# As of R 3.5, print.vctr can not find format.percent since it's not in +# its lexical environment. We fix that problem by manually registering. +s3_register("base::format", "vctrs_percent") +``` + +```{r} +x +``` + +(Note the use of `vec_data()` so `format()` doesn't get stuck in an infinite loop, and that I take a little care to not convert `NA` to `"NA"`; this leads to better printing.) + +The format method is also used by data frames, tibbles, and `str()`: + +```{r} +data.frame(x) +``` + +For optimal display, I recommend also defining an abbreviated type name, which should be 4-5 letters for commonly used vectors. +This is used in tibbles and in `str()`: + +```{r} +vec_ptype_abbr.vctrs_percent <- function(x, ...) { + "prcnt" +} + +tibble::tibble(x) + +str(x) +``` + +If you need more control over printing in tibbles, implement a method for `pillar::pillar_shaft()`. +See `vignette("pillar", package = "vctrs")` for details. + +## Casting and coercion + +The next set of methods you are likely to need are those related to coercion and casting. +Coercion and casting are two sides of the same coin: changing the prototype of an existing object. +When the change happens *implicitly* (e.g in `c()`) we call it **coercion**; when the change happens *explicitly* (e.g. with `as.integer(x)`), we call it **casting**. + +One of the main goals of vctrs is to put coercion and casting on a robust theoretical footing so it's possible to make accurate predictions about what (e.g.) `c(x, y)` should do when `x` and `y` have different prototypes. +vctrs achieves this goal through two generics: + +- `vec_ptype2(x, y)` defines possible set of coercions. + It returns a prototype if `x` and `y` can be safely coerced to the same prototype; otherwise it returns an error. + The set of automatic coercions is usually quite small because too many tend to make code harder to reason about and silently propagate mistakes. + +- `vec_cast(x, to)` defines the possible sets of casts. + It returns `x` translated to have prototype `to`, or throws an error if the conversion isn't possible. + The set of possible casts is a superset of possible coercions because they're requested explicitly. + +### Double dispatch + +Both generics use [**double dispatch**](https://en.wikipedia.org/wiki/Double_dispatch) which means that the implementation is selected based on the class of two arguments, not just one. +S3 does not natively support double dispatch, so we implement our own dispatch mechanism. +In practice, this means: + +- You end up with method names with two classes, like `vec_ptype2.foo.bar()`. + +- You don't need to implement default methods (they would never be called if you do). + +- You can't call `NextMethod()`. + +### Percent class {#percent} + +We'll make our percent class coercible back and forth with double vectors. + +`vec_ptype2()` provides a user friendly error message if the coercion doesn't exist and makes sure `NA` is handled in a standard way. +`NA` is technically a logical vector, but we want to stand in for a missing value of any type. + +```{r, error = TRUE} +vec_ptype2("bogus", percent()) +vec_ptype2(percent(), NA) +vec_ptype2(NA, percent()) +``` + +By default and in simple cases, an object of the same class is compatible with itself: + +```{r} +vec_ptype2(percent(), percent()) +``` + +However this only works if the attributes for both objects are the same. +Also the default methods are a bit slower. +It is always a good idea to provide an explicit coercion method for the case of identical classes. +So we'll start by saying that a `vctrs_percent` combined with a `vctrs_percent` yields a `vctrs_percent`, which we indicate by returning a prototype generated by the constructor. + +```{r} +vec_ptype2.vctrs_percent.vctrs_percent <- function(x, y, ...) new_percent() +``` + +Next we define methods that say that combining a `percent` and double should yield a `double`. +We avoid returning a `percent` here because errors in the scale (1 vs. 0.01) are more obvious with raw numbers. + +Because double dispatch is a bit of a hack, we need to provide two methods. +It's your responsibility to ensure that each member of the pair returns the same result: if they don't you will get weird and unpredictable behaviour. + +The double dispatch mechanism requires us to refer to the underlying type, `double`, in the method name. +If we implemented `vec_ptype2.vctrs_percent.numeric()`, it would never be called. + +```{r} +vec_ptype2.vctrs_percent.double <- function(x, y, ...) double() +vec_ptype2.double.vctrs_percent <- function(x, y, ...) double() +``` + +We can check that we've implemented this correctly with `vec_ptype_show()`: + +```{r} +vec_ptype_show(percent(), double(), percent()) +``` + +The `vec_ptype2()` methods define which input is the richer type that vctrs should coerce to. +However, they don't perform any conversion. +This is the job of `vec_cast()`, which we implement next. +We'll provide a method to cast a percent to a percent: + +```{r} +vec_cast.vctrs_percent.vctrs_percent <- function(x, to, ...) x +``` + +And then for converting back and forth between doubles. +To convert a double to a percent we use the `percent()` helper (not the constructor; this is unvalidated user input). +To convert a `percent` to a double, we strip the attributes. + +Note that for historical reasons the order of argument in the signature is the opposite as for `vec_ptype2()`. +The class for `to` comes first, and the class for `x` comes second. + +Again, the double dispatch mechanism requires us to refer to the underlying type, `double`, in the method name. +Implementing `vec_cast.vctrs_percent.numeric()` has no effect. + +```{r} +vec_cast.vctrs_percent.double <- function(x, to, ...) percent(x) +vec_cast.double.vctrs_percent <- function(x, to, ...) vec_data(x) +``` + +Then we can check this works with `vec_cast()`: + +```{r} +vec_cast(0.5, percent()) +vec_cast(percent(0.5), double()) +``` + +Once you've implemented `vec_ptype2()` and `vec_cast()`, you get `vec_c()`, `[<-`, and `[[<-` implementations for free. + +```{r, error = TRUE} +vec_c(percent(0.5), 1) +vec_c(NA, percent(0.5)) +# but +vec_c(TRUE, percent(0.5)) + +x <- percent(c(0.5, 1, 2)) +x[1:2] <- 2:1 +x[[3]] <- 0.5 +x +``` + +You'll also get mostly correct behaviour for `c()`. +The exception is when you use `c()` with a base R class: + +```{r, error = TRUE} +# Correct +c(percent(0.5), 1) +c(percent(0.5), factor(1)) + +# Incorrect +c(factor(1), percent(0.5)) +``` + +Unfortunately there's no way to fix this problem with the current design of `c()`. + +Again, as a convenience, consider providing an `as_percent()` function that makes use of the casts defined in your `vec_cast.vctrs_percent()` methods: + +```{r} +as_percent <- function(x) { + vec_cast(x, new_percent()) +} +``` + +Occasionally, it is useful to provide conversions that go beyond what's allowed in casting. +For example, we could offer a parsing method for character vectors. +In this case, `as_percent()` should be generic, the default method should cast, and then additional methods should implement more flexible conversion: + +```{r} +as_percent <- function(x, ...) { + UseMethod("as_percent") +} + +as_percent.default <- function(x, ...) { + vec_cast(x, new_percent()) +} + +as_percent.character <- function(x) { + value <- as.numeric(gsub(" *% *$", "", x)) / 100 + new_percent(value) +} +``` + +### Decimal class + +Now that you've seen the basics with a very simple S3 class, we'll gradually explore more complicated scenarios. +This section creates a `decimal` class that prints with the specified number of decimal places. +This is very similar to `percent` but now the class needs an attribute: the number of decimal places to display (an integer vector of length 1). + +We start off as before, defining a low-level constructor, a user-friendly constructor, a `format()` method, and a `vec_ptype_abbr()`. +Note that additional object attributes are simply passed along to `new_vctr()`: + +```{r} +new_decimal <- function(x = double(), digits = 2L) { + if (!is_double(x)) { + abort("`x` must be a double vector.") + } + if (!is_integer(digits)) { + abort("`digits` must be an integer vector.") + } + vec_check_size(digits, size = 1L) + + new_vctr(x, digits = digits, class = "vctrs_decimal") +} + +decimal <- function(x = double(), digits = 2L) { + x <- vec_cast(x, double()) + digits <- vec_recycle(vec_cast(digits, integer()), 1L) + + new_decimal(x, digits = digits) +} + +digits <- function(x) attr(x, "digits") + +format.vctrs_decimal <- function(x, ...) { + sprintf(paste0("%-0.", digits(x), "f"), x) +} + +vec_ptype_abbr.vctrs_decimal <- function(x, ...) { + "dec" +} + +x <- decimal(runif(10), 1L) +x +``` + +Note that I provide a little helper to extract the `digits` attribute. +This makes the code a little easier to read and should not be exported. + +By default, vctrs assumes that attributes are independent of the data and so are automatically preserved. +You'll see what to do if the attributes are data dependent in the next section. + +```{r} +x[1:2] +x[[1]] +``` + +For the sake of exposition, we'll assume that `digits` is an important attribute of the class and should be included in the full type: + +```{r} +vec_ptype_full.vctrs_decimal <- function(x, ...) { + paste0("decimal<", digits(x), ">") +} + +x +``` + +Now consider `vec_cast()` and `vec_ptype2()`. +Casting and coercing from one decimal to another requires a little thought as the values of the `digits` attribute might be different, and we need some way to reconcile them. +Here I've decided to chose the maximum of the two; other reasonable options are to take the value from the left-hand side or throw an error. + +```{r} +vec_ptype2.vctrs_decimal.vctrs_decimal <- function(x, y, ...) { + new_decimal(digits = max(digits(x), digits(y))) +} +vec_cast.vctrs_decimal.vctrs_decimal <- function(x, to, ...) { + new_decimal(vec_data(x), digits = digits(to)) +} + +vec_c(decimal(1/100, digits = 3), decimal(2/100, digits = 2)) +``` + +Finally, I can implement coercion to and from other types, like doubles. +When automatically coercing, I choose the richer type (i.e., the decimal). + +```{r} +vec_ptype2.vctrs_decimal.double <- function(x, y, ...) x +vec_ptype2.double.vctrs_decimal <- function(x, y, ...) y + +vec_cast.vctrs_decimal.double <- function(x, to, ...) new_decimal(x, digits = digits(to)) +vec_cast.double.vctrs_decimal <- function(x, to, ...) vec_data(x) + +vec_c(decimal(1, digits = 1), pi) +vec_c(pi, decimal(1, digits = 1)) +``` + +If type `x` has greater resolution than `y`, there will be some inputs that lose precision. +These should generate errors using `stop_lossy_cast()`. +You can see that in action when casting from doubles to integers; only some doubles can become integers without losing resolution. + +```{r, error = TRUE} +vec_cast(c(1, 2, 10), to = integer()) + +vec_cast(c(1.5, 2, 10.5), to = integer()) +``` + +### Cached sum class {#cached-sum} + +The next level up in complexity is an object that has data-dependent attributes. +To explore this idea we'll create a vector that caches the sum of its values. +As usual, we start with low-level and user-friendly constructors: + +```{r} +new_cached_sum <- function(x = double(), sum = 0L) { + if (!is_double(x)) { + abort("`x` must be a double vector.") + } + if (!is_double(sum)) { + abort("`sum` must be a double vector.") + } + vec_check_size(sum, size = 1L) + + new_vctr(x, sum = sum, class = "vctrs_cached_sum") +} + +cached_sum <- function(x) { + x <- vec_cast(x, double()) + new_cached_sum(x, sum(x)) +} +``` + +For this class, we can use the default `format()` method, and instead, we'll customise the `obj_print_footer()` method. +This is a good place to display user facing attributes. + +```{r} +obj_print_footer.vctrs_cached_sum <- function(x, ...) { + cat("# Sum: ", format(attr(x, "sum"), digits = 3), "\n", sep = "") +} + +x <- cached_sum(runif(10)) +x +``` + +We'll also override `sum()` and `mean()` to use the attribute. +This is easiest to do with `vec_math()`, which you'll learn about later. + +```{r} +vec_math.vctrs_cached_sum <- function(.fn, .x, ...) { + cat("Using cache\n") + switch(.fn, + sum = attr(.x, "sum"), + mean = attr(.x, "sum") / length(.x), + vec_math_base(.fn, .x, ...) + ) +} + +sum(x) +``` + +As mentioned above, vctrs assumes that attributes are independent of the data. +This means that when we take advantage of the default methods, they'll work, but return the incorrect result: + +```{r} +x[1:2] +``` + +To fix this, you need to provide a `vec_restore()` method. +Note that this method dispatches on the `to` argument. + +```{r} +vec_restore.vctrs_cached_sum <- function(x, to, ..., i = NULL) { + new_cached_sum(x, sum(x)) +} + +x[1] +``` + +This works because most of the vctrs methods dispatch to the underlying base function by first stripping off extra attributes with `vec_data()` and then reapplying them again with `vec_restore()`. +The default `vec_restore()` method copies over all attributes, which is not appropriate when the attributes depend on the data. + +Note that `vec_restore.class` is subtly different from `vec_cast.class.class()`. +`vec_restore()` is used when restoring attributes that have been lost; `vec_cast()` is used for coercions. +This is easier to understand with a concrete example. +Imagine factors were implemented with `new_vctr()`. +`vec_restore.factor()` would restore attributes back to an integer vector, but you would not want to allow manually casting an integer to a factor with `vec_cast()`. + +## Record-style objects + +Record-style objects use a list of equal-length vectors to represent individual components of the object. +The best example of this is `POSIXlt`, which underneath the hood is a list of 11 fields like year, month, and day. +Record-style classes override `length()` and subsetting methods to conceal this implementation detail. + +```{r} +x <- as.POSIXlt(ISOdatetime(2020, 1, 1, 0, 0, 1:3)) +x + +length(x) +length(unclass(x)) + +x[[1]] # the first date time +unclass(x)[[1]] # the first component, the number of seconds +``` + +vctrs makes it easy to create new record-style classes using `new_rcrd()`, which has a wide selection of default methods. + +### Rational class + +A fraction, or rational number, can be represented by a pair of integer vectors representing the numerator (the number on top) and the denominator (the number on bottom), where the length of each vector must be the same. +To represent such a data structure we turn to a new base data type: the record (or rcrd for short). + +As usual we start with low-level and user-friendly constructors. +The low-level constructor calls `new_rcrd()`, which needs a named list of equal-length vectors. + +```{r} +new_rational <- function(n = integer(), d = integer()) { + if (!is_integer(n)) { + abort("`n` must be an integer vector.") + } + if (!is_integer(d)) { + abort("`d` must be an integer vector.") + } + + new_rcrd(list(n = n, d = d), class = "vctrs_rational") +} +``` + +Our user friendly constructor casts `n` and `d` to integers and recycles them to the same length. + +```{r} +rational <- function(n = integer(), d = integer()) { + c(n, d) %<-% vec_cast_common(n, d, .to = integer()) + c(n, d) %<-% vec_recycle_common(n, d) + + new_rational(n, d) +} + +x <- rational(1, 1:10) +``` + +Behind the scenes, `x` is a named list with two elements. +But those details are hidden so that it behaves like a vector: + +```{r} +names(x) +length(x) +``` + +To access the underlying fields we need to use `field()` and `fields()`: + +```{r} +fields(x) +field(x, "n") +``` + +Notice that we can't `print()` or `str()` the new rational vector `x` yet. +Printing causes an error: + +```{r, error = TRUE} +x + +str(x) +``` + +This is because we haven't defined how our class can be printed from the underlying data. +Note that if you want to look under the hood during development, you can always call `vec_data(x)`. + +```{r} +vec_data(x) + +str(vec_data(x)) +``` + +It is generally best to define a formatting method early in the development of a class. +The format method defines how to display the class so that it can be printed in the normal way: + +```{r} +format.vctrs_rational <- function(x, ...) { + n <- field(x, "n") + d <- field(x, "d") + + out <- paste0(n, "/", d) + out[is.na(n) | is.na(d)] <- NA + + out +} + +vec_ptype_abbr.vctrs_rational <- function(x, ...) "rtnl" +vec_ptype_full.vctrs_rational <- function(x, ...) "rational" + +x +``` + +vctrs uses the `format()` method in `str()`, hiding the underlying implementation details from the user: + +```{r} +str(x) +``` + +For `rational`, `vec_ptype2()` and `vec_cast()` follow the same pattern as `percent()`. +We allow coercion from integer and to doubles. + +```{r} +vec_ptype2.vctrs_rational.vctrs_rational <- function(x, y, ...) new_rational() +vec_ptype2.vctrs_rational.integer <- function(x, y, ...) new_rational() +vec_ptype2.integer.vctrs_rational <- function(x, y, ...) new_rational() + +vec_cast.vctrs_rational.vctrs_rational <- function(x, to, ...) x +vec_cast.double.vctrs_rational <- function(x, to, ...) field(x, "n") / field(x, "d") +vec_cast.vctrs_rational.integer <- function(x, to, ...) rational(x, 1) + +vec_c(rational(1, 2), 1L, NA) +``` + +### Decimal2 class + +The previous implementation of `decimal` was built on top of doubles. +This is a bad idea because decimal vectors are typically used when you care about precise values (i.e., dollars and cents in a bank account), and double values suffer from floating point problems. + +A better implementation of a decimal class would be to use pair of integers, one for the value to the left of the decimal point, and the other for the value to the right (divided by a `scale`). +The following code is a very quick sketch of how you might start creating such a class: + +```{r} +new_decimal2 <- function(l, r, scale = 2L) { + if (!is_integer(l)) { + abort("`l` must be an integer vector.") + } + if (!is_integer(r)) { + abort("`r` must be an integer vector.") + } + if (!is_integer(scale)) { + abort("`scale` must be an integer vector.") + } + vec_check_size(scale, size = 1L) + + new_rcrd(list(l = l, r = r), scale = scale, class = "vctrs_decimal2") +} + +decimal2 <- function(l, r, scale = 2L) { + l <- vec_cast(l, integer()) + r <- vec_cast(r, integer()) + c(l, r) %<-% vec_recycle_common(l, r) + scale <- vec_cast(scale, integer()) + + # should check that r < 10^scale + new_decimal2(l = l, r = r, scale = scale) +} + +format.vctrs_decimal2 <- function(x, ...) { + val <- field(x, "l") + field(x, "r") / 10^attr(x, "scale") + sprintf(paste0("%.0", attr(x, "scale"), "f"), val) +} + +decimal2(10, c(0, 5, 99)) +``` + +## Equality and comparison + +vctrs provides four "proxy" generics. +Two of these let you control how your class determines equality and comparison: + +- `vec_proxy_equal()` returns a data vector suitable for comparison. + It underpins `==`, `!=`, `unique()`, `anyDuplicated()`, and `is.na()`. + +- `vec_proxy_compare()` specifies how to compare the elements of your vector. + This proxy is used in `<`, `<=`, `>=`, `>`, `min()`, `max()`, `median()`, and `quantile()`. + +Two other proxy generic are used for sorting for unordered data types and for accessing the raw data for exotic storage formats: + +- `vec_proxy_order()` specifies how to sort the elements of your vector. + It is used in `xtfrm()`, which in turn is called by the `order()` and `sort()` functions. + + This proxy was added to implement the behaviour of lists, which are sortable (their order proxy sorts by first occurrence) but not comparable (comparison operators cause an error). + Its default implementation for other classes calls `vec_proxy_compare()` and you normally don't need to implement this proxy. + +- `vec_proxy()` returns the actual data of a vector. + This is useful when you store the data in a field of your class. + Most of the time, you shouldn't need to implement `vec_proxy()`. + +The default behavior is as follows: + +- `vec_proxy_equal()` calls `vec_proxy()` +- `vec_proxy_compare()` calls `vec_proxy_equal()` +- `vec_proxy_order()` calls `vec_proxy_compare()` + +You should only implement these proxies when some preprocessing on the data is needed to make elements comparable. +In that case, defining these methods will get you a lot of behaviour for relatively little work. + +These proxy functions should always return a simple object (either a bare vector or a data frame) that possesses the same properties as your class. +This permits efficient implementation of the vctrs internals because it allows dispatch to happen once in R, and then efficient computations can be written in C. + +### Rational class + +Let's explore these ideas by with the rational class we started on above. +By default, `vec_proxy()` converts a record to a data frame, and the default comparison works column by column: + +```{r} +x <- rational(c(1, 2, 1, 2), c(1, 1, 2, 2)) +x + +vec_proxy(x) + +x == rational(1, 1) +``` + +This makes sense as a default but isn't correct here because `rational(1, 1)` represents the same number as `rational(2, 2)`, so they should be equal. +We can fix that by implementing a `vec_proxy_equal()` method that divides `n` and `d` by their greatest common divisor: + +```{r} +# Thanks to Matthew Lundberg: https://stackoverflow.com/a/21504113/16632 +gcd <- function(x, y) { + r <- x %% y + ifelse(r, gcd(y, r), y) +} + +vec_proxy_equal.vctrs_rational <- function(x, ...) { + n <- field(x, "n") + d <- field(x, "d") + gcd <- gcd(n, d) + + data.frame(n = n / gcd, d = d / gcd) +} +vec_proxy_equal(x) + +x == rational(1, 1) +``` + +`vec_proxy_equal()` is also used by `unique()`: + +```{r} +unique(x) +``` + +We now need to fix the comparison operations similarly, since comparison currently happens lexicographically by `n`, then by `d`: + +```{r} +rational(1, 2) < rational(2, 3) +rational(2, 4) < rational(2, 3) +``` + +The easiest fix is to convert the fraction to a floating point number and use this as a proxy: + +```{r} +vec_proxy_compare.vctrs_rational <- function(x, ...) { + field(x, "n") / field(x, "d") +} + +rational(2, 4) < rational(2, 3) +``` + +This also fixes `sort()`, because the default implementation of `vec_proxy_order()` calls `vec_proxy_compare()`. + +```{r} +sort(x) +``` + +(We could have used the same approach in `vec_proxy_equal()`, but when working with floating point numbers it's not necessarily true that `x == y` implies that `d * x == d * y`.) + +### Polynomial class + +A related problem occurs if we build our vector on top of a list. +The following code defines a polynomial class that represents polynomials (like `1 + 3x - 2x^2`) using a list of integer vectors (like `c(1, 3, -2)`). +Note the use of `new_list_of()` in the constructor. + +```{r} +poly <- function(...) { + x <- vec_cast_common(..., .to = integer()) + new_poly(x) +} +new_poly <- function(x) { + new_list_of(x, ptype = integer(), class = "vctrs_poly_list") +} + +vec_ptype_full.vctrs_poly_list <- function(x, ...) "polynomial" +vec_ptype_abbr.vctrs_poly_list <- function(x, ...) "poly" + +format.vctrs_poly_list <- function(x, ...) { + format_one <- function(x) { + if (length(x) == 0) { + return("") + } + + if (length(x) == 1) { + format(x) + } else { + suffix <- c(paste0("\u22C5x^", seq(length(x) - 1, 1)), "") + out <- paste0(x, suffix) + out <- out[x != 0L] + paste0(out, collapse = " + ") + } + } + + vapply(x, format_one, character(1)) +} + +obj_print_data.vctrs_poly_list <- function(x, ...) { + if (length(x) != 0) { + print(format(x), quote = FALSE) + } +} + +p <- poly(1, c(1, 0, 0, 0, 2), c(1, 0, 1)) +p +``` + +The resulting objects will inherit from the `vctrs_list_of` class, which provides tailored methods for `$`, `[[`, the corresponding assignment operators, and other methods. + +```{r} +class(p) +p[2] +p[[2]] +``` + +The class implements the list interface: + +```{r} +obj_is_list(p) +``` + +This is fine for the internal implementation of this class but it would be more appropriate if it behaved like an atomic vector rather than a list. + +#### Make an atomic polynomial vector + +An atomic vector is a vector like integer or character for which `[[` returns the same type. +Unlike lists, you can't reach inside an atomic vector. + +To make the polynomial class an atomic vector, we'll wrap the internal `list_of()` class within a record vector. +Usually records are used because they can store several fields of data for each observation. +Here we have only one, but we use the class anyway to inherit its atomicity. + +```{r} +poly <- function(...) { + x <- vec_cast_common(..., .to = integer()) + x <- new_poly(x) + new_rcrd(list(data = x), class = "vctrs_poly") +} +format.vctrs_poly <- function(x, ...) { + format(field(x, "data")) +} +``` + +The new `format()` method delegates to the one we wrote for the internal list. +The vector looks just like before: + +```{r} +p <- poly(1, c(1, 0, 0, 0, 2), c(1, 0, 1)) +p +``` + +Making the class atomic means that `obj_is_list()` now returns `FALSE`. +This prevents recursive algorithms that traverse lists from reaching too far inside the polynomial internals. + +```{r} +obj_is_list(p) +``` + +Most importantly, it prevents users from reaching into the internals with `[[`: + +```{r} +p[[2]] +``` + +#### Implementing equality and comparison + +Equality works out of the box because we can tell if two integer vectors are equal: + +```{r} +p == poly(c(1, 0, 1)) +``` + +We can't compare individual elements, because the data is stored in a list and by default lists are not comparable: + +```{r, error = TRUE} +p < p[2] +``` + +To enable comparison, we implement a `vec_proxy_compare()` method: + +```{r} +vec_proxy_compare.vctrs_poly <- function(x, ...) { + # Get the list inside the record vector + x_raw <- vec_data(field(x, "data")) + + # First figure out the maximum length + n <- max(vapply(x_raw, length, integer(1))) + + # Then expand all vectors to this length by filling in with zeros + full <- lapply(x_raw, function(x) c(rep(0L, n - length(x)), x)) + + # Then turn into a data frame + as.data.frame(do.call(rbind, full)) +} + +p < p[2] +``` + +Often, this is sufficient to also implement `sort()`. +However, for lists, there is already a default `vec_proxy_order()` method that sorts by first occurrence: + +```{r} +sort(p) +sort(p[c(1:3, 1:2)]) +``` + +To ensure consistency between ordering and comparison, we forward `vec_proxy_order()` to `vec_proxy_compare()`: + +```{r} +vec_proxy_order.vctrs_poly <- function(x, ...) { + vec_proxy_compare(x, ...) +} + +sort(p) +``` + +## Arithmetic + +vctrs also provides two mathematical generics that allow you to define a broad swath of mathematical behaviour at once: + +- `vec_math(fn, x, ...)` specifies the behaviour of mathematical functions like `abs()`, `sum()`, and `mean()`. + (Note that `var()` and `sd()` can't be overridden, see `?vec_math()` for the complete list supported by `vec_math()`.) + +- `vec_arith(op, x, y)` specifies the behaviour of the arithmetic operations like `+`, `-`, and `%%`. + (See `?vec_arith()` for the complete list.) + +Both generics define the behaviour for multiple functions because `sum.vctrs_vctr(x)` calls `vec_math.vctrs_vctr("sum", x)`, and `x + y` calls `vec_math.x_class.y_class("+", x, y)`. +They're accompanied by `vec_math_base()` and `vec_arith_base()` which make it easy to call the underlying base R functions. + +`vec_arith()` uses double dispatch and needs the following standard boilerplate: + +```{r} +vec_arith.MYCLASS <- function(op, x, y, ...) { + UseMethod("vec_arith.MYCLASS", y) +} +vec_arith.MYCLASS.default <- function(op, x, y, ...) { + stop_incompatible_op(op, x, y) +} +``` + +Correctly exporting `vec_arith()` methods from a package is currently a little awkward. +See the instructions in the Arithmetic section of the "Implementing a vctrs S3 class in a package" section below. + +### Cached sum class + +I showed an example of `vec_math()` to define `sum()` and `mean()` methods for `cached_sum`. +Now let's talk about exactly how it works. +Most `vec_math()` functions will have a similar form. +You use a switch statement to handle the methods that you care about and fall back to `vec_math_base()` for those that you don't care about. + +```{r} +vec_math.vctrs_cached_sum <- function(.fn, .x, ...) { + switch(.fn, + sum = attr(.x, "sum"), + mean = attr(.x, "sum") / length(.x), + vec_math_base(.fn, .x, ...) + ) +} +``` + +### Meter class + +To explore the infix arithmetic operators exposed by `vec_arith()` I'll create a new class that represents a measurement in `meter`s: + +```{r} +new_meter <- function(x) { + stopifnot(is.double(x)) + new_vctr(x, class = "vctrs_meter") +} + +format.vctrs_meter <- function(x, ...) { + paste0(format(vec_data(x)), " m") +} + +meter <- function(x) { + x <- vec_cast(x, double()) + new_meter(x) +} + +x <- meter(1:10) +x +``` + +Because `meter` is built on top of a double vector, basic mathematic operations work: + +```{r} +sum(x) +mean(x) +``` + +But we can't do arithmetic: + +```{r, error = TRUE} +x + 1 +meter(10) + meter(1) +meter(10) * 3 +``` + +To allow these infix functions to work, we'll need to provide `vec_arith()` generic. +But before we do that, let's think about what combinations of inputs we should support: + +- It makes sense to add and subtract meters: that yields another meter. + We can divide a meter by another meter (yielding a unitless number), but we can't multiply meters (because that would yield an area). + +- For a combination of meter and number multiplication and division by a number are acceptable. + Addition and subtraction don't make much sense as we, strictly speaking, are dealing with objects of different nature. + +`vec_arith()` is another function that uses double dispatch, so as usual we start with a template. + +```{r} +vec_arith.vctrs_meter <- function(op, x, y, ...) { + UseMethod("vec_arith.vctrs_meter", y) +} +vec_arith.vctrs_meter.default <- function(op, x, y, ...) { + stop_incompatible_op(op, x, y) +} +``` + +Then write the method for two meter objects. +We use a switch statement to cover the cases we care about and `stop_incompatible_op()` to throw an informative error message for everything else. + +```{r, error = TRUE} +vec_arith.vctrs_meter.vctrs_meter <- function(op, x, y, ...) { + switch( + op, + "+" = , + "-" = new_meter(vec_arith_base(op, x, y)), + "/" = vec_arith_base(op, x, y), + stop_incompatible_op(op, x, y) + ) +} + +meter(10) + meter(1) +meter(10) - meter(1) +meter(10) / meter(1) +meter(10) * meter(1) +``` + +Next we write the pair of methods for arithmetic with a meter and a number. +These are almost identical, but while `meter(10) / 2` makes sense, `2 / meter(10)` does not (and neither do addition and subtraction). +To support both doubles and integers as operands, we dispatch over `numeric` here instead of `double`. + +```{r, error = TRUE} +vec_arith.vctrs_meter.numeric <- function(op, x, y, ...) { + switch( + op, + "/" = , + "*" = new_meter(vec_arith_base(op, x, y)), + stop_incompatible_op(op, x, y) + ) +} +vec_arith.numeric.vctrs_meter <- function(op, x, y, ...) { + switch( + op, + "*" = new_meter(vec_arith_base(op, x, y)), + stop_incompatible_op(op, x, y) + ) +} + +meter(2) * 10 +meter(2) * as.integer(10) +10 * meter(2) +meter(20) / 10 +10 / meter(20) +meter(20) + 10 +``` + +For completeness, we also need `vec_arith.vctrs_meter.MISSING` for the unary `+` and `-` operators: + +```{r} +vec_arith.vctrs_meter.MISSING <- function(op, x, y, ...) { + switch(op, + `-` = x * -1, + `+` = x, + stop_incompatible_op(op, x, y) + ) +} +-meter(1) ++meter(1) +``` + +## Implementing a vctrs S3 class in a package + +Defining S3 methods interactively is fine for iteration and exploration, but if your class lives in a package, you need to do a few more things: + +- Register the S3 methods by listing them in the `NAMESPACE` file. + +- Create documentation around your methods, for the sake of your user and to satisfy `R CMD check`. + +Let's assume that the `percent` class is implemented in the pizza package in the file `R/percent.R`. +Here we walk through the major sections of this hypothetical file. +You've seen all of this code before, but now it's augmented by the roxygen2 directives that produce the correct `NAMESPACE` entries and help topics. + +### Getting started + +First, the pizza package needs to include vctrs in the `Imports` section of its `DESCRIPTION` (perhaps by calling `usethis::use_package("vctrs")`. +While vctrs is under very active development, it probably makes sense to state a minimum version. + + Imports: + a_package, + another_package, + ... + vctrs (>= x.y.z), + ... + +Then we make all vctrs functions available within the pizza package by including the directive `#' @import vctrs` somewhere. +Usually, it's not good practice to `@import` the entire namespace of a package, but vctrs is deliberately designed with this use case in mind. + +Where should we put `#' @import vctrs`? +There are two natural locations: + +- With package-level docs in `R/pizza-doc.R`. + You can use `usethis::use_package_doc()` to initiate this package-level documentation. + +- In `R/percent.R`. This makes the most sense when the vctrs S3 class is a modest and self-contained part of the overall package. + +We also must use one of these locations to dump some internal documentation that's needed to avoid `R CMD check` complaints. +We don't expect any human to ever read this documentation. +Here's how this dummy documentation should look, combined with the `#' @import vctrs` directive described above. + +```{r eval = FALSE} +#' Internal vctrs methods +#' +#' @import vctrs +#' @keywords internal +#' @name pizza-vctrs +NULL +``` + +This should appear in `R/pizza-doc.R` (package-level docs) or in `R/percent.R` (class-focused file). + +Remember to call `devtools::document()` regularly, as you develop, to regenerate `NAMESPACE` and the `.Rd` files. + +From this point on, the code shown is expected to appear in `R/percent.R`. + +### Low-level and user-friendly constructors + +Next we add our constructor: + +```{r} +new_percent <- function(x = double()) { + if (!is_double(x)) { + abort("`x` must be a double vector.") + } + new_vctr(x, class = "pizza_percent") +} +``` + +Note that the name of the package must be included in the class name (`pizza_percent`), but it does not need to be included in the constructor name. +You do not need to export the constructor, unless you want people to extend your class. + +We can also add a call to `setOldClass()` for compatibility with S4: + +```{r} +# for compatibility with the S4 system +methods::setOldClass(c("pizza_percent", "vctrs_vctr")) +``` + +Because we've used a function from the methods package, you'll also need to add methods to `Imports`, with (e.g.) `usethis::use_package("methods")`. +This is a "free" dependency because methods is bundled with every R install. + +Next we implement, export, and document a user-friendly helper: `percent()`. + +```{r} +#' `percent` vector +#' +#' This creates a double vector that represents percentages so when it is +#' printed, it is multiplied by 100 and suffixed with `%`. +#' +#' @param x A numeric vector +#' @return An S3 vector of class `pizza_percent`. +#' @export +#' @examples +#' percent(c(0.25, 0.5, 0.75)) +percent <- function(x = double()) { + x <- vec_cast(x, double()) + new_percent(x) +} +``` + +(Again note that the package name will appear in the class, but does not need to occur in the function, because we can already do `pizza::percent()`; it would be redundant to have `pizza::pizza_percent()`.) + +### Other helpers + +It's a good idea to provide a function that tests if an object is of this class. +If you do so, it makes sense to document it with the user-friendly constructor `percent()`: + +```{r} +#' @export +#' @rdname percent +is_percent <- function(x) { + inherits(x, "pizza_percent") +} +``` + +You'll also need to update the `percent()` documentation to reflect that `x` now means two different things: + +```{r} +#' @param x +#' * For `percent()`: A numeric vector +#' * For `is_percent()`: An object to test. +``` + +Next we provide the key methods to make printing work. +These are S3 methods, so they don't need to be documented, but they do need to be exported. + +```{r eval = FALSE} +#' @export +format.pizza_percent <- function(x, ...) { + out <- formatC(signif(vec_data(x) * 100, 3)) + out[is.na(x)] <- NA + out[!is.na(x)] <- paste0(out[!is.na(x)], "%") + out +} + +#' @export +vec_ptype_abbr.pizza_percent <- function(x, ...) { + "prcnt" +} +``` + +Finally, we implement methods for `vec_ptype2()` and `vec_cast()`. + +```{r, eval = FALSE} +#' @export +vec_ptype2.vctrs_percent.vctrs_percent <- function(x, y, ...) new_percent() +#' @export +vec_ptype2.double.vctrs_percent <- function(x, y, ...) double() + +#' @export +vec_cast.pizza_percent.pizza_percent <- function(x, to, ...) x +#' @export +vec_cast.pizza_percent.double <- function(x, to, ...) percent(x) +#' @export +vec_cast.double.pizza_percent <- function(x, to, ...) vec_data(x) +``` + +### Arithmetic + +Writing double dispatch methods for `vec_arith()` is currently more awkward than writing them for `vec_ptype2()` or `vec_cast()`. +We plan to improve this in the future. +For now, you can use the following instructions. + +If you define a new type and want to write `vec_arith()` methods for it, you'll need to provide a new single dispatch S3 generic for it of the following form: + +```{r, eval=FALSE} +#' @export +#' @method vec_arith my_type +vec_arith.my_type <- function(op, x, y, ...) { + UseMethod("vec_arith.my_type", y) +} +``` + +Note that this actually functions as both an S3 method for `vec_arith()` and an S3 generic called `vec_arith.my_type()` that dispatches off `y`. +roxygen2 only recognizes it as an S3 generic, so you have to register the S3 method part of this with an explicit `@method` call. + +After that, you can define double dispatch methods, but you still need an explicit `@method` tag to ensure it is registered with the correct generic: + +```{r, eval=FALSE} +#' @export +#' @method vec_arith.my_type my_type +vec_arith.my_type.my_type <- function(op, x, y, ...) { + # implementation here +} + +#' @export +#' @method vec_arith.my_type integer +vec_arith.my_type.integer <- function(op, x, y, ...) { + # implementation here +} + +#' @export +#' @method vec_arith.integer my_type +vec_arith.integer.my_type <- function(op, x, y, ...) { + # implementation here +} +``` + +vctrs provides the hybrid S3 generics/methods for most of the base R types, like `vec_arith.integer()`. +If you don't fully import vctrs with `@import vctrs`, then you will need to explicitly import the generic you are registering double dispatch methods for with `@importFrom vctrs vec_arith.integer`. + +### Testing + +It's good practice to test your new class. +Specific recommendations: + +- `R/percent.R` is the type of file where you really do want 100% test coverage. + You can use `devtools::test_coverage_file()` to check this. + +- Make sure to test behaviour with zero-length inputs and missing values. + +- Use `testthat::verify_output()` to test your format method. + Customised printing is often a primary motivation for creating your own S3 class in the first place, so this will alert you to unexpected changes in your printed output. + Read more about `verify_output()` in the [testthat v2.3.0 blog post](https://www.tidyverse.org/blog/2019/11/testthat-2-3-0/); it's an example of a so-called [golden test](https://ro-che.info/articles/2017-12-04-golden-tests). + +- Check for method symmetry; use `expect_s3_class()`, probably with `exact = TRUE`, to ensure that `vec_c(x, y)` and `vec_c(y, x)` return the same type of output for the important `x`s and `y`s in your domain. + +- Use `testthat::expect_error()` to check that inputs that can't be combined fail with an error. + Here, you should be generally checking the class of the error, not its message. + Relevant classes include `vctrs_error_assert_ptype`, `vctrs_error_assert_size`, and `vctrs_error_incompatible_type`. + + ```{r, eval = FALSE} + expect_error(vec_c(1, "a"), class = "vctrs_error_incompatible_type") + ``` + +If your tests pass when run by `devtools::test()`, but fail when run in `R CMD check`, it is very likely to reflect a problem with S3 method registration. +Carefully check your roxygen2 comments and the generated `NAMESPACE`. + +### Existing classes + +Before you build your own class, you might want to consider using, or subclassing existing classes. +You can check [awesome-vctrs](https://github.com/krlmlr/awesome-vctrs) for a curated list of R vector classes, some of which are built with vctrs. + +If you've built or extended a class, consider adding it to that list so other people can use it. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/s3-vector.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/s3-vector.html new file mode 100644 index 00000000..0267edae --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/s3-vector.html @@ -0,0 +1,1796 @@ + + + + + + + + + + + + + + +S3 vectors + + + + + + + + + + + + + + + + + + + + + + + + + + +

S3 vectors

+ + + +

This vignette shows you how to create your own S3 vector classes. It +focuses on the aspects of making a vector class that every class needs +to worry about; you’ll also need to provide methods that actually make +the vector useful.

+

I assume that you’re already familiar with the basic machinery of S3, +and the vocabulary I use in Advanced R: constructor, helper, and +validator. If not, I recommend reading at least the first two sections +of the S3 chapter of +Advanced R.

+

This article refers to “vectors of numbers” as double +vectors. Here, “double” stands for “double +precision floating point number”, see also +double().

+
library(vctrs)
+library(rlang)
+library(zeallot)
+

This vignette works through five big topics:

+
    +
  • The basics of creating a new vector class with vctrs.
  • +
  • The coercion and casting system.
  • +
  • The record and list-of types.
  • +
  • Equality and comparison proxies.
  • +
  • Arithmetic operators.
  • +
+

They’re collectively demonstrated with a number of simple S3 +classes:

+
    +
  • Percent: a double vector that prints as a percentage. This +illustrates the basic mechanics of class creation, coercion, and +casting.

  • +
  • Decimal: a double vector that always prints with a fixed number +of decimal places. This class has an attribute which needs a little +extra care in casts and coercions.

  • +
  • Cached sum: a double vector that caches the total sum in an +attribute. The attribute depends on the data, so needs extra +care.

  • +
  • Rational: a pair of integer vectors that defines a rational +number like 2 / 3. This introduces you to the record style, +and to the equality and comparison operators. It also needs special +handling for +, -, and friends.

  • +
  • Polynomial: a list of integer vectors that define polynomials +like 1 + x - x^3. Sorting such vectors correctly requires a +custom equality method.

  • +
  • Meter: a numeric vector with meter units. This is the simplest +possible class with interesting algebraic properties.

  • +
  • Period and frequency: a pair of classes represent a period, or +its inverse, frequency. This allows us to explore more arithmetic +operators.

  • +
+
+

Basics

+

In this section you’ll learn how to create a new vctrs class by +calling new_vctr(). This creates an object with class +vctrs_vctr which has a number of methods. These are +designed to make your life as easy as possible. For example:

+
    +
  • The print() and str() methods are +defined in terms of format() so you get a pleasant, +consistent display as soon as you’ve made your format() +method.

  • +
  • You can immediately put your new vector class in a data frame +because as.data.frame.vctrs_vctr() does the right +thing.

  • +
  • Subsetting ([, [[, and $), +length<-, and rep() methods automatically +preserve attributes because they use vec_restore(). A +default vec_restore() works for all classes where the +attributes are data-independent, and can easily be customised when the +attributes do depend on the data.

  • +
  • Default subset-assignment methods ([<-, +[[<-, and $<-) follow the principle that +the new values should be coerced to match the existing vector. This +gives predictable behaviour and clear error messages.

  • +
+
+

Percent class

+

In this section, I’ll show you how to make a percent +class, i.e., a double vector that is printed as a percentage. We start +by defining a low-level constructor to +check types and/or sizes and call new_vctr().

+

percent is built on a double vector of any length and +doesn’t have any attributes.

+
new_percent <- function(x = double()) {
+  if (!is_double(x)) {
+    abort("`x` must be a double vector.")
+  }
+  new_vctr(x, class = "vctrs_percent")
+}
+
+x <- new_percent(c(seq(0, 1, length.out = 4), NA))
+x
+#> <vctrs_percent[5]>
+#> [1] 0.0000000 0.3333333 0.6666667 1.0000000        NA
+
+str(x)
+#>  vctrs_pr [1:5] 0.0000000, 0.3333333, 0.6666667, 1.0000000,        NA
+

Note that we prefix the name of the class with the name of the +package. This prevents conflicting definitions between packages. For +packages that implement only one class (such as blob), it’s fine to use the +package name without prefix as the class name.

+

We then follow up with a user friendly helper. Here we’ll +use vec_cast() to allow it to accept anything coercible to +a double:

+
percent <- function(x = double()) {
+  x <- vec_cast(x, double())
+  new_percent(x)
+}
+

Before you go on, check that user-friendly constructor returns a +zero-length vector when called with no arguments. This makes it easy to +use as a prototype.

+
new_percent()
+#> <vctrs_percent[0]>
+percent()
+#> <vctrs_percent[0]>
+

For the convenience of your users, consider implementing an +is_percent() function:

+
is_percent <- function(x) {
+  inherits(x, "vctrs_percent")
+}
+
+
+

format() method

+

The first method for every class should almost always be a +format() method. This should return a character vector the +same length as x. The easiest way to do this is to rely on +one of R’s low-level formatting functions like +formatC():

+
format.vctrs_percent <- function(x, ...) {
+  out <- formatC(signif(vec_data(x) * 100, 3))
+  out[is.na(x)] <- NA
+  out[!is.na(x)] <- paste0(out[!is.na(x)], "%")
+  out
+}
+
x
+#> <vctrs_percent[5]>
+#> [1] 0%    33.3% 66.7% 100%  <NA>
+

(Note the use of vec_data() so format() +doesn’t get stuck in an infinite loop, and that I take a little care to +not convert NA to "NA"; this leads to better +printing.)

+

The format method is also used by data frames, tibbles, and +str():

+
data.frame(x)
+#>       x
+#> 1    0%
+#> 2 33.3%
+#> 3 66.7%
+#> 4  100%
+#> 5  <NA>
+

For optimal display, I recommend also defining an abbreviated type +name, which should be 4-5 letters for commonly used vectors. This is +used in tibbles and in str():

+
vec_ptype_abbr.vctrs_percent <- function(x, ...) {
+  "prcnt"
+}
+
+tibble::tibble(x)
+#> # A tibble: 5 × 1
+#>         x
+#>   <prcnt>
+#> 1      0%
+#> 2   33.3%
+#> 3   66.7%
+#> 4    100%
+#> 5      NA
+
+str(x)
+#>  prcnt [1:5] 0%, 33.3%, 66.7%, 100%, <NA>
+

If you need more control over printing in tibbles, implement a method +for pillar::pillar_shaft(). See +vignette("pillar", package = "vctrs") for details.

+
+
+
+

Casting and coercion

+

The next set of methods you are likely to need are those related to +coercion and casting. Coercion and casting are two sides of the same +coin: changing the prototype of an existing object. When the change +happens implicitly (e.g in c()) we call it +coercion; when the change happens explicitly +(e.g. with as.integer(x)), we call it +casting.

+

One of the main goals of vctrs is to put coercion and casting on a +robust theoretical footing so it’s possible to make accurate predictions +about what (e.g.) c(x, y) should do when x and +y have different prototypes. vctrs achieves this goal +through two generics:

+
    +
  • vec_ptype2(x, y) defines possible set of coercions. +It returns a prototype if x and y can be +safely coerced to the same prototype; otherwise it returns an error. The +set of automatic coercions is usually quite small because too many tend +to make code harder to reason about and silently propagate +mistakes.

  • +
  • vec_cast(x, to) defines the possible sets of casts. +It returns x translated to have prototype to, +or throws an error if the conversion isn’t possible. The set of possible +casts is a superset of possible coercions because they’re requested +explicitly.

  • +
+
+

Double dispatch

+

Both generics use double +dispatch which means that the implementation is selected +based on the class of two arguments, not just one. S3 does not natively +support double dispatch, so we implement our own dispatch mechanism. In +practice, this means:

+
    +
  • You end up with method names with two classes, like +vec_ptype2.foo.bar().

  • +
  • You don’t need to implement default methods (they would never be +called if you do).

  • +
  • You can’t call NextMethod().

  • +
+
+
+

Percent class

+

We’ll make our percent class coercible back and forth with double +vectors.

+

vec_ptype2() provides a user friendly error message if +the coercion doesn’t exist and makes sure NA is handled in +a standard way. NA is technically a logical vector, but we +want to stand in for a missing value of any type.

+
vec_ptype2("bogus", percent())
+#> Error:
+#> ! Can't combine `"bogus"` <character> and `percent()` <vctrs_percent>.
+vec_ptype2(percent(), NA)
+#> <vctrs_percent[0]>
+vec_ptype2(NA, percent())
+#> <vctrs_percent[0]>
+

By default and in simple cases, an object of the same class is +compatible with itself:

+
vec_ptype2(percent(), percent())
+#> <vctrs_percent[0]>
+

However this only works if the attributes for both objects are the +same. Also the default methods are a bit slower. It is always a good +idea to provide an explicit coercion method for the case of identical +classes. So we’ll start by saying that a vctrs_percent +combined with a vctrs_percent yields a +vctrs_percent, which we indicate by returning a prototype +generated by the constructor.

+
vec_ptype2.vctrs_percent.vctrs_percent <- function(x, y, ...) new_percent()
+

Next we define methods that say that combining a percent +and double should yield a double. We avoid returning a +percent here because errors in the scale (1 vs. 0.01) are +more obvious with raw numbers.

+

Because double dispatch is a bit of a hack, we need to provide two +methods. It’s your responsibility to ensure that each member of the pair +returns the same result: if they don’t you will get weird and +unpredictable behaviour.

+

The double dispatch mechanism requires us to refer to the underlying +type, double, in the method name. If we implemented +vec_ptype2.vctrs_percent.numeric(), it would never be +called.

+
vec_ptype2.vctrs_percent.double <- function(x, y, ...) double()
+vec_ptype2.double.vctrs_percent <- function(x, y, ...) double()
+

We can check that we’ve implemented this correctly with +vec_ptype_show():

+
vec_ptype_show(percent(), double(), percent())
+#> Prototype: <double>
+#> 0. (                 , <vctrs_percent> ) = <vctrs_percent>
+#> 1. ( <vctrs_percent> , <double>        ) = <double>       
+#> 2. ( <double>        , <vctrs_percent> ) = <double>
+

The vec_ptype2() methods define which input is the +richer type that vctrs should coerce to. However, they don’t perform any +conversion. This is the job of vec_cast(), which we +implement next. We’ll provide a method to cast a percent to a +percent:

+
vec_cast.vctrs_percent.vctrs_percent <- function(x, to, ...) x
+

And then for converting back and forth between doubles. To convert a +double to a percent we use the percent() helper (not the +constructor; this is unvalidated user input). To convert a +percent to a double, we strip the attributes.

+

Note that for historical reasons the order of argument in the +signature is the opposite as for vec_ptype2(). The class +for to comes first, and the class for x comes +second.

+

Again, the double dispatch mechanism requires us to refer to the +underlying type, double, in the method name. Implementing +vec_cast.vctrs_percent.numeric() has no effect.

+
vec_cast.vctrs_percent.double <- function(x, to, ...) percent(x)
+vec_cast.double.vctrs_percent <- function(x, to, ...) vec_data(x)
+

Then we can check this works with vec_cast():

+
vec_cast(0.5, percent())
+#> <vctrs_percent[1]>
+#> [1] 50%
+vec_cast(percent(0.5), double())
+#> [1] 0.5
+

Once you’ve implemented vec_ptype2() and +vec_cast(), you get vec_c(), +[<-, and [[<- implementations for +free.

+
vec_c(percent(0.5), 1)
+#> [1] 0.5 1.0
+vec_c(NA, percent(0.5))
+#> <vctrs_percent[2]>
+#> [1] <NA> 50%
+# but
+vec_c(TRUE, percent(0.5))
+#> Error in `vec_c()`:
+#> ! Can't combine `..1` <logical> and `..2` <vctrs_percent>.
+
+x <- percent(c(0.5, 1, 2))
+x[1:2] <- 2:1
+#> Error in `vec_restore_dispatch()`:
+#> ! Can't convert <integer> to <vctrs_percent>.
+x[[3]] <- 0.5
+x
+#> <vctrs_percent[3]>
+#> [1] 50%  100% 50%
+

You’ll also get mostly correct behaviour for c(). The +exception is when you use c() with a base R class:

+
# Correct
+c(percent(0.5), 1)
+#> [1] 0.5 1.0
+c(percent(0.5), factor(1))
+#> Error in `vec_c()`:
+#> ! Can't combine `..1` <vctrs_percent> and `..2` <factor<25c7e>>.
+
+# Incorrect
+c(factor(1), percent(0.5))
+#> [1] 1.0 0.5
+

Unfortunately there’s no way to fix this problem with the current +design of c().

+

Again, as a convenience, consider providing an +as_percent() function that makes use of the casts defined +in your vec_cast.vctrs_percent() methods:

+
as_percent <- function(x) {
+  vec_cast(x, new_percent())
+}
+

Occasionally, it is useful to provide conversions that go beyond +what’s allowed in casting. For example, we could offer a parsing method +for character vectors. In this case, as_percent() should be +generic, the default method should cast, and then additional methods +should implement more flexible conversion:

+
as_percent <- function(x, ...) {
+  UseMethod("as_percent")
+}
+
+as_percent.default <- function(x, ...) {
+  vec_cast(x, new_percent())
+}
+
+as_percent.character <- function(x) {
+  value <- as.numeric(gsub(" *% *$", "", x)) / 100
+  new_percent(value)
+}
+
+
+

Decimal class

+

Now that you’ve seen the basics with a very simple S3 class, we’ll +gradually explore more complicated scenarios. This section creates a +decimal class that prints with the specified number of +decimal places. This is very similar to percent but now the +class needs an attribute: the number of decimal places to display (an +integer vector of length 1).

+

We start off as before, defining a low-level constructor, a +user-friendly constructor, a format() method, and a +vec_ptype_abbr(). Note that additional object attributes +are simply passed along to new_vctr():

+
new_decimal <- function(x = double(), digits = 2L) {
+  if (!is_double(x)) {
+    abort("`x` must be a double vector.")
+  }
+  if (!is_integer(digits)) {
+    abort("`digits` must be an integer vector.")
+  }
+  vec_check_size(digits, size = 1L)
+
+  new_vctr(x, digits = digits, class = "vctrs_decimal")
+}
+
+decimal <- function(x = double(), digits = 2L) {
+  x <- vec_cast(x, double())
+  digits <- vec_recycle(vec_cast(digits, integer()), 1L)
+
+  new_decimal(x, digits = digits)
+}
+
+digits <- function(x) attr(x, "digits")
+
+format.vctrs_decimal <- function(x, ...) {
+  sprintf(paste0("%-0.", digits(x), "f"), x)
+}
+
+vec_ptype_abbr.vctrs_decimal <- function(x, ...) {
+  "dec"
+}
+
+x <- decimal(runif(10), 1L)
+x
+#> <vctrs_decimal[10]>
+#>  [1] 0.1 0.8 0.6 0.2 0.0 0.5 0.5 0.3 0.7 0.8
+

Note that I provide a little helper to extract the +digits attribute. This makes the code a little easier to +read and should not be exported.

+

By default, vctrs assumes that attributes are independent of the data +and so are automatically preserved. You’ll see what to do if the +attributes are data dependent in the next section.

+
x[1:2]
+#> <vctrs_decimal[2]>
+#> [1] 0.1 0.8
+x[[1]]
+#> <vctrs_decimal[1]>
+#> [1] 0.1
+

For the sake of exposition, we’ll assume that digits is +an important attribute of the class and should be included in the full +type:

+
vec_ptype_full.vctrs_decimal <- function(x, ...) {
+  paste0("decimal<", digits(x), ">")
+}
+
+x
+#> <decimal<1>[10]>
+#>  [1] 0.1 0.8 0.6 0.2 0.0 0.5 0.5 0.3 0.7 0.8
+

Now consider vec_cast() and vec_ptype2(). +Casting and coercing from one decimal to another requires a little +thought as the values of the digits attribute might be +different, and we need some way to reconcile them. Here I’ve decided to +chose the maximum of the two; other reasonable options are to take the +value from the left-hand side or throw an error.

+
vec_ptype2.vctrs_decimal.vctrs_decimal <- function(x, y, ...) {
+  new_decimal(digits = max(digits(x), digits(y)))
+}
+vec_cast.vctrs_decimal.vctrs_decimal <- function(x, to, ...) {
+  new_decimal(vec_data(x), digits = digits(to))
+}
+
+vec_c(decimal(1/100, digits = 3), decimal(2/100, digits = 2))
+#> <decimal<3>[2]>
+#> [1] 0.010 0.020
+

Finally, I can implement coercion to and from other types, like +doubles. When automatically coercing, I choose the richer type (i.e., +the decimal).

+
vec_ptype2.vctrs_decimal.double <- function(x, y, ...) x
+vec_ptype2.double.vctrs_decimal <- function(x, y, ...) y
+
+vec_cast.vctrs_decimal.double  <- function(x, to, ...) new_decimal(x, digits = digits(to))
+vec_cast.double.vctrs_decimal  <- function(x, to, ...) vec_data(x)
+
+vec_c(decimal(1, digits = 1), pi)
+#> <decimal<1>[2]>
+#> [1] 1.0 3.1
+vec_c(pi, decimal(1, digits = 1))
+#> <decimal<1>[2]>
+#> [1] 3.1 1.0
+

If type x has greater resolution than y, +there will be some inputs that lose precision. These should generate +errors using stop_lossy_cast(). You can see that in action +when casting from doubles to integers; only some doubles can become +integers without losing resolution.

+
vec_cast(c(1, 2, 10), to = integer())
+#> [1]  1  2 10
+
+vec_cast(c(1.5, 2, 10.5), to = integer())
+#> Error:
+#> ! Can't convert from `c(1.5, 2, 10.5)` <double> to <integer> due to loss of precision.
+#> • Locations: 1, 3
+
+
+

Cached sum class

+

The next level up in complexity is an object that has data-dependent +attributes. To explore this idea we’ll create a vector that caches the +sum of its values. As usual, we start with low-level and user-friendly +constructors:

+
new_cached_sum <- function(x = double(), sum = 0L) {
+  if (!is_double(x)) {
+    abort("`x` must be a double vector.")
+  }
+  if (!is_double(sum)) {
+    abort("`sum` must be a double vector.")
+  }
+  vec_check_size(sum, size = 1L)
+
+  new_vctr(x, sum = sum, class = "vctrs_cached_sum")
+}
+
+cached_sum <- function(x) {
+  x <- vec_cast(x, double())
+  new_cached_sum(x, sum(x))
+}
+

For this class, we can use the default format() method, +and instead, we’ll customise the obj_print_footer() method. +This is a good place to display user facing attributes.

+
obj_print_footer.vctrs_cached_sum <- function(x, ...) {
+  cat("# Sum: ", format(attr(x, "sum"), digits = 3), "\n", sep = "")
+}
+
+x <- cached_sum(runif(10))
+x
+#> <vctrs_cached_sum[10]>
+#>  [1] 0.87460066 0.17494063 0.03424133 0.32038573 0.40232824 0.19566983
+#>  [7] 0.40353812 0.06366146 0.38870131 0.97554784
+#> # Sum: 3.83
+

We’ll also override sum() and mean() to use +the attribute. This is easiest to do with vec_math(), which +you’ll learn about later.

+
vec_math.vctrs_cached_sum <- function(.fn, .x, ...) {
+  cat("Using cache\n")
+  switch(.fn,
+    sum = attr(.x, "sum"),
+    mean = attr(.x, "sum") / length(.x),
+    vec_math_base(.fn, .x, ...)
+  )
+}
+
+sum(x)
+#> Using cache
+#> [1] 3.833615
+

As mentioned above, vctrs assumes that attributes are independent of +the data. This means that when we take advantage of the default methods, +they’ll work, but return the incorrect result:

+
x[1:2]
+#> <vctrs_cached_sum[2]>
+#> [1] 0.8746007 0.1749406
+#> # Sum: 3.83
+

To fix this, you need to provide a vec_restore() method. +Note that this method dispatches on the to argument.

+
vec_restore.vctrs_cached_sum <- function(x, to, ..., i = NULL) {
+  new_cached_sum(x, sum(x))
+}
+
+x[1]
+#> <vctrs_cached_sum[1]>
+#> [1] 0.8746007
+#> # Sum: 0.875
+

This works because most of the vctrs methods dispatch to the +underlying base function by first stripping off extra attributes with +vec_data() and then reapplying them again with +vec_restore(). The default vec_restore() +method copies over all attributes, which is not appropriate when the +attributes depend on the data.

+

Note that vec_restore.class is subtly different from +vec_cast.class.class(). vec_restore() is used +when restoring attributes that have been lost; vec_cast() +is used for coercions. This is easier to understand with a concrete +example. Imagine factors were implemented with new_vctr(). +vec_restore.factor() would restore attributes back to an +integer vector, but you would not want to allow manually casting an +integer to a factor with vec_cast().

+
+
+
+

Record-style objects

+

Record-style objects use a list of equal-length vectors to represent +individual components of the object. The best example of this is +POSIXlt, which underneath the hood is a list of 11 fields +like year, month, and day. Record-style classes override +length() and subsetting methods to conceal this +implementation detail.

+
x <- as.POSIXlt(ISOdatetime(2020, 1, 1, 0, 0, 1:3))
+x
+#> [1] "2020-01-01 00:00:01 EST" "2020-01-01 00:00:02 EST"
+#> [3] "2020-01-01 00:00:03 EST"
+
+length(x)
+#> [1] 3
+length(unclass(x))
+#> [1] 11
+
+x[[1]] # the first date time
+#> [1] "2020-01-01 00:00:01 EST"
+unclass(x)[[1]] # the first component, the number of seconds
+#> [1] 1 2 3
+

vctrs makes it easy to create new record-style classes using +new_rcrd(), which has a wide selection of default +methods.

+
+

Rational class

+

A fraction, or rational number, can be represented by a pair of +integer vectors representing the numerator (the number on top) and the +denominator (the number on bottom), where the length of each vector must +be the same. To represent such a data structure we turn to a new base +data type: the record (or rcrd for short).

+

As usual we start with low-level and user-friendly constructors. The +low-level constructor calls new_rcrd(), which needs a named +list of equal-length vectors.

+
new_rational <- function(n = integer(), d = integer()) {
+  if (!is_integer(n)) {
+    abort("`n` must be an integer vector.")
+  }
+  if (!is_integer(d)) {
+    abort("`d` must be an integer vector.")
+  }
+
+  new_rcrd(list(n = n, d = d), class = "vctrs_rational")
+}
+

Our user friendly constructor casts n and d +to integers and recycles them to the same length.

+
rational <- function(n = integer(), d = integer()) {
+  c(n, d) %<-% vec_cast_common(n, d, .to = integer())
+  c(n, d) %<-% vec_recycle_common(n, d)
+
+  new_rational(n, d)
+}
+
+x <- rational(1, 1:10)
+

Behind the scenes, x is a named list with two elements. +But those details are hidden so that it behaves like a vector:

+
names(x)
+#> NULL
+length(x)
+#> [1] 10
+

To access the underlying fields we need to use field() +and fields():

+
fields(x)
+#> [1] "n" "d"
+field(x, "n")
+#>  [1] 1 1 1 1 1 1 1 1 1 1
+

Notice that we can’t print() or str() the +new rational vector x yet. Printing causes an error:

+
x
+#> <vctrs_rational[10]>
+#> Error in `format()`:
+#> ! `format.vctrs_rational()` not implemented.
+
+str(x)
+#> Error in `format()`:
+#> ! `format.vctrs_rational()` not implemented.
+

This is because we haven’t defined how our class can be printed from +the underlying data. Note that if you want to look under the hood during +development, you can always call vec_data(x).

+
vec_data(x)
+#>    n  d
+#> 1  1  1
+#> 2  1  2
+#> 3  1  3
+#> 4  1  4
+#> 5  1  5
+#> 6  1  6
+#> 7  1  7
+#> 8  1  8
+#> 9  1  9
+#> 10 1 10
+
+str(vec_data(x))
+#> 'data.frame':    10 obs. of  2 variables:
+#>  $ n: int  1 1 1 1 1 1 1 1 1 1
+#>  $ d: int  1 2 3 4 5 6 7 8 9 10
+

It is generally best to define a formatting method early in the +development of a class. The format method defines how to display the +class so that it can be printed in the normal way:

+
format.vctrs_rational <- function(x, ...) {
+  n <- field(x, "n")
+  d <- field(x, "d")
+
+  out <- paste0(n, "/", d)
+  out[is.na(n) | is.na(d)] <- NA
+
+  out
+}
+
+vec_ptype_abbr.vctrs_rational <- function(x, ...) "rtnl"
+vec_ptype_full.vctrs_rational <- function(x, ...) "rational"
+
+x
+#> <rational[10]>
+#>  [1] 1/1  1/2  1/3  1/4  1/5  1/6  1/7  1/8  1/9  1/10
+

vctrs uses the format() method in str(), +hiding the underlying implementation details from the user:

+
str(x)
+#>  rtnl [1:10] 1/1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8, 1/9, 1/10
+

For rational, vec_ptype2() and +vec_cast() follow the same pattern as +percent(). We allow coercion from integer and to +doubles.

+
vec_ptype2.vctrs_rational.vctrs_rational <- function(x, y, ...) new_rational()
+vec_ptype2.vctrs_rational.integer <- function(x, y, ...) new_rational()
+vec_ptype2.integer.vctrs_rational <- function(x, y, ...) new_rational()
+
+vec_cast.vctrs_rational.vctrs_rational <- function(x, to, ...) x
+vec_cast.double.vctrs_rational <- function(x, to, ...) field(x, "n") / field(x, "d")
+vec_cast.vctrs_rational.integer <- function(x, to, ...) rational(x, 1)
+
+vec_c(rational(1, 2), 1L, NA)
+#> <rational[3]>
+#> [1] 1/2  1/1  <NA>
+
+
+

Decimal2 class

+

The previous implementation of decimal was built on top +of doubles. This is a bad idea because decimal vectors are typically +used when you care about precise values (i.e., dollars and cents in a +bank account), and double values suffer from floating point +problems.

+

A better implementation of a decimal class would be to use pair of +integers, one for the value to the left of the decimal point, and the +other for the value to the right (divided by a scale). The +following code is a very quick sketch of how you might start creating +such a class:

+
new_decimal2 <- function(l, r, scale = 2L) {
+  if (!is_integer(l)) {
+    abort("`l` must be an integer vector.")
+  }
+  if (!is_integer(r)) {
+    abort("`r` must be an integer vector.")
+  }
+  if (!is_integer(scale)) {
+    abort("`scale` must be an integer vector.")
+  }
+  vec_check_size(scale, size = 1L)
+
+  new_rcrd(list(l = l, r = r), scale = scale, class = "vctrs_decimal2")
+}
+
+decimal2 <- function(l, r, scale = 2L) {
+  l <- vec_cast(l, integer())
+  r <- vec_cast(r, integer())
+  c(l, r) %<-% vec_recycle_common(l, r)
+  scale <- vec_cast(scale, integer())
+
+  # should check that r < 10^scale
+  new_decimal2(l = l, r = r, scale = scale)
+}
+
+format.vctrs_decimal2 <- function(x, ...) {
+  val <- field(x, "l") + field(x, "r") / 10^attr(x, "scale")
+  sprintf(paste0("%.0", attr(x, "scale"), "f"), val)
+}
+
+decimal2(10, c(0, 5, 99))
+#> <vctrs_decimal2[3]>
+#> [1] 10.00 10.05 10.99
+
+
+
+

Equality and comparison

+

vctrs provides four “proxy” generics. Two of these let you control +how your class determines equality and comparison:

+
    +
  • vec_proxy_equal() returns a data vector suitable for +comparison. It underpins ==, !=, +unique(), anyDuplicated(), and +is.na().

  • +
  • vec_proxy_compare() specifies how to compare the +elements of your vector. This proxy is used in <, +<=, >=, >, +min(), max(), median(), and +quantile().

  • +
+

Two other proxy generic are used for sorting for unordered data types +and for accessing the raw data for exotic storage formats:

+
    +
  • vec_proxy_order() specifies how to sort the elements +of your vector. It is used in xtfrm(), which in turn is +called by the order() and sort() +functions.

    +

    This proxy was added to implement the behaviour of lists, which are +sortable (their order proxy sorts by first occurrence) but not +comparable (comparison operators cause an error). Its default +implementation for other classes calls vec_proxy_compare() +and you normally don’t need to implement this proxy.

  • +
  • vec_proxy() returns the actual data of a vector. +This is useful when you store the data in a field of your class. Most of +the time, you shouldn’t need to implement +vec_proxy().

  • +
+

The default behavior is as follows:

+
    +
  • vec_proxy_equal() calls vec_proxy()
  • +
  • vec_proxy_compare() calls +vec_proxy_equal()
  • +
  • vec_proxy_order() calls +vec_proxy_compare()
  • +
+

You should only implement these proxies when some preprocessing on +the data is needed to make elements comparable. In that case, defining +these methods will get you a lot of behaviour for relatively little +work.

+

These proxy functions should always return a simple object (either a +bare vector or a data frame) that possesses the same properties as your +class. This permits efficient implementation of the vctrs internals +because it allows dispatch to happen once in R, and then efficient +computations can be written in C.

+
+

Rational class

+

Let’s explore these ideas by with the rational class we started on +above. By default, vec_proxy() converts a record to a data +frame, and the default comparison works column by column:

+
x <- rational(c(1, 2, 1, 2), c(1, 1, 2, 2))
+x
+#> <rational[4]>
+#> [1] 1/1 2/1 1/2 2/2
+
+vec_proxy(x)
+#>   n d
+#> 1 1 1
+#> 2 2 1
+#> 3 1 2
+#> 4 2 2
+
+x == rational(1, 1)
+#> [1]  TRUE FALSE FALSE FALSE
+

This makes sense as a default but isn’t correct here because +rational(1, 1) represents the same number as +rational(2, 2), so they should be equal. We can fix that by +implementing a vec_proxy_equal() method that divides +n and d by their greatest common divisor:

+
# Thanks to Matthew Lundberg: https://stackoverflow.com/a/21504113/16632
+gcd <- function(x, y) {
+  r <- x %% y
+  ifelse(r, gcd(y, r), y)
+}
+
+vec_proxy_equal.vctrs_rational <- function(x, ...) {
+  n <- field(x, "n")
+  d <- field(x, "d")
+  gcd <- gcd(n, d)
+
+  data.frame(n = n / gcd, d = d / gcd)
+}
+vec_proxy_equal(x)
+#>   n d
+#> 1 1 1
+#> 2 2 1
+#> 3 1 2
+#> 4 1 1
+
+x == rational(1, 1)
+#> [1]  TRUE FALSE FALSE  TRUE
+

vec_proxy_equal() is also used by +unique():

+
unique(x)
+#> <rational[3]>
+#> [1] 1/1 2/1 1/2
+

We now need to fix the comparison operations similarly, since +comparison currently happens lexicographically by n, then +by d:

+
rational(1, 2) < rational(2, 3)
+#> [1] TRUE
+rational(2, 4) < rational(2, 3)
+#> [1] TRUE
+

The easiest fix is to convert the fraction to a floating point number +and use this as a proxy:

+
vec_proxy_compare.vctrs_rational <- function(x, ...) {
+  field(x, "n") / field(x, "d")
+}
+
+rational(2, 4) < rational(2, 3)
+#> [1] TRUE
+

This also fixes sort(), because the default +implementation of vec_proxy_order() calls +vec_proxy_compare().

+
sort(x)
+#> <rational[4]>
+#> [1] 1/2 1/1 2/2 2/1
+

(We could have used the same approach in +vec_proxy_equal(), but when working with floating point +numbers it’s not necessarily true that x == y implies that +d * x == d * y.)

+
+
+

Polynomial class

+

A related problem occurs if we build our vector on top of a list. The +following code defines a polynomial class that represents polynomials +(like 1 + 3x - 2x^2) using a list of integer vectors (like +c(1, 3, -2)). Note the use of new_list_of() in +the constructor.

+
poly <- function(...) {
+  x <- vec_cast_common(..., .to = integer())
+  new_poly(x)
+}
+new_poly <- function(x) {
+  new_list_of(x, ptype = integer(), class = "vctrs_poly_list")
+}
+
+vec_ptype_full.vctrs_poly_list <- function(x, ...) "polynomial"
+vec_ptype_abbr.vctrs_poly_list <- function(x, ...) "poly"
+
+format.vctrs_poly_list <- function(x, ...) {
+  format_one <- function(x) {
+    if (length(x) == 0) {
+      return("")
+    }
+
+    if (length(x) == 1) {
+      format(x)
+    } else {
+      suffix <- c(paste0("\u22C5x^", seq(length(x) - 1, 1)), "")
+      out <- paste0(x, suffix)
+      out <- out[x != 0L]
+      paste0(out, collapse = " + ")
+    }
+  }
+
+  vapply(x, format_one, character(1))
+}
+
+obj_print_data.vctrs_poly_list <- function(x, ...) {
+  if (length(x) != 0) {
+    print(format(x), quote = FALSE)
+  }
+}
+
+p <- poly(1, c(1, 0, 0, 0, 2), c(1, 0, 1))
+p
+#> <polynomial[3]>
+#> [1] 1         1⋅x^4 + 2 1⋅x^2 + 1
+

The resulting objects will inherit from the +vctrs_list_of class, which provides tailored methods for +$, [[, the corresponding assignment operators, +and other methods.

+
class(p)
+#> [1] "vctrs_poly_list" "vctrs_list_of"   "vctrs_vctr"      "list"
+p[2]
+#> <polynomial[1]>
+#> [1] 1⋅x^4 + 2
+p[[2]]
+#> [1] 1 0 0 0 2
+

The class implements the list interface:

+
obj_is_list(p)
+#> [1] TRUE
+

This is fine for the internal implementation of this class but it +would be more appropriate if it behaved like an atomic vector rather +than a list.

+
+

Make an atomic polynomial vector

+

An atomic vector is a vector like integer or character for which +[[ returns the same type. Unlike lists, you can’t reach +inside an atomic vector.

+

To make the polynomial class an atomic vector, we’ll wrap the +internal list_of() class within a record vector. Usually +records are used because they can store several fields of data for each +observation. Here we have only one, but we use the class anyway to +inherit its atomicity.

+
poly <- function(...) {
+  x <- vec_cast_common(..., .to = integer())
+  x <- new_poly(x)
+  new_rcrd(list(data = x), class = "vctrs_poly")
+}
+format.vctrs_poly <- function(x, ...) {
+  format(field(x, "data"))
+}
+

The new format() method delegates to the one we wrote +for the internal list. The vector looks just like before:

+
p <- poly(1, c(1, 0, 0, 0, 2), c(1, 0, 1))
+p
+#> <vctrs_poly[3]>
+#> [1] 1         1⋅x^4 + 2 1⋅x^2 + 1
+

Making the class atomic means that obj_is_list() now +returns FALSE. This prevents recursive algorithms that +traverse lists from reaching too far inside the polynomial +internals.

+
obj_is_list(p)
+#> [1] FALSE
+

Most importantly, it prevents users from reaching into the internals +with [[:

+
p[[2]]
+#> <vctrs_poly[1]>
+#> [1] 1⋅x^4 + 2
+
+
+

Implementing equality and comparison

+

Equality works out of the box because we can tell if two integer +vectors are equal:

+
p == poly(c(1, 0, 1))
+#> [1] FALSE FALSE  TRUE
+

We can’t compare individual elements, because the data is stored in a +list and by default lists are not comparable:

+
p < p[2]
+#> Error in `vec_proxy_compare()`:
+#> ! `vec_proxy_compare.vctrs_poly_list()` not supported.
+

To enable comparison, we implement a vec_proxy_compare() +method:

+
vec_proxy_compare.vctrs_poly <- function(x, ...) {
+  # Get the list inside the record vector
+  x_raw <- vec_data(field(x, "data"))
+
+  # First figure out the maximum length
+  n <- max(vapply(x_raw, length, integer(1)))
+
+  # Then expand all vectors to this length by filling in with zeros
+  full <- lapply(x_raw, function(x) c(rep(0L, n - length(x)), x))
+
+  # Then turn into a data frame
+  as.data.frame(do.call(rbind, full))
+}
+
+p < p[2]
+#> [1]  TRUE FALSE  TRUE
+

Often, this is sufficient to also implement sort(). +However, for lists, there is already a default +vec_proxy_order() method that sorts by first +occurrence:

+
sort(p)
+#> <vctrs_poly[3]>
+#> [1] 1         1⋅x^2 + 1 1⋅x^4 + 2
+sort(p[c(1:3, 1:2)])
+#> <vctrs_poly[5]>
+#> [1] 1         1         1⋅x^2 + 1 1⋅x^4 + 2 1⋅x^4 + 2
+

To ensure consistency between ordering and comparison, we forward +vec_proxy_order() to vec_proxy_compare():

+
vec_proxy_order.vctrs_poly <- function(x, ...) {
+  vec_proxy_compare(x, ...)
+}
+
+sort(p)
+#> <vctrs_poly[3]>
+#> [1] 1         1⋅x^2 + 1 1⋅x^4 + 2
+
+
+
+
+

Arithmetic

+

vctrs also provides two mathematical generics that allow you to +define a broad swath of mathematical behaviour at once:

+
    +
  • vec_math(fn, x, ...) specifies the behaviour of +mathematical functions like abs(), sum(), and +mean(). (Note that var() and sd() +can’t be overridden, see ?vec_math() for the complete list +supported by vec_math().)

  • +
  • vec_arith(op, x, y) specifies the behaviour of the +arithmetic operations like +, -, and +%%. (See ?vec_arith() for the complete +list.)

  • +
+

Both generics define the behaviour for multiple functions because +sum.vctrs_vctr(x) calls +vec_math.vctrs_vctr("sum", x), and x + y calls +vec_math.x_class.y_class("+", x, y). They’re accompanied by +vec_math_base() and vec_arith_base() which +make it easy to call the underlying base R functions.

+

vec_arith() uses double dispatch and needs the following +standard boilerplate:

+
vec_arith.MYCLASS <- function(op, x, y, ...) {
+  UseMethod("vec_arith.MYCLASS", y)
+}
+vec_arith.MYCLASS.default <- function(op, x, y, ...) {
+  stop_incompatible_op(op, x, y)
+}
+

Correctly exporting vec_arith() methods from a package +is currently a little awkward. See the instructions in the Arithmetic +section of the “Implementing a vctrs S3 class in a package” section +below.

+
+

Cached sum class

+

I showed an example of vec_math() to define +sum() and mean() methods for +cached_sum. Now let’s talk about exactly how it works. Most +vec_math() functions will have a similar form. You use a +switch statement to handle the methods that you care about and fall back +to vec_math_base() for those that you don’t care about.

+
vec_math.vctrs_cached_sum <- function(.fn, .x, ...) {
+  switch(.fn,
+    sum = attr(.x, "sum"),
+    mean = attr(.x, "sum") / length(.x),
+    vec_math_base(.fn, .x, ...)
+  )
+}
+
+
+

Meter class

+

To explore the infix arithmetic operators exposed by +vec_arith() I’ll create a new class that represents a +measurement in meters:

+
new_meter <- function(x) {
+  stopifnot(is.double(x))
+  new_vctr(x, class = "vctrs_meter")
+}
+
+format.vctrs_meter <- function(x, ...) {
+  paste0(format(vec_data(x)), " m")
+}
+
+meter <- function(x) {
+  x <- vec_cast(x, double())
+  new_meter(x)
+}
+
+x <- meter(1:10)
+x
+#> <vctrs_meter[10]>
+#>  [1]  1 m  2 m  3 m  4 m  5 m  6 m  7 m  8 m  9 m 10 m
+

Because meter is built on top of a double vector, basic +mathematic operations work:

+
sum(x)
+#> <vctrs_meter[1]>
+#> [1] 55 m
+mean(x)
+#> <vctrs_meter[1]>
+#> [1] 5.5 m
+

But we can’t do arithmetic:

+
x + 1
+#> Error in `vec_arith()`:
+#> ! <vctrs_meter> + <double> is not permitted
+meter(10) + meter(1)
+#> Error in `vec_arith()`:
+#> ! <vctrs_meter> + <vctrs_meter> is not permitted
+meter(10) * 3
+#> Error in `vec_arith()`:
+#> ! <vctrs_meter> * <double> is not permitted
+

To allow these infix functions to work, we’ll need to provide +vec_arith() generic. But before we do that, let’s think +about what combinations of inputs we should support:

+
    +
  • It makes sense to add and subtract meters: that yields another +meter. We can divide a meter by another meter (yielding a unitless +number), but we can’t multiply meters (because that would yield an +area).

  • +
  • For a combination of meter and number multiplication and division +by a number are acceptable. Addition and subtraction don’t make much +sense as we, strictly speaking, are dealing with objects of different +nature.

  • +
+

vec_arith() is another function that uses double +dispatch, so as usual we start with a template.

+
vec_arith.vctrs_meter <- function(op, x, y, ...) {
+  UseMethod("vec_arith.vctrs_meter", y)
+}
+vec_arith.vctrs_meter.default <- function(op, x, y, ...) {
+  stop_incompatible_op(op, x, y)
+}
+

Then write the method for two meter objects. We use a switch +statement to cover the cases we care about and +stop_incompatible_op() to throw an informative error +message for everything else.

+
vec_arith.vctrs_meter.vctrs_meter <- function(op, x, y, ...) {
+  switch(
+    op,
+    "+" = ,
+    "-" = new_meter(vec_arith_base(op, x, y)),
+    "/" = vec_arith_base(op, x, y),
+    stop_incompatible_op(op, x, y)
+  )
+}
+
+meter(10) + meter(1)
+#> <vctrs_meter[1]>
+#> [1] 11 m
+meter(10) - meter(1)
+#> <vctrs_meter[1]>
+#> [1] 9 m
+meter(10) / meter(1)
+#> [1] 10
+meter(10) * meter(1)
+#> Error in `vec_arith()`:
+#> ! <vctrs_meter> * <vctrs_meter> is not permitted
+

Next we write the pair of methods for arithmetic with a meter and a +number. These are almost identical, but while meter(10) / 2 +makes sense, 2 / meter(10) does not (and neither do +addition and subtraction). To support both doubles and integers as +operands, we dispatch over numeric here instead of +double.

+
vec_arith.vctrs_meter.numeric <- function(op, x, y, ...) {
+  switch(
+    op,
+    "/" = ,
+    "*" = new_meter(vec_arith_base(op, x, y)),
+    stop_incompatible_op(op, x, y)
+  )
+}
+vec_arith.numeric.vctrs_meter <- function(op, x, y, ...) {
+  switch(
+    op,
+    "*" = new_meter(vec_arith_base(op, x, y)),
+    stop_incompatible_op(op, x, y)
+  )
+}
+
+meter(2) * 10
+#> <vctrs_meter[1]>
+#> [1] 20 m
+meter(2) * as.integer(10)
+#> <vctrs_meter[1]>
+#> [1] 20 m
+10 * meter(2)
+#> <vctrs_meter[1]>
+#> [1] 20 m
+meter(20) / 10
+#> <vctrs_meter[1]>
+#> [1] 2 m
+10 / meter(20)
+#> Error in `vec_arith()`:
+#> ! <double> / <vctrs_meter> is not permitted
+meter(20) + 10
+#> Error in `vec_arith()`:
+#> ! <vctrs_meter> + <double> is not permitted
+

For completeness, we also need +vec_arith.vctrs_meter.MISSING for the unary + +and - operators:

+
vec_arith.vctrs_meter.MISSING <- function(op, x, y, ...) {
+  switch(op,
+    `-` = x * -1,
+    `+` = x,
+    stop_incompatible_op(op, x, y)
+  )
+}
+-meter(1)
+#> <vctrs_meter[1]>
+#> [1] -1 m
++meter(1)
+#> <vctrs_meter[1]>
+#> [1] 1 m
+
+
+
+

Implementing a vctrs S3 class in a package

+

Defining S3 methods interactively is fine for iteration and +exploration, but if your class lives in a package, you need to do a few +more things:

+
    +
  • Register the S3 methods by listing them in the +NAMESPACE file.

  • +
  • Create documentation around your methods, for the sake of your +user and to satisfy R CMD check.

  • +
+

Let’s assume that the percent class is implemented in +the pizza package in the file R/percent.R. Here we walk +through the major sections of this hypothetical file. You’ve seen all of +this code before, but now it’s augmented by the roxygen2 directives that +produce the correct NAMESPACE entries and help topics.

+
+

Getting started

+

First, the pizza package needs to include vctrs in the +Imports section of its DESCRIPTION (perhaps by +calling usethis::use_package("vctrs"). While vctrs is under +very active development, it probably makes sense to state a minimum +version.

+
Imports:
+    a_package,
+    another_package,
+    ...
+    vctrs (>= x.y.z),
+    ...
+

Then we make all vctrs functions available within the pizza package +by including the directive #' @import vctrs somewhere. +Usually, it’s not good practice to @import the entire +namespace of a package, but vctrs is deliberately designed with this use +case in mind.

+

Where should we put #' @import vctrs? There are two +natural locations:

+
    +
  • With package-level docs in R/pizza-doc.R. You can +use usethis::use_package_doc() to initiate this +package-level documentation.

  • +
  • In R/percent.R. This makes the most sense when the +vctrs S3 class is a modest and self-contained part of the overall +package.

  • +
+

We also must use one of these locations to dump some internal +documentation that’s needed to avoid R CMD check +complaints. We don’t expect any human to ever read this documentation. +Here’s how this dummy documentation should look, combined with the +#' @import vctrs directive described above.

+
#' Internal vctrs methods
+#'
+#' @import vctrs
+#' @keywords internal
+#' @name pizza-vctrs
+NULL
+

This should appear in R/pizza-doc.R (package-level docs) +or in R/percent.R (class-focused file).

+

Remember to call devtools::document() regularly, as you +develop, to regenerate NAMESPACE and the .Rd +files.

+

From this point on, the code shown is expected to appear in +R/percent.R.

+
+
+

Low-level and user-friendly constructors

+

Next we add our constructor:

+
new_percent <- function(x = double()) {
+  if (!is_double(x)) {
+    abort("`x` must be a double vector.")
+  }
+  new_vctr(x, class = "pizza_percent")
+}
+

Note that the name of the package must be included in the class name +(pizza_percent), but it does not need to be included in the +constructor name. You do not need to export the constructor, unless you +want people to extend your class.

+

We can also add a call to setOldClass() for +compatibility with S4:

+
# for compatibility with the S4 system
+methods::setOldClass(c("pizza_percent", "vctrs_vctr"))
+

Because we’ve used a function from the methods package, you’ll also +need to add methods to Imports, with (e.g.) +usethis::use_package("methods"). This is a “free” +dependency because methods is bundled with every R install.

+

Next we implement, export, and document a user-friendly helper: +percent().

+
#' `percent` vector
+#'
+#' This creates a double vector that represents percentages so when it is
+#' printed, it is multiplied by 100 and suffixed with `%`.
+#'
+#' @param x A numeric vector
+#' @return An S3 vector of class `pizza_percent`.
+#' @export
+#' @examples
+#' percent(c(0.25, 0.5, 0.75))
+percent <- function(x = double()) {
+  x <- vec_cast(x, double())
+  new_percent(x)
+}
+

(Again note that the package name will appear in the class, but does +not need to occur in the function, because we can already do +pizza::percent(); it would be redundant to have +pizza::pizza_percent().)

+
+
+

Other helpers

+

It’s a good idea to provide a function that tests if an object is of +this class. If you do so, it makes sense to document it with the +user-friendly constructor percent():

+
#' @export
+#' @rdname percent
+is_percent <- function(x) {
+  inherits(x, "pizza_percent")
+}
+

You’ll also need to update the percent() documentation +to reflect that x now means two different things:

+
#' @param x
+#'  * For `percent()`: A numeric vector
+#'  * For `is_percent()`: An object to test.
+

Next we provide the key methods to make printing work. These are S3 +methods, so they don’t need to be documented, but they do need to be +exported.

+
#' @export
+format.pizza_percent <- function(x, ...) {
+  out <- formatC(signif(vec_data(x) * 100, 3))
+  out[is.na(x)] <- NA
+  out[!is.na(x)] <- paste0(out[!is.na(x)], "%")
+  out
+}
+
+#' @export
+vec_ptype_abbr.pizza_percent <- function(x, ...) {
+  "prcnt"
+}
+

Finally, we implement methods for vec_ptype2() and +vec_cast().

+
#' @export
+vec_ptype2.vctrs_percent.vctrs_percent <- function(x, y, ...) new_percent()
+#' @export
+vec_ptype2.double.vctrs_percent <- function(x, y, ...) double()
+
+#' @export
+vec_cast.pizza_percent.pizza_percent <- function(x, to, ...) x
+#' @export
+vec_cast.pizza_percent.double <- function(x, to, ...) percent(x)
+#' @export
+vec_cast.double.pizza_percent <- function(x, to, ...) vec_data(x)
+
+
+

Arithmetic

+

Writing double dispatch methods for vec_arith() is +currently more awkward than writing them for vec_ptype2() +or vec_cast(). We plan to improve this in the future. For +now, you can use the following instructions.

+

If you define a new type and want to write vec_arith() +methods for it, you’ll need to provide a new single dispatch S3 generic +for it of the following form:

+
#' @export
+#' @method vec_arith my_type
+vec_arith.my_type <- function(op, x, y, ...) {
+  UseMethod("vec_arith.my_type", y)
+}
+

Note that this actually functions as both an S3 method for +vec_arith() and an S3 generic called +vec_arith.my_type() that dispatches off y. +roxygen2 only recognizes it as an S3 generic, so you have to register +the S3 method part of this with an explicit @method +call.

+

After that, you can define double dispatch methods, but you still +need an explicit @method tag to ensure it is registered +with the correct generic:

+
#' @export
+#' @method vec_arith.my_type my_type
+vec_arith.my_type.my_type <- function(op, x, y, ...) {
+  # implementation here
+}
+
+#' @export
+#' @method vec_arith.my_type integer
+vec_arith.my_type.integer <- function(op, x, y, ...) {
+  # implementation here
+}
+
+#' @export
+#' @method vec_arith.integer my_type
+vec_arith.integer.my_type <- function(op, x, y, ...) {
+  # implementation here
+}
+

vctrs provides the hybrid S3 generics/methods for most of the base R +types, like vec_arith.integer(). If you don’t fully import +vctrs with @import vctrs, then you will need to explicitly +import the generic you are registering double dispatch methods for with +@importFrom vctrs vec_arith.integer.

+
+
+

Testing

+

It’s good practice to test your new class. Specific +recommendations:

+
    +
  • R/percent.R is the type of file where you really do +want 100% test coverage. You can use +devtools::test_coverage_file() to check this.

  • +
  • Make sure to test behaviour with zero-length inputs and missing +values.

  • +
  • Use testthat::verify_output() to test your format +method. Customised printing is often a primary motivation for creating +your own S3 class in the first place, so this will alert you to +unexpected changes in your printed output. Read more about +verify_output() in the testthat +v2.3.0 blog post; it’s an example of a so-called golden +test.

  • +
  • Check for method symmetry; use expect_s3_class(), +probably with exact = TRUE, to ensure that +vec_c(x, y) and vec_c(y, x) return the same +type of output for the important xs and ys in +your domain.

  • +
  • Use testthat::expect_error() to check that inputs +that can’t be combined fail with an error. Here, you should be generally +checking the class of the error, not its message. Relevant classes +include vctrs_error_assert_ptype, +vctrs_error_assert_size, and +vctrs_error_incompatible_type.

    +
    expect_error(vec_c(1, "a"), class = "vctrs_error_incompatible_type")
  • +
+

If your tests pass when run by devtools::test(), but +fail when run in R CMD check, it is very likely to reflect +a problem with S3 method registration. Carefully check your roxygen2 +comments and the generated NAMESPACE.

+
+
+

Existing classes

+

Before you build your own class, you might want to consider using, or +subclassing existing classes. You can check awesome-vctrs for a +curated list of R vector classes, some of which are built with +vctrs.

+

If you’ve built or extended a class, consider adding it to that list +so other people can use it.

+
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/stability.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/stability.R new file mode 100644 index 00000000..a6491845 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/stability.R @@ -0,0 +1,175 @@ +## ----include = FALSE---------------------------------------------------------- +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) + +## ----setup-------------------------------------------------------------------- +library(vctrs) +library(rlang) +library(zeallot) + +## ----------------------------------------------------------------------------- +vec_ptype_show(median(c(1L, 1L))) +vec_ptype_show(median(c(1L, 1L, 1L))) + +## ----------------------------------------------------------------------------- +vec_ptype_show(sapply(1L, function(x) c(x, x))) +vec_ptype_show(sapply(integer(), function(x) c(x, x))) + +## ----------------------------------------------------------------------------- +vec_ptype_show(c(NA, Sys.Date())) +vec_ptype_show(c(Sys.Date(), NA)) + +## ----------------------------------------------------------------------------- +env <- new.env(parent = emptyenv()) +length(env) +length(mean) +length(c(env, mean)) + +## ----------------------------------------------------------------------------- +vec_ptype_show(ifelse(NA, 1L, 1L)) +vec_ptype_show(ifelse(FALSE, 1L, 1L)) + +## ----------------------------------------------------------------------------- +c(FALSE, 1L, 2.5) + +## ----------------------------------------------------------------------------- +vec_c(FALSE, 1L, 2.5) + +## ----error = TRUE------------------------------------------------------------- +c(FALSE, "x") +vec_c(FALSE, "x") + +c(FALSE, list(1)) +vec_c(FALSE, list(1)) + +## ----------------------------------------------------------------------------- +c(10.5, factor("x")) + +## ----------------------------------------------------------------------------- +c(mean, globalenv()) + +## ----error = TRUE------------------------------------------------------------- +c(getRversion(), "x") + +c("x", getRversion()) + +## ----error = TRUE------------------------------------------------------------- +vec_c(mean, globalenv()) + +vec_c(Sys.Date(), factor("x"), "x") + +## ----------------------------------------------------------------------------- +fa <- factor("a") +fb <- factor("b") + +c(fa, fb) + +## ----------------------------------------------------------------------------- +vec_c(fa, fb) +vec_c(fb, fa) + +## ----------------------------------------------------------------------------- +datetime_nz <- as.POSIXct("2020-01-01 09:00", tz = "Pacific/Auckland") +c(datetime_nz) + +## ----------------------------------------------------------------------------- +vec_c(datetime_nz) + +## ----------------------------------------------------------------------------- +datetime_local <- as.POSIXct("2020-01-01 09:00") +datetime_houston <- as.POSIXct("2020-01-01 09:00", tz = "US/Central") + +vec_c(datetime_local, datetime_houston, datetime_nz) +vec_c(datetime_houston, datetime_nz) +vec_c(datetime_nz, datetime_houston) + +## ----------------------------------------------------------------------------- +date <- as.Date("2020-01-01") +datetime <- as.POSIXct("2020-01-01 09:00") + +c(date, datetime) +c(datetime, date) + +## ----------------------------------------------------------------------------- +vec_c(date, datetime) +vec_c(date, datetime_nz) + +## ----------------------------------------------------------------------------- +c(NA, fa) +c(NA, date) +c(NA, datetime) + +## ----------------------------------------------------------------------------- +vec_c(NA, fa) +vec_c(NA, date) +vec_c(NA, datetime) + +## ----------------------------------------------------------------------------- +df1 <- data.frame(x = 1) +df2 <- data.frame(x = 2) +str(c(df1, df1)) + +## ----------------------------------------------------------------------------- +vec_c(df1, df2) + +## ----------------------------------------------------------------------------- +m <- matrix(1:4, nrow = 2) +c(m, m) +vec_c(m, m) + +## ----------------------------------------------------------------------------- +c(m, 1) + +vec_c(m, 1) + +## ----eval = FALSE------------------------------------------------------------- +# vec_c <- function(...) { +# args <- compact(list2(...)) +# +# ptype <- vec_ptype_common(!!!args) +# if (is.null(ptype)) +# return(NULL) +# +# ns <- map_int(args, vec_size) +# out <- vec_init(ptype, sum(ns)) +# +# pos <- 1 +# for (i in seq_along(ns)) { +# n <- ns[[i]] +# +# x <- vec_cast(args[[i]], to = ptype) +# vec_slice(out, pos:(pos + n - 1)) <- x +# pos <- pos + n +# } +# +# out +# } + +## ----------------------------------------------------------------------------- +if_else <- function(test, yes, no) { + if (!is_logical(test)) { + abort("`test` must be a logical vector.") + } + + c(yes, no) %<-% vec_cast_common(yes, no) + c(test, yes, no) %<-% vec_recycle_common(test, yes, no) + + out <- vec_init(yes, vec_size(yes)) + vec_slice(out, test) <- vec_slice(yes, test) + vec_slice(out, !test) <- vec_slice(no, !test) + + out +} + +x <- c(NA, 1:4) +if_else(x > 2, "small", "big") +if_else(x > 2, factor("small"), factor("big")) +if_else(x > 2, Sys.Date(), Sys.Date() + 7) + +## ----------------------------------------------------------------------------- +if_else(x > 2, data.frame(x = 1), data.frame(y = 2)) + +if_else(x > 2, matrix(1:10, ncol = 2), cbind(30, 30)) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/stability.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/stability.Rmd new file mode 100644 index 00000000..d6cf480b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/stability.Rmd @@ -0,0 +1,400 @@ +--- +title: "Type and size stability" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Type and size stability} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + +This vignette introduces the ideas of type-stability and size-stability. If a function possesses these properties, it is substantially easier to reason about because to predict the "shape" of the output you only need to know the "shape"s of the inputs. + +This work is partly motivated by a common pattern that I noticed when reviewing code: if I read the code (without running it!), and I can't predict the type of each variable, I feel very uneasy about the code. This sense is important because most unit tests explore typical inputs, rather than exhaustively testing the strange and unusual. Analysing the types (and size) of variables makes it possible to spot unpleasant edge cases. + +```{r setup} +library(vctrs) +library(rlang) +library(zeallot) +``` + +## Definitions + +We say a function is __type-stable__ iff: + +1. You can predict the output type knowing only the input types. +1. The order of arguments in ... does not affect the output type. + +Similarly, a function is __size-stable__ iff: + +1. You can predict the output size knowing only the input sizes, or + there is a single numeric input that specifies the output size. + +Very few base R functions are size-stable, so I'll also define a slightly weaker condition. I'll call a function __length-stable__ iff: + +1. You can predict the output _length_ knowing only the input _lengths_, or + there is a single numeric input that specifies the output _length_. + +(But note that length-stable is not a particularly robust definition because `length()` returns a value for things that are not vectors.) + +We'll call functions that don't obey these principles __type-unstable__ and __size-unstable__ respectively. + +On top of type- and size-stability it's also desirable to have a single set of rules that are applied consistently. We want one set of type-coercion and size-recycling rules that apply everywhere, not many sets of rules that apply to different functions. + +The goal of these principles is to minimise cognitive overhead. Rather than having to memorise many special cases, you should be able to learn one set of principles and apply them again and again. + +### Examples + +To make these ideas concrete, let's apply them to a few base functions: + +1. `mean()` is trivially type-stable and size-stable because it always returns + a double vector of length 1 (or it throws an error). + +1. Surprisingly, `median()` is type-unstable: + + ```{r} + vec_ptype_show(median(c(1L, 1L))) + vec_ptype_show(median(c(1L, 1L, 1L))) + ``` + + It is, however, size-stable, since it always returns a vector of length 1. + +1. `sapply()` is type-unstable because you can't predict the output type only + knowing the input types: + + ```{r} + vec_ptype_show(sapply(1L, function(x) c(x, x))) + vec_ptype_show(sapply(integer(), function(x) c(x, x))) + ``` + + It's not quite size-stable; `vec_size(sapply(x, f))` is `vec_size(x)` + for vectors but not for matrices (the output is transposed) or + data frames (it iterates over the columns). + +1. `vapply()` is a type-stable version of `sapply()` because + `vec_ptype_show(vapply(x, fn, template))` is always `vec_ptype_show(template)`. + It is size-unstable for the same reasons as `sapply()`. + +1. `c()` is type-unstable because `c(x, y)` doesn't always output the same type + as `c(y, x)`. + + ```{r} + vec_ptype_show(c(NA, Sys.Date())) + vec_ptype_show(c(Sys.Date(), NA)) + ``` + + `c()` is *almost always* length-stable because `length(c(x, y))` + *almost always* equals `length(x) + length(y)`. One common source of + instability here is dealing with non-vectors (see the later section + "Non-vectors"): + + ```{r} + env <- new.env(parent = emptyenv()) + length(env) + length(mean) + length(c(env, mean)) + ``` + +1. `paste(x1, x2)` is length-stable because `length(paste(x1, x2))` + equals `max(length(x1), length(x2))`. However, it doesn't follow the usual + arithmetic recycling rules because `paste(1:2, 1:3)` doesn't generate + a warning. + +1. `ifelse()` is length-stable because `length(ifelse(cond, true, false))` + is always `length(cond)`. `ifelse()` is type-unstable because the output + type depends on the value of `cond`: + + ```{r} + vec_ptype_show(ifelse(NA, 1L, 1L)) + vec_ptype_show(ifelse(FALSE, 1L, 1L)) + ``` + +1. `read.csv(file)` is type-unstable and size-unstable because, while you know + it will return a data frame, you don't know what columns it will return or + how many rows it will have. Similarly, `df[[i]]` is not type-stable because + the result depends on the _value_ of `i`. There are many important + functions that can not be made type-stable or size-stable! + +With this understanding of type- and size-stability in hand, we'll use them to analyse some base R functions in greater depth and then propose alternatives with better properties. + +## `c()` and `vctrs::vec_c()` + +In this section we'll compare and contrast `c()` and `vec_c()`. `vec_c()` is both type- and size-stable because it possesses the following invariants: + +* `vec_ptype(vec_c(x, y))` equals `vec_ptype_common(x, y)`. +* `vec_size(vec_c(x, y))` equals `vec_size(x) + vec_size(y)`. + +`c()` has another undesirable property in that it's not consistent with `unlist()`; i.e., `unlist(list(x, y))` does not always equal `c(x, y)`; i.e., base R has multiple sets of type-coercion rules. I won't consider this problem further here. + +I have two goals here: + +* To fully document the quirks of `c()`, hence motivating the development + of an alternative. + +* To discuss non-obvious consequences of the type- and size-stability above. + +### Atomic vectors + +If we only consider atomic vectors, `c()` is type-stable because it uses a hierarchy of types: character > complex > double > integer > logical. + +```{r} +c(FALSE, 1L, 2.5) +``` + +`vec_c()` obeys similar rules: + +```{r} +vec_c(FALSE, 1L, 2.5) +``` + +But it does not automatically coerce to character vectors or lists: + +```{r, error = TRUE} +c(FALSE, "x") +vec_c(FALSE, "x") + +c(FALSE, list(1)) +vec_c(FALSE, list(1)) +``` + +### Incompatible vectors and non-vectors + +In general, most base methods do not throw an error: + +```{r} +c(10.5, factor("x")) +``` + +If the inputs aren't vectors, `c()` automatically puts them in a list: + +```{r} +c(mean, globalenv()) +``` + +For numeric versions, this depends on the order of inputs. Version first is an error, otherwise the input is wrapped in a list: + +```{r, error = TRUE} +c(getRversion(), "x") + +c("x", getRversion()) +``` + +`vec_c()` throws an error if the inputs are not vectors or not automatically coercible: + +```{r, error = TRUE} +vec_c(mean, globalenv()) + +vec_c(Sys.Date(), factor("x"), "x") +``` + + +### Factors + +Combining two factors returns an integer vector: + +```{r} +fa <- factor("a") +fb <- factor("b") + +c(fa, fb) +``` + +(This is documented in `c()` but is still undesirable.) + +`vec_c()` returns a factor taking the union of the levels. This behaviour is motivated by pragmatics: there are many places in base R that automatically convert character vectors to factors, so enforcing stricter behaviour would be unnecessarily onerous. (This is backed up by experience with `dplyr::bind_rows()`, which is stricter and is a common source of user difficulty.) + +```{r} +vec_c(fa, fb) +vec_c(fb, fa) +``` + +### Date-times + +`c()` strips the time zone associated with date-times: + +```{r} +datetime_nz <- as.POSIXct("2020-01-01 09:00", tz = "Pacific/Auckland") +c(datetime_nz) +``` + +This behaviour is documented in `?DateTimeClasses` but is the source of considerable user pain. + +`vec_c()` preserves time zones: + +```{r} +vec_c(datetime_nz) +``` + +What time zone should the output have if inputs have different time zones? One option would be to be strict and force the user to manually align all the time zones. However, this is onerous (particularly because there's no easy way to change the time zone in base R), so vctrs chooses to use the first non-local time zone: + +```{r} +datetime_local <- as.POSIXct("2020-01-01 09:00") +datetime_houston <- as.POSIXct("2020-01-01 09:00", tz = "US/Central") + +vec_c(datetime_local, datetime_houston, datetime_nz) +vec_c(datetime_houston, datetime_nz) +vec_c(datetime_nz, datetime_houston) +``` + +### Dates and date-times + +Combining dates and date-times with `c()` gives silently incorrect results: + +```{r} +date <- as.Date("2020-01-01") +datetime <- as.POSIXct("2020-01-01 09:00") + +c(date, datetime) +c(datetime, date) +``` + +This behaviour arises because neither `c.Date()` nor `c.POSIXct()` check that all inputs are of the same type. + +`vec_c()` uses a standard set of rules to avoid this problem. When you mix dates and date-times, vctrs returns a date-time and converts dates to date-times at midnight (in the timezone of the date-time). + +```{r} +vec_c(date, datetime) +vec_c(date, datetime_nz) +``` + +### Missing values + +If a missing value comes at the beginning of the inputs, `c()` falls back to the internal behaviour, which strips all attributes: + +```{r} +c(NA, fa) +c(NA, date) +c(NA, datetime) +``` + +`vec_c()` takes a different approach treating a logical vector consisting only of `NA` as the `unspecified()` class which can be converted to any other 1d type: + +```{r} +vec_c(NA, fa) +vec_c(NA, date) +vec_c(NA, datetime) +``` + +### Data frames + +Because it is *almost always* length-stable, `c()` combines data frames column wise (into a list): + +```{r} +df1 <- data.frame(x = 1) +df2 <- data.frame(x = 2) +str(c(df1, df1)) +``` + +`vec_c()` is size-stable, which implies it will row-bind data frames: + +```{r} +vec_c(df1, df2) +``` + +### Matrices and arrays + +The same reasoning applies to matrices: + +```{r} +m <- matrix(1:4, nrow = 2) +c(m, m) +vec_c(m, m) +``` + +One difference is that `vec_c()` will "broadcast" a vector to match the dimensions of a matrix: + +```{r} +c(m, 1) + +vec_c(m, 1) +``` + +### Implementation + +The basic implementation of `vec_c()` is reasonably simple. We first figure out the properties of the output, i.e. the common type and total size, and then allocate it with `vec_init()`, and then insert each input into the correct place in the output. + +```{r, eval = FALSE} +vec_c <- function(...) { + args <- compact(list2(...)) + + ptype <- vec_ptype_common(!!!args) + if (is.null(ptype)) + return(NULL) + + ns <- map_int(args, vec_size) + out <- vec_init(ptype, sum(ns)) + + pos <- 1 + for (i in seq_along(ns)) { + n <- ns[[i]] + + x <- vec_cast(args[[i]], to = ptype) + vec_slice(out, pos:(pos + n - 1)) <- x + pos <- pos + n + } + + out +} +``` + +(The real `vec_c()` is a bit more complicated in order to handle inner and outer names). + +## `ifelse()` + +One of the functions that motivate the development of vctrs is `ifelse()`. It has the surprising property that the result value is "A vector of the same length and attributes (including dimensions and class) as `test`". To me, it seems more reasonable for the type of the output to be controlled by the type of the `yes` and `no` arguments. + +In `dplyr::if_else()` I swung too far towards strictness: it throws an error if `yes` and `no` are not the same type. This is annoying in practice because it requires typed missing values (`NA_character_` etc), and because the checks are only on the class (not the full prototype), it's easy to create invalid output. + +I found it much easier to understand what `ifelse()` _should_ do once I internalised the ideas of type- and size-stability: + +* The first argument must be logical. + +* `vec_ptype(if_else(test, yes, no))` equals + `vec_ptype_common(yes, no)`. Unlike `ifelse()` this implies + that `if_else()` must always evaluate both `yes` and `no` in order + to figure out the correct type. I think this is consistent with `&&` (scalar + operation, short circuits) and `&` (vectorised, evaluates both sides). + +* `vec_size(if_else(test, yes, no))` equals + `vec_size_common(test, yes, no)`. I think the output could have the same + size as `test` (i.e., the same behaviour as `ifelse`), but I _think_ + as a general rule that your inputs should either be mutually recycling + or not. + +This leads to the following implementation: + +```{r} +if_else <- function(test, yes, no) { + if (!is_logical(test)) { + abort("`test` must be a logical vector.") + } + + c(yes, no) %<-% vec_cast_common(yes, no) + c(test, yes, no) %<-% vec_recycle_common(test, yes, no) + + out <- vec_init(yes, vec_size(yes)) + vec_slice(out, test) <- vec_slice(yes, test) + vec_slice(out, !test) <- vec_slice(no, !test) + + out +} + +x <- c(NA, 1:4) +if_else(x > 2, "small", "big") +if_else(x > 2, factor("small"), factor("big")) +if_else(x > 2, Sys.Date(), Sys.Date() + 7) +``` + +By using `vec_size()` and `vec_slice()`, this definition of `if_else()` automatically works with data.frames and matrices: + +```{r} +if_else(x > 2, data.frame(x = 1), data.frame(y = 2)) + +if_else(x > 2, matrix(1:10, ncol = 2), cbind(30, 30)) +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/stability.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/stability.html new file mode 100644 index 00000000..a2c4838f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/stability.html @@ -0,0 +1,811 @@ + + + + + + + + + + + + + + +Type and size stability + + + + + + + + + + + + + + + + + + + + + + + + + + +

Type and size stability

+ + + +

This vignette introduces the ideas of type-stability and +size-stability. If a function possesses these properties, it is +substantially easier to reason about because to predict the “shape” of +the output you only need to know the “shape”s of the inputs.

+

This work is partly motivated by a common pattern that I noticed when +reviewing code: if I read the code (without running it!), and I can’t +predict the type of each variable, I feel very uneasy about the code. +This sense is important because most unit tests explore typical inputs, +rather than exhaustively testing the strange and unusual. Analysing the +types (and size) of variables makes it possible to spot unpleasant edge +cases.

+
library(vctrs)
+library(rlang)
+library(zeallot)
+
+

Definitions

+

We say a function is type-stable iff:

+
    +
  1. You can predict the output type knowing only the input types.
  2. +
  3. The order of arguments in … does not affect the output type.
  4. +
+

Similarly, a function is size-stable iff:

+
    +
  1. You can predict the output size knowing only the input sizes, or +there is a single numeric input that specifies the output size.
  2. +
+

Very few base R functions are size-stable, so I’ll also define a +slightly weaker condition. I’ll call a function +length-stable iff:

+
    +
  1. You can predict the output length knowing only the input +lengths, or there is a single numeric input that specifies the +output length.
  2. +
+

(But note that length-stable is not a particularly robust definition +because length() returns a value for things that are not +vectors.)

+

We’ll call functions that don’t obey these principles +type-unstable and size-unstable +respectively.

+

On top of type- and size-stability it’s also desirable to have a +single set of rules that are applied consistently. We want one set of +type-coercion and size-recycling rules that apply everywhere, not many +sets of rules that apply to different functions.

+

The goal of these principles is to minimise cognitive overhead. +Rather than having to memorise many special cases, you should be able to +learn one set of principles and apply them again and again.

+
+

Examples

+

To make these ideas concrete, let’s apply them to a few base +functions:

+
    +
  1. mean() is trivially type-stable and size-stable +because it always returns a double vector of length 1 (or it throws an +error).

  2. +
  3. Surprisingly, median() is type-unstable:

    +
    vec_ptype_show(median(c(1L, 1L)))
    +#> Prototype: double
    +vec_ptype_show(median(c(1L, 1L, 1L)))
    +#> Prototype: integer
    +

    It is, however, size-stable, since it always returns a vector of +length 1.

  4. +
  5. sapply() is type-unstable because you can’t predict +the output type only knowing the input types:

    +
    vec_ptype_show(sapply(1L, function(x) c(x, x)))
    +#> Prototype: integer[,1]
    +vec_ptype_show(sapply(integer(), function(x) c(x, x)))
    +#> Prototype: list
    +

    It’s not quite size-stable; vec_size(sapply(x, f)) is +vec_size(x) for vectors but not for matrices (the output is +transposed) or data frames (it iterates over the columns).

  6. +
  7. vapply() is a type-stable version of +sapply() because +vec_ptype_show(vapply(x, fn, template)) is always +vec_ptype_show(template).
    +It is size-unstable for the same reasons as +sapply().

  8. +
  9. c() is type-unstable because c(x, y) +doesn’t always output the same type as c(y, x).

    +
    vec_ptype_show(c(NA, Sys.Date()))
    +#> Prototype: double
    +vec_ptype_show(c(Sys.Date(), NA))
    +#> Prototype: date
    +

    c() is almost always length-stable because +length(c(x, y)) almost always equals +length(x) + length(y). One common source of instability +here is dealing with non-vectors (see the later section +“Non-vectors”):

    +
    env <- new.env(parent = emptyenv())
    +length(env)
    +#> [1] 0
    +length(mean)
    +#> [1] 1
    +length(c(env, mean))
    +#> [1] 2
  10. +
  11. paste(x1, x2) is length-stable because +length(paste(x1, x2)) equals +max(length(x1), length(x2)). However, it doesn’t follow the +usual arithmetic recycling rules because paste(1:2, 1:3) +doesn’t generate a warning.

  12. +
  13. ifelse() is length-stable because +length(ifelse(cond, true, false)) is always +length(cond). ifelse() is type-unstable +because the output type depends on the value of cond:

    +
    vec_ptype_show(ifelse(NA, 1L, 1L))
    +#> Prototype: logical
    +vec_ptype_show(ifelse(FALSE, 1L, 1L))
    +#> Prototype: integer
  14. +
  15. read.csv(file) is type-unstable and size-unstable +because, while you know it will return a data frame, you don’t know what +columns it will return or how many rows it will have. Similarly, +df[[i]] is not type-stable because the result depends on +the value of i. There are many important functions +that can not be made type-stable or size-stable!

  16. +
+

With this understanding of type- and size-stability in hand, we’ll +use them to analyse some base R functions in greater depth and then +propose alternatives with better properties.

+
+
+
+

c() and vctrs::vec_c()

+

In this section we’ll compare and contrast c() and +vec_c(). vec_c() is both type- and size-stable +because it possesses the following invariants:

+
    +
  • vec_ptype(vec_c(x, y)) equals +vec_ptype_common(x, y).
  • +
  • vec_size(vec_c(x, y)) equals +vec_size(x) + vec_size(y).
  • +
+

c() has another undesirable property in that it’s not +consistent with unlist(); i.e., +unlist(list(x, y)) does not always equal +c(x, y); i.e., base R has multiple sets of type-coercion +rules. I won’t consider this problem further here.

+

I have two goals here:

+
    +
  • To fully document the quirks of c(), hence +motivating the development of an alternative.

  • +
  • To discuss non-obvious consequences of the type- and +size-stability above.

  • +
+
+

Atomic vectors

+

If we only consider atomic vectors, c() is type-stable +because it uses a hierarchy of types: character > complex > double +> integer > logical.

+
c(FALSE, 1L, 2.5)
+#> [1] 0.0 1.0 2.5
+

vec_c() obeys similar rules:

+
vec_c(FALSE, 1L, 2.5)
+#> [1] 0.0 1.0 2.5
+

But it does not automatically coerce to character vectors or +lists:

+
c(FALSE, "x")
+#> [1] "FALSE" "x"
+vec_c(FALSE, "x")
+#> Error in `vec_c()`:
+#> ! Can't combine `..1` <logical> and `..2` <character>.
+
+c(FALSE, list(1))
+#> [[1]]
+#> [1] FALSE
+#> 
+#> [[2]]
+#> [1] 1
+vec_c(FALSE, list(1))
+#> Error in `vec_c()`:
+#> ! Can't combine `..1` <logical> and `..2` <list>.
+
+
+

Incompatible vectors and non-vectors

+

In general, most base methods do not throw an error:

+
c(10.5, factor("x"))
+#> [1] 10.5  1.0
+

If the inputs aren’t vectors, c() automatically puts +them in a list:

+
c(mean, globalenv())
+#> [[1]]
+#> function (x, ...) 
+#> UseMethod("mean")
+#> <bytecode: 0x103a05448>
+#> <environment: namespace:base>
+#> 
+#> [[2]]
+#> <environment: R_GlobalEnv>
+

For numeric versions, this depends on the order of inputs. Version +first is an error, otherwise the input is wrapped in a list:

+
c(getRversion(), "x")
+#> Error: invalid version specification 'x'
+
+c("x", getRversion())
+#> [[1]]
+#> [1] "x"
+#> 
+#> [[2]]
+#> [1] 4 3 1
+

vec_c() throws an error if the inputs are not vectors or +not automatically coercible:

+
vec_c(mean, globalenv())
+#> Error in `vec_c()`:
+#> ! `..1` must be a vector, not a function.
+
+vec_c(Sys.Date(), factor("x"), "x")
+#> Error in `vec_c()`:
+#> ! Can't combine `..1` <date> and `..2` <factor<bf275>>.
+
+
+

Factors

+

Combining two factors returns an integer vector:

+
fa <- factor("a")
+fb <- factor("b")
+
+c(fa, fb)
+#> [1] a b
+#> Levels: a b
+

(This is documented in c() but is still +undesirable.)

+

vec_c() returns a factor taking the union of the levels. +This behaviour is motivated by pragmatics: there are many places in base +R that automatically convert character vectors to factors, so enforcing +stricter behaviour would be unnecessarily onerous. (This is backed up by +experience with dplyr::bind_rows(), which is stricter and +is a common source of user difficulty.)

+
vec_c(fa, fb)
+#> [1] a b
+#> Levels: a b
+vec_c(fb, fa)
+#> [1] b a
+#> Levels: b a
+
+
+

Date-times

+

c() strips the time zone associated with date-times:

+
datetime_nz <- as.POSIXct("2020-01-01 09:00", tz = "Pacific/Auckland")
+c(datetime_nz)
+#> [1] "2020-01-01 09:00:00 NZDT"
+

This behaviour is documented in ?DateTimeClasses but is +the source of considerable user pain.

+

vec_c() preserves time zones:

+
vec_c(datetime_nz)
+#> [1] "2020-01-01 09:00:00 NZDT"
+

What time zone should the output have if inputs have different time +zones? One option would be to be strict and force the user to manually +align all the time zones. However, this is onerous (particularly because +there’s no easy way to change the time zone in base R), so vctrs chooses +to use the first non-local time zone:

+
datetime_local <- as.POSIXct("2020-01-01 09:00")
+datetime_houston <- as.POSIXct("2020-01-01 09:00", tz = "US/Central")
+
+vec_c(datetime_local, datetime_houston, datetime_nz)
+#> [1] "2020-01-01 08:00:00 CST" "2020-01-01 09:00:00 CST"
+#> [3] "2019-12-31 14:00:00 CST"
+vec_c(datetime_houston, datetime_nz)
+#> [1] "2020-01-01 09:00:00 CST" "2019-12-31 14:00:00 CST"
+vec_c(datetime_nz, datetime_houston)
+#> [1] "2020-01-01 09:00:00 NZDT" "2020-01-02 04:00:00 NZDT"
+
+
+

Dates and date-times

+

Combining dates and date-times with c() gives silently +incorrect results:

+
date <- as.Date("2020-01-01")
+datetime <- as.POSIXct("2020-01-01 09:00")
+
+c(date, datetime)
+#> [1] "2020-01-01" "2020-01-01"
+c(datetime, date)
+#> [1] "2020-01-01 09:00:00 EST" "2019-12-31 19:00:00 EST"
+

This behaviour arises because neither c.Date() nor +c.POSIXct() check that all inputs are of the same type.

+

vec_c() uses a standard set of rules to avoid this +problem. When you mix dates and date-times, vctrs returns a date-time +and converts dates to date-times at midnight (in the timezone of the +date-time).

+
vec_c(date, datetime)
+#> [1] "2020-01-01 00:00:00 EST" "2020-01-01 09:00:00 EST"
+vec_c(date, datetime_nz)
+#> [1] "2020-01-01 00:00:00 NZDT" "2020-01-01 09:00:00 NZDT"
+
+
+

Missing values

+

If a missing value comes at the beginning of the inputs, +c() falls back to the internal behaviour, which strips all +attributes:

+
c(NA, fa)
+#> [1] NA  1
+c(NA, date)
+#> [1]    NA 18262
+c(NA, datetime)
+#> [1]         NA 1577887200
+

vec_c() takes a different approach treating a logical +vector consisting only of NA as the +unspecified() class which can be converted to any other 1d +type:

+
vec_c(NA, fa)
+#> [1] <NA> a   
+#> Levels: a
+vec_c(NA, date)
+#> [1] NA           "2020-01-01"
+vec_c(NA, datetime)
+#> [1] NA                        "2020-01-01 09:00:00 EST"
+
+
+

Data frames

+

Because it is almost always length-stable, c() +combines data frames column wise (into a list):

+
df1 <- data.frame(x = 1)
+df2 <- data.frame(x = 2)
+str(c(df1, df1))
+#> List of 2
+#>  $ x: num 1
+#>  $ x: num 1
+

vec_c() is size-stable, which implies it will row-bind +data frames:

+
vec_c(df1, df2)
+#>   x
+#> 1 1
+#> 2 2
+
+
+

Matrices and arrays

+

The same reasoning applies to matrices:

+
m <- matrix(1:4, nrow = 2)
+c(m, m)
+#> [1] 1 2 3 4 1 2 3 4
+vec_c(m, m)
+#>      [,1] [,2]
+#> [1,]    1    3
+#> [2,]    2    4
+#> [3,]    1    3
+#> [4,]    2    4
+

One difference is that vec_c() will “broadcast” a vector +to match the dimensions of a matrix:

+
c(m, 1)
+#> [1] 1 2 3 4 1
+
+vec_c(m, 1)
+#>      [,1] [,2]
+#> [1,]    1    3
+#> [2,]    2    4
+#> [3,]    1    1
+
+
+

Implementation

+

The basic implementation of vec_c() is reasonably +simple. We first figure out the properties of the output, i.e. the +common type and total size, and then allocate it with +vec_init(), and then insert each input into the correct +place in the output.

+
vec_c <- function(...) {
+  args <- compact(list2(...))
+
+  ptype <- vec_ptype_common(!!!args)
+  if (is.null(ptype))
+    return(NULL)
+
+  ns <- map_int(args, vec_size)
+  out <- vec_init(ptype, sum(ns))
+
+  pos <- 1
+  for (i in seq_along(ns)) {
+    n <- ns[[i]]
+    
+    x <- vec_cast(args[[i]], to = ptype)
+    vec_slice(out, pos:(pos + n - 1)) <- x
+    pos <- pos + n
+  }
+
+  out
+}
+

(The real vec_c() is a bit more complicated in order to +handle inner and outer names).

+
+
+
+

ifelse()

+

One of the functions that motivate the development of vctrs is +ifelse(). It has the surprising property that the result +value is “A vector of the same length and attributes (including +dimensions and class) as test”. To me, it seems more +reasonable for the type of the output to be controlled by the type of +the yes and no arguments.

+

In dplyr::if_else() I swung too far towards strictness: +it throws an error if yes and no are not the +same type. This is annoying in practice because it requires typed +missing values (NA_character_ etc), and because the checks +are only on the class (not the full prototype), it’s easy to create +invalid output.

+

I found it much easier to understand what ifelse() +should do once I internalised the ideas of type- and +size-stability:

+
    +
  • The first argument must be logical.

  • +
  • vec_ptype(if_else(test, yes, no)) equals +vec_ptype_common(yes, no). Unlike ifelse() +this implies that if_else() must always evaluate both +yes and no in order to figure out the correct +type. I think this is consistent with && (scalar +operation, short circuits) and & (vectorised, evaluates +both sides).

  • +
  • vec_size(if_else(test, yes, no)) equals +vec_size_common(test, yes, no). I think the output could +have the same size as test (i.e., the same behaviour as +ifelse), but I think as a general rule that your +inputs should either be mutually recycling or not.

  • +
+

This leads to the following implementation:

+
if_else <- function(test, yes, no) {
+  if (!is_logical(test)) {
+    abort("`test` must be a logical vector.")
+  }
+  
+  c(yes, no) %<-% vec_cast_common(yes, no)
+  c(test, yes, no) %<-% vec_recycle_common(test, yes, no)
+
+  out <- vec_init(yes, vec_size(yes))
+  vec_slice(out, test) <- vec_slice(yes, test)
+  vec_slice(out, !test) <- vec_slice(no, !test)
+
+  out
+}
+
+x <- c(NA, 1:4)
+if_else(x > 2, "small", "big")
+#> [1] NA      "big"   "big"   "small" "small"
+if_else(x > 2, factor("small"), factor("big"))
+#> [1] <NA>  big   big   small small
+#> Levels: small big
+if_else(x > 2, Sys.Date(), Sys.Date() + 7)
+#> [1] NA           "2023-12-08" "2023-12-08" "2023-12-01" "2023-12-01"
+

By using vec_size() and vec_slice(), this +definition of if_else() automatically works with +data.frames and matrices:

+
if_else(x > 2, data.frame(x = 1), data.frame(y = 2))
+#>    x  y
+#> 1 NA NA
+#> 2 NA  2
+#> 3 NA  2
+#> 4  1 NA
+#> 5  1 NA
+
+if_else(x > 2, matrix(1:10, ncol = 2), cbind(30, 30))
+#>      [,1] [,2]
+#> [1,]   NA   NA
+#> [2,]   30   30
+#> [3,]   30   30
+#> [4,]    4    9
+#> [5,]    5   10
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/type-size.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/type-size.R new file mode 100644 index 00000000..b0401479 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/type-size.R @@ -0,0 +1,196 @@ +## ----setup, include = FALSE--------------------------------------------------- +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) + +## ----------------------------------------------------------------------------- +library(vctrs) + +## ----------------------------------------------------------------------------- +vec_ptype_show(FALSE) +vec_ptype_show(1L) +vec_ptype_show(2.5) +vec_ptype_show("three") +vec_ptype_show(list(1, 2, 3)) + +## ----------------------------------------------------------------------------- +vec_ptype_show(array(logical(), c(2, 3))) +vec_ptype_show(array(integer(), c(2, 3, 4))) +vec_ptype_show(array(character(), c(2, 3, 4, 5))) + +## ----------------------------------------------------------------------------- +vec_ptype_show(factor("a")) +vec_ptype_show(ordered("b")) + +## ----------------------------------------------------------------------------- +vec_ptype(factor("a")) + +## ----------------------------------------------------------------------------- +vec_ptype_show(Sys.Date()) +vec_ptype_show(Sys.time()) +vec_ptype_show(as.difftime(10, units = "mins")) + +## ----------------------------------------------------------------------------- +vec_ptype_show(data.frame(a = FALSE, b = 1L, c = 2.5, d = "x")) + +## ----------------------------------------------------------------------------- +df <- data.frame(x = FALSE) +df$y <- data.frame(a = 1L, b = 2.5) +vec_ptype_show(df) + +## ----error = TRUE------------------------------------------------------------- +vec_ptype_show(logical(), integer(), double()) + +vec_ptype_show(logical(), character()) + +## ----------------------------------------------------------------------------- +vec_ptype_show( + array(1, c(0, 1)), + array(1, c(0, 2)) +) + +vec_ptype_show( + array(1, c(0, 1)), + array(1, c(0, 3)), + array(1, c(0, 3, 4)), + array(1, c(0, 3, 4, 5)) +) + +## ----error = TRUE------------------------------------------------------------- +vec_ptype_show( + array(1, c(0, 2)), + array(1, c(0, 3)) +) + +## ----------------------------------------------------------------------------- +fa <- factor("a") +fb <- factor("b") + +levels(vec_ptype_common(fa, fb)) +levels(vec_ptype_common(fb, fa)) + +## ----------------------------------------------------------------------------- +vec_ptype_show(new_date(), new_datetime()) + +## ----------------------------------------------------------------------------- +vec_ptype_show( + new_datetime(tzone = "US/Central"), + new_datetime(tzone = "Pacific/Auckland") +) + +## ----------------------------------------------------------------------------- +vec_ptype_show( + new_datetime(tzone = ""), + new_datetime(tzone = ""), + new_datetime(tzone = "Pacific/Auckland") +) + +## ----------------------------------------------------------------------------- +vec_ptype_show( + data.frame(x = FALSE), + data.frame(x = 1L), + data.frame(x = 2.5) +) + +## ----------------------------------------------------------------------------- +vec_ptype_show(data.frame(x = 1, y = 1), data.frame(y = 1, z = 1)) + +## ----------------------------------------------------------------------------- +str(vec_cast_common( + FALSE, + 1:5, + 2.5 +)) + +str(vec_cast_common( + factor("x"), + factor("y") +)) + +str(vec_cast_common( + data.frame(x = 1), + data.frame(y = 1:2) +)) + +## ----error = TRUE------------------------------------------------------------- +# Cast succeeds +vec_cast(c(1, 2), integer()) + +# Cast fails +vec_cast(c(1.5, 2.5), factor("a")) + +## ----error = TRUE------------------------------------------------------------- +vec_cast(c(1.5, 2), integer()) + +## ----------------------------------------------------------------------------- +allow_lossy_cast( + vec_cast(c(1.5, 2), integer()) +) + +## ----------------------------------------------------------------------------- +allow_lossy_cast( + vec_cast(c(1.5, 2), integer()), + x_ptype = double(), + to_ptype = integer() +) + +## ----------------------------------------------------------------------------- +x <- sample(1:10) +df <- data.frame(x = x) + +vec_slice(x, 5:6) +vec_slice(df, 5:6) + +## ----------------------------------------------------------------------------- +vec_size_common(1:3, 1:3, 1:3) +vec_size_common(1:10, 1) +vec_size_common(integer(), 1) + +## ----echo = FALSE, fig.cap="Summary of vctrs recycling rules. X indicates an error"---- +knitr::include_graphics("../man/figures/sizes-recycling.png", dpi = 300) + +## ----------------------------------------------------------------------------- +vec_recycle(1:3, 3) +vec_recycle(1, 10) + +## ----------------------------------------------------------------------------- +vec_recycle_common(1:3, 1:3) +vec_recycle_common(1:10, 1) + +## ----------------------------------------------------------------------------- +rep(1, 6) + 1 +rep(1, 6) + 1:2 +rep(1, 6) + 1:3 + +## ----------------------------------------------------------------------------- +invisible(pmax(1:2, 1:3)) +invisible(1:2 + 1:3) +invisible(cbind(1:2, 1:3)) + +## ----------------------------------------------------------------------------- +length(atan2(1:3, 1:2)) +length(paste(1:3, 1:2)) +length(ifelse(1:3, 1:2, 1:2)) + +## ----error = TRUE------------------------------------------------------------- +data.frame(1:2, 1:3) + +## ----error = TRUE------------------------------------------------------------- +# length-0 output +1:2 + integer() +atan2(1:2, integer()) +pmax(1:2, integer()) + +# dropped +cbind(1:2, integer()) + +# recycled to length of first +ifelse(rep(TRUE, 4), integer(), character()) + +# preserved-ish +paste(1:2, integer()) + +# Errors +data.frame(1:2, integer()) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/type-size.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/type-size.Rmd new file mode 100644 index 00000000..008ee770 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/type-size.Rmd @@ -0,0 +1,402 @@ +--- +title: "Prototypes and sizes" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Prototypes and sizes} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r setup, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + +Rather than using `class()` and `length()`, vctrs has notions of prototype (`vec_ptype_show()`) and size (`vec_size()`). This vignette discusses the motivation for why these alternatives are necessary and connects their definitions to type coercion and the recycling rules. + +Size and prototype are motivated by thinking about the optimal behaviour for `c()` and `rbind()`, particularly inspired by data frames with columns that are matrices or data frames. + +```{r} +library(vctrs) +``` + +## Prototype + +The idea of a prototype is to capture the metadata associated with a vector without capturing any data. Unfortunately, the `class()` of an object is inadequate for this purpose: + +* The `class()` doesn't include attributes. Attributes are important because, + for example, they store the levels of a factor and the timezone of a + `POSIXct`. You cannot combine two factors or two `POSIXct`s without + thinking about the attributes. + +* The `class()` of a matrix is "matrix" and doesn't include the type of the + underlying vector or the dimensionality. + +Instead, vctrs takes advantage of R's vectorised nature and uses a __prototype__, a 0-observation slice of the vector (this is basically `x[0]` but with some subtleties we'll come back to later). This is a miniature version of the vector that contains all of the attributes but none of the data. + +Conveniently, you can create many prototypes using existing base functions (e.g, `double()` and `factor(levels = c("a", "b"))`). vctrs provides a few helpers (e.g. `new_date()`, `new_datetime()`, and `new_duration()`) where the equivalents in base R are missing. + +### Base prototypes + +`vec_ptype()` creates a prototype from an existing object. However, many base vectors have uninformative printing methods for 0-length subsets, so vctrs also provides `vec_ptype_show()`, which prints the prototype in a friendly way (and returns nothing). + +Using `vec_ptype_show()` allows us to see the prototypes base R classes: + +* Atomic vectors have no attributes and just display the underlying `typeof()`: + + ```{r} + vec_ptype_show(FALSE) + vec_ptype_show(1L) + vec_ptype_show(2.5) + vec_ptype_show("three") + vec_ptype_show(list(1, 2, 3)) + ``` + +* The prototype of matrices and arrays include the base type and the + dimensions after the first: + + ```{r} + vec_ptype_show(array(logical(), c(2, 3))) + vec_ptype_show(array(integer(), c(2, 3, 4))) + vec_ptype_show(array(character(), c(2, 3, 4, 5))) + ``` + +* The prototype of a factor includes its levels. Levels are a character vector, + which can be arbitrarily long, so the prototype just shows a hash. If the + hash of two factors is equal, it's highly likely that their levels are also + equal. + + ```{r} + vec_ptype_show(factor("a")) + vec_ptype_show(ordered("b")) + ``` + + While `vec_ptype_show()` prints only the hash, the prototype object itself does + contain all levels: + + ```{r} + vec_ptype(factor("a")) + ``` + +* Base R has three key date time classes: dates, date-times (`POSIXct`), + and durations (`difftime)`. Date-times have a timezone, and durations have + a unit. + + ```{r} + vec_ptype_show(Sys.Date()) + vec_ptype_show(Sys.time()) + vec_ptype_show(as.difftime(10, units = "mins")) + ``` + +* Data frames have the most complex prototype: the prototype of a data frame + is the name and prototype of each column: + + ```{r} + vec_ptype_show(data.frame(a = FALSE, b = 1L, c = 2.5, d = "x")) + ``` + + Data frames can have columns that are themselves data frames, making this + a "recursive" type: + + ```{r} + df <- data.frame(x = FALSE) + df$y <- data.frame(a = 1L, b = 2.5) + vec_ptype_show(df) + ``` + +### Coercing to common type + +It's often important to combine vectors with multiple types. vctrs provides a consistent set of rules for coercion, via `vec_ptype_common()`. `vec_ptype_common()` possesses the following invariants: + +* `class(vec_ptype_common(x, y))` equals `class(vec_ptype_common(y, x))`. + +* `class(vec_ptype_common(x, vec_ptype_common(y, z))` equals + `class(vec_ptype_common(vec_ptype_common(x, y), z))`. + +* `vec_ptype_common(x, NULL) == vec_ptype(x)`. + +i.e., `vec_ptype_common()` is both commutative and associative (with respect to class) and has an identity element, `NULL`; i.e., it's a __commutative monoid__. This means the underlying implementation is quite simple: we can find the common type of any number of objects by progressively finding the common type of pairs of objects. + +Like with `vec_ptype()`, the easiest way to explore `vec_ptype_common()` is with `vec_ptype_show()`: when given multiple inputs, it will print their common prototype. (In other words: program with `vec_ptype_common()` but play with `vec_ptype_show()`.) + +* The common type of atomic vectors is computed very similar to the rules of base + R, except that we do not coerce to character automatically: + + ```{r, error = TRUE} + vec_ptype_show(logical(), integer(), double()) + + vec_ptype_show(logical(), character()) + ``` + +* Matrices and arrays are automatically broadcast to higher dimensions: + + ```{r} + vec_ptype_show( + array(1, c(0, 1)), + array(1, c(0, 2)) + ) + + vec_ptype_show( + array(1, c(0, 1)), + array(1, c(0, 3)), + array(1, c(0, 3, 4)), + array(1, c(0, 3, 4, 5)) + ) + ``` + + Provided that the dimensions follow the vctrs recycling rules: + + ```{r, error = TRUE} + vec_ptype_show( + array(1, c(0, 2)), + array(1, c(0, 3)) + ) + ``` + +* Factors combine levels in the order in which they appear. + + ```{r} + fa <- factor("a") + fb <- factor("b") + + levels(vec_ptype_common(fa, fb)) + levels(vec_ptype_common(fb, fa)) + ``` + +* Combining a date and date-time yields a date-time: + + ```{r} + vec_ptype_show(new_date(), new_datetime()) + ``` + + When combining two date times, the timezone is taken from the first input: + + ```{r} + vec_ptype_show( + new_datetime(tzone = "US/Central"), + new_datetime(tzone = "Pacific/Auckland") + ) + ``` + + Unless it's the local timezone, in which case any explicit time zone will + win: + + ```{r} + vec_ptype_show( + new_datetime(tzone = ""), + new_datetime(tzone = ""), + new_datetime(tzone = "Pacific/Auckland") + ) + ``` + +* The common type of two data frames is the common type of each column that + occurs in both data frames: + + ```{r} + vec_ptype_show( + data.frame(x = FALSE), + data.frame(x = 1L), + data.frame(x = 2.5) + ) + ``` + + And the union of the columns that only occur in one: + + ```{r} + vec_ptype_show(data.frame(x = 1, y = 1), data.frame(y = 1, z = 1)) + ``` + + Note that new columns are added on the right-hand side. This is consistent + with the way that factor levels and time zones are handled. + +### Casting to specified type + +`vec_ptype_common()` finds the common type of a set of vector. Typically, however, what you want is a set of vectors coerced to that common type. That's the job of `vec_cast_common()`: + +```{r} +str(vec_cast_common( + FALSE, + 1:5, + 2.5 +)) + +str(vec_cast_common( + factor("x"), + factor("y") +)) + +str(vec_cast_common( + data.frame(x = 1), + data.frame(y = 1:2) +)) +``` + +Alternatively, you can cast to a specific prototype using `vec_cast()`: + +```{r, error = TRUE} +# Cast succeeds +vec_cast(c(1, 2), integer()) + +# Cast fails +vec_cast(c(1.5, 2.5), factor("a")) +``` + +If a cast is possible in general (i.e., double -> integer), but information is lost for a specific input (e.g. 1.5 -> 1), it will generate an error. + +```{r, error = TRUE} +vec_cast(c(1.5, 2), integer()) +``` + +You can suppress the lossy cast errors with `allow_lossy_cast()`: + +```{r} +allow_lossy_cast( + vec_cast(c(1.5, 2), integer()) +) +``` + +This will suppress all lossy cast errors. Supply prototypes if you want to be specific about the type of lossy cast allowed: + +```{r} +allow_lossy_cast( + vec_cast(c(1.5, 2), integer()), + x_ptype = double(), + to_ptype = integer() +) +``` + +The set of casts should not be more permissive than the set of coercions. This is not enforced but it is expected from classes to follow the rule and keep the coercion ecosystem sound. + + +## Size + +`vec_size()` was motivated by the need to have an invariant that describes the number of "observations" in a data structure. This is particularly important for data frames, as it's useful to have some function such that `f(data.frame(x))` equals `f(x)`. No base function has this property: + +* `length(data.frame(x))` equals `1` because the length of a data frame + is the number of columns. + +* `nrow(data.frame(x))` does not equal `nrow(x)` because `nrow()` of a + vector is `NULL`. + +* `NROW(data.frame(x))` equals `NROW(x)` for vector `x`, so is almost what + we want. But because `NROW()` is defined in terms of `length()`, it returns + a value for every object, even types that can't go in a data frame, e.g. + `data.frame(mean)` errors even though `NROW(mean)` is `1`. + +We define `vec_size()` as follows: + +* It is the length of 1d vectors. +* It is the number of rows of data frames, matrices, and arrays. +* It throws error for non vectors. + +Given `vec_size()`, we can give a precise definition of a data frame: a data frame is a list of vectors where every vector has the same size. This has the desirable property of trivially supporting matrix and data frame columns. + +### Slicing + +`vec_slice()` is to `vec_size()` as `[` is to `length()`; i.e., it allows you to select observations regardless of the dimensionality of the underlying object. `vec_slice(x, i)` is equivalent to: + +* `x[i]` when `x` is a vector. +* `x[i, , drop = FALSE]` when `x` is a data frame. +* `x[i, , , drop = FALSE]` when `x` is a 3d array. + +```{r} +x <- sample(1:10) +df <- data.frame(x = x) + +vec_slice(x, 5:6) +vec_slice(df, 5:6) +``` + +`vec_slice(data.frame(x), i)` equals `data.frame(vec_slice(x, i))` (modulo variable and row names). + +Prototypes are generated with `vec_slice(x, 0L)`; given a prototype, you can initialize a vector of given size (filled with `NA`s) with `vec_init()`. + +### Common sizes: recycling rules + +Closely related to the definition of size are the __recycling rules__. The recycling rules determine the size of the output when two vectors of different sizes are combined. In vctrs, the recycling rules are encoded in `vec_size_common()`, which gives the common size of a set of vectors: + +```{r} +vec_size_common(1:3, 1:3, 1:3) +vec_size_common(1:10, 1) +vec_size_common(integer(), 1) +``` + +vctrs obeys a stricter set of recycling rules than base R. Vectors of size 1 are recycled to any other size. All other size combinations will generate an error. This strictness prevents common mistakes like `dest == c("IAH", "HOU"))`, at the cost of occasionally requiring an explicit calls to `rep()`. + +```{r, echo = FALSE, fig.cap="Summary of vctrs recycling rules. X indicates an error"} +knitr::include_graphics("../man/figures/sizes-recycling.png", dpi = 300) +``` + +You can apply the recycling rules in two ways: + +* If you have a vector and desired size, use `vec_recycle()`: + + ```{r} + vec_recycle(1:3, 3) + vec_recycle(1, 10) + ``` + +* If you have multiple vectors and you want to recycle them to the same + size, use `vec_recycle_common()`: + + ```{r} + vec_recycle_common(1:3, 1:3) + vec_recycle_common(1:10, 1) + ``` + +## Appendix: recycling in base R + +The recycling rules in base R are described in [The R Language Definition](https://cran.r-project.org/doc/manuals/r-release/R-lang.html#Recycling-rules) but are not implemented in a single function and thus are not applied consistently. Here, I give a brief overview of their most common realisation, as well as showing some of the exceptions. + +Generally, in base R, when a pair of vectors is not the same length, the shorter vector is recycled to the same length as the longer: + +```{r} +rep(1, 6) + 1 +rep(1, 6) + 1:2 +rep(1, 6) + 1:3 +``` + +If the length of the longer vector is not an integer multiple of the length of the shorter, you usually get a warning: + +```{r} +invisible(pmax(1:2, 1:3)) +invisible(1:2 + 1:3) +invisible(cbind(1:2, 1:3)) +``` + +But some functions recycle silently: + +```{r} +length(atan2(1:3, 1:2)) +length(paste(1:3, 1:2)) +length(ifelse(1:3, 1:2, 1:2)) +``` + +And `data.frame()` throws an error: + +```{r, error = TRUE} +data.frame(1:2, 1:3) +``` + +The R language definition states that "any arithmetic operation involving a zero-length vector has a zero-length result". But outside of arithmetic, this rule is not consistently followed: + +```{r, error = TRUE} +# length-0 output +1:2 + integer() +atan2(1:2, integer()) +pmax(1:2, integer()) + +# dropped +cbind(1:2, integer()) + +# recycled to length of first +ifelse(rep(TRUE, 4), integer(), character()) + +# preserved-ish +paste(1:2, integer()) + +# Errors +data.frame(1:2, integer()) +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/type-size.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/type-size.html new file mode 100644 index 00000000..64eab1f1 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/doc/type-size.html @@ -0,0 +1,845 @@ + + + + + + + + + + + + + + +Prototypes and sizes + + + + + + + + + + + + + + + + + + + + + + + + + + +

Prototypes and sizes

+ + + +

Rather than using class() and length(), +vctrs has notions of prototype (vec_ptype_show()) and size +(vec_size()). This vignette discusses the motivation for +why these alternatives are necessary and connects their definitions to +type coercion and the recycling rules.

+

Size and prototype are motivated by thinking about the optimal +behaviour for c() and rbind(), particularly +inspired by data frames with columns that are matrices or data +frames.

+
library(vctrs)
+
+

Prototype

+

The idea of a prototype is to capture the metadata associated with a +vector without capturing any data. Unfortunately, the +class() of an object is inadequate for this purpose:

+
    +
  • The class() doesn’t include attributes. Attributes +are important because, for example, they store the levels of a factor +and the timezone of a POSIXct. You cannot combine two +factors or two POSIXcts without thinking about the +attributes.

  • +
  • The class() of a matrix is “matrix” and doesn’t +include the type of the underlying vector or the +dimensionality.

  • +
+

Instead, vctrs takes advantage of R’s vectorised nature and uses a +prototype, a 0-observation slice of the vector (this is +basically x[0] but with some subtleties we’ll come back to +later). This is a miniature version of the vector that contains all of +the attributes but none of the data.

+

Conveniently, you can create many prototypes using existing base +functions (e.g, double() and +factor(levels = c("a", "b"))). vctrs provides a few helpers +(e.g. new_date(), new_datetime(), and +new_duration()) where the equivalents in base R are +missing.

+
+

Base prototypes

+

vec_ptype() creates a prototype from an existing object. +However, many base vectors have uninformative printing methods for +0-length subsets, so vctrs also provides vec_ptype_show(), +which prints the prototype in a friendly way (and returns nothing).

+

Using vec_ptype_show() allows us to see the prototypes +base R classes:

+
    +
  • Atomic vectors have no attributes and just display the underlying +typeof():

    +
    vec_ptype_show(FALSE)
    +#> Prototype: logical
    +vec_ptype_show(1L)
    +#> Prototype: integer
    +vec_ptype_show(2.5)
    +#> Prototype: double
    +vec_ptype_show("three")
    +#> Prototype: character
    +vec_ptype_show(list(1, 2, 3))
    +#> Prototype: list
  • +
  • The prototype of matrices and arrays include the base type and +the dimensions after the first:

    +
    vec_ptype_show(array(logical(), c(2, 3)))
    +#> Prototype: logical[,3]
    +vec_ptype_show(array(integer(), c(2, 3, 4)))
    +#> Prototype: integer[,3,4]
    +vec_ptype_show(array(character(), c(2, 3, 4, 5)))
    +#> Prototype: character[,3,4,5]
  • +
  • The prototype of a factor includes its levels. Levels are a +character vector, which can be arbitrarily long, so the prototype just +shows a hash. If the hash of two factors is equal, it’s highly likely +that their levels are also equal.

    +
    vec_ptype_show(factor("a"))
    +#> Prototype: factor<4d52a>
    +vec_ptype_show(ordered("b"))
    +#> Prototype: ordered<9b7e3>
    +

    While vec_ptype_show() prints only the hash, the +prototype object itself does contain all levels:

    +
    vec_ptype(factor("a"))
    +#> factor()
    +#> Levels: a
  • +
  • Base R has three key date time classes: dates, date-times +(POSIXct), and durations (difftime). +Date-times have a timezone, and durations have a unit.

    +
    vec_ptype_show(Sys.Date())
    +#> Prototype: date
    +vec_ptype_show(Sys.time())
    +#> Prototype: datetime<local>
    +vec_ptype_show(as.difftime(10, units = "mins"))
    +#> Prototype: duration<mins>
  • +
  • Data frames have the most complex prototype: the prototype of a +data frame is the name and prototype of each column:

    +
    vec_ptype_show(data.frame(a = FALSE, b = 1L, c = 2.5, d = "x"))
    +#> Prototype: data.frame<
    +#>   a: logical
    +#>   b: integer
    +#>   c: double
    +#>   d: character
    +#> >
    +

    Data frames can have columns that are themselves data frames, making +this a “recursive” type:

    +
    df <- data.frame(x = FALSE)
    +df$y <- data.frame(a = 1L, b = 2.5)
    +vec_ptype_show(df)
    +#> Prototype: data.frame<
    +#>   x: logical
    +#>   y: 
    +#>     data.frame<
    +#>       a: integer
    +#>       b: double
    +#>     >
    +#> >
  • +
+
+
+

Coercing to common type

+

It’s often important to combine vectors with multiple types. vctrs +provides a consistent set of rules for coercion, via +vec_ptype_common(). vec_ptype_common() +possesses the following invariants:

+
    +
  • class(vec_ptype_common(x, y)) equals +class(vec_ptype_common(y, x)).

  • +
  • class(vec_ptype_common(x, vec_ptype_common(y, z)) +equals +class(vec_ptype_common(vec_ptype_common(x, y), z)).

  • +
  • vec_ptype_common(x, NULL) == vec_ptype(x).

  • +
+

i.e., vec_ptype_common() is both commutative and +associative (with respect to class) and has an identity element, +NULL; i.e., it’s a commutative monoid. +This means the underlying implementation is quite simple: we can find +the common type of any number of objects by progressively finding the +common type of pairs of objects.

+

Like with vec_ptype(), the easiest way to explore +vec_ptype_common() is with vec_ptype_show(): +when given multiple inputs, it will print their common prototype. (In +other words: program with vec_ptype_common() but play with +vec_ptype_show().)

+
    +
  • The common type of atomic vectors is computed very similar to the +rules of base R, except that we do not coerce to character +automatically:

    +
    vec_ptype_show(logical(), integer(), double())
    +#> Prototype: <double>
    +#> 0. (           , <logical> ) = <logical>
    +#> 1. ( <logical> , <integer> ) = <integer>
    +#> 2. ( <integer> , <double>  ) = <double>
    +
    +vec_ptype_show(logical(), character())
    +#> Error in `vec_ptype_show()`:
    +#> ! Can't combine `out_types[[i - 1]]` <logical> and `in_types[[i]]` <character>.
  • +
  • Matrices and arrays are automatically broadcast to higher +dimensions:

    +
    vec_ptype_show(
    +  array(1, c(0, 1)), 
    +  array(1, c(0, 2))
    +)
    +#> Prototype: <double[,2]>
    +#> 0. (              , <double[,1]> ) = <double[,1]>
    +#> 1. ( <double[,1]> , <double[,2]> ) = <double[,2]>
    +
    +vec_ptype_show(
    +  array(1, c(0, 1)), 
    +  array(1, c(0, 3)),
    +  array(1, c(0, 3, 4)),
    +  array(1, c(0, 3, 4, 5))
    +)
    +#> Prototype: <double[,3,4,5]>
    +#> 0. (                , <double[,1]>     ) = <double[,1]>    
    +#> 1. ( <double[,1]>   , <double[,3]>     ) = <double[,3]>    
    +#> 2. ( <double[,3]>   , <double[,3,4]>   ) = <double[,3,4]>  
    +#> 3. ( <double[,3,4]> , <double[,3,4,5]> ) = <double[,3,4,5]>
    +

    Provided that the dimensions follow the vctrs recycling rules:

    +
    vec_ptype_show(
    +  array(1, c(0, 2)), 
    +  array(1, c(0, 3))
    +)
    +#> Error:
    +#> ! Can't combine `out_types[[i - 1]]` <double[,2]> and `in_types[[i]]` <double[,3]>.
    +#> ✖ Incompatible sizes 2 and 3 along axis 2.
  • +
  • Factors combine levels in the order in which they appear.

    +
    fa <- factor("a")
    +fb <- factor("b")
    +
    +levels(vec_ptype_common(fa, fb))
    +#> [1] "a" "b"
    +levels(vec_ptype_common(fb, fa))
    +#> [1] "b" "a"
  • +
  • Combining a date and date-time yields a date-time:

    +
    vec_ptype_show(new_date(), new_datetime())
    +#> Prototype: <datetime<local>>
    +#> 0. (        , <date>            ) = <date>           
    +#> 1. ( <date> , <datetime<local>> ) = <datetime<local>>
    +

    When combining two date times, the timezone is taken from the first +input:

    +
    vec_ptype_show(
    +  new_datetime(tzone = "US/Central"), 
    +  new_datetime(tzone = "Pacific/Auckland")
    +)
    +#> Prototype: <datetime<US/Central>>
    +#> 0. (                        , <datetime<US/Central>>       ) = <datetime<US/Central>>
    +#> 1. ( <datetime<US/Central>> , <datetime<Pacific/Auckland>> ) = <datetime<US/Central>>
    +

    Unless it’s the local timezone, in which case any explicit time zone +will win:

    +
    vec_ptype_show(
    +  new_datetime(tzone = ""), 
    +  new_datetime(tzone = ""), 
    +  new_datetime(tzone = "Pacific/Auckland")
    +)
    +#> Prototype: <datetime<Pacific/Auckland>>
    +#> 0. (                   , <datetime<local>>            ) = <datetime<local>>           
    +#> 1. ( <datetime<local>> , <datetime<local>>            ) = <datetime<local>>           
    +#> 2. ( <datetime<local>> , <datetime<Pacific/Auckland>> ) = <datetime<Pacific/Auckland>>
  • +
  • The common type of two data frames is the common type of each +column that occurs in both data frames:

    +
    vec_ptype_show(
    +  data.frame(x = FALSE), 
    +  data.frame(x = 1L),
    +  data.frame(x = 2.5)
    +)
    +#> Prototype: <data.frame<x:double>>
    +#> 0. (                         , <data.frame<x:logical>> ) = <data.frame<x:logical>>
    +#> 1. ( <data.frame<x:logical>> , <data.frame<x:integer>> ) = <data.frame<x:integer>>
    +#> 2. ( <data.frame<x:integer>> , <data.frame<x:double>>  ) = <data.frame<x:double>>
    +

    And the union of the columns that only occur in one:

    +
    vec_ptype_show(data.frame(x = 1, y = 1), data.frame(y = 1, z = 1))
    +#> Prototype: <data.frame<
    +#>   x: double
    +#>   y: double
    +#>   z: double
    +#> >>
    +#> 0. ┌              , <data.frame< ┐ = <data.frame<
    +#>    │                  x: double  │     x: double 
    +#>    │                  y: double  │     y: double 
    +#>    └                >>           ┘   >>          
    +#> 1. ┌ <data.frame< , <data.frame< ┐ = <data.frame<
    +#>    │   x: double      y: double  │     x: double 
    +#>    │   y: double      z: double  │     y: double 
    +#>    │ >>             >>           │     z: double 
    +#>    └                             ┘   >>
    +

    Note that new columns are added on the right-hand side. This is +consistent with the way that factor levels and time zones are +handled.

  • +
+
+
+

Casting to specified type

+

vec_ptype_common() finds the common type of a set of +vector. Typically, however, what you want is a set of vectors coerced to +that common type. That’s the job of vec_cast_common():

+
str(vec_cast_common(
+  FALSE, 
+  1:5, 
+  2.5
+))
+#> List of 3
+#>  $ : num 0
+#>  $ : num [1:5] 1 2 3 4 5
+#>  $ : num 2.5
+
+str(vec_cast_common(
+  factor("x"), 
+  factor("y")
+))
+#> List of 2
+#>  $ : Factor w/ 2 levels "x","y": 1
+#>  $ : Factor w/ 2 levels "x","y": 2
+
+str(vec_cast_common(
+  data.frame(x = 1),
+  data.frame(y = 1:2)
+))
+#> List of 2
+#>  $ :'data.frame':    1 obs. of  2 variables:
+#>   ..$ x: num 1
+#>   ..$ y: int NA
+#>  $ :'data.frame':    2 obs. of  2 variables:
+#>   ..$ x: num [1:2] NA NA
+#>   ..$ y: int [1:2] 1 2
+

Alternatively, you can cast to a specific prototype using +vec_cast():

+
# Cast succeeds
+vec_cast(c(1, 2), integer())
+#> [1] 1 2
+
+# Cast fails
+vec_cast(c(1.5, 2.5), factor("a"))
+#> Error:
+#> ! Can't convert `c(1.5, 2.5)` <double> to <factor<4d52a>>.
+

If a cast is possible in general (i.e., double -> integer), but +information is lost for a specific input (e.g. 1.5 -> 1), it will +generate an error.

+
vec_cast(c(1.5, 2), integer())
+#> Error:
+#> ! Can't convert from `c(1.5, 2)` <double> to <integer> due to loss of precision.
+#> • Locations: 1
+

You can suppress the lossy cast errors with +allow_lossy_cast():

+
allow_lossy_cast(
+  vec_cast(c(1.5, 2), integer())
+)
+#> [1] 1 2
+

This will suppress all lossy cast errors. Supply prototypes if you +want to be specific about the type of lossy cast allowed:

+
allow_lossy_cast(
+  vec_cast(c(1.5, 2), integer()),
+  x_ptype = double(),
+  to_ptype = integer()
+)
+#> [1] 1 2
+

The set of casts should not be more permissive than the set of +coercions. This is not enforced but it is expected from classes to +follow the rule and keep the coercion ecosystem sound.

+
+
+
+

Size

+

vec_size() was motivated by the need to have an +invariant that describes the number of “observations” in a data +structure. This is particularly important for data frames, as it’s +useful to have some function such that f(data.frame(x)) +equals f(x). No base function has this property:

+
    +
  • length(data.frame(x)) equals 1 because +the length of a data frame is the number of columns.

  • +
  • nrow(data.frame(x)) does not equal +nrow(x) because nrow() of a vector is +NULL.

  • +
  • NROW(data.frame(x)) equals NROW(x) for +vector x, so is almost what we want. But because +NROW() is defined in terms of length(), it +returns a value for every object, even types that can’t go in a data +frame, e.g. data.frame(mean) errors even though +NROW(mean) is 1.

  • +
+

We define vec_size() as follows:

+
    +
  • It is the length of 1d vectors.
  • +
  • It is the number of rows of data frames, matrices, and arrays.
  • +
  • It throws error for non vectors.
  • +
+

Given vec_size(), we can give a precise definition of a +data frame: a data frame is a list of vectors where every vector has the +same size. This has the desirable property of trivially supporting +matrix and data frame columns.

+
+

Slicing

+

vec_slice() is to vec_size() as +[ is to length(); i.e., it allows you to +select observations regardless of the dimensionality of the underlying +object. vec_slice(x, i) is equivalent to:

+
    +
  • x[i] when x is a vector.
  • +
  • x[i, , drop = FALSE] when x is a data +frame.
  • +
  • x[i, , , drop = FALSE] when x is a 3d +array.
  • +
+
x <- sample(1:10)
+df <- data.frame(x = x)
+
+vec_slice(x, 5:6)
+#> [1] 8 2
+vec_slice(df, 5:6)
+#>   x
+#> 1 8
+#> 2 2
+

vec_slice(data.frame(x), i) equals +data.frame(vec_slice(x, i)) (modulo variable and row +names).

+

Prototypes are generated with vec_slice(x, 0L); given a +prototype, you can initialize a vector of given size (filled with +NAs) with vec_init().

+
+
+

Common sizes: recycling rules

+

Closely related to the definition of size are the recycling +rules. The recycling rules determine the size of the output +when two vectors of different sizes are combined. In vctrs, the +recycling rules are encoded in vec_size_common(), which +gives the common size of a set of vectors:

+
vec_size_common(1:3, 1:3, 1:3)
+#> [1] 3
+vec_size_common(1:10, 1)
+#> [1] 10
+vec_size_common(integer(), 1)
+#> [1] 0
+

vctrs obeys a stricter set of recycling rules than base R. Vectors of +size 1 are recycled to any other size. All other size combinations will +generate an error. This strictness prevents common mistakes like +dest == c("IAH", "HOU")), at the cost of occasionally +requiring an explicit calls to rep().

+
+Summary of vctrs recycling rules. X indicates an error +

+Summary of vctrs recycling rules. X indicates an error +

+
+

You can apply the recycling rules in two ways:

+
    +
  • If you have a vector and desired size, use +vec_recycle():

    +
    vec_recycle(1:3, 3)
    +#> [1] 1 2 3
    +vec_recycle(1, 10)
    +#>  [1] 1 1 1 1 1 1 1 1 1 1
  • +
  • If you have multiple vectors and you want to recycle them to the +same size, use vec_recycle_common():

    +
    vec_recycle_common(1:3, 1:3)
    +#> [[1]]
    +#> [1] 1 2 3
    +#> 
    +#> [[2]]
    +#> [1] 1 2 3
    +vec_recycle_common(1:10, 1)
    +#> [[1]]
    +#>  [1]  1  2  3  4  5  6  7  8  9 10
    +#> 
    +#> [[2]]
    +#>  [1] 1 1 1 1 1 1 1 1 1 1
  • +
+
+
+
+

Appendix: recycling in base R

+

The recycling rules in base R are described in The +R Language Definition but are not implemented in a single function +and thus are not applied consistently. Here, I give a brief overview of +their most common realisation, as well as showing some of the +exceptions.

+

Generally, in base R, when a pair of vectors is not the same length, +the shorter vector is recycled to the same length as the longer:

+
rep(1, 6) + 1
+#> [1] 2 2 2 2 2 2
+rep(1, 6) + 1:2
+#> [1] 2 3 2 3 2 3
+rep(1, 6) + 1:3
+#> [1] 2 3 4 2 3 4
+

If the length of the longer vector is not an integer multiple of the +length of the shorter, you usually get a warning:

+
invisible(pmax(1:2, 1:3))
+#> Warning in pmax(1:2, 1:3): an argument will be fractionally recycled
+invisible(1:2 + 1:3)
+#> Warning in 1:2 + 1:3: longer object length is not a multiple of shorter object
+#> length
+invisible(cbind(1:2, 1:3))
+#> Warning in cbind(1:2, 1:3): number of rows of result is not a multiple of
+#> vector length (arg 1)
+

But some functions recycle silently:

+
length(atan2(1:3, 1:2))
+#> [1] 3
+length(paste(1:3, 1:2))
+#> [1] 3
+length(ifelse(1:3, 1:2, 1:2))
+#> [1] 3
+

And data.frame() throws an error:

+
data.frame(1:2, 1:3)
+#> Error in data.frame(1:2, 1:3): arguments imply differing number of rows: 2, 3
+

The R language definition states that “any arithmetic operation +involving a zero-length vector has a zero-length result”. But outside of +arithmetic, this rule is not consistently followed:

+
# length-0 output
+1:2 + integer()
+#> integer(0)
+atan2(1:2, integer())
+#> numeric(0)
+pmax(1:2, integer())
+#> integer(0)
+
+# dropped
+cbind(1:2, integer())
+#>      [,1]
+#> [1,]    1
+#> [2,]    2
+
+# recycled to length of first
+ifelse(rep(TRUE, 4), integer(), character())
+#> [1] NA NA NA NA
+
+# preserved-ish
+paste(1:2, integer())
+#> [1] "1 " "2 "
+
+# Errors
+data.frame(1:2, integer())
+#> Error in data.frame(1:2, integer()): arguments imply differing number of rows: 2, 0
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/AnIndex new file mode 100644 index 00000000..dc4add73 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/AnIndex @@ -0,0 +1,226 @@ +vctrs-package vctrs-package +%0% op-empty-default +allow_lossy_cast vctrs-conditions +as-is as-is +as_list_of list_of +data_frame data_frame +df_cast df_ptype2 +df_list df_list +df_ptype2 df_ptype2 +faq-compatibility-types faq-compatibility-types +faq-error-incompatible-attributes faq-error-incompatible-attributes +faq-error-scalar-type faq-error-scalar-type +field fields +field<- fields +fields fields +howto-faq-coercion howto-faq-coercion +howto-faq-coercion-data-frame howto-faq-coercion-data-frame +howto-faq-fix-scalar-type-error howto-faq-fix-scalar-type-error +internal-faq-matches-algorithm internal-faq-matches-algorithm +internal-faq-ptype2-identity internal-faq-ptype2-identity +is_list_of list_of +is_partial new_partial +list_all_size obj_is_list +list_all_vectors obj_is_list +list_check_all_size obj_is_list +list_check_all_vectors obj_is_list +list_drop_empty list_drop_empty +list_of list_of +list_sizes vec_size +list_unchop vec_chop +maybe_lossy_cast maybe_lossy_cast +MISSING vec_arith +missing missing +name_spec name_spec +new_data_frame new_data_frame +new_date new_date +new_datetime new_date +new_duration new_date +new_factor new_factor +new_list_of new_list_of +new_ordered new_factor +new_partial new_partial +new_rcrd new_rcrd +new_vctr new_vctr +num_as_location vec_as_location +num_as_location2 vec_as_location +n_fields fields +obj_check_list obj_is_list +obj_check_vector vector-checks +obj_is_list obj_is_list +obj_is_vector vector-checks +obj_print obj_print +obj_print_data obj_print +obj_print_footer obj_print +obj_print_header obj_print +obj_str obj_print +obj_str_data obj_print +obj_str_footer obj_print +obj_str_header obj_print +order-radix order-radix +partial_factor partial_factor +partial_frame partial_frame +rcrd new_rcrd +reference-faq-compatibility reference-faq-compatibility +runs runs +s3_register s3_register +ses new_rcrd +stop_incompatible_cast vctrs-conditions +stop_incompatible_op vctrs-conditions +stop_incompatible_size vctrs-conditions +stop_incompatible_type vctrs-conditions +table table +theory-faq-coercion theory-faq-coercion +theory-faq-recycling theory-faq-recycling +tib_cast df_ptype2 +tib_ptype2 df_ptype2 +unspecified unspecified +vctr new_vctr +vctrs vctrs-package +vctrs-conditions vctrs-conditions +vctrs-data-frame vctrs-data-frame +vec-rep vec-rep +vec-set vec-set +vector-checks vector-checks +vector_recycling_rules theory-faq-recycling +vec_any_missing missing +vec_arith vec_arith +vec_arith.Date new_date +vec_arith.default vec_arith +vec_arith.difftime new_date +vec_arith.logical vec_arith +vec_arith.numeric vec_arith +vec_arith.POSIXct new_date +vec_arith.POSIXlt new_date +vec_arith_base vec_arith +vec_assert vec_assert +vec_assign vec_slice +vec_as_index vec_as_index +vec_as_location vec_as_location +vec_as_location2 vec_as_location +vec_as_names vec_as_names +vec_as_names_legacy vec_as_names_legacy +vec_as_subscript vec_as_subscript +vec_as_subscript2 vec_as_subscript +vec_bind vec_bind +vec_c vec_c +vec_cast vec_cast +vec_cast.character vec_cast +vec_cast.complex vec_cast +vec_cast.data.frame vctrs-data-frame +vec_cast.Date new_date +vec_cast.difftime new_date +vec_cast.double vec_cast +vec_cast.factor new_factor +vec_cast.integer vec_cast +vec_cast.integer64 int64 +vec_cast.list vec_cast +vec_cast.logical vec_cast +vec_cast.ordered new_factor +vec_cast.POSIXct new_date +vec_cast.POSIXlt new_date +vec_cast.raw vec_cast +vec_cast.vctrs_list_of list_of +vec_cast_common vec_cast +vec_cbind vec_bind +vec_cbind_frame_ptype vec_cbind_frame_ptype +vec_check_list vec_is_list +vec_check_size vector-checks +vec_chop vec_chop +vec_compare vec_compare +vec_count vec_count +vec_data vec_data +vec_default_cast vec_default_ptype2 +vec_default_ptype2 vec_default_ptype2 +vec_detect_complete vec_detect_complete +vec_detect_missing missing +vec_duplicate vec_duplicate +vec_duplicate_any vec_duplicate +vec_duplicate_detect vec_duplicate +vec_duplicate_id vec_duplicate +vec_empty vec_empty +vec_equal vec_equal +vec_equal_na vec_equal_na +vec_expand_grid vec_expand_grid +vec_fill_missing vec_fill_missing +vec_group vec_group +vec_group_id vec_group +vec_group_loc vec_group +vec_group_rle vec_group +vec_identify_runs runs +vec_in vec_match +vec_init vec_init +vec_init_along vec_seq_along +vec_interleave vec_interleave +vec_is vec_assert +vec_is_empty vec_size +vec_is_list vec_is_list +vec_locate_matches vec_locate_matches +vec_locate_sorted_groups vec_locate_sorted_groups +vec_match vec_match +vec_math vec_math +vec_math_base vec_math +vec_names vec_names +vec_names2 vec_names +vec_order vec_order +vec_order_radix order-radix +vec_proxy vec_proxy +vec_proxy_compare vec_proxy_compare +vec_proxy_equal vec_proxy_equal +vec_proxy_order vec_proxy_compare +vec_ptype vec_ptype +vec_ptype2 vec_ptype2 +vec_ptype2.AsIs as-is +vec_ptype2.character vec_ptype2 +vec_ptype2.complex vec_ptype2 +vec_ptype2.data.frame vctrs-data-frame +vec_ptype2.Date new_date +vec_ptype2.difftime new_date +vec_ptype2.double vec_ptype2 +vec_ptype2.factor new_factor +vec_ptype2.integer vec_ptype2 +vec_ptype2.integer64 int64 +vec_ptype2.list vec_ptype2 +vec_ptype2.logical vec_ptype2 +vec_ptype2.ordered new_factor +vec_ptype2.POSIXct new_date +vec_ptype2.POSIXlt new_date +vec_ptype2.raw vec_ptype2 +vec_ptype2.vctrs_list_of list_of +vec_ptype_abbr vec_ptype_full +vec_ptype_abbr.integer64 int64 +vec_ptype_common vec_ptype +vec_ptype_finalise new_partial +vec_ptype_full vec_ptype_full +vec_ptype_full.integer64 int64 +vec_ptype_show vec_ptype +vec_rank vec_rank +vec_rbind vec_bind +vec_recycle vec_recycle +vec_recycle_common vec_recycle +vec_rep vec-rep +vec_repeat vec_repeat +vec_rep_each vec-rep +vec_restore vec_proxy +vec_run_sizes runs +vec_seq_along vec_seq_along +vec_set_difference vec-set +vec_set_intersect vec-set +vec_set_names vec_names +vec_set_symmetric_difference vec-set +vec_set_union vec-set +vec_size vec_size +vec_size_common vec_size +vec_slice vec_slice +vec_slice<- vec_slice +vec_sort vec_order +vec_sort_radix order-radix +vec_split vec_split +vec_type vec_type +vec_type2 vec_type +vec_type_common vec_type +vec_unchop vec_unchop +vec_unique vec_unique +vec_unique_count vec_unique +vec_unique_loc vec_unique +vec_unrep vec-rep diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/aliases.rds new file mode 100644 index 00000000..01f5b076 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/cast.png b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/cast.png new file mode 100644 index 00000000..a859215f Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/cast.png differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/coerce.png b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/coerce.png new file mode 100644 index 00000000..dab8d5ed Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/coerce.png differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/combined.png b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/combined.png new file mode 100644 index 00000000..64cd0226 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/combined.png differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-archived.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-archived.svg new file mode 100644 index 00000000..48f72a6f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-archived.svg @@ -0,0 +1 @@ + lifecyclelifecyclearchivedarchived \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-defunct.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-defunct.svg new file mode 100644 index 00000000..01452e5f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-defunct.svg @@ -0,0 +1 @@ +lifecyclelifecycledefunctdefunct \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-deprecated.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-deprecated.svg new file mode 100644 index 00000000..4baaee01 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-deprecated.svg @@ -0,0 +1 @@ +lifecyclelifecycledeprecateddeprecated \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-experimental.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-experimental.svg new file mode 100644 index 00000000..d1d060e9 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-experimental.svg @@ -0,0 +1 @@ +lifecyclelifecycleexperimentalexperimental \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-maturing.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-maturing.svg new file mode 100644 index 00000000..df713101 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-maturing.svg @@ -0,0 +1 @@ +lifecyclelifecyclematuringmaturing \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-questioning.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-questioning.svg new file mode 100644 index 00000000..08ee0c90 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-questioning.svg @@ -0,0 +1 @@ +lifecyclelifecyclequestioningquestioning \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-soft-deprecated.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-soft-deprecated.svg new file mode 100644 index 00000000..9f014fd1 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-soft-deprecated.svg @@ -0,0 +1 @@ +lifecyclelifecyclesoft-deprecatedsoft-deprecated \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-stable.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-stable.svg new file mode 100644 index 00000000..e015dc81 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-stable.svg @@ -0,0 +1 @@ +lifecyclelifecyclestablestable \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-superseded.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-superseded.svg new file mode 100644 index 00000000..75f24f55 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/lifecycle-superseded.svg @@ -0,0 +1 @@ + lifecyclelifecyclesupersededsuperseded \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/logo.png b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/logo.png new file mode 100644 index 00000000..392e347a Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/logo.png differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/sizes-recycling.png b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/sizes-recycling.png new file mode 100644 index 00000000..981f5233 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/sizes-recycling.png differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/vec-count-deps.png b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/vec-count-deps.png new file mode 100644 index 00000000..ef25d583 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/vec-count-deps.png differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/vec-count-deps.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/vec-count-deps.svg new file mode 100644 index 00000000..0431eeac --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/figures/vec-count-deps.svg @@ -0,0 +1,3 @@ + + + Produced by OmniGraffle 6.6.2 2020-05-22 13:14:22 +0000Canvas 1Layer 1vec_count()vec_proxy_equal()vec_slice()vec_order()vec_proxy()vec_restore()vec_proxy_compare() diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/paths.rds new file mode 100644 index 00000000..ac4ba6ab Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/vctrs.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/vctrs.rdb new file mode 100644 index 00000000..00e40855 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/vctrs.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/vctrs.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/vctrs.rdx new file mode 100644 index 00000000..93713adb Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/help/vctrs.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/html/00Index.html new file mode 100644 index 00000000..0f64be80 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/html/00Index.html @@ -0,0 +1,330 @@ + + +R: Vector Helpers + + + +
+

Vector Helpers + +

+
+
+[Up] +[Top] +

Documentation for package ‘vctrs’ version 0.6.5

+ + + +

Help Pages

+ + +

+A +D +F +H +I +L +M +N +O +R +T +V +misc +

+ + +

-- A --

+ + + + +
as_list_of'list_of' S3 class for homogenous lists
+ +

-- D --

+ + + + + + + + + + +
data_frameConstruct a data frame
df_castCoercion between two data frames
df_listCollect columns for data frame construction
df_ptype2Coercion between two data frames
+ +

-- F --

+ + + + + + + + +
faq-compatibility-typesFAQ - How is the compatibility of vector types decided?
faq-error-incompatible-attributesFAQ - Error/Warning: Some attributes are incompatible
faq-error-scalar-typeFAQ - Error: Input must be a vector
+ +

-- H --

+ + + + + + + + +
howto-faq-coercionFAQ - How to implement ptype2 and cast methods?
howto-faq-coercion-data-frameFAQ - How to implement ptype2 and cast methods? (Data frames)
howto-faq-fix-scalar-type-errorFAQ - Why isn't my class treated as a vector?
+ +

-- I --

+ + + + + + + + +
internal-faq-matches-algorithmInternal FAQ - Implementation of 'vec_locate_matches()'
internal-faq-ptype2-identityInternal FAQ - 'vec_ptype2()', 'NULL', and unspecified vectors
is_list_of'list_of' S3 class for homogenous lists
+ +

-- L --

+ + + + + + + + + + + + + + + + + + +
list_all_sizeList checks
list_all_vectorsList checks
list_check_all_sizeList checks
list_check_all_vectorsList checks
list_drop_emptyDrop empty elements from a list
list_of'list_of' S3 class for homogenous lists
list_sizesNumber of observations
list_unchopChopping
+ +

-- M --

+ + + + +
missingMissing values
+ +

-- N --

+ + + + + + +
name_specName specifications
new_data_frameAssemble attributes for data frame construction
+ +

-- O --

+ + + + + + + + + + +
obj_check_listList checks
obj_check_vectorVector checks
obj_is_listList checks
obj_is_vectorVector checks
+ +

-- R --

+ + + + + + +
reference-faq-compatibilityFAQ - Is my class compatible with vctrs?
runsRuns
+ +

-- T --

+ + + + + + + + + + +
theory-faq-coercionFAQ - How does coercion work in vctrs?
theory-faq-recyclingFAQ - How does recycling work in vctrs and the tidyverse?
tib_castCoercion between two data frames
tib_ptype2Coercion between two data frames
+ +

-- V --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
vec-repRepeat a vector
vec-setSet operations
vector-checksVector checks
vector_recycling_rulesFAQ - How does recycling work in vctrs and the tidyverse?
vec_any_missingMissing values
vec_as_namesRetrieve and repair names
vec_bindCombine many data frames into one data frame
vec_cCombine many vectors into one vector
vec_castCast a vector to a specified type
vec_cast.characterCast a vector to a specified type
vec_cast.complexCast a vector to a specified type
vec_cast.doubleCast a vector to a specified type
vec_cast.integerCast a vector to a specified type
vec_cast.listCast a vector to a specified type
vec_cast.logicalCast a vector to a specified type
vec_cast.rawCast a vector to a specified type
vec_cast.vctrs_list_of'list_of' S3 class for homogenous lists
vec_cast_commonCast a vector to a specified type
vec_cbindCombine many data frames into one data frame
vec_check_sizeVector checks
vec_chopChopping
vec_compareCompare two vectors
vec_countCount unique values in a vector
vec_detect_completeComplete
vec_detect_missingMissing values
vec_duplicateFind duplicated values
vec_duplicate_anyFind duplicated values
vec_duplicate_detectFind duplicated values
vec_duplicate_idFind duplicated values
vec_equalEquality
vec_expand_gridCreate a data frame from all combinations of the inputs
vec_fill_missingFill in missing values with the previous or following value
vec_identify_runsRuns
vec_inFind matching observations across vectors
vec_initInitialize a vector
vec_init_alongUseful sequences
vec_interleaveInterleave many vectors into one vector
vec_is_emptyNumber of observations
vec_locate_matchesLocate observations matching specified conditions
vec_matchFind matching observations across vectors
vec_namesGet or set the names of a vector
vec_names2Get or set the names of a vector
vec_orderOrder and sort vectors
vec_ptypeFind the prototype of a set of vectors
vec_ptype2Find the common type for a pair of vectors
vec_ptype2.characterFind the common type for a pair of vectors
vec_ptype2.complexFind the common type for a pair of vectors
vec_ptype2.doubleFind the common type for a pair of vectors
vec_ptype2.integerFind the common type for a pair of vectors
vec_ptype2.listFind the common type for a pair of vectors
vec_ptype2.logicalFind the common type for a pair of vectors
vec_ptype2.rawFind the common type for a pair of vectors
vec_ptype2.vctrs_list_of'list_of' S3 class for homogenous lists
vec_ptype_commonFind the prototype of a set of vectors
vec_ptype_showFind the prototype of a set of vectors
vec_rankCompute ranks
vec_rbindCombine many data frames into one data frame
vec_recycleVector recycling
vec_recycle_commonVector recycling
vec_repRepeat a vector
vec_rep_eachRepeat a vector
vec_run_sizesRuns
vec_seq_alongUseful sequences
vec_set_differenceSet operations
vec_set_intersectSet operations
vec_set_namesGet or set the names of a vector
vec_set_symmetric_differenceSet operations
vec_set_unionSet operations
vec_sizeNumber of observations
vec_size_commonNumber of observations
vec_sortOrder and sort vectors
vec_splitSplit a vector into groups
vec_uniqueFind and count unique values
vec_unique_countFind and count unique values
vec_unique_locFind and count unique values
vec_unrepRepeat a vector
+ +

-- misc --

+ + + + +
%0%Default value for empty vectors
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/include/vctrs.c b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/include/vctrs.c new file mode 100644 index 00000000..ce849c4a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/include/vctrs.c @@ -0,0 +1,17 @@ +#include "vctrs.h" + +// Maturing +bool (*obj_is_vector)(SEXP) = NULL; +R_len_t (*short_vec_size)(SEXP) = NULL; +SEXP (*short_vec_recycle)(SEXP, R_len_t) = NULL; + +// Deprecated +bool (*vec_is_vector)(SEXP) = NULL; + +void vctrs_init_api(void) { + obj_is_vector = (bool (*)(SEXP)) R_GetCCallable("vctrs", "obj_is_vector"); + short_vec_size = (R_len_t (*)(SEXP)) R_GetCCallable("vctrs", "short_vec_size"); + short_vec_recycle = (SEXP (*)(SEXP, R_len_t)) R_GetCCallable("vctrs", "short_vec_recycle"); + + vec_is_vector = (bool (*)(SEXP)) R_GetCCallable("vctrs", "vec_is_vector"); +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/include/vctrs.h b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/include/vctrs.h new file mode 100644 index 00000000..2b379b68 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/include/vctrs.h @@ -0,0 +1,20 @@ +#ifndef VCTRS_H +#define VCTRS_H + +#include +#include +#include + +// Maturing +extern bool (*obj_is_vector)(SEXP); +extern R_len_t (*short_vec_size)(SEXP); +extern SEXP (*short_vec_recycle)(SEXP, R_len_t); + +// Deprecated in favor of `obj_is_vector()` +// version: 0.5.3 +// date: 2023-02-15 +extern bool (*vec_is_vector)(SEXP); + +void vctrs_init_api(void); + +#endif diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/libs/vctrs.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/libs/vctrs.so new file mode 100755 index 00000000..759d0b02 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/libs/vctrs.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/libs/vctrs.so.dSYM/Contents/Info.plist b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/libs/vctrs.so.dSYM/Contents/Info.plist new file mode 100644 index 00000000..e1ebfa12 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/libs/vctrs.so.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.vctrs.so + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/libs/vctrs.so.dSYM/Contents/Resources/DWARF/vctrs.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/libs/vctrs.so.dSYM/Contents/Resources/DWARF/vctrs.so new file mode 100644 index 00000000..3273809a Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/vctrs/libs/vctrs.so.dSYM/Contents/Resources/DWARF/vctrs.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/DESCRIPTION new file mode 100644 index 00000000..eef4172e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/DESCRIPTION @@ -0,0 +1,23 @@ +Package: whisker +Maintainer: Edwin de Jonge +License: GPL-3 +Title: {{mustache}} for R, Logicless Templating +Type: Package +LazyLoad: yes +Author: Edwin de Jonge +Description: Implements 'Mustache' logicless templating. +Version: 0.4.1 +URL: https://github.com/edwindj/whisker +Suggests: markdown +RoxygenNote: 6.1.1 +NeedsCompilation: no +Packaged: 2022-12-05 15:15:55 UTC; hornik +Repository: CRAN +Date/Publication: 2022-12-05 15:33:50 UTC +Built: R 4.4.1; ; 2025-01-25 18:39:40 UTC; unix +RemoteType: standard +RemotePkgRef: whisker +RemoteRef: whisker +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 0.4.1 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/INDEX new file mode 100644 index 00000000..68ae7384 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/INDEX @@ -0,0 +1,5 @@ +iteratelist Create an iteration list from a R object +rowSplit Split a data.frame or matrix into rows +whisker-package Mustache for R +whisker.escape escape basic HTML characters +whisker.render Logicless templating diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/Meta/Rd.rds new file mode 100644 index 00000000..d1e4a0ec Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/Meta/hsearch.rds new file mode 100644 index 00000000..7c9a8a15 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/Meta/links.rds new file mode 100644 index 00000000..b7040c03 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/Meta/nsInfo.rds new file mode 100644 index 00000000..6a35c9d6 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/Meta/package.rds new file mode 100644 index 00000000..04089e2a Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/NAMESPACE new file mode 100644 index 00000000..fe70c7af --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/NAMESPACE @@ -0,0 +1,6 @@ +# Generated by roxygen2: do not edit by hand + +export(iteratelist) +export(rowSplit) +export(whisker.escape) +export(whisker.render) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/NEWS b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/NEWS new file mode 100644 index 00000000..97a7664d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/NEWS @@ -0,0 +1,17 @@ +0.4 +- Fixed issue #12: inconsistent treatment of new lines (Thanks to @danhalligan) +- Updated documentation for disabling html escaping. (issue #16)(Thanks to @ctbrown) + +0.3-3 +- Added an option "strict" to render. Setting it to FALSE allows for "." in names +and use "$" for splitting which is a more natural R syntax. + +0.3-2 +- Added a rowSplit utility function to iterate over rows of a data.frame + +0.3-1 +- Fixed rendering an empty template (Thanks to Hadley Wickham) + +0.1 +- Initial release +- Conforms to mustache specification except for delimiter switching diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/R/whisker b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/R/whisker new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/R/whisker @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/R/whisker.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/R/whisker.rdb new file mode 100644 index 00000000..a59e37c7 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/R/whisker.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/R/whisker.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/R/whisker.rdx new file mode 100644 index 00000000..27854497 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/R/whisker.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/help/AnIndex new file mode 100644 index 00000000..b30fc1b0 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/help/AnIndex @@ -0,0 +1,9 @@ +whisker-package whisker-package +delimit delimit +isFalsey isFalsey +iteratelist iteratelist +rowSplit rowSplit +rxsplit rxsplit +tag2delim tag2delim +whisker.escape whisker.escape +whisker.render whisker.render diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/help/aliases.rds new file mode 100644 index 00000000..80981028 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/help/paths.rds new file mode 100644 index 00000000..366713d5 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/help/whisker.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/help/whisker.rdb new file mode 100644 index 00000000..a8b0815c Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/help/whisker.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/help/whisker.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/help/whisker.rdx new file mode 100644 index 00000000..7871d56c Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/help/whisker.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/html/00Index.html new file mode 100644 index 00000000..25759f52 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/html/00Index.html @@ -0,0 +1,36 @@ + + +R: {{mustache}} for R, Logicless Templating + + + +
+

{{mustache}} for R, Logicless Templating + +

+
+
+[Up] +[Top] +

Documentation for package ‘whisker’ version 0.4.1

+ + + +

Help Pages

+ + + + + + + + + + + + + +
whisker-packageMustache for R
iteratelistCreate an iteration list from a R object
rowSplitSplit a data.frame or matrix into rows
whisker.escapeescape basic HTML characters
whisker.renderLogicless templating
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/comments.json b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/comments.json new file mode 100644 index 00000000..30cb927e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/comments.json @@ -0,0 +1 @@ +{"__ATTN__":"Do not edit this file; changes belong in the appropriate YAML file.","overview":"Comment tags represent content that should never appear in the resulting\noutput.\n\nThe tag's content may contain any substring (including newlines) EXCEPT the\nclosing delimiter.\n\nComment tags SHOULD be treated as standalone when appropriate.\n","tests":[{"name":"Inline","data":{},"expected":"1234567890","template":"12345{{! Comment Block! }}67890","desc":"Comment blocks should be removed from the template."},{"name":"Multiline","data":{},"expected":"1234567890\n","template":"12345{{!\n This is a\n multi-line comment...\n}}67890\n","desc":"Multiline comments should be permitted."},{"name":"Standalone","data":{},"expected":"Begin.\nEnd.\n","template":"Begin.\n{{! Comment Block! }}\nEnd.\n","desc":"All standalone comment lines should be removed."},{"name":"Indented Standalone","data":{},"expected":"Begin.\nEnd.\n","template":"Begin.\n {{! Indented Comment Block! }}\nEnd.\n","desc":"All standalone comment lines should be removed."},{"name":"Standalone Line Endings","data":{},"expected":"|\r\n|","template":"|\r\n{{! Standalone Comment }}\r\n|","desc":"\"\\r\\n\" should be considered a newline for standalone tags."},{"name":"Standalone Without Previous Line","data":{},"expected":"!","template":" {{! I'm Still Standalone }}\n!","desc":"Standalone tags should not require a newline to precede them."},{"name":"Standalone Without Newline","data":{},"expected":"!\n","template":"!\n {{! I'm Still Standalone }}","desc":"Standalone tags should not require a newline to follow them."},{"name":"Multiline Standalone","data":{},"expected":"Begin.\nEnd.\n","template":"Begin.\n{{!\nSomething's going on here...\n}}\nEnd.\n","desc":"All standalone comment lines should be removed."},{"name":"Indented Multiline Standalone","data":{},"expected":"Begin.\nEnd.\n","template":"Begin.\n {{!\n Something's going on here...\n }}\nEnd.\n","desc":"All standalone comment lines should be removed."},{"name":"Indented Inline","data":{},"expected":" 12 \n","template":" 12 {{! 34 }}\n","desc":"Inline comments should not strip whitespace"},{"name":"Surrounding Whitespace","data":{},"expected":"12345 67890","template":"12345 {{! Comment Block! }} 67890","desc":"Comment removal should preserve surrounding whitespace."}]} \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/comments.yml b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/comments.yml new file mode 100644 index 00000000..7b14c7f3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/comments.yml @@ -0,0 +1,103 @@ +overview: | + Comment tags represent content that should never appear in the resulting + output. + + The tag's content may contain any substring (including newlines) EXCEPT the + closing delimiter. + + Comment tags SHOULD be treated as standalone when appropriate. +tests: + - name: Inline + desc: Comment blocks should be removed from the template. + data: { } + template: '12345{{! Comment Block! }}67890' + expected: '1234567890' + + - name: Multiline + desc: Multiline comments should be permitted. + data: { } + template: | + 12345{{! + This is a + multi-line comment... + }}67890 + expected: | + 1234567890 + + - name: Standalone + desc: All standalone comment lines should be removed. + data: { } + template: | + Begin. + {{! Comment Block! }} + End. + expected: | + Begin. + End. + + - name: Indented Standalone + desc: All standalone comment lines should be removed. + data: { } + template: | + Begin. + {{! Indented Comment Block! }} + End. + expected: | + Begin. + End. + + - name: Standalone Line Endings + desc: '"\r\n" should be considered a newline for standalone tags.' + data: { } + template: "|\r\n{{! Standalone Comment }}\r\n|" + expected: "|\r\n|" + + - name: Standalone Without Previous Line + desc: Standalone tags should not require a newline to precede them. + data: { } + template: " {{! I'm Still Standalone }}\n!" + expected: "!" + + - name: Standalone Without Newline + desc: Standalone tags should not require a newline to follow them. + data: { } + template: "!\n {{! I'm Still Standalone }}" + expected: "!\n" + + - name: Multiline Standalone + desc: All standalone comment lines should be removed. + data: { } + template: | + Begin. + {{! + Something's going on here... + }} + End. + expected: | + Begin. + End. + + - name: Indented Multiline Standalone + desc: All standalone comment lines should be removed. + data: { } + template: | + Begin. + {{! + Something's going on here... + }} + End. + expected: | + Begin. + End. + + - name: Indented Inline + desc: Inline comments should not strip whitespace + data: { } + template: " 12 {{! 34 }}\n" + expected: " 12 \n" + + - name: Surrounding Whitespace + desc: Comment removal should preserve surrounding whitespace. + data: { } + template: '12345 {{! Comment Block! }} 67890' + expected: '12345 67890' diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/convert.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/convert.R new file mode 100644 index 00000000..0859774e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/convert.R @@ -0,0 +1,72 @@ +# Create testthat test from the specification file for Mustache, so it can be +# tested if lives up to the specification +# +# Please note: +# * You'll need rjson for reading the specifications +# * an installed whisker, because that is used for the generation of the test +# (eat your own dog food...) + +library(rjson) +library(whisker) + +header <- +"# Automatically generated from specification file: '{{file}}' +# +{{overview}} +library(testthat) +context('Spec v1.1, {{type}}') +" +testtemplate <- +"test_that( {{&name}}, { + #{{&desc}} + template <- {{&template}} + data <- {{&data}} + +{{#partials}} + partials <- {{&partials}} + str <- whisker.render(template, partials=partials, data=data) +{{/partials}} +{{^partials}} + str <- whisker.render(template, data=data) +{{/partials}} + + expect_equal(str, {{&expected}}, label=deparse(str), info={{&desc}}) +}) +" + +convertToTest <- function(files){ + for (json in files){ + writeSpec(json) + } +} + +writeSpec <- function(file){ + outfile <- gsub("^(.+).json", "../tests/test\\1.R", file) + spec <- fromJSON(file=file) + con <- file(outfile, open="wt") + on.exit(close(con)) + + spec$file <- file + spec$overview <- gsub("(^|\n)", "\\1# ", spec$overview) + spec$type <- gsub(".json", "", file) + + writeLines(whisker.render(header, data=spec), con) + test <- sapply(spec$test, writeTest) + writeLines(test, con) +} + +writeTest <- function(test){ + test <- lapply(test, deparse, control=c("keepNA")) + test$data <- paste(test$data, collapse="\n") + whisker.render(testtemplate, data=test) +} + +spec <- c( "interpolation.json" + , "comments.json" + , "inverted.json" + , "sections.json" + , "partials.json" + , "delimiters.json" + #, "lambdas.json" + ) +convertToTest(spec) \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/delimiters.json b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/delimiters.json new file mode 100644 index 00000000..fcf95888 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/delimiters.json @@ -0,0 +1 @@ +{"__ATTN__":"Do not edit this file; changes belong in the appropriate YAML file.","overview":"Set Delimiter tags are used to change the tag delimiters for all content\nfollowing the tag in the current compilation unit.\n\nThe tag's content MUST be any two non-whitespace sequences (separated by\nwhitespace) EXCEPT an equals sign ('=') followed by the current closing\ndelimiter.\n\nSet Delimiter tags SHOULD be treated as standalone when appropriate.\n","tests":[{"name":"Pair Behavior","data":{"text":"Hey!"},"expected":"(Hey!)","template":"{{=<% %>=}}(<%text%>)","desc":"The equals sign (used on both sides) should permit delimiter changes."},{"name":"Special Characters","data":{"text":"It worked!"},"expected":"(It worked!)","template":"({{=[ ]=}}[text])","desc":"Characters with special meaning regexen should be valid delimiters."},{"name":"Sections","data":{"section":true,"data":"I got interpolated."},"expected":"[\n I got interpolated.\n |data|\n\n {{data}}\n I got interpolated.\n]\n","template":"[\n{{#section}}\n {{data}}\n |data|\n{{/section}}\n\n{{= | | =}}\n|#section|\n {{data}}\n |data|\n|/section|\n]\n","desc":"Delimiters set outside sections should persist."},{"name":"Inverted Sections","data":{"section":false,"data":"I got interpolated."},"expected":"[\n I got interpolated.\n |data|\n\n {{data}}\n I got interpolated.\n]\n","template":"[\n{{^section}}\n {{data}}\n |data|\n{{/section}}\n\n{{= | | =}}\n|^section|\n {{data}}\n |data|\n|/section|\n]\n","desc":"Delimiters set outside inverted sections should persist."},{"name":"Partial Inheritence","data":{"value":"yes"},"expected":"[ .yes. ]\n[ .yes. ]\n","template":"[ {{>include}} ]\n{{= | | =}}\n[ |>include| ]\n","desc":"Delimiters set in a parent template should not affect a partial.","partials":{"include":".{{value}}."}},{"name":"Post-Partial Behavior","data":{"value":"yes"},"expected":"[ .yes. .yes. ]\n[ .yes. .|value|. ]\n","template":"[ {{>include}} ]\n[ .{{value}}. .|value|. ]\n","desc":"Delimiters set in a partial should not affect the parent template.","partials":{"include":".{{value}}. {{= | | =}} .|value|."}},{"name":"Surrounding Whitespace","data":{},"expected":"| |","template":"| {{=@ @=}} |","desc":"Surrounding whitespace should be left untouched."},{"name":"Outlying Whitespace (Inline)","data":{},"expected":" | \n","template":" | {{=@ @=}}\n","desc":"Whitespace should be left untouched."},{"name":"Standalone Tag","data":{},"expected":"Begin.\nEnd.\n","template":"Begin.\n{{=@ @=}}\nEnd.\n","desc":"Standalone lines should be removed from the template."},{"name":"Indented Standalone Tag","data":{},"expected":"Begin.\nEnd.\n","template":"Begin.\n {{=@ @=}}\nEnd.\n","desc":"Indented standalone lines should be removed from the template."},{"name":"Standalone Line Endings","data":{},"expected":"|\r\n|","template":"|\r\n{{= @ @ =}}\r\n|","desc":"\"\\r\\n\" should be considered a newline for standalone tags."},{"name":"Standalone Without Previous Line","data":{},"expected":"=","template":" {{=@ @=}}\n=","desc":"Standalone tags should not require a newline to precede them."},{"name":"Standalone Without Newline","data":{},"expected":"=\n","template":"=\n {{=@ @=}}","desc":"Standalone tags should not require a newline to follow them."},{"name":"Pair with Padding","data":{},"expected":"||","template":"|{{= @ @ =}}|","desc":"Superfluous in-tag whitespace should be ignored."}]} \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/delimiters.yml b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/delimiters.yml new file mode 100644 index 00000000..ce80b17c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/delimiters.yml @@ -0,0 +1,158 @@ +overview: | + Set Delimiter tags are used to change the tag delimiters for all content + following the tag in the current compilation unit. + + The tag's content MUST be any two non-whitespace sequences (separated by + whitespace) EXCEPT an equals sign ('=') followed by the current closing + delimiter. + + Set Delimiter tags SHOULD be treated as standalone when appropriate. +tests: + - name: Pair Behavior + desc: The equals sign (used on both sides) should permit delimiter changes. + data: { text: 'Hey!' } + template: '{{=<% %>=}}(<%text%>)' + expected: '(Hey!)' + + - name: Special Characters + desc: Characters with special meaning regexen should be valid delimiters. + data: { text: 'It worked!' } + template: '({{=[ ]=}}[text])' + expected: '(It worked!)' + + - name: Sections + desc: Delimiters set outside sections should persist. + data: { section: true, data: 'I got interpolated.' } + template: | + [ + {{#section}} + {{data}} + |data| + {{/section}} + + {{= | | =}} + |#section| + {{data}} + |data| + |/section| + ] + expected: | + [ + I got interpolated. + |data| + + {{data}} + I got interpolated. + ] + + - name: Inverted Sections + desc: Delimiters set outside inverted sections should persist. + data: { section: false, data: 'I got interpolated.' } + template: | + [ + {{^section}} + {{data}} + |data| + {{/section}} + + {{= | | =}} + |^section| + {{data}} + |data| + |/section| + ] + expected: | + [ + I got interpolated. + |data| + + {{data}} + I got interpolated. + ] + + - name: Partial Inheritence + desc: Delimiters set in a parent template should not affect a partial. + data: { value: 'yes' } + partials: + include: '.{{value}}.' + template: | + [ {{>include}} ] + {{= | | =}} + [ |>include| ] + expected: | + [ .yes. ] + [ .yes. ] + + - name: Post-Partial Behavior + desc: Delimiters set in a partial should not affect the parent template. + data: { value: 'yes' } + partials: + include: '.{{value}}. {{= | | =}} .|value|.' + template: | + [ {{>include}} ] + [ .{{value}}. .|value|. ] + expected: | + [ .yes. .yes. ] + [ .yes. .|value|. ] + + # Whitespace Sensitivity + + - name: Surrounding Whitespace + desc: Surrounding whitespace should be left untouched. + data: { } + template: '| {{=@ @=}} |' + expected: '| |' + + - name: Outlying Whitespace (Inline) + desc: Whitespace should be left untouched. + data: { } + template: " | {{=@ @=}}\n" + expected: " | \n" + + - name: Standalone Tag + desc: Standalone lines should be removed from the template. + data: { } + template: | + Begin. + {{=@ @=}} + End. + expected: | + Begin. + End. + + - name: Indented Standalone Tag + desc: Indented standalone lines should be removed from the template. + data: { } + template: | + Begin. + {{=@ @=}} + End. + expected: | + Begin. + End. + + - name: Standalone Line Endings + desc: '"\r\n" should be considered a newline for standalone tags.' + data: { } + template: "|\r\n{{= @ @ =}}\r\n|" + expected: "|\r\n|" + + - name: Standalone Without Previous Line + desc: Standalone tags should not require a newline to precede them. + data: { } + template: " {{=@ @=}}\n=" + expected: "=" + + - name: Standalone Without Newline + desc: Standalone tags should not require a newline to follow them. + data: { } + template: "=\n {{=@ @=}}" + expected: "=\n" + + # Whitespace Insensitivity + + - name: Pair with Padding + desc: Superfluous in-tag whitespace should be ignored. + data: { } + template: '|{{= @ @ =}}|' + expected: '||' diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/interpolation.json b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/interpolation.json new file mode 100644 index 00000000..d1a1a328 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/interpolation.json @@ -0,0 +1 @@ +{"__ATTN__":"Do not edit this file; changes belong in the appropriate YAML file.","overview":"Interpolation tags are used to integrate dynamic content into the template.\n\nThe tag's content MUST be a non-whitespace character sequence NOT containing\nthe current closing delimiter.\n\nThis tag's content names the data to replace the tag. A single period (`.`)\nindicates that the item currently sitting atop the context stack should be\nused; otherwise, name resolution is as follows:\n 1) Split the name on periods; the first part is the name to resolve, any\n remaining parts should be retained.\n 2) Walk the context stack from top to bottom, finding the first context\n that is a) a hash containing the name as a key OR b) an object responding\n to a method with the given name.\n 3) If the context is a hash, the data is the value associated with the\n name.\n 4) If the context is an object, the data is the value returned by the\n method with the given name.\n 5) If any name parts were retained in step 1, each should be resolved\n against a context stack containing only the result from the former\n resolution. If any part fails resolution, the result should be considered\n falsey, and should interpolate as the empty string.\nData should be coerced into a string (and escaped, if appropriate) before\ninterpolation.\n\nThe Interpolation tags MUST NOT be treated as standalone.\n","tests":[{"name":"No Interpolation","data":{},"expected":"Hello from {Mustache}!\n","template":"Hello from {Mustache}!\n","desc":"Mustache-free templates should render as-is."},{"name":"Basic Interpolation","data":{"subject":"world"},"expected":"Hello, world!\n","template":"Hello, {{subject}}!\n","desc":"Unadorned tags should interpolate content into the template."},{"name":"HTML Escaping","data":{"forbidden":"& \" < >"},"expected":"These characters should be HTML escaped: & " < >\n","template":"These characters should be HTML escaped: {{forbidden}}\n","desc":"Basic interpolation should be HTML escaped."},{"name":"Triple Mustache","data":{"forbidden":"& \" < >"},"expected":"These characters should not be HTML escaped: & \" < >\n","template":"These characters should not be HTML escaped: {{{forbidden}}}\n","desc":"Triple mustaches should interpolate without HTML escaping."},{"name":"Ampersand","data":{"forbidden":"& \" < >"},"expected":"These characters should not be HTML escaped: & \" < >\n","template":"These characters should not be HTML escaped: {{&forbidden}}\n","desc":"Ampersand should interpolate without HTML escaping."},{"name":"Basic Integer Interpolation","data":{"mph":85},"expected":"\"85 miles an hour!\"","template":"\"{{mph}} miles an hour!\"","desc":"Integers should interpolate seamlessly."},{"name":"Triple Mustache Integer Interpolation","data":{"mph":85},"expected":"\"85 miles an hour!\"","template":"\"{{{mph}}} miles an hour!\"","desc":"Integers should interpolate seamlessly."},{"name":"Ampersand Integer Interpolation","data":{"mph":85},"expected":"\"85 miles an hour!\"","template":"\"{{&mph}} miles an hour!\"","desc":"Integers should interpolate seamlessly."},{"name":"Basic Decimal Interpolation","data":{"power":1.21},"expected":"\"1.21 jiggawatts!\"","template":"\"{{power}} jiggawatts!\"","desc":"Decimals should interpolate seamlessly with proper significance."},{"name":"Triple Mustache Decimal Interpolation","data":{"power":1.21},"expected":"\"1.21 jiggawatts!\"","template":"\"{{{power}}} jiggawatts!\"","desc":"Decimals should interpolate seamlessly with proper significance."},{"name":"Ampersand Decimal Interpolation","data":{"power":1.21},"expected":"\"1.21 jiggawatts!\"","template":"\"{{&power}} jiggawatts!\"","desc":"Decimals should interpolate seamlessly with proper significance."},{"name":"Basic Context Miss Interpolation","data":{},"expected":"I () be seen!","template":"I ({{cannot}}) be seen!","desc":"Failed context lookups should default to empty strings."},{"name":"Triple Mustache Context Miss Interpolation","data":{},"expected":"I () be seen!","template":"I ({{{cannot}}}) be seen!","desc":"Failed context lookups should default to empty strings."},{"name":"Ampersand Context Miss Interpolation","data":{},"expected":"I () be seen!","template":"I ({{&cannot}}) be seen!","desc":"Failed context lookups should default to empty strings."},{"name":"Dotted Names - Basic Interpolation","data":{"person":{"name":"Joe"}},"expected":"\"Joe\" == \"Joe\"","template":"\"{{person.name}}\" == \"{{#person}}{{name}}{{/person}}\"","desc":"Dotted names should be considered a form of shorthand for sections."},{"name":"Dotted Names - Triple Mustache Interpolation","data":{"person":{"name":"Joe"}},"expected":"\"Joe\" == \"Joe\"","template":"\"{{{person.name}}}\" == \"{{#person}}{{{name}}}{{/person}}\"","desc":"Dotted names should be considered a form of shorthand for sections."},{"name":"Dotted Names - Ampersand Interpolation","data":{"person":{"name":"Joe"}},"expected":"\"Joe\" == \"Joe\"","template":"\"{{&person.name}}\" == \"{{#person}}{{&name}}{{/person}}\"","desc":"Dotted names should be considered a form of shorthand for sections."},{"name":"Dotted Names - Arbitrary Depth","data":{"a":{"b":{"c":{"d":{"e":{"name":"Phil"}}}}}},"expected":"\"Phil\" == \"Phil\"","template":"\"{{a.b.c.d.e.name}}\" == \"Phil\"","desc":"Dotted names should be functional to any level of nesting."},{"name":"Dotted Names - Broken Chains","data":{"a":{}},"expected":"\"\" == \"\"","template":"\"{{a.b.c}}\" == \"\"","desc":"Any falsey value prior to the last part of the name should yield ''."},{"name":"Dotted Names - Broken Chain Resolution","data":{"a":{"b":{}},"c":{"name":"Jim"}},"expected":"\"\" == \"\"","template":"\"{{a.b.c.name}}\" == \"\"","desc":"Each part of a dotted name should resolve only against its parent."},{"name":"Dotted Names - Initial Resolution","data":{"a":{"b":{"c":{"d":{"e":{"name":"Phil"}}}}},"b":{"c":{"d":{"e":{"name":"Wrong"}}}}},"expected":"\"Phil\" == \"Phil\"","template":"\"{{#a}}{{b.c.d.e.name}}{{/a}}\" == \"Phil\"","desc":"The first part of a dotted name should resolve as any other name."},{"name":"Interpolation - Surrounding Whitespace","data":{"string":"---"},"expected":"| --- |","template":"| {{string}} |","desc":"Interpolation should not alter surrounding whitespace."},{"name":"Triple Mustache - Surrounding Whitespace","data":{"string":"---"},"expected":"| --- |","template":"| {{{string}}} |","desc":"Interpolation should not alter surrounding whitespace."},{"name":"Ampersand - Surrounding Whitespace","data":{"string":"---"},"expected":"| --- |","template":"| {{&string}} |","desc":"Interpolation should not alter surrounding whitespace."},{"name":"Interpolation - Standalone","data":{"string":"---"},"expected":" ---\n","template":" {{string}}\n","desc":"Standalone interpolation should not alter surrounding whitespace."},{"name":"Triple Mustache - Standalone","data":{"string":"---"},"expected":" ---\n","template":" {{{string}}}\n","desc":"Standalone interpolation should not alter surrounding whitespace."},{"name":"Ampersand - Standalone","data":{"string":"---"},"expected":" ---\n","template":" {{&string}}\n","desc":"Standalone interpolation should not alter surrounding whitespace."},{"name":"Interpolation With Padding","data":{"string":"---"},"expected":"|---|","template":"|{{ string }}|","desc":"Superfluous in-tag whitespace should be ignored."},{"name":"Triple Mustache With Padding","data":{"string":"---"},"expected":"|---|","template":"|{{{ string }}}|","desc":"Superfluous in-tag whitespace should be ignored."},{"name":"Ampersand With Padding","data":{"string":"---"},"expected":"|---|","template":"|{{& string }}|","desc":"Superfluous in-tag whitespace should be ignored."}]} \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/interpolation.yml b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/interpolation.yml new file mode 100644 index 00000000..2237b55f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/interpolation.yml @@ -0,0 +1,230 @@ +overview: | + Interpolation tags are used to integrate dynamic content into the template. + + The tag's content MUST be a non-whitespace character sequence NOT containing + the current closing delimiter. + + This tag's content names the data to replace the tag. A single period (`.`) + indicates that the item currently sitting atop the context stack should be + used; otherwise, name resolution is as follows: + 1) Split the name on periods; the first part is the name to resolve, any + remaining parts should be retained. + 2) Walk the context stack from top to bottom, finding the first context + that is a) a hash containing the name as a key OR b) an object responding + to a method with the given name. + 3) If the context is a hash, the data is the value associated with the + name. + 4) If the context is an object, the data is the value returned by the + method with the given name. + 5) If any name parts were retained in step 1, each should be resolved + against a context stack containing only the result from the former + resolution. If any part fails resolution, the result should be considered + falsey, and should interpolate as the empty string. + Data should be coerced into a string (and escaped, if appropriate) before + interpolation. + + The Interpolation tags MUST NOT be treated as standalone. +tests: + - name: No Interpolation + desc: Mustache-free templates should render as-is. + data: { } + template: | + Hello from {Mustache}! + expected: | + Hello from {Mustache}! + + - name: Basic Interpolation + desc: Unadorned tags should interpolate content into the template. + data: { subject: "world" } + template: | + Hello, {{subject}}! + expected: | + Hello, world! + + - name: HTML Escaping + desc: Basic interpolation should be HTML escaped. + data: { forbidden: '& " < >' } + template: | + These characters should be HTML escaped: {{forbidden}} + expected: | + These characters should be HTML escaped: & " < > + + - name: Triple Mustache + desc: Triple mustaches should interpolate without HTML escaping. + data: { forbidden: '& " < >' } + template: | + These characters should not be HTML escaped: {{{forbidden}}} + expected: | + These characters should not be HTML escaped: & " < > + + - name: Ampersand + desc: Ampersand should interpolate without HTML escaping. + data: { forbidden: '& " < >' } + template: | + These characters should not be HTML escaped: {{&forbidden}} + expected: | + These characters should not be HTML escaped: & " < > + + - name: Basic Integer Interpolation + desc: Integers should interpolate seamlessly. + data: { mph: 85 } + template: '"{{mph}} miles an hour!"' + expected: '"85 miles an hour!"' + + - name: Triple Mustache Integer Interpolation + desc: Integers should interpolate seamlessly. + data: { mph: 85 } + template: '"{{{mph}}} miles an hour!"' + expected: '"85 miles an hour!"' + + - name: Ampersand Integer Interpolation + desc: Integers should interpolate seamlessly. + data: { mph: 85 } + template: '"{{&mph}} miles an hour!"' + expected: '"85 miles an hour!"' + + - name: Basic Decimal Interpolation + desc: Decimals should interpolate seamlessly with proper significance. + data: { power: 1.210 } + template: '"{{power}} jiggawatts!"' + expected: '"1.21 jiggawatts!"' + + - name: Triple Mustache Decimal Interpolation + desc: Decimals should interpolate seamlessly with proper significance. + data: { power: 1.210 } + template: '"{{{power}}} jiggawatts!"' + expected: '"1.21 jiggawatts!"' + + - name: Ampersand Decimal Interpolation + desc: Decimals should interpolate seamlessly with proper significance. + data: { power: 1.210 } + template: '"{{&power}} jiggawatts!"' + expected: '"1.21 jiggawatts!"' + + # Context Misses + + - name: Basic Context Miss Interpolation + desc: Failed context lookups should default to empty strings. + data: { } + template: "I ({{cannot}}) be seen!" + expected: "I () be seen!" + + - name: Triple Mustache Context Miss Interpolation + desc: Failed context lookups should default to empty strings. + data: { } + template: "I ({{{cannot}}}) be seen!" + expected: "I () be seen!" + + - name: Ampersand Context Miss Interpolation + desc: Failed context lookups should default to empty strings. + data: { } + template: "I ({{&cannot}}) be seen!" + expected: "I () be seen!" + + # Dotted Names + + - name: Dotted Names - Basic Interpolation + desc: Dotted names should be considered a form of shorthand for sections. + data: { person: { name: 'Joe' } } + template: '"{{person.name}}" == "{{#person}}{{name}}{{/person}}"' + expected: '"Joe" == "Joe"' + + - name: Dotted Names - Triple Mustache Interpolation + desc: Dotted names should be considered a form of shorthand for sections. + data: { person: { name: 'Joe' } } + template: '"{{{person.name}}}" == "{{#person}}{{{name}}}{{/person}}"' + expected: '"Joe" == "Joe"' + + - name: Dotted Names - Ampersand Interpolation + desc: Dotted names should be considered a form of shorthand for sections. + data: { person: { name: 'Joe' } } + template: '"{{&person.name}}" == "{{#person}}{{&name}}{{/person}}"' + expected: '"Joe" == "Joe"' + + - name: Dotted Names - Arbitrary Depth + desc: Dotted names should be functional to any level of nesting. + data: + a: { b: { c: { d: { e: { name: 'Phil' } } } } } + template: '"{{a.b.c.d.e.name}}" == "Phil"' + expected: '"Phil" == "Phil"' + + - name: Dotted Names - Broken Chains + desc: Any falsey value prior to the last part of the name should yield ''. + data: + a: { } + template: '"{{a.b.c}}" == ""' + expected: '"" == ""' + + - name: Dotted Names - Broken Chain Resolution + desc: Each part of a dotted name should resolve only against its parent. + data: + a: { b: { } } + c: { name: 'Jim' } + template: '"{{a.b.c.name}}" == ""' + expected: '"" == ""' + + - name: Dotted Names - Initial Resolution + desc: The first part of a dotted name should resolve as any other name. + data: + a: { b: { c: { d: { e: { name: 'Phil' } } } } } + b: { c: { d: { e: { name: 'Wrong' } } } } + template: '"{{#a}}{{b.c.d.e.name}}{{/a}}" == "Phil"' + expected: '"Phil" == "Phil"' + + # Whitespace Sensitivity + + - name: Interpolation - Surrounding Whitespace + desc: Interpolation should not alter surrounding whitespace. + data: { string: '---' } + template: '| {{string}} |' + expected: '| --- |' + + - name: Triple Mustache - Surrounding Whitespace + desc: Interpolation should not alter surrounding whitespace. + data: { string: '---' } + template: '| {{{string}}} |' + expected: '| --- |' + + - name: Ampersand - Surrounding Whitespace + desc: Interpolation should not alter surrounding whitespace. + data: { string: '---' } + template: '| {{&string}} |' + expected: '| --- |' + + - name: Interpolation - Standalone + desc: Standalone interpolation should not alter surrounding whitespace. + data: { string: '---' } + template: " {{string}}\n" + expected: " ---\n" + + - name: Triple Mustache - Standalone + desc: Standalone interpolation should not alter surrounding whitespace. + data: { string: '---' } + template: " {{{string}}}\n" + expected: " ---\n" + + - name: Ampersand - Standalone + desc: Standalone interpolation should not alter surrounding whitespace. + data: { string: '---' } + template: " {{&string}}\n" + expected: " ---\n" + + # Whitespace Insensitivity + + - name: Interpolation With Padding + desc: Superfluous in-tag whitespace should be ignored. + data: { string: "---" } + template: '|{{ string }}|' + expected: '|---|' + + - name: Triple Mustache With Padding + desc: Superfluous in-tag whitespace should be ignored. + data: { string: "---" } + template: '|{{{ string }}}|' + expected: '|---|' + + - name: Ampersand With Padding + desc: Superfluous in-tag whitespace should be ignored. + data: { string: "---" } + template: '|{{& string }}|' + expected: '|---|' diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/inverted.json b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/inverted.json new file mode 100644 index 00000000..c9b550b9 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/inverted.json @@ -0,0 +1 @@ +{"__ATTN__":"Do not edit this file; changes belong in the appropriate YAML file.","overview":"Inverted Section tags and End Section tags are used in combination to wrap a\nsection of the template.\n\nThese tags' content MUST be a non-whitespace character sequence NOT\ncontaining the current closing delimiter; each Inverted Section tag MUST be\nfollowed by an End Section tag with the same content within the same\nsection.\n\nThis tag's content names the data to replace the tag. Name resolution is as\nfollows:\n 1) Split the name on periods; the first part is the name to resolve, any\n remaining parts should be retained.\n 2) Walk the context stack from top to bottom, finding the first context\n that is a) a hash containing the name as a key OR b) an object responding\n to a method with the given name.\n 3) If the context is a hash, the data is the value associated with the\n name.\n 4) If the context is an object and the method with the given name has an\n arity of 1, the method SHOULD be called with a String containing the\n unprocessed contents of the sections; the data is the value returned.\n 5) Otherwise, the data is the value returned by calling the method with\n the given name.\n 6) If any name parts were retained in step 1, each should be resolved\n against a context stack containing only the result from the former\n resolution. If any part fails resolution, the result should be considered\n falsey, and should interpolate as the empty string.\nIf the data is not of a list type, it is coerced into a list as follows: if\nthe data is truthy (e.g. `!!data == true`), use a single-element list\ncontaining the data, otherwise use an empty list.\n\nThis section MUST NOT be rendered unless the data list is empty.\n\nInverted Section and End Section tags SHOULD be treated as standalone when\nappropriate.\n","tests":[{"name":"Falsey","data":{"boolean":false},"expected":"\"This should be rendered.\"","template":"\"{{^boolean}}This should be rendered.{{/boolean}}\"","desc":"Falsey sections should have their contents rendered."},{"name":"Truthy","data":{"boolean":true},"expected":"\"\"","template":"\"{{^boolean}}This should not be rendered.{{/boolean}}\"","desc":"Truthy sections should have their contents omitted."},{"name":"Context","data":{"context":{"name":"Joe"}},"expected":"\"\"","template":"\"{{^context}}Hi {{name}}.{{/context}}\"","desc":"Objects and hashes should behave like truthy values."},{"name":"List","data":{"list":[{"n":1},{"n":2},{"n":3}]},"expected":"\"\"","template":"\"{{^list}}{{n}}{{/list}}\"","desc":"Lists should behave like truthy values."},{"name":"Empty List","data":{"list":[]},"expected":"\"Yay lists!\"","template":"\"{{^list}}Yay lists!{{/list}}\"","desc":"Empty lists should behave like falsey values."},{"name":"Doubled","data":{"two":"second","bool":false},"expected":"* first\n* second\n* third\n","template":"{{^bool}}\n* first\n{{/bool}}\n* {{two}}\n{{^bool}}\n* third\n{{/bool}}\n","desc":"Multiple inverted sections per template should be permitted."},{"name":"Nested (Falsey)","data":{"bool":false},"expected":"| A B C D E |","template":"| A {{^bool}}B {{^bool}}C{{/bool}} D{{/bool}} E |","desc":"Nested falsey sections should have their contents rendered."},{"name":"Nested (Truthy)","data":{"bool":true},"expected":"| A E |","template":"| A {{^bool}}B {{^bool}}C{{/bool}} D{{/bool}} E |","desc":"Nested truthy sections should be omitted."},{"name":"Context Misses","data":{},"expected":"[Cannot find key 'missing'!]","template":"[{{^missing}}Cannot find key 'missing'!{{/missing}}]","desc":"Failed context lookups should be considered falsey."},{"name":"Dotted Names - Truthy","data":{"a":{"b":{"c":true}}},"expected":"\"\" == \"\"","template":"\"{{^a.b.c}}Not Here{{/a.b.c}}\" == \"\"","desc":"Dotted names should be valid for Inverted Section tags."},{"name":"Dotted Names - Falsey","data":{"a":{"b":{"c":false}}},"expected":"\"Not Here\" == \"Not Here\"","template":"\"{{^a.b.c}}Not Here{{/a.b.c}}\" == \"Not Here\"","desc":"Dotted names should be valid for Inverted Section tags."},{"name":"Dotted Names - Broken Chains","data":{"a":{}},"expected":"\"Not Here\" == \"Not Here\"","template":"\"{{^a.b.c}}Not Here{{/a.b.c}}\" == \"Not Here\"","desc":"Dotted names that cannot be resolved should be considered falsey."},{"name":"Surrounding Whitespace","data":{"boolean":false},"expected":" | \t|\t | \n","template":" | {{^boolean}}\t|\t{{/boolean}} | \n","desc":"Inverted sections should not alter surrounding whitespace."},{"name":"Internal Whitespace","data":{"boolean":false},"expected":" | \n | \n","template":" | {{^boolean}} {{! Important Whitespace }}\n {{/boolean}} | \n","desc":"Inverted should not alter internal whitespace."},{"name":"Indented Inline Sections","data":{"boolean":false},"expected":" NO\n WAY\n","template":" {{^boolean}}NO{{/boolean}}\n {{^boolean}}WAY{{/boolean}}\n","desc":"Single-line sections should not alter surrounding whitespace."},{"name":"Standalone Lines","data":{"boolean":false},"expected":"| This Is\n|\n| A Line\n","template":"| This Is\n{{^boolean}}\n|\n{{/boolean}}\n| A Line\n","desc":"Standalone lines should be removed from the template."},{"name":"Standalone Indented Lines","data":{"boolean":false},"expected":"| This Is\n|\n| A Line\n","template":"| This Is\n {{^boolean}}\n|\n {{/boolean}}\n| A Line\n","desc":"Standalone indented lines should be removed from the template."},{"name":"Standalone Line Endings","data":{"boolean":false},"expected":"|\r\n|","template":"|\r\n{{^boolean}}\r\n{{/boolean}}\r\n|","desc":"\"\\r\\n\" should be considered a newline for standalone tags."},{"name":"Standalone Without Previous Line","data":{"boolean":false},"expected":"^\n/","template":" {{^boolean}}\n^{{/boolean}}\n/","desc":"Standalone tags should not require a newline to precede them."},{"name":"Standalone Without Newline","data":{"boolean":false},"expected":"^\n/\n","template":"^{{^boolean}}\n/\n {{/boolean}}","desc":"Standalone tags should not require a newline to follow them."},{"name":"Padding","data":{"boolean":false},"expected":"|=|","template":"|{{^ boolean }}={{/ boolean }}|","desc":"Superfluous in-tag whitespace should be ignored."}]} \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/inverted.yml b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/inverted.yml new file mode 100644 index 00000000..5f8e2b2f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/inverted.yml @@ -0,0 +1,193 @@ +overview: | + Inverted Section tags and End Section tags are used in combination to wrap a + section of the template. + + These tags' content MUST be a non-whitespace character sequence NOT + containing the current closing delimiter; each Inverted Section tag MUST be + followed by an End Section tag with the same content within the same + section. + + This tag's content names the data to replace the tag. Name resolution is as + follows: + 1) Split the name on periods; the first part is the name to resolve, any + remaining parts should be retained. + 2) Walk the context stack from top to bottom, finding the first context + that is a) a hash containing the name as a key OR b) an object responding + to a method with the given name. + 3) If the context is a hash, the data is the value associated with the + name. + 4) If the context is an object and the method with the given name has an + arity of 1, the method SHOULD be called with a String containing the + unprocessed contents of the sections; the data is the value returned. + 5) Otherwise, the data is the value returned by calling the method with + the given name. + 6) If any name parts were retained in step 1, each should be resolved + against a context stack containing only the result from the former + resolution. If any part fails resolution, the result should be considered + falsey, and should interpolate as the empty string. + If the data is not of a list type, it is coerced into a list as follows: if + the data is truthy (e.g. `!!data == true`), use a single-element list + containing the data, otherwise use an empty list. + + This section MUST NOT be rendered unless the data list is empty. + + Inverted Section and End Section tags SHOULD be treated as standalone when + appropriate. +tests: + - name: Falsey + desc: Falsey sections should have their contents rendered. + data: { boolean: false } + template: '"{{^boolean}}This should be rendered.{{/boolean}}"' + expected: '"This should be rendered."' + + - name: Truthy + desc: Truthy sections should have their contents omitted. + data: { boolean: true } + template: '"{{^boolean}}This should not be rendered.{{/boolean}}"' + expected: '""' + + - name: Context + desc: Objects and hashes should behave like truthy values. + data: { context: { name: 'Joe' } } + template: '"{{^context}}Hi {{name}}.{{/context}}"' + expected: '""' + + - name: List + desc: Lists should behave like truthy values. + data: { list: [ { n: 1 }, { n: 2 }, { n: 3 } ] } + template: '"{{^list}}{{n}}{{/list}}"' + expected: '""' + + - name: Empty List + desc: Empty lists should behave like falsey values. + data: { list: [ ] } + template: '"{{^list}}Yay lists!{{/list}}"' + expected: '"Yay lists!"' + + - name: Doubled + desc: Multiple inverted sections per template should be permitted. + data: { bool: false, two: 'second' } + template: | + {{^bool}} + * first + {{/bool}} + * {{two}} + {{^bool}} + * third + {{/bool}} + expected: | + * first + * second + * third + + - name: Nested (Falsey) + desc: Nested falsey sections should have their contents rendered. + data: { bool: false } + template: "| A {{^bool}}B {{^bool}}C{{/bool}} D{{/bool}} E |" + expected: "| A B C D E |" + + - name: Nested (Truthy) + desc: Nested truthy sections should be omitted. + data: { bool: true } + template: "| A {{^bool}}B {{^bool}}C{{/bool}} D{{/bool}} E |" + expected: "| A E |" + + - name: Context Misses + desc: Failed context lookups should be considered falsey. + data: { } + template: "[{{^missing}}Cannot find key 'missing'!{{/missing}}]" + expected: "[Cannot find key 'missing'!]" + + # Dotted Names + + - name: Dotted Names - Truthy + desc: Dotted names should be valid for Inverted Section tags. + data: { a: { b: { c: true } } } + template: '"{{^a.b.c}}Not Here{{/a.b.c}}" == ""' + expected: '"" == ""' + + - name: Dotted Names - Falsey + desc: Dotted names should be valid for Inverted Section tags. + data: { a: { b: { c: false } } } + template: '"{{^a.b.c}}Not Here{{/a.b.c}}" == "Not Here"' + expected: '"Not Here" == "Not Here"' + + - name: Dotted Names - Broken Chains + desc: Dotted names that cannot be resolved should be considered falsey. + data: { a: { } } + template: '"{{^a.b.c}}Not Here{{/a.b.c}}" == "Not Here"' + expected: '"Not Here" == "Not Here"' + + # Whitespace Sensitivity + + - name: Surrounding Whitespace + desc: Inverted sections should not alter surrounding whitespace. + data: { boolean: false } + template: " | {{^boolean}}\t|\t{{/boolean}} | \n" + expected: " | \t|\t | \n" + + - name: Internal Whitespace + desc: Inverted should not alter internal whitespace. + data: { boolean: false } + template: " | {{^boolean}} {{! Important Whitespace }}\n {{/boolean}} | \n" + expected: " | \n | \n" + + - name: Indented Inline Sections + desc: Single-line sections should not alter surrounding whitespace. + data: { boolean: false } + template: " {{^boolean}}NO{{/boolean}}\n {{^boolean}}WAY{{/boolean}}\n" + expected: " NO\n WAY\n" + + - name: Standalone Lines + desc: Standalone lines should be removed from the template. + data: { boolean: false } + template: | + | This Is + {{^boolean}} + | + {{/boolean}} + | A Line + expected: | + | This Is + | + | A Line + + - name: Standalone Indented Lines + desc: Standalone indented lines should be removed from the template. + data: { boolean: false } + template: | + | This Is + {{^boolean}} + | + {{/boolean}} + | A Line + expected: | + | This Is + | + | A Line + + - name: Standalone Line Endings + desc: '"\r\n" should be considered a newline for standalone tags.' + data: { boolean: false } + template: "|\r\n{{^boolean}}\r\n{{/boolean}}\r\n|" + expected: "|\r\n|" + + - name: Standalone Without Previous Line + desc: Standalone tags should not require a newline to precede them. + data: { boolean: false } + template: " {{^boolean}}\n^{{/boolean}}\n/" + expected: "^\n/" + + - name: Standalone Without Newline + desc: Standalone tags should not require a newline to follow them. + data: { boolean: false } + template: "^{{^boolean}}\n/\n {{/boolean}}" + expected: "^\n/\n" + + # Whitespace Insensitivity + + - name: Padding + desc: Superfluous in-tag whitespace should be ignored. + data: { boolean: false } + template: '|{{^ boolean }}={{/ boolean }}|' + expected: '|=|' diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/lambdas.json b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/lambdas.json new file mode 100644 index 00000000..cf67d48d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/lambdas.json @@ -0,0 +1,168 @@ +{ + "overview": "Lambdas are a special-cased data type for use in interpolations and\nsections.\n\nWhen used as the data value for an Interpolation tag, the lambda MUST be\ntreatable as an arity 0 function, and invoked as such. The returned value\nMUST be rendered against the default delimiters, then interpolated in place\nof the lambda.\n\nWhen used as the data value for a Section tag, the lambda MUST be treatable\nas an arity 1 function, and invoked as such (passing a String containing the\nunprocessed section contents). The returned value MUST be rendered against\nthe current delimiters, then interpolated in place of the section.\n", + "tests": [ + { + "expected": "Hello, world!", + "data": { + "lambda": { + "python": "lambda: \"world\"", + "perl": "sub { \"world\" }", + "php": "return \"world\";", + "ruby": "proc { \"world\" }", + "js": "function() { return \"world\" }" + "R": "function() { \"world\" }" + } + }, + "name": "Interpolation", + "template": "Hello, {{lambda}}!", + "desc": "A lambda's return value should be interpolated." + }, + { + "expected": "Hello, world!", + "data": { + "planet": "world", + "lambda": { + "python": "lambda: \"{{planet}}\"", + "perl": "sub { \"{{planet}}\" }", + "php": "return \"{{planet}}\";", + "ruby": "proc { \"{{planet}}\" }", + "js": "function() { return \"{{planet}}\" }" + "R": "function() { \"{{planet}}\" }" + } + }, + "name": "Interpolation - Expansion", + "template": "Hello, {{lambda}}!", + "desc": "A lambda's return value should be parsed." + }, + { + "expected": "Hello, (|planet| => world)!", + "data": { + "planet": "world", + "lambda": { + "python": "lambda: \"|planet| => {{planet}}\"", + "perl": "sub { \"|planet| => {{planet}}\" }", + "php": "return \"|planet| => {{planet}}\";", + "ruby": "proc { \"|planet| => {{planet}}\" }", + "js": "function() { return \"|planet| => {{planet}}\" }" + "R": "function() { \"|planet| => {{planet}}\" }" + } + }, + "name": "Interpolation - Alternate Delimiters", + "template": "{{= | | =}}\nHello, (|&lambda|)!", + "desc": "A lambda's return value should parse with the default delimiters." + }, + { + "expected": "1 == 2 == 3", + "data": { + "lambda": { + "python": "lambda: globals().update(calls=globals().get(\"calls\",0)+1) or calls", + "perl": "sub { no strict; $calls += 1 }", + "php": "global $calls; return ++$calls;", + "ruby": "proc { $calls ||= 0; $calls += 1 }", + "js": "function() { return (g=(function(){return this})()).calls=(g.calls||0)+1 }" + "R": "function(){if (!exists(\"x\")) x <<- 0; x <<- x + 1; x}" + } + }, + "name": "Interpolation - Multiple Calls", + "template": "{{lambda}} == {{{lambda}}} == {{lambda}}", + "desc": "Interpolated lambdas should not be cached." + }, + { + "expected": "<>>", + "data": { + "lambda": { + "python": "lambda: \">\"", + "perl": "sub { \">\" }", + "php": "return \">\";", + "ruby": "proc { \">\" }", + "js": "function() { return \">\" }" + "R": "function() { \">\"}" + } + }, + "name": "Escaping", + "template": "<{{lambda}}{{{lambda}}}", + "desc": "Lambda results should be appropriately escaped." + }, + { + "expected": "", + "data": { + "x": "Error!", + "lambda": { + "python": "lambda text: text == \"{{x}}\" and \"yes\" or \"no\"", + "perl": "sub { $_[0] eq \"{{x}}\" ? \"yes\" : \"no\" }", + "php": "return ($text == \"{{x}}\") ? \"yes\" : \"no\";", + "ruby": "proc { |text| text == \"{{x}}\" ? \"yes\" : \"no\" }", + "js": "function(txt) { return (txt == \"{{x}}\" ? \"yes\" : \"no\") }" + "R": "function(txt) { ifelse(txt == \"{{x}}\",\"yes\",\"no\") }" + } + }, + "name": "Section", + "template": "<{{#lambda}}{{x}}{{/lambda}}>", + "desc": "Lambdas used for sections should receive the raw section string." + }, + { + "expected": "<-Earth->", + "data": { + "planet": "Earth", + "lambda": { + "python": "lambda text: \"%s{{planet}}%s\" % (text, text)", + "perl": "sub { $_[0] . \"{{planet}}\" . $_[0] }", + "php": "return $text . \"{{planet}}\" . $text;", + "ruby": "proc { |text| \"#{text}{{planet}}#{text}\" }", + "js": "function(txt) { return txt + \"{{planet}}\" + txt }" + "R": "function(txt) { paste(txt, \"{{planet}}\", txt, sep=\"\"}" + } + }, + "name": "Section - Expansion", + "template": "<{{#lambda}}-{{/lambda}}>", + "desc": "Lambdas used for sections should have their results parsed." + }, + { + "expected": "<-{{planet}} => Earth->", + "data": { + "planet": "Earth", + "lambda": { + "python": "lambda text: \"%s{{planet}} => |planet|%s\" % (text, text)", + "perl": "sub { $_[0] . \"{{planet}} => |planet|\" . $_[0] }", + "php": "return $text . \"{{planet}} => |planet|\" . $text;", + "ruby": "proc { |text| \"#{text}{{planet}} => |planet|#{text}\" }", + "js": "function(txt) { return txt + \"{{planet}} => |planet|\" + txt }" + } + }, + "name": "Section - Alternate Delimiters", + "template": "{{= | | =}}<|#lambda|-|/lambda|>", + "desc": "Lambdas used for sections should parse with the current delimiters." + }, + { + "expected": "__FILE__ != __LINE__", + "data": { + "lambda": { + "python": "lambda text: \"__%s__\" % (text)", + "perl": "sub { \"__\" . $_[0] . \"__\" }", + "php": "return \"__\" . $text . \"__\";", + "ruby": "proc { |text| \"__#{text}__\" }", + "js": "function(txt) { return \"__\" + txt + \"__\" }" + } + }, + "name": "Section - Multiple Calls", + "template": "{{#lambda}}FILE{{/lambda}} != {{#lambda}}LINE{{/lambda}}", + "desc": "Lambdas used for sections should not be cached." + }, + { + "expected": "<>", + "data": { + "static": "static", + "lambda": { + "python": "lambda text: 0", + "perl": "sub { 0 }", + "php": "return false;", + "ruby": "proc { |text| false }", + "js": "function(txt) { return false }" + } + }, + "name": "Inverted Section", + "template": "<{{^lambda}}{{static}}{{/lambda}}>", + "desc": "Lambdas used for inverted sections should be considered truthy." + } + ] +} \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/lambdas.yml b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/lambdas.yml new file mode 100644 index 00000000..e0e9bf37 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/lambdas.yml @@ -0,0 +1,139 @@ +overview: | + Lambdas are a special-cased data type for use in interpolations and + sections. + + When used as the data value for an Interpolation tag, the lambda MUST be + treatable as an arity 0 function, and invoked as such. The returned value + MUST be rendered against the default delimiters, then interpolated in place + of the lambda. + + When used as the data value for a Section tag, the lambda MUST be treatable + as an arity 1 function, and invoked as such (passing a String containing the + unprocessed section contents). The returned value MUST be rendered against + the current delimiters, then interpolated in place of the section. +tests: + - name: Interpolation + desc: A lambda's return value should be interpolated. + data: + lambda: !code + ruby: 'proc { "world" }' + perl: 'sub { "world" }' + js: 'function() { return "world" }' + php: 'return "world";' + python: 'lambda: "world"' + template: "Hello, {{lambda}}!" + expected: "Hello, world!" + + - name: Interpolation - Expansion + desc: A lambda's return value should be parsed. + data: + planet: "world" + lambda: !code + ruby: 'proc { "{{planet}}" }' + perl: 'sub { "{{planet}}" }' + js: 'function() { return "{{planet}}" }' + php: 'return "{{planet}}";' + python: 'lambda: "{{planet}}"' + template: "Hello, {{lambda}}!" + expected: "Hello, world!" + + - name: Interpolation - Alternate Delimiters + desc: A lambda's return value should parse with the default delimiters. + data: + planet: "world" + lambda: !code + ruby: 'proc { "|planet| => {{planet}}" }' + perl: 'sub { "|planet| => {{planet}}" }' + js: 'function() { return "|planet| => {{planet}}" }' + php: 'return "|planet| => {{planet}}";' + python: 'lambda: "|planet| => {{planet}}"' + template: "{{= | | =}}\nHello, (|&lambda|)!" + expected: "Hello, (|planet| => world)!" + + - name: Interpolation - Multiple Calls + desc: Interpolated lambdas should not be cached. + data: + lambda: !code + ruby: 'proc { $calls ||= 0; $calls += 1 }' + perl: 'sub { no strict; $calls += 1 }' + js: 'function() { return (g=(function(){return this})()).calls=(g.calls||0)+1 }' + php: 'global $calls; return ++$calls;' + python: 'lambda: globals().update(calls=globals().get("calls",0)+1) or calls' + template: '{{lambda}} == {{{lambda}}} == {{lambda}}' + expected: '1 == 2 == 3' + + - name: Escaping + desc: Lambda results should be appropriately escaped. + data: + lambda: !code + ruby: 'proc { ">" }' + perl: 'sub { ">" }' + js: 'function() { return ">" }' + php: 'return ">";' + python: 'lambda: ">"' + template: "<{{lambda}}{{{lambda}}}" + expected: "<>>" + + - name: Section + desc: Lambdas used for sections should receive the raw section string. + data: + x: 'Error!' + lambda: !code + ruby: 'proc { |text| text == "{{x}}" ? "yes" : "no" }' + perl: 'sub { $_[0] eq "{{x}}" ? "yes" : "no" }' + js: 'function(txt) { return (txt == "{{x}}" ? "yes" : "no") }' + php: 'return ($text == "{{x}}") ? "yes" : "no";' + python: 'lambda text: text == "{{x}}" and "yes" or "no"' + template: "<{{#lambda}}{{x}}{{/lambda}}>" + expected: "" + + - name: Section - Expansion + desc: Lambdas used for sections should have their results parsed. + data: + planet: "Earth" + lambda: !code + ruby: 'proc { |text| "#{text}{{planet}}#{text}" }' + perl: 'sub { $_[0] . "{{planet}}" . $_[0] }' + js: 'function(txt) { return txt + "{{planet}}" + txt }' + php: 'return $text . "{{planet}}" . $text;' + python: 'lambda text: "%s{{planet}}%s" % (text, text)' + template: "<{{#lambda}}-{{/lambda}}>" + expected: "<-Earth->" + + - name: Section - Alternate Delimiters + desc: Lambdas used for sections should parse with the current delimiters. + data: + planet: "Earth" + lambda: !code + ruby: 'proc { |text| "#{text}{{planet}} => |planet|#{text}" }' + perl: 'sub { $_[0] . "{{planet}} => |planet|" . $_[0] }' + js: 'function(txt) { return txt + "{{planet}} => |planet|" + txt }' + php: 'return $text . "{{planet}} => |planet|" . $text;' + python: 'lambda text: "%s{{planet}} => |planet|%s" % (text, text)' + template: "{{= | | =}}<|#lambda|-|/lambda|>" + expected: "<-{{planet}} => Earth->" + + - name: Section - Multiple Calls + desc: Lambdas used for sections should not be cached. + data: + lambda: !code + ruby: 'proc { |text| "__#{text}__" }' + perl: 'sub { "__" . $_[0] . "__" }' + js: 'function(txt) { return "__" + txt + "__" }' + php: 'return "__" . $text . "__";' + python: 'lambda text: "__%s__" % (text)' + template: '{{#lambda}}FILE{{/lambda}} != {{#lambda}}LINE{{/lambda}}' + expected: '__FILE__ != __LINE__' + + - name: Inverted Section + desc: Lambdas used for inverted sections should be considered truthy. + data: + static: 'static' + lambda: !code + ruby: 'proc { |text| false }' + perl: 'sub { 0 }' + js: 'function(txt) { return false }' + php: 'return false;' + python: 'lambda text: 0' + template: "<{{^lambda}}{{static}}{{/lambda}}>" + expected: "<>" diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/partials.json b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/partials.json new file mode 100644 index 00000000..b4d592ed --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/partials.json @@ -0,0 +1 @@ +{"__ATTN__":"Do not edit this file; changes belong in the appropriate YAML file.","overview":"Partial tags are used to expand an external template into the current\ntemplate.\n\nThe tag's content MUST be a non-whitespace character sequence NOT containing\nthe current closing delimiter.\n\nThis tag's content names the partial to inject. Set Delimiter tags MUST NOT\naffect the parsing of a partial. The partial MUST be rendered against the\ncontext stack local to the tag.\n\nPartial tags SHOULD be treated as standalone when appropriate. If this tag\nis used standalone, any whitespace preceding the tag should treated as\nindentation, and prepended to each line of the partial before rendering.\n","tests":[{"name":"Basic Behavior","data":{},"expected":"\"from partial\"","template":"\"{{>text}}\"","desc":"The greater-than operator should expand to the named partial.","partials":{"text":"from partial"}},{"name":"Context","data":{"text":"content"},"expected":"\"*content*\"","template":"\"{{>partial}}\"","desc":"The greater-than operator should operate within the current context.","partials":{"partial":"*{{text}}*"}},{"name":"Recursion","data":{"content":"X","nodes":[{"content":"Y","nodes":[]}]},"expected":"X>","template":"{{>node}}","desc":"The greater-than operator should properly recurse.","partials":{"node":"{{content}}<{{#nodes}}{{>node}}{{/nodes}}>"}},{"name":"Surrounding Whitespace","data":{},"expected":"| \t|\t |","template":"| {{>partial}} |","desc":"The greater-than operator should not alter surrounding whitespace.","partials":{"partial":"\t|\t"}},{"name":"Inline Indentation","data":{"data":"|"},"expected":" | >\n>\n","template":" {{data}} {{> partial}}\n","desc":"Whitespace should be left untouched.","partials":{"partial":">\n>"}},{"name":"Standalone Line Endings","data":{},"expected":"|\r\n>|","template":"|\r\n{{>partial}}\r\n|","desc":"\"\\r\\n\" should be considered a newline for standalone tags.","partials":{"partial":">"}},{"name":"Standalone Without Previous Line","data":{},"expected":" >\n >>","template":" {{>partial}}\n>","desc":"Standalone tags should not require a newline to precede them.","partials":{"partial":">\n>"}},{"name":"Standalone Without Newline","data":{},"expected":">\n >\n >","template":">\n {{>partial}}","desc":"Standalone tags should not require a newline to follow them.","partials":{"partial":">\n>"}},{"name":"Standalone Indentation","data":{"content":"<\n->"},"expected":"\\\n |\n <\n->\n |\n/\n","template":"\\\n {{>partial}}\n/\n","desc":"Each line of the partial should be indented before rendering.","partials":{"partial":"|\n{{{content}}}\n|\n"}},{"name":"Padding Whitespace","data":{"boolean":true},"expected":"|[]|","template":"|{{> partial }}|","desc":"Superfluous in-tag whitespace should be ignored.","partials":{"partial":"[]"}}]} \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/partials.yml b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/partials.yml new file mode 100644 index 00000000..e24ca561 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/partials.yml @@ -0,0 +1,101 @@ +overview: | + Partial tags are used to expand an external template into the current + template. + + The tag's content MUST be a non-whitespace character sequence NOT containing + the current closing delimiter. + + This tag's content names the partial to inject. Set Delimiter tags MUST NOT + affect the parsing of a partial. The partial MUST be rendered against the + context stack local to the tag. + + Partial tags SHOULD be treated as standalone when appropriate. If this tag + is used standalone, any whitespace preceding the tag should treated as + indentation, and prepended to each line of the partial before rendering. +tests: + - name: Basic Behavior + desc: The greater-than operator should expand to the named partial. + data: { } + template: '"{{>text}}"' + partials: { text: 'from partial' } + expected: '"from partial"' + + - name: Context + desc: The greater-than operator should operate within the current context. + data: { text: 'content' } + template: '"{{>partial}}"' + partials: { partial: '*{{text}}*' } + expected: '"*content*"' + + - name: Recursion + desc: The greater-than operator should properly recurse. + data: { content: "X", nodes: [ { content: "Y", nodes: [] } ] } + template: '{{>node}}' + partials: { node: '{{content}}<{{#nodes}}{{>node}}{{/nodes}}>' } + expected: 'X>' + + # Whitespace Sensitivity + + - name: Surrounding Whitespace + desc: The greater-than operator should not alter surrounding whitespace. + data: { } + template: '| {{>partial}} |' + partials: { partial: "\t|\t" } + expected: "| \t|\t |" + + - name: Inline Indentation + desc: Whitespace should be left untouched. + data: { data: '|' } + template: " {{data}} {{> partial}}\n" + partials: { partial: ">\n>" } + expected: " | >\n>\n" + + - name: Standalone Line Endings + desc: '"\r\n" should be considered a newline for standalone tags.' + data: { } + template: "|\r\n{{>partial}}\r\n|" + partials: { partial: ">" } + expected: "|\r\n>|" + + - name: Standalone Without Previous Line + desc: Standalone tags should not require a newline to precede them. + data: { } + template: " {{>partial}}\n>" + partials: { partial: ">\n>"} + expected: " >\n >>" + + - name: Standalone Without Newline + desc: Standalone tags should not require a newline to follow them. + data: { } + template: ">\n {{>partial}}" + partials: { partial: ">\n>" } + expected: ">\n >\n >" + + - name: Standalone Indentation + desc: Each line of the partial should be indented before rendering. + data: { content: "<\n->" } + template: | + \ + {{>partial}} + / + partials: + partial: | + | + {{{content}}} + | + expected: | + \ + | + < + -> + | + / + + # Whitespace Insensitivity + + - name: Padding Whitespace + desc: Superfluous in-tag whitespace should be ignored. + data: { boolean: true } + template: "|{{> partial }}|" + partials: { partial: "[]" } + expected: '|[]|' diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/sections.json b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/sections.json new file mode 100644 index 00000000..b0aa352e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/sections.json @@ -0,0 +1 @@ +{"__ATTN__":"Do not edit this file; changes belong in the appropriate YAML file.","overview":"Section tags and End Section tags are used in combination to wrap a section\nof the template for iteration\n\nThese tags' content MUST be a non-whitespace character sequence NOT\ncontaining the current closing delimiter; each Section tag MUST be followed\nby an End Section tag with the same content within the same section.\n\nThis tag's content names the data to replace the tag. Name resolution is as\nfollows:\n 1) Split the name on periods; the first part is the name to resolve, any\n remaining parts should be retained.\n 2) Walk the context stack from top to bottom, finding the first context\n that is a) a hash containing the name as a key OR b) an object responding\n to a method with the given name.\n 3) If the context is a hash, the data is the value associated with the\n name.\n 4) If the context is an object and the method with the given name has an\n arity of 1, the method SHOULD be called with a String containing the\n unprocessed contents of the sections; the data is the value returned.\n 5) Otherwise, the data is the value returned by calling the method with\n the given name.\n 6) If any name parts were retained in step 1, each should be resolved\n against a context stack containing only the result from the former\n resolution. If any part fails resolution, the result should be considered\n falsey, and should interpolate as the empty string.\nIf the data is not of a list type, it is coerced into a list as follows: if\nthe data is truthy (e.g. `!!data == true`), use a single-element list\ncontaining the data, otherwise use an empty list.\n\nFor each element in the data list, the element MUST be pushed onto the\ncontext stack, the section MUST be rendered, and the element MUST be popped\noff the context stack.\n\nSection and End Section tags SHOULD be treated as standalone when\nappropriate.\n","tests":[{"name":"Truthy","data":{"boolean":true},"expected":"\"This should be rendered.\"","template":"\"{{#boolean}}This should be rendered.{{/boolean}}\"","desc":"Truthy sections should have their contents rendered."},{"name":"Falsey","data":{"boolean":false},"expected":"\"\"","template":"\"{{#boolean}}This should not be rendered.{{/boolean}}\"","desc":"Falsey sections should have their contents omitted."},{"name":"Context","data":{"context":{"name":"Joe"}},"expected":"\"Hi Joe.\"","template":"\"{{#context}}Hi {{name}}.{{/context}}\"","desc":"Objects and hashes should be pushed onto the context stack."},{"name":"Deeply Nested Contexts","data":{"a":{"one":1},"b":{"two":2},"c":{"three":3},"d":{"four":4},"e":{"five":5}},"expected":"1\n121\n12321\n1234321\n123454321\n1234321\n12321\n121\n1\n","template":"{{#a}}\n{{one}}\n{{#b}}\n{{one}}{{two}}{{one}}\n{{#c}}\n{{one}}{{two}}{{three}}{{two}}{{one}}\n{{#d}}\n{{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}}\n{{#e}}\n{{one}}{{two}}{{three}}{{four}}{{five}}{{four}}{{three}}{{two}}{{one}}\n{{/e}}\n{{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}}\n{{/d}}\n{{one}}{{two}}{{three}}{{two}}{{one}}\n{{/c}}\n{{one}}{{two}}{{one}}\n{{/b}}\n{{one}}\n{{/a}}\n","desc":"All elements on the context stack should be accessible."},{"name":"List","data":{"list":[{"item":1},{"item":2},{"item":3}]},"expected":"\"123\"","template":"\"{{#list}}{{item}}{{/list}}\"","desc":"Lists should be iterated; list items should visit the context stack."},{"name":"Empty List","data":{"list":[]},"expected":"\"\"","template":"\"{{#list}}Yay lists!{{/list}}\"","desc":"Empty lists should behave like falsey values."},{"name":"Doubled","data":{"two":"second","bool":true},"expected":"* first\n* second\n* third\n","template":"{{#bool}}\n* first\n{{/bool}}\n* {{two}}\n{{#bool}}\n* third\n{{/bool}}\n","desc":"Multiple sections per template should be permitted."},{"name":"Nested (Truthy)","data":{"bool":true},"expected":"| A B C D E |","template":"| A {{#bool}}B {{#bool}}C{{/bool}} D{{/bool}} E |","desc":"Nested truthy sections should have their contents rendered."},{"name":"Nested (Falsey)","data":{"bool":false},"expected":"| A E |","template":"| A {{#bool}}B {{#bool}}C{{/bool}} D{{/bool}} E |","desc":"Nested falsey sections should be omitted."},{"name":"Context Misses","data":{},"expected":"[]","template":"[{{#missing}}Found key 'missing'!{{/missing}}]","desc":"Failed context lookups should be considered falsey."},{"name":"Implicit Iterator - String","data":{"list":["a","b","c","d","e"]},"expected":"\"(a)(b)(c)(d)(e)\"","template":"\"{{#list}}({{.}}){{/list}}\"","desc":"Implicit iterators should directly interpolate strings."},{"name":"Implicit Iterator - Integer","data":{"list":[1,2,3,4,5]},"expected":"\"(1)(2)(3)(4)(5)\"","template":"\"{{#list}}({{.}}){{/list}}\"","desc":"Implicit iterators should cast integers to strings and interpolate."},{"name":"Implicit Iterator - Decimal","data":{"list":[1.1,2.2,3.3,4.4,5.5]},"expected":"\"(1.1)(2.2)(3.3)(4.4)(5.5)\"","template":"\"{{#list}}({{.}}){{/list}}\"","desc":"Implicit iterators should cast decimals to strings and interpolate."},{"name":"Dotted Names - Truthy","data":{"a":{"b":{"c":true}}},"expected":"\"Here\" == \"Here\"","template":"\"{{#a.b.c}}Here{{/a.b.c}}\" == \"Here\"","desc":"Dotted names should be valid for Section tags."},{"name":"Dotted Names - Falsey","data":{"a":{"b":{"c":false}}},"expected":"\"\" == \"\"","template":"\"{{#a.b.c}}Here{{/a.b.c}}\" == \"\"","desc":"Dotted names should be valid for Section tags."},{"name":"Dotted Names - Broken Chains","data":{"a":{}},"expected":"\"\" == \"\"","template":"\"{{#a.b.c}}Here{{/a.b.c}}\" == \"\"","desc":"Dotted names that cannot be resolved should be considered falsey."},{"name":"Surrounding Whitespace","data":{"boolean":true},"expected":" | \t|\t | \n","template":" | {{#boolean}}\t|\t{{/boolean}} | \n","desc":"Sections should not alter surrounding whitespace."},{"name":"Internal Whitespace","data":{"boolean":true},"expected":" | \n | \n","template":" | {{#boolean}} {{! Important Whitespace }}\n {{/boolean}} | \n","desc":"Sections should not alter internal whitespace."},{"name":"Indented Inline Sections","data":{"boolean":true},"expected":" YES\n GOOD\n","template":" {{#boolean}}YES{{/boolean}}\n {{#boolean}}GOOD{{/boolean}}\n","desc":"Single-line sections should not alter surrounding whitespace."},{"name":"Standalone Lines","data":{"boolean":true},"expected":"| This Is\n|\n| A Line\n","template":"| This Is\n{{#boolean}}\n|\n{{/boolean}}\n| A Line\n","desc":"Standalone lines should be removed from the template."},{"name":"Indented Standalone Lines","data":{"boolean":true},"expected":"| This Is\n|\n| A Line\n","template":"| This Is\n {{#boolean}}\n|\n {{/boolean}}\n| A Line\n","desc":"Indented standalone lines should be removed from the template."},{"name":"Standalone Line Endings","data":{"boolean":true},"expected":"|\r\n|","template":"|\r\n{{#boolean}}\r\n{{/boolean}}\r\n|","desc":"\"\\r\\n\" should be considered a newline for standalone tags."},{"name":"Standalone Without Previous Line","data":{"boolean":true},"expected":"#\n/","template":" {{#boolean}}\n#{{/boolean}}\n/","desc":"Standalone tags should not require a newline to precede them."},{"name":"Standalone Without Newline","data":{"boolean":true},"expected":"#\n/\n","template":"#{{#boolean}}\n/\n {{/boolean}}","desc":"Standalone tags should not require a newline to follow them."},{"name":"Padding","data":{"boolean":true},"expected":"|=|","template":"|{{# boolean }}={{/ boolean }}|","desc":"Superfluous in-tag whitespace should be ignored."}]} \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/sections.yml b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/sections.yml new file mode 100644 index 00000000..f62d9cb3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/specs/sections.yml @@ -0,0 +1,256 @@ +overview: | + Section tags and End Section tags are used in combination to wrap a section + of the template for iteration + + These tags' content MUST be a non-whitespace character sequence NOT + containing the current closing delimiter; each Section tag MUST be followed + by an End Section tag with the same content within the same section. + + This tag's content names the data to replace the tag. Name resolution is as + follows: + 1) Split the name on periods; the first part is the name to resolve, any + remaining parts should be retained. + 2) Walk the context stack from top to bottom, finding the first context + that is a) a hash containing the name as a key OR b) an object responding + to a method with the given name. + 3) If the context is a hash, the data is the value associated with the + name. + 4) If the context is an object and the method with the given name has an + arity of 1, the method SHOULD be called with a String containing the + unprocessed contents of the sections; the data is the value returned. + 5) Otherwise, the data is the value returned by calling the method with + the given name. + 6) If any name parts were retained in step 1, each should be resolved + against a context stack containing only the result from the former + resolution. If any part fails resolution, the result should be considered + falsey, and should interpolate as the empty string. + If the data is not of a list type, it is coerced into a list as follows: if + the data is truthy (e.g. `!!data == true`), use a single-element list + containing the data, otherwise use an empty list. + + For each element in the data list, the element MUST be pushed onto the + context stack, the section MUST be rendered, and the element MUST be popped + off the context stack. + + Section and End Section tags SHOULD be treated as standalone when + appropriate. +tests: + - name: Truthy + desc: Truthy sections should have their contents rendered. + data: { boolean: true } + template: '"{{#boolean}}This should be rendered.{{/boolean}}"' + expected: '"This should be rendered."' + + - name: Falsey + desc: Falsey sections should have their contents omitted. + data: { boolean: false } + template: '"{{#boolean}}This should not be rendered.{{/boolean}}"' + expected: '""' + + - name: Context + desc: Objects and hashes should be pushed onto the context stack. + data: { context: { name: 'Joe' } } + template: '"{{#context}}Hi {{name}}.{{/context}}"' + expected: '"Hi Joe."' + + - name: Deeply Nested Contexts + desc: All elements on the context stack should be accessible. + data: + a: { one: 1 } + b: { two: 2 } + c: { three: 3 } + d: { four: 4 } + e: { five: 5 } + template: | + {{#a}} + {{one}} + {{#b}} + {{one}}{{two}}{{one}} + {{#c}} + {{one}}{{two}}{{three}}{{two}}{{one}} + {{#d}} + {{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}} + {{#e}} + {{one}}{{two}}{{three}}{{four}}{{five}}{{four}}{{three}}{{two}}{{one}} + {{/e}} + {{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}} + {{/d}} + {{one}}{{two}}{{three}}{{two}}{{one}} + {{/c}} + {{one}}{{two}}{{one}} + {{/b}} + {{one}} + {{/a}} + expected: | + 1 + 121 + 12321 + 1234321 + 123454321 + 1234321 + 12321 + 121 + 1 + + - name: List + desc: Lists should be iterated; list items should visit the context stack. + data: { list: [ { item: 1 }, { item: 2 }, { item: 3 } ] } + template: '"{{#list}}{{item}}{{/list}}"' + expected: '"123"' + + - name: Empty List + desc: Empty lists should behave like falsey values. + data: { list: [ ] } + template: '"{{#list}}Yay lists!{{/list}}"' + expected: '""' + + - name: Doubled + desc: Multiple sections per template should be permitted. + data: { bool: true, two: 'second' } + template: | + {{#bool}} + * first + {{/bool}} + * {{two}} + {{#bool}} + * third + {{/bool}} + expected: | + * first + * second + * third + + - name: Nested (Truthy) + desc: Nested truthy sections should have their contents rendered. + data: { bool: true } + template: "| A {{#bool}}B {{#bool}}C{{/bool}} D{{/bool}} E |" + expected: "| A B C D E |" + + - name: Nested (Falsey) + desc: Nested falsey sections should be omitted. + data: { bool: false } + template: "| A {{#bool}}B {{#bool}}C{{/bool}} D{{/bool}} E |" + expected: "| A E |" + + - name: Context Misses + desc: Failed context lookups should be considered falsey. + data: { } + template: "[{{#missing}}Found key 'missing'!{{/missing}}]" + expected: "[]" + + # Implicit Iterators + + - name: Implicit Iterator - String + desc: Implicit iterators should directly interpolate strings. + data: + list: [ 'a', 'b', 'c', 'd', 'e' ] + template: '"{{#list}}({{.}}){{/list}}"' + expected: '"(a)(b)(c)(d)(e)"' + + - name: Implicit Iterator - Integer + desc: Implicit iterators should cast integers to strings and interpolate. + data: + list: [ 1, 2, 3, 4, 5 ] + template: '"{{#list}}({{.}}){{/list}}"' + expected: '"(1)(2)(3)(4)(5)"' + + - name: Implicit Iterator - Decimal + desc: Implicit iterators should cast decimals to strings and interpolate. + data: + list: [ 1.10, 2.20, 3.30, 4.40, 5.50 ] + template: '"{{#list}}({{.}}){{/list}}"' + expected: '"(1.1)(2.2)(3.3)(4.4)(5.5)"' + + # Dotted Names + + - name: Dotted Names - Truthy + desc: Dotted names should be valid for Section tags. + data: { a: { b: { c: true } } } + template: '"{{#a.b.c}}Here{{/a.b.c}}" == "Here"' + expected: '"Here" == "Here"' + + - name: Dotted Names - Falsey + desc: Dotted names should be valid for Section tags. + data: { a: { b: { c: false } } } + template: '"{{#a.b.c}}Here{{/a.b.c}}" == ""' + expected: '"" == ""' + + - name: Dotted Names - Broken Chains + desc: Dotted names that cannot be resolved should be considered falsey. + data: { a: { } } + template: '"{{#a.b.c}}Here{{/a.b.c}}" == ""' + expected: '"" == ""' + + # Whitespace Sensitivity + + - name: Surrounding Whitespace + desc: Sections should not alter surrounding whitespace. + data: { boolean: true } + template: " | {{#boolean}}\t|\t{{/boolean}} | \n" + expected: " | \t|\t | \n" + + - name: Internal Whitespace + desc: Sections should not alter internal whitespace. + data: { boolean: true } + template: " | {{#boolean}} {{! Important Whitespace }}\n {{/boolean}} | \n" + expected: " | \n | \n" + + - name: Indented Inline Sections + desc: Single-line sections should not alter surrounding whitespace. + data: { boolean: true } + template: " {{#boolean}}YES{{/boolean}}\n {{#boolean}}GOOD{{/boolean}}\n" + expected: " YES\n GOOD\n" + + - name: Standalone Lines + desc: Standalone lines should be removed from the template. + data: { boolean: true } + template: | + | This Is + {{#boolean}} + | + {{/boolean}} + | A Line + expected: | + | This Is + | + | A Line + + - name: Indented Standalone Lines + desc: Indented standalone lines should be removed from the template. + data: { boolean: true } + template: | + | This Is + {{#boolean}} + | + {{/boolean}} + | A Line + expected: | + | This Is + | + | A Line + + - name: Standalone Line Endings + desc: '"\r\n" should be considered a newline for standalone tags.' + data: { boolean: true } + template: "|\r\n{{#boolean}}\r\n{{/boolean}}\r\n|" + expected: "|\r\n|" + + - name: Standalone Without Previous Line + desc: Standalone tags should not require a newline to precede them. + data: { boolean: true } + template: " {{#boolean}}\n#{{/boolean}}\n/" + expected: "#\n/" + + - name: Standalone Without Newline + desc: Standalone tags should not require a newline to follow them. + data: { boolean: true } + template: "#{{#boolean}}\n/\n {{/boolean}}" + expected: "#\n/\n" + + # Whitespace Insensitivity + + - name: Padding + desc: Superfluous in-tag whitespace should be ignored. + data: { boolean: true } + template: '|{{# boolean }}={{/ boolean }}|' + expected: '|=|' diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/tests/testComments.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/tests/testComments.R new file mode 100644 index 00000000..3807db3e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/tests/testComments.R @@ -0,0 +1,134 @@ +# Automatically generated from specification file: 'comments.json' +# +# Comment tags represent content that should never appear in the resulting +# output. +# +# The tag's content may contain any substring (including newlines) EXCEPT the +# closing delimiter. +# +# Comment tags SHOULD be treated as standalone when appropriate. +# +library(testthat) +context('Spec v1.1, comments') + +test_that( "Inline", { + #"Comment blocks should be removed from the template." + template <- "12345{{! Comment Block! }}67890" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "1234567890", label=deparse(str), info="Comment blocks should be removed from the template.") +}) + +test_that( "Multiline", { + #"Multiline comments should be permitted." + template <- "12345{{!\n This is a\n multi-line comment...\n}}67890\n" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "1234567890\n", label=deparse(str), info="Multiline comments should be permitted.") +}) + +test_that( "Standalone", { + #"All standalone comment lines should be removed." + template <- "Begin.\n{{! Comment Block! }}\nEnd.\n" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "Begin.\nEnd.\n", label=deparse(str), info="All standalone comment lines should be removed.") +}) + +test_that( "Indented Standalone", { + #"All standalone comment lines should be removed." + template <- "Begin.\n {{! Indented Comment Block! }}\nEnd.\n" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "Begin.\nEnd.\n", label=deparse(str), info="All standalone comment lines should be removed.") +}) + +test_that( "Standalone Line Endings", { + #"\"\\r\\n\" should be considered a newline for standalone tags." + template <- "|\r\n{{! Standalone Comment }}\r\n|" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "|\r\n|", label=deparse(str), info="\"\\r\\n\" should be considered a newline for standalone tags.") +}) + +test_that( "Standalone Without Previous Line", { + #"Standalone tags should not require a newline to precede them." + template <- " {{! I'm Still Standalone }}\n!" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "!", label=deparse(str), info="Standalone tags should not require a newline to precede them.") +}) + +test_that( "Standalone Without Newline", { + #"Standalone tags should not require a newline to follow them." + template <- "!\n {{! I'm Still Standalone }}" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "!\n", label=deparse(str), info="Standalone tags should not require a newline to follow them.") +}) + +test_that( "Multiline Standalone", { + #"All standalone comment lines should be removed." + template <- "Begin.\n{{!\nSomething's going on here...\n}}\nEnd.\n" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "Begin.\nEnd.\n", label=deparse(str), info="All standalone comment lines should be removed.") +}) + +test_that( "Indented Multiline Standalone", { + #"All standalone comment lines should be removed." + template <- "Begin.\n {{!\n Something's going on here...\n }}\nEnd.\n" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "Begin.\nEnd.\n", label=deparse(str), info="All standalone comment lines should be removed.") +}) + +test_that( "Indented Inline", { + #"Inline comments should not strip whitespace" + template <- " 12 {{! 34 }}\n" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, " 12 \n", label=deparse(str), info="Inline comments should not strip whitespace") +}) + +test_that( "Surrounding Whitespace", { + #"Comment removal should preserve surrounding whitespace." + template <- "12345 {{! Comment Block! }} 67890" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "12345 67890", label=deparse(str), info="Comment removal should preserve surrounding whitespace.") +}) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/tests/testName.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/tests/testName.R new file mode 100644 index 00000000..6eaaa807 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/tests/testName.R @@ -0,0 +1,34 @@ +library(testthat) +context("Extra tests") + +test_that("names with . work",{ + a.test <- 'World' + template <- template <- "Hello {{a.test}}!" + expect_equal( whisker.render(template, list(a.test = a.test), strict=FALSE) + , "Hello World!" + ) +}) + +test_that("referencing with $ works",{ + a <- list(test = 'World') + template <- template <- "Hello {{a$test}}!" + expect_equal( whisker.render(template, list(a=a), strict=FALSE) + , "Hello World!" + ) +}) + +context("Github test") + + +test_that("newlines consistency",{ + template <- +"{{#var}} +var is true +{{/var}} +{{^var}} +var is not true +{{/var}}" + + expect_equal("var is true\n",whisker.render(template, list(var=TRUE))) + expect_equal("var is not true\n",whisker.render(template, list(var=FALSE))) +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/tests/testdelimiters.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/tests/testdelimiters.R new file mode 100644 index 00000000..1a88a4b2 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/tests/testdelimiters.R @@ -0,0 +1,168 @@ +# Automatically generated from specification file: 'delimiters.json' +# +# Set Delimiter tags are used to change the tag delimiters for all content +# following the tag in the current compilation unit. +# +# The tag's content MUST be any two non-whitespace sequences (separated by +# whitespace) EXCEPT an equals sign ('=') followed by the current closing +# delimiter. +# +# Set Delimiter tags SHOULD be treated as standalone when appropriate. +# +library(testthat) +context('Spec v1.1, delimiters') + +test_that( "Pair Behavior", { + #"The equals sign (used on both sides) should permit delimiter changes." + template <- "{{=<% %>=}}(<%text%>)" + data <- list(text = "Hey!") + + + str <- whisker.render(template, data=data) + + expect_equal(str, "(Hey!)", label=deparse(str), info="The equals sign (used on both sides) should permit delimiter changes.") +}) + +test_that( "Special Characters", { + #"Characters with special meaning regexen should be valid delimiters." + template <- "({{=[ ]=}}[text])" + data <- list(text = "It worked!") + + + str <- whisker.render(template, data=data) + + expect_equal(str, "(It worked!)", label=deparse(str), info="Characters with special meaning regexen should be valid delimiters.") +}) + +test_that( "Sections", { + #"Delimiters set outside sections should persist." + template <- "[\n{{#section}}\n {{data}}\n |data|\n{{/section}}\n\n{{= | | =}}\n|#section|\n {{data}}\n |data|\n|/section|\n]\n" + data <- list(section = TRUE, data = "I got interpolated.") + + + str <- whisker.render(template, data=data) + + expect_equal(str, "[\n I got interpolated.\n |data|\n\n {{data}}\n I got interpolated.\n]\n", label=deparse(str), info="Delimiters set outside sections should persist.") +}) + +test_that( "Inverted Sections", { + #"Delimiters set outside inverted sections should persist." + template <- "[\n{{^section}}\n {{data}}\n |data|\n{{/section}}\n\n{{= | | =}}\n|^section|\n {{data}}\n |data|\n|/section|\n]\n" + data <- list(section = FALSE, data = "I got interpolated.") + + + str <- whisker.render(template, data=data) + + expect_equal(str, "[\n I got interpolated.\n |data|\n\n {{data}}\n I got interpolated.\n]\n", label=deparse(str), info="Delimiters set outside inverted sections should persist.") +}) + +test_that( "Partial Inheritence", { + #"Delimiters set in a parent template should not affect a partial." + template <- "[ {{>include}} ]\n{{= | | =}}\n[ |>include| ]\n" + data <- list(value = "yes") + + partials <- list(include = ".{{value}}.") + str <- whisker.render(template, partials=partials, data=data) + + expect_equal(str, "[ .yes. ]\n[ .yes. ]\n", label=deparse(str), info="Delimiters set in a parent template should not affect a partial.") +}) + +test_that( "Post-Partial Behavior", { + #"Delimiters set in a partial should not affect the parent template." + template <- "[ {{>include}} ]\n[ .{{value}}. .|value|. ]\n" + data <- list(value = "yes") + + partials <- list(include = ".{{value}}. {{= | | =}} .|value|.") + str <- whisker.render(template, partials=partials, data=data) + + expect_equal(str, "[ .yes. .yes. ]\n[ .yes. .|value|. ]\n", label=deparse(str), info="Delimiters set in a partial should not affect the parent template.") +}) + +test_that( "Surrounding Whitespace", { + #"Surrounding whitespace should be left untouched." + template <- "| {{=@ @=}} |" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "| |", label=deparse(str), info="Surrounding whitespace should be left untouched.") +}) + +test_that( "Outlying Whitespace (Inline)", { + #"Whitespace should be left untouched." + template <- " | {{=@ @=}}\n" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, " | \n", label=deparse(str), info="Whitespace should be left untouched.") +}) + +test_that( "Standalone Tag", { + #"Standalone lines should be removed from the template." + template <- "Begin.\n{{=@ @=}}\nEnd.\n" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "Begin.\nEnd.\n", label=deparse(str), info="Standalone lines should be removed from the template.") +}) + +test_that( "Indented Standalone Tag", { + #"Indented standalone lines should be removed from the template." + template <- "Begin.\n {{=@ @=}}\nEnd.\n" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "Begin.\nEnd.\n", label=deparse(str), info="Indented standalone lines should be removed from the template.") +}) + +test_that( "Standalone Line Endings", { + #"\"\\r\\n\" should be considered a newline for standalone tags." + template <- "|\r\n{{= @ @ =}}\r\n|" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "|\r\n|", label=deparse(str), info="\"\\r\\n\" should be considered a newline for standalone tags.") +}) + +test_that( "Standalone Without Previous Line", { + #"Standalone tags should not require a newline to precede them." + template <- " {{=@ @=}}\n=" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "=", label=deparse(str), info="Standalone tags should not require a newline to precede them.") +}) + +test_that( "Standalone Without Newline", { + #"Standalone tags should not require a newline to follow them." + template <- "=\n {{=@ @=}}" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "=\n", label=deparse(str), info="Standalone tags should not require a newline to follow them.") +}) + +test_that( "Pair with Padding", { + #"Superfluous in-tag whitespace should be ignored." + template <- "|{{= @ @ =}}|" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "||", label=deparse(str), info="Superfluous in-tag whitespace should be ignored.") +}) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/tests/testinterpolation.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/tests/testinterpolation.R new file mode 100644 index 00000000..cf5bb594 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/tests/testinterpolation.R @@ -0,0 +1,386 @@ +# Automatically generated from specification file: 'interpolation.json' +# +# Interpolation tags are used to integrate dynamic content into the template. +# +# The tag's content MUST be a non-whitespace character sequence NOT containing +# the current closing delimiter. +# +# This tag's content names the data to replace�the tag. A single period (`.`) +# indicates that the item currently sitting atop the context stack should be +# used; otherwise, name resolution is as follows: +# 1) Split the name on periods; the first part is the name to resolve, any +# remaining parts should be retained. +# 2) Walk the context stack from top to bottom, finding the first context +# that is a) a hash containing the name as a key OR b) an object responding +# to a method with the given name. +# 3) If the context is a hash, the data is the value associated with the +# name. +# 4) If the context is an object, the data is the value returned by the +# method with the given name. +# 5) If any name parts were retained in step 1, each should be resolved +# against a context stack containing only the result from the former +# resolution. If any part fails resolution, the result should be considered +# falsey, and should interpolate as the empty string. +# Data should be coerced into a string (and escaped, if appropriate) before +# interpolation. +# +# The Interpolation tags MUST NOT be treated as standalone. +# +library(testthat) +context('Spec v1.1, interpolation') + +test_that( "No Interpolation", { + #"Mustache-free templates should render as-is." + template <- "Hello from {Mustache}!\n" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "Hello from {Mustache}!\n", label=deparse(str), info="Mustache-free templates should render as-is.") +}) + +test_that( "Basic Interpolation", { + #"Unadorned tags should interpolate content into the template." + template <- "Hello, {{subject}}!\n" + data <- list(subject = "world") + + + str <- whisker.render(template, data=data) + + expect_equal(str, "Hello, world!\n", label=deparse(str), info="Unadorned tags should interpolate content into the template.") +}) + +test_that( "HTML Escaping", { + #"Basic interpolation should be HTML escaped." + template <- "These characters should be HTML escaped: {{forbidden}}\n" + data <- list(forbidden = "& \" < >") + + + str <- whisker.render(template, data=data) + + expect_equal(str, "These characters should be HTML escaped: & " < >\n", label=deparse(str), info="Basic interpolation should be HTML escaped.") +}) + +test_that( "Triple Mustache", { + #"Triple mustaches should interpolate without HTML escaping." + template <- "These characters should not be HTML escaped: {{{forbidden}}}\n" + data <- list(forbidden = "& \" < >") + + + str <- whisker.render(template, data=data) + + expect_equal(str, "These characters should not be HTML escaped: & \" < >\n", label=deparse(str), info="Triple mustaches should interpolate without HTML escaping.") +}) + +test_that( "Ampersand", { + #"Ampersand should interpolate without HTML escaping." + template <- "These characters should not be HTML escaped: {{&forbidden}}\n" + data <- list(forbidden = "& \" < >") + + + str <- whisker.render(template, data=data) + + expect_equal(str, "These characters should not be HTML escaped: & \" < >\n", label=deparse(str), info="Ampersand should interpolate without HTML escaping.") +}) + +test_that( "Basic Integer Interpolation", { + #"Integers should interpolate seamlessly." + template <- "\"{{mph}} miles an hour!\"" + data <- list(mph = 85) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"85 miles an hour!\"", label=deparse(str), info="Integers should interpolate seamlessly.") +}) + +test_that( "Triple Mustache Integer Interpolation", { + #"Integers should interpolate seamlessly." + template <- "\"{{{mph}}} miles an hour!\"" + data <- list(mph = 85) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"85 miles an hour!\"", label=deparse(str), info="Integers should interpolate seamlessly.") +}) + +test_that( "Ampersand Integer Interpolation", { + #"Integers should interpolate seamlessly." + template <- "\"{{&mph}} miles an hour!\"" + data <- list(mph = 85) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"85 miles an hour!\"", label=deparse(str), info="Integers should interpolate seamlessly.") +}) + +test_that( "Basic Decimal Interpolation", { + #"Decimals should interpolate seamlessly with proper significance." + template <- "\"{{power}} jiggawatts!\"" + data <- list(power = 1.21) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"1.21 jiggawatts!\"", label=deparse(str), info="Decimals should interpolate seamlessly with proper significance.") +}) + +test_that( "Triple Mustache Decimal Interpolation", { + #"Decimals should interpolate seamlessly with proper significance." + template <- "\"{{{power}}} jiggawatts!\"" + data <- list(power = 1.21) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"1.21 jiggawatts!\"", label=deparse(str), info="Decimals should interpolate seamlessly with proper significance.") +}) + +test_that( "Ampersand Decimal Interpolation", { + #"Decimals should interpolate seamlessly with proper significance." + template <- "\"{{&power}} jiggawatts!\"" + data <- list(power = 1.21) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"1.21 jiggawatts!\"", label=deparse(str), info="Decimals should interpolate seamlessly with proper significance.") +}) + +test_that( "Basic Context Miss Interpolation", { + #"Failed context lookups should default to empty strings." + template <- "I ({{cannot}}) be seen!" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "I () be seen!", label=deparse(str), info="Failed context lookups should default to empty strings.") +}) + +test_that( "Triple Mustache Context Miss Interpolation", { + #"Failed context lookups should default to empty strings." + template <- "I ({{{cannot}}}) be seen!" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "I () be seen!", label=deparse(str), info="Failed context lookups should default to empty strings.") +}) + +test_that( "Ampersand Context Miss Interpolation", { + #"Failed context lookups should default to empty strings." + template <- "I ({{&cannot}}) be seen!" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "I () be seen!", label=deparse(str), info="Failed context lookups should default to empty strings.") +}) + +test_that( "Dotted Names - Basic Interpolation", { + #"Dotted names should be considered a form of shorthand for sections." + template <- "\"{{person.name}}\" == \"{{#person}}{{name}}{{/person}}\"" + data <- list(person = list(name = "Joe")) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"Joe\" == \"Joe\"", label=deparse(str), info="Dotted names should be considered a form of shorthand for sections.") +}) + +test_that( "Dotted Names - Triple Mustache Interpolation", { + #"Dotted names should be considered a form of shorthand for sections." + template <- "\"{{{person.name}}}\" == \"{{#person}}{{{name}}}{{/person}}\"" + data <- list(person = list(name = "Joe")) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"Joe\" == \"Joe\"", label=deparse(str), info="Dotted names should be considered a form of shorthand for sections.") +}) + +test_that( "Dotted Names - Ampersand Interpolation", { + #"Dotted names should be considered a form of shorthand for sections." + template <- "\"{{&person.name}}\" == \"{{#person}}{{&name}}{{/person}}\"" + data <- list(person = list(name = "Joe")) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"Joe\" == \"Joe\"", label=deparse(str), info="Dotted names should be considered a form of shorthand for sections.") +}) + +test_that( "Dotted Names - Arbitrary Depth", { + #"Dotted names should be functional to any level of nesting." + template <- "\"{{a.b.c.d.e.name}}\" == \"Phil\"" + data <- list(a = list(b = list(c = list(d = list(e = list(name = "Phil")))))) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"Phil\" == \"Phil\"", label=deparse(str), info="Dotted names should be functional to any level of nesting.") +}) + +test_that( "Dotted Names - Broken Chains", { + #"Any falsey value prior to the last part of the name should yield ''." + template <- "\"{{a.b.c}}\" == \"\"" + data <- list(a = list()) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"\" == \"\"", label=deparse(str), info="Any falsey value prior to the last part of the name should yield ''.") +}) + +test_that( "Dotted Names - Broken Chain Resolution", { + #"Each part of a dotted name should resolve only against its parent." + template <- "\"{{a.b.c.name}}\" == \"\"" + data <- list(a = list(b = list()), c = list(name = "Jim")) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"\" == \"\"", label=deparse(str), info="Each part of a dotted name should resolve only against its parent.") +}) + +test_that( "Dotted Names - Initial Resolution", { + #"The first part of a dotted name should resolve as any other name." + template <- "\"{{#a}}{{b.c.d.e.name}}{{/a}}\" == \"Phil\"" + data <- list(a = list(b = list(c = list(d = list(e = list(name = "Phil"))))), + b = list(c = list(d = list(e = list(name = "Wrong"))))) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"Phil\" == \"Phil\"", label=deparse(str), info="The first part of a dotted name should resolve as any other name.") +}) + +test_that( "Interpolation - Surrounding Whitespace", { + #"Interpolation should not alter surrounding whitespace." + template <- "| {{string}} |" + data <- list(string = "---") + + + str <- whisker.render(template, data=data) + + expect_equal(str, "| --- |", label=deparse(str), info="Interpolation should not alter surrounding whitespace.") +}) + +test_that( "Triple Mustache - Surrounding Whitespace", { + #"Interpolation should not alter surrounding whitespace." + template <- "| {{{string}}} |" + data <- list(string = "---") + + + str <- whisker.render(template, data=data) + + expect_equal(str, "| --- |", label=deparse(str), info="Interpolation should not alter surrounding whitespace.") +}) + +test_that( "Ampersand - Surrounding Whitespace", { + #"Interpolation should not alter surrounding whitespace." + template <- "| {{&string}} |" + data <- list(string = "---") + + + str <- whisker.render(template, data=data) + + expect_equal(str, "| --- |", label=deparse(str), info="Interpolation should not alter surrounding whitespace.") +}) + +test_that( "Interpolation - Standalone", { + #"Standalone interpolation should not alter surrounding whitespace." + template <- " {{string}}\n" + data <- list(string = "---") + + + str <- whisker.render(template, data=data) + + expect_equal(str, " ---\n", label=deparse(str), info="Standalone interpolation should not alter surrounding whitespace.") +}) + +test_that( "Triple Mustache - Standalone", { + #"Standalone interpolation should not alter surrounding whitespace." + template <- " {{{string}}}\n" + data <- list(string = "---") + + + str <- whisker.render(template, data=data) + + expect_equal(str, " ---\n", label=deparse(str), info="Standalone interpolation should not alter surrounding whitespace.") +}) + +test_that( "Ampersand - Standalone", { + #"Standalone interpolation should not alter surrounding whitespace." + template <- " {{&string}}\n" + data <- list(string = "---") + + + str <- whisker.render(template, data=data) + + expect_equal(str, " ---\n", label=deparse(str), info="Standalone interpolation should not alter surrounding whitespace.") +}) + +test_that( "Interpolation With Padding", { + #"Superfluous in-tag whitespace should be ignored." + template <- "|{{ string }}|" + data <- list(string = "---") + + + str <- whisker.render(template, data=data) + + expect_equal(str, "|---|", label=deparse(str), info="Superfluous in-tag whitespace should be ignored.") +}) + +test_that( "Triple Mustache With Padding", { + #"Superfluous in-tag whitespace should be ignored." + template <- "|{{{ string }}}|" + data <- list(string = "---") + + + str <- whisker.render(template, data=data) + + expect_equal(str, "|---|", label=deparse(str), info="Superfluous in-tag whitespace should be ignored.") +}) + +test_that( "Ampersand With Padding", { + #"Superfluous in-tag whitespace should be ignored." + template <- "|{{& string }}|" + data <- list(string = "---") + + + str <- whisker.render(template, data=data) + + expect_equal(str, "|---|", label=deparse(str), info="Superfluous in-tag whitespace should be ignored.") +}) + +test_that( "Empty Line", { + #"Character vectors starting with the empty string should still render" + + template <- c("", "Hello {{place}}!") + data <- list(place = "World") + + str <- whisker.render(template, data=data) + + expect_equal(str, "\nHello World!", label=deparse(str), info="Templates starting with empty string should still parse.") +}) + + +test_that( "Empty Lines", { + #"Character vectors of multiple empty strings should not collapse to newlines" + + template <- c("", "") + data <- list() + + str <- whisker.render(template, data=data) + + expect_equal(str, "", label=deparse(str), info="Templates of multiple empty strings should return empty.") +}) + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/tests/testinverted.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/tests/testinverted.R new file mode 100644 index 00000000..8926f72d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/tests/testinverted.R @@ -0,0 +1,271 @@ +# Automatically generated from specification file: 'inverted.json' +# +# Inverted Section tags and End Section tags are used in combination to wrap a +# section of the template. +# +# These tags' content MUST be a non-whitespace character sequence NOT +# containing the current closing delimiter; each Inverted Section tag MUST be +# followed by an End Section tag with the same content within the same +# section. +# +# This tag's content names the data to replace�the tag. Name resolution is as +# follows: +# 1) Split the name on periods; the first part is the name to resolve, any +# remaining parts should be retained. +# 2) Walk the context stack from top to bottom, finding the first context +# that is a) a hash containing the name as a key OR b) an object responding +# to a method with the given name. +# 3) If the context is a hash, the data is the value associated with the +# name. +# 4) If the context is an object and the method with the given name has an +# arity of 1, the method SHOULD be called with a String containing the +# unprocessed contents of the sections; the data is the value returned. +# 5) Otherwise, the data is the value returned by calling the method with +# the given name. +# 6) If any name parts were retained in step 1, each should be resolved +# against a context stack containing only the result from the former +# resolution. If any part fails resolution, the result should be considered +# falsey, and should interpolate as the empty string. +# If the data is not of a list type, it is coerced into a list as follows: if +# the data is truthy (e.g. `!!data == true`), use a single-element list +# containing the data, otherwise use an empty list. +# +# This section MUST NOT be rendered unless the data list is empty. +# +# Inverted Section and End Section tags SHOULD be treated as standalone when +# appropriate. +# +library(testthat) +context('Spec v1.1, inverted') + +test_that( "Falsey", { + #"Falsey sections should have their contents rendered." + template <- "\"{{^boolean}}This should be rendered.{{/boolean}}\"" + data <- list(boolean = FALSE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"This should be rendered.\"", label=deparse(str), info="Falsey sections should have their contents rendered.") +}) + +test_that( "Truthy", { + #"Truthy sections should have their contents omitted." + template <- "\"{{^boolean}}This should not be rendered.{{/boolean}}\"" + data <- list(boolean = TRUE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"\"", label=deparse(str), info="Truthy sections should have their contents omitted.") +}) + +test_that( "Context", { + #"Objects and hashes should behave like truthy values." + template <- "\"{{^context}}Hi {{name}}.{{/context}}\"" + data <- list(context = list(name = "Joe")) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"\"", label=deparse(str), info="Objects and hashes should behave like truthy values.") +}) + +test_that( "List", { + #"Lists should behave like truthy values." + template <- "\"{{^list}}{{n}}{{/list}}\"" + data <- list(list = list(list(n = 1), list(n = 2), list(n = 3))) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"\"", label=deparse(str), info="Lists should behave like truthy values.") +}) + +test_that( "Empty List", { + #"Empty lists should behave like falsey values." + template <- "\"{{^list}}Yay lists!{{/list}}\"" + data <- list(list = list()) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"Yay lists!\"", label=deparse(str), info="Empty lists should behave like falsey values.") +}) + +test_that( "Doubled", { + #"Multiple inverted sections per template should be permitted." + template <- "{{^bool}}\n* first\n{{/bool}}\n* {{two}}\n{{^bool}}\n* third\n{{/bool}}\n" + data <- list(two = "second", bool = FALSE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "* first\n* second\n* third\n", label=deparse(str), info="Multiple inverted sections per template should be permitted.") +}) + +test_that( "Nested (Falsey)", { + #"Nested falsey sections should have their contents rendered." + template <- "| A {{^bool}}B {{^bool}}C{{/bool}} D{{/bool}} E |" + data <- list(bool = FALSE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "| A B C D E |", label=deparse(str), info="Nested falsey sections should have their contents rendered.") +}) + +test_that( "Nested (Truthy)", { + #"Nested truthy sections should be omitted." + template <- "| A {{^bool}}B {{^bool}}C{{/bool}} D{{/bool}} E |" + data <- list(bool = TRUE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "| A E |", label=deparse(str), info="Nested truthy sections should be omitted.") +}) + +test_that( "Context Misses", { + #"Failed context lookups should be considered falsey." + template <- "[{{^missing}}Cannot find key 'missing'!{{/missing}}]" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "[Cannot find key 'missing'!]", label=deparse(str), info="Failed context lookups should be considered falsey.") +}) + +test_that( "Dotted Names - Truthy", { + #"Dotted names should be valid for Inverted Section tags." + template <- "\"{{^a.b.c}}Not Here{{/a.b.c}}\" == \"\"" + data <- list(a = list(b = list(c = TRUE))) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"\" == \"\"", label=deparse(str), info="Dotted names should be valid for Inverted Section tags.") +}) + +test_that( "Dotted Names - Falsey", { + #"Dotted names should be valid for Inverted Section tags." + template <- "\"{{^a.b.c}}Not Here{{/a.b.c}}\" == \"Not Here\"" + data <- list(a = list(b = list(c = FALSE))) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"Not Here\" == \"Not Here\"", label=deparse(str), info="Dotted names should be valid for Inverted Section tags.") +}) + +test_that( "Dotted Names - Broken Chains", { + #"Dotted names that cannot be resolved should be considered falsey." + template <- "\"{{^a.b.c}}Not Here{{/a.b.c}}\" == \"Not Here\"" + data <- list(a = list()) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"Not Here\" == \"Not Here\"", label=deparse(str), info="Dotted names that cannot be resolved should be considered falsey.") +}) + +test_that( "Surrounding Whitespace", { + #"Inverted sections should not alter surrounding whitespace." + template <- " | {{^boolean}}\t|\t{{/boolean}} | \n" + data <- list(boolean = FALSE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, " | \t|\t | \n", label=deparse(str), info="Inverted sections should not alter surrounding whitespace.") +}) + +test_that( "Internal Whitespace", { + #"Inverted should not alter internal whitespace." + template <- " | {{^boolean}} {{! Important Whitespace }}\n {{/boolean}} | \n" + data <- list(boolean = FALSE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, " | \n | \n", label=deparse(str), info="Inverted should not alter internal whitespace.") +}) + +test_that( "Indented Inline Sections", { + #"Single-line sections should not alter surrounding whitespace." + template <- " {{^boolean}}NO{{/boolean}}\n {{^boolean}}WAY{{/boolean}}\n" + data <- list(boolean = FALSE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, " NO\n WAY\n", label=deparse(str), info="Single-line sections should not alter surrounding whitespace.") +}) + +test_that( "Standalone Lines", { + #"Standalone lines should be removed from the template." + template <- "| This Is\n{{^boolean}}\n|\n{{/boolean}}\n| A Line\n" + data <- list(boolean = FALSE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "| This Is\n|\n| A Line\n", label=deparse(str), info="Standalone lines should be removed from the template.") +}) + +test_that( "Standalone Indented Lines", { + #"Standalone indented lines should be removed from the template." + template <- "| This Is\n {{^boolean}}\n|\n {{/boolean}}\n| A Line\n" + data <- list(boolean = FALSE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "| This Is\n|\n| A Line\n", label=deparse(str), info="Standalone indented lines should be removed from the template.") +}) + +test_that( "Standalone Line Endings", { + #"\"\\r\\n\" should be considered a newline for standalone tags." + template <- "|\r\n{{^boolean}}\r\n{{/boolean}}\r\n|" + data <- list(boolean = FALSE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "|\r\n|", label=deparse(str), info="\"\\r\\n\" should be considered a newline for standalone tags.") +}) + +test_that( "Standalone Without Previous Line", { + #"Standalone tags should not require a newline to precede them." + template <- " {{^boolean}}\n^{{/boolean}}\n/" + data <- list(boolean = FALSE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "^\n/", label=deparse(str), info="Standalone tags should not require a newline to precede them.") +}) + +test_that( "Standalone Without Newline", { + #"Standalone tags should not require a newline to follow them." + template <- "^{{^boolean}}\n/\n {{/boolean}}" + data <- list(boolean = FALSE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "^\n/\n", label=deparse(str), info="Standalone tags should not require a newline to follow them.") +}) + +test_that( "Padding", { + #"Superfluous in-tag whitespace should be ignored." + template <- "|{{^ boolean }}={{/ boolean }}|" + data <- list(boolean = FALSE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "|=|", label=deparse(str), info="Superfluous in-tag whitespace should be ignored.") +}) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/tests/testpartials.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/tests/testpartials.R new file mode 100644 index 00000000..6f5e761d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/tests/testpartials.R @@ -0,0 +1,129 @@ +# Automatically generated from specification file: 'partials.json' +# +# Partial tags are used to expand an external template into the current +# template. +# +# The tag's content MUST be a non-whitespace character sequence NOT containing +# the current closing delimiter. +# +# This tag's content names the partial to inject. Set Delimiter tags MUST NOT +# affect the parsing of a partial. The partial MUST be rendered against the +# context stack local to the tag. +# +# Partial tags SHOULD be treated as standalone when appropriate. If this tag +# is used standalone, any whitespace preceding the tag should treated as +# indentation, and prepended to each line of the partial before rendering. +# +library(testthat) +context('Spec v1.1, partials') + +test_that( "Basic Behavior", { + #"The greater-than operator should expand to the named partial." + template <- "\"{{>text}}\"" + data <- list() + + partials <- list(text = "from partial") + str <- whisker.render(template, partials=partials, data=data) + + expect_equal(str, "\"from partial\"", label=deparse(str), info="The greater-than operator should expand to the named partial.") +}) + +test_that( "Context", { + #"The greater-than operator should operate within the current context." + template <- "\"{{>partial}}\"" + data <- list(text = "content") + + partials <- list(partial = "*{{text}}*") + str <- whisker.render(template, partials=partials, data=data) + + expect_equal(str, "\"*content*\"", label=deparse(str), info="The greater-than operator should operate within the current context.") +}) + +test_that( "Recursion", { + #"The greater-than operator should properly recurse." + template <- "{{>node}}" + data <- list(content = "X", nodes = list(list(content = "Y", nodes = list()))) + + partials <- list(node = "{{content}}<{{#nodes}}{{>node}}{{/nodes}}>") + str <- whisker.render(template, partials=partials, data=data) + + expect_equal(str, "X>", label=deparse(str), info="The greater-than operator should properly recurse.") +}) + +test_that( "Surrounding Whitespace", { + #"The greater-than operator should not alter surrounding whitespace." + template <- "| {{>partial}} |" + data <- list() + + partials <- list(partial = "\t|\t") + str <- whisker.render(template, partials=partials, data=data) + + expect_equal(str, "| \t|\t |", label=deparse(str), info="The greater-than operator should not alter surrounding whitespace.") +}) + +test_that( "Inline Indentation", { + #"Whitespace should be left untouched." + template <- " {{data}} {{> partial}}\n" + data <- list(data = "|") + + partials <- list(partial = ">\n>") + str <- whisker.render(template, partials=partials, data=data) + + expect_equal(str, " | >\n>\n", label=deparse(str), info="Whitespace should be left untouched.") +}) + +test_that( "Standalone Line Endings", { + #"\"\\r\\n\" should be considered a newline for standalone tags." + template <- "|\r\n{{>partial}}\r\n|" + data <- list() + + partials <- list(partial = ">") + str <- whisker.render(template, partials=partials, data=data) + + expect_equal(str, "|\r\n>|", label=deparse(str), info="\"\\r\\n\" should be considered a newline for standalone tags.") +}) + +test_that( "Standalone Without Previous Line", { + #"Standalone tags should not require a newline to precede them." + template <- " {{>partial}}\n>" + data <- list() + + partials <- list(partial = ">\n>") + str <- whisker.render(template, partials=partials, data=data) + + expect_equal(str, " >\n >>", label=deparse(str), info="Standalone tags should not require a newline to precede them.") +}) + +test_that( "Standalone Without Newline", { + #"Standalone tags should not require a newline to follow them." + template <- ">\n {{>partial}}" + data <- list() + + partials <- list(partial = ">\n>") + str <- whisker.render(template, partials=partials, data=data) + + expect_equal(str, ">\n >\n >", label=deparse(str), info="Standalone tags should not require a newline to follow them.") +}) + +test_that( "Standalone Indentation", { + #"Each line of the partial should be indented before rendering." + template <- "\\\n {{>partial}}\n/\n" + data <- list(content = "<\n->") + + partials <- list(partial = "|\n{{{content}}}\n|\n") + str <- whisker.render(template, partials=partials, data=data) + + expect_equal(str, "\\\n |\n <\n->\n |\n/\n", label=deparse(str), info="Each line of the partial should be indented before rendering.") +}) + +test_that( "Padding Whitespace", { + #"Superfluous in-tag whitespace should be ignored." + template <- "|{{> partial }}|" + data <- list(boolean = TRUE) + + partials <- list(partial = "[]") + str <- whisker.render(template, partials=partials, data=data) + + expect_equal(str, "|[]|", label=deparse(str), info="Superfluous in-tag whitespace should be ignored.") +}) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/tests/testsections.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/tests/testsections.R new file mode 100644 index 00000000..a8ebe9b9 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/whisker/tests/testsections.R @@ -0,0 +1,317 @@ +# Automatically generated from specification file: 'sections.json' +# +# Section tags and End Section tags are used in combination to wrap a section +# of the template for iteration +# +# These tags' content MUST be a non-whitespace character sequence NOT +# containing the current closing delimiter; each Section tag MUST be followed +# by an End Section tag with the same content within the same section. +# +# This tag's content names the data to replace�the tag. Name resolution is as +# follows: +# 1) Split the name on periods; the first part is the name to resolve, any +# remaining parts should be retained. +# 2) Walk the context stack from top to bottom, finding the first context +# that is a) a hash containing the name as a key OR b) an object responding +# to a method with the given name. +# 3) If the context is a hash, the data is the value associated with the +# name. +# 4) If the context is an object and the method with the given name has an +# arity of 1, the method SHOULD be called with a String containing the +# unprocessed contents of the sections; the data is the value returned. +# 5) Otherwise, the data is the value returned by calling the method with +# the given name. +# 6) If any name parts were retained in step 1, each should be resolved +# against a context stack containing only the result from the former +# resolution. If any part fails resolution, the result should be considered +# falsey, and should interpolate as the empty string. +# If the data is not of a list type, it is coerced into a list as follows: if +# the data is truthy (e.g. `!!data == true`), use a single-element list +# containing the data, otherwise use an empty list. +# +# For each element in the data list, the element MUST be pushed onto the +# context stack, the section MUST be rendered, and the element MUST be popped +# off the context stack. +# +# Section and End Section tags SHOULD be treated as standalone when +# appropriate. +# +library(testthat) +context('Spec v1.1, sections') + +test_that( "Truthy", { + #"Truthy sections should have their contents rendered." + template <- "\"{{#boolean}}This should be rendered.{{/boolean}}\"" + data <- list(boolean = TRUE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"This should be rendered.\"", label=deparse(str), info="Truthy sections should have their contents rendered.") +}) + +test_that( "Falsey", { + #"Falsey sections should have their contents omitted." + template <- "\"{{#boolean}}This should not be rendered.{{/boolean}}\"" + data <- list(boolean = FALSE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"\"", label=deparse(str), info="Falsey sections should have their contents omitted.") +}) + +test_that( "Context", { + #"Objects and hashes should be pushed onto the context stack." + template <- "\"{{#context}}Hi {{name}}.{{/context}}\"" + data <- list(context = list(name = "Joe")) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"Hi Joe.\"", label=deparse(str), info="Objects and hashes should be pushed onto the context stack.") +}) + +test_that( "Deeply Nested Contexts", { + #"All elements on the context stack should be accessible." + template <- "{{#a}}\n{{one}}\n{{#b}}\n{{one}}{{two}}{{one}}\n{{#c}}\n{{one}}{{two}}{{three}}{{two}}{{one}}\n{{#d}}\n{{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}}\n{{#e}}\n{{one}}{{two}}{{three}}{{four}}{{five}}{{four}}{{three}}{{two}}{{one}}\n{{/e}}\n{{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}}\n{{/d}}\n{{one}}{{two}}{{three}}{{two}}{{one}}\n{{/c}}\n{{one}}{{two}}{{one}}\n{{/b}}\n{{one}}\n{{/a}}\n" + data <- list(a = list(one = 1), b = list(two = 2), c = list(three = 3), + d = list(four = 4), e = list(five = 5)) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "1\n121\n12321\n1234321\n123454321\n1234321\n12321\n121\n1\n", label=deparse(str), info="All elements on the context stack should be accessible.") +}) + +test_that( "List", { + #"Lists should be iterated; list items should visit the context stack." + template <- "\"{{#list}}{{item}}{{/list}}\"" + data <- list(list = list(list(item = 1), list(item = 2), list(item = 3))) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"123\"", label=deparse(str), info="Lists should be iterated; list items should visit the context stack.") +}) + +test_that( "Empty List", { + #"Empty lists should behave like falsey values." + template <- "\"{{#list}}Yay lists!{{/list}}\"" + data <- list(list = list()) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"\"", label=deparse(str), info="Empty lists should behave like falsey values.") +}) + +test_that( "Doubled", { + #"Multiple sections per template should be permitted." + template <- "{{#bool}}\n* first\n{{/bool}}\n* {{two}}\n{{#bool}}\n* third\n{{/bool}}\n" + data <- list(two = "second", bool = TRUE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "* first\n* second\n* third\n", label=deparse(str), info="Multiple sections per template should be permitted.") +}) + +test_that( "Nested (Truthy)", { + #"Nested truthy sections should have their contents rendered." + template <- "| A {{#bool}}B {{#bool}}C{{/bool}} D{{/bool}} E |" + data <- list(bool = TRUE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "| A B C D E |", label=deparse(str), info="Nested truthy sections should have their contents rendered.") +}) + +test_that( "Nested (Falsey)", { + #"Nested falsey sections should be omitted." + template <- "| A {{#bool}}B {{#bool}}C{{/bool}} D{{/bool}} E |" + data <- list(bool = FALSE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "| A E |", label=deparse(str), info="Nested falsey sections should be omitted.") +}) + +test_that( "Context Misses", { + #"Failed context lookups should be considered falsey." + template <- "[{{#missing}}Found key 'missing'!{{/missing}}]" + data <- list() + + + str <- whisker.render(template, data=data) + + expect_equal(str, "[]", label=deparse(str), info="Failed context lookups should be considered falsey.") +}) + +test_that( "Implicit Iterator - String", { + #"Implicit iterators should directly interpolate strings." + template <- "\"{{#list}}({{.}}){{/list}}\"" + data <- list(list = c("a", "b", "c", "d", "e")) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"(a)(b)(c)(d)(e)\"", label=deparse(str), info="Implicit iterators should directly interpolate strings.") +}) + +test_that( "Implicit Iterator - Integer", { + #"Implicit iterators should cast integers to strings and interpolate." + template <- "\"{{#list}}({{.}}){{/list}}\"" + data <- list(list = c(1, 2, 3, 4, 5)) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"(1)(2)(3)(4)(5)\"", label=deparse(str), info="Implicit iterators should cast integers to strings and interpolate.") +}) + +test_that( "Implicit Iterator - Decimal", { + #"Implicit iterators should cast decimals to strings and interpolate." + template <- "\"{{#list}}({{.}}){{/list}}\"" + data <- list(list = c(1.1, 2.2, 3.3, 4.4, 5.5)) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"(1.1)(2.2)(3.3)(4.4)(5.5)\"", label=deparse(str), info="Implicit iterators should cast decimals to strings and interpolate.") +}) + +test_that( "Dotted Names - Truthy", { + #"Dotted names should be valid for Section tags." + template <- "\"{{#a.b.c}}Here{{/a.b.c}}\" == \"Here\"" + data <- list(a = list(b = list(c = TRUE))) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"Here\" == \"Here\"", label=deparse(str), info="Dotted names should be valid for Section tags.") +}) + +test_that( "Dotted Names - Falsey", { + #"Dotted names should be valid for Section tags." + template <- "\"{{#a.b.c}}Here{{/a.b.c}}\" == \"\"" + data <- list(a = list(b = list(c = FALSE))) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"\" == \"\"", label=deparse(str), info="Dotted names should be valid for Section tags.") +}) + +test_that( "Dotted Names - Broken Chains", { + #"Dotted names that cannot be resolved should be considered falsey." + template <- "\"{{#a.b.c}}Here{{/a.b.c}}\" == \"\"" + data <- list(a = list()) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "\"\" == \"\"", label=deparse(str), info="Dotted names that cannot be resolved should be considered falsey.") +}) + +test_that( "Surrounding Whitespace", { + #"Sections should not alter surrounding whitespace." + template <- " | {{#boolean}}\t|\t{{/boolean}} | \n" + data <- list(boolean = TRUE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, " | \t|\t | \n", label=deparse(str), info="Sections should not alter surrounding whitespace.") +}) + +test_that( "Internal Whitespace", { + #"Sections should not alter internal whitespace." + template <- " | {{#boolean}} {{! Important Whitespace }}\n {{/boolean}} | \n" + data <- list(boolean = TRUE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, " | \n | \n", label=deparse(str), info="Sections should not alter internal whitespace.") +}) + +test_that( "Indented Inline Sections", { + #"Single-line sections should not alter surrounding whitespace." + template <- " {{#boolean}}YES{{/boolean}}\n {{#boolean}}GOOD{{/boolean}}\n" + data <- list(boolean = TRUE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, " YES\n GOOD\n", label=deparse(str), info="Single-line sections should not alter surrounding whitespace.") +}) + +test_that( "Standalone Lines", { + #"Standalone lines should be removed from the template." + template <- "| This Is\n{{#boolean}}\n|\n{{/boolean}}\n| A Line\n" + data <- list(boolean = TRUE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "| This Is\n|\n| A Line\n", label=deparse(str), info="Standalone lines should be removed from the template.") +}) + +test_that( "Indented Standalone Lines", { + #"Indented standalone lines should be removed from the template." + template <- "| This Is\n {{#boolean}}\n|\n {{/boolean}}\n| A Line\n" + data <- list(boolean = TRUE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "| This Is\n|\n| A Line\n", label=deparse(str), info="Indented standalone lines should be removed from the template.") +}) + +test_that( "Standalone Line Endings", { + #"\"\\r\\n\" should be considered a newline for standalone tags." + template <- "|\r\n{{#boolean}}\r\n{{/boolean}}\r\n|" + data <- list(boolean = TRUE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "|\r\n|", label=deparse(str), info="\"\\r\\n\" should be considered a newline for standalone tags.") +}) + +test_that( "Standalone Without Previous Line", { + #"Standalone tags should not require a newline to precede them." + template <- " {{#boolean}}\n#{{/boolean}}\n/" + data <- list(boolean = TRUE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "#\n/", label=deparse(str), info="Standalone tags should not require a newline to precede them.") +}) + +test_that( "Standalone Without Newline", { + #"Standalone tags should not require a newline to follow them." + template <- "#{{#boolean}}\n/\n {{/boolean}}" + data <- list(boolean = TRUE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "#\n/\n", label=deparse(str), info="Standalone tags should not require a newline to follow them.") +}) + +test_that( "Padding", { + #"Superfluous in-tag whitespace should be ignored." + template <- "|{{# boolean }}={{/ boolean }}|" + data <- list(boolean = TRUE) + + + str <- whisker.render(template, data=data) + + expect_equal(str, "|=|", label=deparse(str), info="Superfluous in-tag whitespace should be ignored.") +}) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/DESCRIPTION new file mode 100644 index 00000000..a78c651b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/DESCRIPTION @@ -0,0 +1,57 @@ +Package: withr +Title: Run Code 'With' Temporarily Modified Global State +Version: 3.0.2 +Authors@R: c( + person("Jim", "Hester", role = "aut"), + person("Lionel", "Henry", , "lionel@posit.co", role = c("aut", "cre")), + person("Kirill", "Müller", , "krlmlr+r@mailbox.org", role = "aut"), + person("Kevin", "Ushey", , "kevinushey@gmail.com", role = "aut"), + person("Hadley", "Wickham", , "hadley@posit.co", role = "aut"), + person("Winston", "Chang", role = "aut"), + person("Jennifer", "Bryan", role = "ctb"), + person("Richard", "Cotton", role = "ctb"), + person("Posit Software, PBC", role = c("cph", "fnd")) + ) +Description: A set of functions to run code 'with' safely and temporarily + modified global state. Many of these functions were originally a part + of the 'devtools' package, this provides a simple package with limited + dependencies to provide access to these functions. +License: MIT + file LICENSE +URL: https://withr.r-lib.org, https://github.com/r-lib/withr#readme +BugReports: https://github.com/r-lib/withr/issues +Depends: R (>= 3.6.0) +Imports: graphics, grDevices +Suggests: callr, DBI, knitr, methods, rlang, rmarkdown (>= 2.12), + RSQLite, testthat (>= 3.0.0) +VignetteBuilder: knitr +Config/Needs/website: tidyverse/tidytemplate +Config/testthat/edition: 3 +Encoding: UTF-8 +RoxygenNote: 7.3.2 +Collate: 'aaa.R' 'collate.R' 'connection.R' 'db.R' 'defer-exit.R' + 'standalone-defer.R' 'defer.R' 'devices.R' 'local_.R' 'with_.R' + 'dir.R' 'env.R' 'file.R' 'language.R' 'libpaths.R' 'locale.R' + 'makevars.R' 'namespace.R' 'options.R' 'par.R' 'path.R' 'rng.R' + 'seed.R' 'wrap.R' 'sink.R' 'tempfile.R' 'timezone.R' + 'torture.R' 'utils.R' 'with.R' +NeedsCompilation: no +Packaged: 2024-10-28 10:58:18 UTC; lionel +Author: Jim Hester [aut], + Lionel Henry [aut, cre], + Kirill Müller [aut], + Kevin Ushey [aut], + Hadley Wickham [aut], + Winston Chang [aut], + Jennifer Bryan [ctb], + Richard Cotton [ctb], + Posit Software, PBC [cph, fnd] +Maintainer: Lionel Henry +Repository: CRAN +Date/Publication: 2024-10-28 13:30:02 UTC +Built: R 4.4.1; ; 2025-02-01 04:46:13 UTC; unix +RemoteType: standard +RemotePkgRef: withr +RemoteRef: withr +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 3.0.2 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/INDEX new file mode 100644 index 00000000..e14842da --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/INDEX @@ -0,0 +1,24 @@ +defer Defer Evaluation of an Expression +devices Graphics devices +with_collate Collation Order +with_connection Connections which close themselves +with_db_connection DBMS Connections which disconnect themselves. +with_dir Working directory +with_envvar Environment variables +with_file Files which delete themselves +with_gctorture2 Torture Garbage Collector +with_language Language +with_libpaths Library paths +with_locale Locale settings +with_makevars Makevars variables +with_options Options +with_package Execute code with a modified search path +with_par Graphics parameters +with_path PATH environment variable +with_rng_version RNG version +with_seed Random seed +with_sink Output redirection +with_temp_libpaths Library paths +with_tempfile Temporary files and directories +with_timezone Time zone +withr Execute code in temporarily altered environment diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/LICENSE new file mode 100644 index 00000000..855af9ff --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2020 +COPYRIGHT HOLDER: withr authors diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/Meta/Rd.rds new file mode 100644 index 00000000..3d20df2f Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/Meta/hsearch.rds new file mode 100644 index 00000000..05922484 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/Meta/links.rds new file mode 100644 index 00000000..867445e9 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/Meta/nsInfo.rds new file mode 100644 index 00000000..b7b620ea Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/Meta/package.rds new file mode 100644 index 00000000..afe2e5be Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/Meta/vignette.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/Meta/vignette.rds new file mode 100644 index 00000000..3b393b23 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/Meta/vignette.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/NAMESPACE new file mode 100644 index 00000000..4cc4cff2 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/NAMESPACE @@ -0,0 +1,81 @@ +# Generated by roxygen2: do not edit by hand + +export(defer) +export(defer_parent) +export(deferred_clear) +export(deferred_run) +export(global_defer) +export(local_) +export(local_bmp) +export(local_cairo_pdf) +export(local_cairo_ps) +export(local_collate) +export(local_connection) +export(local_db_connection) +export(local_dir) +export(local_environment) +export(local_envvar) +export(local_file) +export(local_jpeg) +export(local_language) +export(local_libpaths) +export(local_locale) +export(local_makevars) +export(local_message_sink) +export(local_namespace) +export(local_options) +export(local_output_sink) +export(local_package) +export(local_par) +export(local_path) +export(local_pdf) +export(local_png) +export(local_postscript) +export(local_preserve_seed) +export(local_rng_version) +export(local_seed) +export(local_svg) +export(local_temp_libpaths) +export(local_tempdir) +export(local_tempfile) +export(local_tiff) +export(local_timezone) +export(local_xfig) +export(makevars_user) +export(set_makevars) +export(with_) +export(with_bmp) +export(with_cairo_pdf) +export(with_cairo_ps) +export(with_collate) +export(with_connection) +export(with_db_connection) +export(with_dir) +export(with_environment) +export(with_envvar) +export(with_file) +export(with_jpeg) +export(with_language) +export(with_libpaths) +export(with_locale) +export(with_makevars) +export(with_message_sink) +export(with_namespace) +export(with_options) +export(with_output_sink) +export(with_package) +export(with_par) +export(with_path) +export(with_pdf) +export(with_png) +export(with_postscript) +export(with_preserve_seed) +export(with_rng_version) +export(with_seed) +export(with_svg) +export(with_temp_libpaths) +export(with_tempdir) +export(with_tempfile) +export(with_tiff) +export(with_timezone) +export(with_xfig) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/NEWS.md new file mode 100644 index 00000000..5685970e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/NEWS.md @@ -0,0 +1,274 @@ +# withr 3.0.2 + +* `local_language()` now never warns when set to `"C"` (#254). + This is a cross-platform and silent way of disabling `gettext()` + translations. + + +# withr 3.0.1 + +* Fixes for CRAN checks. + + +# withr 3.0.0 + +## Performance of withr + +* `defer()` is now a thin wrapper around `base::on.exit()`. This is + possible thanks to two contributions that we made to R 3.5: + + - We added an argument for LIFO cleanup: `on.exit(after = FALSE)`. + - Calling `sys.on.exit()` elsewhere than top-level didn't work. This + is needed for manual invocation with `deferred_run()`. + + Following this change, `defer()` is now much faster (although still + slower than `on.exit()` which is a primitive function and about as + fast as it gets). This also increases the compatibility of `defer()` + with `on.exit()` (all handlers are now run in the expected order + even if they are registered with `on.exit()`) and standalone + versions of `defer()`. + + +## Breaking change + +* When `source()` is used with a local environment, as opposed to + `globalenv()` (the default), you now need to set + `options(withr.hook_source = TRUE)` to get proper withr support + (running `defer()` or `local_` functions at top-level of a script). + This support is disabled by default in local environments to avoid a + performance penalty in normal usage of withr features. + + +## Other features and bugfixes + +* `deferred_run()` now reports the number of executed expressions with + a message. + +* `deferred_run()` can now be run at any point in a knitr file (#235). + +* `local_tempfile()` now writes `lines` in UTF-8 (#210) and always uses + `\n` for newlines (#216). + +* `local_pdf()` and friends now correctly restore to the previously + active device (#138). + +* `local_()` now works even if withr isn't attached (#207). + +* `local_par()` and `with_par()` now work if you don't set any parameters + (#238). + +* `with_language()` now properly resets the translation cache (#213). + +* Fixes for Debian packaging. + + +# withr 2.5.2 + +* Fixes for CRAN checks. + + +# withr 2.5.1 + +* Fixes for CRAN checks. + + +# withr 2.5.0 + +* `defer()` and all `local_*()` functions now work when run inside of + a `.Rmd`. The deferred expressions are executed when knitr exits. + +* `defer()` and `local_` functions now work within `source()`. + The deferred expressions are executed when `source()` exits. + +* `with_()` and `local_()` gain a `get` argument. Supply a getter + function to create `with` and `local` functions that are robust to + early exits. + + When supplied, this restoration pattern is used: + + ``` + old <- get() + on.exit(set(old)) + set(new) + action() + ``` + + Instead of: + + ``` + old <- set(new) + on.exit(set(old)) + action() + ``` + + This ensures proper restoration of the old state when an early exit + occurs during `set()` (for instance when a deprecation warning is + caught, see #191). + +* These `with_` and `local_` functions are now robust to early exits (see next bullet): + + - `_locale()` + - `_envvar()` + - `_libpaths()` + - `_options()` + - `_par()` + - `_path()` + - `_seed()` + +* `with_namespace()` and `local_namespace()` now pass `warn.conflicts` + to `attach()` (@kyleam, #185). + +* `local_rng_version()` and `local_seed()` no longer warn when + restoring `sample.kind` to `"Rounding"` (#167). + +* `with_seed()` now preserves the current values of `RNGkind()` (#167). + +* `with_collate()` is no longer affected by the `LC_COLLATE` + environment variable set to "C" (#179). + +* Local evaluations in the `globalenv()` (as opposed to top-level + ones) are now unwound in the same way as regular environments. + +* `local_tempfile()` gains a lines argument so, if desired, you can pre-fill + the temporary file with some data. + + +# withr 2.4.3 + +* Lionel Henry is the new maintainer. + +* Handlers registered with the global environment (as happens when `local_()` + is run at the top-level, outside a function) are now automatically run + when the R session ends (#173). + +* New `with_language()` and `local_language()` to temporarily control the + language used for translations (#180). + +* `with_seed()` now caches the check for R version, so is now faster (#170) + +* `with_makevars()` and `local_makevars()` now eagerly evaluate the `path` argument (#169) + +# withr 2.4.2 + +- `local_options()` now lets you set an option to `NULL` as intended (#156) + +- `local_tempfile()` argument `envir` is deprecated, in favor of `.local_envir`. + All withr functions except `local_tempfile()` used `.local_envir` to specify environments, so this makes this function consistent with the rest. (#157) + +- `with_environment()` now passing `pos` and `warn.conflicts` to `attach()`, as intended (#161). + +- `with_seed()` now also sets the RNG via new arguments `.rng_kind`, `.rng_normal_kind` and `.rng_sample_kind` + (#162, @AshesITR). + +- `with_timezone()` now works after recent changes to `Sys.timezone()` in R-devel (#165) + +# withr 2.4.1 + +- Tests which require `capabilities("cairo")` are now skipped. + +# withr 2.4.0 + +- withr is now licensed as MIT (#154). + +- Tests for `with_cairo_pdf()` and `with_cairo_ps()` have been removed, as they fail if Cairo is not available, such as with M1 macOS systems (#158) + +- `local_seed()` is now exported (#153) + +# withr 2.3.0 + +## Deprecations + +- `local_tempfile()` argument `new` is deprecated, in favor of returning the path to the new tempfile. + calls like `local_tempfile("xyz")` should be replaced with `xyx <- local_tempfile()` in your code (#141). + +## New features + +- New `local_seed()` function and `local_preserve_seed()` functions to correspond to `with_seed()` and `with_preserve_seed()` (#139). + +- New `local_tempdir()` function added to create a temp directory (#140) + +- `local_*()` functions now take dots (`...`), which can simplify calls in some cases, e.g. you can now use `local_options(foo = "bar")` rather than `local_options(c(foo = "bar"))`. + +## Minor improvements and fixes + +- `defer()` now throws an error if an error occurs in the deferred expression (#148) + +- `with_file()` and `local_file()` can now work if the file is actually a directory (#144). + +# withr 2.2.0 + +- `defer()` can set deferred events on `.GlobalEnv` to facilitate the interactive development of code inside a function or test. + Helpers `deferred_run()` (and `deferred_clear()`) provide a way to explicity run and clear (or just clear) deferred events (#76, @jennybc). + +- `with_connection()` now works when existing objects or connections exist with the same names (#120) + +- `with_makevars()` now uses `tools::makevars_user()` to determine the default user makevars file (#77, @siddharthab). + +- `with_options()` no longer uses `do.call()`, so optiosn are not evaluated on exit (#73, @mtmorgan). + +- `with_package()` no longer has the `help` argument (#94, @wendtke). + +- `with_package()` now does not try to detach the package if it is already attached before calling `with_package()` (#107) + +- `with_preserve_seed()` now restores `.Random.seed` if it is not set + originally (#124). + +- Add `with_rng_version()` and `local_rng_version()` functions to change the version of the RNG (#90, @gaborcsardi). + +- `with_svg()` documentation now is consistent across R versions (#129) + +- Add `with_timezone()` and `local_timezone()` functions to change the time zone (#92, @gaborcsardi). + +- `with_tempfile()` and `local_tempfile()` now delete recursively directories on exit (#84, @meta00). + +# withr 2.1.2 + +- `set_makevars()` is now exported (#68, @gaborcsardi). + +- `with_temp_libpaths()` gains an `action` argument, to specify how the + temporary library path will be added (#66, @krlmlr). + +# withr 2.1.1 + +- Fixes test failures with testthat 2.0.0 + +- `with_file()` function to automatically remove files. + +# withr 2.1.0 + +- `with_connection()` function to automatically close R file connections. + +- `with_db_connection()` function to automatically disconnect from DBI database + connections. + +- `with_gctorture2` command to run code with gctorture2, useful for testing + (#47). + +- `with_package()`, `with_namespace()` and `with_environment()` (and equivalent + locals) functions added, to run code with a modified object search path (#38, + #48). + +- Add `with_tempfile()` and `local_tempfile()` functions to create temporary + files which are cleanup up afterwards. (#32) + +- Remove the `code` argument from `local_` functions (#50). + +# withr 2.0.0 + +- Each `with_` function now has a `local_` variant, which reset at the end of + their local scope, generally at the end of the function body. + +- New functions `with_seed()` and `with_preserve_seed()` for running code with + a given random seed (#45, @krlmlr). + +# withr 1.0.2 +- `with_makevars()` gains an `assignment` argument to allow specifying + additional assignment types. + +# withr 1.0.1 +- Relaxed R version requirement to 3.0.2 (#35, #39). +- New `with_output_sink()` and `with_message_sink()` (#24). + +# withr 1.0.0 + +- First Public Release diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/R/withr b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/R/withr new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/R/withr @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/R/withr.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/R/withr.rdb new file mode 100644 index 00000000..07b069a8 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/R/withr.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/R/withr.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/R/withr.rdx new file mode 100644 index 00000000..f9032f8b Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/R/withr.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/doc/index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/doc/index.html new file mode 100644 index 00000000..fc108321 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/doc/index.html @@ -0,0 +1,29 @@ + + +R: Vignettes and other documentation + + + +
+

Vignettes and other documentation + +

+
+
+[Top] +
+

Vignettes from package 'withr'

+ +++++++ + + + + +
withr::withrChanging and restoring stateHTMLsourceR code
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/doc/withr.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/doc/withr.R new file mode 100644 index 00000000..a570085a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/doc/withr.R @@ -0,0 +1,184 @@ +## ----include = FALSE---------------------------------------------------------- +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) + +## ----setup-------------------------------------------------------------------- +library(withr) + +## ----include = FALSE---------------------------------------------------------- +op <- options() + +## ----------------------------------------------------------------------------- +sloppy <- function(x, sig_digits) { + options(digits = sig_digits) + print(x) +} + +pi + +sloppy(pi, 2) + +pi + +## ----include = FALSE---------------------------------------------------------- +options(op) + +## ----------------------------------------------------------------------------- +neat <- function(x, sig_digits) { + op <- options(digits = sig_digits) + on.exit(options(op), add = TRUE) + print(x) +} + +pi + +neat(pi, 2) + +pi + +## ----------------------------------------------------------------------------- +neater <- function(x, sig_digits) { + op <- options(digits = sig_digits) + defer(options(op)) + print(x) +} + +pi + +neater(pi, 2) + +pi + +## ----------------------------------------------------------------------------- +defer_stack <- function() { + cat("put on socks\n") + defer(cat("take off socks\n")) + + cat("put on shoes\n") + defer(cat("take off shoes\n")) +} +defer_stack() + +## ----------------------------------------------------------------------------- +on_exit_last_one_wins <- function() { + cat("put on socks\n") + on.exit(cat("take off socks\n")) + + cat("put on shoes\n") + on.exit(cat("take off shoes\n")) +} +on_exit_last_one_wins() + +## ----eval = getRversion() >= "3.5.0"------------------------------------------ +on_exit_stack <- function() { + cat("put on socks\n") + on.exit(cat("take off socks\n"), add = TRUE, after = FALSE) + + cat("put on shoes\n") + on.exit(cat("take off shoes\n"), add = TRUE, after = FALSE) +} +on_exit_stack() + +## ----------------------------------------------------------------------------- +defer_queue <- function() { + cat("Adam gets in line for ice cream\n") + defer(cat("Adam gets ice cream\n"), priority = "last") + + cat("Beth gets in line for ice cream\n") + defer(cat("Beth gets ice cream\n"), priority = "last") +} +defer_queue() + +## ----------------------------------------------------------------------------- +neater <- function(x, sig_digits) { + op <- options(digits = sig_digits) # record orig. "digits" & change "digits" + defer(options(op)) # schedule restoration of "digits" + + print(x) +} + +## ----------------------------------------------------------------------------- +local_digits <- function(sig_digits, envir = parent.frame()) { + op <- options(digits = sig_digits) + defer(options(op), envir = envir) +} + +## ----------------------------------------------------------------------------- +neato <- function(x, digits) { + local_digits(digits) + print(x) +} + +pi + +neato(pi, 2) + +neato(pi, 4) + +## ----------------------------------------------------------------------------- +neatful <- function(x) { + local_digits(1) + print(x) + local_digits(3) + print(x) + local_digits(5) + print(x) +} + +neatful(pi) + +## ----------------------------------------------------------------------------- +neatest <- function(x, sig_digits) { + local_options(list(digits = sig_digits)) + print(x) +} + +pi + +neatest(pi, 2) + +neatest(pi, 4) + +## ----eval = FALSE------------------------------------------------------------- +# neat_with <- function(x, sig_digits) { +# # imagine lots of code here +# withr::with_options( +# list(digits = sig_digits), +# print(x) +# ) +# # ... and a lot more code here +# } + +## ----eval = FALSE------------------------------------------------------------- +# neat_local <- function(x, sig_digits) { +# withr::local_options(list(digits = sig_digits)) +# print(x) +# # imagine lots of code here +# } + +## ----------------------------------------------------------------------------- +library(withr) + +defer(print("hi")) + +pi + +# this adds another deferred event, but does not re-message +local_digits(3) + +pi + +deferred_run() + +pi + +## ----eval = FALSE------------------------------------------------------------- +# defer(print("hi")) +# #> Setting global deferred event(s). +# #> i These will be run: +# #> * Automatically, when the R session ends. +# #> * On demand, if you call `withr::deferred_run()`. +# #> i Use `withr::deferred_clear()` to clear them without executing. + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/doc/withr.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/doc/withr.Rmd new file mode 100644 index 00000000..57659d53 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/doc/withr.Rmd @@ -0,0 +1,343 @@ +--- +title: "Changing and restoring state" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Changing and restoring state} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + +```{r setup} +library(withr) +``` + + + +This article explains the type of problem withr solves and shows typical patterns of usage. +It also compares withr's functionality to the `on.exit()` function from base R. + +## It's dangerous to change state + +Whenever possible, it is desirable to write so-called **pure** functions. +The property we focus on here is that the function should not change the surrounding R landscape, i.e. it should not change things like the search path, global options, or the working directory. +If the behaviour of *other* functions differs before and after running your function, you've modified the landscape. +Changing the landscape is bad because it makes code much harder to understand. + +Here's a `sloppy()` function that prints a number with a specific number of significant digits, by adjusting R's global "digits" option. + +```{r include = FALSE} +op <- options() +``` + +```{r} +sloppy <- function(x, sig_digits) { + options(digits = sig_digits) + print(x) +} + +pi + +sloppy(pi, 2) + +pi +``` + +```{r include = FALSE} +options(op) +``` + +Notice how `pi` prints differently before and after the call to `sloppy()`? +Calling `sloppy()` has a side effect: it changes the "digits" option globally, not just within its own scope of operations. +This is what we want to avoid. + +*Don't worry, we're restoring global state (specifically, the "digits" option) behind the scenes here.* + +Sometimes you cannot avoid modifying the state of the world, in which case you just have to make sure that you put things back the way you found them. +This is what the withr package is for. + +## The base solution: `on.exit()` + +The first function to know about is base R's `on.exit()`. +Inside your function body, every time you do something that should be undone **on exit**, you immediately register the cleanup code with `on.exit(expr, add = TRUE)`[^on-exit-add]. + +[^on-exit-add]: It's too bad `add = TRUE` isn't the default, because you almost always want this. Without it, each call to `on.exit()` clobbers the effect of previous calls. + +`neat()` is an improvement over `sloppy()`, because it uses `on.exit()` to ensure that the "digits" option is restored to its original value. + +```{r} +neat <- function(x, sig_digits) { + op <- options(digits = sig_digits) + on.exit(options(op), add = TRUE) + print(x) +} + +pi + +neat(pi, 2) + +pi +``` + +`on.exit()` also works when you exit the function abnormally, i.e. due to error. +This is why official tools, like `on.exit()`, are a better choice than any do-it-yourself solution to this problem. + +`on.exit()` is a very useful function, but it's not very flexible. +The withr package provides an extensible `on.exit()`-inspired toolkit. + +## `defer()` is the foundation of withr + +`defer()` is the core function of withr and is very much like `on.exit()`, i.e. it schedules the execution of arbitrary code when the current function exits: + +```{r} +neater <- function(x, sig_digits) { + op <- options(digits = sig_digits) + defer(options(op)) + print(x) +} + +pi + +neater(pi, 2) + +pi +``` + +`withr::defer()` is basically a drop-in substitute for `on.exit()`, but with three key differences we explore below: + +1. Different default behaviour around the effect of a series of two or more + calls +1. Control over the environment the deferred events are associated with +1. Ability to work with the global environment + +Here we focus on using withr inside your functions. +See the blog post [Self-cleaning test fixtures](https://www.tidyverse.org/blog/2020/04/self-cleaning-test-fixtures/) or the testthat vignette [Test fixtures](https://testthat.r-lib.org/articles/test-fixtures.html) for how to use withr inside tests. + +## Last-in, first-out + +If you make more than one call to `defer()`, by default, it **adds** expressions to the **top** of the stack of deferred actions. + +```{r} +defer_stack <- function() { + cat("put on socks\n") + defer(cat("take off socks\n")) + + cat("put on shoes\n") + defer(cat("take off shoes\n")) +} +defer_stack() +``` + +In contrast, by default, a subsequent call to `on.exit()` **overwrites** the deferred actions registered in the previous call. + +```{r} +on_exit_last_one_wins <- function() { + cat("put on socks\n") + on.exit(cat("take off socks\n")) + + cat("put on shoes\n") + on.exit(cat("take off shoes\n")) +} +on_exit_last_one_wins() +``` + +Oops, we still have our socks on! +The last-in, first-out, stack-like behaviour of `defer()` tends to be what you want in most applications. + +To get such behaviour with `on.exit()`, remember to call it with `add = TRUE, after = FALSE`[^on-exit-after]. + +[^on-exit-after]: Note: the `after` argument of `on.exit()` first appeared in R 3.5.0. + +```{r, eval = getRversion() >= "3.5.0"} +on_exit_stack <- function() { + cat("put on socks\n") + on.exit(cat("take off socks\n"), add = TRUE, after = FALSE) + + cat("put on shoes\n") + on.exit(cat("take off shoes\n"), add = TRUE, after = FALSE) +} +on_exit_stack() +``` + +Conversely, if you want `defer()` to have first-in, first-out behaviour, specify `priority = "last"`. + +```{r} +defer_queue <- function() { + cat("Adam gets in line for ice cream\n") + defer(cat("Adam gets ice cream\n"), priority = "last") + + cat("Beth gets in line for ice cream\n") + defer(cat("Beth gets ice cream\n"), priority = "last") +} +defer_queue() +``` + +## "Local" functions (and "with" functions) + +Both `on.exit()` and `withr::defer()` schedule actions to be executed when a certain environment goes out of scope, most typically the execution environment of a function. +But the `envir` argument of `withr::defer()` lets you specify a *different* environment, which makes it possible to create customised `on.exit()` extensions. + +Let's look at the `neater()` function again. + +```{r} +neater <- function(x, sig_digits) { + op <- options(digits = sig_digits) # record orig. "digits" & change "digits" + defer(options(op)) # schedule restoration of "digits" + + print(x) +} +``` + +The first two lines are typical `on.exit()` maneuvers where, in some order, you record an original state, arrange for its eventual restoration, and +change it. +In real life, this can be much more involved and you might want to wrap this logic up into a helper function. +You can't wrap `on.exit()` in this way, because there's no way to reach back up into the correct parent frame and schedule cleanup there. +But with `defer()`, we can! +Here is such a custom helper, called `local_digits()`. + +```{r} +local_digits <- function(sig_digits, envir = parent.frame()) { + op <- options(digits = sig_digits) + defer(options(op), envir = envir) +} +``` + +We can use `local_digits()` to keep any manipulation of `digits` local to a function. + +```{r} +neato <- function(x, digits) { + local_digits(digits) + print(x) +} + +pi + +neato(pi, 2) + +neato(pi, 4) +``` + +You can even call `local_digits()` multiple times inside a function. +Each call to `local_digits()` is in effect until the next or until the function exits, which ever comes first. + +```{r} +neatful <- function(x) { + local_digits(1) + print(x) + local_digits(3) + print(x) + local_digits(5) + print(x) +} + +neatful(pi) +``` + +Certain state changes, such as modifying global options, come up so often that withr offers pre-made helpers. +These helpers come in two forms: `local_*()` functions, like the one we just made, and `with_*()` functions, which we explain below. +Here are the state change helpers in withr that you are most likely to find useful: + +| Do / undo this | withr functions | +|-----------------------------|-------------------------------------| +| Set an R option | `local_options()`,`with_options()` | +| Set an environment variable | `local_envvar()`, `with_envvar()` | +| Change working directory | `local_dir()`, `with_dir()` | +| Set a graphics parameter | `local_par()`, `with_par()` | + +We didn't really need to write our own `local_digits()` helper, because the built-in `withr::local_options()` also gets the job done: + +```{r} +neatest <- function(x, sig_digits) { + local_options(list(digits = sig_digits)) + print(x) +} + +pi + +neatest(pi, 2) + +neatest(pi, 4) +``` + +The `local_*()` functions target a slightly different use case from the `with_*()` functions, which are inspired by base R's `with()` function: + +* `with_*()` functions are best for executing a small snippet of code with a + modified state + ```{r eval = FALSE} + neat_with <- function(x, sig_digits) { + # imagine lots of code here + withr::with_options( + list(digits = sig_digits), + print(x) + ) + # ... and a lot more code here + } + ``` +* `local_*()` functions are best for modifying state "from now until the + function exits" + ```{r eval = FALSE} + neat_local <- function(x, sig_digits) { + withr::local_options(list(digits = sig_digits)) + print(x) + # imagine lots of code here + } + ``` + +It's best to minimize the footprint of your state modifications. +Therefore, use `with_*()` functions where you can. +But when this forces you to put lots of (indented) code inside `with_*()`, e.g. most of your function's body, then it's better to use `local_*()`. + +## Deferring events on the global environment + +Here is one last difference between `withr::defer()` and `on.exit()`: the ability to defer events on the global environment[^withr-2-2-0]. + +[^withr-2-2-0]: This feature first appeared in withr v2.2.0. + +At first, it sounds pretty weird to propose scheduling deferred actions on the global environment. +It's not ephemeral, the way function execution environments are. +It goes out of scope very rarely, i.e. when you exit R. +Why would you want this? + +The answer is: for development purposes. + +If you are developing functions or tests that use withr, it's very useful to be able to execute that code interactively, without error, and with the ability to trigger the deferred events. +It's hard to develop with functions that work one way inside a function, but another way in the global environment (or, worse, throw an error). + +Here's how `defer()` (and all functions based on it) works in an interactive session. + +```{r} +library(withr) + +defer(print("hi")) + +pi + +# this adds another deferred event, but does not re-message +local_digits(3) + +pi + +deferred_run() + +pi +``` + +Note that because this example is running in a vignette, it doesn't look exactly the same as what you'll see interactively. When you defer events on the global environment for the first time, you get this message that alerts you to the situation: + +```{r, eval = FALSE} +defer(print("hi")) +#> Setting global deferred event(s). +#> i These will be run: +#> * Automatically, when the R session ends. +#> * On demand, if you call `withr::deferred_run()`. +#> i Use `withr::deferred_clear()` to clear them without executing. +``` + +If you add subsequent events, the message is *not* repeated. +Since the global environment isn't perishable, like a test environment is, you have to call `deferred_run()` explicitly to execute the deferred events. You can also clear them, without running, with `deferred_clear()`. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/doc/withr.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/doc/withr.html new file mode 100644 index 00000000..bfc53cf8 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/doc/withr.html @@ -0,0 +1,726 @@ + + + + + + + + + + + + + + +Changing and restoring state + + + + + + + + + + + + + + + + + + + + + + + + + + +

Changing and restoring state

+ + + +
library(withr)
+ +

This article explains the type of problem withr solves and shows +typical patterns of usage. It also compares withr’s functionality to the +on.exit() function from base R.

+
+

It’s dangerous to change state

+

Whenever possible, it is desirable to write so-called +pure functions. The property we focus on here is that +the function should not change the surrounding R landscape, i.e. it +should not change things like the search path, global options, or the +working directory. If the behaviour of other functions differs +before and after running your function, you’ve modified the landscape. +Changing the landscape is bad because it makes code much harder to +understand.

+

Here’s a sloppy() function that prints a number with a +specific number of significant digits, by adjusting R’s global “digits” +option.

+
sloppy <- function(x, sig_digits) {
+  options(digits = sig_digits)
+  print(x)
+}
+
+pi
+#> [1] 3.141593
+
+sloppy(pi, 2)
+#> [1] 3.1
+
+pi
+#> [1] 3.1
+

Notice how pi prints differently before and after the +call to sloppy()? Calling sloppy() has a side +effect: it changes the “digits” option globally, not just within its own +scope of operations. This is what we want to avoid.

+

Don’t worry, we’re restoring global state (specifically, the +“digits” option) behind the scenes here.

+

Sometimes you cannot avoid modifying the state of the world, in which +case you just have to make sure that you put things back the way you +found them. This is what the withr package is for.

+
+
+

The base solution: on.exit()

+

The first function to know about is base R’s on.exit(). +Inside your function body, every time you do something that should be +undone on exit, you immediately register the cleanup +code with on.exit(expr, add = TRUE)1.

+

neat() is an improvement over sloppy(), +because it uses on.exit() to ensure that the “digits” +option is restored to its original value.

+
neat <- function(x, sig_digits) {
+  op <- options(digits = sig_digits)
+  on.exit(options(op), add = TRUE)
+  print(x)
+}
+
+pi
+#> [1] 3.141593
+
+neat(pi, 2)
+#> [1] 3.1
+
+pi
+#> [1] 3.141593
+

on.exit() also works when you exit the function +abnormally, i.e. due to error. This is why official tools, like +on.exit(), are a better choice than any do-it-yourself +solution to this problem.

+

on.exit() is a very useful function, but it’s not very +flexible. The withr package provides an extensible +on.exit()-inspired toolkit.

+
+
+

defer() is the foundation of withr

+

defer() is the core function of withr and is very much +like on.exit(), i.e. it schedules the execution of +arbitrary code when the current function exits:

+
neater <- function(x, sig_digits) {
+  op <- options(digits = sig_digits)
+  defer(options(op))
+  print(x)
+}
+
+pi
+#> [1] 3.141593
+
+neater(pi, 2)
+#> [1] 3.1
+
+pi
+#> [1] 3.141593
+

withr::defer() is basically a drop-in substitute for +on.exit(), but with three key differences we explore +below:

+
    +
  1. Different default behaviour around the effect of a series of two or +more calls
  2. +
  3. Control over the environment the deferred events are associated +with
  4. +
  5. Ability to work with the global environment
  6. +
+

Here we focus on using withr inside your functions. See the blog post +Self-cleaning +test fixtures or the testthat vignette Test +fixtures for how to use withr inside tests.

+
+
+

Last-in, first-out

+

If you make more than one call to defer(), by default, +it adds expressions to the top of the +stack of deferred actions.

+
defer_stack <- function() {
+  cat("put on socks\n")
+  defer(cat("take off socks\n"))
+  
+  cat("put on shoes\n")
+  defer(cat("take off shoes\n"))
+}
+defer_stack()
+#> put on socks
+#> put on shoes
+#> take off shoes
+#> take off socks
+

In contrast, by default, a subsequent call to on.exit() +overwrites the deferred actions registered in the +previous call.

+
on_exit_last_one_wins <- function() {
+  cat("put on socks\n")
+  on.exit(cat("take off socks\n"))
+  
+  cat("put on shoes\n")
+  on.exit(cat("take off shoes\n"))
+}
+on_exit_last_one_wins()
+#> put on socks
+#> put on shoes
+#> take off shoes
+

Oops, we still have our socks on! The last-in, first-out, stack-like +behaviour of defer() tends to be what you want in most +applications.

+

To get such behaviour with on.exit(), remember to call +it with add = TRUE, after = FALSE2.

+
on_exit_stack <- function() {
+  cat("put on socks\n")
+  on.exit(cat("take off socks\n"), add = TRUE, after = FALSE)
+  
+  cat("put on shoes\n")
+  on.exit(cat("take off shoes\n"), add = TRUE, after = FALSE)
+}
+on_exit_stack()
+#> put on socks
+#> put on shoes
+#> take off shoes
+#> take off socks
+

Conversely, if you want defer() to have first-in, +first-out behaviour, specify priority = "last".

+
defer_queue <- function() {
+  cat("Adam gets in line for ice cream\n")
+  defer(cat("Adam gets ice cream\n"), priority = "last")
+
+  cat("Beth gets in line for ice cream\n")
+  defer(cat("Beth gets ice cream\n"), priority = "last")
+}
+defer_queue()
+#> Adam gets in line for ice cream
+#> Beth gets in line for ice cream
+#> Adam gets ice cream
+#> Beth gets ice cream
+
+
+

“Local” functions (and “with” functions)

+

Both on.exit() and withr::defer() schedule +actions to be executed when a certain environment goes out of scope, +most typically the execution environment of a function. But the +envir argument of withr::defer() lets you +specify a different environment, which makes it possible to +create customised on.exit() extensions.

+

Let’s look at the neater() function again.

+
neater <- function(x, sig_digits) {
+  op <- options(digits = sig_digits) # record orig. "digits" & change "digits"
+  defer(options(op))                 # schedule restoration of "digits"
+  
+  print(x)
+}
+

The first two lines are typical on.exit() maneuvers +where, in some order, you record an original state, arrange for its +eventual restoration, and change it. In real life, this can be much more +involved and you might want to wrap this logic up into a helper +function. You can’t wrap on.exit() in this way, because +there’s no way to reach back up into the correct parent frame and +schedule cleanup there. But with defer(), we can! Here is +such a custom helper, called local_digits().

+
local_digits <- function(sig_digits, envir = parent.frame()) {
+  op <- options(digits = sig_digits)
+  defer(options(op), envir = envir)
+}
+

We can use local_digits() to keep any manipulation of +digits local to a function.

+
neato <- function(x, digits) {
+  local_digits(digits)
+  print(x)
+}
+
+pi
+#> [1] 3.141593
+
+neato(pi, 2)
+#> [1] 3.1
+
+neato(pi, 4)
+#> [1] 3.142
+

You can even call local_digits() multiple times inside a +function. Each call to local_digits() is in effect until +the next or until the function exits, which ever comes first.

+
neatful <- function(x) {
+  local_digits(1)
+  print(x)
+  local_digits(3)
+  print(x)
+  local_digits(5)
+  print(x)
+}
+
+neatful(pi)
+#> [1] 3
+#> [1] 3.14
+#> [1] 3.1416
+

Certain state changes, such as modifying global options, come up so +often that withr offers pre-made helpers. These helpers come in two +forms: local_*() functions, like the one we just made, and +with_*() functions, which we explain below. Here are the +state change helpers in withr that you are most likely to find +useful:

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Do / undo thiswithr functions
Set an R optionlocal_options(),with_options()
Set an environment variablelocal_envvar(), with_envvar()
Change working directorylocal_dir(), with_dir()
Set a graphics parameterlocal_par(), with_par()
+

We didn’t really need to write our own local_digits() +helper, because the built-in withr::local_options() also +gets the job done:

+
neatest <- function(x, sig_digits) {
+  local_options(list(digits = sig_digits))
+  print(x)
+}
+
+pi
+#> [1] 3.141593
+
+neatest(pi, 2)
+#> [1] 3.1
+
+neatest(pi, 4)
+#> [1] 3.142
+

The local_*() functions target a slightly different use +case from the with_*() functions, which are inspired by +base R’s with() function:

+
    +
  • with_*() functions are best for executing a small +snippet of code with a modified state

    +
    neat_with <- function(x, sig_digits) {
    +  # imagine lots of code here
    +  withr::with_options(
    +    list(digits = sig_digits),
    +    print(x)
    +  )
    +  # ... and a lot more code here
    +}
  • +
  • local_*() functions are best for modifying state +“from now until the function exits”

    +
    neat_local <- function(x, sig_digits) {
    +  withr::local_options(list(digits = sig_digits))
    +  print(x)
    +  # imagine lots of code here
    +}
  • +
+

It’s best to minimize the footprint of your state modifications. +Therefore, use with_*() functions where you can. But when +this forces you to put lots of (indented) code inside +with_*(), e.g. most of your function’s body, then it’s +better to use local_*().

+
+
+

Deferring events on the global environment

+

Here is one last difference between withr::defer() and +on.exit(): the ability to defer events on the global +environment3.

+

At first, it sounds pretty weird to propose scheduling deferred +actions on the global environment. It’s not ephemeral, the way function +execution environments are. It goes out of scope very rarely, i.e. when +you exit R. Why would you want this?

+

The answer is: for development purposes.

+

If you are developing functions or tests that use withr, it’s very +useful to be able to execute that code interactively, without error, and +with the ability to trigger the deferred events. It’s hard to develop +with functions that work one way inside a function, but another way in +the global environment (or, worse, throw an error).

+

Here’s how defer() (and all functions based on it) works +in an interactive session.

+
library(withr)
+
+defer(print("hi"))
+
+pi
+#> [1] 3.141593
+
+# this adds another deferred event, but does not re-message
+local_digits(3)
+
+pi
+#> [1] 3.14
+
+deferred_run()
+#> [1] "hi"
+#> Ran 2/2 deferred expressions
+
+pi
+#> [1] 3.141593
+

Note that because this example is running in a vignette, it doesn’t +look exactly the same as what you’ll see interactively. When you defer +events on the global environment for the first time, you get this +message that alerts you to the situation:

+
defer(print("hi"))
+#> Setting global deferred event(s).
+#> i These will be run:
+#>   * Automatically, when the R session ends.
+#>   * On demand, if you call `withr::deferred_run()`.
+#> i Use `withr::deferred_clear()` to clear them without executing.
+

If you add subsequent events, the message is not repeated. +Since the global environment isn’t perishable, like a test environment +is, you have to call deferred_run() explicitly to execute +the deferred events. You can also clear them, without running, with +deferred_clear().

+
+
+
+
    +
  1. It’s too bad add = TRUE isn’t the default, +because you almost always want this. Without it, each call to +on.exit() clobbers the effect of previous calls.↩︎

  2. +
  3. Note: the after argument of +on.exit() first appeared in R 3.5.0.↩︎

  4. +
  5. This feature first appeared in withr v2.2.0.↩︎

  6. +
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/AnIndex new file mode 100644 index 00000000..4511aed3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/AnIndex @@ -0,0 +1,86 @@ +withr-package withr +defer defer +deferred_clear defer +deferred_run defer +defer_parent defer +devices devices +global_defer global_defer +local_ with_ +local_bmp devices +local_cairo_pdf devices +local_cairo_ps devices +local_collate with_collate +local_connection with_connection +local_db_connection with_db_connection +local_dir with_dir +local_environment with_package +local_envvar with_envvar +local_file with_file +local_jpeg devices +local_language with_language +local_libpaths with_libpaths +local_locale with_locale +local_makevars with_makevars +local_message_sink with_sink +local_namespace with_package +local_options with_options +local_output_sink with_sink +local_package with_package +local_par with_par +local_path with_path +local_pdf devices +local_png devices +local_postscript devices +local_preserve_seed with_seed +local_rng_version with_rng_version +local_seed with_seed +local_svg devices +local_tempdir with_tempfile +local_tempfile with_tempfile +local_temp_libpaths with_temp_libpaths +local_tiff devices +local_timezone with_timezone +local_xfig devices +makevars_user makevars_user +set_makevars set_makevars +withr withr +with_ with_ +with_bmp devices +with_cairo_pdf devices +with_cairo_ps devices +with_collate with_collate +with_connection with_connection +with_db_connection with_db_connection +with_dev devices +with_device devices +with_dir with_dir +with_environment with_package +with_envvar with_envvar +with_file with_file +with_gctorture2 with_gctorture2 +with_jpeg devices +with_language with_language +with_libpaths with_libpaths +with_locale with_locale +with_makevars with_makevars +with_message_sink with_sink +with_namespace with_package +with_options with_options +with_output_sink with_sink +with_package with_package +with_par with_par +with_path with_path +with_pdf devices +with_png devices +with_postscript devices +with_preserve_seed with_seed +with_rng_version with_rng_version +with_seed with_seed +with_sink with_sink +with_svg devices +with_tempdir with_tempfile +with_tempfile with_tempfile +with_temp_libpaths with_temp_libpaths +with_tiff devices +with_timezone with_timezone +with_xfig devices diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/aliases.rds new file mode 100644 index 00000000..8487eae3 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/README-unnamed-chunk-3-1.png b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/README-unnamed-chunk-3-1.png new file mode 100644 index 00000000..4cf82a9a Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/README-unnamed-chunk-3-1.png differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-archived.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-archived.svg new file mode 100644 index 00000000..745ab0c7 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-archived.svg @@ -0,0 +1,21 @@ + + lifecycle: archived + + + + + + + + + + + + + + + lifecycle + + archived + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-defunct.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-defunct.svg new file mode 100644 index 00000000..d5c9559e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-defunct.svg @@ -0,0 +1,21 @@ + + lifecycle: defunct + + + + + + + + + + + + + + + lifecycle + + defunct + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-deprecated.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-deprecated.svg new file mode 100644 index 00000000..b61c57c3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-deprecated.svg @@ -0,0 +1,21 @@ + + lifecycle: deprecated + + + + + + + + + + + + + + + lifecycle + + deprecated + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-experimental.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-experimental.svg new file mode 100644 index 00000000..5d88fc2c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-experimental.svg @@ -0,0 +1,21 @@ + + lifecycle: experimental + + + + + + + + + + + + + + + lifecycle + + experimental + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-maturing.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-maturing.svg new file mode 100644 index 00000000..897370ec --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-maturing.svg @@ -0,0 +1,21 @@ + + lifecycle: maturing + + + + + + + + + + + + + + + lifecycle + + maturing + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-questioning.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-questioning.svg new file mode 100644 index 00000000..7c1721d0 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-questioning.svg @@ -0,0 +1,21 @@ + + lifecycle: questioning + + + + + + + + + + + + + + + lifecycle + + questioning + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-soft-deprecated.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-soft-deprecated.svg new file mode 100644 index 00000000..9c166ff3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-soft-deprecated.svg @@ -0,0 +1,21 @@ + + lifecycle: soft-deprecated + + + + + + + + + + + + + + + lifecycle + + soft-deprecated + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-stable.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-stable.svg new file mode 100644 index 00000000..9bf21e76 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-stable.svg @@ -0,0 +1,29 @@ + + lifecycle: stable + + + + + + + + + + + + + + + + lifecycle + + + + stable + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-superseded.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-superseded.svg new file mode 100644 index 00000000..db8d757f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/lifecycle-superseded.svg @@ -0,0 +1,21 @@ + + lifecycle: superseded + + + + + + + + + + + + + + + lifecycle + + superseded + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/logo.png b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/logo.png new file mode 100644 index 00000000..935cb298 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/figures/logo.png differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/paths.rds new file mode 100644 index 00000000..711102fa Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/withr.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/withr.rdb new file mode 100644 index 00000000..f5767d5a Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/withr.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/withr.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/withr.rdx new file mode 100644 index 00000000..b6f3581a Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/help/withr.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/html/00Index.html new file mode 100644 index 00000000..f136845e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/html/00Index.html @@ -0,0 +1,189 @@ + + +R: Run Code 'With' Temporarily Modified Global State + + + +
+

Run Code 'With' Temporarily Modified Global State + +

+
+
+[Up] +[Top] +

Documentation for package ‘withr’ version 3.0.2

+ + + +

Help Pages

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
withr-packageExecute code in temporarily altered environment
deferDefer Evaluation of an Expression
deferred_clearDefer Evaluation of an Expression
deferred_runDefer Evaluation of an Expression
defer_parentDefer Evaluation of an Expression
devicesGraphics devices
local_bmpGraphics devices
local_cairo_pdfGraphics devices
local_cairo_psGraphics devices
local_collateCollation Order
local_connectionConnections which close themselves
local_db_connectionDBMS Connections which disconnect themselves.
local_dirWorking directory
local_environmentExecute code with a modified search path
local_envvarEnvironment variables
local_fileFiles which delete themselves
local_jpegGraphics devices
local_languageLanguage
local_libpathsLibrary paths
local_localeLocale settings
local_makevarsMakevars variables
local_message_sinkOutput redirection
local_namespaceExecute code with a modified search path
local_optionsOptions
local_output_sinkOutput redirection
local_packageExecute code with a modified search path
local_parGraphics parameters
local_pathPATH environment variable
local_pdfGraphics devices
local_pngGraphics devices
local_postscriptGraphics devices
local_preserve_seedRandom seed
local_rng_versionRNG version
local_seedRandom seed
local_svgGraphics devices
local_tempdirTemporary files and directories
local_tempfileTemporary files and directories
local_temp_libpathsLibrary paths
local_tiffGraphics devices
local_timezoneTime zone
local_xfigGraphics devices
withrExecute code in temporarily altered environment
with_bmpGraphics devices
with_cairo_pdfGraphics devices
with_cairo_psGraphics devices
with_collateCollation Order
with_connectionConnections which close themselves
with_db_connectionDBMS Connections which disconnect themselves.
with_devGraphics devices
with_deviceGraphics devices
with_dirWorking directory
with_environmentExecute code with a modified search path
with_envvarEnvironment variables
with_fileFiles which delete themselves
with_gctorture2Torture Garbage Collector
with_jpegGraphics devices
with_languageLanguage
with_libpathsLibrary paths
with_localeLocale settings
with_makevarsMakevars variables
with_message_sinkOutput redirection
with_namespaceExecute code with a modified search path
with_optionsOptions
with_output_sinkOutput redirection
with_packageExecute code with a modified search path
with_parGraphics parameters
with_pathPATH environment variable
with_pdfGraphics devices
with_pngGraphics devices
with_postscriptGraphics devices
with_preserve_seedRandom seed
with_rng_versionRNG version
with_seedRandom seed
with_sinkOutput redirection
with_svgGraphics devices
with_tempdirTemporary files and directories
with_tempfileTemporary files and directories
with_temp_libpathsLibrary paths
with_tiffGraphics devices
with_timezoneTime zone
with_xfigGraphics devices
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/withr/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/DESCRIPTION new file mode 100644 index 00000000..d6e5af37 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/DESCRIPTION @@ -0,0 +1,45 @@ +Package: xfun +Type: Package +Title: Supporting Functions for Packages Maintained by 'Yihui Xie' +Version: 0.50 +Authors@R: c( + person("Yihui", "Xie", role = c("aut", "cre", "cph"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")), + person("Wush", "Wu", role = "ctb"), + person("Daijiang", "Li", role = "ctb"), + person("Xianying", "Tan", role = "ctb"), + person("Salim", "Brüggemann", role = "ctb", email = "salim-b@pm.me", comment = c(ORCID = "0000-0002-5329-5987")), + person("Christophe", "Dervieux", role = "ctb"), + person() + ) +Description: Miscellaneous functions commonly used in other packages maintained by 'Yihui Xie'. +Depends: R (>= 3.2.0) +Imports: grDevices, stats, tools +Suggests: testit, parallel, codetools, methods, rstudioapi, tinytex (>= + 0.30), mime, litedown (>= 0.4), commonmark, knitr (>= 1.47), + remotes, pak, rhub, renv, curl, xml2, jsonlite, magick, yaml, + qs, rmarkdown +License: MIT + file LICENSE +URL: https://github.com/yihui/xfun +BugReports: https://github.com/yihui/xfun/issues +Encoding: UTF-8 +RoxygenNote: 7.3.2 +VignetteBuilder: litedown +NeedsCompilation: yes +Packaged: 2025-01-07 14:01:22 UTC; runner +Author: Yihui Xie [aut, cre, cph] (), + Wush Wu [ctb], + Daijiang Li [ctb], + Xianying Tan [ctb], + Salim Brüggemann [ctb] (), + Christophe Dervieux [ctb] +Maintainer: Yihui Xie +Repository: CRAN +Date/Publication: 2025-01-07 15:20:02 UTC +Built: R 4.4.1; aarch64-apple-darwin20; 2025-02-01 04:44:52 UTC; unix +Archs: xfun.so.dSYM +RemoteType: standard +RemotePkgRef: xfun +RemoteRef: xfun +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 0.50 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/INDEX new file mode 100644 index 00000000..b8d19fd9 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/INDEX @@ -0,0 +1,137 @@ +Rscript Run the commands 'Rscript' and 'R CMD' +Rscript_call Call a function in a new R session via + 'Rscript()' +alnum_id Generate ID strings +attr Obtain an attribute of an object without + partial matching +base64_encode Encode/decode data into/from base64 encoding. +base64_uri Generate the Data URI for a file +base_pkgs Get base R package names +bg_process Start a background process +broken_packages Find out broken packages and reinstall them +bump_version Bump version numbers +cache_exec Cache the execution of an expression in memory + or on disk +cache_rds Cache the value of an R expression to an RDS + file +crandalf_check Submit check jobs to crandalf +csv_options Parse comma-separated chunk options +decimal_dot Evaluate an expression after forcing the + decimal point to be a dot +del_empty_dir Delete an empty directory +dir_create Create a directory recursively by default +dir_exists Test the existence of files and directories +divide_chunk Divide chunk options from the code chunk body +do_once Perform a task once in an R session +download_cache Download a file from a URL and cache it on disk +download_file Try various methods to download a file +embed_file Embed a file, multiple files, or directory on + an HTML page +env_option Retrieve a global option from both 'options()' + and environment variables +existing_files Find file paths that exist +exit_call Call 'on.exit()' in a parent function +fenced_block Create a fenced block in Markdown +file_ext Manipulate filename extensions +file_rename Rename files and directories +file_string Read a text file and concatenate the lines by + "\n" +find_globals Find global/local variables in R code +format_bytes Format numbers of bytes using a specified unit +from_root Get the relative path of a path in a project + relative to the current working directory +github_releases Get the tags of GitHub releases of a repository +grep_sub Perform replacement with 'gsub()' on elements + matched from 'grep()' +gsub_file Search and replace strings in files +html_tag Tools for HTML tags +in_dir Evaluate an expression under a specified + working directory +install_dir Install a source package from a directory +install_github An alias of 'remotes::install_github()' +is_abs_path Test if paths are relative or absolute +is_ascii Check if a character vector consists of + entirely ASCII characters +is_blank Test if a character vector consists of blank + strings +is_sub_path Test if a path is a subpath of a dir +is_web_path Test if a path is a web path +is_windows Test for types of operating systems +join_words Join multiple words into a single string +lazy_save Save objects to files and lazy-load them +magic_path Find a file or directory under a root directory +mark_dirs Mark some paths as directories +md5 Calculate the MD5 checksums of R objects +md_table Generate a simple Markdown pipe table +mime_type Get the MIME types of files +msg_cat Generate a message with 'cat()' +native_encode Try to use the system native encoding to + represent a character vector +new_app Create a local web application +news2md Convert package news to the Markdown format +normalize_path Normalize paths +numbers_to_words Convert numbers to English words +optipng Run OptiPNG on all PNG files under a directory +parse_only Parse R code and do not keep the source +pkg_attach Attach or load packages, and automatically + install missing packages if requested +pkg_bib Generate BibTeX bibliography databases for R + packages +proc_kill Kill a process and (optionally) all its child + processes +process_file Read a text file, process the text with a + function, and write the text back +proj_root Return the (possible) root directory of a + project +prose_index Find the indices of lines in Markdown that are + prose (not code blocks) +protect_math Protect math expressions in pairs of backticks + in Markdown +raw_string Print a character vector in its raw form +read_all Read all text files and concatenate their + content +read_bin Read all records of a binary file as a raw + vector by default +read_utf8 Read / write files encoded in UTF-8 +record Run R code and record the results +record_print Print methods for 'record()' +relative_path Get the relative path of a path relative to a + directory +rename_seq Rename files with a sequential numeric prefix +rest_api Get data from a REST API +retry Retry calling a function for a number of times +rev_check Run 'R CMD check' on the reverse dependencies + of a package +rstudio_type Type a character vector into the RStudio source + editor +same_path Test if two paths are the same after they are + normalized +session_info An alternative to sessionInfo() to print + session information +set_envvar Set environment variables +shrink_images Shrink images to a maximum width +split_lines Split a character vector by line breaks +split_source Split source lines into complete expressions +str_wrap Wrap character vectors +strict_list Strict lists +strip_html Strip HTML tags +submit_cran Submit a source package to CRAN +system3 Run 'system2()' and mark its character output + as UTF-8 if appropriate +tabset Represent a (recursive) list with (nested) + tabsets +taml_load A simple YAML reader and writer +tinify Use the Tinify API to compress PNG and JPEG + images +tojson A simple JSON serializer +tree Turn the output of 'str()' into a tree diagram +try_error Try an expression and see if it throws an error +try_silent Try to evaluate an expression silently +upload_ftp Upload to an FTP server via 'curl' +upload_imgur Upload an image to imgur.com +url_accessible Test if a URL is accessible +url_filename Extract filenames from a URLs +valid_syntax Check if the syntax of the code is valid +yaml_body Partition the YAML metadata and the body in a + document +yaml_load Read YAML data diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/LICENSE new file mode 100644 index 00000000..c87f3082 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2018-2024 +COPYRIGHT HOLDER: Yihui Xie diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/Meta/Rd.rds new file mode 100644 index 00000000..7906a59b Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/Meta/hsearch.rds new file mode 100644 index 00000000..465077ec Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/Meta/links.rds new file mode 100644 index 00000000..cb29bc7a Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/Meta/nsInfo.rds new file mode 100644 index 00000000..998180fe Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/Meta/package.rds new file mode 100644 index 00000000..6a5d5087 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/Meta/vignette.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/Meta/vignette.rds new file mode 100644 index 00000000..950f9cf8 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/Meta/vignette.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/NAMESPACE new file mode 100644 index 00000000..82403f2c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/NAMESPACE @@ -0,0 +1,168 @@ +# Generated by roxygen2: do not edit by hand + +S3method("$",xfun_strict_list) +S3method(format,xfun_record_results) +S3method(print,xfun_md_viewable) +S3method(print,xfun_raw_string) +S3method(print,xfun_record_results) +S3method(print,xfun_rename_seq) +S3method(print,xfun_strict_list) +S3method(record_print,default) +S3method(record_print,record_asis) +export(Rcmd) +export(Rscript) +export(Rscript_call) +export(alnum_id) +export(append_unique) +export(append_utf8) +export(as_strict_list) +export(attr) +export(base64_decode) +export(base64_encode) +export(base64_uri) +export(base_pkgs) +export(bg_process) +export(broken_packages) +export(bump_version) +export(cache_exec) +export(cache_rds) +export(check_old_package) +export(check_package_name) +export(compare_Rcheck) +export(crandalf_check) +export(crandalf_results) +export(csv_options) +export(decimal_dot) +export(del_empty_dir) +export(dir_create) +export(dir_exists) +export(divide_chunk) +export(do_once) +export(download_cache) +export(download_file) +export(embed_dir) +export(embed_file) +export(embed_files) +export(env_option) +export(existing_files) +export(exit_call) +export(fenced_block) +export(fenced_div) +export(file_exists) +export(file_ext) +export(file_rename) +export(file_string) +export(find_globals) +export(find_locals) +export(format_bytes) +export(from_root) +export(github_api) +export(github_releases) +export(grep_sub) +export(gsub_dir) +export(gsub_ext) +export(gsub_file) +export(gsub_files) +export(html_escape) +export(html_tag) +export(html_value) +export(html_view) +export(in_dir) +export(install_dir) +export(install_github) +export(is_CRAN_incoming) +export(is_R_CMD_check) +export(is_abs_path) +export(is_arm64) +export(is_ascii) +export(is_blank) +export(is_linux) +export(is_macos) +export(is_rel_path) +export(is_sub_path) +export(is_unix) +export(is_web_path) +export(is_windows) +export(join_words) +export(json_vector) +export(lazy_load) +export(lazy_save) +export(loadable) +export(magic_path) +export(make_fence) +export(mark_dirs) +export(md5) +export(md_table) +export(mime_type) +export(msg_cat) +export(n2w) +export(native_encode) +export(new_app) +export(new_record) +export(news2md) +export(normalize_path) +export(numbers_to_words) +export(optipng) +export(parse_only) +export(pkg_attach) +export(pkg_attach2) +export(pkg_available) +export(pkg_bib) +export(pkg_load) +export(pkg_load2) +export(proc_kill) +export(process_file) +export(proj_root) +export(prose_index) +export(protect_math) +export(raw_string) +export(read_all) +export(read_bin) +export(read_utf8) +export(record) +export(record_print) +export(relative_path) +export(rename_seq) +export(rest_api) +export(rest_api_raw) +export(retry) +export(rev_check) +export(root_rules) +export(rstudio_type) +export(same_path) +export(sans_ext) +export(session_info) +export(set_envvar) +export(shrink_images) +export(sort_file) +export(split_lines) +export(split_source) +export(str_wrap) +export(strict_list) +export(strip_html) +export(submit_cran) +export(system3) +export(tabset) +export(taml_file) +export(taml_load) +export(taml_save) +export(tinify) +export(tinify_dir) +export(tojson) +export(tree) +export(try_error) +export(try_silent) +export(upload_ftp) +export(upload_imgur) +export(upload_win_builder) +export(url_accessible) +export(url_filename) +export(valid_syntax) +export(with_ext) +export(write_utf8) +export(yaml_body) +export(yaml_load) +import(grDevices) +import(stats) +import(utils) +useDynLib(xfun, .registration = TRUE) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/NEWS.md new file mode 100644 index 00000000..6115824c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/NEWS.md @@ -0,0 +1,611 @@ +# CHANGES IN xfun VERSION 0.50 + +- The function `isFALSE()` has been removed from this package. The deprecation notice was given two years ago: https://yihui.org/en/2023/02/xfun-isfalse/ + +- Added a new function `tabset()` to represent a list with a tabset. The representation is similar to `str()`, but uses a visual form. + +- Factored out the function `taml_load()` and exported it (TAML is a tiny subset of YAML). Also added a new function `taml_save()` to convert simple lists to YAML. + +- The `print` argument of `record()` can accept non-function values now, in which case `print()` (or `show()` for S4 objects) will be used as the print function. + +- The `record()` results can also be formatted to Markdown via `format(record(), to = 'markdown')`. + +- Moved `knitr::combine_words()` into this package as `xfun::join_words()`. The former has become a simple wrapper of the latter. + +- Similarly, moved `knitr::write_bib()` into this package as `xfun::pkg_bib()`. + +- Moved the internal function `str_wrap()` from **knitr** and exported it as `xfun::str_wrap()`. + +- Exported the internal `find_globals()` and `find_locals()` functions. + +- `md_table()` escapes `|` in the table to `\|` instead of `|` now. + +- `yaml_load(use_yaml = FALSE)` allows for indenting sub-fields by any number of spaces now (thanks, @J-Moravec, #95). Previously, one level of indentation must use exactly 2 spaces. + +- `divide_chunk()` no longer requires every line of chunk options to be commented out when the engine uses a pair of comment delimiters (such as `/*` and `*/` for CSS) instead of a single comment character. It suffices to use the opening delimiter at the beginning and closing delimiter at the end, e.g., + + ````md + ```{css} + /*| echo=FALSE, + label='foo' */ + ``` + ```` + + Previously, every line must be commented out like: + + ````md + ```{css} + /*| echo=FALSE, */ + /*| label='foo' */ + ``` + ```` + +# CHANGES IN xfun VERSION 0.49 + +- Added an argument `use_block = FALSE` to `protect_math()`. When `use_block = TRUE`, a `$$ $$` expression that spans across multiple lines will be protected in a code block. + +- `protect_math()` will ignore `$ $` if there are backticks after the opening `$` or before the closing `$`, e.g., ``$`this is not math`$``. + +- `protect_math()` allows for parentheses `()` around math expressions now, e.g., `($x$)` was previously not recognized but is recognized now (thanks, @AlbertLei, yihui/litedown#34). + +- `record()` works with `quote()` now (thanks, @ben-schwen, yihui/litedown#38). + +- `html_escape()` will not escape double quotes (i.e., convert `"`" to `"`) by default, and the conversion will be done only for `html_escape(attr = TRUE)`. + +- The arguments `before` and `after` of `read_all()` can take functions of two arguments now, with the second argument being the content of each file. + +- Added an argument `start` to `make_fence()`. + +# CHANGES IN xfun VERSION 0.48 + +- Added utilities for HTML tags: `html_tag()`, `html_escape()`, `html_escape()`, and `html_view()`. Removed the soft dependency on the **htmltools** package accordingly. + +- `base_pkgs()` is faster now: it calls `tools::standard_package_names()` if the function exists (R >= 4.4.0), otherwise it just returns a constant vector of base package names (thanks, @arnaudgallou, #91). + +- Added a function `mime_type()` to obtain the MIME types of files via `mime::guess_type()` if **mime** is installed, otherwise it will call `tools:::mime_type()`, and fall back to using a system command (e.g., `file --mime-type`) to obtain the types. + +- Added a function `file_rename()` to deal with `file.rename()` failures by calling `file.copy()` (thanks, @Giqles @katrinabrock, rstudio/bookdown#804). + +- `new_app()` will use `utils::browseURL()` to open the app if `options('viewer')` is not configured (thanks, @AlbertLei, yihui/litedown#29). + +- Added a method `record_print.record_asis()` to return the object as is. + +# CHANGES IN xfun VERSION 0.47 + +- Added functions `lazy_save()` and `lazy_load()` to save objects to files and lazy-load them. + +- Fixed a bug in `record(dev = svglite::svglite)` that misplaced plots when low-level plot functions are used (thanks, @liao961120, yihui/litedown#17). + +- Specified the lowest R version required (v3.2.0) for this package. + +# CHANGES IN xfun VERSION 0.46 + +- `md_table()` should add a vertical ellipsis to row names when rows are truncated by the `limit` argument. + +- `session_info()` recognizes Positron now (thanks, @chuxinyuan, #89). + +# CHANGES IN xfun VERSION 0.45 + +- For `record()` with `verbose = 1` or `2`, invisible `NULL` is no longer printed. + +- `Rscript_call()` will show the actual error message (if an error occurred) during calling the function in a new R session. + +# CHANGES IN xfun VERSION 0.44 + +- Added a function `cache_exec()` to cache the execution of an expression either in memory or on disk. It is much more general and flexible than `cache_rds()`. For example, it supports custom reading/writing methods for cache files, and can load locally created variables in the expression while loading cache. + +- Added an argument `cache` to `record()` to make it possible to enable caching. + +- Added arguments `message` and `warning` to `record()` to decide whether messages and warnings should be recorded. + +- Changed the default value of the argument `error` of `record()` from `FALSE` to `NA`. Now `FALSE` means to suppress error messages, and `NA` means to throw errors normally. This is for consistency with the `message` and `warning` arguments. + +- Added an S3 generic function `record_print()`, which is similar to `knitr::knit_print()` but for the purpose of printing visible values in `record()`. + +- The `record()` function gained new arguments `print` and `print.args` to support custom printing functions and arguments. + +- Added a function `md_table()`, which is a minimal Markdown table generator. + +- Exported the internal function `md5()` to calculate the MD5 checksums of R objects. The function is essentially a workaround for `tools::md5sum()` (see HenrikBengtsson/Wishlist-for-R#21). + +- For `fenced_block()`, a space is added between the backticks and the language name, e.g., ```` ```r ```` has become ```` ``` r ```` now. This will affect snapshot tests based on Markdown ([an example](https://github.com/yihui/knitr-examples/commit/931e0a2)). + +- Added a shorthand `fenced_div()` for `fenced_block(char = ':')`. + +- `write_utf8()` returns the `con` argument (typically a file path) now. Previously, it returns `NULL`. + +- Added an experimental function `new_app()` to create a local web application. + +- The returned value of `yaml_body()` contains a new element `lines` in the list indicating the line numbers of YAML metadata if exists. + +- Removed the `skip` argument from `split_source()`. + +- For `split_source(line_number = TRUE)`, the attribute name for line numbers in the returned value was changed from `line_start` (a single starting line number) to `lines` (both the starting and ending numbers). + +- Fixed an edge case in `prose_index()`, in which inline code was incorrectly recognized as a code block fence. + +# CHANGES IN xfun VERSION 0.43 + +- Added a function `upload_imgur()`, which was adapted from `knitr::imgur_upload()`. The latter will call the former in the future. `xfun::upload_imgur()` allows users to choose whether to use the system command `curl` or the R package **curl** to upload the image. It also has a new argument `include_xml` to specify whether the XML response needs to be included in the returned value. + +- Added a function `fenced_block()` to create a fenced block in Markdown (thanks, @cderv, yihui/knitr#2331). The block can be either a code block or a fenced Div. + +- Fixed a bug in `xfun::record()` when the argument `verbose = 1` or `2`. + +# CHANGES IN xfun VERSION 0.42 + +- `isFALSE()` has been fully deprecated for R >= 3.5.0, and will be completely removed from this package in the future (). + +- Added a function `record()` to run R code and record the results, which is similar to `evaluate::evaluate()` but less sophisticated and technically simpler. One major difference is that `xfun::record()` records plots directly to files instead of saving them as display lists. + +- `yaml_load()` gained an `envir` argument, which can be used to specify the environment to evaluate R expressions in YAML (i.e., expressions written after `!expr` or `!r`). This is not straightforward in the upstream **yaml** package (thanks, @viking, vubiostat/r-yaml#54). + +- `yaml_body()` gained the `...` argument to pass more arguments to `yaml_load()`. + +- `split_source()` gained a `merge_comments` argument to merge consecutive lines of comments into the next code block, a `line_number` argument to store the line number of each expression in the returned value, and a `skip` argument to skip the rest of the code when the skip token is found. + +- `check_old_package()` has been vectorized, i.e., the arguments `name` and `version` can take vectors now. + +- Factored out the code for parsing chunk options and dividing a chunk into chunk options and chunk body from **knitr** to this package as functions `csv_options()` and `divide_chunk()`, respectively. They will be used by **knitr** and other packages in future. + +- Added a function `decimal_dot()` to evaluate an expression after forcing `options(OutDec = '.')` and `Sys.setlocale(LC_NUMERIC = 'C')` (for rstudio/rmarkdown#2525). + +# CHANGES IN xfun VERSION 0.41 + +- `process_file()` will write to the file only if the processed text is different with the input text. This is to avoid writing files unnecessarily. + +- `session_info()` will remove extra blank lines (thanks, @chuxinyuan, #82) and also omit the time zone info. + +# CHANGES IN xfun VERSION 0.40 + +- `number_to_words()` supports decimal numbers now (thanks, @harshvardhaniimi, #80). + +- `is_ascii()` is more robust now (thanks, @bastistician, #81). + +# CHANGES IN xfun VERSION 0.39 + +- Fixed a bug that `protect_math()` fails to protect the starting `$$` that has leading white spaces. + +- Added a function `strip_html()` to remove HTML tags and comments from text. + +- The function `alnum_id()` will remove HTML tags and comments from text (using `strip_html()`) before converting it to an ID string. + +- Added a function `env_option()` to retrieve an option value from `options()`. If the option does not exist there, check the environment variables. This provides a way for users to set an option via either `options()` or an environment variable. + +# CHANGES IN xfun VERSION 0.38 + +- Added an object `download_cache`, which is a list of methods to download a URL, cache the result, retrieve the result from the cache, and clear the cache. + +- Added an argument `default` to `url_filename()` to provide a default filename when it cannot be determined from the URL. + +- Added a function `yaml_load()` to read YAML data when the **yaml** package is not available. It only supports a limited number of data types and is supposed to be used as a fallback method. See the help page `?xfun::yaml_load` for details. + +- Added a function `yaml_body()` to split a document into YAML metadata and the body. + +- `is_arm64()` also supports Linux now (thanks, @eitsupi, #74). + +- `is_blank()` returns a logical vector of the same length as the input vector now, indicating if each element of the input is blank. Previously it returns a logical scalar indicating whether *all* elements are blank. If you want the old behavior, you can use `all(is_blank())`. + +# CHANGES IN xfun VERSION 0.37 + +- Added a function `is_arm64()` to test the CPU type (thanks, @AlbanSagouis, #72). + +- Started deprecating `xfun::isFALSE()` in favor of `base::isFALSE()` for R >= 3.5.0 (thanks, @mmaechler, #66); `isFALSE()` will eventually be removed from **xfun** when we do not need to support R < 3.5.0. + +# CHANGES IN xfun VERSION 0.36 + +- Added a new argument `resolve_symlink` to `normalize_path()` to get the absolute paths of symlinks without resolving them (with `resolve_symlink = FALSE`). + +# CHANGES IN xfun VERSION 0.35 + +- Added a new argument `token` to `protect_math()` to optionally include a token around math expressions. + +- `base64_uri()` relies less on the **mime** package now. For some common file extensions (e.g., `.jpg`/`.png`), this function knows their MIME types. + +- `stringsAsStrings()` has been removed from this package. + +# CHANGES IN xfun VERSION 0.34 + +- Added a new function `alnum_id()` to generate ID strings from a character vector. + +- The function `stringsAsStrings()` has been deprecated. + +# CHANGES IN xfun VERSION 0.33 + +- Reverted the change for #68: the characters `-+!_#` are no longer accepted by default in filename extensions, since they are relatively rare and caused a breakage in rstudio/bookdown#1369. If you wish to allow for these characters, you may use the new `extra` argument in `file_ext()` and related functions, e.g., `xfun::file_ext(x, extra = '-+!_#')`. + +- The function `stringsAsStrings()` will be deprecated in a future release of **xfun**, because the global option `stringsAsFactors = FALSE` has become the default in base R since 4.0.0. + +# CHANGES IN xfun VERSION 0.32 + +- Added a function `shrink_images()` to shrink images to a maximum width using the **magick** package (thanks, @apreshill, rstudio/blogdown#614). + +- Added a function `tinify_dir()` as a wrapper of `tinify()` to compress images under a directory. + +- `file_ext()` supports more file extensions now, such as `.c++`, `.FB2K-COMPONENT`, and so on (thanks, @tentacles-from-outer-space, #68). + +- Fixed the issue that `xfun::base_pkgs()` could hang R (thanks, @mmaechler, #66). + +- The `...` argument in `dir_create()` was not passed to `dir.create()`. + +# CHANGES IN xfun VERSION 0.31 + +- `github_releases(use_jsonlite = FALSE)` supports R versions below 4.1.0 now. + +- `session_info()` silently drops empty package names now (thanks, @phargarten2, #65). + +# CHANGES IN xfun VERSION 0.30 + +- Added a new function `is_blank()` (previously existed in **knitr**) to test if all elements of a character vector are blank (white spaces or empty strings). + +- Added a new argument `error = TRUE` to `existing_files()`. + +# CHANGES IN xfun VERSION 0.29 + +- `github_releases()` can fetch all releases (tags) of a Github repo now. + +- Added an argument `.error` to `download_file()` so that users can customize the error message when the download fails. + +- Added functions `rest_api_raw()` and `rest_api()` to get data from a REST API; also added the function `github_api()` to get data from the Github API based on `rest_api_raw()`. + +- Added a wrapper function `system3()` based on `system2()` to mark the character output of `system2()` as UTF-8 if appropriate. + +- Added a function `existing_files()` to return file paths that exist (a shorthand of `x[file.exists(x)]`). + +- Added a function `read_all()` to read multiple files and concatenate the content into a character vector. + +- `url_accessible()` uses `curlGetHeaders()` by default (instead of `download_file()`) to test if a URL is accessible when the **curl** package is not available. + +- When `options(xfun.rev_check.compare = FALSE)`, `rev_check()` will run `R CMD check` on reverse dependencies against a source package but not the CRAN version of this package. By default, this option is `TRUE`, meaning that `R CMD check` will run against both versions of the package. + +# CHANGES IN xfun VERSION 0.28 + +- Added a new function `url_accessible()` to test if a URL can be downloaded. + +- Added a new function `try_error()` to try an expression and see if it throws an error. + +# CHANGES IN xfun VERSION 0.27 + +- Exported and documented the function `xfun::base_pkgs()` (to return base R package names). + +- Changed the default value of the `status_only` argument of `compare_Rcheck()` from `FALSE` to `TRUE`. + +- Added new functions `crandalf_check()` and `crandalf_results()` for checking (especially large numbers of) reverse dependencies of packages via [**crandalf**](https://github.com/yihui/crandalf). + +- Added new functions `append_utf8()` and `append_unique()` based on `read_utf8()` and `write_utf8()` to append content to files or connections. + +# CHANGES IN xfun VERSION 0.26 + +- The `windows_only` argument of `native_encode()` has been removed. Now `native_encode()` only tries the conversion to native encoding on platforms where `l10n_info()[['UTF-8']]` does not return `TRUE`. + +- Added a `solaris` argument to `upload_win_builder()`. + +# CHANGES IN xfun VERSION 0.25 + +- Fixed a bug in `broken_packages()` (thanks, @PythonCoderUnicorn, rstudio/rmarkdown#1990). + +- Added a `files` argument to `optipng()` so that users can specify the list of PNG files instead of running `optipng` on a whole directory. + +# CHANGES IN xfun VERSION 0.24 + +- Exported the internal function `broken_packages()` to reinstall broken R packages. + +- Fixed the bug in `proj_root()` #54 (thanks, @clarkliming). + +# CHANGES IN xfun VERSION 0.23 + +## NEW FEATURES + +- Added a `tinify()` function to compress PNG/JPEG images via [the Tinify API](https://tinypng.com/developers). + +- Added a `news2md()` function to convert package news to the Markdown format. This is mainly for converting the plain-text `NEWS` file and the `NEWS.Rd` file to `NEWS.md`. + +- Added a `format_bytes()` function to format numbers of bytes using a specified unit, e.g., `1024` can be formatted as `1 Kb`. + +- When using `pkg_load2()` in an **renv** project, it will use `renv::install()` to install missing packages by default to take advantage of **renv**'s caching feature (thanks, @chunyunma @cderv, #52). + +- `upload_win_builder()` no longer requires the system command `curl` to be available; if `curl` is not available, the R package **curl** will be used instead, which means this R package must be installed. In addition to uploading to the `ftp` server of win-builder, it's also possible to upload to : call `upload_win_builder(..., server = 'https')`. This change was made so that it would be possible to continue to upload to win-builder in case it should stop supporting `ftp` (CRAN has discouraged package authors from using `ftp://`). + +## BUG FIXES + +- Backticks are added to math environments by mistake when `\begin{}` and `\end{}` do not match (thanks, @oliviergimenez, #51). + +## MINOR CHANGES + +- The argument `src` was renamed to `pkg` in `install_dir()`. + +- The argument `file` of `upload_win_builder()` defaults to `pkg_build()` now, i.e., by default, it will build a source package and upload it, so you do not need to build the package separately. + +# CHANGES IN xfun VERSION 0.22 + +## NEW FEATURES + +- `relative_path()` is vectorized now. + +- Added a new function `retry()` to retry calling a function for a number of times in case of errors. + +- Added a new function `sort_file()`, which is a shorthand for `process_file(fun = sort)` to sort the lines in a text file. + +## MAJOR CHANGES + +- The argument `FUN` was renamed to `fun` in `process_file()`. + +## MINOR CHANGES + +- Inside `download_file()`, the `timeout` option in `options()` is set to 3600 seconds when it takes the default value of 60 seconds, which may not be enough for downloading large files (thanks, @matthewgson, yihui/tinytex#286). + +# CHANGES IN xfun VERSION 0.21 + +## NEW FEATURES + +- Added a new function `pkg_available()` to test if a package with a minimal version is available (thanks, @cderv, #45). + +- Added a new function `set_envvar()` to set environment variables and return their old values, so they could be restored later. + +- Added a new function `exit_call()` to call a function when a parent function exits. + +- Exported the internal function `read_bin()`. + +- Added an argument `verbose` to `bg_process()`. + +- `Rscript_call()` gains an `options` argument to pass command-line options to `Rscript` (thanks, @cderv, #48). + +# CHANGES IN xfun VERSION 0.20 + +## NEW FEATURES + +- Added a function `msg_cat()` to generate a message with `cat()`. See the help page `?xfun::msg_cat` for more information. + +- Added a function `mark_dirs()` to mark directories with a trailing slash in a vector of paths to differentiate them from normal filenames (#44). + +## BUG FIXES + +- `xfun::proc_kill()` failed to work on *nix. + +- `xfun::del_empty_dir()` failed to delete empty dirs. + +- `xfun::file_string()` preserves emptiness (thanks, @MichaelChirico, #38). + +- `xfun::raw_string()` preserves the class(es) of the input now (thanks, @MichaelChirico, #40). + +## MINOR CHANGES + +- Exported the function `dir_create()`. + +# CHANGES IN xfun VERSION 0.19 + +## NEW FEATURES + +- Added functions `bg_process()` to run a command in a background process, and `proc_kill()` to kill a process. + +- Added a function `del_empty_dir()` to delete a directory if it is empty. + +- Added functions `is_abs_path()` and `is_rel_path()` to check if paths are absolute or relative. + +- Added a function `is_sub_path()` to test if a path is under a directory. + +- Added a function `is_web_path()` to test if a path is a web path that starts with `http://` or `https://` or `ftp://` or `ftps://`. + +- Documented and exported the previously internal functions `dir_exists()` and `file_exists()` (thanks, @cderv, #36). + +- Added a function `dir_create()` to create a directory recursively by default when it does not exist. + +- Added an argument `fail` to `Rscript_call()` to allow users to customize the error message when an error occurred in calling the function in a new R session. + +## MINOR CHANGES + +- `file_ext()`, `sans_ext()`, and `with_ext()` no longer use `tools::file_ext()` or `tools::file_path_sans_ext()`, but provide a slightly different implementation. They treat `tar.(gz|bz2|xz)` and `nb.html` as file extensions, and also allow extensions to contain a trailing `~` or `#`. + +# CHANGES IN xfun VERSION 0.18 + +## NEW FEATURES + +- Added a function `grep_sub()` to perform replacement with `gsub()` on elements matched from `grep()`. + +- Added a function `github_releases()` to obtain the tags from the Github releases of a repo. + +- Added a function `bump_version()` to increase the last digit of version numbers by one. + +- Moved a function `process_file()` from the **blogdown** package to this package, and documented it. + +- Added a function `valid_syntax()` to check if an R code fragment is syntactically valid. This function was moved from the **highr** package. + +- Added a function `url_filename()` to extract filenames from URLs. This function is used by `download_file()` to determine the default output filename. + +- Added a function `do_once()` to perform a task once in an R session. + +- Added a function `proj_root()` to find the root directory of a project. Currently it only supports R package projects and RStudio projects by default. + +- Added a function `relative_path()` to calculate the relative path of a path relative to a directory. + +- Added a function `from_root()`, which is similar to `here::here()` but returns a relative path instead of an absolute path. + +- Added a function `magic_path()` that, given an incomplete input path, tries to find the actual path recursively under subdirectories of a root directory. For example, users may only provide a base filename, and `magic_path()` will look for this file under subdirectories and return the actual path if it is found. + +## MINOR CHANGES + +- Now `download_file()` tries the download method `winnet` first (previously it was `libcurl`) on Windows (thanks, @cderv, #33). + +# CHANGES IN xfun VERSION 0.17 + +## NEW FEATURES + +- Supports `xfun::pkg_attach(packages, install = "pak")`, i.e., use `pak::pkg_install()` to install a package when it is not installed (thanks, @GitHunter0, #32). + +- Added a new function `xfun::split_source()` to split lines of R source code into minimal complete expressions. This function was moved from the **highr** package. + +# CHANGES IN xfun VERSION 0.16 + +- Added a new function `base64_decode()` to decode data from the base64 encoding (thanks, @wush978, #31). + +# CHANGES IN xfun VERSION 0.15 + +## NEW FEATURES + +- Added a new function `tree()`, which is based on `str()` in base R, but changes the output of `str()` into a tree diagram to make it easier to understand nested data structures. + +- Added a new function `base64_encode()` to encode data into the base64 encoding (thanks, @wush978, #27). + +- Added a new function `base64_uri()` to generate the Data URI (or Data URL) for a file. + +## BUG FIXES + +- Fenced code blocks commented out in `` are not longer recognized as code blocks but prose (thanks, @jarauh, #25). + +# CHANGES IN xfun VERSION 0.14 + +## NEW FEATURES + +- The `cache_rds()` function can invalidate the cache automatically when the code passed to its `expr` argument has changed. Two new arguments, `hash` and `clean` were added to this function to make it more useful and powerful. See the help page `?xfun::cache_rds()` for more information. + +# CHANGES IN xfun VERSION 0.13 + +## NEW FEATURES + +- Added a new function `cache_rds()` to cache an R expression to a `*.rds` file. + +- Added a new function `Rscript_call()` to call a function (with arguments) in a new R session via the command `Rscript`. + +- The `recheck` argument of `rev_check()` can take a vector of package names, and only these packages will be checked. See `?xfun::rev_check` for more details. + +# CHANGES IN xfun VERSION 0.12 + +## NEW FEATURES + +- Added a new function `split_lines()`. + +# CHANGES IN xfun VERSION 0.11 + +## BUG FIXES + +- `read_utf8()` will read the file with `options(encoding = 'native.enc')` and ignore user's setting such as `options(encoding = 'UTF-8')` (#21). + +# CHANGES IN xfun VERSION 0.10 + +## NEW FEATURES + +- Added the function `as_strict_list()` to convert an existing object to a strict list without wrapping it in another list if the object already is of type list (in contrast to how `strict_list()` behaves) (thanks, @salim-b, #20). + +# CHANGES IN xfun VERSION 0.9 + +## NEW FEATURES + +- Added a function `rename_seq()` to rename files to add an incremental numeric prefix to the filenames, e.g., rename `a.txt`, `b.txt`, `c.txt` to `1-a.txt`, `2-b.txt`, `3-c.txt`. + +# CHANGES IN xfun VERSION 0.8 + +## MINOR CHANGES + +- `xfun::write_utf8(NULL)` is equivalent to `xfun::write_utf8(character(0))` now (thanks, @schloerke, yihui/knitr#1714). + +# CHANGES IN xfun VERSION 0.7 + +## MINOR CHANGES + +- `loadable()` is quiet with R 3.6.0 (https://stat.ethz.ch/pipermail/r-devel/2019-May/077774.html). + +# CHANGES IN xfun VERSION 0.6 + +## NEW FEATURES + +- Added the `...` argument to `same_path()` to pass additional arguments to `normalize_path()`. + +## BUG FIXES + +- The `warn` argument in `prose_index()` failed to suppress warnings. + +# CHANGES IN xfun VERSION 0.5 + +## NEW FEATURES + +- Added functions `upload_ftp()` and `upload_win_builder()` to upload files to FTP servers. + +- Added a function `stringsAsStrings()` (see its help page for details). + +- Added an argument `warn` to `prose_index()` to suppress the warning when code fences are not balanced. + +## BUG FIXES + +- Fixed the bug that `prose_index()` recognizes double backticks as code fences (thanks, @shrektan, #14 #15). + +# CHANGES IN xfun VERSION 0.4 + +## NEW FEATURES + +- Added functions `embed_file()`, `embed_dir()`, and `embed_files()` to embed files in an HTML output file (e.g., from R Markdown), so that the files can be directly downloaded from the web browser. One use case is to call one of these functions in an R code chunk of an Rmd document to embed the Rmd source document or data files in the HTML output, so readers can download them. + +- Added a new argument `message` to `pkg_attach()`, so you can suppress package startup messages via `xfun::pkg_attach(..., message = FALSE)` or set the global option `options(xfun.pkg_attach.message = FALSE)` (thanks, @wch, yihui/knitr#1583). + +## MINOR CHANGES + +- The argument `rw_error` was moved from `gsub_dir()` to `gsub_file()` (`gsub_dir(rw_error = ...)` will still work). + +- `is_ascii()` now returns `NA` for `NA_character_` (thanks, @shrektan, #8 #9). + +# CHANGES IN xfun VERSION 0.3 + +## NEW FEATURES + +- Added a new functions `download_file()` to try various methods to download a file. + +- Added a new function `is_ascii()` to test if a character vector only consists of ASCII characters. + +- Added a new function `numbers_to_words()` to convert numbers to English words (thanks, @daijiang, #3). + +# CHANGES IN xfun VERSION 0.2 + +## NEW FEATURES + +- Added a `new_session` argument to `loadable()`. + +- Added new functions `gsub_file()`, `gsub_files()`, `gsub_dir()`, and `gsub_ext()` to replace strings in files. + +- Added new functions `Rscript` and `Rcmd` as wrappers of `system2('Rscript')` and `system2('R', 'CMD')`, respectively. + +- Added a new function `install_dir()` to install a source package from a directory. + +- Added a new function `file_string()` to read a text file (encoded in UTF-8) and return its content a single character string (lines concatenated by `\n`). + +- Added a new function `raw_string()` to print a character vector in its "raw" form using `cat(..., sep = '\n')` instead of `print()`, because the latter may introduce `[1]`, "extra" double quotes, and escape sequences, which are not very human-readable. + +- Added a new function `session_info()` as an alternative to `sessionInfo()`. + +- Added a new function `rev_check()` to run `R CMD check` on the reverse dependencies of a package, and a corresponding helper function `compare_Rcheck()` for showing the differences in logs with the CRAN version and the current version of the package, respectively. + +- Added new functions for dealing with Markdown text: `prose_index()` returns the line indices of text that is prose (not code blocks), and `protect_math()` protects math expressions in Markdown in backticks. + +- Added an `error` argument to `read_utf8()` to signal an error if the file is not encoded in UTF-8. + +# CHANGES IN xfun VERSION 0.1 + +## NEW FEATURES + +- `attr()` as an abbreviation of `base::attr(exact = TRUE)`. + +- `file_ext()`, `sans_ext()`, and `with_ext()` to manipulate extensions in filenames. + +- `in_dir()` to evaluate an R expression in a directory. + +- `isFALSE()` as an abbreviation of `identical(x, FALSE)`. + +- `is_windows()`, `is_macos()`, `is_linux()`, and `is_unix()` to test operating systems. + +- `native_encode()` to try to encode a character vector in the native encoding. + +- `normalize_path()` as an abbreviation of `normalizePath(winslash = '/', mustWork = FALSE)`. + +- `optipng()` to run the command `optipng` to optimize all PNG files under a directory. + +- `parse_only()` parses R code without keeping the source references. + +- `pkg_attach()` and `pkg_load()` to attach and load a vector of packages, respectively (and optionally, install the missing packages). + +- `read_utf8()` and `write_utf8()` to read and write UTF-8 files, respectively. + +- `same_path()` to test if two paths are the same. + +- `strict_list()` is a version of `list()` that disables partial matching of the `$` operator. + +- `tojson()` is a simple JSON serializer. + +- `try_silent()` is an abbreviation of `try(silent = TRUE)`. diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/R/xfun b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/R/xfun new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/R/xfun @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/R/xfun.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/R/xfun.rdb new file mode 100644 index 00000000..c41d3478 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/R/xfun.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/R/xfun.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/R/xfun.rdx new file mode 100644 index 00000000..038e1dc5 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/R/xfun.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/doc/index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/doc/index.html new file mode 100644 index 00000000..847c0705 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/doc/index.html @@ -0,0 +1,29 @@ + + +R: Vignettes and other documentation + + + +
+

Vignettes and other documentation + +

+
+
+[Top] +
+

Vignettes from package 'xfun'

+ +++++++ + + + + +
xfun::xfunAn Introduction to xfunHTMLsourceR code
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/doc/xfun.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/doc/xfun.R new file mode 100644 index 00000000..0fbc3702 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/doc/xfun.R @@ -0,0 +1,80 @@ +library(xfun) + +library(xfun) +(z = strict_list(aaa = "I am aaa", b = 1:5)) +z$a # NULL (strict matching) +z$aaa # I am aaa +z$b +z$c = "you can create a new element" + +z2 = unclass(z) # a normal list +z2$a # partial matching + +z3 = as_strict_list(z2) # a strict list again +z3$a # NULL (strict matching) again! + +library(xfun) +raw_string(head(LETTERS)) +(x = c("a \"b\"", "hello\tworld!")) +raw_string(x) # this is more likely to be what you want to see + +f = system.file("LICENSE", package = "xfun") +xfun::file_string(f) +as.character(xfun::file_string(f)) # essentially a character string + +f = system.file("LICENSE", package = "xfun") +xfun::base64_uri(f) + +xfun::grep_sub('a([b]+)c', 'a\\U\\1c', c('abc', 'abbbc', 'addc', '123'), perl = TRUE) + +library(xfun) +f = tempfile() +writeLines(c("hello", "world"), f) +gsub_file(f, "world", "woRld", fixed = TRUE) +file_string(f) + +process_file(f, function(x) { + rep(x, 3) # repeat the content 3 times +}) +file_string(f) + +library(xfun) +p = c("abc.doc", "def123.tex", "path/to/foo.Rmd") +file_ext(p) +sans_ext(p) +with_ext(p, ".txt") +with_ext(p, c(".ppt", ".sty", ".Rnw")) +with_ext(p, "html") + +xfun::is_macos() +xfun::is_unix() +xfun::is_linux() +xfun::is_windows() + +library(testit) +library(parallel) +library(tinytex) +library(mime) + +xfun::pkg_attach(c('testit', 'parallel', 'tinytex', 'mime')) + +if (!requireNamespace('tinytex')) install.packages('tinytex') +library(tinytex) + +xfun::pkg_attach2('tinytex') + +n2w(0, cap = TRUE) +n2w(seq(0, 121, 11), and = TRUE) +n2w(1e+06) +n2w(1e+11 + 12345678) +n2w(-987654321) +n2w(1e+15 - 1) + +res = xfun::cache_rds({ + # pretend the computing here is a time-consuming + Sys.sleep(2) + 1:10 +}) + +xfun::session_info(c('xfun', 'litedown', 'tinytex'), dependencies = FALSE) + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/doc/xfun.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/doc/xfun.Rmd new file mode 100644 index 00000000..d51a76ab --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/doc/xfun.Rmd @@ -0,0 +1,291 @@ +--- +title: An Introduction to xfun +subtitle: A Collection of Miscellaneous Functions +author: "Yihui Xie" +date: "`{r} Sys.Date()`" +slug: xfun +githubEditURL: https://github.com/yihui/xfun/edit/main/vignettes/xfun.Rmd +output: + litedown::html_format: + meta: + css: ["@default", "@article"] + js: ["@sidenotes"] + options: + toc: true + number_sections: true +--- + + + +```{r setup, include=FALSE} +library(xfun) +``` + +After writing about 20 R packages, I found I had accumulated several utility functions that I used across different packages, so I decided to extract them into a separate package. Previously I had been using the evil triple-colon `:::` to access these internal utility functions. Now with **xfun**, these functions have been exported, and more importantly, documented. It should be better to use them under the sun instead of in the dark. + +This page shows examples of a subset of functions in this package. For a full list of functions, see the help page `help(package = 'xfun')`. The source package is available on GitHub: https://github.com/yihui/xfun. + +## No more partial matching for lists! + +I have been bitten many times by partial matching in lists, e.g., when I want `x$a` but the element `a` does not exist in the list `x`, it returns the value `x$abc` if `abc` exists in `x`. A strict list is a list for which the partial matching of the `$` operator is disabled. The functions `xfun::strict_list()` and `xfun::as_strict_list()` are the equivalents to `base::list()` and `base::as.list()` respectively which always return as strict list, e.g., + +```{r} +library(xfun) +(z = strict_list(aaa = "I am aaa", b = 1:5)) +z$a # NULL (strict matching) +z$aaa # I am aaa +z$b +z$c = "you can create a new element" + +z2 = unclass(z) # a normal list +z2$a # partial matching + +z3 = as_strict_list(z2) # a strict list again +z3$a # NULL (strict matching) again! +``` + +Similarly, the default partial matching in `attr()` can be annoying, too. The function `xfun::attr()` is simply a shorthand of `attr(..., exact = TRUE)`. + +I want it, or I do not want. There is no "I probably want". + +## Output character vectors for human eyes + +When R prints a character vector, your eyes may be distracted by the indices like `[1]`, double quotes, and escape sequences. To see a character vector in its "raw" form, you can use `cat(..., sep = '\n')`. The function `raw_string()` marks a character vector as "raw", and the corresponding printing function will call `cat(sep = '\n')` to print the character vector to the console. + +```{r comment=''} +library(xfun) +raw_string(head(LETTERS)) +(x = c("a \"b\"", "hello\tworld!")) +raw_string(x) # this is more likely to be what you want to see +``` + +## Print the content of a text file + +I have used `paste(readLines('foo'), collapse = '\n')` many times before I decided to write a simple wrapper function `xfun::file_string()`. This function also makes use of `raw_string()`, so you can see the content of a file in the console as a side-effect, e.g., + +```{r comment=''} +f = system.file("LICENSE", package = "xfun") +xfun::file_string(f) +as.character(xfun::file_string(f)) # essentially a character string +``` + +## Get the data URI of a file + +Files can be encoded into base64 strings via `base64_uri()`. This is a common technique to embed arbitrary files in HTML documents (which is [what `xfun::embed_file()` does](https://bookdown.org/yihui/rmarkdown-cookbook/embed-file.html) and it is based on `base64_uri()`). + +```{r} +f = system.file("LICENSE", package = "xfun") +xfun::base64_uri(f) +``` + +## Match strings and do substitutions + +After typing the code `x = grep(pattern, x, value = TRUE); gsub(pattern, '\\1', x)` many times, I combined them into a single function `xfun::grep_sub()`. + +```{r} +xfun::grep_sub('a([b]+)c', 'a\\U\\1c', c('abc', 'abbbc', 'addc', '123'), perl = TRUE) +``` + +## Search and replace strings in files + +I can never remember how to properly use `grep` or `sed` to search and replace strings in multiple files. My favorite IDE, RStudio, has not provided this feature yet (you can only search and replace in the currently opened file). Therefore I did a quick and dirty implementation in R, including functions `gsub_files()`, `gsub_dir()`, and `gsub_ext()`, to search and replace strings in multiple files under a directory. Note that the files are assumed to be encoded in UTF-8. If you do not use UTF-8, we cannot be friends. Seriously. + +All functions are based on `gsub_file()`, which performs searching and replacing in a single file, e.g., + +```{r comment=''} +library(xfun) +f = tempfile() +writeLines(c("hello", "world"), f) +gsub_file(f, "world", "woRld", fixed = TRUE) +file_string(f) +``` + +The function `gsub_dir()` is very flexible: you can limit the list of files by MIME types, or extensions. For example, if you want to do substitution in text files, you may use `gsub_dir(..., mimetype = '^text/')`. + +The function `process_file()` is a more general way to process files. Basically it reads a file, process the content with a function that you pass to it, and writes back the text, e.g., + +```{r, comment=''} +process_file(f, function(x) { + rep(x, 3) # repeat the content 3 times +}) +file_string(f) +``` + +**WARNING**: Before using these functions, make sure that you have backed up your files, or version control your files. The files will be modified in-place. If you do not back up or use version control, there is no chance to regret. + +## Manipulate filename extensions + +Functions `file_ext()` and `sans_ext()` are based on functions in **tools**. The function `with_ext()` adds or replaces extensions of filenames, and it is vectorized. + +```{r} +library(xfun) +p = c("abc.doc", "def123.tex", "path/to/foo.Rmd") +file_ext(p) +sans_ext(p) +with_ext(p, ".txt") +with_ext(p, c(".ppt", ".sty", ".Rnw")) +with_ext(p, "html") +``` + +## Find files (in a project) without the pain of thinking about absolute/relative paths + +The function `proj_root()` was inspired by the **rprojroot** package, and tries to find the root directory of a project. Currently it only supports R package projects and RStudio projects by default. It is much less sophisticated than **rprojroot**. + +The function `from_root()` was inspired by `here::here()`, but returns a relative path (relative to the project's root directory found by `proj_root()`) instead of an absolute path. For example, `xfun::from_root('data', 'cars.csv')` in a code chunk of `docs/foo.Rmd` will return `../data/cars.csv` when `docs/` and `data/` directories are under the root directory of a project. + +``` +root/ + |-- data/ + | |-- cars.csv + | + |-- docs/ + |-- foo.Rmd +``` + +If file paths are too much pain for you to think about, you can just pass an incomplete path to the function `magic_path()`, and it will try to find the actual path recursively under subdirectories of a root directory. For example, you may only provide a base filename, and `magic_path()` will look for this file under subdirectories and return the actual path if it is found. By default, it returns a relative path, which is relative to the current working directory. With the above example, `xfun::magic_path('cars.csv')` in a code chunk of `docs/foo.Rmd` will return `../data/cars.csv`, if `cars.csv` is a unique filename in the project. You can freely move it to any folders of this project, and `magic_path()` will still find it. If you are not using a project to manage files, `magic_path()` will look for the file under subdirectories of the current working directory. + +## Types of operating systems + +The series of functions `is_linux()`, `is_macos()`, `is_unix()`, and `is_windows()` test the types of the OS, using the information from `.Platform` and `Sys.info()`, e.g., + +```{r} +xfun::is_macos() +xfun::is_unix() +xfun::is_linux() +xfun::is_windows() +``` + +## Loading and attaching packages + +Oftentimes I see users attach a series of packages in the beginning of their scripts by repeating `library()` multiple times. This could be easily vectorized, and the function `xfun::pkg_attach()` does this job. For example, + +```{r eval=FALSE} +library(testit) +library(parallel) +library(tinytex) +library(mime) +``` + +is equivalent to + +```{r eval=FALSE} +xfun::pkg_attach(c('testit', 'parallel', 'tinytex', 'mime')) +``` + +I also see scripts that contain code to install a package if it is not available, e.g., + +```{r eval=FALSE} +if (!requireNamespace('tinytex')) install.packages('tinytex') +library(tinytex) +``` + +This could be done via + +```{r eval=FALSE} +xfun::pkg_attach2('tinytex') +``` + +The function `pkg_attach2()` is a shorthand of `pkg_attach(..., install = TRUE)`, which means if a package is not available, install it. This function can also deal with multiple packages. + +The function `loadable()` tests if a package is loadable. + +## Read/write files in UTF-8 + +Functions `read_utf8()` and `write_utf8()` can be used to read/write files in UTF-8. They are simple wrappers of `readLines()` and `writeLines()`. + +## Convert numbers to English words + +The function `numbers_to_words()` (or `n2w()` for short) converts numbers to English words. + +```{r} +n2w(0, cap = TRUE) +n2w(seq(0, 121, 11), and = TRUE) +n2w(1e+06) +n2w(1e+11 + 12345678) +n2w(-987654321) +n2w(1e+15 - 1) +``` + +## Cache an R expression to an RDS file + +The function `cache_rds()` provides a simple caching mechanism: the first time an expression is passed to it, it saves the result to an RDS file; the next time it will read the RDS file and return the value instead of evaluating the expression again. If you want to invalidate the cache, you can use the argument `rerun = TRUE`. + +```{r, eval=FALSE} +res = xfun::cache_rds({ + # pretend the computing here is a time-consuming + Sys.sleep(2) + 1:10 +}) +``` + +When the function is used in a code chunk in a **knitr** document, the RDS cache file is saved to a path determined by the chunk label (the base filename) and the chunk option `cache.path` (the cache directory), so you do not have to provide the `file` and `dir` arguments of `cache_rds()`. + +This caching mechanism is much simpler than **knitr**'s caching. Cache invalidation is often tricky (see [this post](https://yihui.org/en/2018/06/cache-invalidation/)), so this function may be helpful if you want more transparency and control over when to invalidate the cache (for `cache_rds()`, the cache is invalidated when the cache file is deleted, which can be achieved via the argument `rerun = TRUE`). + +As documented on the help page of `cache_rds()`, there are two common cases in which you may want to invalidate the cache: + +1. The code in the expression has changed, e.g., if you changed the code from `cache_rds({x + 1})` to `cache_rds({x + 2})`, the cache will be automatically invalidated and the expression will be re-evaluated. However, please note that changes in white spaces or comments do not matter. Or generally speaking, as long as the change does not affect the parsed expression, the cache will not be invalidated, e.g., the two expressions below are essentially identical (hence if you have executed `cache_rds()` on the first expression, the second expression will be able to take advantage of the cache): + + ```r + res = xfun::cache_rds({ + Sys.sleep(3 ); + x=1:10; # semi-colons won't matter + x+1; + }) + + res = xfun::cache_rds({ + Sys.sleep(3) + x = 1:10 # a comment + x + + 1 # feel free to make any changes in white spaces + }) + ``` + +1. The value of a global variable in the expression has changed, e.g., if `y` has changed, you are most likely to want to invalidate the cache and rerun the expression below: + + ```r + res = xfun::cache_rds({ + x = 1:10 + x + y + }) + ``` + + This is because `x` is a local variable in the expression, and `y` is an external global variable (not created locally like `x`). To invalidate the cache when `y` has changed, you may let `cache_rds()` know through the `hash` argument that `y` needs to be considered when deciding if the cache should be invalidated: + + ```r + res = xfun::cache_rds({ + x = 1:10 + x + y + }, hash = list(y)) + ``` + + If you do not want to provide this list of value(s) to the `hash` argument, you may try `hash = "auto"` instead, which asks `cache_rds()` to try to figure out all global variables automatically and use a list of their values as the value for the `hash` argument. + + ```r + res = xfun::cache_rds({ + x = 1:10 + x + y + }, hash = "auto") + ``` + +## Check reverse dependencies of a package + +Running `R CMD check` on the reverse dependencies of **knitr** and **rmarkdown** is my least favorite thing in developing R packages, because the numbers of their reverse dependencies are huge. The function `rev_check()` reflects some of my past experience in this process. I think I have automated it as much as possible, and made it as easy as possible to discover possible new problems introduced by the current version of the package (compared to the CRAN version). Finally I can just sit back and let it run. + +## Input a character vector into the RStudio source editor + +The function `rstudio_type()` inputs characters in the RStudio source editor as if they were typed by a human. I came up with the idea when preparing my talk for rstudio::conf 2018 ([see this post](https://yihui.org/en/2018/03/blogdown-video-rstudio-conf/) for more details). + +## Print session information + +Since I have never been fully satisfied by the output of `sessionInfo()`, I tweaked it to make it more useful in my use cases. For example, it is rarely useful to print out the names of base R packages, or information about the matrix products / BLAS / LAPACK. Oftentimes I want additional information in the session information, such as the Pandoc version when **rmarkdown** is used. The function `session_info()` tweaks the output of `sessionInfo()`, and makes it possible for other packages to append information in the output of `session_info()`. + +You can choose to print out the versions of only the packages you specify, e.g., + +```{r} +xfun::session_info(c('xfun', 'litedown', 'tinytex'), dependencies = FALSE) +``` + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/doc/xfun.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/doc/xfun.html new file mode 100644 index 00000000..d88817ea --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/doc/xfun.html @@ -0,0 +1,335 @@ + + + + + + +An Introduction to xfun + + + + + +
+

An Introduction to xfun

+

A Collection of Miscellaneous Functions

+

Yihui Xie

+

2025-01-07

+
+
+ + +

After writing about 20 R packages, I found I had accumulated several utility functions that I used across different packages, so I decided to extract them into a separate package. Previously I had been using the evil triple-colon ::: to access these internal utility functions. Now with xfun, these functions have been exported, and more importantly, documented. It should be better to use them under the sun instead of in the dark.

+

This page shows examples of a subset of functions in this package. For a full list of functions, see the help page help(package = 'xfun'). The source package is available on GitHub: https://github.com/yihui/xfun.

+

1 No more partial matching for lists!

+

I have been bitten many times by partial matching in lists, e.g., when I want x$a but the element a does not exist in the list x, it returns the value x$abc if abc exists in x. A strict list is a list for which the partial matching of the $ operator is disabled. The functions xfun::strict_list() and xfun::as_strict_list() are the equivalents to base::list() and base::as.list() respectively which always return as strict list, e.g.,

+
library(xfun)
+(z = strict_list(aaa = "I am aaa", b = 1:5))
+
+
#> $aaa
+#> [1] "I am aaa"
+#> 
+#> $b
+#> [1] 1 2 3 4 5
+#> 
+
+
z$a  # NULL (strict matching)
+
+
#> NULL
+
+
z$aaa  # I am aaa
+
+
#> [1] "I am aaa"
+
+
z$b
+
+
#> [1] 1 2 3 4 5
+
+
z$c = "you can create a new element"
+
+z2 = unclass(z)  # a normal list
+z2$a  # partial matching
+
+
#> [1] "I am aaa"
+
+
z3 = as_strict_list(z2)  # a strict list again
+z3$a  # NULL (strict matching) again!
+
+
#> NULL
+
+

Similarly, the default partial matching in attr() can be annoying, too. The function xfun::attr() is simply a shorthand of attr(..., exact = TRUE).

+

I want it, or I do not want. There is no “I probably want”.

+

2 Output character vectors for human eyes

+

When R prints a character vector, your eyes may be distracted by the indices like [1], double quotes, and escape sequences. To see a character vector in its “raw” form, you can use cat(..., sep = '\n'). The function raw_string() marks a character vector as “raw”, and the corresponding printing function will call cat(sep = '\n') to print the character vector to the console.

+
library(xfun)
+raw_string(head(LETTERS))
+
+
A
+B
+C
+D
+E
+F
+
+
(x = c("a \"b\"", "hello\tworld!"))
+
+
[1] "a \"b\""       "hello\tworld!"
+
+
raw_string(x)  # this is more likely to be what you want to see
+
+
a "b"
+hello	world!
+
+

3 Print the content of a text file

+

I have used paste(readLines('foo'), collapse = '\n') many times before I decided to write a simple wrapper function xfun::file_string(). This function also makes use of raw_string(), so you can see the content of a file in the console as a side-effect, e.g.,

+
f = system.file("LICENSE", package = "xfun")
+xfun::file_string(f)
+
+
YEAR: 2018-2024
+COPYRIGHT HOLDER: Yihui Xie
+
+
as.character(xfun::file_string(f))  # essentially a character string
+
+
[1] "YEAR: 2018-2024\nCOPYRIGHT HOLDER: Yihui Xie"
+
+

4 Get the data URI of a file

+

Files can be encoded into base64 strings via base64_uri(). This is a common technique to embed arbitrary files in HTML documents (which is what xfun::embed_file() does and it is based on base64_uri()).

+
f = system.file("LICENSE", package = "xfun")
+xfun::base64_uri(f)
+
+
#> [1] "data:text/plain;base64,WUVBUjogMjAxOC0yMDI0CkNPUFlSSUdIVCBIT0xERVI6IFlpaHVpIFhpZQo="
+
+

5 Match strings and do substitutions

+

After typing the code x = grep(pattern, x, value = TRUE); gsub(pattern, '\\1', x) many times, I combined them into a single function xfun::grep_sub().

+
xfun::grep_sub('a([b]+)c', 'a\\U\\1c', c('abc', 'abbbc', 'addc', '123'), perl = TRUE)
+
+
#> [1] "aBc"   "aBBBc"
+
+

6 Search and replace strings in files

+

I can never remember how to properly use grep or sed to search and replace strings in multiple files. My favorite IDE, RStudio, has not provided this feature yet (you can only search and replace in the currently opened file). Therefore I did a quick and dirty implementation in R, including functions gsub_files(), gsub_dir(), and gsub_ext(), to search and replace strings in multiple files under a directory. Note that the files are assumed to be encoded in UTF-8. If you do not use UTF-8, we cannot be friends. Seriously.

+

All functions are based on gsub_file(), which performs searching and replacing in a single file, e.g.,

+
library(xfun)
+f = tempfile()
+writeLines(c("hello", "world"), f)
+gsub_file(f, "world", "woRld", fixed = TRUE)
+file_string(f)
+
+
hello
+woRld
+
+

The function gsub_dir() is very flexible: you can limit the list of files by MIME types, or extensions. For example, if you want to do substitution in text files, you may use gsub_dir(..., mimetype = '^text/').

+

The function process_file() is a more general way to process files. Basically it reads a file, process the content with a function that you pass to it, and writes back the text, e.g.,

+
process_file(f, function(x) {
+  rep(x, 3)  # repeat the content 3 times
+})
+file_string(f)
+
+
hello
+woRld
+hello
+woRld
+hello
+woRld
+
+

WARNING: Before using these functions, make sure that you have backed up your files, or version control your files. The files will be modified in-place. If you do not back up or use version control, there is no chance to regret.

+

7 Manipulate filename extensions

+

Functions file_ext() and sans_ext() are based on functions in tools. The function with_ext() adds or replaces extensions of filenames, and it is vectorized.

+
library(xfun)
+p = c("abc.doc", "def123.tex", "path/to/foo.Rmd")
+file_ext(p)
+
+
#> [1] "doc" "tex" "Rmd"
+
+
sans_ext(p)
+
+
#> [1] "abc"         "def123"      "path/to/foo"
+
+
with_ext(p, ".txt")
+
+
#> [1] "abc.txt"         "def123.txt"      "path/to/foo.txt"
+
+
with_ext(p, c(".ppt", ".sty", ".Rnw"))
+
+
#> [1] "abc.ppt"         "def123.sty"      "path/to/foo.Rnw"
+
+
with_ext(p, "html")
+
+
#> [1] "abc.html"         "def123.html"      "path/to/foo.html"
+
+

8 Find files (in a project) without the pain of thinking about absolute/relative paths

+

The function proj_root() was inspired by the rprojroot package, and tries to find the root directory of a project. Currently it only supports R package projects and RStudio projects by default. It is much less sophisticated than rprojroot.

+

The function from_root() was inspired by here::here(), but returns a relative path (relative to the project’s root directory found by proj_root()) instead of an absolute path. For example, xfun::from_root('data', 'cars.csv') in a code chunk of docs/foo.Rmd will return ../data/cars.csv when docs/ and data/ directories are under the root directory of a project.

+
root/
+  |-- data/
+  |   |-- cars.csv
+  |
+  |-- docs/
+      |-- foo.Rmd
+
+

If file paths are too much pain for you to think about, you can just pass an incomplete path to the function magic_path(), and it will try to find the actual path recursively under subdirectories of a root directory. For example, you may only provide a base filename, and magic_path() will look for this file under subdirectories and return the actual path if it is found. By default, it returns a relative path, which is relative to the current working directory. With the above example, xfun::magic_path('cars.csv') in a code chunk of docs/foo.Rmd will return ../data/cars.csv, if cars.csv is a unique filename in the project. You can freely move it to any folders of this project, and magic_path() will still find it. If you are not using a project to manage files, magic_path() will look for the file under subdirectories of the current working directory.

+

9 Types of operating systems

+

The series of functions is_linux(), is_macos(), is_unix(), and is_windows() test the types of the OS, using the information from .Platform and Sys.info(), e.g.,

+
xfun::is_macos()
+
+
#> [1] TRUE
+
+
xfun::is_unix()
+
+
#> [1] TRUE
+
+
xfun::is_linux()
+
+
#> [1] FALSE
+
+
xfun::is_windows()
+
+
#> [1] FALSE
+
+

10 Loading and attaching packages

+

Oftentimes I see users attach a series of packages in the beginning of their scripts by repeating library() multiple times. This could be easily vectorized, and the function xfun::pkg_attach() does this job. For example,

+
library(testit)
+library(parallel)
+library(tinytex)
+library(mime)
+
+

is equivalent to

+
xfun::pkg_attach(c('testit', 'parallel', 'tinytex', 'mime'))
+
+

I also see scripts that contain code to install a package if it is not available, e.g.,

+
if (!requireNamespace('tinytex')) install.packages('tinytex')
+library(tinytex)
+
+

This could be done via

+
xfun::pkg_attach2('tinytex')
+
+

The function pkg_attach2() is a shorthand of pkg_attach(..., install = TRUE), which means if a package is not available, install it. This function can also deal with multiple packages.

+

The function loadable() tests if a package is loadable.

+

11 Read/write files in UTF-8

+

Functions read_utf8() and write_utf8() can be used to read/write files in UTF-8. They are simple wrappers of readLines() and writeLines().

+

12 Convert numbers to English words

+

The function numbers_to_words() (or n2w() for short) converts numbers to English words.

+
n2w(0, cap = TRUE)
+
+
#> [1] "Zero"
+
+
n2w(seq(0, 121, 11), and = TRUE)
+
+
#>  [1] "zero"                       "eleven"                    
+#>  [3] "twenty-two"                 "thirty-three"              
+#>  [5] "forty-four"                 "fifty-five"                
+#>  [7] "sixty-six"                  "seventy-seven"             
+#>  [9] "eighty-eight"               "ninety-nine"               
+#> [11] "one hundred and ten"        "one hundred and twenty-one"
+
+
n2w(1e+06)
+
+
#> [1] "one million"
+
+
n2w(1e+11 + 12345678)
+
+
#> [1] "one hundred billion, twelve million, three hundred forty-five thousand, six hundred seventy-eight"
+
+
n2w(-987654321)
+
+
#> [1] "minus nine hundred eighty-seven million, six hundred fifty-four thousand, three hundred twenty-one"
+
+
n2w(1e+15 - 1)
+
+
#> [1] "nine hundred ninety-nine trillion, nine hundred ninety-nine billion, nine hundred ninety-nine million, nine hundred ninety-nine thousand, nine hundred ninety-nine"
+
+

13 Cache an R expression to an RDS file

+

The function cache_rds() provides a simple caching mechanism: the first time an expression is passed to it, it saves the result to an RDS file; the next time it will read the RDS file and return the value instead of evaluating the expression again. If you want to invalidate the cache, you can use the argument rerun = TRUE.

+
res = xfun::cache_rds({
+  # pretend the computing here is a time-consuming
+  Sys.sleep(2)
+  1:10
+})
+
+

When the function is used in a code chunk in a knitr document, the RDS cache file is saved to a path determined by the chunk label (the base filename) and the chunk option cache.path (the cache directory), so you do not have to provide the file and dir arguments of cache_rds().

+

This caching mechanism is much simpler than knitr’s caching. Cache invalidation is often tricky (see this post), so this function may be helpful if you want more transparency and control over when to invalidate the cache (for cache_rds(), the cache is invalidated when the cache file is deleted, which can be achieved via the argument rerun = TRUE).

+

As documented on the help page of cache_rds(), there are two common cases in which you may want to invalidate the cache:

+
    +
  1. +

    The code in the expression has changed, e.g., if you changed the code from cache_rds({x + 1}) to cache_rds({x + 2}), the cache will be automatically invalidated and the expression will be re-evaluated. However, please note that changes in white spaces or comments do not matter. Or generally speaking, as long as the change does not affect the parsed expression, the cache will not be invalidated, e.g., the two expressions below are essentially identical (hence if you have executed cache_rds() on the first expression, the second expression will be able to take advantage of the cache):

    +
    res = xfun::cache_rds({
    +  Sys.sleep(3  );
    +  x=1:10;  # semi-colons won't matter
    +  x+1;
    +})
    +
    +res = xfun::cache_rds({
    +  Sys.sleep(3)
    +  x = 1:10  # a comment
    +  x +
    +    1  # feel free to make any changes in white spaces
    +})
    +
    +
  2. +
  3. +

    The value of a global variable in the expression has changed, e.g., if y has changed, you are most likely to want to invalidate the cache and rerun the expression below:

    +
    res = xfun::cache_rds({
    +  x = 1:10
    +  x + y
    +})
    +
    +

    This is because x is a local variable in the expression, and y is an external global variable (not created locally like x). To invalidate the cache when y has changed, you may let cache_rds() know through the hash argument that y needs to be considered when deciding if the cache should be invalidated:

    +
    res = xfun::cache_rds({
    +  x = 1:10
    +  x + y
    +}, hash = list(y))
    +
    +

    If you do not want to provide this list of value(s) to the hash argument, you may try hash = "auto" instead, which asks cache_rds() to try to figure out all global variables automatically and use a list of their values as the value for the hash argument.

    +
    res = xfun::cache_rds({
    +  x = 1:10
    +  x + y
    +}, hash = "auto")
    +
    +
  4. +
+

14 Check reverse dependencies of a package

+

Running R CMD check on the reverse dependencies of knitr and rmarkdown is my least favorite thing in developing R packages, because the numbers of their reverse dependencies are huge. The function rev_check() reflects some of my past experience in this process. I think I have automated it as much as possible, and made it as easy as possible to discover possible new problems introduced by the current version of the package (compared to the CRAN version). Finally I can just sit back and let it run.

+

15 Input a character vector into the RStudio source editor

+

The function rstudio_type() inputs characters in the RStudio source editor as if they were typed by a human. I came up with the idea when preparing my talk for rstudio::conf 2018 (see this post for more details).

+

16 Print session information

+

Since I have never been fully satisfied by the output of sessionInfo(), I tweaked it to make it more useful in my use cases. For example, it is rarely useful to print out the names of base R packages, or information about the matrix products / BLAS / LAPACK. Oftentimes I want additional information in the session information, such as the Pandoc version when rmarkdown is used. The function session_info() tweaks the output of sessionInfo(), and makes it possible for other packages to append information in the output of session_info().

+

You can choose to print out the versions of only the packages you specify, e.g.,

+
xfun::session_info(c('xfun', 'litedown', 'tinytex'), dependencies = FALSE)
+
+
#> R Under development (unstable) (2025-01-03 r87521)
+#> Platform: aarch64-apple-darwin20
+#> Running under: macOS Sonoma 14.7.2
+#> 
+#> Locale: en_US.UTF-8 / en_US.UTF-8 / en_US.UTF-8 / C / en_US.UTF-8 / en_US.UTF-8
+#> 
+#> Package version:
+#>   litedown_0.4 tinytex_0.54 xfun_0.50   
+#> 
+
+
+ + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/help/AnIndex new file mode 100644 index 00000000..84a5ae69 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/help/AnIndex @@ -0,0 +1,160 @@ +$.xfun_strict_list strict_list +alnum_id alnum_id +append_unique read_utf8 +append_utf8 read_utf8 +as_strict_list strict_list +attr attr +base64_decode base64_encode +base64_encode base64_encode +base64_uri base64_uri +base_pkgs base_pkgs +bg_process bg_process +broken_packages broken_packages +bump_version bump_version +cache_exec cache_exec +cache_rds cache_rds +check_old_package is_R_CMD_check +check_package_name is_R_CMD_check +compare_Rcheck rev_check +crandalf_check crandalf_check +crandalf_results crandalf_check +csv_options csv_options +decimal_dot decimal_dot +del_empty_dir del_empty_dir +dir_create dir_create +dir_exists dir_exists +divide_chunk divide_chunk +download_cache download_cache +download_file download_file +do_once do_once +embed_dir embed_file +embed_file embed_file +embed_files embed_file +env_option env_option +existing_files existing_files +exit_call exit_call +fenced_block fenced_block +fenced_div fenced_block +file_exists dir_exists +file_ext file_ext +file_rename file_rename +file_string file_string +find_globals find_globals +find_locals find_globals +format.xfun_record_results record +format_bytes format_bytes +from_root from_root +github_api rest_api +github_releases github_releases +grep_sub grep_sub +gsub_dir gsub_file +gsub_ext gsub_file +gsub_file gsub_file +gsub_files gsub_file +html_escape html_tag +html_tag html_tag +html_value html_tag +html_view html_tag +install_dir install_dir +install_github install_github +in_dir in_dir +is_abs_path is_abs_path +is_arm64 os +is_ascii is_ascii +is_blank is_blank +is_CRAN_incoming is_R_CMD_check +is_linux os +is_macos os +is_rel_path is_abs_path +is_R_CMD_check is_R_CMD_check +is_sub_path is_sub_path +is_unix os +is_web_path is_web_path +is_windows os +join_words join_words +json_vector tojson +lazy_load lazy_save +lazy_save lazy_save +loadable pkg_attach +magic_path magic_path +make_fence fenced_block +mark_dirs mark_dirs +md5 md5 +md_table md_table +mime_type mime_type +msg_cat msg_cat +n2w numbers_to_words +native_encode native_encode +news2md news2md +new_app new_app +new_record record_print +normalize_path normalize_path +numbers_to_words numbers_to_words +optipng optipng +parse_only parse_only +pkg_attach pkg_attach +pkg_attach2 pkg_attach +pkg_available pkg_attach +pkg_bib pkg_bib +pkg_load pkg_attach +pkg_load2 pkg_attach +print.xfun_raw_string raw_string +print.xfun_record_results record +print.xfun_strict_list strict_list +process_file process_file +proc_kill proc_kill +proj_root proj_root +prose_index prose_index +protect_math protect_math +raw_string raw_string +Rcmd Rscript +read_all read_all +read_bin read_bin +read_utf8 read_utf8 +record record +record_print record_print +record_print.default record_print +record_print.record_asis record_print +relative_path relative_path +rename_seq rename_seq +rest_api rest_api +rest_api_raw rest_api +retry retry +rev_check rev_check +root_rules proj_root +Rscript Rscript +Rscript_call Rscript_call +rstudio_type rstudio_type +same_path same_path +sans_ext file_ext +session_info session_info +set_envvar set_envvar +shrink_images shrink_images +sort_file process_file +split_lines split_lines +split_source split_source +strict_list strict_list +strip_html strip_html +str_wrap str_wrap +submit_cran submit_cran +system3 system3 +tabset tabset +taml_file taml_load +taml_load taml_load +taml_save taml_load +tinify tinify +tinify_dir tinify +tojson tojson +tree tree +try_error try_error +try_silent try_silent +upload_ftp upload_ftp +upload_imgur upload_imgur +upload_win_builder upload_ftp +url_accessible url_accessible +url_filename url_filename +valid_syntax valid_syntax +with_ext file_ext +write_utf8 read_utf8 +yaml_body yaml_body +yaml_load yaml_load diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/help/aliases.rds new file mode 100644 index 00000000..1eb22724 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/help/paths.rds new file mode 100644 index 00000000..0584b6c2 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/help/xfun.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/help/xfun.rdb new file mode 100644 index 00000000..d45016e6 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/help/xfun.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/help/xfun.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/help/xfun.rdx new file mode 100644 index 00000000..dcf657be Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/help/xfun.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/html/00Index.html new file mode 100644 index 00000000..39b41f9f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/html/00Index.html @@ -0,0 +1,478 @@ + + +R: Supporting Functions for Packages Maintained by 'Yihui Xie' + + + +
+

Supporting Functions for Packages Maintained by 'Yihui Xie' + +

+
+
+[Up] +[Top] +

Documentation for package ‘xfun’ version 0.50

+ + + +

Help Pages

+ + +

+A +B +C +D +E +F +G +H +I +J +L +M +N +O +P +R +S +T +U +V +W +Y +misc +

+ + +

-- A --

+ + + + + + + + + + + + +
alnum_idGenerate ID strings
append_uniqueRead / write files encoded in UTF-8
append_utf8Read / write files encoded in UTF-8
as_strict_listStrict lists
attrObtain an attribute of an object without partial matching
+ +

-- B --

+ + + + + + + + + + + + + + + + +
base64_decodeEncode/decode data into/from base64 encoding.
base64_encodeEncode/decode data into/from base64 encoding.
base64_uriGenerate the Data URI for a file
base_pkgsGet base R package names
bg_processStart a background process
broken_packagesFind out broken packages and reinstall them
bump_versionBump version numbers
+ +

-- C --

+ + + + + + + + + + + + + + +
cache_execCache the execution of an expression in memory or on disk
cache_rdsCache the value of an R expression to an RDS file
compare_RcheckRun 'R CMD check' on the reverse dependencies of a package
crandalf_checkSubmit check jobs to crandalf
crandalf_resultsSubmit check jobs to crandalf
csv_optionsParse comma-separated chunk options
+ +

-- D --

+ + + + + + + + + + + + + + + + + + +
decimal_dotEvaluate an expression after forcing the decimal point to be a dot
del_empty_dirDelete an empty directory
dir_createCreate a directory recursively by default
dir_existsTest the existence of files and directories
divide_chunkDivide chunk options from the code chunk body
download_cacheDownload a file from a URL and cache it on disk
download_fileTry various methods to download a file
do_oncePerform a task once in an R session
+ +

-- E --

+ + + + + + + + + + + + + + +
embed_dirEmbed a file, multiple files, or directory on an HTML page
embed_fileEmbed a file, multiple files, or directory on an HTML page
embed_filesEmbed a file, multiple files, or directory on an HTML page
env_optionRetrieve a global option from both 'options()' and environment variables
existing_filesFind file paths that exist
exit_callCall 'on.exit()' in a parent function
+ +

-- F --

+ + + + + + + + + + + + + + + + + + + + + + + + +
fenced_blockCreate a fenced block in Markdown
fenced_divCreate a fenced block in Markdown
file_existsTest the existence of files and directories
file_extManipulate filename extensions
file_renameRename files and directories
file_stringRead a text file and concatenate the lines by "\n"
find_globalsFind global/local variables in R code
find_localsFind global/local variables in R code
format.xfun_record_resultsRun R code and record the results
format_bytesFormat numbers of bytes using a specified unit
from_rootGet the relative path of a path in a project relative to the current working directory
+ +

-- G --

+ + + + + + + + + + + + + + + + +
github_apiGet data from a REST API
github_releasesGet the tags of GitHub releases of a repository
grep_subPerform replacement with 'gsub()' on elements matched from 'grep()'
gsub_dirSearch and replace strings in files
gsub_extSearch and replace strings in files
gsub_fileSearch and replace strings in files
gsub_filesSearch and replace strings in files
+ +

-- H --

+ + + + + + + + + + +
html_escapeTools for HTML tags
html_tagTools for HTML tags
html_valueTools for HTML tags
html_viewTools for HTML tags
+ +

-- I --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
install_dirInstall a source package from a directory
install_githubAn alias of 'remotes::install_github()'
in_dirEvaluate an expression under a specified working directory
is_abs_pathTest if paths are relative or absolute
is_arm64Test for types of operating systems
is_asciiCheck if a character vector consists of entirely ASCII characters
is_blankTest if a character vector consists of blank strings
is_linuxTest for types of operating systems
is_macosTest for types of operating systems
is_rel_pathTest if paths are relative or absolute
is_sub_pathTest if a path is a subpath of a dir
is_unixTest for types of operating systems
is_web_pathTest if a path is a web path
is_windowsTest for types of operating systems
+ +

-- J --

+ + + + + + +
join_wordsJoin multiple words into a single string
json_vectorA simple JSON serializer
+ +

-- L --

+ + + + + + + + +
lazy_loadSave objects to files and lazy-load them
lazy_saveSave objects to files and lazy-load them
loadableAttach or load packages, and automatically install missing packages if requested
+ +

-- M --

+ + + + + + + + + + + + + + + + +
magic_pathFind a file or directory under a root directory
make_fenceCreate a fenced block in Markdown
mark_dirsMark some paths as directories
md5Calculate the MD5 checksums of R objects
md_tableGenerate a simple Markdown pipe table
mime_typeGet the MIME types of files
msg_catGenerate a message with 'cat()'
+ +

-- N --

+ + + + + + + + + + + + + + + + +
n2wConvert numbers to English words
native_encodeTry to use the system native encoding to represent a character vector
news2mdConvert package news to the Markdown format
new_appCreate a local web application
new_recordPrint methods for 'record()'
normalize_pathNormalize paths
numbers_to_wordsConvert numbers to English words
+ +

-- O --

+ + + + +
optipngRun OptiPNG on all PNG files under a directory
+ +

-- P --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
parse_onlyParse R code and do not keep the source
pkg_attachAttach or load packages, and automatically install missing packages if requested
pkg_attach2Attach or load packages, and automatically install missing packages if requested
pkg_availableAttach or load packages, and automatically install missing packages if requested
pkg_bibGenerate BibTeX bibliography databases for R packages
pkg_loadAttach or load packages, and automatically install missing packages if requested
pkg_load2Attach or load packages, and automatically install missing packages if requested
print.xfun_raw_stringPrint a character vector in its raw form
print.xfun_record_resultsRun R code and record the results
print.xfun_strict_listStrict lists
process_fileRead a text file, process the text with a function, and write the text back
proc_killKill a process and (optionally) all its child processes
proj_rootReturn the (possible) root directory of a project
prose_indexFind the indices of lines in Markdown that are prose (not code blocks)
protect_mathProtect math expressions in pairs of backticks in Markdown
+ +

-- R --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
raw_stringPrint a character vector in its raw form
RcmdRun the commands 'Rscript' and 'R CMD'
read_allRead all text files and concatenate their content
read_binRead all records of a binary file as a raw vector by default
read_utf8Read / write files encoded in UTF-8
recordRun R code and record the results
record_printPrint methods for 'record()'
record_print.defaultPrint methods for 'record()'
record_print.record_asisPrint methods for 'record()'
relative_pathGet the relative path of a path relative to a directory
rename_seqRename files with a sequential numeric prefix
rest_apiGet data from a REST API
rest_api_rawGet data from a REST API
retryRetry calling a function for a number of times
rev_checkRun 'R CMD check' on the reverse dependencies of a package
root_rulesReturn the (possible) root directory of a project
RscriptRun the commands 'Rscript' and 'R CMD'
Rscript_callCall a function in a new R session via 'Rscript()'
rstudio_typeType a character vector into the RStudio source editor
+ +

-- S --

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
same_pathTest if two paths are the same after they are normalized
sans_extManipulate filename extensions
session_infoAn alternative to sessionInfo() to print session information
set_envvarSet environment variables
shrink_imagesShrink images to a maximum width
sort_fileRead a text file, process the text with a function, and write the text back
split_linesSplit a character vector by line breaks
split_sourceSplit source lines into complete expressions
strict_listStrict lists
strip_htmlStrip HTML tags
str_wrapWrap character vectors
submit_cranSubmit a source package to CRAN
system3Run 'system2()' and mark its character output as UTF-8 if appropriate
+ +

-- T --

+ + + + + + + + + + + + + + + + + + + + + + +
tabsetRepresent a (recursive) list with (nested) tabsets
taml_fileA simple YAML reader and writer
taml_loadA simple YAML reader and writer
taml_saveA simple YAML reader and writer
tinifyUse the Tinify API to compress PNG and JPEG images
tinify_dirUse the Tinify API to compress PNG and JPEG images
tojsonA simple JSON serializer
treeTurn the output of 'str()' into a tree diagram
try_errorTry an expression and see if it throws an error
try_silentTry to evaluate an expression silently
+ +

-- U --

+ + + + + + + + + + + + +
upload_ftpUpload to an FTP server via 'curl'
upload_imgurUpload an image to imgur.com
upload_win_builderUpload to an FTP server via 'curl'
url_accessibleTest if a URL is accessible
url_filenameExtract filenames from a URLs
+ +

-- V --

+ + + + +
valid_syntaxCheck if the syntax of the code is valid
+ +

-- W --

+ + + + + + +
with_extManipulate filename extensions
write_utf8Read / write files encoded in UTF-8
+ +

-- Y --

+ + + + + + +
yaml_bodyPartition the YAML metadata and the body in a document
yaml_loadRead YAML data
+ +

-- misc --

+ + + + +
$.xfun_strict_listStrict lists
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/libs/xfun.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/libs/xfun.so new file mode 100755 index 00000000..ddc8870b Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/libs/xfun.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/libs/xfun.so.dSYM/Contents/Info.plist b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/libs/xfun.so.dSYM/Contents/Info.plist new file mode 100644 index 00000000..d75137ef --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/libs/xfun.so.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.xfun.so + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/libs/xfun.so.dSYM/Contents/Resources/DWARF/xfun.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/libs/xfun.so.dSYM/Contents/Resources/DWARF/xfun.so new file mode 100644 index 00000000..49e89b2e Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/libs/xfun.so.dSYM/Contents/Resources/DWARF/xfun.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/resources/record.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/resources/record.css new file mode 100644 index 00000000..df584863 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/resources/record.css @@ -0,0 +1,46 @@ +body { + max-width: 800px; + margin: auto; + padding: 1.5em 0; + line-height: 1.5; +} +pre, .plot img { + max-width: 100%; + display: block; + margin: auto; +} +pre:hover { + white-space: pre-wrap; + word-break: break-all; +} +pre { + padding: 1em; + overflow-x: auto; +} +pre code { + padding: 0; +} +pre[class^="language-"] { + background-color: #F8F8F8; + cursor: pointer; +} +pre:not([class^="language-"]) { + background-color: inherit; + border: 1px solid #eee; +} +pre.message { + border-color: #9eeaf9; +} +pre.warning { + background: #fff3cd; + border-color: #fff3cd; +} +pre.error { + background: #f8d7da; + border-color: #f8d7da; +} +@media only screen { + pre:not([class^="language-"]) { + max-height: 300px; + } +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/resources/record.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/resources/record.html new file mode 100644 index 00000000..cfe479cc --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/resources/record.html @@ -0,0 +1,20 @@ + + + + + +$title$Output of xfun::record() + + + + + + + + + + +$body$ + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/scripts/call-fun.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/scripts/call-fun.R new file mode 100644 index 00000000..5017cd99 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/scripts/call-fun.R @@ -0,0 +1,16 @@ +# This script is executed via the command line `Rscript call-fun.R arg1 arg2 +# arg3`, where arg1 is a path to an .rds file, which contains the function and +# its arguments saved as a list; arg2 is a path to an .rds file to which the +# returned value of the function call is saved; arg3 saves the error message. + +local({ + if (length(a <- commandArgs(TRUE)) != 3) + stop('The number of arguments passed to Rscript should be 3.') + # save the error message on exit if an error occurred + on.exit(if (!file.exists(a[2])) saveRDS(geterrmessage(), a[3])) + x = readRDS(a[1]) # list(fun, args) + f = x[[1]] + if (is.character(f)) f = eval(parse(text = f), envir = globalenv()) + r = do.call(f, x[[2]], envir = globalenv()) + saveRDS(r, a[2]) +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/scripts/child-pids.sh b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/scripts/child-pids.sh new file mode 100644 index 00000000..1455a01b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/scripts/child-pids.sh @@ -0,0 +1,11 @@ +# given a PID, output all its child PIDs recursively +list_children() { + for j in $(pgrep -P $1); do + echo $j + echo $(list_children $j) + done +} + +for i in $@; do + list_children $i +done diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/scripts/mime-type.txt b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/scripts/mime-type.txt new file mode 100644 index 00000000..2c56495d --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xfun/scripts/mime-type.txt @@ -0,0 +1,9 @@ +# get the MIME type using .NET's MimeMapping class + +param ( + [string]$filePath +) + +Add-Type -AssemblyName "System.Web" +$mimeType = [System.Web.MimeMapping]::GetMimeMapping($filePath) +Write-Host $mimeType diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/DESCRIPTION new file mode 100644 index 00000000..25ab3994 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/DESCRIPTION @@ -0,0 +1,53 @@ +Package: xml2 +Title: Parse XML +Version: 1.3.6 +Authors@R: c( + person("Hadley", "Wickham", , "hadley@posit.co", role = c("aut", "cre")), + person("Jim", "Hester", role = "aut"), + person("Jeroen", "Ooms", role = "aut"), + person("Posit Software, PBC", role = c("cph", "fnd")), + person("R Foundation", role = "ctb", + comment = "Copy of R-project homepage cached as example") + ) +Description: Work with XML files using a simple, consistent interface. + Built on top of the 'libxml2' C library. +License: MIT + file LICENSE +URL: https://xml2.r-lib.org/, https://github.com/r-lib/xml2 +BugReports: https://github.com/r-lib/xml2/issues +Depends: R (>= 3.6.0) +Imports: cli, methods, rlang (>= 1.1.0) +Suggests: covr, curl, httr, knitr, magrittr, mockery, rmarkdown, + testthat (>= 3.0.0) +VignetteBuilder: knitr +Config/Needs/website: tidyverse/tidytemplate +Encoding: UTF-8 +RoxygenNote: 7.2.3 +SystemRequirements: libxml2: libxml2-dev (deb), libxml2-devel (rpm) +Collate: 'S4.R' 'as_list.R' 'xml_parse.R' 'as_xml_document.R' + 'classes.R' 'format.R' 'import-standalone-obj-type.R' + 'import-standalone-purrr.R' 'import-standalone-types-check.R' + 'init.R' 'nodeset_apply.R' 'paths.R' 'utils.R' 'xml2-package.R' + 'xml_attr.R' 'xml_children.R' 'xml_document.R' 'xml_find.R' + 'xml_missing.R' 'xml_modify.R' 'xml_name.R' 'xml_namespaces.R' + 'xml_node.R' 'xml_nodeset.R' 'xml_path.R' 'xml_schema.R' + 'xml_serialize.R' 'xml_structure.R' 'xml_text.R' 'xml_type.R' + 'xml_url.R' 'xml_write.R' 'zzz.R' +Config/testthat/edition: 3 +NeedsCompilation: yes +Packaged: 2023-12-04 14:50:27 UTC; hadleywickham +Author: Hadley Wickham [aut, cre], + Jim Hester [aut], + Jeroen Ooms [aut], + Posit Software, PBC [cph, fnd], + R Foundation [ctb] (Copy of R-project homepage cached as example) +Maintainer: Hadley Wickham +Repository: CRAN +Date/Publication: 2023-12-04 16:30:02 UTC +Built: R 4.4.1; aarch64-apple-darwin20; 2025-01-24 20:08:38 UTC; unix +Archs: xml2.so.dSYM +RemoteType: standard +RemotePkgRef: xml2 +RemoteRef: xml2 +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 1.3.6 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/INDEX new file mode 100644 index 00000000..4f13630b --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/INDEX @@ -0,0 +1,30 @@ +as_list Coerce xml nodes to a list. +as_xml_document Coerce a R list to xml nodes. +download_xml Download a HTML or XML file +read_xml Read HTML or XML. +url_absolute Convert between relative and absolute urls. +url_escape Escape and unescape urls. +url_parse Parse a url into its component pieces. +write_xml Write XML or HTML to disk. +xml2_example Get path to a xml2 example +xml_attr Retrieve an attribute. +xml_cdata Construct a cdata node +xml_children Navigate around the family tree. +xml_comment Construct a comment node +xml_dtd Construct a document type definition +xml_find_all Find nodes that match an xpath expression. +xml_name The (tag) name of an xml element. +xml_new_document Create a new document, possibly with a root + node +xml_ns XML namespaces. +xml_ns_strip Strip the default namespaces from a document +xml_path Retrieve the xpath to a node +xml_replace Modify a tree by inserting, replacing or + removing nodes +xml_serialize Serializing XML objects to connections. +xml_set_namespace Set the node's namespace +xml_structure Show the structure of an html/xml document. +xml_text Extract or modify the text +xml_type Determine the type of a node. +xml_url The URL of an XML document +xml_validate Validate XML schema diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/LICENSE new file mode 100644 index 00000000..1c743f16 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2023 +COPYRIGHT HOLDER: xml2 authors diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/Meta/Rd.rds new file mode 100644 index 00000000..1ce65519 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/Meta/hsearch.rds new file mode 100644 index 00000000..ac93dcd7 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/Meta/links.rds new file mode 100644 index 00000000..dd405ffa Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/Meta/nsInfo.rds new file mode 100644 index 00000000..51c0adbb Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/Meta/package.rds new file mode 100644 index 00000000..466c5869 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/Meta/vignette.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/Meta/vignette.rds new file mode 100644 index 00000000..c343cbaa Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/Meta/vignette.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/NAMESPACE new file mode 100644 index 00000000..8f74da43 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/NAMESPACE @@ -0,0 +1,194 @@ +# Generated by roxygen2: do not edit by hand + +S3method("[",xml_missing) +S3method("[",xml_nodeset) +S3method("[[",xml_missing) +S3method("xml_attr<-",xml_missing) +S3method("xml_attr<-",xml_node) +S3method("xml_attr<-",xml_nodeset) +S3method("xml_attrs<-",xml_missing) +S3method("xml_attrs<-",xml_node) +S3method("xml_attrs<-",xml_nodeset) +S3method("xml_name<-",xml_missing) +S3method("xml_name<-",xml_node) +S3method("xml_name<-",xml_nodeset) +S3method("xml_text<-",xml_missing) +S3method("xml_text<-",xml_node) +S3method("xml_text<-",xml_nodeset) +S3method(as.character,xml_document) +S3method(as.character,xml_missing) +S3method(as.character,xml_node) +S3method(as.character,xml_nodeset) +S3method(as_list,xml_document) +S3method(as_list,xml_missing) +S3method(as_list,xml_node) +S3method(as_list,xml_nodeset) +S3method(as_xml_document,character) +S3method(as_xml_document,connection) +S3method(as_xml_document,list) +S3method(as_xml_document,raw) +S3method(as_xml_document,response) +S3method(as_xml_document,xml_document) +S3method(as_xml_document,xml_node) +S3method(as_xml_document,xml_nodeset) +S3method(format,xml_node) +S3method(is.na,xml_missing) +S3method(is.na,xml_node) +S3method(is.na,xml_nodeset) +S3method(nodeset_apply,xml_document) +S3method(nodeset_apply,xml_missing) +S3method(nodeset_apply,xml_node) +S3method(nodeset_apply,xml_nodeset) +S3method(print,xml_document) +S3method(print,xml_missing) +S3method(print,xml_namespace) +S3method(print,xml_node) +S3method(print,xml_nodeset) +S3method(read_html,default) +S3method(read_html,response) +S3method(read_xml,character) +S3method(read_xml,connection) +S3method(read_xml,raw) +S3method(read_xml,response) +S3method(tree_structure,xml_missing) +S3method(tree_structure,xml_node) +S3method(tree_structure,xml_nodeset) +S3method(write_html,xml_document) +S3method(write_html,xml_missing) +S3method(write_html,xml_node) +S3method(write_html,xml_nodeset) +S3method(write_xml,xml_document) +S3method(write_xml,xml_missing) +S3method(write_xml,xml_node) +S3method(write_xml,xml_nodeset) +S3method(xml_add_child,xml_document) +S3method(xml_add_child,xml_missing) +S3method(xml_add_child,xml_node) +S3method(xml_add_child,xml_nodeset) +S3method(xml_add_parent,xml_missing) +S3method(xml_add_parent,xml_node) +S3method(xml_add_parent,xml_nodeset) +S3method(xml_add_sibling,xml_missing) +S3method(xml_add_sibling,xml_node) +S3method(xml_add_sibling,xml_nodeset) +S3method(xml_find_all,xml_missing) +S3method(xml_find_all,xml_node) +S3method(xml_find_all,xml_nodeset) +S3method(xml_find_chr,xml_missing) +S3method(xml_find_chr,xml_node) +S3method(xml_find_chr,xml_nodeset) +S3method(xml_find_first,xml_missing) +S3method(xml_find_first,xml_node) +S3method(xml_find_first,xml_nodeset) +S3method(xml_find_int,xml_missing) +S3method(xml_find_int,xml_node) +S3method(xml_find_int,xml_nodeset) +S3method(xml_find_lgl,xml_missing) +S3method(xml_find_lgl,xml_node) +S3method(xml_find_lgl,xml_nodeset) +S3method(xml_find_num,xml_missing) +S3method(xml_find_num,xml_node) +S3method(xml_find_num,xml_nodeset) +S3method(xml_ns,xml_document) +S3method(xml_ns,xml_missing) +S3method(xml_ns,xml_node) +S3method(xml_ns,xml_nodeset) +S3method(xml_parent,xml_missing) +S3method(xml_parent,xml_node) +S3method(xml_parent,xml_nodeset) +S3method(xml_remove,xml_missing) +S3method(xml_remove,xml_node) +S3method(xml_remove,xml_nodeset) +S3method(xml_replace,xml_missing) +S3method(xml_replace,xml_node) +S3method(xml_replace,xml_nodeset) +S3method(xml_serialize,xml_document) +S3method(xml_serialize,xml_node) +S3method(xml_serialize,xml_nodeset) +S3method(xml_set_attr,xml_missing) +S3method(xml_set_attr,xml_node) +S3method(xml_set_attr,xml_nodeset) +S3method(xml_set_attrs,xml_missing) +S3method(xml_set_attrs,xml_node) +S3method(xml_set_attrs,xml_nodeset) +S3method(xml_set_name,xml_missing) +S3method(xml_set_name,xml_node) +S3method(xml_set_name,xml_nodeset) +S3method(xml_url,xml_missing) +S3method(xml_url,xml_node) +S3method(xml_url,xml_nodeset) +S3method(xml_validate,xml_document) +export("xml_attr<-") +export("xml_attrs<-") +export("xml_name<-") +export("xml_text<-") +export(as_list) +export(as_xml_document) +export(download_html) +export(download_xml) +export(html_structure) +export(read_html) +export(read_xml) +export(url_absolute) +export(url_escape) +export(url_parse) +export(url_relative) +export(url_unescape) +export(write_html) +export(write_xml) +export(xml2_example) +export(xml_add_child) +export(xml_add_parent) +export(xml_add_sibling) +export(xml_attr) +export(xml_attrs) +export(xml_cdata) +export(xml_child) +export(xml_children) +export(xml_comment) +export(xml_contents) +export(xml_double) +export(xml_dtd) +export(xml_find_all) +export(xml_find_chr) +export(xml_find_first) +export(xml_find_int) +export(xml_find_lgl) +export(xml_find_num) +export(xml_find_one) +export(xml_has_attr) +export(xml_integer) +export(xml_length) +export(xml_missing) +export(xml_name) +export(xml_new_document) +export(xml_new_root) +export(xml_ns) +export(xml_ns_rename) +export(xml_ns_strip) +export(xml_parent) +export(xml_parents) +export(xml_path) +export(xml_remove) +export(xml_replace) +export(xml_root) +export(xml_serialize) +export(xml_set_attr) +export(xml_set_attrs) +export(xml_set_name) +export(xml_set_namespace) +export(xml_set_text) +export(xml_siblings) +export(xml_structure) +export(xml_text) +export(xml_type) +export(xml_unserialize) +export(xml_url) +export(xml_validate) +exportClasses(xml_document) +exportClasses(xml_missing) +exportClasses(xml_node) +exportClasses(xml_nodeset) +import(rlang) +importFrom(methods,setOldClass) +useDynLib(xml2, .registration = TRUE) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/NEWS.md b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/NEWS.md new file mode 100644 index 00000000..9a3a4fb4 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/NEWS.md @@ -0,0 +1,284 @@ +# xml2 1.3.6 + +* Now compatible with libxml2 2.12.0 and later (@KNnut). + +* Fixed format string issues detected in R-devel. + +* Remove unused dependencies on glue, withr and lifecycle (@mgirlich). + +* `print()` is faster for very long `xml_nodeset` inputs (#366, @michaelchirico). + +* `xml_attr()`, `xml_attrs()`, `xml_double()`, `xml_integer()`, `xml_length()`, + `xml_name()`, `xml_path()`, `xml_text()`, and `xml_type()` no longer use + S3 dispatch but instead dispatch in C, leading to considerable performance + improvements in many cases (@mgirlich, #400). + +* `xml_find_int()` analogous to `xml_find_num()` for returning integers + matched by an XPath (#365, @michaelchirico). + +* `xml_serialize()` now includes the document type so that `xml_unserialize()` + works also for HTML documents (#407, @HenrikBengtsson). + +# xml2 1.3.5 + +* Small speedup for `xml_find_all()` (@mgirlich, #393). + +* Fixes for R CMD check problems. + +# xml2 1.3.4 + +* Fixes for R CMD check problems. + +* Windows: update to libxml2 2.10.3 + +# xml2 1.3.3 + +* Hadley Wickham is now (again) the maintainer. + +* xml2 has been re-licensed as MIT (#317). + +* `xml_find_all.xml_node()` fails more informatively the `xpath` parameter is the wrong type (@michaelchirico) + +* `xml_find_all.xml_nodeset()` gains a `flatten` argument to control whether to return a single nodeset or a list of nodesets (#311, @jakejh) + +* `write_xml()` and `write_html()` now return NULL invisibly, as they did prior to version 1.3.0 (#307) + +* `XPtr` gets explicit copy constructor and assignment operator definitions, which were two missing components of the [Rule of three](https://en.wikipedia.org/wiki/Rule_of_three_(C%2B%2B_programming)) (@michaelchirico) + +* Windows: update to libxml2 2.9.10 and libxslt 1.1.34 and add ucrt libs + +# xml2 1.3.2 + +* `read_html()` and `read_xml()` now error if passed strings of length greater than one (#121) + +* `read_xml.raw()` had an inadvertent regression in 1.3.0 and is now again fixed (#300) + +* Compilation fix on macOS 10.15.4 (@kevinushey, #296) + +# xml2 1.3.1 + +* `read_html()` now again works with HTML files with non-ASCII encodings (#293). + +# xml2 1.3.0 + +* Removes the Rcpp dependency + +# xml2 1.2.5 + +* Fix compilation issue on macOS versions after High Sierra when not using homebrew supplied libxml2 + +# xml2 1.2.4 + +* Fix potential dangling pointer with internal `asXmlChar()` function (@michaelquinn32, #287). + +* `as_xml_document()` now handles cases with text nodes trailing normal nodes (#274). + +* `xml_add_child()` can now create nodes with a `par` attribute. These previously errored due to partial name matching of the `parent` function in the internal `create_node()` function. (@jennybc, #285) + +* `libxml2_version()` now returns a semantic version rather than alphanumeric version, so "2.9.10" > "2.9.9" (#277) + +# xml2 1.2.2 + +* Export S4 classes with documentation, so they can be used in other packages +without Warnings (@nuest, #267) + +# xml2 1.2.1 + +## New Features + +* xml2 now has a pkgdown site! (@jayhesselberth, #211). + +* Windows: upgrade to libxml2 2.9.8 + +* print methods now match the type of document, e.g. `read_html()` prints as + "{html_document}" rather than "{xml_document}" (#227) + +## Bugfixes and Miscellaneous features + +* Generic xml2 error are now forwarded as R errors. Previously these errors + were output to stderr, so could not be suppressed (#209). + +* Fix for ICU 59+ defaulting to use char16_t, which is only available in C++11 (#231) + +* No longer uses the C connections API + +* Better error message when trying to run `download_xml()` without the curl + package installed (#262) + +* xml2 classes are now registered for use with S4 by calling `setOldClass()` (#248) + +* Nodes with nested data type definition entities now work without crashing (#241) + +* Test failure fixed due to behavior change with relative paths in libxml2 + 2.9.9 (#245). + +* `read_xml()` now has a better error message when given zero length character + inputs (#212). + +* `read_xml()` and `read_html()` now automatically check if the response + succeeded before trying to read from a HTTP response (#255). + +* `xml_root()` can now create root nodes with namespaces (#239) + +* `xml_set_attr()` no longer crashes if you try to set the same namespace on + the same node multiple times (#253). + +* `xml_set_attr()` now recycles the values if needed (#221) + +* `xml_structure()` gains a `file` argument, to support writing to a file + rather than the console (#244). + + +# xml2 1.2.0 + +## Breaking changes + +* `as_list()` on `xml_document` objects did not properly include the root node + in the returned list. Previous behavior can be obtained by using + `as_list()[[1L]]` in place of `as_list()`. + +## New Features + +* `download_xml()` and `download_html()` helper functions to make it easy to + download files (#193). + +* `xml_attr()` can now set attributes with no value (#198). + +* `xml_serialize()` and `xml_unserialize()` now create file connections when + given character input (#179). + +## Bugfixes + +* `xml_find_first()` no longer de-duplicates results, so the results are always + the same length as the inputs (as documented) (#194). + +* xml2 can now build using libxml2 2.7.0 + +* Use Rcpp symbol registration and visibility to prevent symbol conflicts on Linux + +* `xml_add_child()` now requires less resources to insert a node when called + with `.where = 0L` (@heckendorfc, #175). + +* Fixed failing examples due to a change in an external resource. + +# xml2 1.1.1 + +* This is a small point release addressing installation issues found with older + libxml2 versions shipped with RedHat Linux 6 / CentOS 6 (#163, #164). + +# xml2 1.1.0 + +## New Features +* `write_xml()` and `write_html()` now accept connections as well as filenames + for output. (#157) + +* `xml_add_child()` now takes a `.where` argument specifying where to add the + new children. (#138) + +* `as_xml()` generic function to convert R objects to xml. The most important + method is for lists and enables full roundtrip support for going to and back + from xml for lists and enables full roundtrip support to and from XML. (#137, #143) + +* `xml_new_root()` can be used to create a new document and a root node in one step (#131). + +* `xml_add_parent()` inserts a new node between the node and its parent (#129) + +* Add `xml_validate()` to validate a document against an xml schema (#31, @jeroenooms). + +* Export `xml2_types.h` to allow for extension packages such as xslt. + +* `xml_comment()` allows you to add comment nodes to a document. (#111) + +* `xml_cdata()` allows you to add CDATA nodes to a document. (#128) + +* Add `xml_set_text()` and `xml_set_name()` equivalent to `xml_text<-` and `xml_name<-`. (#130). + +* Add `xml_set_attr()` and `xml_set_attrs()` equivalent to `xml_attr<-` and `xml_attrs<-`. (#109, #130) + +* Add `write_html()` method (#133). + +## Bugfixes + +* `xml_new_document()` now explicitly sets the encoding (default UTF-8) (#142) + +* Document formatting options for `write_xml()` (#132) + +* Add missing methods for xml_missing objects. (#134) + +* Bugfix for xml_length.xml_nodeset that caused it to fail unconditionally. (#140) + +* `is.na()` now returns `TRUE` for `xml_missing` objects. (#139) + +* Trim non-breaking spaces in `xml_text(trim = TRUE)` (#151). + +* Allow setting non-character attributes (values are coerced to characters). (@sjp, #117, #122). + +* Fixed return value in call to vapply in xml_integer.xml_nodeset. (@ddiez, #146, #147). + +* Allow docs missing a root element to be created and printed. (@sjp, #126, #121). + +* xml_add_* methods now return invisibly. (@sjp, #124) + +* `as_list()` now preserves element names when attributes exist, and escapes + XML attributes that conflict with special R attributes (@peterfoley, #115). + +# xml2 1.0.0 + +* All C++ functions now use `checked_get()` instead of `get()` where possible, + so NULL XPtrs properly throw an error rather than crashing. (@jimhester, + #101, #104). + +* `xml_integer()` and `xml_double()` functions to make it easy to extract + integer and double text from nodes (@jimhester, #97, #99). + +* xml2 now supports modification and creation of XML nodes. New functions + `xml_new_document()`, `xml_new_child()`, `xml_new_sibling()`, + `xml_set_namespace()`, , `xml_remove()`, `xml_replace()`, `xml_root()` + and replacement methods for `xml_name()`, `xml_attr()`, `xml_attrs()` and + `xml_text()` (@jimhester, #9 #76) + +* `xml_ns()` now keeps namespace prefixes that point to the same URI + (@jimhester, #35, #95). + +* `read_xml()` and `read_html()` methods added for `httr::response()` objects. + (@jimhester, #63, #93) + +* `xml_child()` function to make selecting children a little easier + (@jimhester, #23, #94) + +* `xml_find_one()` has been deprecated in favor of `xml_find_first()` + (@jimhester, #58, #92) + +* `xml_read()` functions now default to passing the document's namespace + object. Namespace definitions can now be removed as well as added and + `xml_ns_strip()` added to remove all default namespaces from a document. + (@jimhester, #28, #89) + +* `xml_read()` gains a `options` argument to control all available parsing + options, including `HUGE` to turn off limits for parsing very large + documents and now drops blank text nodes by default, mimicking default + behavior of XML package. (@jimhester, #49, #62, #85, #88) + +* `xml_write()` expands the path on filenames, so directories can be specified + with '~/' (@jimhester, #86, #80) + +* `xml_find_one()` now returns a 'xml_missing' node object if there are 0 + matches (@jimhester, #55, #53, hadley/rvest#82). + +* `xml_find_num()`, `xml_find_chr()`, `xml_find_lgl()` functions added to + return numeric, character and logical results from XPath expressions. (@jimhester, #55) + +* `xml_name()` and `xml_text()` always correctly encode returned value as + UTF-8 (#54). + +# xml2 0.1.2 + +* Improved configure script - now works again on R-devel on windows. + +* Compiles with older versions of libxml2., + +# xml2 0.1.1 + +* Make configure script more cross platform. + +* Add `xml_length()` to count the number of children (#32). diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/R/xml2 b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/R/xml2 new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/R/xml2 @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/R/xml2.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/R/xml2.rdb new file mode 100644 index 00000000..7a813c71 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/R/xml2.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/R/xml2.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/R/xml2.rdx new file mode 100644 index 00000000..7f268819 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/R/xml2.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/doc/index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/doc/index.html new file mode 100644 index 00000000..f9af797c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/doc/index.html @@ -0,0 +1,29 @@ + + +R: Vignettes and other documentation + + + +
+

Vignettes and other documentation + +

+
+
+[Top] +
+

Vignettes from package 'xml2'

+ +++++++ + + + + +
xml2::modificationNode ModificationHTMLsourceR code
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/doc/modification.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/doc/modification.R new file mode 100644 index 00000000..3dacccde --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/doc/modification.R @@ -0,0 +1,120 @@ +## ----echo = FALSE, message = FALSE-------------------------------------------- +knitr::opts_chunk$set(collapse = TRUE, comment = "#>") +library(xml2) +library(magrittr) + +## ----------------------------------------------------------------------------- +x <- read_xml("

This is some text. This is more.

") +xml_text(x) + +xml_text(x) <- "This is some other text." +xml_text(x) + +# You can avoid this by explicitly selecting the text node. +x <- read_xml("

This is some text. This is bold!

") +text_only <- xml_find_all(x, "//text()") + +xml_text(text_only) <- c("This is some other text. ", "Still bold!") +xml_text(x) +xml_structure(x) + +## ----------------------------------------------------------------------------- +x <- read_xml("xml2") +xml_attr(x, "href") + +xml_attr(x, "href") <- "https://github.com/r-lib/xml2" +xml_attr(x, "href") + +xml_attrs(x) <- c(id = "xml2", href = "https://github.com/r-lib/xml2") +xml_attrs(x) +x + +xml_attrs(x) <- NULL +x + +# Namespaces are added with as a xmlns or xmlns:prefix attribute +xml_attr(x, "xmlns") <- "http://foo" +x + +xml_attr(x, "xmlns:bar") <- "http://bar" +x + +## ----------------------------------------------------------------------------- +x <- read_xml("") +x +xml_name(x) +xml_name(x) <- "c" +x + +## ----------------------------------------------------------------------------- +x <- read_xml("123") +children <- xml_children(x) +t1 <- children[[1]] +t2 <- children[[2]] +t3 <- xml_children(children[[2]])[[1]] + +xml_replace(t1, t3) +x + +## ----------------------------------------------------------------------------- +x <- read_xml("123") +children <- xml_children(x) +t1 <- children[[1]] +t2 <- children[[2]] +t3 <- xml_children(children[[2]])[[1]] + +xml_add_sibling(t1, t3) +x + +xml_add_sibling(t3, t1, where = "before") +x + +## ----------------------------------------------------------------------------- +x <- read_xml("123") +children <- xml_children(x) +t1 <- children[[1]] +t2 <- children[[2]] +t3 <- xml_children(children[[2]])[[1]] + +xml_add_child(t1, t3) +x + +xml_add_child(t1, read_xml("")) +x + +## ----------------------------------------------------------------------------- +x <- read_xml("") +x1 <- x %>% + xml_children() %>% + .[[1]] +x2 <- x1 %>% + xml_children() %>% + .[[1]] + +xml_remove(x1) +rm(x1) +gc() + +x2 + +## ----------------------------------------------------------------------------- +x <- read_xml("") +bees <- xml_find_all(x, "//b") +xml_remove(xml_child(x), free = TRUE) +# bees[[1]] is no longer valid!!! +rm(bees) +gc() + +## ----------------------------------------------------------------------------- +d <- xml_new_root("sld", + "xmlns" = "http://www.opengis.net/sld", + "xmlns:ogc" = "http://www.opengis.net/ogc", + "xmlns:se" = "http://www.opengis.net//se", + version = "1.1.0" +) %>% + xml_add_child("layer") %>% + xml_add_child("se:Name", "My Layer") %>% + xml_root() + +d + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/doc/modification.Rmd b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/doc/modification.Rmd new file mode 100644 index 00000000..ecd8f5db --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/doc/modification.Rmd @@ -0,0 +1,203 @@ +--- +title: "Node Modification" +author: "Jim Hester" +date: "`r Sys.Date()`" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Node Modification} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, echo = FALSE, message = FALSE} +knitr::opts_chunk$set(collapse = TRUE, comment = "#>") +library(xml2) +library(magrittr) +``` + +# Modifying Existing XML + +Modifying existing XML can be done in xml2 by using the replacement functions +of the accessors. They all have methods for both individual `xml_node` objects +as well as `xml_nodeset` objects. If a vector of values is provided it is +applied piecewise over the nodeset, otherwise the value is recycled. + +## Text Modification ## + +Text modification only happens on text nodes. If a given node has more than one +text node only the first will be affected. If you want to modify additional +text nodes you need to select them explicitly with `/text()`. + +```{r} +x <- read_xml("

This is some text. This is more.

") +xml_text(x) + +xml_text(x) <- "This is some other text." +xml_text(x) + +# You can avoid this by explicitly selecting the text node. +x <- read_xml("

This is some text. This is bold!

") +text_only <- xml_find_all(x, "//text()") + +xml_text(text_only) <- c("This is some other text. ", "Still bold!") +xml_text(x) +xml_structure(x) +``` + +## Attribute and Namespace Definition Modification ## + +Attributes and namespace definitions are modified one at a time with +`xml_attr()` or all at once with `xml_attrs()`. In both cases using `NULL` as +the value will remove the attribute completely. + +```{r} +x <- read_xml("xml2") +xml_attr(x, "href") + +xml_attr(x, "href") <- "https://github.com/r-lib/xml2" +xml_attr(x, "href") + +xml_attrs(x) <- c(id = "xml2", href = "https://github.com/r-lib/xml2") +xml_attrs(x) +x + +xml_attrs(x) <- NULL +x + +# Namespaces are added with as a xmlns or xmlns:prefix attribute +xml_attr(x, "xmlns") <- "http://foo" +x + +xml_attr(x, "xmlns:bar") <- "http://bar" +x +``` + +## Name Modification ## + +Node names are modified with `xml_name()`. + +```{r} +x <- read_xml("") +x +xml_name(x) +xml_name(x) <- "c" +x +``` + +# Node modification # +All of these functions have a `.copy` argument. If this is set to `FALSE` they +will remove the new node from its location before inserting it into the new +location. Otherwise they make a copy of the node before insertion. + +## Replacing existing nodes ## +```{r} +x <- read_xml("123") +children <- xml_children(x) +t1 <- children[[1]] +t2 <- children[[2]] +t3 <- xml_children(children[[2]])[[1]] + +xml_replace(t1, t3) +x +``` + +## Add a sibling ## +```{r} +x <- read_xml("123") +children <- xml_children(x) +t1 <- children[[1]] +t2 <- children[[2]] +t3 <- xml_children(children[[2]])[[1]] + +xml_add_sibling(t1, t3) +x + +xml_add_sibling(t3, t1, where = "before") +x +``` + +## Add a child ## +```{r} +x <- read_xml("123") +children <- xml_children(x) +t1 <- children[[1]] +t2 <- children[[2]] +t3 <- xml_children(children[[2]])[[1]] + +xml_add_child(t1, t3) +x + +xml_add_child(t1, read_xml("")) +x +``` + +## Removing nodes ## +The `xml_remove()` can be used to remove a node (and its children) from a +tree. The default behavior is to unlink the node from the tree, but does _not_ +free the memory for the node, so R objects pointing to the node are still +valid. + +This allows code like the following to work without crashing R + +```{r} +x <- read_xml("") +x1 <- x %>% + xml_children() %>% + .[[1]] +x2 <- x1 %>% + xml_children() %>% + .[[1]] + +xml_remove(x1) +rm(x1) +gc() + +x2 +``` +If you are not planning on referencing these nodes again this memory is wasted. +Calling `xml_remove(free = TRUE)` will remove the nodes _and_ free the memory +used to store them. **Note** In this case _any_ node which previously pointed +to the node or its children will instead be pointing to free memory and may +cause R to crash. xml2 can't figure this out for you, so it's your +responsibility to remove any objects which are no longer valid. + +In particular `xml_find_*()` results are easy to overlook, for example + +```{r} +x <- read_xml("") +bees <- xml_find_all(x, "//b") +xml_remove(xml_child(x), free = TRUE) +# bees[[1]] is no longer valid!!! +rm(bees) +gc() +``` + +## Namespaces ## + +We want to construct a document with the following namespace layout. (From +). +```xml + + + +My Layer + + +``` + +```{r} +d <- xml_new_root("sld", + "xmlns" = "http://www.opengis.net/sld", + "xmlns:ogc" = "http://www.opengis.net/ogc", + "xmlns:se" = "http://www.opengis.net//se", + version = "1.1.0" +) %>% + xml_add_child("layer") %>% + xml_add_child("se:Name", "My Layer") %>% + xml_root() + +d +``` diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/doc/modification.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/doc/modification.html new file mode 100644 index 00000000..8d4681f2 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/doc/modification.html @@ -0,0 +1,596 @@ + + + + + + + + + + + + + + + + +Node Modification + + + + + + + + + + + + + + + + + + + + + + + + + + +

Node Modification

+

Jim Hester

+

2023-12-04

+ + + +
+

Modifying Existing XML

+

Modifying existing XML can be done in xml2 by using the replacement +functions of the accessors. They all have methods for both individual +xml_node objects as well as xml_nodeset +objects. If a vector of values is provided it is applied piecewise over +the nodeset, otherwise the value is recycled.

+
+

Text Modification

+

Text modification only happens on text nodes. If a given node has +more than one text node only the first will be affected. If you want to +modify additional text nodes you need to select them explicitly with +/text().

+
x <- read_xml("<p>This is some <b>text</b>. This is more.</p>")
+xml_text(x)
+#> [1] "This is some text. This is more."
+
+xml_text(x) <- "This is some other text."
+xml_text(x)
+#> [1] "This is some other text.text. This is more."
+
+# You can avoid this by explicitly selecting the text node.
+x <- read_xml("<p>This is some text. This is <b>bold!</b></p>")
+text_only <- xml_find_all(x, "//text()")
+
+xml_text(text_only) <- c("This is some other text. ", "Still bold!")
+xml_text(x)
+#> [1] "This is some other text. Still bold!"
+xml_structure(x)
+#> <p>
+#>   {text}
+#>   <b>
+#>     {text}
+
+
+

Attribute and Namespace Definition Modification

+

Attributes and namespace definitions are modified one at a time with +xml_attr() or all at once with xml_attrs(). In +both cases using NULL as the value will remove the +attribute completely.

+
x <- read_xml("<a href='invalid!'>xml2</a>")
+xml_attr(x, "href")
+#> [1] "invalid!"
+
+xml_attr(x, "href") <- "https://github.com/r-lib/xml2"
+xml_attr(x, "href")
+#> [1] "https://github.com/r-lib/xml2"
+
+xml_attrs(x) <- c(id = "xml2", href = "https://github.com/r-lib/xml2")
+xml_attrs(x)
+#>                            href                              id 
+#> "https://github.com/r-lib/xml2"                          "xml2"
+x
+#> {xml_document}
+#> <a href="https://github.com/r-lib/xml2" id="xml2">
+
+xml_attrs(x) <- NULL
+x
+#> {xml_document}
+#> <a>
+
+# Namespaces are added with as a xmlns or xmlns:prefix attribute
+xml_attr(x, "xmlns") <- "http://foo"
+x
+#> {xml_document}
+#> <a xmlns="http://foo">
+
+xml_attr(x, "xmlns:bar") <- "http://bar"
+x
+#> {xml_document}
+#> <a xmlns="http://foo" xmlns:bar="http://bar">
+
+
+

Name Modification

+

Node names are modified with xml_name().

+
x <- read_xml("<a><b/></a>")
+x
+#> {xml_document}
+#> <a>
+#> [1] <b/>
+xml_name(x)
+#> [1] "a"
+xml_name(x) <- "c"
+x
+#> {xml_document}
+#> <c>
+#> [1] <b/>
+
+
+
+

Node modification

+

All of these functions have a .copy argument. If this is +set to FALSE they will remove the new node from its +location before inserting it into the new location. Otherwise they make +a copy of the node before insertion.

+
+

Replacing existing nodes

+
x <- read_xml("<parent><child>1</child><child>2<child>3</child></child></parent>")
+children <- xml_children(x)
+t1 <- children[[1]]
+t2 <- children[[2]]
+t3 <- xml_children(children[[2]])[[1]]
+
+xml_replace(t1, t3)
+#> {xml_node}
+#> <child>
+x
+#> {xml_document}
+#> <parent>
+#> [1] <child>3</child>
+#> [2] <child>2<child>3</child></child>
+
+
+

Add a sibling

+
x <- read_xml("<parent><child>1</child><child>2<child>3</child></child></parent>")
+children <- xml_children(x)
+t1 <- children[[1]]
+t2 <- children[[2]]
+t3 <- xml_children(children[[2]])[[1]]
+
+xml_add_sibling(t1, t3)
+x
+#> {xml_document}
+#> <parent>
+#> [1] <child>1</child>
+#> [2] <child>3</child>
+#> [3] <child>2<child>3</child></child>
+
+xml_add_sibling(t3, t1, where = "before")
+x
+#> {xml_document}
+#> <parent>
+#> [1] <child>1</child>
+#> [2] <child>3</child>
+#> [3] <child>2<child>3</child><child>1</child></child>
+
+
+

Add a child

+
x <- read_xml("<parent><child>1</child><child>2<child>3</child></child></parent>")
+children <- xml_children(x)
+t1 <- children[[1]]
+t2 <- children[[2]]
+t3 <- xml_children(children[[2]])[[1]]
+
+xml_add_child(t1, t3)
+x
+#> {xml_document}
+#> <parent>
+#> [1] <child>1<child>3</child></child>
+#> [2] <child>2<child>3</child></child>
+
+xml_add_child(t1, read_xml("<test/>"))
+x
+#> {xml_document}
+#> <parent>
+#> [1] <child>1<child>3</child><test/></child>
+#> [2] <child>2<child>3</child></child>
+
+
+

Removing nodes

+

The xml_remove() can be used to remove a node (and its +children) from a tree. The default behavior is to unlink the node from +the tree, but does not free the memory for the node, so R +objects pointing to the node are still valid.

+

This allows code like the following to work without crashing R

+
x <- read_xml("<foo><bar><baz/></bar></foo>")
+x1 <- x %>%
+  xml_children() %>%
+  .[[1]]
+x2 <- x1 %>%
+  xml_children() %>%
+  .[[1]]
+
+xml_remove(x1)
+rm(x1)
+gc()
+#>           used (Mb) gc trigger (Mb) limit (Mb) max used (Mb)
+#> Ncells  598977 32.0    1355532 72.4         NA  1320341 70.6
+#> Vcells 1127775  8.7    8388608 64.0      32768  2040786 15.6
+
+x2
+#> {xml_node}
+#> <baz>
+

If you are not planning on referencing these nodes again this memory +is wasted. Calling xml_remove(free = TRUE) will remove the +nodes and free the memory used to store them. +Note In this case any node which previously +pointed to the node or its children will instead be pointing to free +memory and may cause R to crash. xml2 can’t figure this out for you, so +it’s your responsibility to remove any objects which are no longer +valid.

+

In particular xml_find_*() results are easy to overlook, +for example

+
x <- read_xml("<a><b /><b><b /></b></a>")
+bees <- xml_find_all(x, "//b")
+xml_remove(xml_child(x), free = TRUE)
+# bees[[1]] is no longer valid!!!
+rm(bees)
+gc()
+#>           used (Mb) gc trigger (Mb) limit (Mb) max used (Mb)
+#> Ncells  598883 32.0    1355532 72.4         NA  1320341 70.6
+#> Vcells 1127612  8.7    8388608 64.0      32768  2040786 15.6
+
+
+

Namespaces

+

We want to construct a document with the following namespace layout. +(From https://stackoverflow.com/questions/32939229/creating-xml-in-r-with-namespaces/32941524#32941524).

+
<?xml version = "1.0" encoding="UTF-8"?>
+<sld xmlns="http://www.opengis.net/sld"
+     xmlns:ogc="http://www.opengis.net/ogc"
+     xmlns:se="http://www.opengis.net/se"
+     version="1.1.0" >
+<layer>
+<se:Name>My Layer</se:Name>
+</layer>
+</sld>
+
d <- xml_new_root("sld",
+  "xmlns" = "http://www.opengis.net/sld",
+  "xmlns:ogc" = "http://www.opengis.net/ogc",
+  "xmlns:se" = "http://www.opengis.net//se",
+  version = "1.1.0"
+) %>%
+  xml_add_child("layer") %>%
+  xml_add_child("se:Name", "My Layer") %>%
+  xml_root()
+
+d
+#> {xml_document}
+#> <sld version="1.1.0" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:se="http://www.opengis.net//se">
+#> [1] <layer>\n  <se:Name>My Layer</se:Name>\n</layer>
+
+
+ + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/extdata/cd_catalog.xml b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/extdata/cd_catalog.xml new file mode 100644 index 00000000..d6c9f415 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/extdata/cd_catalog.xml @@ -0,0 +1,211 @@ + + + + Empire Burlesque + Bob Dylan + USA + Columbia + 10.90 + 1985 + + + Hide your heart + Bonnie Tylor + UK + CBS Records + 9.90 + 1988 + + + Greatest Hits + Dolly Parton + USA + RCA + 9.90 + 1982 + + + Still got the blues + Gary More + UK + Virgin redords + 10.20 + 1990 + + + Eros + Eros Ramazzotti + EU + BMG + 9.90 + 1997 + + + One night only + Bee Gees + UK + Polydor + 10.90 + 1998 + + + Sylvias Mother + Dr.Hook + UK + CBS + 8.10 + 1973 + + + Maggie May + Rod Stewart + UK + Pickwick + 8.50 + 1990 + + + Romanza + Andrea Bocelli + EU + Polydor + 10.80 + 1996 + + + When a man loves a woman + Percy Sledge + USA + Atlantic + 8.70 + 1987 + + + Black angel + Savage Rose + EU + Mega + 10.90 + 1995 + + + 1999 Grammy Nominees + Many + USA + Grammy + 10.20 + 1999 + + + For the good times + Kenny Rogers + UK + Mucik Master + 8.70 + 1995 + + + Big Willie style + Will Smith + USA + Columbia + 9.90 + 1997 + + + Tupelo Honey + Van Morrison + UK + Polydor + 8.20 + 1971 + + + Soulsville + Jorn Hoel + Norway + WEA + 7.90 + 1996 + + + The very best of + Cat Stevens + UK + Island + 8.90 + 1990 + + + Stop + Sam Brown + UK + A and M + 8.90 + 1988 + + + Bridge of Spies + T`Pau + UK + Siren + 7.90 + 1987 + + + Private Dancer + Tina Turner + UK + Capitol + 8.90 + 1983 + + + Midt om natten + Kim Larsen + EU + Medley + 7.80 + 1983 + + + Pavarotti Gala Concert + Luciano Pavarotti + UK + DECCA + 9.90 + 1991 + + + The dock of the bay + Otis Redding + USA + Atlantic + 7.90 + 1987 + + + Picture book + Simply Red + EU + Elektra + 7.20 + 1985 + + + Red + The Communards + UK + London + 7.80 + 1987 + + + Unchain my heart + Joe Cocker + USA + EMI + 8.20 + 1987 + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/extdata/order-doc.xml b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/extdata/order-doc.xml new file mode 100644 index 00000000..b97c0f92 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/extdata/order-doc.xml @@ -0,0 +1,32 @@ + + + + Alice Smith + 123 Maple Street + Mill Valley + CA + 90952 + + + Robert Smith + 8 Oak Avenue + Old Town + PA + 95819 + + Hurry, my lawn is going wild! + + + Lawnmower + 1 + 148.95 + Confirm this is electric + + + Baby Monitor + 1 + 39.98 + 1999-05-21 + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/extdata/order-schema.xml b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/extdata/order-schema.xml new file mode 100644 index 00000000..685d31c7 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/extdata/order-schema.xml @@ -0,0 +1,76 @@ + + + + Purchase order schema for Example.com. + Copyright 2000 Example.com. All rights reserved. + + + + + + + + + + + + + + + + + + + + + Purchase order schema for Example.Microsoft.com. + Copyright 2001 Example.Microsoft.com. All rights reserved. + + + Application info. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/extdata/r-project.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/extdata/r-project.html new file mode 100644 index 00000000..eefffb20 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/extdata/r-project.html @@ -0,0 +1,102 @@ + + + + + + + R: The R Project for Statistical Computing + + + + + + + + + + + + + +
+
+ +
+

The R Project for Statistical Computing

+

Getting Started

+

R is a free software environment for statistical computing and graphics. It compiles and runs on a wide variety of UNIX platforms, Windows and MacOS. To download R, please choose your preferred CRAN mirror.

+

If you have questions about R like how to download and install the software, or what the license terms are, please read our answers to frequently asked questions before you send an email.

+

News

+
    +
  • R 3.2.0 (Full of Ingredients) prerelease versions will appear starting March 19. Final release is scheduled for 2015-04-16.

  • +
  • R version 3.1.3 (Smooth Sidewalk) has been released on 2015-03-09.

  • +
  • The R Journal Volume 6/2 is available.

  • +
  • R version 3.1.2 (Pumpkin Helmet) has been released on 2014-10-31.

  • +
  • useR! 2015, will take place at the University of Aalborg, Denmark, June 30 - July 3, 2015.

  • +
  • useR! 2014, took place at the University of California, Los Angeles, USA June 30 - July 3, 2014.

  • +
+ +
+
+ +
+ + + + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/AnIndex new file mode 100644 index 00000000..a4671b0f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/AnIndex @@ -0,0 +1,79 @@ +xml2-package xml2-package +as_list as_list +as_xml_document as_xml_document +download_html download_xml +download_xml download_xml +html_structure xml_structure +read_html read_xml +read_xml read_xml +read_xml.character read_xml +read_xml.connection read_xml +read_xml.raw read_xml +url_absolute url_absolute +url_escape url_escape +url_parse url_parse +url_relative url_absolute +url_unescape url_escape +write_html write_xml +write_html.xml_document write_xml +write_xml write_xml +write_xml.xml_document write_xml +xml2 xml2-package +xml2_example xml2_example +xml_add_child xml_replace +xml_add_parent xml_replace +xml_add_sibling xml_replace +xml_attr xml_attr +xml_attr<- xml_attr +xml_attrs xml_attr +xml_attrs<- xml_attr +xml_cdata xml_cdata +xml_child xml_children +xml_children xml_children +xml_comment xml_comment +xml_contents xml_children +xml_document-class oldclass +xml_double xml_text +xml_dtd xml_dtd +xml_find_all xml_find_all +xml_find_all.xml_nodeset xml_find_all +xml_find_chr xml_find_all +xml_find_first xml_find_all +xml_find_int xml_find_all +xml_find_lgl xml_find_all +xml_find_num xml_find_all +xml_find_one xml_find_all +xml_has_attr xml_attr +xml_integer xml_text +xml_length xml_children +xml_missing xml_missing +xml_missing-class oldclass +xml_name xml_name +xml_name<- xml_name +xml_new_document xml_new_document +xml_new_root xml_new_document +xml_node-class oldclass +xml_nodeset-class oldclass +xml_ns xml_ns +xml_ns_rename xml_ns +xml_ns_strip xml_ns_strip +xml_parent xml_children +xml_parents xml_children +xml_path xml_path +xml_remove xml_replace +xml_replace xml_replace +xml_root xml_children +xml_serialize xml_serialize +xml_set_attr xml_attr +xml_set_attrs xml_attr +xml_set_name xml_name +xml_set_namespace xml_set_namespace +xml_set_text xml_text +xml_siblings xml_children +xml_structure xml_structure +xml_text xml_text +xml_text<- xml_text +xml_type xml_type +xml_unserialize xml_serialize +xml_url xml_url +xml_validate xml_validate diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/aliases.rds new file mode 100644 index 00000000..865ff47e Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-archived.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-archived.svg new file mode 100644 index 00000000..745ab0c7 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-archived.svg @@ -0,0 +1,21 @@ + + lifecycle: archived + + + + + + + + + + + + + + + lifecycle + + archived + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-defunct.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-defunct.svg new file mode 100644 index 00000000..d5c9559e --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-defunct.svg @@ -0,0 +1,21 @@ + + lifecycle: defunct + + + + + + + + + + + + + + + lifecycle + + defunct + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-deprecated.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-deprecated.svg new file mode 100644 index 00000000..b61c57c3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-deprecated.svg @@ -0,0 +1,21 @@ + + lifecycle: deprecated + + + + + + + + + + + + + + + lifecycle + + deprecated + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-experimental.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-experimental.svg new file mode 100644 index 00000000..5d88fc2c --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-experimental.svg @@ -0,0 +1,21 @@ + + lifecycle: experimental + + + + + + + + + + + + + + + lifecycle + + experimental + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-maturing.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-maturing.svg new file mode 100644 index 00000000..897370ec --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-maturing.svg @@ -0,0 +1,21 @@ + + lifecycle: maturing + + + + + + + + + + + + + + + lifecycle + + maturing + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-questioning.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-questioning.svg new file mode 100644 index 00000000..7c1721d0 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-questioning.svg @@ -0,0 +1,21 @@ + + lifecycle: questioning + + + + + + + + + + + + + + + lifecycle + + questioning + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-soft-deprecated.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-soft-deprecated.svg new file mode 100644 index 00000000..9c166ff3 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-soft-deprecated.svg @@ -0,0 +1,21 @@ + + lifecycle: soft-deprecated + + + + + + + + + + + + + + + lifecycle + + soft-deprecated + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-stable.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-stable.svg new file mode 100644 index 00000000..9bf21e76 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-stable.svg @@ -0,0 +1,29 @@ + + lifecycle: stable + + + + + + + + + + + + + + + + lifecycle + + + + stable + + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-superseded.svg b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-superseded.svg new file mode 100644 index 00000000..db8d757f --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/figures/lifecycle-superseded.svg @@ -0,0 +1,21 @@ + + lifecycle: superseded + + + + + + + + + + + + + + + lifecycle + + superseded + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/paths.rds new file mode 100644 index 00000000..05a85b2c Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/xml2.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/xml2.rdb new file mode 100644 index 00000000..25d1eb2c Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/xml2.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/xml2.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/xml2.rdx new file mode 100644 index 00000000..befcb356 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/help/xml2.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/html/00Index.html new file mode 100644 index 00000000..8f97e4d2 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/html/00Index.html @@ -0,0 +1,171 @@ + + +R: Parse XML + + + +
+

Parse XML + +

+
+
+[Up] +[Top] +

Documentation for package ‘xml2’ version 1.3.6

+ + + +

Help Pages

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
as_listCoerce xml nodes to a list.
as_xml_documentCoerce a R list to xml nodes.
download_htmlDownload a HTML or XML file
download_xmlDownload a HTML or XML file
html_structureShow the structure of an html/xml document.
read_htmlRead HTML or XML.
read_xmlRead HTML or XML.
read_xml.characterRead HTML or XML.
read_xml.connectionRead HTML or XML.
read_xml.rawRead HTML or XML.
url_absoluteConvert between relative and absolute urls.
url_escapeEscape and unescape urls.
url_parseParse a url into its component pieces.
url_relativeConvert between relative and absolute urls.
url_unescapeEscape and unescape urls.
write_htmlWrite XML or HTML to disk.
write_html.xml_documentWrite XML or HTML to disk.
write_xmlWrite XML or HTML to disk.
write_xml.xml_documentWrite XML or HTML to disk.
xml2_exampleGet path to a xml2 example
xml_add_childModify a tree by inserting, replacing or removing nodes
xml_add_parentModify a tree by inserting, replacing or removing nodes
xml_add_siblingModify a tree by inserting, replacing or removing nodes
xml_attrRetrieve an attribute.
xml_attr<-Retrieve an attribute.
xml_attrsRetrieve an attribute.
xml_attrs<-Retrieve an attribute.
xml_cdataConstruct a cdata node
xml_childNavigate around the family tree.
xml_childrenNavigate around the family tree.
xml_commentConstruct a comment node
xml_contentsNavigate around the family tree.
xml_doubleExtract or modify the text
xml_dtdConstruct a document type definition
xml_find_allFind nodes that match an xpath expression.
xml_find_all.xml_nodesetFind nodes that match an xpath expression.
xml_find_chrFind nodes that match an xpath expression.
xml_find_firstFind nodes that match an xpath expression.
xml_find_intFind nodes that match an xpath expression.
xml_find_lglFind nodes that match an xpath expression.
xml_find_numFind nodes that match an xpath expression.
xml_find_oneFind nodes that match an xpath expression.
xml_has_attrRetrieve an attribute.
xml_integerExtract or modify the text
xml_lengthNavigate around the family tree.
xml_nameThe (tag) name of an xml element.
xml_name<-The (tag) name of an xml element.
xml_new_documentCreate a new document, possibly with a root node
xml_new_rootCreate a new document, possibly with a root node
xml_nsXML namespaces.
xml_ns_renameXML namespaces.
xml_ns_stripStrip the default namespaces from a document
xml_parentNavigate around the family tree.
xml_parentsNavigate around the family tree.
xml_pathRetrieve the xpath to a node
xml_removeModify a tree by inserting, replacing or removing nodes
xml_replaceModify a tree by inserting, replacing or removing nodes
xml_rootNavigate around the family tree.
xml_serializeSerializing XML objects to connections.
xml_set_attrRetrieve an attribute.
xml_set_attrsRetrieve an attribute.
xml_set_nameThe (tag) name of an xml element.
xml_set_namespaceSet the node's namespace
xml_set_textExtract or modify the text
xml_siblingsNavigate around the family tree.
xml_structureShow the structure of an html/xml document.
xml_textExtract or modify the text
xml_text<-Extract or modify the text
xml_typeDetermine the type of a node.
xml_unserializeSerializing XML objects to connections.
xml_urlThe URL of an XML document
xml_validateValidate XML schema
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/include/xml2_types.h b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/include/xml2_types.h new file mode 100644 index 00000000..88356025 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/include/xml2_types.h @@ -0,0 +1,95 @@ +#ifndef __XML2_XML2_TYPES__ +#define __XML2_XML2_TYPES__ + +#include +#define R_NO_REMAP +#include + +template class XPtr { + protected: + SEXP data_; + + public: + XPtr(SEXP x) : data_(x) { + if (TYPEOF(data_) != EXTPTRSXP) { + Rf_error("Expecting an external pointer: [type=%s]", Rf_type2char(TYPEOF(data_))); + } + R_PreserveObject(data_); + } + + XPtr(T* p) { + data_ = R_MakeExternalPtr((void *) p, R_NilValue, R_NilValue); + R_PreserveObject(data_); + } + + XPtr(const XPtr &old) { + data_ = old.data_; + R_PreserveObject(data_); + } + + XPtr& operator=(const XPtr &other) { + R_PreserveObject(other.data_); + if (data_ != NULL) { + R_ReleaseObject(data_); + } + data_ = other.data_; + return *this; + } + + operator SEXP() const { return data_; } + + T* get() const { + return (T*)(R_ExternalPtrAddr(data_)); + } + + T* checked_get() const { + T* ptr = get(); + if (ptr == NULL) { + Rf_error("external pointer is not valid"); + } + return ptr; + } + + operator T*() { + return checked_get(); + } + + T* operator->() const { + return checked_get(); + } + + ~XPtr() { + R_ReleaseObject(data_); + } +}; + + +class XPtrDoc : public ::XPtr { + static void finalizeXPtrDoc(SEXP p) { + if (TYPEOF(p) != EXTPTRSXP) { + return; + } + + xmlDoc* ptr = (xmlDoc*) R_ExternalPtrAddr(p); + + if (ptr == NULL) { + return; + } + + R_ClearExternalPtr(p); + + xmlFreeDoc(ptr); + } + + public: + XPtrDoc(xmlDoc* p) : ::XPtr(p) { + R_RegisterCFinalizerEx(data_, finalizeXPtrDoc, (Rboolean) false); + } + + XPtrDoc(SEXP x) : ::XPtr(x) {} +}; + +typedef ::XPtr XPtrNode; +typedef ::XPtr XPtrNs; + +#endif diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/libs/xml2.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/libs/xml2.so new file mode 100755 index 00000000..fc1c3c01 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/libs/xml2.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/libs/xml2.so.dSYM/Contents/Info.plist b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/libs/xml2.so.dSYM/Contents/Info.plist new file mode 100644 index 00000000..94ba38df --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/libs/xml2.so.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.xml2.so + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/libs/xml2.so.dSYM/Contents/Resources/DWARF/xml2.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/libs/xml2.so.dSYM/Contents/Resources/DWARF/xml2.so new file mode 100644 index 00000000..1659c096 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/xml2/libs/xml2.so.dSYM/Contents/Resources/DWARF/xml2.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/CHANGELOG b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/CHANGELOG new file mode 100644 index 00000000..a44de9da --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/CHANGELOG @@ -0,0 +1,180 @@ +### Release Notes +v2.3.8 added verbatim_logical helper function + +v2.3.7 clang deprecated sprintf. Changed in included clib to snprintf + +v2.3.6 C deprecated functions with no prototypes, these were added. + +v2.3.5 Patch to put back in libyaml modifications that as.yaml relied on. + +v2.3.4 + - Added read_yaml parameter readLines.warn that defaults to TRUE for overrriding warnings about incomplete files. + +v2.3.3 + -Fixed Bug #99, support for BUILTINSXP functions as handlers + +v2.3.2 + - Removed some code that got revert in the libyaml 0.2.5 merge at 2.2.4 release + +v2.3.1 + - Added omap support for output using proper tag. + +v2.3.0 + - Made eval.expr default to FALSE + +v2.2.4 + - Updated libyaml code from 0.2.5 + +v2.2.3 + - Added attribute quote support for strings #72 #109 + +v2.2.2 + - change maintainer from Jeremy Stephens to Shawn Garbett + - move Git repository to https://github.com/vubiostat/r-yaml + +v2.2.1 + - add merge.precedence option to yaml.load + - fix improper handling of explicit '!bool' tag (reported by Luke Goodsell) + - fix memory issue flagged by valgrind + - update LibYAML to 0.2.2 + - fix some -Wall warnings to appease CRAN + +v2.2.0 + - add custom handlers to as.yaml + - add processing of 'verbatim' class in as.yaml + - add processing of 'tag' class in as.yaml + - change examples/tests to write to tempfiles to appease CRAN + - fix as.yaml representation of very small negative floating point numbers + (reported by Ryan Welch) + - properly ignore a map key that would override a key from a merged map + (reported by Bradley Saul) + - gracefully fail compilation if GCC fast-math flag is enabled (reported by + Dmitriy Selivanov) + - switch from testthat to RUnit for unit testing since RUnit has fewer + dependencies and does not require compilation + +v2.1.19 + - fix unserialization issues with int#base60 tag (reported by Nancy Irisarri) + - add eval.expr option to yaml.load function + - fix issue with error.label argument (patch by Gregory R. Warnes) + - fix a few garbage collection protection issues + +v2.1.18 + - fix protection stack bugs (reported by Rich FitzJohn) + +v2.1.17 + - rewrite parsing functionality using pairlists instead of a self-managed + protection stack in order to appease rchk + - use MARK_NOT_MUTABLE instead of SET_NAMED, which is deprecated + - show warning when duplicate map key is ignored during a merge + +v2.1.16 + - fix error checking bug regarding number conversions + +v2.1.15 + - improve handling of UTF-8 encoded files + - add Github URL to description file + - add `read_yaml` and `write_yaml` convenience functions + - add `error.label` parameter to `yaml.load` and `yaml.load_file` + - recognize floating point numbers without leading 0 + - fix nested list issue + - show warning for integer/real overflow + +v2.1.14 + - mark character input/output as UTF-8 (patch submitted by Yihui Xie) + - update LibYAML to 0.1.7 + +v2.1.13 + - fix integer overflow issue + - explicitly cast pointers from char to yaml_char_t, and vice versa + +v2.1.12 + - properly emit factors with NAs (bug submitted by Jenny Bryan) + - update LibYAML to 0.1.6 + +v2.1.11 + - update LibYAML to 0.1.5 + +v2.1.10 + - properly escape names in data frames and lists (bug submitted + by Paul Hodor) + - remove extra digit in Windows when formatting exponential numbers + +v2.1.9 + - CRAN maintainers changed memcpy to memmove + +v2.1.8 + - properly emit and consume numeric values in scientific + notiation (bug submitted by Gergely Daróczi) + - add 'precision' argument to as.yaml to control how many digits + are printed when emitting + +v2.1.7 + - properly emit and consume special values: Inf, -Inf, NaN, NA, TRUE, + and FALSE (bug submitted by Richard Cotton) + - Inf is emitted as '.inf' + - -Inf as '-.inf' + - NaN as '.nan' + - TRUE is now emitted as 'yes', and FALSE as 'no' + - because the YAML specification does not specify how to handle NA values, + the various NA types are emitted as follows: + - NA: .na + - NA_real_: .na.real + - NA_integer_: .na.integer + - NA_character_: .na.character + +v2.1.6 + - add unicode option to as.yaml() (bug submissions by Gergely Daróczi + and Aleksandar Blagotić) + +v2.1.5 + - fix yaml.load() ignoring explicit quotes around strings (bug submitted + by Jonas Zimmermann) + - fix as.yaml() not quoting strings that need to be quoted + +v2.1.4 + - replace lang5() function for backwards compatibility with R < 2.12.0 + (bug submitted by Philipp Hofmann) + +v2.1.3 + - fix as.yaml() converting numeric vectors incorrectly (bug submitted + by Markus Göker) + +v2.1.2 + - fix multiple anchor bug (bug submitted by apshaar) + +v2.1.1 + - remove redundant yaml-package help page + - fix solaris compilation error + - remove printf/assert symbols from the compiled library + +v2.1.0 + - re-wrote as.yaml in C (using libyaml's emitter) + - removed the `pre.indent` option to as.yaml, mainly because libyaml + doesn't support pre-indention and I'm not sure the option is useful + anymore; will revisit if requested + +v2.0.0 + - switch from the Syck parser to the libyaml (0.1.4) parser + - changed behavior: + - sequences of sequences no longer collapse when they contain the same + type; ex: yaml.load("[1, [2, 3], 4]") returns list(1L, c(2L, 3L), 4L) + +v1.2.0 + - added support for loading R expressions (using the !expr tag) + - added multiline string support + - added support for nameless lists in as.yaml (converts to a sequence) + +v1.1.0 + - added support for omaps + - added yaml.load_file function to read from files/connections + - using format instead of as.character now in as.yaml.default + +v1.0.2 + - fixed as.yaml bug where a nested empty list wasn't converted correctly + +v1.0.1 + - yaml.load will now load empty documents (bug submitted by Jeff Klingner) + - as.yaml will return '[]' for empty objects (patch submitted by Brendan O'Connor) + - as.yaml will now create valid YAML for a list that contains a list of length + one (bug submitted by Gabor Grothendieck) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/DESCRIPTION b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/DESCRIPTION new file mode 100644 index 00000000..96ca6b7a --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/DESCRIPTION @@ -0,0 +1,28 @@ +Package: yaml +Type: Package +Title: Methods to Convert R Data to YAML and Back +Date: 2024-07-22 +Version: 2.3.10 +Suggests: RUnit +Author: Shawn P Garbett [aut], Jeremy Stephens [aut, cre], Kirill Simonov [aut], Yihui Xie [ctb], + Zhuoer Dong [ctb], Hadley Wickham [ctb], Jeffrey Horner [ctb], reikoch [ctb], + Will Beasley [ctb], Brendan O'Connor [ctb], Gregory R. Warnes [ctb], + Michael Quinn [ctb], Zhian N. Kamvar [ctb], Charlie Gao [ctb] +Maintainer: Shawn Garbett +License: BSD_3_clause + file LICENSE +Description: Implements the 'libyaml' 'YAML' 1.1 parser and emitter + () for R. +URL: https://github.com/vubiostat/r-yaml/ +BugReports: https://github.com/vubiostat/r-yaml/issues +NeedsCompilation: yes +Packaged: 2024-07-22 15:44:18 UTC; garbetsp +Repository: CRAN +Date/Publication: 2024-07-26 15:10:02 UTC +Built: R 4.4.1; aarch64-apple-darwin20; 2025-02-01 04:44:25 UTC; unix +Archs: yaml.so.dSYM +RemoteType: standard +RemotePkgRef: yaml +RemoteRef: yaml +RemoteRepos: https://cloud.r-project.org/ +RemotePkgPlatform: aarch64-apple-darwin20 +RemoteSha: 2.3.10 diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/INDEX b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/INDEX new file mode 100644 index 00000000..031fb587 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/INDEX @@ -0,0 +1,5 @@ +as.yaml Convert an R object into a YAML string +read_yaml Read a YAML file +verbatim_logical Alternative logical handler +write_yaml Write a YAML file +yaml.load Convert a YAML string into R objects diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/LICENSE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/LICENSE new file mode 100644 index 00000000..5e1791af --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/LICENSE @@ -0,0 +1,3 @@ +YEAR: 2008-2022 +COPYRIGHT HOLDER: Vanderbilt University Medical Center +ORGANIZATION: Vanderbilt University Medical Center diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/Meta/Rd.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/Meta/Rd.rds new file mode 100644 index 00000000..d55339b4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/Meta/Rd.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/Meta/features.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/Meta/features.rds new file mode 100644 index 00000000..781f60d4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/Meta/features.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/Meta/hsearch.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/Meta/hsearch.rds new file mode 100644 index 00000000..500f59a4 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/Meta/hsearch.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/Meta/links.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/Meta/links.rds new file mode 100644 index 00000000..038979b7 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/Meta/links.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/Meta/nsInfo.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/Meta/nsInfo.rds new file mode 100644 index 00000000..9e86a635 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/Meta/nsInfo.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/Meta/package.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/Meta/package.rds new file mode 100644 index 00000000..2d7f81de Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/Meta/package.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/NAMESPACE b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/NAMESPACE new file mode 100644 index 00000000..fa22d6d1 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/NAMESPACE @@ -0,0 +1,2 @@ +useDynLib(yaml, .registration = TRUE, .fixes = "C_") +export(as.yaml, yaml.load_file, yaml.load, read_yaml, write_yaml, verbatim_logical) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/R/yaml b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/R/yaml new file mode 100644 index 00000000..66861563 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/R/yaml @@ -0,0 +1,27 @@ +# File share/R/nspackloader.R +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2012 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.r-project.org/Licenses/ + +local({ + info <- loadingNamespaceInfo() + pkg <- info$pkgname + ns <- .getNamespace(as.name(pkg)) + if (is.null(ns)) + stop("cannot find namespace environment for ", pkg, domain = NA); + dbbase <- file.path(info$libname, pkg, "R", pkg) + lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.") +}) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/R/yaml.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/R/yaml.rdb new file mode 100644 index 00000000..e6049ec5 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/R/yaml.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/R/yaml.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/R/yaml.rdx new file mode 100644 index 00000000..ddb3be65 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/R/yaml.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/THANKS b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/THANKS new file mode 100644 index 00000000..32bcd9ef --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/THANKS @@ -0,0 +1,13 @@ +Thanks to the following people for helping out: +- Jeff Horner, for general advice and incorporating the syck parser into this package + +Patches submitted by: +- Brendan O'Connor (dfe10f6) +- Yihui Xie (d8e65c2, 069bb89, 0e34af1..67496b6) +- reikoch (ce28a1e) +- Hadley Wickham (867d1b0) +- Will Beasley (edefae9) +- Zhuoer Dong (8febaba..28c89f4, 0e34af1) +- Gregory R. Warnes (e3bf914) +- Michael Quinn (9e16411) +- Zhian N. Kamvar (405073b) diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/help/AnIndex b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/help/AnIndex new file mode 100644 index 00000000..57c9a5c8 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/help/AnIndex @@ -0,0 +1,6 @@ +as.yaml as.yaml +read_yaml read_yaml +verbatim_logical verbatim_logical +write_yaml write_yaml +yaml.load yaml.load +yaml.load_file yaml.load diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/help/aliases.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/help/aliases.rds new file mode 100644 index 00000000..0029943c Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/help/aliases.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/help/paths.rds b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/help/paths.rds new file mode 100644 index 00000000..f232f715 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/help/paths.rds differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/help/yaml.rdb b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/help/yaml.rdb new file mode 100644 index 00000000..beec94ad Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/help/yaml.rdb differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/help/yaml.rdx b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/help/yaml.rdx new file mode 100644 index 00000000..477ddd2c Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/help/yaml.rdx differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/html/00Index.html b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/html/00Index.html new file mode 100644 index 00000000..798e83f7 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/html/00Index.html @@ -0,0 +1,37 @@ + + +R: Methods to Convert R Data to YAML and Back + + + +
+

Methods to Convert R Data to YAML and Back + +

+
+
+[Up] +[Top] +

Documentation for package ‘yaml’ version 2.3.10

+ + + +

Help Pages

+ + + + + + + + + + + + + + + +
as.yamlConvert an R object into a YAML string
read_yamlRead a YAML file
verbatim_logicalAlternative logical handler
write_yamlWrite a YAML file
yaml.loadConvert a YAML string into R objects
yaml.load_fileConvert a YAML string into R objects
+
diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/html/R.css b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/html/R.css new file mode 100644 index 00000000..c2289098 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/html/R.css @@ -0,0 +1,130 @@ +@media screen { + .container { + padding-right: 10px; + padding-left: 10px; + margin-right: auto; + margin-left: auto; + max-width: 900px; + } +} + +.rimage img { /* from knitr - for examples and demos */ + width: 96%; + margin-left: 2%; +} + +.katex { font-size: 1.1em; } + +code { + color: inherit; + background: inherit; +} + +body { + line-height: 1.4; + background: white; + color: black; +} + +a:link { + background: white; + color: blue; +} + +a:visited { + background: white; + color: rgb(50%, 0%, 50%); +} + +h1 { + background: white; + color: rgb(55%, 55%, 55%); + font-family: monospace; + font-size: 1.4em; /* x-large; */ + text-align: center; +} + +h2 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ + text-align: center; +} + +h3 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-size: 1.2em; /* large; */ +} + +h4 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; + font-size: 1.2em; /* large; */ +} + +h5 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; +} + +h6 { + background: white; + color: rgb(40%, 40%, 40%); + font-family: monospace; + font-style: italic; +} + +img.toplogo { + width: 4em; + vertical-align: middle; +} + +img.arrow { + width: 30px; + height: 30px; + border: 0; +} + +span.acronym { + font-size: small; +} + +span.env { + font-family: monospace; +} + +span.file { + font-family: monospace; +} + +span.option{ + font-family: monospace; +} + +span.pkg { + font-weight: bold; +} + +span.samp{ + font-family: monospace; +} + +div.vignettes a:hover { + background: rgb(85%, 85%, 85%); +} + +tr { + vertical-align: top; +} + +span.rlang { + font-family: Courier New, Courier; + color: #666666; +} + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/implicit.re b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/implicit.re new file mode 100644 index 00000000..b2fa2276 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/implicit.re @@ -0,0 +1,105 @@ +#include "yaml.h" + +char *Ryaml_find_implicit_tag(const char *str, size_t len) +{ + /* This bit was taken from implicit.re, which is in the Syck library. + * + * Copyright (C) 2003 why the lucky stiff */ + + const char *cursor, *marker; + cursor = str; + +/*!re2c + +re2c:define:YYCTYPE = "char"; +re2c:define:YYCURSOR = cursor; +re2c:define:YYMARKER = marker; +re2c:yyfill:enable = 0; + +NULL = [\000] ; +ANY = [\001-\377] ; +DIGIT = [0-9] ; +DIGITSC = [0-9,] ; +DIGITSP = [0-9.] ; +YEAR = DIGIT DIGIT DIGIT DIGIT ; +MON = DIGIT DIGIT ; +SIGN = [-+] ; +HEX = [0-9a-fA-F,] ; +OCT = [0-7,] ; +INTHEX = SIGN? "0x" HEX+ ; +INTOCT = SIGN? "0" OCT+ ; +INTSIXTY = SIGN? DIGIT DIGITSC* ( ":" [0-5]? DIGIT )+ ; +INTCANON = SIGN? ( "0" | [1-9] DIGITSC* ) ; +FLOATFIX = SIGN? ( DIGIT DIGITSC* )? "." DIGITSC* ; +FLOATEXP = SIGN? ( DIGIT DIGITSC* )? "." DIGITSP* [eE] SIGN DIGIT+ ; +FLOATSIXTY = SIGN? DIGIT DIGITSC* ( ":" [0-5]? DIGIT )+ "." DIGITSC* ; +INF = ( "inf" | "Inf" | "INF" ) ; +FLOATINF = [+]? "." INF ; +FLOATNEGINF = [-] "." INF ; +FLOATNAN = "." ( "nan" | "NaN" | "NAN" ) ; +NULLTYPE = ( "~" | "null" | "Null" | "NULL" )? ; +BOOLYES = ( "y" | "Y" | "yes" | "Yes" | "YES" | "true" | "True" | "TRUE" | "on" | "On" | "ON" ) ; +BOOLNO = ( "n" | "N" | "no" | "No" | "NO" | "false" | "False" | "FALSE" | "off" | "Off" | "OFF" ) ; +INTNA = ".na.integer" ; +FLOATNA = ".na.real" ; +STRNA = ".na.character" ; +BOOLNA = ".na" ; +TIMEZ = ( "Z" | [-+] DIGIT DIGIT ( ":" DIGIT DIGIT )? ) ; +TIMEYMD = YEAR "-" MON "-" MON ; +TIMEISO = YEAR "-" MON "-" MON [Tt] MON ":" MON ":" MON ( "." DIGIT* )? TIMEZ ; +TIMESPACED = YEAR "-" MON "-" MON [ \t]+ MON ":" MON ":" MON ( "." DIGIT* )? [ \t]+ TIMEZ ; +TIMECANON = YEAR "-" MON "-" MON "T" MON ":" MON ":" MON ( "." DIGIT* [1-9]+ )? "Z" ; +MERGE = "<<" ; +DEFAULTKEY = "=" ; + +NULLTYPE NULL { return "null"; } + +BOOLYES NULL { return "bool#yes"; } + +BOOLNO NULL { return "bool#no"; } + +BOOLNA NULL { return "bool#na"; } + +INTHEX NULL { return "int#hex"; } + +INTOCT NULL { return "int#oct"; } + +INTSIXTY NULL { return "int#base60"; } + +INTNA NULL { return "int#na"; } + +INTCANON NULL { return "int"; } + +FLOATFIX NULL { return "float#fix"; } + +FLOATEXP NULL { return "float#exp"; } + +FLOATSIXTY NULL { return "float#base60"; } + +FLOATINF NULL { return "float#inf"; } + +FLOATNEGINF NULL { return "float#neginf"; } + +FLOATNAN NULL { return "float#nan"; } + +FLOATNA NULL { return "float#na"; } + +TIMEYMD NULL { return "timestamp#ymd"; } + +TIMEISO NULL { return "timestamp#iso8601"; } + +TIMESPACED NULL { return "timestamp#spaced"; } + +TIMECANON NULL { return "timestamp"; } + +STRNA NULL { return "str#na"; } + +DEFAULTKEY NULL { return "default"; } + +MERGE NULL { return "merge"; } + +ANY { return "str"; } + +*/ + +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/libs/yaml.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/libs/yaml.so new file mode 100755 index 00000000..6ab0ea6b Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/libs/yaml.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/libs/yaml.so.dSYM/Contents/Info.plist b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/libs/yaml.so.dSYM/Contents/Info.plist new file mode 100644 index 00000000..3d0c48c1 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/libs/yaml.so.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.yaml.so + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/libs/yaml.so.dSYM/Contents/Resources/DWARF/yaml.so b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/libs/yaml.so.dSYM/Contents/Resources/DWARF/yaml.so new file mode 100644 index 00000000..8d294373 Binary files /dev/null and b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/libs/yaml.so.dSYM/Contents/Resources/DWARF/yaml.so differ diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/tests/files/merge.yml b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/tests/files/merge.yml new file mode 100644 index 00000000..dc7b8bd2 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/tests/files/merge.yml @@ -0,0 +1,27 @@ +--- +- &CENTER { x: 1, "y": 2 } +- &LEFT { x: 0, "y": 2 } +- &BIG { r: 10 } +- &SMALL { r: 1 } + +# All the following maps are equal: + +- # Explicit keys + x: 1 + "y": 2 + r: 10 + label: center/big + +- # Merge one map + << : *CENTER + r: 10 + label: center/big + +- # Merge multiple maps + << : [ *CENTER, *BIG ] + label: center/big + +- # Override + << : [ *BIG, *LEFT, *SMALL ] + x: 1 + label: center/big diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/tests/files/test.yml b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/tests/files/test.yml new file mode 100644 index 00000000..1f42ad40 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/tests/files/test.yml @@ -0,0 +1,18 @@ +foo: &foo + one: 1 + two: 2 +bar: &bar + three: 3 + four: 4 +baz: + - *foo + - *bar +quux: &quux + <<: *foo + <<: *bar + five: 5 + six: 6 +corge: + - *quux + - xyzzy: + <<: *quux diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/tests/test_as_yaml.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/tests/test_as_yaml.R new file mode 100644 index 00000000..2fde5c41 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/tests/test_as_yaml.R @@ -0,0 +1,457 @@ +test_named_list_is_converted <- function() { + checkEquals("foo: bar\n", as.yaml(list(foo="bar"))) + + x <- list(foo=1:10, bar=c("junk", "test")) + y <- yaml.load(as.yaml(x)) + checkEquals(y$foo, x$foo) + checkEquals(y$bar, x$bar) + + x <- list(foo=1:10, bar=list(foo=11:20, bar=letters[1:10])) + y <- yaml.load(as.yaml(x)) + checkEquals(x$foo, y$foo) + checkEquals(x$bar$foo, y$bar$foo) + checkEquals(x$bar$bar, y$bar$bar) + + # nested lists + x <- list(foo = list(a = 1, b = 2), bar = list(b = 4)) + y <- yaml.load(as.yaml(x)) + checkEquals(x$foo$a, y$foo$a) + checkEquals(x$foo$b, y$foo$b) + checkEquals(x$bar$b, y$bar$b) +} + +test_data_frame_is_converted <- function() { + x <- data.frame(a=1:10, b=letters[1:10], c=11:20) + y <- as.data.frame(yaml.load(as.yaml(x))) + checkEquals(x$a, y$a) + checkEquals(x$b, y$b) + checkEquals(x$c, y$c) + + x <- as.yaml(x, column.major = FALSE) + y <- yaml.load(x) + checkEquals(5L, y[[5]]$a) + checkEquals("e", y[[5]]$b) + checkEquals(15L, y[[5]]$c) +} + +test_empty_nested_list_is_converted <- function() { + x <- list(foo=list()) + checkEquals("foo: []\n", as.yaml(x)) +} + +test_empty_nested_data_frame_is_converted <- function() { + x <- list(foo=data.frame()) + checkEquals("foo: {}\n", as.yaml(x)) +} + +test_empty_nested_vector_is_converted <- function() { + x <- list(foo=character()) + checkEquals("foo: []\n", as.yaml(x)) +} + +test_list_is_converted_as_omap <- function() { + x <- list(a=1:2, b=3:4) + expected <- "!!omap\n- a:\n - 1\n - 2\n- b:\n - 3\n - 4\n" + checkEquals(expected, as.yaml(x, omap=TRUE)) +} + +test_nested_list_is_converted_as_omap <- function() { + x <- list(a=list(c=list(e=1L, f=2L)), b=list(d=list(g=3L, h=4L))) + expected <- "!!omap\n- a: !!omap\n - c: !!omap\n - e: 1\n - f: 2\n- b: !!omap\n - d: !!omap\n - g: 3\n - h: 4\n" + checkEquals(expected, as.yaml(x, omap=TRUE)) +} + +test_omap_is_loaded <- function() { + x <- yaml.load(as.yaml(list(a=1:2, b=3:4, c=5:6, d=7:8), omap=TRUE)) + checkEquals(c("a", "b", "c", "d"), names(x)) +} + +test_numeric_is_converted_correctly <- function() { + result <- as.yaml(c(1, 5, 10, 15)) + checkEquals(result, "- 1.0\n- 5.0\n- 10.0\n- 15.0\n", label = result) +} + +test_multiline_string_is_converted <- function() { + checkEquals("|-\n foo\n bar\n", as.yaml("foo\nbar")) + checkEquals("- foo\n- |-\n bar\n baz\n", as.yaml(c("foo", "bar\nbaz"))) + checkEquals("foo: |-\n foo\n bar\n", as.yaml(list(foo = "foo\nbar"))) + checkEquals("a:\n- foo\n- bar\n- |-\n baz\n quux\n", as.yaml(data.frame(a = c('foo', 'bar', 'baz\nquux')))) +} + +test_function_is_converted <- function() { + x <- function() { runif(100) } + expected <- "!expr |\n function ()\n {\n runif(100)\n }\n" + result <- as.yaml(x) + checkEquals(expected, result) +} + +test_list_with_unnamed_items_is_converted <- function() { + x <- list(foo=list(list(a = 1L, b = 2L), list(a = 3L, b = 4L))) + expected <- "foo:\n- a: 1\n b: 2\n- a: 3\n b: 4\n" + result <- as.yaml(x) + checkEquals(result, expected) +} + +test_pound_signs_are_escaped_in_strings <- function() { + result <- as.yaml("foo # bar") + checkEquals("'foo # bar'\n", result) +} + +test_null_is_converted <- function() { + checkEquals("~\n", as.yaml(NULL)) +} + +test_different_line_seps_are_used <- function() { + result <- as.yaml(c('foo', 'bar'), line.sep = "\n") + checkEquals("- foo\n- bar\n", result) + + result <- as.yaml(c('foo', 'bar'), line.sep = "\r\n") + checkEquals("- foo\r\n- bar\r\n", result) + + result <- as.yaml(c('foo', 'bar'), line.sep = "\r") + checkEquals("- foo\r- bar\r", result) +} + +test_custom_indent_is_used <- function() { + result <- as.yaml(list(foo=list(bar=list('foo', 'bar'))), indent = 3) + checkEquals("foo:\n bar:\n - foo\n - bar\n", result) +} + +test_block_sequences_in_mapping_context_are_indented_when_option_is_true <- function() { + result <- as.yaml(list(foo=list(bar=list('foo', 'bar'))), indent.mapping.sequence = TRUE) + checkEquals("foo:\n bar:\n - foo\n - bar\n", result) +} + +test_indent_value_is_validated <- function() { + checkException(as.yaml(list(foo=list(bar=list('foo', 'bar'))), indent = 0)) +} + +test_strings_are_escaped_properly <- function() { + result <- as.yaml("12345") + checkEquals("'12345'\n", result) +} + +test_unicode_strings_are_not_escaped <- function() { + # list('име' = 'Александар', 'презиме' = 'Благотић') + a <- "\u0438\u043C\u0435" # name 1 + b <- "\u0410\u043B\u0435\u043A\u0441\u0430\u043D\u0434\u0430\u0440" # value 1 + c <- "\u043F\u0440\u0435\u0437\u0438\u043C\u0435" # name 2 + d <- "\u0411\u043B\u0430\u0433\u043E\u0442\u0438\u045B" # value 2 + x <- list(b, d) + names(x) <- c(a, c) + expected <- paste(a, ": ", b, "\n", c, ": ", d, "\n", sep="") + result <- as.yaml(x, unicode = TRUE) + checkEquals(expected, result, label = result) +} + +test_unicode_strings_are_escaped <- function() { + # 'é' + x <- "\u00e9" + result <- as.yaml(x, unicode = FALSE) + checkEquals("\"\\xE9\"\n", result) +} + +test_unicode_strings_are_not_escaped_by_default <- function() { + # list('é') + x <- list("\u00e9") + result <- as.yaml(x) + checkEquals("- \u00e9\n", result) +} + +test_named_list_with_unicode_character_is_correct_converted <- function() { + x <- list(special.char = "\u00e9") + result <- as.yaml(x) + checkEquals("special.char: \u00e9\n", result) +} + +test_unknown_objects_cause_error <- function() { + checkException(as.yaml(expression(foo <- bar))) +} + +test_inf_is_emitted_properly <- function() { + result <- as.yaml(Inf) + checkEquals(".inf\n", result) +} + +test_negative_inf_is_emitted_properly <- function() { + result <- as.yaml(-Inf) + checkEquals("-.inf\n", result) +} + +test_nan_is_emitted_properly <- function() { + result <- as.yaml(NaN) + checkEquals(".nan\n", result) +} + +test_logical_na_is_emitted_properly <- function() { + result <- as.yaml(NA) + checkEquals(".na\n", result) +} + +test_numeric_na_is_emitted_properly <- function() { + result <- as.yaml(NA_real_) + checkEquals(".na.real\n", result) +} + +test_integer_na_is_emitted_properly <- function() { + result <- as.yaml(NA_integer_) + checkEquals(".na.integer\n", result) +} + +test_character_na_is_emitted_properly <- function() { + result <- as.yaml(NA_character_) + checkEquals(".na.character\n", result) +} + +test_true_is_emitted_properly <- function() { + result <- as.yaml(TRUE) + checkEquals("yes\n", result) +} + +test_false_is_emitted_properly <- function() { + result <- as.yaml(FALSE) + checkEquals("no\n", result) +} + +test_named_list_keys_are_escaped_properly <- function() { + result <- as.yaml(list(n = 123)) + checkEquals("'n': 123.0\n", result) +} + +test_data_frame_keys_are_escaped_properly_when_row_major <- function() { + result <- as.yaml(data.frame(n=1:3), column.major = FALSE) + checkEquals("- 'n': 1\n- 'n': 2\n- 'n': 3\n", result) +} + +test_scientific_notation_is_valid_yaml <- function() { + result <- as.yaml(10000000) + checkEquals("1.0e+07\n", result) +} + +test_precision_must_be_in_the_range_1..22 <- function() { + checkException(as.yaml(12345, precision = -1)) + checkException(as.yaml(12345, precision = 0)) + checkException(as.yaml(12345, precision = 23)) +} + +test_factor_with_missing_values_is_emitted_properly <- function() { + x <- factor('foo', levels=c('bar', 'baz')) + result <- as.yaml(x) + checkEquals(".na.character\n", result) +} + +test_very_small_negative_float_is_emitted_properly <- function() { + result <- as.yaml(-7.62e-24) + checkEquals("-7.62e-24\n", result) +} + +test_very_small_positive_float_is_emitted_properly <- function() { + result <- as.yaml(7.62e-24) + checkEquals("7.62e-24\n", result) +} + +test_numeric_zero_is_emitted_properly <- function() { + result <- as.yaml(0.0) + checkEquals("0.0\n", result) +} + +test_numeric_negative_zero_is_emitted_properly <- function() { + result <- as.yaml(-0.0) + checkEquals("-0.0\n", result) +} + +test_custom_handler_is_run_for_first_class <- function() { + x <- "foo" + class(x) <- "bar" + result <- as.yaml(x, handlers = list(bar = function(x) paste0("x", x, "x"))) + checkEquals("xfoox\n", result) +} + +test_custom_handler_is_run_for_second_class <- function() { + x <- "foo" + class(x) <- c("bar", "baz") + result <- as.yaml(x, handlers = list(baz = function(x) paste0("x", x, "x"))) + checkEquals("xfoox\n", result) +} + +test_custom_handler_with_verbatim_result <- function() { + result <- as.yaml(TRUE, handlers = list( + logical = function(x) { + result <- ifelse(x, "true", "false") + class(result) <- "verbatim" + return(result) + } + )) + checkEquals("true\n", result) +} + +test_custom_handler_with_sequence_result <- function() { + result <- as.yaml(c(1, 2, 3), handlers = list( + numeric = function(x) { + x + 1 + } + )) + checkEquals("- 2.0\n- 3.0\n- 4.0\n", result) +} + +test_custom_handler_with_mapping_result <- function() { + result <- as.yaml(1, handlers = list( + numeric = function(x) { + list(foo = 1:2, bar = 3:4) + } + )) + checkEquals("foo:\n- 1\n- 2\nbar:\n- 3\n- 4\n", result) +} + +test_custom_handler_with_function_result <- function() { + result <- as.yaml(1, handlers = list( + numeric = function(x) { + function(y) y + 1 + } + )) + expected <- "!expr |\n function (y)\n y + 1\n" + checkEquals(expected, result) +} + +test_custom_tag_for_function <- function() { + f <- function(x) x + 1 + attr(f, "tag") <- "!foo" + expected <- "!foo |\n function (x)\n x + 1\n" + result <- as.yaml(f) + checkEquals(expected, result) +} + +test_custom_tag_for_numeric_sequence <- function() { + x <- c(1, 2, 3) + attr(x, "tag") <- "!foo" + expected <- "!foo\n- 1.0\n- 2.0\n- 3.0\n" + result <- as.yaml(x) + checkEquals(expected, result) +} + +test_custom_tag_for_numeric_scalar <- function() { + x <- 1 + attr(x, "tag") <- "!foo" + expected <- "!foo 1.0\n" + result <- as.yaml(x) + checkEquals(expected, result) +} + +test_custom_tag_for_integer_sequence <- function() { + x <- 1L:3L + attr(x, "tag") <- "!foo" + expected <- "!foo\n- 1\n- 2\n- 3\n" + result <- as.yaml(x) + checkEquals(expected, result) +} + +test_custom_tag_for_integer_scalar <- function() { + x <- 1L + attr(x, "tag") <- "!foo" + expected <- "!foo 1\n" + result <- as.yaml(x) + checkEquals(expected, result) +} + +test_custom_tag_for_logical_sequence <- function() { + x <- c(TRUE, FALSE) + attr(x, "tag") <- "!foo" + expected <- "!foo\n- yes\n- no\n" + result <- as.yaml(x) + checkEquals(expected, result) +} + +test_custom_tag_for_logical_scalar <- function() { + x <- TRUE + attr(x, "tag") <- "!foo" + expected <- "!foo yes\n" + result <- as.yaml(x) + checkEquals(expected, result) +} + +test_custom_tag_for_factor_sequence <- function() { + x <- factor(c("foo", "bar")) + attr(x, "tag") <- "!foo" + expected <- "!foo\n- foo\n- bar\n" + result <- as.yaml(x) + checkEquals(expected, result) +} + +test_custom_tag_for_factor_scalar <- function() { + x <- factor("foo") + attr(x, "tag") <- "!foo" + expected <- "!foo foo\n" + result <- as.yaml(x) + checkEquals(expected, result) +} + +test_custom_tag_for_character_sequence <- function() { + x <- c("foo", "bar") + attr(x, "tag") <- "!foo" + expected <- "!foo\n- foo\n- bar\n" + result <- as.yaml(x) + checkEquals(expected, result) +} + +test_custom_tag_for_character_scalar <- function() { + x <- "foo" + attr(x, "tag") <- "!foo" + expected <- "!foo foo\n" + result <- as.yaml(x) + checkEquals(expected, result) +} + +test_custom_tag_for_data_frame <- function() { + x <- data.frame(a = 1:3, b = 4:6) + attr(x, "tag") <- "!foo" + expected <- "!foo\na:\n- 1\n- 2\n- 3\nb:\n- 4\n- 5\n- 6\n" + result <- as.yaml(x) + checkEquals(expected, result) +} + +test_custom_tag_for_data_frame_column <- function() { + x <- data.frame(a = 1:3, b = 4:6) + attr(x$a, "tag") <- "!foo" + expected <- "a: !foo\n- 1\n- 2\n- 3\nb:\n- 4\n- 5\n- 6\n" + result <- as.yaml(x) + checkEquals(expected, result) +} + +test_custom_tag_for_omap <- function() { + x <- list(a=1:2, b=3:4) + attr(x, "tag") <- "!foo" + expected <- "!foo\n- a:\n - 1\n - 2\n- b:\n - 3\n - 4\n" + result <- as.yaml(x, omap = TRUE) + checkEquals(expected, result) +} + +test_custom_tag_for_named_list <- function() { + x <- list(a=1:2, b=3:4) + attr(x, "tag") <- "!foo" + expected <- "!foo\na:\n- 1\n- 2\nb:\n- 3\n- 4\n" + result <- as.yaml(x) + checkEquals(expected, result) +} + +test_custom_tag_for_unnamed_list <- function() { + x <- list(1, 2, 3) + attr(x, "tag") <- "!foo" + expected <- "!foo\n- 1.0\n- 2.0\n- 3.0\n" + result <- as.yaml(x) + checkEquals(expected, result) +} + +test_quotes_for_string <- function() { + port_def <- "80:80" + attr(port_def, "quoted") <- TRUE + x <- list(ports = list(port_def)) + result <- as.yaml(x) + expected <- "ports:\n- \"80:80\"\n" + checkEquals(expected, result) +} + +test_no_dots_at_end <- function() +{ + result <- yaml::as.yaml(list(eol = "\n", a = 1), line.sep = "\n") + checkEquals("eol: |2+\n\na: 1.0\n", result) +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/tests/test_read_yaml.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/tests/test_read_yaml.R new file mode 100644 index 00000000..8ac28105 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/tests/test_read_yaml.R @@ -0,0 +1,62 @@ +test_reading_from_a_connection_works <- function() { + filename <- tempfile() + cat("foo: 123", file=filename, sep="\n") + foo <- file(filename, 'r') + x <- read_yaml(foo) + close(foo) + unlink(filename) + checkEquals(123L, x$foo) +} + +test_reading_from_specified_filename_works <- function() { + filename <- tempfile() + cat("foo: 123", file=filename, sep="\n") + x <- read_yaml(filename) + unlink(filename) + checkEquals(123L, x$foo) +} + +test_reading_from_text_works <- function() { + x <- read_yaml(text="foo: 123") + checkEquals(123L, x$foo) +} + +test_reading_a_complicated_document_works <- function() { + filename <- system.file(file.path("tests", "files", "test.yml"), package = "yaml") + x <- read_yaml(filename) + expected <- list( + foo = list(one=1, two=2), + bar = list(three=3, four=4), + baz = list(list(one=1, two=2), list(three=3, four=4)), + quux = list(one=1, two=2, three=3, four=4, five=5, six=6), + corge = list( + list(one=1, two=2, three=3, four=4, five=5, six=6), + list(xyzzy=list(one=1, two=2, three=3, four=4, five=5, six=6)) + ) + ) + checkEquals(expected, x) +} + +test_warns_about_incomplete_last_line <- function() +{ + filename <- tempfile() + cat("foo: 123", file=filename, sep="") + foo <- file(filename, 'r') + checkWarning(x <- read_yaml(foo)) + #, readLines.warn=FALSE) + close(foo) + unlink(filename) + checkEquals(123L, x$foo) +} + +test_supress_warning_incomplete_last_line <- function() +{ + filename <- tempfile() + cat("foo: 123", file=filename, sep="") + foo <- file(filename, 'r') + warnings <- captureWarnings(x <- read_yaml(foo, readLines.warn=FALSE)) + close(foo) + unlink(filename) + checkEquals(123L, x$foo) + checkEquals(0, length(warnings)) +} \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/tests/test_write_yaml.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/tests/test_write_yaml.R new file mode 100644 index 00000000..78b62656 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/tests/test_write_yaml.R @@ -0,0 +1,7 @@ +test_output_is_written_to_a_file_when_a_filename_is_specified <- function() { + filename <- tempfile() + write_yaml(1:3, filename) + output <- readLines(filename) + unlink(filename) + checkEquals(c("- 1", "- 2", "- 3"), output) +} diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/tests/test_yaml_load.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/tests/test_yaml_load.R new file mode 100644 index 00000000..d41f18cc --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/tests/test_yaml_load.R @@ -0,0 +1,670 @@ +test_named_list_is_not_returned <- function() { + x <- yaml.load("hey: man\n123: 456\n", FALSE) + checkEquals(2L, length(x)) + checkEquals(2L, length(attr(x, "keys"))) + + x <- yaml.load("- dude\n- sup\n- 1.2345", FALSE) + checkEquals(3L, length(x)) + checkEquals(0L, length(attr(x, "keys"))) + checkEquals("sup", x[[2]]) + + x <- yaml.load("dude:\n - 123\n - sup", FALSE) + checkEquals(1L, length(x)) + checkEquals(1L, length(attr(x, "keys"))) + checkEquals(2L, length(x[[1]])) +} + +test_key_conflicts_throw_errors <- function() { + checkException(yaml.load("hey: buddy\nhey: guy")); +} + +test_named_list_is_returned <- function() { + x <- yaml.load("hey: man\n123: 456\n", TRUE) + checkEquals(2L, length(x)) + checkEquals(2L, length(names(x))) + checkEquals(c("123", "hey"), sort(names(x))) + checkEquals("man", x$hey) +} + +test_uniform_sequences_are_coerced <- function() { + x <- yaml.load("- 1\n- 2\n- 3") + checkEquals(1:3, x) + + x <- yaml.load("- yes\n- no\n- yes") + checkEquals(c(TRUE, FALSE, TRUE), x) + + x <- yaml.load("- 3.1\n- 3.14\n- 3.141") + checkEquals(c(3.1, 3.14, 3.141), x) + + x <- yaml.load("- hey\n- hi\n- hello") + checkEquals(c("hey", "hi", "hello"), x) +} + +test_tag_type_conflicts_throws_error <- function() { + checkException(yaml.load("!!str [1, 2, 3]")) + checkException(yaml.load("!!str {foo: bar}")) +} + +test_sequences_are_not_collapsed <- function() { + x <- yaml.load("- [1, 2]\n- 3\n- [4, 5]") + checkEquals(list(1:2, 3L, 4:5), x) +} + +test_named_maps_are_merged_without_warnings <- function() { + x <- yaml.load("foo: bar\n<<: {baz: boo}", TRUE) + checkEquals(2L, length(x)) + checkEquals("bar", x$foo) + checkEquals("boo", x$baz) + + expected <- list(foo = 'bar', quux = 'quux', baz = 'blah') + warnings <- captureWarnings({ + x <- yaml.load("foo: bar\n<<: [{quux: quux}, {foo: doo}, {foo: junk}, {baz: blah}, {baz: boo}]", TRUE) + }) + checkEquals(expected, x) + checkEquals(0L, length(warnings)) + + warnings <- captureWarnings({ + x <- yaml.load("foo: bar\n<<: {foo: baz}\n<<: {foo: quux}") + }) + checkEquals(1L, length(x)) + checkEquals("bar", x$foo) + checkEquals(0L, length(warnings)) + + warnings <- captureWarnings({ + x <- yaml.load("<<: {foo: bar}\nfoo: baz") + }) + checkEquals(list(foo = 'bar'), x) + checkEquals(0L, length(warnings)) +} + +test_named_maps_are_merged_with_warnings <- function() { + x <- yaml.load("foo: bar\n<<: {baz: boo}", as.named.list = TRUE, merge.warning = TRUE) + checkEquals(2L, length(x)) + checkEquals("bar", x$foo) + checkEquals("boo", x$baz) + + expected <- list(foo = 'bar', quux = 'quux', baz = 'blah') + warnings <- captureWarnings({ + x <- yaml.load("foo: bar\n<<: [{quux: quux}, {foo: doo}, {foo: junk}, {baz: blah}, {baz: boo}]", as.named.list = TRUE, merge.warning = TRUE) + }) + checkEquals(expected, x) + checkEquals(c("Duplicate map key ignored during merge: 'foo'", + "Duplicate map key ignored during merge: 'foo'", + "Duplicate map key ignored during merge: 'baz'"), warnings) + + warnings <- captureWarnings({ + x <- yaml.load("foo: bar\n<<: {foo: baz}\n<<: {foo: quux}", as.named.list = TRUE, merge.warning = TRUE) + }) + checkEquals(1L, length(x)) + checkEquals("bar", x$foo) + checkEquals(c("Duplicate map key ignored during merge: 'foo'", + "Duplicate map key ignored during merge: 'foo'"), warnings) + + warnings <- captureWarnings({ + x <- yaml.load("<<: {foo: bar}\nfoo: baz", as.named.list = TRUE, merge.warning = TRUE) + }) + checkEquals(list(foo = 'bar'), x) + checkEquals(c("Duplicate map key ignored after merge: 'foo'"), warnings) +} + +test_unnamed_maps_are_merged_without_warnings <- function() { + x <- yaml.load("foo: bar\n<<: {baz: boo}", as.named.list = FALSE) + checkEquals(2L, length(x)) + checkEquals(list("foo", "baz"), attr(x, 'keys')) + checkEquals("bar", x[[1]]) + checkEquals("boo", x[[2]]) + + warnings <- captureWarnings({ + x <- yaml.load("foo: bar\n<<: [{quux: quux}, {foo: doo}, {baz: boo}]", as.named.list = FALSE) + }) + checkEquals(3L, length(x)) + checkEquals(list("foo", "quux", "baz"), attr(x, 'keys')) + checkEquals("bar", x[[1]]) + checkEquals("quux", x[[2]]) + checkEquals("boo", x[[3]]) + checkEquals(0L, length(warnings)) + + warnings <- captureWarnings({ + x <- yaml.load("<<: {foo: bar}\nfoo: baz", as.named.list = FALSE) + }) + checkEquals(1L, length(x)) + checkEquals(list("foo"), attr(x, 'keys')) + checkEquals("bar", x[[1]]) + checkEquals(0L, length(warnings)) +} + +test_unnamed_maps_are_merged_with_warnings <- function() { + warnings <- captureWarnings({ + x <- yaml.load("foo: bar\n<<: {baz: boo}", as.named.list = FALSE, merge.warning = TRUE) + }) + checkEquals(2L, length(x)) + checkEquals(list("foo", "baz"), attr(x, 'keys')) + checkEquals("bar", x[[1]]) + checkEquals("boo", x[[2]]) + checkEquals(0L, length(warnings)) + + warnings <- captureWarnings({ + x <- yaml.load("foo: bar\n<<: [{quux: quux}, {foo: doo}, {baz: boo}]", as.named.list = FALSE, merge.warning = TRUE) + }) + checkEquals(3L, length(x)) + checkEquals(list("foo", "quux", "baz"), attr(x, 'keys')) + checkEquals("bar", x[[1]]) + checkEquals("quux", x[[2]]) + checkEquals("boo", x[[3]]) + checkEquals("Duplicate map key ignored during merge: 'foo'", warnings) + + warnings <- captureWarnings({ + x <- yaml.load("<<: {foo: bar}\nfoo: baz", as.named.list = FALSE, merge.warning = TRUE) + }) + checkEquals(1L, length(x)) + checkEquals(list("foo"), attr(x, 'keys')) + checkEquals("bar", x[[1]]) + checkEquals(c("Duplicate map key ignored after merge: 'foo'"), warnings) +} + +test_duplicate_keys_throws_an_error <- function() { + checkException(yaml.load("foo: bar\nfoo: baz\n", TRUE)) +} + +test_duplicate_keys_with_merge_first_does_not_throw_an_error <- function() { + result <- try(yaml.load("<<: {foo: bar}\nfoo: baz\n", TRUE)) + checkTrue(!inherits(result, "try-error")) +} + +test_invalid_merges_throw_errors <- function() { + checkException(yaml.load("foo: bar\n<<: [{leet: hax}, blargh, 123]", TRUE)) + checkException(yaml.load("foo: bar\n<<: [123, blargh, {leet: hax}]", TRUE)) + checkException(yaml.load("foo: bar\n<<: junk", TRUE)) +} + +test_syntax_errors_throw_errors <- function() { + checkException(yaml.load("[whoa, this is some messed up]: yaml?!: dang")) +} + +test_null_types_are_converted <- function() { + x <- yaml.load("~") + checkEquals(NULL, x) +} + +#test_should_handle_binary_type <- function() { +# x <- yaml.load("!!binary 0b101011") +# checkEquals("0b101011", x) +#} + +test_bool_yes_type_is_converted <- function() { + x <- yaml.load("yes") + checkEquals(TRUE, x) +} + +test_bool_no_type_is_converted <- function() { + x <- yaml.load("no") + checkEquals(FALSE, x) +} + +test_int_hex_type_is_converted <- function() { + x <- yaml.load("0xF") + checkEquals(15L, x) +} + +test_int_oct_type_is_converted <- function() { + x <- yaml.load("015") + checkEquals(13L, x) +} + +#test_should_handle_int_base60_type <- function() { +# x <- yaml.load("1:20") +# checkEquals("1:20", x) +#} + +test_int_type_is_converted <- function() { + x <- yaml.load("31337") + checkEquals(31337L, x) +} + +test_explicit_int_type_is_converted <- function() { + x <- yaml.load("!!int 31337") + checkEquals(31337L, x) +} + +#test_should_handle_float_base60_type <- function() { +# x <- yaml.load("1:20.5") +# checkEquals("1:20.5", x) +#} + +test_float_nan_type_is_converted <- function() { + x <- yaml.load(".NaN") + checkTrue(is.nan(x)) +} + +test_float_inf_type_is_converted <- function() { + x <- yaml.load(".inf") + checkEquals(Inf, x) +} + +test_float_neginf_type_is_converted <- function() { + x <- yaml.load("-.inf") + checkEquals(-Inf, x) +} + +test_float_type_is_converted <- function() { + x <- yaml.load("123.456") + checkEquals(123.456, x) +} + +#test_should_handle_timestamp_iso8601_type <- function() { +# x <- yaml.load("!timestamp#iso8601 2001-12-14t21:59:43.10-05:00") +# checkEquals("2001-12-14t21:59:43.10-05:00", x) +#} + +#test_should_handle_timestamp_spaced_type <- function() { +# x <- yaml.load("!timestamp#spaced 2001-12-14 21:59:43.10 -5") +# checkEquals("2001-12-14 21:59:43.10 -5", x) +#} + +#test_should_handle_timestamp_ymd_type <- function() { +# x <- yaml.load("!timestamp#ymd 2008-03-03") +# checkEquals("2008-03-03", x) +#} + +#test_should_handle_timestamp_type <- function() { +# x <- yaml.load("!timestamp 2001-12-14t21:59:43.10-05:00") +# checkEquals("2001-12-14t21:59:43.10-05:00", x) +#} + +test_aliases_are_handled <- function() { + x <- yaml.load("- &foo bar\n- *foo") + checkEquals(c("bar", "bar"), x) +} + +test_str_type_is_converted <- function() { + x <- yaml.load("lickety split") + checkEquals("lickety split", x) +} + +test_bad_anchors_are_handled <- function() { + warnings <- captureWarnings({ + x <- yaml.load("*blargh") + }) + expected <- "_yaml.bad-anchor_" + class(expected) <- "_yaml.bad-anchor_" + checkEquals(expected, x) + checkEquals("Unknown anchor: blargh", warnings) +} + +test_custom_null_handler_is_applied <- function() { + x <- yaml.load("~", handlers=list("null"=function(x) { "argh!" })) + checkEquals("argh!", x) +} + +test_custom_binary_handler_is_applied <- function() { + x <- yaml.load("!binary 0b101011", handlers=list("binary"=function(x) { "argh!" })) + checkEquals("argh!", x) +} + +test_custom_bool_yes_handler_is_applied <- function() { + x <- yaml.load("yes", handlers=list("bool#yes"=function(x) { "argh!" })) + checkEquals("argh!", x) +} + +test_custom_bool_no_handler_is_applied <- function() { + x <- yaml.load("no", handlers=list("bool#no"=function(x) { "argh!" })) + checkEquals("argh!", x) +} + +test_custom_int_hex_handler_is_applied <- function() { + x <- yaml.load("0xF", handlers=list("int#hex"=function(x) { "argh!" })) + checkEquals("argh!", x) +} + +test_custom_int_oct_handler_is_applied <- function() { + x <- yaml.load("015", handlers=list("int#oct"=function(x) { "argh!" })) + checkEquals("argh!", x) +} + +test_int_base60_is_not_coerced_by_default <- function() { + x <- yaml.load("1:20") + checkEquals("1:20", x) +} + +test_custom_int_base60_handler_is_applied <- function() { + x <- yaml.load("1:20", handlers=list("int#base60"=function(x) { "argh!" })) + checkEquals("argh!", x) +} + +test_custom_int_handler_is_applied <- function() { + x <- yaml.load("31337", handlers=list("int"=function(x) { "argh!" })) + checkEquals("argh!", x) +} + +test_custom_float_base60_handler_is_applied <- function() { + x <- yaml.load("1:20.5", handlers=list("float#base60"=function(x) { "argh!" })) + checkEquals("argh!", x) +} + +test_custom_float_nan_handler_is_applied <- function() { + x <- yaml.load(".NaN", handlers=list("float#nan"=function(x) { "argh!" })) + checkEquals("argh!", x) +} + +test_custom_float_inf_handler_is_applied <- function() { + x <- yaml.load(".inf", handlers=list("float#inf"=function(x) { "argh!" })) + checkEquals("argh!", x) +} + +test_custom_float_neginf_handler_is_applied <- function() { + x <- yaml.load("-.inf", handlers=list("float#neginf"=function(x) { "argh!" })) + checkEquals("argh!", x) +} + +test_custom_float_handler_is_applied <- function() { + x <- yaml.load("123.456", handlers=list("float#fix"=function(x) { "argh!" })) + checkEquals("argh!", x) +} + +test_custom_timestamp_iso8601_handler_is_applied <- function() { + x <- yaml.load("2001-12-14t21:59:43.10-05:00", handlers=list("timestamp#iso8601"=function(x) { "argh!" })) + checkEquals("argh!", x) +} + +#test_should_use_custom_timestamp_spaced_handler <- function() { +# x <- yaml.load('!"timestamp#spaced" 2001-12-14 21:59:43.10 -5', handlers=list("timestamp#spaced"=function(x) { "argh!" })) +# checkEquals("argh!", x) +#} + +test_custom_timestamp_ymd_handler_is_applied <- function() { + x <- yaml.load("2008-03-03", handlers=list("timestamp#ymd"=function(x) { "argh!" })) + checkEquals("argh!", x) +} + +test_custom_merge_handler_is_not_applied <- function() { + warnings <- captureWarnings({ + x <- yaml.load("foo: &foo\n bar: 123\n baz: 456\n\njunk:\n <<: *foo\n bah: 789", handlers=list("merge"=function(x) { "argh!" })) + }) + checkEquals(list(foo=list(bar=123, baz=456), junk=list(bar=123, baz=456, bah=789)), x) + checkEquals("Custom handling for type 'merge' is not allowed; handler ignored", warnings) +} + +test_custom_str_handler_is_applied <- function() { + x <- yaml.load("lickety split", handlers=list("str"=function(x) { "argh!" })) + checkEquals("argh!", x) +} + +test_handler_for_unknown_type_is_applied <- function() { + x <- yaml.load("!viking pillage", handlers=list(viking=function(x) { paste(x, "the village") })) + checkEquals("pillage the village", x) +} + +test_custom_seq_handler_is_applied <- function() { + x <- yaml.load("- 1\n- 2\n- 3", handlers=list(seq=function(x) { as.integer(x) + 3L })) + checkEquals(4:6, x) +} + +test_custom_map_handler_is_applied <- function() { + x <- yaml.load("foo: bar", handlers=list(map=function(x) { x$foo <- paste(x$foo, "yarr"); x })) + checkEquals("bar yarr", x$foo) +} + +test_custom_typed_seq_handler_is_applied <- function() { + x <- yaml.load("!foo\n- 1\n- 2", handlers=list(foo=function(x) { as.integer(x) + 1L })) + checkEquals(2:3, x) +} + +test_custom_typed_map_handler_is_applied <- function() { + x <- yaml.load("!foo\nuno: 1\ndos: 2", handlers=list(foo=function(x) { x$uno <- "uno"; x$dos <- "dos"; x })) + checkEquals(list(uno="uno", dos="dos"), x) +} + +# NOTE: this works, but R_tryEval doesn't return when called non-interactively +#test_should_handle_a_bad_handler <- function() { +# x <- yaml.load("foo", handlers=list(str=function(x) { blargh })) +# str(x) +#} + +test_empty_documents_are_loaded <- function() { + x <- yaml.load("") + checkEquals(NULL, x) + x <- yaml.load("# this document only has\n # wickedly awesome comments") + checkEquals(NULL, x) +} + +test_omaps_are_loaded <- function() { + x <- yaml.load("--- !omap\n- foo:\n - 1\n - 2\n- bar:\n - 3\n - 4") + checkEquals(2L, length(x)) + checkEquals(c("foo", "bar"), names(x)) + checkEquals(1:2, x$foo) + checkEquals(3:4, x$bar) +} + +test_omaps_are_loaded_when_named_is_false <- function() { + x <- yaml.load("--- !omap\n- 123:\n - 1\n - 2\n- bar:\n - 3\n - 4", FALSE) + checkEquals(2L, length(x)) + checkEquals(list(123L, "bar"), attr(x, "keys")) + checkEquals(1:2, x[[1]]) + checkEquals(3:4, x[[2]]) +} + +test_named_opam_with_duplicate_key_causes_error <- function() { + checkException(yaml.load("--- !omap\n- foo:\n - 1\n - 2\n- foo:\n - 3\n - 4")) +} + +test_unnamed_omap_with_duplicate_key_causes_error <- function() { + checkException(yaml.load("--- !omap\n- foo:\n - 1\n - 2\n- foo:\n - 3\n - 4", FALSE)) +} + +test_invalid_omap_causes_error <- function() { + checkException(yaml.load("--- !omap\nhey!")) + checkException(yaml.load("--- !omap\n- sup?")) +} + +test_expressions_are_not_implicitly_converted_with_warning <- function() { + warnings <- captureWarnings({ + x <- yaml.load("!expr |\n function() \n {\n 'hey!'\n }") + }) + checkEquals("function() \n{\n 'hey!'\n}", x) +# checkEquals("function", class(x)) +# checkEquals("hey!", x()) + checkEquals("Evaluating R expressions (!expr) requires explicit `eval.expr=TRUE` option (see yaml.load help)", warnings) +} + +test_expressions_are_explicitly_converted_without_warning <- function() { + warnings <- captureWarnings({ + x <- yaml.load("!expr |\n function() \n {\n 'hey!'\n }", eval.expr = TRUE) + }) + checkEquals("function", class(x)) + checkEquals("hey!", x()) + checkEquals(0, length(warnings)) +} + +test_expressions_are_explicitly_not_converted <- function() { + x <- yaml.load("!expr 123 + 456", eval.expr = FALSE) + checkEquals("123 + 456", x) +} + +test_invalid_expressions_cause_error <- function() { + checkException(yaml.load("!expr |\n 1+", eval.expr=TRUE)) +} + +# NOTE: this works, but R_tryEval doesn't return when called non-interactively +#test_should_error_for_expressions_with_eval_errors <- function() { +# x <- try(yaml.load("!expr |\n 1 + non.existent.variable")) +# assert(inherits(x, "try-error")) +#} + +test_maps_are_in_ordered <- function() { + x <- yaml.load("{a: 1, b: 2, c: 3}") + checkEquals(c('a', 'b', 'c'), names(x)) +} + +test_illegal_recursive_anchor_is_handled <- function() { + warnings <- captureWarnings({ + x <- yaml.load('&foo {foo: *foo}') + }) + expected <- "_yaml.bad-anchor_" + class(expected) <- "_yaml.bad-anchor_" + checkEquals(expected, x$foo) + checkEquals("Unknown anchor: foo", warnings) +} + +test_dereferenced_aliases_have_unshared_names <- function() { + x <- yaml.load('{foo: &foo {one: 1, two: 2}, bar: *foo}') + x$foo$one <- 'uno' + checkEquals(1L, x$bar$one) +} + +test_multiple_anchors_are_handled <- function() { + x <- yaml.load('{foo: &foo {one: 1}, bar: &bar {two: 2}, baz: *foo, quux: *bar}') + expected <- list( + foo = list(one = 1), + bar = list(two = 2), + baz = list(one = 1), + quux = list(two = 2) + ) + checkEquals(expected, x) +} + +test_quoted_strings_are_preserved <- function() { + x <- yaml.load("'12345'") + checkEquals("12345", x) +} + +test_inf_is_loaded_properly <- function() { + result <- yaml.load(".inf\n...\n") + checkEquals(Inf, result) +} + +test_negative_inf_is_loaded_properly <- function() { + result <- yaml.load("-.inf\n...\n") + checkEquals(-Inf, result) +} + +test_nan_is_loaded_properly <- function() { + result <- yaml.load(".nan\n...\n") + checkEquals(NaN, result) +} + +test_logical_na_is_loaded_properly <- function() { + result <- yaml.load(".na\n...\n") + checkEquals(NA, result) +} + +test_numeric_na_is_loaded_properly <- function() { + result <- yaml.load(".na.real\n...\n") + checkEquals(NA_real_, result) +} + +test_integer_na_is_loaded_properly <- function() { + result <- yaml.load(".na.integer\n...\n") + checkEquals(NA_integer_, result) +} + +test_character_na_is_loaded_properly <- function() { + result <- yaml.load(".na.character\n...\n") + checkEquals(NA_character_, result) +} + +test_true_is_loaded_properly_from_y <- function() { + result <- yaml.load("y\n...\n") + checkEquals(TRUE, result) +} + +test_false_is_loaded_properly_from_n <- function() { + result <- yaml.load("n\n...\n") + checkEquals(FALSE, result) +} + +test_numeric_sequence_with_missing_values_loads_properly <- function() { + result <- yaml.load("[1.2, 3.4, .na.real]") + checkEquals(c(1.2, 3.4, NA), result) +} + +test_integer_sequence_with_missing_values_loads_properly <- function() { + result <- yaml.load("[1, 2, .na.integer]") + checkEquals(c(1, 2, NA), result) +} + +test_string_sequence_with_missing_values_loads_properly <- function() { + result <- yaml.load("[foo, bar, .na.character]") + checkEquals(c("foo", "bar", NA), result) +} + +test_logical_sequence_with_missing_values_loads_properly <- function() { + result <- yaml.load("[y, n, .na]") + checkEquals(c(TRUE, FALSE, NA), result) +} + +test_numeric_sequence_with_nans_loads_properly <- function() { + result <- yaml.load("[1.2, 3.4, .nan]") + checkEquals(c(1.2, 3.4, NaN), result) +} + +test_numeric_represented_in_exponential_form_is_loaded_properly <- function() { + checkEquals(1000000, yaml.load("1.0e+06")) +}; + +test_numeric_without_leading_digits_is_loaded_properly <- function() { + checkEquals(0.9, yaml.load(".9")) +}; + +test_integer_overflow_creates_a_warning <- function() { + checkWarning(result <- yaml.load("2147483648")) + checkEquals(NA_integer_, result) + checkWarning(result <- yaml.load("2147483649")) + checkEquals(NA_integer_, result) +} + +test_numeric_overflow_creates_a_warning <- function() { + checkWarning(result <- yaml.load("1.797693e+309")) + checkEquals(NA_real_, result) +} + +test_list_of_one_list_is_loaded_properly <- function() { + result <- yaml.load('a:\n -\n - b\n - c\n') + checkEquals(list(a = list(c("b", "c"))), result) +} + +test_override_merge_precedence <- function() { + doc <- "[ &one { foo: bar }, { <<: *one, foo: baz } ]" + expected <- list(list(foo = 'bar'), list(foo = 'baz')) + result <- yaml.load(doc, merge.precedence = "override") + checkEquals(expected, result) +} + +test_explicit_bool_tag_for_true_value <- function() { + doc <- "!!bool 'true'" + expected <- TRUE + result <- yaml.load(doc) + checkEquals(expected, result) +} + +test_explicit_bool_tag_for_false_value <- function() { + doc <- "!!bool 'false'" + expected <- FALSE + result <- yaml.load(doc) + checkEquals(expected, result) +} + +test_explicit_bool_tag_for_na_value <- function() { + doc <- "!!bool '.na'" + expected <- NA + result <- yaml.load(doc) + checkEquals(expected, result) +} + +test_explicit_bool_tag_for_invalid_value <- function() { + doc <- "!!bool foo" + expected <- NA + warnings <- captureWarnings({ + result <- yaml.load(doc) + }) + checkEquals(expected, result) + checkEquals(c("NAs introduced by coercion: foo is not a recognized boolean value"), warnings) +} + +test_builtin_as_handler_works <- function() { + x <- "{a: 1, b: 2, c: 3}" + warnings <- captureWarnings({ + results <- yaml.load(x, handlers=list(int=as.double)) + }) + checkEquals(class(results$a), "numeric") + checkEquals(0, length(warnings)) +} \ No newline at end of file diff --git a/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/tests/test_yaml_load_file.R b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/tests/test_yaml_load_file.R new file mode 100644 index 00000000..9b9c6431 --- /dev/null +++ b/rhino/renv/library/macos/R-4.4/aarch64-apple-darwin20/yaml/tests/test_yaml_load_file.R @@ -0,0 +1,83 @@ +test_reading_from_a_connection_works <- function() { + filename <- tempfile() + cat("foo: 123", file=filename, sep="\n") + foo <- file(filename, 'r') + x <- yaml.load_file(foo) + close(foo) + unlink(filename) + checkEquals(123L, x$foo) +} + +test_reading_from_specified_filename_works <- function() { + filename <- tempfile() + cat("foo: 123", file=filename, sep="\n") + x <- yaml.load_file(filename) + unlink(filename) + checkEquals(123L, x$foo) +} + +test_reading_a_complicated_document_works <- function() { + filename <- system.file(file.path("tests", "files", "test.yml"), package = "yaml") + x <- yaml.load_file(filename) + expected <- list( + foo = list(one = 1, two = 2), + bar = list(three = 3, four = 4), + baz = list(list(one = 1, two = 2), list(three = 3, four = 4)), + quux = list(one = 1, two = 2, three = 3, four = 4, five = 5, six = 6), + corge = list( + list(one = 1, two = 2, three = 3, four = 4, five = 5, six = 6), + list(xyzzy = list(one = 1, two = 2, three = 3, four = 4, five = 5, six = 6)) + ) + ) + checkEquals(expected, x) +} + +test_expressions_are_not_implicitly_converted_with_warning <- function() { + warnings <- captureWarnings({ + filename <- tempfile() + cat("!expr 123 + 456", file=filename, sep="\n") + foo <- file(filename, 'r') + x <- yaml.load_file(foo) + close(foo) + unlink(filename) + }) + checkEquals("character", class(x)) + checkEquals("123 + 456", x) + checkEquals("Evaluating R expressions (!expr) requires explicit `eval.expr=TRUE` option (see yaml.load help)", warnings) +} + +test_expressions_are_explicitly_converted_without_warning <- function() { + warnings <- captureWarnings({ + filename <- tempfile() + cat("!expr 123 + 456", file=filename, sep="\n") + foo <- file(filename, 'r') + x <- yaml.load_file(foo, eval.expr = TRUE) + close(foo) + unlink(filename) + }) + checkEquals("numeric", class(x)) + checkEquals(579, x) + checkEquals(0, length(warnings)) +} + +test_expressions_are_unconverted <- function() { + filename <- tempfile() + cat("!expr 123 + 456", file=filename, sep="\n") + foo <- file(filename, 'r') + x <- yaml.load_file(foo, eval.expr = FALSE) + close(foo) + unlink(filename) + + checkEquals("character", class(x)) + checkEquals("123 + 456", x) +} + +test_merge_specification_example_with_merge_override <- function() { + filename <- system.file(file.path("tests", "files", "merge.yml"), package = "yaml") + x <- yaml.load_file(filename, merge.precedence = "override") + expected <- list(x = 1, y = 2, r = 10, label = "center/big") + checkNamedListEquals(expected, x[[5]]) + checkNamedListEquals(expected, x[[6]]) + checkNamedListEquals(expected, x[[7]]) + checkNamedListEquals(expected, x[[8]]) +} diff --git a/tests/testthat/apps/golem/.Rbuildignore b/tests/testthat/apps/golem/.Rbuildignore new file mode 100644 index 00000000..9b9a10f3 --- /dev/null +++ b/tests/testthat/apps/golem/.Rbuildignore @@ -0,0 +1,7 @@ +^.*\.Rproj$ +^\.Rproj\.user$ +^data-raw$ +dev_history.R +^dev$ +$run_dev.* +^.here$ diff --git a/tests/testthat/apps/golem/.gitignore b/tests/testthat/apps/golem/.gitignore new file mode 100644 index 00000000..cd67eac6 --- /dev/null +++ b/tests/testthat/apps/golem/.gitignore @@ -0,0 +1 @@ +.Rproj.user diff --git a/tests/testthat/apps/golem/.here b/tests/testthat/apps/golem/.here new file mode 100644 index 00000000..e69de29b diff --git a/tests/testthat/apps/golem/DESCRIPTION b/tests/testthat/apps/golem/DESCRIPTION new file mode 100644 index 00000000..fede03ad --- /dev/null +++ b/tests/testthat/apps/golem/DESCRIPTION @@ -0,0 +1,17 @@ +Package: testapp +Title: An Amazing Shiny App +Version: 0.0.0.9000 +Authors@R: + person(given = "firstname", + family = "lastname", + role = c("aut", "cre"), + email = "your@email.com") +Description: What the package does (one paragraph). +License: What license is it under? +Imports: + config, + golem, + shiny +Encoding: UTF-8 +LazyData: true +RoxygenNote: 7.1.1 diff --git a/tests/testthat/apps/golem/NAMESPACE b/tests/testthat/apps/golem/NAMESPACE new file mode 100644 index 00000000..2b8d54c7 --- /dev/null +++ b/tests/testthat/apps/golem/NAMESPACE @@ -0,0 +1,10 @@ +# Generated by roxygen2: do not edit by hand + +export(run_app) +import(shiny) +importFrom(golem,activate_js) +importFrom(golem,add_resource_path) +importFrom(golem,bundle_resources) +importFrom(golem,favicon) +importFrom(golem,with_golem_options) +importFrom(shiny,shinyApp) diff --git a/tests/testthat/apps/golem/R/app_config.R b/tests/testthat/apps/golem/R/app_config.R new file mode 100644 index 00000000..290ad94b --- /dev/null +++ b/tests/testthat/apps/golem/R/app_config.R @@ -0,0 +1,44 @@ +#' Access files in the current app +#' +#' NOTE: If you manually change your package name in the DESCRIPTION, +#' don't forget to change it here too, and in the config file. +#' For a safer name change mechanism, use the `golem::set_golem_name()` function. +#' +#' @param ... character vectors, specifying subdirectory and file(s) +#' within your package. The default, none, returns the root of the app. +#' +#' @noRd +app_sys <- function(...) { + system.file(..., package = "testapp") +} + + +#' Read App Config +#' +#' @param value Value to retrieve from the config file. +#' @param config GOLEM_CONFIG_ACTIVE value. If unset, R_CONFIG_ACTIVE. +#' If unset, "default". +#' @param use_parent Logical, scan the parent directory for config file. +#' @param file Location of the config file +#' +#' @noRd +get_golem_config <- function( + value, + config = Sys.getenv( + "GOLEM_CONFIG_ACTIVE", + Sys.getenv( + "R_CONFIG_ACTIVE", + "default" + ) + ), + use_parent = TRUE, + # Modify this if your config file is somewhere else + file = app_sys("golem-config.yml") +) { + config::get( + value = value, + config = config, + file = file, + use_parent = use_parent + ) +} diff --git a/tests/testthat/apps/golem/R/app_server.R b/tests/testthat/apps/golem/R/app_server.R new file mode 100644 index 00000000..f4313119 --- /dev/null +++ b/tests/testthat/apps/golem/R/app_server.R @@ -0,0 +1,9 @@ +#' The application server-side +#' +#' @param input,output,session Internal parameters for {shiny}. +#' DO NOT REMOVE. +#' @import shiny +#' @noRd +app_server <- function(input, output, session) { + # Your application server logic +} diff --git a/tests/testthat/apps/golem/R/app_ui.R b/tests/testthat/apps/golem/R/app_ui.R new file mode 100644 index 00000000..49c8e738 --- /dev/null +++ b/tests/testthat/apps/golem/R/app_ui.R @@ -0,0 +1,42 @@ +#' The application User-Interface +#' +#' @param request Internal parameter for `{shiny}`. +#' DO NOT REMOVE. +#' @import shiny +#' @noRd +app_ui <- function(request) { + tagList( + # Leave this function for adding external resources + golem_add_external_resources(), + # Your application UI logic + fluidPage( + # golem::golem_welcome_page() # Remove this line to start building your UI + shiny::div(id="test_id", "Golem App loaded") + ) + ) +} + +#' Add external Resources to the Application +#' +#' This function is internally used to add external +#' resources inside the Shiny application. +#' +#' @import shiny +#' @importFrom golem add_resource_path activate_js favicon bundle_resources +#' @noRd +golem_add_external_resources <- function() { + add_resource_path( + "www", + app_sys("app/www") + ) + + tags$head( + favicon(), + bundle_resources( + path = app_sys("app/www"), + app_title = "testapp" + ) + # Add here other external resources + # for example, you can add shinyalert::useShinyalert() + ) +} diff --git a/tests/testthat/apps/golem/R/run_app.R b/tests/testthat/apps/golem/R/run_app.R new file mode 100644 index 00000000..5d60ac1d --- /dev/null +++ b/tests/testthat/apps/golem/R/run_app.R @@ -0,0 +1,28 @@ +#' Run the Shiny Application +#' +#' @param ... arguments to pass to golem_opts. +#' See `?golem::get_golem_options` for more details. +#' @inheritParams shiny::shinyApp +#' +#' @export +#' @importFrom shiny shinyApp +#' @importFrom golem with_golem_options +run_app <- function( + onStart = NULL, + options = list(), + enableBookmarking = NULL, + uiPattern = "/", + ... +) { + with_golem_options( + app = shinyApp( + ui = app_ui, + server = app_server, + onStart = onStart, + options = options, + enableBookmarking = enableBookmarking, + uiPattern = uiPattern + ), + golem_opts = list(...) + ) +} diff --git a/tests/testthat/apps/golem/dev/01_start.R b/tests/testthat/apps/golem/dev/01_start.R new file mode 100644 index 00000000..f18409ef --- /dev/null +++ b/tests/testthat/apps/golem/dev/01_start.R @@ -0,0 +1,74 @@ +# Building a Prod-Ready, Robust Shiny Application. +# +# README: each step of the dev files is optional, and you don't have to +# fill every dev scripts before getting started. +# 01_start.R should be filled at start. +# 02_dev.R should be used to keep track of your development during the project. +# 03_deploy.R should be used once you need to deploy your app. +# +# +######################################## +#### CURRENT FILE: ON START SCRIPT ##### +######################################## + +## Fill the DESCRIPTION ---- +## Add meta data about your application and set some default {golem} options +## +## /!\ Note: if you want to change the name of your app during development, +## either re-run this function, call golem::set_golem_name(), or don't forget +## to change the name in the app_sys() function in app_config.R /!\ +## +golem::fill_desc( + pkg_name = "testapp", # The name of the golem package containing the app (typically lowercase, no underscore or periods) + pkg_title = "PKG_TITLE", # What the Package Does (One Line, Title Case, No Period) + pkg_description = "PKG_DESC.", # What the package does (one paragraph). + authors = person( + given = "AUTHOR_FIRST", # Your First Name + family = "AUTHOR_LAST", # Your Last Name + email = "AUTHOR@MAIL.COM", # Your email + role = c("aut", "cre") # Your role (here author/creator) + ), + repo_url = NULL, # The URL of the GitHub repo (optional), + pkg_version = "0.0.0.9000", # The version of the package containing the app + set_options = TRUE # Set the global golem options +) + +## Install the required dev dependencies ---- +golem::install_dev_deps() + +## Create Common Files ---- +## See ?usethis for more information +usethis::use_mit_license("Golem User") # You can set another license here +golem::use_readme_rmd(open = FALSE) +devtools::build_readme() +# Note that `contact` is required since usethis version 2.1.5 +# If your {usethis} version is older, you can remove that param +usethis::use_code_of_conduct(contact = "Golem User") +usethis::use_lifecycle_badge("Experimental") +usethis::use_news_md(open = FALSE) + +## Init Testing Infrastructure ---- +## Create a template for tests +golem::use_recommended_tests() + +## Favicon ---- +# If you want to change the favicon (default is golem's one) +golem::use_favicon() # path = "path/to/ico". Can be an online file. +# golem::remove_favicon() # Uncomment to remove the default favicon + +## Add helper functions ---- +golem::use_utils_ui(with_test = TRUE) +golem::use_utils_server(with_test = TRUE) + +## Use git ---- +usethis::use_git() +## Sets the remote associated with 'name' to 'url' +usethis::use_git_remote( + name = "origin", + url = "https://github.com//.git" +) + +# You're now set! ---- + +# go to dev/02_dev.R +rstudioapi::navigateToFile("dev/02_dev.R") diff --git a/tests/testthat/apps/golem/dev/02_dev.R b/tests/testthat/apps/golem/dev/02_dev.R new file mode 100644 index 00000000..e896b84d --- /dev/null +++ b/tests/testthat/apps/golem/dev/02_dev.R @@ -0,0 +1,89 @@ +# Building a Prod-Ready, Robust Shiny Application. +# +# README: each step of the dev files is optional, and you don't have to +# fill every dev scripts before getting started. +# 01_start.R should be filled at start. +# 02_dev.R should be used to keep track of your development during the project. +# 03_deploy.R should be used once you need to deploy your app. +# +# +################################### +#### CURRENT FILE: DEV SCRIPT ##### +################################### + +# Engineering + +## Dependencies ---- +## Amend DESCRIPTION with dependencies read from package code parsing +## install.packages('attachment') # if needed. +attachment::att_amend_desc() + +## Add modules ---- +## Create a module infrastructure in R/ +golem::add_module(name = "name_of_module1", with_test = TRUE) # Name of the module +golem::add_module(name = "name_of_module2", with_test = TRUE) # Name of the module + +## Add helper functions ---- +## Creates fct_* and utils_* +golem::add_fct("helpers", with_test = TRUE) +golem::add_utils("helpers", with_test = TRUE) + +## External resources +## Creates .js and .css files at inst/app/www +golem::add_js_file("script") +golem::add_js_handler("handlers") +golem::add_css_file("custom") +golem::add_sass_file("custom") +golem::add_any_file("file.json") + +## Add internal datasets ---- +## If you have data in your package +usethis::use_data_raw(name = "my_dataset", open = FALSE) + +## Tests ---- +## Add one line by test you want to create +usethis::use_test("app") + +# Documentation + +## Vignette ---- +usethis::use_vignette("testapp") +devtools::build_vignettes() + +## Code Coverage---- +## Set the code coverage service ("codecov" or "coveralls") +usethis::use_coverage() + +# Create a summary readme for the testthat subdirectory +covrpage::covrpage() + +## CI ---- +## Use this part of the script if you need to set up a CI +## service for your application +## +## (You'll need GitHub there) +usethis::use_github() + +# GitHub Actions +usethis::use_github_action() +# Chose one of the three +# See https://usethis.r-lib.org/reference/use_github_action.html +usethis::use_github_action_check_release() +usethis::use_github_action_check_standard() +usethis::use_github_action_check_full() +# Add action for PR +usethis::use_github_action_pr_commands() + +# Circle CI +usethis::use_circleci() +usethis::use_circleci_badge() + +# Jenkins +usethis::use_jenkins() + +# GitLab CI +usethis::use_gitlab_ci() + +# You're now set! ---- +# go to dev/03_deploy.R +rstudioapi::navigateToFile("dev/03_deploy.R") diff --git a/tests/testthat/apps/golem/dev/03_deploy.R b/tests/testthat/apps/golem/dev/03_deploy.R new file mode 100644 index 00000000..6b203534 --- /dev/null +++ b/tests/testthat/apps/golem/dev/03_deploy.R @@ -0,0 +1,61 @@ +# Building a Prod-Ready, Robust Shiny Application. +# +# README: each step of the dev files is optional, and you don't have to +# fill every dev scripts before getting started. +# 01_start.R should be filled at start. +# 02_dev.R should be used to keep track of your development during the project. +# 03_deploy.R should be used once you need to deploy your app. +# +# +###################################### +#### CURRENT FILE: DEPLOY SCRIPT ##### +###################################### + +# Test your app + +## Run checks ---- +## Check the package before sending to prod +devtools::check() +rhub::check_for_cran() + +# Deploy + +## Local, CRAN or Package Manager ---- +## This will build a tar.gz that can be installed locally, +## sent to CRAN, or to a package manager +devtools::build() + +## Docker ---- +## If you want to deploy via a generic Dockerfile +golem::add_dockerfile_with_renv() +## If you want to deploy to ShinyProxy +golem::add_dockerfile_with_renv_shinyproxy() + +## Posit ---- +## If you want to deploy on Posit related platforms +golem::add_positconnect_file() +golem::add_shinyappsio_file() +golem::add_shinyserver_file() + +## Deploy to Posit Connect or ShinyApps.io ---- + +## Add/update manifest file (optional; for Git backed deployment on Posit ) +rsconnect::writeManifest() + +## In command line. +rsconnect::deployApp( + appName = desc::desc_get_field("Package"), + appTitle = desc::desc_get_field("Package"), + appFiles = c( + # Add any additional files unique to your app here. + "R/", + "inst/", + "data/", + "NAMESPACE", + "DESCRIPTION", + "app.R" + ), + appId = rsconnect::deployments(".")$appID, + lint = FALSE, + forceUpdate = TRUE +) diff --git a/tests/testthat/apps/golem/dev/run_dev.R b/tests/testthat/apps/golem/dev/run_dev.R new file mode 100644 index 00000000..08030f44 --- /dev/null +++ b/tests/testthat/apps/golem/dev/run_dev.R @@ -0,0 +1,15 @@ +# Set options here +options(golem.app.prod = FALSE) # TRUE = production mode, FALSE = development mode + +# Comment this if you don't want the app to be served on a random port +options(shiny.port = httpuv::randomPort()) + +# Detach all loaded packages and clean your environment +golem::detach_all_attached() +# rm(list=ls(all.names = TRUE)) + +# Document and reload your package +golem::document_and_reload() + +# Run the application +run_app() diff --git a/tests/testthat/apps/golem/inst/app/www/favicon.ico b/tests/testthat/apps/golem/inst/app/www/favicon.ico new file mode 100644 index 00000000..4c0982c0 Binary files /dev/null and b/tests/testthat/apps/golem/inst/app/www/favicon.ico differ diff --git a/tests/testthat/apps/golem/inst/golem-config.yml b/tests/testthat/apps/golem/inst/golem-config.yml new file mode 100644 index 00000000..5dd32382 --- /dev/null +++ b/tests/testthat/apps/golem/inst/golem-config.yml @@ -0,0 +1,11 @@ +default: + golem_name: testapp + golem_version: 0.0.0.9000 + app_prod: no + +production: + app_prod: yes + +dev: + golem_wd: !expr golem::pkg_path() + diff --git a/tests/testthat/apps/golem/man/run_app.Rd b/tests/testthat/apps/golem/man/run_app.Rd new file mode 100644 index 00000000..c6c36f74 --- /dev/null +++ b/tests/testthat/apps/golem/man/run_app.Rd @@ -0,0 +1,41 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/run_app.R +\name{run_app} +\alias{run_app} +\title{Run the Shiny Application} +\usage{ +run_app( + onStart = NULL, + options = list(), + enableBookmarking = NULL, + uiPattern = "/", + ... +) +} +\arguments{ +\item{onStart}{A function that will be called before the app is actually run. +This is only needed for \code{shinyAppObj}, since in the \code{shinyAppDir} +case, a \code{global.R} file can be used for this purpose.} + +\item{options}{Named options that should be passed to the \code{runApp} call +(these can be any of the following: "port", "launch.browser", "host", "quiet", +"display.mode" and "test.mode"). You can also specify \code{width} and +\code{height} parameters which provide a hint to the embedding environment +about the ideal height/width for the app.} + +\item{enableBookmarking}{Can be one of \code{"url"}, \code{"server"}, or +\code{"disable"}. The default value, \code{NULL}, will respect the setting from +any previous calls to \code{\link[shiny:enableBookmarking]{enableBookmarking()}}. See \code{\link[shiny:enableBookmarking]{enableBookmarking()}} +for more information on bookmarking your app.} + +\item{uiPattern}{A regular expression that will be applied to each \code{GET} +request to determine whether the \code{ui} should be used to handle the +request. Note that the entire request path must match the regular +expression in order for the match to be considered successful.} + +\item{...}{arguments to pass to golem_opts. +See `?golem::get_golem_options` for more details.} +} +\description{ +Run the Shiny Application +} diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/001.png b/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/001.png deleted file mode 100644 index a2220500..00000000 Binary files a/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/001.png and /dev/null differ diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/002_.png b/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/002_.png deleted file mode 100644 index a2220500..00000000 Binary files a/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/002_.png and /dev/null differ diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/003_.png b/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/003_.png deleted file mode 100644 index ed257235..00000000 Binary files a/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/003_.png and /dev/null differ diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/manual-screenshot.png b/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/manual-screenshot.png deleted file mode 100644 index a2220500..00000000 Binary files a/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/manual-screenshot.png and /dev/null differ diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.4/app/manual-screenshot.png b/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.4/app/manual-screenshot.png new file mode 100644 index 00000000..2dbd6b16 Binary files /dev/null and b/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.4/app/manual-screenshot.png differ diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app.md b/tests/testthat/apps/hello/tests/testthat/_snaps/mac/app.md similarity index 100% rename from tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app.md rename to tests/testthat/apps/hello/tests/testthat/_snaps/mac/app.md diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/mac/app/001.png b/tests/testthat/apps/hello/tests/testthat/_snaps/mac/app/001.png new file mode 100644 index 00000000..2dbd6b16 Binary files /dev/null and b/tests/testthat/apps/hello/tests/testthat/_snaps/mac/app/001.png differ diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/002.json b/tests/testthat/apps/hello/tests/testthat/_snaps/mac/app/002.json similarity index 100% rename from tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/002.json rename to tests/testthat/apps/hello/tests/testthat/_snaps/mac/app/002.json diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/mac/app/002_.png b/tests/testthat/apps/hello/tests/testthat/_snaps/mac/app/002_.png new file mode 100644 index 00000000..2dbd6b16 Binary files /dev/null and b/tests/testthat/apps/hello/tests/testthat/_snaps/mac/app/002_.png differ diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/003.json b/tests/testthat/apps/hello/tests/testthat/_snaps/mac/app/003.json similarity index 100% rename from tests/testthat/apps/hello/tests/testthat/_snaps/mac-4.1/app/003.json rename to tests/testthat/apps/hello/tests/testthat/_snaps/mac/app/003.json diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/mac/app/003_.png b/tests/testthat/apps/hello/tests/testthat/_snaps/mac/app/003_.png new file mode 100644 index 00000000..f59e921a Binary files /dev/null and b/tests/testthat/apps/hello/tests/testthat/_snaps/mac/app/003_.png differ diff --git a/tests/testthat/apps/hello/tests/testthat/_snaps/mac/app/manual-screenshot.png b/tests/testthat/apps/hello/tests/testthat/_snaps/mac/app/manual-screenshot.png new file mode 100644 index 00000000..2dbd6b16 Binary files /dev/null and b/tests/testthat/apps/hello/tests/testthat/_snaps/mac/app/manual-screenshot.png differ diff --git a/tests/testthat/apps/hello/tests/testthat/test-app.R b/tests/testthat/apps/hello/tests/testthat/test-app.R index 2d22fbad..837c299e 100644 --- a/tests/testthat/apps/hello/tests/testthat/test-app.R +++ b/tests/testthat/apps/hello/tests/testthat/test-app.R @@ -8,10 +8,9 @@ # app$snapshot(list(output = "greeting")) # }) - # shinytest2 code using `app$**()`: test_that("basic website example works using shinytest", { - app <- AppDriver$new(variant = platform_variant()) + app <- AppDriver$new(variant = platform_variant(r_version = FALSE)) app$set_inputs(name = "Hadley") app$set_inputs(greet = "click") @@ -30,7 +29,10 @@ test_that("basic website example works using shinytest", { # shinytest2 code using `app$**()`: test_that("basic website example works using testthat", { - app <- AppDriver$new(variant = platform_variant(), name = "manual") + app <- AppDriver$new( + variant = platform_variant(r_version = FALSE), + name = "manual" + ) app$set_inputs(name = "Hadley") app$set_inputs(greet = "click") @@ -38,7 +40,11 @@ test_that("basic website example works using testthat", { # Take picture and record inputs / outputs tmpfile <- tempfile() app$get_screenshot(tmpfile) - expect_snapshot_file(tmpfile, name = "manual-screenshot.png", variant = app$get_variant()) + expect_snapshot_file( + tmpfile, + name = "manual-screenshot.png", + variant = app$get_variant() + ) values <- app$get_values() expect_equal(values$output$greeting, "Hello Hadley!") diff --git a/tests/testthat/apps/image/tests/testthat/_snaps/image/sa-user-001_.png b/tests/testthat/apps/image/tests/testthat/_snaps/image/sa-user-001_.png index b2f09258..faf368eb 100644 Binary files a/tests/testthat/apps/image/tests/testthat/_snaps/image/sa-user-001_.png and b/tests/testthat/apps/image/tests/testthat/_snaps/image/sa-user-001_.png differ diff --git a/tests/testthat/apps/image/tests/testthat/_snaps/image/sa-values-001_.png b/tests/testthat/apps/image/tests/testthat/_snaps/image/sa-values-001_.png index b2f09258..faf368eb 100644 Binary files a/tests/testthat/apps/image/tests/testthat/_snaps/image/sa-values-001_.png and b/tests/testthat/apps/image/tests/testthat/_snaps/image/sa-values-001_.png differ diff --git a/tests/testthat/apps/image/tests/testthat/_snaps/image/screen1-001.png b/tests/testthat/apps/image/tests/testthat/_snaps/image/screen1-001.png index b2f09258..faf368eb 100644 Binary files a/tests/testthat/apps/image/tests/testthat/_snaps/image/screen1-001.png and b/tests/testthat/apps/image/tests/testthat/_snaps/image/screen1-001.png differ diff --git a/tests/testthat/apps/image/tests/testthat/_snaps/image/screen2-001.png b/tests/testthat/apps/image/tests/testthat/_snaps/image/screen2-001.png index b2f09258..faf368eb 100644 Binary files a/tests/testthat/apps/image/tests/testthat/_snaps/image/screen2-001.png and b/tests/testthat/apps/image/tests/testthat/_snaps/image/screen2-001.png differ diff --git a/tests/testthat/apps/image/tests/testthat/_snaps/mac-4.1/image/001_.png b/tests/testthat/apps/image/tests/testthat/_snaps/mac-4.1/image/001_.png deleted file mode 100644 index bbb05432..00000000 Binary files a/tests/testthat/apps/image/tests/testthat/_snaps/mac-4.1/image/001_.png and /dev/null differ diff --git a/tests/testthat/apps/image/tests/testthat/_snaps/mac-4.1/image/002_.png b/tests/testthat/apps/image/tests/testthat/_snaps/mac-4.1/image/002_.png deleted file mode 100644 index 85cd6637..00000000 Binary files a/tests/testthat/apps/image/tests/testthat/_snaps/mac-4.1/image/002_.png and /dev/null differ diff --git a/tests/testthat/apps/image/tests/testthat/_snaps/mac-4.1/image/001.json b/tests/testthat/apps/image/tests/testthat/_snaps/mac/image/001.json similarity index 100% rename from tests/testthat/apps/image/tests/testthat/_snaps/mac-4.1/image/001.json rename to tests/testthat/apps/image/tests/testthat/_snaps/mac/image/001.json diff --git a/tests/testthat/apps/image/tests/testthat/_snaps/mac/image/001_.png b/tests/testthat/apps/image/tests/testthat/_snaps/mac/image/001_.png new file mode 100644 index 00000000..62b98e39 Binary files /dev/null and b/tests/testthat/apps/image/tests/testthat/_snaps/mac/image/001_.png differ diff --git a/tests/testthat/apps/image/tests/testthat/_snaps/mac-4.1/image/002.json b/tests/testthat/apps/image/tests/testthat/_snaps/mac/image/002.json similarity index 100% rename from tests/testthat/apps/image/tests/testthat/_snaps/mac-4.1/image/002.json rename to tests/testthat/apps/image/tests/testthat/_snaps/mac/image/002.json diff --git a/tests/testthat/apps/image/tests/testthat/_snaps/mac/image/002_.png b/tests/testthat/apps/image/tests/testthat/_snaps/mac/image/002_.png new file mode 100644 index 00000000..2e0ca691 Binary files /dev/null and b/tests/testthat/apps/image/tests/testthat/_snaps/mac/image/002_.png differ diff --git a/tests/testthat/apps/image/tests/testthat/test-image.R b/tests/testthat/apps/image/tests/testthat/test-image.R index 44832625..52a0fa5b 100644 --- a/tests/testthat/apps/image/tests/testthat/test-image.R +++ b/tests/testthat/apps/image/tests/testthat/test-image.R @@ -2,7 +2,7 @@ library(shinytest2) test_that("images are captured via expect_values", { app <- AppDriver$new( - variant = platform_variant() + variant = platform_variant(r_version = FALSE) # name = "values-image" ) @@ -10,9 +10,11 @@ test_that("images are captured via expect_values", { app$expect_values() # Add something that will always produce a new image - app$run_js(' + app$run_js( + ' $("body").append("
" + new Date() + "
") - ') + ' + ) # Since it is zoomed in on the image, the text will be NOT be displayed app$expect_values(output = "img") @@ -21,7 +23,6 @@ test_that("images are captured via expect_values", { # app$expect_values() }) - # TODO-future; Perform these tests via mock to assert proper screenshot args are captured. test_that("Values screenshot args are used", { app <- AppDriver$new( @@ -45,8 +46,6 @@ test_that("User screenshot args are used instead of auto defined screenshot args app$expect_values(screenshot_args = list(selector = "#green")) }) - - # TODO-future; Perform these tests via mock to assert proper screenshot args are captured. test_that("No screenshot is taken", { app <- AppDriver$new( @@ -67,7 +66,6 @@ test_that("No screenshot is taken", { app$expect_values(screenshot_args = FALSE) }) - test_that("screenshot can be expected", { app <- AppDriver$new( variant = NULL, diff --git a/tests/testthat/apps/pkg/.Rbuildignore b/tests/testthat/apps/pkg/.Rbuildignore new file mode 100644 index 00000000..5163d0b5 --- /dev/null +++ b/tests/testthat/apps/pkg/.Rbuildignore @@ -0,0 +1 @@ +^LICENSE\.md$ diff --git a/tests/testthat/apps/pkg/DESCRIPTION b/tests/testthat/apps/pkg/DESCRIPTION new file mode 100644 index 00000000..0e2bdb6d --- /dev/null +++ b/tests/testthat/apps/pkg/DESCRIPTION @@ -0,0 +1,10 @@ +Package: expkg +Title: Testing package +Version: 0.0.0.9000 +Authors@R: + person("Barret", "Schloerke", , "barret@posit.it", role = c("aut", "cre")) +Description: Tests whether or not the local, non-cran package is loaded for app testing. +License: MIT + file LICENSE +Encoding: UTF-8 +Roxygen: list(markdown = TRUE) +RoxygenNote: 7.3.2 diff --git a/tests/testthat/apps/pkg/LICENSE b/tests/testthat/apps/pkg/LICENSE new file mode 100644 index 00000000..b5216a74 --- /dev/null +++ b/tests/testthat/apps/pkg/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2025 +COPYRIGHT HOLDER: expkg authors diff --git a/tests/testthat/apps/pkg/LICENSE.md b/tests/testthat/apps/pkg/LICENSE.md new file mode 100644 index 00000000..4d46bec5 --- /dev/null +++ b/tests/testthat/apps/pkg/LICENSE.md @@ -0,0 +1,21 @@ +# MIT License + +Copyright (c) 2025 expkg authors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tests/testthat/apps/pkg/NAMESPACE b/tests/testthat/apps/pkg/NAMESPACE new file mode 100644 index 00000000..e7edd036 --- /dev/null +++ b/tests/testthat/apps/pkg/NAMESPACE @@ -0,0 +1,3 @@ +# Generated by roxygen2: do not edit by hand + +export(expkg_exported_value) diff --git a/tests/testthat/apps/pkg/R/value.R b/tests/testthat/apps/pkg/R/value.R new file mode 100644 index 00000000..205f8926 --- /dev/null +++ b/tests/testthat/apps/pkg/R/value.R @@ -0,0 +1,5 @@ +expkg_internal_value <- "expkg internal value" + +#' Exported docs +#' @export +expkg_exported_value <- "expkg exported value" \ No newline at end of file diff --git a/tests/testthat/apps/pkg/app.R b/tests/testthat/apps/pkg/app.R new file mode 100644 index 00000000..c9b47fc7 --- /dev/null +++ b/tests/testthat/apps/pkg/app.R @@ -0,0 +1,24 @@ + +testthat::expect_error(expkg_internal_value) +testthat::expect_error(expkg_exported_value) + +library(expkg) + +testthat::expect_error(expkg_internal_value) +testthat::expect_equal(expkg_exported_value, "expkg exported value") + +testthat::expect_equal(expkg:::expkg_internal_value, "expkg internal value") + +app <- shinyApp( + ui = fluidPage( + tags$h1("Local Package Example"), + tags$p("If this app loads, it is a success!"), + actionButton("btn", "Click Me"), + verbatimTextOutput("btn_click_count") + ), + server = function(input, output) { + output$btn_click_count <- renderText({ + input$btn + }) + } +) diff --git a/tests/testthat/apps/pkg/man/expkg_exported_value.Rd b/tests/testthat/apps/pkg/man/expkg_exported_value.Rd new file mode 100644 index 00000000..844112c5 --- /dev/null +++ b/tests/testthat/apps/pkg/man/expkg_exported_value.Rd @@ -0,0 +1,16 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/value.R +\docType{data} +\name{expkg_exported_value} +\alias{expkg_exported_value} +\title{Exported docs} +\format{ +An object of class \code{character} of length 1. +} +\usage{ +expkg_exported_value +} +\description{ +Exported docs +} +\keyword{datasets} diff --git a/tests/testthat/apps/pkg/tests/testthat.R b/tests/testthat/apps/pkg/tests/testthat.R new file mode 100644 index 00000000..7d25b5b9 --- /dev/null +++ b/tests/testthat/apps/pkg/tests/testthat.R @@ -0,0 +1 @@ +shinytest2::test_app() diff --git a/tests/testthat/apps/pkg/tests/testthat/setup.R b/tests/testthat/apps/pkg/tests/testthat/setup.R new file mode 100644 index 00000000..80d55d27 --- /dev/null +++ b/tests/testthat/apps/pkg/tests/testthat/setup.R @@ -0,0 +1 @@ +shinytest2::load_app_env() diff --git a/tests/testthat/apps/pkg/tests/testthat/test-pkg.R b/tests/testthat/apps/pkg/tests/testthat/test-pkg.R new file mode 100644 index 00000000..7d174bbf --- /dev/null +++ b/tests/testthat/apps/pkg/tests/testthat/test-pkg.R @@ -0,0 +1,29 @@ +test_that("Local pkg loads", { + # No library calls! + # expkg should be auto loaded by testthat + + expect_equal(expkg_internal_value, "expkg internal value") + expect_equal(expkg_exported_value, "expkg exported value") + +}) + +test_that("App requires library calls to load pkg", { + + app <- AppDriver$new() + app$wait_for_idle() + + expect_equal( + app$get_value(output = "btn_click_count"), + 0 + ) + + app$click("btn") + + expect_equal( + app$get_value(output = "btn_click_count"), + 1 + ) + +}) + +stop("This is not testing that a package can be loaded. It's testing an app that loads a package. It needs to be reversed") \ No newline at end of file diff --git a/tests/testthat/apps/rhino/.Rprofile b/tests/testthat/apps/rhino/.Rprofile new file mode 100644 index 00000000..c71c4fbf --- /dev/null +++ b/tests/testthat/apps/rhino/.Rprofile @@ -0,0 +1,18 @@ +if (file.exists("renv")) { + source("renv/activate.R") +} else { + # The `renv` directory is automatically skipped when deploying with rsconnect. + message("No 'renv' directory found; renv won't be activated.") +} + +# Allow absolute module imports (relative to the app root). +options(box.path = getwd()) + +# box.lsp languageserver external hook +if (nzchar(system.file(package = "box.lsp"))) { + options( + languageserver.parser_hooks = list( + "box::use" = box.lsp::box_use_parser + ) + ) +} diff --git a/tests/testthat/apps/rhino/.github/workflows/rhino-test.yml b/tests/testthat/apps/rhino/.github/workflows/rhino-test.yml new file mode 100644 index 00000000..b6c85664 --- /dev/null +++ b/tests/testthat/apps/rhino/.github/workflows/rhino-test.yml @@ -0,0 +1,80 @@ +name: Rhino Test +on: + # Run on pushes to 'main' branch + push: + branches: + - main + # Run on any opened pull request + pull_request: + # Run manually via GitHub Actions website + workflow_dispatch: +permissions: + contents: read +jobs: + main: + name: Run linters and tests + runs-on: ubuntu-22.04 + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup system dependencies + run: | + packages=( + # List each package on a separate line. + ) + sudo apt-get update + sudo apt-get install --yes "${packages[@]}" + + - name: Setup R + uses: r-lib/actions/setup-r@v2 + with: + r-version: renv + + - name: Setup R dependencies + uses: r-lib/actions/setup-renv@v2 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 20 + + - name: Lint R + if: always() + shell: Rscript {0} + run: rhino::lint_r() + + - name: Lint JavaScript + if: always() + shell: Rscript {0} + run: rhino::lint_js() + + - name: Lint Sass + if: always() + shell: Rscript {0} + run: rhino::lint_sass() + + - name: Build JavaScript + if: always() + shell: Rscript {0} + run: rhino::build_js() + + - name: Build Sass + if: always() + shell: Rscript {0} + run: rhino::build_sass() + + - name: Run R unit tests + if: always() + shell: Rscript {0} + run: rhino::test_r() + + - name: Run Cypress end-to-end tests + if: always() + uses: cypress-io/github-action@v6 + with: + working-directory: .rhino # Created by earlier commands which use Node.js + start: npm run run-app + project: ../tests + wait-on: 'http://localhost:3333/' + wait-on-timeout: 60 diff --git a/tests/testthat/apps/rhino/.lintr b/tests/testthat/apps/rhino/.lintr new file mode 100644 index 00000000..da7cb04e --- /dev/null +++ b/tests/testthat/apps/rhino/.lintr @@ -0,0 +1,5 @@ +linters: + linters_with_defaults( + defaults = box.linters::rhino_default_linters, + line_length_linter = line_length_linter(100) + ) diff --git a/tests/testthat/apps/rhino/.renvignore b/tests/testthat/apps/rhino/.renvignore new file mode 100644 index 00000000..4f16dc6d --- /dev/null +++ b/tests/testthat/apps/rhino/.renvignore @@ -0,0 +1,3 @@ +# Only use `dependencies.R` to infer project dependencies. +* +!dependencies.R diff --git a/tests/testthat/apps/rhino/.rscignore b/tests/testthat/apps/rhino/.rscignore new file mode 100644 index 00000000..fdd749b5 --- /dev/null +++ b/tests/testthat/apps/rhino/.rscignore @@ -0,0 +1,7 @@ +.github +.lintr +.renvignore +.Renviron +.rhino +.rscignore +tests diff --git a/tests/testthat/apps/rhino/app.R b/tests/testthat/apps/rhino/app.R new file mode 100644 index 00000000..93288192 --- /dev/null +++ b/tests/testthat/apps/rhino/app.R @@ -0,0 +1,2 @@ +# Rhino / shinyApp entrypoint. Do not edit. +rhino::app() diff --git a/tests/testthat/apps/rhino/app/js/index.js b/tests/testthat/apps/rhino/app/js/index.js new file mode 100644 index 00000000..e69de29b diff --git a/tests/testthat/apps/rhino/app/logic/__init__.R b/tests/testthat/apps/rhino/app/logic/__init__.R new file mode 100644 index 00000000..51c43579 --- /dev/null +++ b/tests/testthat/apps/rhino/app/logic/__init__.R @@ -0,0 +1,2 @@ +# Logic: application code independent from Shiny. +# https://go.appsilon.com/rhino-project-structure diff --git a/tests/testthat/apps/rhino/app/main.R b/tests/testthat/apps/rhino/app/main.R new file mode 100644 index 00000000..f310d7e9 --- /dev/null +++ b/tests/testthat/apps/rhino/app/main.R @@ -0,0 +1,25 @@ +box::use( + shiny[bootstrapPage, div, moduleServer, NS, renderUI, tags, uiOutput], +) + +#' @export +ui <- function(id) { + ns <- NS(id) + bootstrapPage( + uiOutput(ns("message")) + ) +} + +#' @export +server <- function(id) { + moduleServer(id, function(input, output, session) { + output$message <- renderUI({ + div( + style = "display: flex; justify-content: center; align-items: center; height: 100vh;", + tags$h1( + tags$a("Check out Rhino docs!", href = "https://appsilon.github.io/rhino/") + ) + ) + }) + }) +} diff --git a/tests/testthat/apps/rhino/app/static/favicon.ico b/tests/testthat/apps/rhino/app/static/favicon.ico new file mode 100644 index 00000000..9f938b2b Binary files /dev/null and b/tests/testthat/apps/rhino/app/static/favicon.ico differ diff --git a/tests/testthat/apps/rhino/app/styles/main.scss b/tests/testthat/apps/rhino/app/styles/main.scss new file mode 100644 index 00000000..e69de29b diff --git a/tests/testthat/apps/rhino/app/view/__init__.R b/tests/testthat/apps/rhino/app/view/__init__.R new file mode 100644 index 00000000..65702e2e --- /dev/null +++ b/tests/testthat/apps/rhino/app/view/__init__.R @@ -0,0 +1,2 @@ +# View: Shiny modules and related code. +# https://go.appsilon.com/rhino-project-structure diff --git a/tests/testthat/apps/rhino/config.yml b/tests/testthat/apps/rhino/config.yml new file mode 100644 index 00000000..e829f276 --- /dev/null +++ b/tests/testthat/apps/rhino/config.yml @@ -0,0 +1,3 @@ +default: + rhino_log_level: !expr Sys.getenv("RHINO_LOG_LEVEL", "INFO") + rhino_log_file: !expr Sys.getenv("RHINO_LOG_FILE", NA) diff --git a/tests/testthat/apps/rhino/dependencies.R b/tests/testthat/apps/rhino/dependencies.R new file mode 100644 index 00000000..4a38316a --- /dev/null +++ b/tests/testthat/apps/rhino/dependencies.R @@ -0,0 +1,4 @@ +# This file allows packrat (used by rsconnect during deployment) to pick up dependencies. +library(rhino) +library(treesitter) +library(treesitter.r) diff --git a/tests/testthat/apps/rhino/renv.lock b/tests/testthat/apps/rhino/renv.lock new file mode 100644 index 00000000..5c282d3e --- /dev/null +++ b/tests/testthat/apps/rhino/renv.lock @@ -0,0 +1,373 @@ +{ + "R": { + "Version": "4.4.2", + "Repositories": [ + { + "Name": "CRAN", + "URL": "https://cloud.r-project.org" + } + ] + }, + "Packages": { + "R6": { + "Package": "R6", + "Version": "2.5.1", + "Source": "Repository", + "Title": "Encapsulated Classes with Reference Semantics", + "Authors@R": "person(\"Winston\", \"Chang\", role = c(\"aut\", \"cre\"), email = \"winston@stdout.org\")", + "Description": "Creates classes with reference semantics, similar to R's built-in reference classes. Compared to reference classes, R6 classes are simpler and lighter-weight, and they are not built on S4 classes so they do not require the methods package. These classes allow public and private members, and they support inheritance, even when the classes are defined in different packages.", + "Depends": [ + "R (>= 3.0)" + ], + "Suggests": [ + "testthat", + "pryr" + ], + "License": "MIT + file LICENSE", + "URL": "https://r6.r-lib.org, https://github.com/r-lib/R6/", + "BugReports": "https://github.com/r-lib/R6/issues", + "RoxygenNote": "7.1.1", + "NeedsCompilation": "no", + "Author": "Winston Chang [aut, cre]", + "Maintainer": "Winston Chang ", + "Repository": "CRAN" + }, + "cli": { + "Package": "cli", + "Version": "3.6.3", + "Source": "Repository", + "Title": "Helpers for Developing Command Line Interfaces", + "Authors@R": "c( person(\"Gábor\", \"Csárdi\", , \"csardi.gabor@gmail.com\", role = c(\"aut\", \"cre\")), person(\"Hadley\", \"Wickham\", role = \"ctb\"), person(\"Kirill\", \"Müller\", role = \"ctb\"), person(\"Salim\", \"Brüggemann\", , \"salim-b@pm.me\", role = \"ctb\", comment = c(ORCID = \"0000-0002-5329-5987\")), person(\"Posit Software, PBC\", role = c(\"cph\", \"fnd\")) )", + "Description": "A suite of tools to build attractive command line interfaces ('CLIs'), from semantic elements: headings, lists, alerts, paragraphs, etc. Supports custom themes via a 'CSS'-like language. It also contains a number of lower level 'CLI' elements: rules, boxes, trees, and 'Unicode' symbols with 'ASCII' alternatives. It support ANSI colors and text styles as well.", + "License": "MIT + file LICENSE", + "URL": "https://cli.r-lib.org, https://github.com/r-lib/cli", + "BugReports": "https://github.com/r-lib/cli/issues", + "Depends": [ + "R (>= 3.4)" + ], + "Imports": [ + "utils" + ], + "Suggests": [ + "callr", + "covr", + "crayon", + "digest", + "glue (>= 1.6.0)", + "grDevices", + "htmltools", + "htmlwidgets", + "knitr", + "methods", + "mockery", + "processx", + "ps (>= 1.3.4.9000)", + "rlang (>= 1.0.2.9003)", + "rmarkdown", + "rprojroot", + "rstudioapi", + "testthat", + "tibble", + "whoami", + "withr" + ], + "Config/Needs/website": "r-lib/asciicast, bench, brio, cpp11, decor, desc, fansi, prettyunits, sessioninfo, tidyverse/tidytemplate, usethis, vctrs", + "Config/testthat/edition": "3", + "Encoding": "UTF-8", + "RoxygenNote": "7.2.3", + "NeedsCompilation": "yes", + "Author": "Gábor Csárdi [aut, cre], Hadley Wickham [ctb], Kirill Müller [ctb], Salim Brüggemann [ctb] (), Posit Software, PBC [cph, fnd]", + "Maintainer": "Gábor Csárdi ", + "Repository": "CRAN" + }, + "glue": { + "Package": "glue", + "Version": "1.8.0", + "Source": "Repository", + "Title": "Interpreted String Literals", + "Authors@R": "c( person(\"Jim\", \"Hester\", role = \"aut\", comment = c(ORCID = \"0000-0002-2739-7082\")), person(\"Jennifer\", \"Bryan\", , \"jenny@posit.co\", role = c(\"aut\", \"cre\"), comment = c(ORCID = \"0000-0002-6983-2759\")), person(\"Posit Software, PBC\", role = c(\"cph\", \"fnd\")) )", + "Description": "An implementation of interpreted string literals, inspired by Python's Literal String Interpolation and Docstrings and Julia's Triple-Quoted String Literals .", + "License": "MIT + file LICENSE", + "URL": "https://glue.tidyverse.org/, https://github.com/tidyverse/glue", + "BugReports": "https://github.com/tidyverse/glue/issues", + "Depends": [ + "R (>= 3.6)" + ], + "Imports": [ + "methods" + ], + "Suggests": [ + "crayon", + "DBI (>= 1.2.0)", + "dplyr", + "knitr", + "magrittr", + "rlang", + "rmarkdown", + "RSQLite", + "testthat (>= 3.2.0)", + "vctrs (>= 0.3.0)", + "waldo (>= 0.5.3)", + "withr" + ], + "VignetteBuilder": "knitr", + "ByteCompile": "true", + "Config/Needs/website": "bench, forcats, ggbeeswarm, ggplot2, R.utils, rprintf, tidyr, tidyverse/tidytemplate", + "Config/testthat/edition": "3", + "Encoding": "UTF-8", + "RoxygenNote": "7.3.2", + "NeedsCompilation": "yes", + "Author": "Jim Hester [aut] (), Jennifer Bryan [aut, cre] (), Posit Software, PBC [cph, fnd]", + "Maintainer": "Jennifer Bryan ", + "Repository": "CRAN" + }, + "lifecycle": { + "Package": "lifecycle", + "Version": "1.0.4", + "Source": "Repository", + "Title": "Manage the Life Cycle of your Package Functions", + "Authors@R": "c( person(\"Lionel\", \"Henry\", , \"lionel@posit.co\", role = c(\"aut\", \"cre\")), person(\"Hadley\", \"Wickham\", , \"hadley@posit.co\", role = \"aut\", comment = c(ORCID = \"0000-0003-4757-117X\")), person(\"Posit Software, PBC\", role = c(\"cph\", \"fnd\")) )", + "Description": "Manage the life cycle of your exported functions with shared conventions, documentation badges, and user-friendly deprecation warnings.", + "License": "MIT + file LICENSE", + "URL": "https://lifecycle.r-lib.org/, https://github.com/r-lib/lifecycle", + "BugReports": "https://github.com/r-lib/lifecycle/issues", + "Depends": [ + "R (>= 3.6)" + ], + "Imports": [ + "cli (>= 3.4.0)", + "glue", + "rlang (>= 1.1.0)" + ], + "Suggests": [ + "covr", + "crayon", + "knitr", + "lintr", + "rmarkdown", + "testthat (>= 3.0.1)", + "tibble", + "tidyverse", + "tools", + "vctrs", + "withr" + ], + "VignetteBuilder": "knitr", + "Config/Needs/website": "tidyverse/tidytemplate, usethis", + "Config/testthat/edition": "3", + "Encoding": "UTF-8", + "RoxygenNote": "7.2.1", + "NeedsCompilation": "no", + "Author": "Lionel Henry [aut, cre], Hadley Wickham [aut] (), Posit Software, PBC [cph, fnd]", + "Maintainer": "Lionel Henry ", + "Repository": "CRAN" + }, + "renv": { + "Package": "renv", + "Version": "1.1.1", + "Source": "Repository", + "Type": "Package", + "Title": "Project Environments", + "Authors@R": "c( person(\"Kevin\", \"Ushey\", role = c(\"aut\", \"cre\"), email = \"kevin@rstudio.com\", comment = c(ORCID = \"0000-0003-2880-7407\")), person(\"Hadley\", \"Wickham\", role = c(\"aut\"), email = \"hadley@rstudio.com\", comment = c(ORCID = \"0000-0003-4757-117X\")), person(\"Posit Software, PBC\", role = c(\"cph\", \"fnd\")) )", + "Description": "A dependency management toolkit for R. Using 'renv', you can create and manage project-local R libraries, save the state of these libraries to a 'lockfile', and later restore your library as required. Together, these tools can help make your projects more isolated, portable, and reproducible.", + "License": "MIT + file LICENSE", + "URL": "https://rstudio.github.io/renv/, https://github.com/rstudio/renv", + "BugReports": "https://github.com/rstudio/renv/issues", + "Imports": [ + "utils" + ], + "Suggests": [ + "BiocManager", + "cli", + "compiler", + "covr", + "cpp11", + "devtools", + "gitcreds", + "jsonlite", + "jsonvalidate", + "knitr", + "miniUI", + "modules", + "packrat", + "pak", + "R6", + "remotes", + "reticulate", + "rmarkdown", + "rstudioapi", + "shiny", + "testthat", + "uuid", + "waldo", + "yaml", + "webfakes" + ], + "Encoding": "UTF-8", + "RoxygenNote": "7.3.2", + "VignetteBuilder": "knitr", + "Config/Needs/website": "tidyverse/tidytemplate", + "Config/testthat/edition": "3", + "Config/testthat/parallel": "true", + "Config/testthat/start-first": "bioconductor,python,install,restore,snapshot,retrieve,remotes", + "NeedsCompilation": "no", + "Author": "Kevin Ushey [aut, cre] (), Hadley Wickham [aut] (), Posit Software, PBC [cph, fnd]", + "Maintainer": "Kevin Ushey ", + "Repository": "CRAN" + }, + "rlang": { + "Package": "rlang", + "Version": "1.1.5", + "Source": "Repository", + "Title": "Functions for Base Types and Core R and 'Tidyverse' Features", + "Description": "A toolbox for working with base types, core R features like the condition system, and core 'Tidyverse' features like tidy evaluation.", + "Authors@R": "c( person(\"Lionel\", \"Henry\", ,\"lionel@posit.co\", c(\"aut\", \"cre\")), person(\"Hadley\", \"Wickham\", ,\"hadley@posit.co\", \"aut\"), person(given = \"mikefc\", email = \"mikefc@coolbutuseless.com\", role = \"cph\", comment = \"Hash implementation based on Mike's xxhashlite\"), person(given = \"Yann\", family = \"Collet\", role = \"cph\", comment = \"Author of the embedded xxHash library\"), person(given = \"Posit, PBC\", role = c(\"cph\", \"fnd\")) )", + "License": "MIT + file LICENSE", + "ByteCompile": "true", + "Biarch": "true", + "Depends": [ + "R (>= 3.5.0)" + ], + "Imports": [ + "utils" + ], + "Suggests": [ + "cli (>= 3.1.0)", + "covr", + "crayon", + "fs", + "glue", + "knitr", + "magrittr", + "methods", + "pillar", + "rmarkdown", + "stats", + "testthat (>= 3.0.0)", + "tibble", + "usethis", + "vctrs (>= 0.2.3)", + "withr" + ], + "Enhances": [ + "winch" + ], + "Encoding": "UTF-8", + "RoxygenNote": "7.3.2", + "URL": "https://rlang.r-lib.org, https://github.com/r-lib/rlang", + "BugReports": "https://github.com/r-lib/rlang/issues", + "Config/testthat/edition": "3", + "Config/Needs/website": "dplyr, tidyverse/tidytemplate", + "NeedsCompilation": "yes", + "Author": "Lionel Henry [aut, cre], Hadley Wickham [aut], mikefc [cph] (Hash implementation based on Mike's xxhashlite), Yann Collet [cph] (Author of the embedded xxHash library), Posit, PBC [cph, fnd]", + "Maintainer": "Lionel Henry ", + "Repository": "CRAN" + }, + "treesitter": { + "Package": "treesitter", + "Version": "0.1.0", + "Source": "Repository", + "Title": "Bindings to 'Tree-Sitter'", + "Authors@R": "c( person(\"Davis\", \"Vaughan\", , \"davis@posit.co\", role = c(\"aut\", \"cre\")), person(\"Posit Software, PBC\", role = c(\"cph\", \"fnd\")), person(\"Tree-sitter authors\", role = \"cph\", comment = \"Tree-sitter C library\") )", + "Description": "Provides bindings to 'Tree-sitter', an incremental parsing system for programming tools. 'Tree-sitter' builds concrete syntax trees for source files of any language, and can efficiently update those syntax trees as the source file is edited. It also includes a robust error recovery system that provides useful parse results even in the presence of syntax errors.", + "License": "MIT + file LICENSE", + "URL": "https://github.com/DavisVaughan/r-tree-sitter", + "BugReports": "https://github.com/DavisVaughan/r-tree-sitter/issues", + "Depends": [ + "R (>= 4.3.0)" + ], + "Imports": [ + "cli (>= 3.6.2)", + "R6 (>= 2.5.1)", + "rlang (>= 1.1.3)", + "vctrs (>= 0.6.5)" + ], + "Suggests": [ + "testthat (>= 3.0.0)", + "treesitter.r" + ], + "Config/Needs/website": "tidyverse/tidytemplate", + "Config/testthat/edition": "3", + "Encoding": "UTF-8", + "RoxygenNote": "7.3.1", + "NeedsCompilation": "yes", + "Author": "Davis Vaughan [aut, cre], Posit Software, PBC [cph, fnd], Tree-sitter authors [cph] (Tree-sitter C library)", + "Maintainer": "Davis Vaughan ", + "Repository": "CRAN" + }, + "treesitter.r": { + "Package": "treesitter.r", + "Version": "1.1.0", + "Source": "Repository", + "Title": "'R' Grammar for 'Tree-Sitter'", + "Authors@R": "c( person(\"Davis\", \"Vaughan\", , \"davis@posit.co\", role = c(\"aut\", \"cre\")), person(\"Posit Software, PBC\", role = c(\"cph\", \"fnd\")), person(\"Tree-sitter authors\", role = \"cph\", comment = \"Tree-sitter C headers and parser.c\") )", + "Description": "Provides bindings to an 'R' grammar for 'Tree-sitter', to be used alongside the 'treesitter' package. 'Tree-sitter' builds concrete syntax trees for source files of any language, and can efficiently update those syntax trees as the source file is edited.", + "License": "MIT + file LICENSE", + "URL": "https://github.com/r-lib/tree-sitter-r", + "BugReports": "https://github.com/r-lib/tree-sitter-r/issues", + "Depends": [ + "R (>= 4.3.0)" + ], + "Suggests": [ + "testthat (>= 3.0.0)", + "treesitter" + ], + "Config/build/bootstrap": "TRUE", + "Config/Needs/website": "tidyverse/tidytemplate", + "Config/testthat/edition": "3", + "Encoding": "UTF-8", + "RoxygenNote": "7.3.2", + "NeedsCompilation": "yes", + "Author": "Davis Vaughan [aut, cre], Posit Software, PBC [cph, fnd], Tree-sitter authors [cph] (Tree-sitter C headers and parser.c)", + "Maintainer": "Davis Vaughan ", + "Repository": "CRAN" + }, + "vctrs": { + "Package": "vctrs", + "Version": "0.6.5", + "Source": "Repository", + "Title": "Vector Helpers", + "Authors@R": "c( person(\"Hadley\", \"Wickham\", , \"hadley@posit.co\", role = \"aut\"), person(\"Lionel\", \"Henry\", , \"lionel@posit.co\", role = \"aut\"), person(\"Davis\", \"Vaughan\", , \"davis@posit.co\", role = c(\"aut\", \"cre\")), person(\"data.table team\", role = \"cph\", comment = \"Radix sort based on data.table's forder() and their contribution to R's order()\"), person(\"Posit Software, PBC\", role = c(\"cph\", \"fnd\")) )", + "Description": "Defines new notions of prototype and size that are used to provide tools for consistent and well-founded type-coercion and size-recycling, and are in turn connected to ideas of type- and size-stability useful for analysing function interfaces.", + "License": "MIT + file LICENSE", + "URL": "https://vctrs.r-lib.org/, https://github.com/r-lib/vctrs", + "BugReports": "https://github.com/r-lib/vctrs/issues", + "Depends": [ + "R (>= 3.5.0)" + ], + "Imports": [ + "cli (>= 3.4.0)", + "glue", + "lifecycle (>= 1.0.3)", + "rlang (>= 1.1.0)" + ], + "Suggests": [ + "bit64", + "covr", + "crayon", + "dplyr (>= 0.8.5)", + "generics", + "knitr", + "pillar (>= 1.4.4)", + "pkgdown (>= 2.0.1)", + "rmarkdown", + "testthat (>= 3.0.0)", + "tibble (>= 3.1.3)", + "waldo (>= 0.2.0)", + "withr", + "xml2", + "zeallot" + ], + "VignetteBuilder": "knitr", + "Config/Needs/website": "tidyverse/tidytemplate", + "Config/testthat/edition": "3", + "Encoding": "UTF-8", + "Language": "en-GB", + "RoxygenNote": "7.2.3", + "NeedsCompilation": "yes", + "Author": "Hadley Wickham [aut], Lionel Henry [aut], Davis Vaughan [aut, cre], data.table team [cph] (Radix sort based on data.table's forder() and their contribution to R's order()), Posit Software, PBC [cph, fnd]", + "Maintainer": "Davis Vaughan ", + "Repository": "CRAN" + } + } +} diff --git a/tests/testthat/apps/rhino/renv/.gitignore b/tests/testthat/apps/rhino/renv/.gitignore new file mode 100644 index 00000000..0ec0cbba --- /dev/null +++ b/tests/testthat/apps/rhino/renv/.gitignore @@ -0,0 +1,7 @@ +library/ +local/ +cellar/ +lock/ +python/ +sandbox/ +staging/ diff --git a/tests/testthat/apps/rhino/renv/activate.R b/tests/testthat/apps/rhino/renv/activate.R new file mode 100644 index 00000000..2fe247d2 --- /dev/null +++ b/tests/testthat/apps/rhino/renv/activate.R @@ -0,0 +1,1313 @@ + +local({ + + # the requested version of renv + version <- "1.1.1" + attr(version, "sha") <- NULL + + # the project directory + project <- Sys.getenv("RENV_PROJECT") + if (!nzchar(project)) + project <- getwd() + + # use start-up diagnostics if enabled + diagnostics <- Sys.getenv("RENV_STARTUP_DIAGNOSTICS", unset = "FALSE") + if (diagnostics) { + start <- Sys.time() + profile <- tempfile("renv-startup-", fileext = ".Rprof") + utils::Rprof(profile) + on.exit({ + utils::Rprof(NULL) + elapsed <- signif(difftime(Sys.time(), start, units = "auto"), digits = 2L) + writeLines(sprintf("- renv took %s to run the autoloader.", format(elapsed))) + writeLines(sprintf("- Profile: %s", profile)) + print(utils::summaryRprof(profile)) + }, add = TRUE) + } + + # figure out whether the autoloader is enabled + enabled <- local({ + + # first, check config option + override <- getOption("renv.config.autoloader.enabled") + if (!is.null(override)) + return(override) + + # if we're being run in a context where R_LIBS is already set, + # don't load -- presumably we're being run as a sub-process and + # the parent process has already set up library paths for us + rcmd <- Sys.getenv("R_CMD", unset = NA) + rlibs <- Sys.getenv("R_LIBS", unset = NA) + if (!is.na(rlibs) && !is.na(rcmd)) + return(FALSE) + + # next, check environment variables + # prefer using the configuration one in the future + envvars <- c( + "RENV_CONFIG_AUTOLOADER_ENABLED", + "RENV_AUTOLOADER_ENABLED", + "RENV_ACTIVATE_PROJECT" + ) + + for (envvar in envvars) { + envval <- Sys.getenv(envvar, unset = NA) + if (!is.na(envval)) + return(tolower(envval) %in% c("true", "t", "1")) + } + + # enable by default + TRUE + + }) + + # bail if we're not enabled + if (!enabled) { + + # if we're not enabled, we might still need to manually load + # the user profile here + profile <- Sys.getenv("R_PROFILE_USER", unset = "~/.Rprofile") + if (file.exists(profile)) { + cfg <- Sys.getenv("RENV_CONFIG_USER_PROFILE", unset = "TRUE") + if (tolower(cfg) %in% c("true", "t", "1")) + sys.source(profile, envir = globalenv()) + } + + return(FALSE) + + } + + # avoid recursion + if (identical(getOption("renv.autoloader.running"), TRUE)) { + warning("ignoring recursive attempt to run renv autoloader") + return(invisible(TRUE)) + } + + # signal that we're loading renv during R startup + options(renv.autoloader.running = TRUE) + on.exit(options(renv.autoloader.running = NULL), add = TRUE) + + # signal that we've consented to use renv + options(renv.consent = TRUE) + + # load the 'utils' package eagerly -- this ensures that renv shims, which + # mask 'utils' packages, will come first on the search path + library(utils, lib.loc = .Library) + + # unload renv if it's already been loaded + if ("renv" %in% loadedNamespaces()) + unloadNamespace("renv") + + # load bootstrap tools + ansify <- function(text) { + if (renv_ansify_enabled()) + renv_ansify_enhanced(text) + else + renv_ansify_default(text) + } + + renv_ansify_enabled <- function() { + + override <- Sys.getenv("RENV_ANSIFY_ENABLED", unset = NA) + if (!is.na(override)) + return(as.logical(override)) + + pane <- Sys.getenv("RSTUDIO_CHILD_PROCESS_PANE", unset = NA) + if (identical(pane, "build")) + return(FALSE) + + testthat <- Sys.getenv("TESTTHAT", unset = "false") + if (tolower(testthat) %in% "true") + return(FALSE) + + iderun <- Sys.getenv("R_CLI_HAS_HYPERLINK_IDE_RUN", unset = "false") + if (tolower(iderun) %in% "false") + return(FALSE) + + TRUE + + } + + renv_ansify_default <- function(text) { + text + } + + renv_ansify_enhanced <- function(text) { + + # R help links + pattern <- "`\\?(renv::(?:[^`])+)`" + replacement <- "`\033]8;;x-r-help:\\1\a?\\1\033]8;;\a`" + text <- gsub(pattern, replacement, text, perl = TRUE) + + # runnable code + pattern <- "`(renv::(?:[^`])+)`" + replacement <- "`\033]8;;x-r-run:\\1\a\\1\033]8;;\a`" + text <- gsub(pattern, replacement, text, perl = TRUE) + + # return ansified text + text + + } + + renv_ansify_init <- function() { + + envir <- renv_envir_self() + if (renv_ansify_enabled()) + assign("ansify", renv_ansify_enhanced, envir = envir) + else + assign("ansify", renv_ansify_default, envir = envir) + + } + + `%||%` <- function(x, y) { + if (is.null(x)) y else x + } + + catf <- function(fmt, ..., appendLF = TRUE) { + + quiet <- getOption("renv.bootstrap.quiet", default = FALSE) + if (quiet) + return(invisible()) + + msg <- sprintf(fmt, ...) + cat(msg, file = stdout(), sep = if (appendLF) "\n" else "") + + invisible(msg) + + } + + header <- function(label, + ..., + prefix = "#", + suffix = "-", + n = min(getOption("width"), 78)) + { + label <- sprintf(label, ...) + n <- max(n - nchar(label) - nchar(prefix) - 2L, 8L) + if (n <= 0) + return(paste(prefix, label)) + + tail <- paste(rep.int(suffix, n), collapse = "") + paste0(prefix, " ", label, " ", tail) + + } + + heredoc <- function(text, leave = 0) { + + # remove leading, trailing whitespace + trimmed <- gsub("^\\s*\\n|\\n\\s*$", "", text) + + # split into lines + lines <- strsplit(trimmed, "\n", fixed = TRUE)[[1L]] + + # compute common indent + indent <- regexpr("[^[:space:]]", lines) + common <- min(setdiff(indent, -1L)) - leave + text <- paste(substring(lines, common), collapse = "\n") + + # substitute in ANSI links for executable renv code + ansify(text) + + } + + bootstrap <- function(version, library) { + + friendly <- renv_bootstrap_version_friendly(version) + section <- header(sprintf("Bootstrapping renv %s", friendly)) + catf(section) + + # attempt to download renv + catf("- Downloading renv ... ", appendLF = FALSE) + withCallingHandlers( + tarball <- renv_bootstrap_download(version), + error = function(err) { + catf("FAILED") + stop("failed to download:\n", conditionMessage(err)) + } + ) + catf("OK") + on.exit(unlink(tarball), add = TRUE) + + # now attempt to install + catf("- Installing renv ... ", appendLF = FALSE) + withCallingHandlers( + status <- renv_bootstrap_install(version, tarball, library), + error = function(err) { + catf("FAILED") + stop("failed to install:\n", conditionMessage(err)) + } + ) + catf("OK") + + # add empty line to break up bootstrapping from normal output + catf("") + + return(invisible()) + } + + renv_bootstrap_tests_running <- function() { + getOption("renv.tests.running", default = FALSE) + } + + renv_bootstrap_repos <- function() { + + # get CRAN repository + cran <- getOption("renv.repos.cran", "https://cloud.r-project.org") + + # check for repos override + repos <- Sys.getenv("RENV_CONFIG_REPOS_OVERRIDE", unset = NA) + if (!is.na(repos)) { + + # check for RSPM; if set, use a fallback repository for renv + rspm <- Sys.getenv("RSPM", unset = NA) + if (identical(rspm, repos)) + repos <- c(RSPM = rspm, CRAN = cran) + + return(repos) + + } + + # check for lockfile repositories + repos <- tryCatch(renv_bootstrap_repos_lockfile(), error = identity) + if (!inherits(repos, "error") && length(repos)) + return(repos) + + # retrieve current repos + repos <- getOption("repos") + + # ensure @CRAN@ entries are resolved + repos[repos == "@CRAN@"] <- cran + + # add in renv.bootstrap.repos if set + default <- c(FALLBACK = "https://cloud.r-project.org") + extra <- getOption("renv.bootstrap.repos", default = default) + repos <- c(repos, extra) + + # remove duplicates that might've snuck in + dupes <- duplicated(repos) | duplicated(names(repos)) + repos[!dupes] + + } + + renv_bootstrap_repos_lockfile <- function() { + + lockpath <- Sys.getenv("RENV_PATHS_LOCKFILE", unset = "renv.lock") + if (!file.exists(lockpath)) + return(NULL) + + lockfile <- tryCatch(renv_json_read(lockpath), error = identity) + if (inherits(lockfile, "error")) { + warning(lockfile) + return(NULL) + } + + repos <- lockfile$R$Repositories + if (length(repos) == 0) + return(NULL) + + keys <- vapply(repos, `[[`, "Name", FUN.VALUE = character(1)) + vals <- vapply(repos, `[[`, "URL", FUN.VALUE = character(1)) + names(vals) <- keys + + return(vals) + + } + + renv_bootstrap_download <- function(version) { + + sha <- attr(version, "sha", exact = TRUE) + + methods <- if (!is.null(sha)) { + + # attempting to bootstrap a development version of renv + c( + function() renv_bootstrap_download_tarball(sha), + function() renv_bootstrap_download_github(sha) + ) + + } else { + + # attempting to bootstrap a release version of renv + c( + function() renv_bootstrap_download_tarball(version), + function() renv_bootstrap_download_cran_latest(version), + function() renv_bootstrap_download_cran_archive(version) + ) + + } + + for (method in methods) { + path <- tryCatch(method(), error = identity) + if (is.character(path) && file.exists(path)) + return(path) + } + + stop("All download methods failed") + + } + + renv_bootstrap_download_impl <- function(url, destfile) { + + mode <- "wb" + + # https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17715 + fixup <- + Sys.info()[["sysname"]] == "Windows" && + substring(url, 1L, 5L) == "file:" + + if (fixup) + mode <- "w+b" + + args <- list( + url = url, + destfile = destfile, + mode = mode, + quiet = TRUE + ) + + if ("headers" %in% names(formals(utils::download.file))) { + headers <- renv_bootstrap_download_custom_headers(url) + if (length(headers) && is.character(headers)) + args$headers <- headers + } + + do.call(utils::download.file, args) + + } + + renv_bootstrap_download_custom_headers <- function(url) { + + headers <- getOption("renv.download.headers") + if (is.null(headers)) + return(character()) + + if (!is.function(headers)) + stopf("'renv.download.headers' is not a function") + + headers <- headers(url) + if (length(headers) == 0L) + return(character()) + + if (is.list(headers)) + headers <- unlist(headers, recursive = FALSE, use.names = TRUE) + + ok <- + is.character(headers) && + is.character(names(headers)) && + all(nzchar(names(headers))) + + if (!ok) + stop("invocation of 'renv.download.headers' did not return a named character vector") + + headers + + } + + renv_bootstrap_download_cran_latest <- function(version) { + + spec <- renv_bootstrap_download_cran_latest_find(version) + type <- spec$type + repos <- spec$repos + + baseurl <- utils::contrib.url(repos = repos, type = type) + ext <- if (identical(type, "source")) + ".tar.gz" + else if (Sys.info()[["sysname"]] == "Windows") + ".zip" + else + ".tgz" + name <- sprintf("renv_%s%s", version, ext) + url <- paste(baseurl, name, sep = "/") + + destfile <- file.path(tempdir(), name) + status <- tryCatch( + renv_bootstrap_download_impl(url, destfile), + condition = identity + ) + + if (inherits(status, "condition")) + return(FALSE) + + # report success and return + destfile + + } + + renv_bootstrap_download_cran_latest_find <- function(version) { + + # check whether binaries are supported on this system + binary <- + getOption("renv.bootstrap.binary", default = TRUE) && + !identical(.Platform$pkgType, "source") && + !identical(getOption("pkgType"), "source") && + Sys.info()[["sysname"]] %in% c("Darwin", "Windows") + + types <- c(if (binary) "binary", "source") + + # iterate over types + repositories + for (type in types) { + for (repos in renv_bootstrap_repos()) { + + # build arguments for utils::available.packages() call + args <- list(type = type, repos = repos) + + # add custom headers if available -- note that + # utils::available.packages() will pass this to download.file() + if ("headers" %in% names(formals(utils::download.file))) { + headers <- renv_bootstrap_download_custom_headers(repos) + if (length(headers) && is.character(headers)) + args$headers <- headers + } + + # retrieve package database + db <- tryCatch( + as.data.frame( + do.call(utils::available.packages, args), + stringsAsFactors = FALSE + ), + error = identity + ) + + if (inherits(db, "error")) + next + + # check for compatible entry + entry <- db[db$Package %in% "renv" & db$Version %in% version, ] + if (nrow(entry) == 0) + next + + # found it; return spec to caller + spec <- list(entry = entry, type = type, repos = repos) + return(spec) + + } + } + + # if we got here, we failed to find renv + fmt <- "renv %s is not available from your declared package repositories" + stop(sprintf(fmt, version)) + + } + + renv_bootstrap_download_cran_archive <- function(version) { + + name <- sprintf("renv_%s.tar.gz", version) + repos <- renv_bootstrap_repos() + urls <- file.path(repos, "src/contrib/Archive/renv", name) + destfile <- file.path(tempdir(), name) + + for (url in urls) { + + status <- tryCatch( + renv_bootstrap_download_impl(url, destfile), + condition = identity + ) + + if (identical(status, 0L)) + return(destfile) + + } + + return(FALSE) + + } + + renv_bootstrap_download_tarball <- function(version) { + + # if the user has provided the path to a tarball via + # an environment variable, then use it + tarball <- Sys.getenv("RENV_BOOTSTRAP_TARBALL", unset = NA) + if (is.na(tarball)) + return() + + # allow directories + if (dir.exists(tarball)) { + name <- sprintf("renv_%s.tar.gz", version) + tarball <- file.path(tarball, name) + } + + # bail if it doesn't exist + if (!file.exists(tarball)) { + + # let the user know we weren't able to honour their request + fmt <- "- RENV_BOOTSTRAP_TARBALL is set (%s) but does not exist." + msg <- sprintf(fmt, tarball) + warning(msg) + + # bail + return() + + } + + catf("- Using local tarball '%s'.", tarball) + tarball + + } + + renv_bootstrap_github_token <- function() { + for (envvar in c("GITHUB_TOKEN", "GITHUB_PAT", "GH_TOKEN")) { + envval <- Sys.getenv(envvar, unset = NA) + if (!is.na(envval)) + return(envval) + } + } + + renv_bootstrap_download_github <- function(version) { + + enabled <- Sys.getenv("RENV_BOOTSTRAP_FROM_GITHUB", unset = "TRUE") + if (!identical(enabled, "TRUE")) + return(FALSE) + + # prepare download options + token <- renv_bootstrap_github_token() + if (is.null(token)) + token <- "" + + if (nzchar(Sys.which("curl")) && nzchar(token)) { + fmt <- "--location --fail --header \"Authorization: token %s\"" + extra <- sprintf(fmt, token) + saved <- options("download.file.method", "download.file.extra") + options(download.file.method = "curl", download.file.extra = extra) + on.exit(do.call(base::options, saved), add = TRUE) + } else if (nzchar(Sys.which("wget")) && nzchar(token)) { + fmt <- "--header=\"Authorization: token %s\"" + extra <- sprintf(fmt, token) + saved <- options("download.file.method", "download.file.extra") + options(download.file.method = "wget", download.file.extra = extra) + on.exit(do.call(base::options, saved), add = TRUE) + } + + url <- file.path("https://api.github.com/repos/rstudio/renv/tarball", version) + name <- sprintf("renv_%s.tar.gz", version) + destfile <- file.path(tempdir(), name) + + status <- tryCatch( + renv_bootstrap_download_impl(url, destfile), + condition = identity + ) + + if (!identical(status, 0L)) + return(FALSE) + + renv_bootstrap_download_augment(destfile) + + return(destfile) + + } + + # Add Sha to DESCRIPTION. This is stop gap until #890, after which we + # can use renv::install() to fully capture metadata. + renv_bootstrap_download_augment <- function(destfile) { + sha <- renv_bootstrap_git_extract_sha1_tar(destfile) + if (is.null(sha)) { + return() + } + + # Untar + tempdir <- tempfile("renv-github-") + on.exit(unlink(tempdir, recursive = TRUE), add = TRUE) + untar(destfile, exdir = tempdir) + pkgdir <- dir(tempdir, full.names = TRUE)[[1]] + + # Modify description + desc_path <- file.path(pkgdir, "DESCRIPTION") + desc_lines <- readLines(desc_path) + remotes_fields <- c( + "RemoteType: github", + "RemoteHost: api.github.com", + "RemoteRepo: renv", + "RemoteUsername: rstudio", + "RemotePkgRef: rstudio/renv", + paste("RemoteRef: ", sha), + paste("RemoteSha: ", sha) + ) + writeLines(c(desc_lines[desc_lines != ""], remotes_fields), con = desc_path) + + # Re-tar + local({ + old <- setwd(tempdir) + on.exit(setwd(old), add = TRUE) + + tar(destfile, compression = "gzip") + }) + invisible() + } + + # Extract the commit hash from a git archive. Git archives include the SHA1 + # hash as the comment field of the tarball pax extended header + # (see https://www.kernel.org/pub/software/scm/git/docs/git-archive.html) + # For GitHub archives this should be the first header after the default one + # (512 byte) header. + renv_bootstrap_git_extract_sha1_tar <- function(bundle) { + + # open the bundle for reading + # We use gzcon for everything because (from ?gzcon) + # > Reading from a connection which does not supply a 'gzip' magic + # > header is equivalent to reading from the original connection + conn <- gzcon(file(bundle, open = "rb", raw = TRUE)) + on.exit(close(conn)) + + # The default pax header is 512 bytes long and the first pax extended header + # with the comment should be 51 bytes long + # `52 comment=` (11 chars) + 40 byte SHA1 hash + len <- 0x200 + 0x33 + res <- rawToChar(readBin(conn, "raw", n = len)[0x201:len]) + + if (grepl("^52 comment=", res)) { + sub("52 comment=", "", res) + } else { + NULL + } + } + + renv_bootstrap_install <- function(version, tarball, library) { + + # attempt to install it into project library + dir.create(library, showWarnings = FALSE, recursive = TRUE) + output <- renv_bootstrap_install_impl(library, tarball) + + # check for successful install + status <- attr(output, "status") + if (is.null(status) || identical(status, 0L)) + return(status) + + # an error occurred; report it + header <- "installation of renv failed" + lines <- paste(rep.int("=", nchar(header)), collapse = "") + text <- paste(c(header, lines, output), collapse = "\n") + stop(text) + + } + + renv_bootstrap_install_impl <- function(library, tarball) { + + # invoke using system2 so we can capture and report output + bin <- R.home("bin") + exe <- if (Sys.info()[["sysname"]] == "Windows") "R.exe" else "R" + R <- file.path(bin, exe) + + args <- c( + "--vanilla", "CMD", "INSTALL", "--no-multiarch", + "-l", shQuote(path.expand(library)), + shQuote(path.expand(tarball)) + ) + + system2(R, args, stdout = TRUE, stderr = TRUE) + + } + + renv_bootstrap_platform_prefix <- function() { + + # construct version prefix + version <- paste(R.version$major, R.version$minor, sep = ".") + prefix <- paste("R", numeric_version(version)[1, 1:2], sep = "-") + + # include SVN revision for development versions of R + # (to avoid sharing platform-specific artefacts with released versions of R) + devel <- + identical(R.version[["status"]], "Under development (unstable)") || + identical(R.version[["nickname"]], "Unsuffered Consequences") + + if (devel) + prefix <- paste(prefix, R.version[["svn rev"]], sep = "-r") + + # build list of path components + components <- c(prefix, R.version$platform) + + # include prefix if provided by user + prefix <- renv_bootstrap_platform_prefix_impl() + if (!is.na(prefix) && nzchar(prefix)) + components <- c(prefix, components) + + # build prefix + paste(components, collapse = "/") + + } + + renv_bootstrap_platform_prefix_impl <- function() { + + # if an explicit prefix has been supplied, use it + prefix <- Sys.getenv("RENV_PATHS_PREFIX", unset = NA) + if (!is.na(prefix)) + return(prefix) + + # if the user has requested an automatic prefix, generate it + auto <- Sys.getenv("RENV_PATHS_PREFIX_AUTO", unset = NA) + if (is.na(auto) && getRversion() >= "4.4.0") + auto <- "TRUE" + + if (auto %in% c("TRUE", "True", "true", "1")) + return(renv_bootstrap_platform_prefix_auto()) + + # empty string on failure + "" + + } + + renv_bootstrap_platform_prefix_auto <- function() { + + prefix <- tryCatch(renv_bootstrap_platform_os(), error = identity) + if (inherits(prefix, "error") || prefix %in% "unknown") { + + msg <- paste( + "failed to infer current operating system", + "please file a bug report at https://github.com/rstudio/renv/issues", + sep = "; " + ) + + warning(msg) + + } + + prefix + + } + + renv_bootstrap_platform_os <- function() { + + sysinfo <- Sys.info() + sysname <- sysinfo[["sysname"]] + + # handle Windows + macOS up front + if (sysname == "Windows") + return("windows") + else if (sysname == "Darwin") + return("macos") + + # check for os-release files + for (file in c("/etc/os-release", "/usr/lib/os-release")) + if (file.exists(file)) + return(renv_bootstrap_platform_os_via_os_release(file, sysinfo)) + + # check for redhat-release files + if (file.exists("/etc/redhat-release")) + return(renv_bootstrap_platform_os_via_redhat_release()) + + "unknown" + + } + + renv_bootstrap_platform_os_via_os_release <- function(file, sysinfo) { + + # read /etc/os-release + release <- utils::read.table( + file = file, + sep = "=", + quote = c("\"", "'"), + col.names = c("Key", "Value"), + comment.char = "#", + stringsAsFactors = FALSE + ) + + vars <- as.list(release$Value) + names(vars) <- release$Key + + # get os name + os <- tolower(sysinfo[["sysname"]]) + + # read id + id <- "unknown" + for (field in c("ID", "ID_LIKE")) { + if (field %in% names(vars) && nzchar(vars[[field]])) { + id <- vars[[field]] + break + } + } + + # read version + version <- "unknown" + for (field in c("UBUNTU_CODENAME", "VERSION_CODENAME", "VERSION_ID", "BUILD_ID")) { + if (field %in% names(vars) && nzchar(vars[[field]])) { + version <- vars[[field]] + break + } + } + + # join together + paste(c(os, id, version), collapse = "-") + + } + + renv_bootstrap_platform_os_via_redhat_release <- function() { + + # read /etc/redhat-release + contents <- readLines("/etc/redhat-release", warn = FALSE) + + # infer id + id <- if (grepl("centos", contents, ignore.case = TRUE)) + "centos" + else if (grepl("redhat", contents, ignore.case = TRUE)) + "redhat" + else + "unknown" + + # try to find a version component (very hacky) + version <- "unknown" + + parts <- strsplit(contents, "[[:space:]]")[[1L]] + for (part in parts) { + + nv <- tryCatch(numeric_version(part), error = identity) + if (inherits(nv, "error")) + next + + version <- nv[1, 1] + break + + } + + paste(c("linux", id, version), collapse = "-") + + } + + renv_bootstrap_library_root_name <- function(project) { + + # use project name as-is if requested + asis <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT_ASIS", unset = "FALSE") + if (asis) + return(basename(project)) + + # otherwise, disambiguate based on project's path + id <- substring(renv_bootstrap_hash_text(project), 1L, 8L) + paste(basename(project), id, sep = "-") + + } + + renv_bootstrap_library_root <- function(project) { + + prefix <- renv_bootstrap_profile_prefix() + + path <- Sys.getenv("RENV_PATHS_LIBRARY", unset = NA) + if (!is.na(path)) + return(paste(c(path, prefix), collapse = "/")) + + path <- renv_bootstrap_library_root_impl(project) + if (!is.null(path)) { + name <- renv_bootstrap_library_root_name(project) + return(paste(c(path, prefix, name), collapse = "/")) + } + + renv_bootstrap_paths_renv("library", project = project) + + } + + renv_bootstrap_library_root_impl <- function(project) { + + root <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT", unset = NA) + if (!is.na(root)) + return(root) + + type <- renv_bootstrap_project_type(project) + if (identical(type, "package")) { + userdir <- renv_bootstrap_user_dir() + return(file.path(userdir, "library")) + } + + } + + renv_bootstrap_validate_version <- function(version, description = NULL) { + + # resolve description file + # + # avoid passing lib.loc to `packageDescription()` below, since R will + # use the loaded version of the package by default anyhow. note that + # this function should only be called after 'renv' is loaded + # https://github.com/rstudio/renv/issues/1625 + description <- description %||% packageDescription("renv") + + # check whether requested version 'version' matches loaded version of renv + sha <- attr(version, "sha", exact = TRUE) + valid <- if (!is.null(sha)) + renv_bootstrap_validate_version_dev(sha, description) + else + renv_bootstrap_validate_version_release(version, description) + + if (valid) + return(TRUE) + + # the loaded version of renv doesn't match the requested version; + # give the user instructions on how to proceed + dev <- identical(description[["RemoteType"]], "github") + remote <- if (dev) + paste("rstudio/renv", description[["RemoteSha"]], sep = "@") + else + paste("renv", description[["Version"]], sep = "@") + + # display both loaded version + sha if available + friendly <- renv_bootstrap_version_friendly( + version = description[["Version"]], + sha = if (dev) description[["RemoteSha"]] + ) + + fmt <- heredoc(" + renv %1$s was loaded from project library, but this project is configured to use renv %2$s. + - Use `renv::record(\"%3$s\")` to record renv %1$s in the lockfile. + - Use `renv::restore(packages = \"renv\")` to install renv %2$s into the project library. + ") + catf(fmt, friendly, renv_bootstrap_version_friendly(version), remote) + + FALSE + + } + + renv_bootstrap_validate_version_dev <- function(version, description) { + + expected <- description[["RemoteSha"]] + if (!is.character(expected)) + return(FALSE) + + pattern <- sprintf("^\\Q%s\\E", version) + grepl(pattern, expected, perl = TRUE) + + } + + renv_bootstrap_validate_version_release <- function(version, description) { + expected <- description[["Version"]] + is.character(expected) && identical(expected, version) + } + + renv_bootstrap_hash_text <- function(text) { + + hashfile <- tempfile("renv-hash-") + on.exit(unlink(hashfile), add = TRUE) + + writeLines(text, con = hashfile) + tools::md5sum(hashfile) + + } + + renv_bootstrap_load <- function(project, libpath, version) { + + # try to load renv from the project library + if (!requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) + return(FALSE) + + # warn if the version of renv loaded does not match + renv_bootstrap_validate_version(version) + + # execute renv load hooks, if any + hooks <- getHook("renv::autoload") + for (hook in hooks) + if (is.function(hook)) + tryCatch(hook(), error = warnify) + + # load the project + renv::load(project) + + TRUE + + } + + renv_bootstrap_profile_load <- function(project) { + + # if RENV_PROFILE is already set, just use that + profile <- Sys.getenv("RENV_PROFILE", unset = NA) + if (!is.na(profile) && nzchar(profile)) + return(profile) + + # check for a profile file (nothing to do if it doesn't exist) + path <- renv_bootstrap_paths_renv("profile", profile = FALSE, project = project) + if (!file.exists(path)) + return(NULL) + + # read the profile, and set it if it exists + contents <- readLines(path, warn = FALSE) + if (length(contents) == 0L) + return(NULL) + + # set RENV_PROFILE + profile <- contents[[1L]] + if (!profile %in% c("", "default")) + Sys.setenv(RENV_PROFILE = profile) + + profile + + } + + renv_bootstrap_profile_prefix <- function() { + profile <- renv_bootstrap_profile_get() + if (!is.null(profile)) + return(file.path("profiles", profile, "renv")) + } + + renv_bootstrap_profile_get <- function() { + profile <- Sys.getenv("RENV_PROFILE", unset = "") + renv_bootstrap_profile_normalize(profile) + } + + renv_bootstrap_profile_set <- function(profile) { + profile <- renv_bootstrap_profile_normalize(profile) + if (is.null(profile)) + Sys.unsetenv("RENV_PROFILE") + else + Sys.setenv(RENV_PROFILE = profile) + } + + renv_bootstrap_profile_normalize <- function(profile) { + + if (is.null(profile) || profile %in% c("", "default")) + return(NULL) + + profile + + } + + renv_bootstrap_path_absolute <- function(path) { + + substr(path, 1L, 1L) %in% c("~", "/", "\\") || ( + substr(path, 1L, 1L) %in% c(letters, LETTERS) && + substr(path, 2L, 3L) %in% c(":/", ":\\") + ) + + } + + renv_bootstrap_paths_renv <- function(..., profile = TRUE, project = NULL) { + renv <- Sys.getenv("RENV_PATHS_RENV", unset = "renv") + root <- if (renv_bootstrap_path_absolute(renv)) NULL else project + prefix <- if (profile) renv_bootstrap_profile_prefix() + components <- c(root, renv, prefix, ...) + paste(components, collapse = "/") + } + + renv_bootstrap_project_type <- function(path) { + + descpath <- file.path(path, "DESCRIPTION") + if (!file.exists(descpath)) + return("unknown") + + desc <- tryCatch( + read.dcf(descpath, all = TRUE), + error = identity + ) + + if (inherits(desc, "error")) + return("unknown") + + type <- desc$Type + if (!is.null(type)) + return(tolower(type)) + + package <- desc$Package + if (!is.null(package)) + return("package") + + "unknown" + + } + + renv_bootstrap_user_dir <- function() { + dir <- renv_bootstrap_user_dir_impl() + path.expand(chartr("\\", "/", dir)) + } + + renv_bootstrap_user_dir_impl <- function() { + + # use local override if set + override <- getOption("renv.userdir.override") + if (!is.null(override)) + return(override) + + # use R_user_dir if available + tools <- asNamespace("tools") + if (is.function(tools$R_user_dir)) + return(tools$R_user_dir("renv", "cache")) + + # try using our own backfill for older versions of R + envvars <- c("R_USER_CACHE_DIR", "XDG_CACHE_HOME") + for (envvar in envvars) { + root <- Sys.getenv(envvar, unset = NA) + if (!is.na(root)) + return(file.path(root, "R/renv")) + } + + # use platform-specific default fallbacks + if (Sys.info()[["sysname"]] == "Windows") + file.path(Sys.getenv("LOCALAPPDATA"), "R/cache/R/renv") + else if (Sys.info()[["sysname"]] == "Darwin") + "~/Library/Caches/org.R-project.R/R/renv" + else + "~/.cache/R/renv" + + } + + renv_bootstrap_version_friendly <- function(version, shafmt = NULL, sha = NULL) { + sha <- sha %||% attr(version, "sha", exact = TRUE) + parts <- c(version, sprintf(shafmt %||% " [sha: %s]", substring(sha, 1L, 7L))) + paste(parts, collapse = "") + } + + renv_bootstrap_exec <- function(project, libpath, version) { + if (!renv_bootstrap_load(project, libpath, version)) + renv_bootstrap_run(project, libpath, version) + } + + renv_bootstrap_run <- function(project, libpath, version) { + + # perform bootstrap + bootstrap(version, libpath) + + # exit early if we're just testing bootstrap + if (!is.na(Sys.getenv("RENV_BOOTSTRAP_INSTALL_ONLY", unset = NA))) + return(TRUE) + + # try again to load + if (requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) { + return(renv::load(project = project)) + } + + # failed to download or load renv; warn the user + msg <- c( + "Failed to find an renv installation: the project will not be loaded.", + "Use `renv::activate()` to re-initialize the project." + ) + + warning(paste(msg, collapse = "\n"), call. = FALSE) + + } + + renv_json_read <- function(file = NULL, text = NULL) { + + jlerr <- NULL + + # if jsonlite is loaded, use that instead + if ("jsonlite" %in% loadedNamespaces()) { + + json <- tryCatch(renv_json_read_jsonlite(file, text), error = identity) + if (!inherits(json, "error")) + return(json) + + jlerr <- json + + } + + # otherwise, fall back to the default JSON reader + json <- tryCatch(renv_json_read_default(file, text), error = identity) + if (!inherits(json, "error")) + return(json) + + # report an error + if (!is.null(jlerr)) + stop(jlerr) + else + stop(json) + + } + + renv_json_read_jsonlite <- function(file = NULL, text = NULL) { + text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n") + jsonlite::fromJSON(txt = text, simplifyVector = FALSE) + } + + renv_json_read_patterns <- function() { + + list( + + # objects + list("{", "\t\n\tobject(\t\n\t"), + list("}", "\t\n\t)\t\n\t"), + + # arrays + list("[", "\t\n\tarray(\t\n\t"), + list("]", "\n\t\n)\n\t\n"), + + # maps + list(":", "\t\n\t=\t\n\t") + + ) + + } + + renv_json_read_envir <- function() { + + envir <- new.env(parent = emptyenv()) + + envir[["+"]] <- `+` + envir[["-"]] <- `-` + + envir[["object"]] <- function(...) { + result <- list(...) + names(result) <- as.character(names(result)) + result + } + + envir[["array"]] <- list + + envir[["true"]] <- TRUE + envir[["false"]] <- FALSE + envir[["null"]] <- NULL + + envir + + } + + renv_json_read_remap <- function(object, patterns) { + + # repair names if necessary + if (!is.null(names(object))) { + + nms <- names(object) + for (pattern in patterns) + nms <- gsub(pattern[[2L]], pattern[[1L]], nms, fixed = TRUE) + names(object) <- nms + + } + + # repair strings if necessary + if (is.character(object)) { + for (pattern in patterns) + object <- gsub(pattern[[2L]], pattern[[1L]], object, fixed = TRUE) + } + + # recurse for other objects + if (is.recursive(object)) + for (i in seq_along(object)) + object[i] <- list(renv_json_read_remap(object[[i]], patterns)) + + # return remapped object + object + + } + + renv_json_read_default <- function(file = NULL, text = NULL) { + + # read json text + text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n") + + # convert into something the R parser will understand + patterns <- renv_json_read_patterns() + transformed <- text + for (pattern in patterns) + transformed <- gsub(pattern[[1L]], pattern[[2L]], transformed, fixed = TRUE) + + # parse it + rfile <- tempfile("renv-json-", fileext = ".R") + on.exit(unlink(rfile), add = TRUE) + writeLines(transformed, con = rfile) + json <- parse(rfile, keep.source = FALSE, srcfile = NULL)[[1L]] + + # evaluate in safe environment + result <- eval(json, envir = renv_json_read_envir()) + + # fix up strings if necessary + renv_json_read_remap(result, patterns) + + } + + + # load the renv profile, if any + renv_bootstrap_profile_load(project) + + # construct path to library root + root <- renv_bootstrap_library_root(project) + + # construct library prefix for platform + prefix <- renv_bootstrap_platform_prefix() + + # construct full libpath + libpath <- file.path(root, prefix) + + # run bootstrap code + renv_bootstrap_exec(project, libpath, version) + + invisible() + +}) diff --git a/tests/testthat/apps/rhino/renv/settings.json b/tests/testthat/apps/rhino/renv/settings.json new file mode 100644 index 00000000..ffdbb320 --- /dev/null +++ b/tests/testthat/apps/rhino/renv/settings.json @@ -0,0 +1,19 @@ +{ + "bioconductor.version": null, + "external.libraries": [], + "ignored.packages": [], + "package.dependency.fields": [ + "Imports", + "Depends", + "LinkingTo" + ], + "ppm.enabled": null, + "ppm.ignored.urls": [], + "r.version": null, + "snapshot.type": "implicit", + "use.cache": true, + "vcs.ignore.cellar": true, + "vcs.ignore.library": true, + "vcs.ignore.local": true, + "vcs.manage.ignores": true +} diff --git a/tests/testthat/apps/rhino/rhino.Rproj b/tests/testthat/apps/rhino/rhino.Rproj new file mode 100644 index 00000000..c8daeb91 --- /dev/null +++ b/tests/testthat/apps/rhino/rhino.Rproj @@ -0,0 +1,17 @@ +Version: 1.0 + +RestoreWorkspace: No +SaveWorkspace: No +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: pdfLaTeX + +AutoAppendNewline: Yes +StripTrailingWhitespace: Yes +LineEndingConversion: Posix diff --git a/tests/testthat/apps/rhino/rhino.yml b/tests/testthat/apps/rhino/rhino.yml new file mode 100644 index 00000000..fea13278 --- /dev/null +++ b/tests/testthat/apps/rhino/rhino.yml @@ -0,0 +1 @@ +sass: node diff --git a/tests/testthat/apps/rhino/tests/cypress.config.js b/tests/testthat/apps/rhino/tests/cypress.config.js new file mode 100644 index 00000000..5c23de01 --- /dev/null +++ b/tests/testthat/apps/rhino/tests/cypress.config.js @@ -0,0 +1,7 @@ +module.exports = { + e2e: { + setupNodeEvents(on, config) {}, + baseUrl: 'http://localhost:3333', + supportFile: false, + }, +} diff --git a/tests/testthat/apps/rhino/tests/cypress/.gitignore b/tests/testthat/apps/rhino/tests/cypress/.gitignore new file mode 100644 index 00000000..e0cd7dc8 --- /dev/null +++ b/tests/testthat/apps/rhino/tests/cypress/.gitignore @@ -0,0 +1,2 @@ +/screenshots/ +/videos/ diff --git a/tests/testthat/apps/rhino/tests/cypress/e2e/app.cy.js b/tests/testthat/apps/rhino/tests/cypress/e2e/app.cy.js new file mode 100644 index 00000000..b9a58df5 --- /dev/null +++ b/tests/testthat/apps/rhino/tests/cypress/e2e/app.cy.js @@ -0,0 +1,7 @@ +describe('app', () => { + beforeEach(() => { + cy.visit('/') + }) + + it('starts', () => {}) +}) diff --git a/tests/testthat/apps/rhino/tests/testthat/test-main.R b/tests/testthat/apps/rhino/tests/testthat/test-main.R new file mode 100644 index 00000000..b8ddd76a --- /dev/null +++ b/tests/testthat/apps/rhino/tests/testthat/test-main.R @@ -0,0 +1,13 @@ +box::use( + shiny[testServer], + testthat[expect_true, test_that], +) +box::use( + app/main[server], +) + +test_that("main server works", { + testServer(server, { + expect_true(grepl(x = output$message$html, pattern = "Check out Rhino docs!")) + }) +}) diff --git a/tests/testthat/apps/test-env/app.R b/tests/testthat/apps/test-env/app.R new file mode 100644 index 00000000..07e10c20 --- /dev/null +++ b/tests/testthat/apps/test-env/app.R @@ -0,0 +1,23 @@ +library(shiny) + +testthat::expect_true( + inherits(try(AppDriver, silent = TRUE), "try-error") +) + +# Test for internal value +# This is defined within shinytest2's ./R/app-driver-start.R +# and will only allow the app to run if the app has access to shinytest2's internal functions +# or the "local package" values. +value <- shinytest2:::.internal_value_used_by_shinytest2_test + +ui <- fluidPage( + tags$h1("Internal test value:"), + verbatimTextOutput("value", placeholder = TRUE), +) +server <- function(input, output, session) { + output$value <- renderText({ + value + }) +} + +shinyApp(ui, server) diff --git a/tests/testthat/apps/test-env/tests/testthat.R b/tests/testthat/apps/test-env/tests/testthat.R new file mode 100644 index 00000000..7d25b5b9 --- /dev/null +++ b/tests/testthat/apps/test-env/tests/testthat.R @@ -0,0 +1 @@ +shinytest2::test_app() diff --git a/tests/testthat/apps/test-env/tests/testthat/setup.R b/tests/testthat/apps/test-env/tests/testthat/setup.R new file mode 100644 index 00000000..80d55d27 --- /dev/null +++ b/tests/testthat/apps/test-env/tests/testthat/setup.R @@ -0,0 +1 @@ +shinytest2::load_app_env() diff --git a/tests/testthat/apps/test-env/tests/testthat/test-app-env.R b/tests/testthat/apps/test-env/tests/testthat/test-app-env.R new file mode 100644 index 00000000..2d65269a --- /dev/null +++ b/tests/testthat/apps/test-env/tests/testthat/test-app-env.R @@ -0,0 +1,3 @@ +test_that("local pkg env is not loaded until library() call", { + AppDriver$new(variant = NULL) +}) diff --git a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/001.json b/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/001.json index 06e18c9f..baeb1c78 100644 --- a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/001.json +++ b/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/001.json @@ -18,6 +18,8 @@ "prettyCheckbox": false, "radio": "1", "search": "", + "search_reset": 0, + "search_search": 0, "search_text": "", "select": "1", "slider1": 50, diff --git a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/001_.png b/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/001_.png index 51946196..63532e06 100644 Binary files a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/001_.png and b/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/001_.png differ diff --git a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/002.json b/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/002.json index db403f81..b53952df 100644 --- a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/002.json +++ b/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/002.json @@ -34,6 +34,8 @@ "prettyCheckbox": false, "radio": "2", "search": "", + "search_reset": 0, + "search_search": 0, "search_text": "", "select": "2", "slider1": 65, diff --git a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/002_.png b/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/002_.png index 26975b4f..5aa6f3f8 100644 Binary files a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/002_.png and b/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/002_.png differ diff --git a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/003.json b/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/003.json index 02404c16..8cb28862 100644 --- a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/003.json +++ b/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/003.json @@ -34,6 +34,8 @@ "prettyCheckbox": false, "radio": "2", "search": "", + "search_reset": 0, + "search_search": 0, "search_text": "", "select": "2", "slider1": 65, diff --git a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/003_.png b/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/003_.png index 8bf7f29d..da759e25 100644 Binary files a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/003_.png and b/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/003_.png differ diff --git a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/004.json b/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/004.json index a85ed0b7..76cc9eba 100644 --- a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/004.json +++ b/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/004.json @@ -38,6 +38,8 @@ "prettyCheckbox": true, "radio": "2", "search": "", + "search_reset": 0, + "search_search": 0, "search_text": "", "select": "2", "slider1": 65, diff --git a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/004_.png b/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/004_.png index 11b01fb4..0a3189a6 100644 Binary files a/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/004_.png and b/tests/testthat/apps/widgits/tests/testthat/_snaps/app-set-inputs/004_.png differ diff --git a/tests/testthat/test-image-diff.R b/tests/testthat/test-image-diff.R index e56b7c7c..6109b8e1 100644 --- a/tests/testthat/test-image-diff.R +++ b/tests/testthat/test-image-diff.R @@ -1,4 +1,3 @@ - img_folder <- system.file("example/imgs", package = "shinytest2") bookmark_new <- fs::path(img_folder, "bookmark-new.png") bookmark_old <- fs::path(img_folder, "bookmark-old.png") @@ -46,7 +45,6 @@ test_that("screenshot options are used", { ) } ) - print(list(small_max_diff, big_max_diff)) expect_lt(small_max_diff, big_max_diff) }) @@ -82,7 +80,6 @@ test_that("convolution can be performed", { ) ) - # Slightly different images expect_false( compare_screenshot_threshold( @@ -101,10 +98,12 @@ test_that("convolution can be performed", { threshold = 28.2 ) }) - expect_true(ans, label = "compare_screenshot_threshold(slider_old, slider_new, threshold = 28.2)") + expect_true( + ans, + label = "compare_screenshot_threshold(slider_old, slider_new, threshold = 28.2)" + ) }) - test_that("kernel size makes a difference", { skip_if_not_installed("png") @@ -127,7 +126,6 @@ test_that("kernel size makes a difference", { expect_lt(big_max_diff, 50) }) - test_that("Errors in screenshot_max_difference do not cause errors in compare_screenshot_threshold", { expect_silent({ comp_val <- @@ -138,5 +136,4 @@ test_that("Errors in screenshot_max_difference do not cause errors in compare_sc ) }) expect_false(comp_val) - })