make_path: Build a path, creating subfolders if needed

View source: R/file_tools.R

make_pathR Documentation

Build a path, creating subfolders if needed

Description

Whereas base::file.path() only concatenates strings to build a path, make_path() also makes sure those folders exist.

Usage

make_path(...)

Arguments

...

(Character) Arguments to send to file.path(). You can provide a complete path as a single string, or incrementally build a path with many strings.

Value

(Character) A file path. Automatically adds trailing slashes if required.

Authors

Examples

# make_path("path", "to", "subfolder")

#> [1] "path/to/subfolder"
# And the path/to/subfolder/ folders were also created in the working directory.

# saveRDS(iris, make_path("subfolders/to/compiled/data/iris.rds"))

# Creates all of the subfolders required for writing iris.rds.


DesiQuintans/desiderata documentation built on April 9, 2023, 5:43 a.m.