Introduction to the hoardr package

knitr::opts_chunk$set(
  comment = "#>",
  collapse = TRUE,
  warning = FALSE,
  message = FALSE
)

hoardr introduction

hoardr is a package for managing cached files.

The benefit of using hoardr vs. raw rapddirs is that hoardr exposes an easy to use R6 class that has variables and functions within it, so you don't have to import function foo or bar, etc. Just a single object.

You can easily wrap hoardr with user facing functions in your own package to manage cached files.

If you find any bugs or have any feature requests get in touch at https://github.com/ropensci/hoardr.

Install

Stable from CRAN

install.packages("hoardr")

Dev version

devtools::install_github(c("ropensci/hoardr"))
library("hoardr")

initialize client

(x <- hoardr::hoard())

set cache path

x$cache_path_set("foobar", type = 'tempdir')

make the directory if doesn't exist

x$mkdir()

put a file in the cache

cat("hello world", file = file.path(x$cache_path_get(), "foo.txt"))

list the files

x$list()

details

x$details()

delete by file name

x$delete("foo.txt")
x$list()


Try the hoardr package in your browser

Any scripts or data that you put into this service are public.

hoardr documentation built on Feb. 16, 2023, 7:28 p.m.