transform.filename: Templating filenames

View source: R/install.R

transform.filenameR Documentation

Templating filenames

Description

Tool to templatize filenames. Useful when needing a ressource that depends on the local configuration

Usage

## S3 method for class 'filename'
transform(fn, subs = base.sub.list)

replace.variables(fn, subs = base.sub.list)

Arguments

fn

Template filename

subs

named list that associates template variable and their values

Details

The names in subs are regex patterns. Any matching regex patterns will be replaced by the value. To avoid replacing parts of words it is advised to start the template variable by a character that is not found in the string to replace. '$ replace.variables is an alias.

Examples

transform.filename("$wd/$dperl/my.script.$scnum.pl", c("$wd" = ".", "$dperl" = "perl", "$scnum" = "10"))

jalgos/jsroot documentation built on Jan. 27, 2025, 3:40 p.m.