data.frame
or a matrix
. It
simply parses the item as an HTML table.
makeHTMLTable(x, attr, row.spans = 0, col.spans = 0, use.row.names = FALSE, use.col.names = FALSE, clean = TRUE, replace.periods = TRUE)
data.frame
/ matrix
you want
to convert to an HTML table.
tag, as raw HTML.TRUE
, we print all
numeric values with 4 digits. Alternatively, we can pass
a format specifier as used by sprintf
.pxt
for an example
implementation. It will also handle 'boxes', e.g. cells
with both rowspan and colspan > 1.Note that the default behavior is to 'clean'
numeric
input; this prints numeric values with a maximum of four
digits; ie, through the "%.4G"
format specifier.
Alternatively, you can use a format specifier (as used in
sprintf
) to ensure numbers are formatted and
displayed as desired.
dat <- data.frame( apple=c(1.2150125, 2, 3), banana=c("a", "b", "c") )
makeHTMLTable( dat )
Run the code above in your browser using DataLab