View source: R/remap_filename.R
remap_filename | R Documentation |
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.
remap_filename(x, sub_dir = NULL, prefix = "", suffix = "")
x |
input filename/character vector |
sub_dir |
sub-directory for the new filename. If |
prefix |
string to put in front of base of filename |
suffix |
string to put at the end of base of filename |
Character vector
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.