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.

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

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")
#>     x
#> 1   1
#> 2   2
#> 3   3
#> 4   4
#> 5   5
#> 6   6
#> 7   7
#> 8   8
#> 9   9
#> 10 10
board %>% pin_browse("rds", local = TRUE)
#>  Pin at <~/.cache/pins/url/c6e1c81e3fc99db54f6083809dbe243a>

board %>% pin_download("files")
#> [1] "~/.cache/pins/url/1651646bb022a8b321711c29a1ada198/first.txt" 
#> [2] "~/.cache/pins/url/1651646bb022a8b321711c29a1ada198/second.txt"
board %>% pin_download("raw")
#> [1] "~/.cache/pins/url/87473d3442e598f929b65b6630da6fd8/first.txt"