The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
The primary purpose of this package is for use within other packages. To use {dlr}, you most likely want to wrap some of the exported functions from this package.
The primary use for {dlr} is to download data to an app cache if that data does not already exist. Wrap read_or_cache
for any files you wish to cache.
Tip: If you will allow users to download multiple files with different URLs, define the URLs as internal data. That way you can edit all URLs in one location without having to search through multiple functions. For example, in the example below, .my_url
is an internal named list with the URLs of the files of interest.
<- function(variant = c("small", "medium", "big")) {
my_big_dataset # Returns the result of downloading and then reading with read.csv.
return(
::read_or_cache(
dlrsource_path = .my_urls[[variant]],
appname = "myPackage",
process_f = read.csv
)}
An alternative pattern would be to allow users to download (or otherwise process) files which other functions in your package will load. For example, perhaps you want to allow the user to download a large lookup table, which will then be used by default by the rest of the package. The code to do so would look something like this:
<- function(variant = c("small", "medium", "big")) {
download_lookup # Returns the path to the processed file, rather than the contents of that
# file.
return(
::maybe_cache(
dlrsource_path = .my_urls[[variant]],
appname = "myPackage",
process_f = read.csv
)
) }
If you want the user to be able to easily determine the location of the cache for your package (often useful even if you don’t think it will be), provide a wrapper around app_cache_dir
<- function() {
myPackage_cache_dir return(dlr::app_cache_dir(appname = "myPackage"))
}
Users will have use cases you aren’t prepared for, such as a strange file system or a shared cache directory specifically for your package. Allow them to set up such options with set_app_cache_dir
.
<- function(cache_dir) {
set_myPackage_cache_dir return(dlr::set_app_cache_dir(appname = "myPackage", cache_dir = cache_dir))
}
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.