
Last chance! 50% off unlimited learning
Sale ends in
This function creates directories recursively (as necessary) to the specified file.
make_path(x, ...)# S3 method for filename
make_path(x, showWarnings = FALSE, recursive = TRUE, ...)
# S3 method for character
make_path(x, ...)
file name (character
or filename
)
other arguments passed to dir.create
whether to show warnings
whether to recursively create all parent directories
if (FALSE) {
# CRAN policy forbids package example to write to current directory,
# even inside \dontrun because the user may copy-and-paste and
# polute his/her current directory;
# in real-world setting, the `tempdir` path prefix is unnecessary
x <- file.path(tempdir(), "path/to/file.txt")
fn <- as.filename(x)
make_path(fn)
}
Run the code above in your browser using DataLab