taf2html | R Documentation |
Convert a TAF table 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 in TAF format. |
file |
a filename, or special values |
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.
Instead of using file
to pass a filename, it can have the special
value file = NULL
to return the HTML code as a vector of strings or
file = ""
(the default) to show the HTML in the console.
NULL
, or a vector of strings if file = NULL
.
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 TAF table to a 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.