board_url: Use a vector of URLs as a board

Description Usage Arguments See Also Examples

View source: R/board_url.R

Description

board_url() lets you build up a board from individual urls. This is useful because pin_download() and pin_get() will be cached - they'll only re-download the data if it's changed from the last time you downloaded it (using the tools of HTTP caching). You'll also be protected from the vagaries of the internet; if a fresh download fails, you'll get the previously cached result with a warning.

board_url() is read only and does not currently support versions.

Usage

1
board_url(urls, cache = NULL, use_cache_on_failure = is_interactive())

Arguments

urls

A named character vector of URLs If the URL ends in a /, board_url will look for a data.txt that provides metadata. The easiest way to generate this file is to upload a pin directory created by board_folder().

cache

Cache path. Every board requires a local cache to avoid downloading files multiple times. The default stores in a standard cache location for your operating system, but you can override if needed.

use_cache_on_failure

If the pin fails to download, is it ok to use the last cached version? Defaults to is_interactive() so you'll be robust to poor internet connectivity when exploring interactively, but you'll get clear errors when the code is deployed.

See Also

Other boards: board_folder(), board_rsconnect()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
github_raw <- "https://raw.githubusercontent.com/"
board <- board_url(c(
  files = paste0(github_raw, "rstudio/pins/master/tests/testthat/pin-files/"),
  rds = paste0(github_raw, "rstudio/pins/master/tests/testthat/pin-rds/"),
  raw = paste0(github_raw, "rstudio/pins/master/tests/testthat/pin-files/first.txt")
))

board %>% pin_read("rds")
board %>% pin_browse("rds", local = TRUE)

board %>% pin_download("files")
board %>% pin_download("raw")

pins documentation built on Oct. 2, 2021, 5:06 p.m.