From a972f7ed17f47a589155bef234279054abd66b75 Mon Sep 17 00:00:00 2001 From: Andrew Bruce Date: Fri, 13 Dec 2024 01:33:48 -0500 Subject: [PATCH] standalone changelog reordering --- R/standalone-helpers.R | 16 +++++----- data-raw/pins_template.txt | 62 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 8 deletions(-) create mode 100644 data-raw/pins_template.txt diff --git a/R/standalone-helpers.R b/R/standalone-helpers.R index 4973266..a15e714 100644 --- a/R/standalone-helpers.R +++ b/R/standalone-helpers.R @@ -1,16 +1,18 @@ # --- # repo: andrewallenbruce/fuimus # file: standalone-helpers.R -# last-updated: 2024-12-10 +# last-updated: 2024-12-12 # license: https://unlicense.org -# imports: [kit, cheapr, collapse, stringfish, vctrs, stringi] +# imports: [cheapr (>= 0.9.92), collapse (>= 2.0.18), kit (>= 0.0.19), stringfish (0.16.0), stringi (>= 1.8.4), vctrs (>= 0.6.5)] # --- # # ## Changelog # -# 2024-12-10: +# 2024-12-12: # -# * Initial version. +# * Fixed bug in search_in() +# * Shortened as_() names +# * Added roundup() # # 2024-12-11: # @@ -25,11 +27,9 @@ # * as_numeric() # * as_date() # -# 2024-12-12: +# 2024-12-10: # -# * Fixed bug in search_in() -# * Shortened as_() names -# * Added roundup() +# * Initial version. # # nocov start diff --git a/data-raw/pins_template.txt b/data-raw/pins_template.txt new file mode 100644 index 0000000..23bac9b --- /dev/null +++ b/data-raw/pins_template.txt @@ -0,0 +1,62 @@ +#' Mount [pins][pins::pins-package] board +#' +#' @param source `` `"local"` or `"remote"` +#' +#' @returns `` or `` +#' +#' @autoglobal +#' +#' @keywords internal +#' +#' @export +mount_board <- function(source = c("local", "remote")) { + + gh_raw <- \(x) paste0("https://raw.githubusercontent.com/andrewallenbruce/", x) + + source <- match.arg(source) + + switch(source, + local = pins::board_folder(fs::path_package("extdata/pins", package = "arktax")), + remote = pins::board_url(gh_raw("arktax/master/inst/extdata/pins/")), + stop("Invalid source")) +} + +#' Get a pinned dataset from a [pins][pins::pins-package] board +#' +#' @param pin `` string name of pinned dataset +#' +#' @param ... additional arguments passed to `mount_board()` +#' +#' @returns `` or `` +#' +#' @autoglobal +#' +#' @keywords internal +#' +#' @export +get_pin <- function(pin, ...) { + + board <- mount_board(...) + + pin <- match.arg(pin, list_pins()) + + pins::pin_read(board, pin) +} + +#' List pins from a [pins][pins::pins-package] board +#' +#' @param ... arguments to pass to [mount_board()] +#' +#' @returns `` of [pins][pins::pins-package] +#' +#' @autoglobal +#' +#' @keywords internal +#' +#' @export +list_pins <- function(...) { + + board <- mount_board(...) + + pins::pin_list(board) +}