remap_filename: Build Filename (usually for images)

Description Usage Arguments Value Examples

View source: R/remap_filename.R

Description

This is a simple function that helps with the case where you want to construct a filename (usually for an image) with the same base of the filename, the same directory (default), but things added to the front or end of that base filename, with the same extension.

Usage

1
remap_filename(x, sub_dir = NULL, prefix = "", suffix = "")

Arguments

x

input filename/character vector

sub_dir

sub-directory for the new filename. If NULL, then the directory is the the same directory as x

prefix

string to put in front of base of filename

suffix

string to put at the end of base of filename

Value

Character vector

Examples

1
2
3
4
5
fname = file.path("/path/to/file", "original.nii.gz")
remap_filename(fname, prefix = "preproc_", "_with_gz")
fname = "original.nii"
remap_filename(fname, prefix = "note_", "_has_directory")
remap_filename(c(fname, "other.nii.gz"), prefix = "note_", "_has_directory")

neuroconductor-devel/neurobase documentation built on May 6, 2021, 1:48 p.m.