Skip to contents

A wrapper around fs::path() that constructs file paths from input components and returns them as a character string instead of an "fs_path" object.

Usage

Path(..., ext = "")

Arguments

...

character vectors, if any values are NA, the result will also be NA. The paths follow the recycling rules used in the tibble package, namely that only length 1 arguments are recycled.

ext

An optional extension to append to the generated path.

Value

A character vector representing the constructed file path(s).

Examples

# Basic usage
IASDT.R::Path("datasets", "processed", "model_fitting")
#> [1] "datasets/processed/model_fitting"

# Adding a file extension
IASDT.R::Path("results", "output", ext = "csv")
#> [1] "results/output.csv"

# Handling multiple components
IASDT.R::Path("home", "user", "documents", "report", ext = "pdf")
#> [1] "home/user/documents/report.pdf"

# Using vectorized input
IASDT.R::Path("folder", c("file1", "file2"), ext = "txt")
#> [1] "folder/file1.txt" "folder/file2.txt"