parseTemplate: Parse a template

Description Usage Arguments Value See Also Examples

View source: R/parseTemplate.R

Description

parseTemplate() reads fileIn and uses sprintf to make string replacements.

Usage

1
parseTemplate(fileIn, ...)

Arguments

fileIn

path to template file (quoted string)

...

objects to use as string replacements

Value

A string representing the contents of fileIn after the specified replacements have been made. As the string is a length one character vector, new lines (\n) have been inserted accordingly.

See Also

sprintf

Examples

1
2
3
4
5
6
7
8
x <- c("My %s favorite", "%s is a %s.")
write(x, "x.txt")
system("more x.txt")
y <- parseTemplate("x.txt", "least", "animal", "cat")
print(y)
write(y, "y.txt")
system("more y.txt")
file.remove("x.txt", "y.txt")

dnegrey/miscTools documentation built on May 3, 2019, 2:57 p.m.