inject_div | R Documentation |
Inject an html division tag with style attribute.
inject_div(x, where, style)
x |
a matrix or data frame |
where |
an |
style |
vector of character string(s) applied to each cell, recycled if necessary |
htmlTable
ht <- htmlTable::htmlTable(
inject_div(head(cars), c(2, 2), style = 'border: dashed 1px;')
)
structure(ht, class = 'htmlTable')
## if where is missing, style is recycled over all cells
ht <- htmlTable::htmlTable(
inject_div(head(mtcars),
style = c('color: red;', 'color: blue', 'border: dashed 1px;')
)
)
structure(ht, class = 'htmlTable')
## where as a matrix
ht <- htmlTable::htmlTable(
inject_div(head(cars),
rbind(c(2, 2), c(2, 1), c(5, 2)),
'background-color: yellow;')
)
structure(ht, class = 'htmlTable')
## where as a vector
ht <- htmlTable::htmlTable(
inject_div(head(cars),
c(2,2,2,1,5,2),
c('background-color: red; color: white;',
'border: solid 1px;',
'font-weight: 900; color: blue;')
)
)
structure(ht, class = 'htmlTable')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.