output_paths {basepenguins} | R Documentation |
Generate modified file paths by adding prefixes and/or suffixes
Description
This function takes a vector of file paths and returns a vector of modified paths
with prefixes and/or suffixes added to the filenames. It's useful for generating
output paths for the convert_files()
and convert_dir()
functions.
files_to_convert()
is useful for generating the input paths
.
Usage
output_paths(paths, prefix = "", suffix = "_new", dir = NULL)
Arguments
paths |
A character vector of file paths to modify |
prefix |
A character string to add at the beginning of each filename.
Default is the empty sting |
suffix |
A character string to add at the end of each filename, before the extension.
Default is |
dir |
An optional character string specifying the output directory.
If provided, the modified filenames will be placed in this directory.
This is useful if |
Value
A character vector of modified file paths with the specified prefixes and suffixes. The original paths are preserved as names of the returned vector.
See Also
convert_files()
, files_to_convert()
Examples
# Get all convertible files from examples directory
input_files <- files_to_convert(example_dir())
# Generate output paths with "_converted" suffix
output_paths(input_files, suffix = "_converted")
# Add both prefix and suffix and place in a new directory
output_paths(
input_files,
prefix = "base_",
suffix = "_converted",
dir = "~/new_dir"
)