Skip to content

Commit

Permalink
standalone changelog reordering
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewallenbruce committed Dec 13, 2024
1 parent 00a3630 commit a972f7e
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 8 deletions.
16 changes: 8 additions & 8 deletions R/standalone-helpers.R
Original file line number Diff line number Diff line change
@@ -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:
#
Expand All @@ -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

Expand Down
62 changes: 62 additions & 0 deletions data-raw/pins_template.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#' Mount [pins][pins::pins-package] board
#'
#' @param source `<chr>` `"local"` or `"remote"`
#'
#' @returns `<pins_board_folder>` or `<pins_board_url>`
#'
#' @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 `<chr>` string name of pinned dataset
#'
#' @param ... additional arguments passed to `mount_board()`
#'
#' @returns `<tibble>` or `<data.frame>`
#'
#' @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 `<list>` of [pins][pins::pins-package]
#'
#' @autoglobal
#'
#' @keywords internal
#'
#' @export
list_pins <- function(...) {

board <- mount_board(...)

pins::pin_list(board)
}

0 comments on commit a972f7e

Please sign in to comment.