dfToHtmlTable: Dataframe to HTML Table

Description Usage Arguments Examples

View source: R/df-to-html-table.R

Description

Simple HTML Table intended to be emailed.

Usage

 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
26
dfToHtmlTable(
  df,
  align = "c",
  width = "100%",
  font = "Arial, sans-serif",
  headerBgColour = "#15679f",
  headerFontColour = "#ffffff",
  headerFontSize = "12px",
  headerFontWeight = "bold",
  strippedBgColour = "#cccccc",
  strippedFontColour = "#000000",
  cellFontSize = "12px",
  highlightRowColour = NULL,
  highlightRows = NULL,
  borderStyle = "1px solid black",
  borderLocation = "all",
  colToCollapse = NULL,
  extraHeaderCss = NULL,
  extraRowCss = NULL,
  nowrapCols = NULL,
  title = NULL,
  subtitle = NULL,
  footnotes = NULL,
  titleAlignment = "left",
  tableLineHeight = 1.25
)

Arguments

df

A data.frame

align

string to determine alignment eg. "lcr". last character to used to fill remainder

width

table width

font

font family

headerBgColour

header bg colour

headerFontColour

header font colour

headerFontSize

header font size

headerFontWeight

header font weight

strippedBgColour

stripped row bg colour

strippedFontColour

stripped row font colour

cellFontSize

cell font size

highlightRowColour

highlight row colour

highlightRows

highlight row indices (positions)

borderStyle

css for border style, eg. "1px solid black"

borderLocation

border location, can be "all", "row", or "col"

colToCollapse

col to collapse on. this applies row spans and orders by the column so that the value does not repeat

extraHeaderCss

extra header css

extraRowCss

extra row css

nowrapCols

cols to apply nowrap to. see css white-space nowrap.

title

table title

subtitle

table subtitle, requires title

footnotes

table foot notes

titleAlignment

title alignment

tableLineHeight

table line height

Examples

1
2
3
4
5
htmltools::html_print(dfToHtmlTable(head(mtcars)))
htmltools::html_print(dfToHtmlTable(iris[0, ]))
htmltools::html_print(dfToHtmlTable(iris, colToCollapse = "Species"))
htmltools::html_print(dfToHtmlTable(mtcars, colToCollapse = "carb"))
htmltools::html_print(dfToHtmlTable(mtcars, colToCollapse = "carb", tableLineHeight = 1))

andrew-a-hale/emailable.html.table documentation built on March 17, 2021, 1:15 a.m.