Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

make_path

Create directory structure for a file path


Description

This function creates directories recursively (as necessary) to the specified file.

Usage

make_path(x, ...)

## S3 method for class 'filename'
make_path(x, showWarnings = FALSE, recursive = TRUE, ...)

## S3 method for class 'character'
make_path(x, ...)

Arguments

x

file name (character or filename)

...

other arguments passed to dir.create

showWarnings

whether to show warnings

recursive

whether to recursively create all parent directories

Examples

## Not run: 
# 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)

## End(Not run)

filenamer

Easy Management of File Names

v0.2.3
GPL (>= 3)
Authors
David J. H. Shih
Initial release
2018-05-01

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.