Learn R Programming

Kmisc (version 0.5.0)

makeHTMLTag: Make HTML Elements

Description

Creates a function that returns a function that can be used to generate HTML elements. See examples for usage.

Usage

makeHTMLTag(tag, ...)

Arguments

tag
the HTML tag to use.
...
a collection of named and unnamed arguments; named arguments are parsed as attributes of the tag, unnamed arguments are pasted together into the inner data of the tag.

Details

This function returns a function that can be called as an HTML tag generating function. For example, by calling p <- makeHTMLTag("p"), we can generate a function that interprets all named arguments as attributes, and all unnamed arguments as 'data', which is generated for a p HTML tag.

See Also

html

Examples

Run this code
div <- makeHTMLTag("div")
my_class = "orange"
x <- "some text"
div( class=my_class, id="hello", "This is ", x )

Run the code above in your browser using DataLab