Creates a temporary subdirectory of tempdir.

temp_dir(path = tempdir(), nchar = 10L)

Arguments

path

base directory in which temporary directory will be created. Defaults to tempdir.

nchar

integer length of random string used as directory name. Default is 10.

Value

the full directory path of the temporary directory as a string.

Examples

tmp <- temp_dir() tmp
#> [1] "/var/folders/y_/mf4yn8l979bdyptzfhx9mb340000gn/T//Rtmpjsf1Mu/1e0gEpQk7t"
dir.exists(tmp)
#> [1] TRUE
unlink(tmp, force = TRUE)