tag_attr-set: Add attributes to a tag

Description Usage Arguments Value Examples

Description

Add attributes to a tag

Usage

1
tag_attr(tag) <- value

Arguments

tag

add attributes to tag.

value

list with named attributes to add e.g. list(style = "background-color: lightblue;").

Value

tag

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 
img <- tempfile(fileext = ".png")
png(img)
plot(speed ~ dist, cars)
dev.off()

h <- html_html(html_body(
    html_p("Display the 'cars' dataset as a table") +
    html_table(cars) +
    html_img(src = img, alt = "'cars' dataset") +
    html_p(paste("Display the 'cars' dataset again, but now",
                 "with column sums in a 'tfoot' tag"),
           style = "background-color: lightblue;") +
    html_table(rbind(cars, colSums(cars)), tfoot = TRUE) +
    html_p("Display the 'mtcars' dataset as a table",
           style = "background-color: lightgreen;") +
    html_table(mtcars) +
    html_hr() +
    html_p("Nice &#9786;")))

filename <- tempfile(fileext = ".html")
capture.output(h, file = filename)
browseURL(filename)

## End(Not run)

trosendal/hlt documentation built on March 15, 2021, 5:21 a.m.