FileTemplate | R Documentation |
A class for reading a file template, replacing tags inside, and writing the results in an output file.
new()
Initializer.
FileTemplate$new(path)
path
The path to the template file.
Nothing.
replace()
Replace a tag by its value inside the template file.
FileTemplate$replace(tag, value)
tag
The tag to replace.
value
The value to replace the tag with.
invisible(self) for chaining method calls.
choose()
Choose one case among a set of cases.
FileTemplate$choose(set, case)
set
The name of the case set.
case
The name of case.
invisible(self) for chaining method calls.
select()
Select or remove sections that match a name.
FileTemplate$select(section, enable)
section
The name of the section.
enable
Set to TRUE to select the section (and keep it), and FALSE to remove it.
invisible(self) for chaining method calls.
write()
Write template with replaced values to disk.
FileTemplate$write(path, overwrite = FALSE, checkRemainingTags = TRUE)
path
Path to output file.
overwrite
If set to FALSE and the destination file already exists, a message is thrown. Otherwise writes into the destination.
checkRemainingTags
If set to TRUE, checks first, before writing, if there any remaining tags that have not been processed. A warning is thrown for each found tag.
Nothing.
getLines()
Get the lines of the templates.
FileTemplate$getLines()
A vector containing the lines of the templates.
clone()
The objects of this class are cloneable with this method.
FileTemplate$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.