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, ...)
"html"(object, file, where=c('cwd', 'tmp'), method=c('hevea', 'htlatex'), rmarkdown=FALSE, cleanup=TRUE, ...)
"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'), ...)
"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)
latex
.
For the generic html
is any object for which an html
method exists.object.html
where object
is the first word in
the name of the argument for object
. For html.latex
specify file=''
or file=character(0)
to print html code to
the console, as when using knitr
. For the data.frame
method, file
may be set to FALSE
which causes a character
vector enclosed in htmltools::HTML
to be returned instead of
writing to the console.
html
. Default is to put output files in current
working directory. Specify where='tmp'
to put in a system
temporary directory area.hevea
to convert
from LaTeX to html. Specifymethod='htlatex'
to use system
command htlatex
, assuming the
system package TeX4ht
is installed.TRUE
if using RMarkdown (usually under
knitr
and RStudio). This causes html to be packaged for
RMarkdown and output to go into the console stream. file
is
ignored when rmarkdown=TRUE
.method='htlatex'
set to FALSE
if
where='cwd'
to prevent deletion of auxiliary files created by
htlatex
that are not needed when using the final html
document (only the .css
file is needed in addition to
.html
). If using method='hevea'
, cleanup=TRUE
causes deletion of the generated .haux
file.object
. Set to NULL
to suppress column names.FALSE
to ignore row names even if they are
present"c", "r", "l"
for center, right, or left
alignment.align
but pertains to
headerFALSE
to not bold face column headersTRUE
to run header and table cell text
through the htmlTranslate
functionhtml.data.frame
. For full
page width use width="100%"
, for use in options()
for
printing objects.htmlVerbatim
and the
data frame method.TRUE
to append to an existing filelink
is omitted or for elements of link
that are
""
. To allow multiple links per link, link
may also be
a character matrix shaped as object
in which case
linkCol
is ignored.object
to which hyperlinks are
attached. Defaults to first column."href"
htmlVerbatim
- is a list of
objects to print()
TRUE
to put the html in a scrollable
textarea
quote=FALSE
to pass to the
print
method, for htmlVerbatim
htmlVerbatim
if TRUE
causes an initial
line of output that is all blank to be deletedlatex
## 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)
Run the code above in your browser using DataLab