dynamicTemplate2 {webdeveloper}R Documentation

Replace placeholder variables in a HTML document string, after reading the file into R.

Description

Replace placeholder variables in a HTML document string, after reading the file into R.

Usage

dynamicTemplate2(file, replacements = c())

Arguments

file

Filepath of the HTML file with placeholder variables that need to be replaced.

replacements

A named vector or named list. Names should match a template variable acting as a placeholder in a HTML document string and values should be the text to replace the placeholders with.

Value

A string of HTML with placeholder values replaced.

Examples

tmp <- tempfile()
writeLines(html(body(templateVar("body_var"))), con = tmp)
dynamicTemplate2(file = tmp, replacements = c("%%rvar-body_var%%" = div(p("body replacement"))))

[Package webdeveloper version 1.0.5 Index]