hwrite {hwriter} | R Documentation |
Outputs an R object in HTML format.
hwrite(x, page=NULL, ...)
x |
an R object to output in HTML format. Objects of type character , vector , matrix
and data.frame are currently supported. |
page |
an optional connection, a character string naming the file to write
to or a page object returned by openPage . |
... |
optional arguments depending on the type of
x . See Details. |
Depending on its type and its length, x
is written as a
character string, a character vector or as an HTML table.
Many optional arguments can be used to render an R object. Arguments are listed below and rendering examples are shown in Examples.
Following optional arguments can be always used, independently of the
type of x
:
x
. Default is FALSE
.x
should be centered.
Default is FALSE
.A character string containing the output HTML code.
If x
is a vector of only one element, it will be written as a
character string. Following optional arguments can be used:
If x
is a vector with more than one element, it will be written
as an
HTML table by default unless table
is set to FALSE
, for which
it will be written as a vector of character strings. Optional
specific
arguments to either character strings or HTML tables can be used,
together with the following ones:
TRUE
, the vector is written as an HTML table
with one row and a number of columns equals to the number of elements
in x
. If FALSE
, the vector is written as a character vector. Default is TRUE
.table
is
TRUE
.FALSE
the table is filled by
columns, otherwise the table is filled by rows. Can be used only if table
is
TRUE
. Default is FALSE
.TRUE
.
If x
is a matrix or a data.frame, x
is written as an
HTML table. Following optional arguments can be used:
x
are to be written. Default is TRUE
.bgcolor
is a character string, the whole table will be painted with this color. If bgcolor
is a character matrix of the same
size as x
which contains the cell colors, cells will be painted accordingly to the matrix. A matrix can contain NAs when cells don't have
a background color. The matrix may contain one extra row and/or column to target the heading (row.names, col.names) table cells. See Examples.x
. If sizes don't match, values are recycled using R style. Unnamed vector of colors will point the heading rows (resp. columns). See Examples.bgcolor
, row.bgcolor
and col.bgcolor
but define
CSS styles that should be used to render table cells. CSS styles are very versatile and allow to change border style, typeface, font properties, align, boldness, font color, italic... See Examples.bgcolor
, row.bgcolor
and col.bgcolor
but
define here URLs that the cells will point to. See Examples.col.width
are used to
point column names of x
. NAs may be used to let some column
widths unspecified.See Examples for many illustrated examples of all arguments.
Gregoire Pau, gpau@ebi.ac.uk, 2008
openPage
, closePage
, hwriteImage
, hmakeTag
.
hwriter:::writeExample()