Checks and creates a directory recursively automatically.

initDir(dir)

Arguments

dir

character(1). Directory path.

Value

character(1). Directory path.

Details

Useful for setting up functions that require writes to a user-specified directory.

Note

Updated 2019-10-22.

Examples

initDir("testdir") dir.exists("testdir")
#> [1] TRUE
## Clean up. unlink("testdir", recursive = TRUE)