Check if data directory exists and create a new directory if needed
Source:R/get_data_dir.R
get_data_dir.Rd
Get the path for a package-specific cache directory with
rappdirs::user_cache_dir()
, check for the existence of a data directory,
optionally create a new directory at the provided path location.
Usage
get_data_dir(
path = NULL,
cache = FALSE,
create = TRUE,
pkg = "sfext",
allow_null = TRUE
)
list_data_files(
path = NULL,
pkg = "sfext",
cache = FALSE,
fileext = NULL,
pattern = NULL,
full.names = TRUE,
ignore.case = TRUE,
...
)
Arguments
- path
Path to directory for use as data directory.
- cache
If
TRUE
, and path isNULL
set path to rappdirs::user_cache_dir (using value of pkg as appname). If path is notNULL
, the path is returned even if cache isTRUE
.- create
If
FALSE
and path does not exist, return path with a warning. IfTRUE
and rlang::is_interactive isTRUE
, ask user if directory should be created. If the session not interactive and create isTRUE
, a new directory will be created.- pkg
Package name; defaults to "sfext"
- allow_null
If
TRUE
, path isNULL
, cache isFALSE
, return theNULL
path value; defaults toTRUE
.- fileext
If pattern is NULL, fileext is used to set the pattern and filter listed files to those matching the file extension.
- pattern
an optional regular expression. Only file names which match the regular expression will be returned.
- full.names
a logical value. If
TRUE
, the directory path is prepended to the file names to give a relative file path. IfFALSE
, the file names (rather than paths) are returned.- ignore.case
logical. Should pattern-matching be case-insensitive?
- ...
Additional parameters passed to
list.files()