Convert an S object to HTML
html
is a generic function, for which only two methods are currently
implemented, html.latex
and a rudimentary
html.data.frame
. The former uses the HeVeA
LaTeX to HTML
translator by Maranget to create an HTML file from a LaTeX file like
the one produced by latex
. html.default
just runs
html.data.frame
.
htmlVerbatim
prints all of its arguments to the console in an
html verbatim environment, using a specified percent of the prevailing
character size. This is useful for R Markdown with knitr
.
Most of the html-producing functions in the Hmisc and rms packages
return a character vector passed through htmltools::HTML
so that
kintr
will correctly format the result without the need for the
user putting results='asis'
in the chunk header.
html(object, ...) ## S3 method for class 'latex' html(object, file, where=c('cwd', 'tmp'), method=c('hevea', 'htlatex'), rmarkdown=FALSE, cleanup=TRUE, ...) ## S3 method for class 'data.frame' html(object, file=paste(first.word(deparse(substitute(object))),'html',sep='.'), header, caption=NULL, rownames=FALSE, align='r', align.header='c', bold.header=TRUE, col.header='Black', border=2, width=NULL, size=100, translate=FALSE, append=FALSE, link=NULL, linkCol=1, linkType=c('href','name'), ...) ## Default S3 method: html(object, file=paste(first.word(deparse(substitute(object))),'html',sep='.'), append=FALSE, link=NULL, linkCol=1, linkType=c('href','name'), ...) htmlVerbatim(..., size=75, width=85, scroll=FALSE, rows=10, cols=100, propts=NULL, omit1b=FALSE)
object |
a data frame or an object created by |
file |
name of the file to create. The default file
name is |
where |
for |
method |
default is to use system command |
rmarkdown |
set to |
cleanup |
if using |
header |
vector of column names. Defaults to names in
|
caption |
a character string to be used as a caption before the table |
rownames |
set to |
align |
alignment for table columns (all are assumed to have the
same if is a scalar). Specify |
align.header |
same coding as for |
bold.header |
set to |
col.header |
color for column headers |
border |
set to 0 to not include table cell borders, 1 to include only outer borders, or 2 (the default) to put borders around cells too |
translate |
set to |
width |
optional table width for |
size |
a number between 0 and 100 representing the percent of the
prevailing character size to be used by |
append |
set to |
link |
character vector specifying hyperlink names to attach to
selected elements of the matrix or data frame. No hyperlinks are used
if |
linkCol |
column number of |
linkType |
defaults to |
... |
ignored except for |
scroll |
set to |
rows,cols |
the number of rows and columns to devote to the visable part of the scrollable box |
propts |
options, besides |
omit1b |
for |
Frank E. Harrell, Jr.
Department of Biostatistics,
Vanderbilt University,
fh@fharrell.com
Maranget, Luc. HeVeA: a LaTeX to HTML translater. URL: http://para.inria.fr/~maranget/hevea/
## Not run: x <- matrix(1:6, nrow=2, dimnames=list(c('a','b'),c('c','d','e'))) w <- latex(x) h <- html(w) # run HeVeA to convert .tex to .html h <- html(x) # convert x directly to html w <- html(x, link=c('','B')) # hyperlink first row first col to B # Assuming system package tex4ht is installed, easily convert advanced # LaTeX tables to html getHdata(pbc) s <- summaryM(bili + albumin + stage + protime + sex + age + spiders ~ drug, data=pbc, test=TRUE) w <- latex(s, npct='slash', file='s.tex') z <- html(w) browseURL(z$file) d <- describe(pbc) w <- latex(d, file='d.tex') z <- html(w) browseURL(z$file) ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.