taf2html | R Documentation |
Convert a data frame to HTML code and optionally write to a file.
taf2html(x, file = "", align = "", header = align,
digits = getOption("digits"), center = "style=\"text-align:center\"",
left = "style=\"text-align:left\"",
right = "style=\"text-align:right\"", append = FALSE)
x |
a data frame. |
file |
a filename, or special value |
align |
a string (or a vector of strings) specifying alignment of data cells. |
header |
a string (or a vector strings) specifying alignment of header cells. |
digits |
significant digits for numeric columns. |
center |
HTML attribute to indicate center alignment. |
left |
HTML attribute to indicate left alignment. |
right |
HTML attribute to indicate right alignment. |
append |
whether to append to an existing file. |
The align
argument can be a vector of strings to specify
column-specific alignment, for example c("l","r","l","l")
. Only the
first letter (case-insensitive) is used, so "left"
is equivalent to
"L"
. An empty string (the default), or any string that does not begin
with C
, L
, or R
indicates no specific alignment.
The header
argument can be used to specify an alignment for the column
names that is different from the data values. The default is to use the same
alignment as the data values.
The center
, left
, and right
arguments can be used to
specify the exact HTML attribute to render alignment, for users who are
familiar with cascading style sheets (CSS). For example, the long-winded
style="text-align:center"
could be shortened to class="L"
if a
corresponding class has been defined in CSS.
The default value file = ""
prints the HTML code in the console,
instead of writing it to a file. The output can then be pasted into a file to
edit further, without accidentally overwriting an existing file.
Character vector of class Bibtex
.
Although the output is HTML code, the Bibtex
class is used for
convenient display in the console.
The resulting HTML conforms to the HTML5 standard and aims for compact output, omitting optional closing tags and rendering each row of data as one row of HTML code.
write.taf
writes a data frame to a CSV file.
TAF-package
gives an overview of the package.
taf2html(catage.taf)
taf2html(catage.taf, align=c("L","R","R","R","R"))
## Not run:
taf2html(catage.taf, "catage.html")
taf2html(catage.taf, "catage.html", align=c("L","R","R","R","R"),
append=TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.