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/9b/4gh0pghx1b71jjd0wjh5mj880000gn/T/RtmpZQYj2p/sWLklu4eD5-174550743286086/aaa"
#> [2] "/private/var/folders/9b/4gh0pghx1b71jjd0wjh5mj880000gn/T/RtmpZQYj2p/sWLklu4eD5-174550743286086/bbb"
unlink2(dir)