Debian Codegraph @

man/format_html.Rd

raw
1 \name{format_html}
2 \alias{show_html}
3 \alias{format_html}
4 \alias{write_html}
5 \alias{df_format_stdstyle}
6 \alias{mat_format_stdstyle}
7 \alias{format_html.data.frame}
8 \alias{format_html.matrix}
9 \title{
10 Format Objects in HTML, show the HTML Format or Write it to a File
11 }
12 \description{
13 \code{show_html} is for showing objects in a convenient way in HTML format.
14 \code{write_html} writes them in HTML format into a file.
15 Both functions call the generic \code{format_html} for the format conversion.
16 }
17 \usage{
18 show_html(x, output = NULL, \dots)
19 write_html(x, file, \dots, standalone = TRUE)
20
21 format_html(x, \dots)
22
23 \method{format_html}{data.frame}(x,
24 toprule=2,midrule=1,bottomrule=2,
25 split.dec=TRUE,
26 row.names=TRUE,
27 digits=getOption("digits"),
28 format="f",
29 style=df_format_stdstyle,
30 margin="2ex auto",
31 \dots)
32
33 \method{format_html}{matrix}(x,
34 toprule=2,midrule=1,bottomrule=2,
35 split.dec=TRUE,
36 formatC=FALSE,
37 digits=getOption("digits"),
38 format="f",
39 style=mat_format_stdstyle,
40 margin="2ex auto",
41 \dots)
42 }
43 \arguments{
44 \item{x}{an object.}
45 \item{output}{character string or a function
46 that determines how the HTML formatted object is shown.
47
48 If \code{output} is a function, it is called with the path
49 of a (temporary) file with HTML code, e.g. \emph{RStudio}'s \code{viewer}
50 function (which is available in the package \code{rstudioapi}.
51
52 If \code{output} equals "stdout", the HTML code is written to the
53 standard output stream (for use e.g. in output produced with \code{knitr}),
54 if "file-show", the contents of a file with the HTML code is shown
55 via \code{\link{file.show}}, and
56 if "browser", the contents of a file with the HTML code is shown
57 by the standard browser (via \code{\link{browseURL}}).
58
59 This arguments has different defaults, depending of the type of
60 the session. In non-interactive sessions, the default is
61 "console", in interactive sessions other than RStudio,
62 it is "browser", in interactive sessions with RStudio
63 it is "file-show".
64
65 These default settings can be overriden by the option "html_viewer"
66 (see \code{\link{options}}).
67 }
68 \item{file}{character string; name or path of the file where to
69 write the HTML code to.}
70 \item{toprule}{integer;
71 thickness in pixels of rule at the top of the table.}
72 \item{midrule}{integer;
73 thickness in pixels of rules within the table.}
74 \item{bottomrule}{integer;
75 thickness in pixels of rule at the bottom of the table.}
76 \item{split.dec}{logical; whether numbers should be centered
77 at the decimal point by splitting the table cells.}
78 \item{row.names}{logical; whether row names should be shown/exported.}
79 \item{digits}{number of digits to be shown after the decimal dot. This is only useful, if
80 the "ftable" object was created from a table created with \code{\link{genTable}} or the like.}
81 \item{formatC}{logical; whether to use \code{\link{formatC}} instead
82 of \code{\link{format}} to format cell contents.}
83 \item{format}{a format string for \code{\link{formatC}}}
84 \item{style}{string containing the stanard CSS styling of table cells.}
85 \item{margin}{character string, determines the margin and thus
86 the position of the HTML table.}
87 \item{\dots}{other arguments, passed on to formatter functions.}
88 \item{standalone}{logical; should HTML file contain a "!DOCTYPE" header?}
89 }
90 \value{
91 \code{format_html} character string with code suitable for inclusion into a HTML-file.
92 }