-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b8ba981
commit f82e244
Showing
9 changed files
with
236 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ | |
^_pkgdown\.yml$ | ||
^docs$ | ||
^pkgdown$ | ||
^data-raw$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,12 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(get_pin) | ||
export(gh_raw) | ||
export(list_pins) | ||
export(mount_board) | ||
importFrom(fs,path_package) | ||
importFrom(glue,glue) | ||
importFrom(pins,board_folder) | ||
importFrom(pins,board_url) | ||
importFrom(pins,pin_list) | ||
importFrom(pins,pin_read) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#' Return GitHub raw url | ||
#' | ||
#' @param x `<chr>` string | ||
#' | ||
#' @returns `<chr>` GitHub raw url | ||
#' | ||
#' @examples | ||
#' gh_raw("andrewbruce/example/main/inst/pins/") | ||
#' | ||
#' @autoglobal | ||
#' | ||
#' @keywords internal | ||
#' | ||
#' @export | ||
gh_raw <- function(x) { | ||
paste0("https://raw.githubusercontent.com/", x) | ||
} | ||
|
||
#' Mount [pins][pins::pins-package] board | ||
#' | ||
#' @param source `<chr>` `"local"` or `"remote"` | ||
#' | ||
#' @param package `<chr>` package name | ||
#' | ||
#' @returns `<pins_board_folder>` or `<pins_board_url>` | ||
#' | ||
#' @autoglobal | ||
#' | ||
#' @importFrom pins board_folder board_url | ||
#' @importFrom fs path_package | ||
#' @importFrom glue glue | ||
#' | ||
#' @keywords internal | ||
#' | ||
#' @export | ||
mount_board <- function(source = c("local", "remote"), package = "arktax") { | ||
|
||
source <- match.arg(source) | ||
|
||
switch( | ||
source, | ||
local = board_folder( | ||
path_package("extdata/pins", package = package) | ||
), | ||
remote = board_url( | ||
gh_raw( | ||
glue("andrewallenbruce/{package}/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 | ||
#' | ||
#' @importFrom pins pin_read | ||
#' | ||
#' @keywords internal | ||
#' | ||
#' @export | ||
get_pin <- function(pin, ...) { | ||
|
||
board <- mount_board(...) | ||
|
||
pin <- match.arg(pin, list_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 | ||
#' | ||
#' @importFrom pins pin_list | ||
#' | ||
#' @keywords internal | ||
#' | ||
#' @export | ||
list_pins <- function(...) { | ||
|
||
board <- mount_board(...) | ||
|
||
pin_list(board) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,49 @@ | ||
url: https://andrewallenbruce.github.io/arktax/ | ||
|
||
template: | ||
bootstrap: 5 | ||
light-switch: true | ||
bslib: | ||
base_font: {google: "Roboto"} | ||
heading_font: {google: "Roboto Slab"} | ||
code_font: {google: "Source Code Pro"} | ||
|
||
navbar: | ||
structure: | ||
left: | ||
- intro | ||
- reference | ||
- articles | ||
- tutorials | ||
- news | ||
right: | ||
- search | ||
- github | ||
- lightswitch | ||
components: | ||
reference: | ||
text: Reference | ||
href: reference/index.html | ||
search: | ||
search: [] | ||
lightswitch: | ||
icon: fa-sun | ||
aria-label: Light switch | ||
id: lightswitch | ||
menu: | ||
- text: Light | ||
theme: light | ||
icon: fa-sun | ||
- text: Dark | ||
theme: dark | ||
icon: fa-moon | ||
- text: Auto | ||
theme: auto | ||
icon: fa-adjust | ||
news: | ||
text: Changelog | ||
href: news/index.html | ||
github: | ||
icon: fab fa-github fa-lg | ||
href: https://github.com/andrewallenbruce/arktax/ | ||
aria-label: GitHub |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.