locdir: local data directory

View source: R/locdir.R

locdirR Documentation

local data directory

Description

This can be used to set a directory for DWD data across projects, thus avoiding multiple downloads of the same file.
Set the default for all subsequent calls with options(rdwdlocdir="YOUR/PATH").
You could add this to your .Rprofile file e.g. via usethis::edit_r_profile()

Usage

locdir(dir = getOption("rdwdlocdir"), file = NULL, quiet = rdwdquiet())

Arguments

dir

Path to data directory. If dir does not exist, tempdir() is used instead (with a warning, unless quiet=TRUE). If dir is NULL, locdir tries "C:/DWDdata", then "~/DWDdata".
dir can also be set with options(rdwdlocdir="YOUR/PATH") thanks to the DEFAULT: getOption("rdwdlocdir")

file

Optional: path(s) at dir. DEFAULT: NULL

quiet

Logical: suppress tempdir warning? DEFAULT: FALSE through rdwdquiet()

Value

charstring (directory)

Author(s)

Berry Boessenkool, berry-b@gmx.de, Apr 2019, Jun 2021

See Also

runLocalTests()

Examples

locdir()
oldopt <- options(rdwdlocdir="~")
locdir()
stopifnot(locdir() == path.expand("~"))
options(oldopt) ; rm(oldopt)


brry/rdwd documentation built on April 18, 2024, 4:16 a.m.