Checks and creates a directory recursively automatically.
Examples
dir <- file.path(tempdir2(), c("aaa", "bbb"))
dir.exists(dir)
#> [1] FALSE FALSE
dir <- initDir(dir)
dir.exists(dir)
#> [1] TRUE TRUE
print(dir)
#> [1] "/private/var/folders/l1/8y8sjzmn15v49jgrqglghcfr0000gn/T/RtmpPc0MEq/kw0K6QfBg9-170267877321361/aaa"
#> [2] "/private/var/folders/l1/8y8sjzmn15v49jgrqglghcfr0000gn/T/RtmpPc0MEq/kw0K6QfBg9-170267877321361/bbb"
unlink2(dir)