htmlTable.etable | R Documentation |
This is method for rendering results of fre/cro/tables
in Shiny/RMarkdown/Jupyter notebooks and etc. For detailed description of
function and its arguments see htmlTable. You can pack your
tables in the list and render them all simultaneously. See examples. You may
be interested in expss_output_viewer()
for automatical rendering
tables in the RStudio viewer or expss_output_rnotebook()
for
rendering in the R notebooks. See expss.options. repr_html
is
method for rendering table in the Jupyter notebooks and knit_print
is
method for rendering table in the knitr
HTML-documents. Jupyter
notebooks and knitr
documents are supported automatically but in the R
notebooks it is needed to set output to notebook via
expss_output_rnotebook()
.
## S3 method for class 'etable'
htmlTable(
x,
header = NULL,
rnames = NULL,
rowlabel = NULL,
caption = NULL,
tfoot = NULL,
label = NULL,
rgroup = NULL,
n.rgroup = NULL,
cgroup = NULL,
n.cgroup = NULL,
tspanner = NULL,
n.tspanner = NULL,
total = NULL,
ctable = TRUE,
compatibility = getOption("htmlTableCompat", "LibreOffice"),
cspan.rgroup = "all",
escape.html = FALSE,
...,
digits = get_expss_digits(),
row_groups = TRUE
)
## S3 method for class 'with_caption'
htmlTable(
x,
header = NULL,
rnames = NULL,
rowlabel = NULL,
caption = NULL,
tfoot = NULL,
label = NULL,
rgroup = NULL,
n.rgroup = NULL,
cgroup = NULL,
n.cgroup = NULL,
tspanner = NULL,
n.tspanner = NULL,
total = NULL,
ctable = TRUE,
compatibility = getOption("htmlTableCompat", "LibreOffice"),
cspan.rgroup = "all",
escape.html = FALSE,
...,
digits = get_expss_digits(),
row_groups = TRUE
)
## S3 method for class 'list'
htmlTable(
x,
header = NULL,
rnames = NULL,
rowlabel = NULL,
caption = NULL,
tfoot = NULL,
label = NULL,
rgroup = NULL,
n.rgroup = NULL,
cgroup = NULL,
n.cgroup = NULL,
tspanner = NULL,
n.tspanner = NULL,
total = NULL,
ctable = TRUE,
compatibility = getOption("htmlTableCompat", "LibreOffice"),
cspan.rgroup = "all",
escape.html = FALSE,
...,
digits = get_expss_digits(),
row_groups = TRUE,
gap = "<br>"
)
knit_print.etable(x, ..., digits = get_expss_digits(), escape.html = FALSE)
knit_print.with_caption(
x,
...,
digits = get_expss_digits(),
escape.html = FALSE
)
repr_html.etable(obj, ..., digits = get_expss_digits(), escape.html = FALSE)
repr_html.with_caption(
obj,
...,
digits = get_expss_digits(),
escape.html = FALSE
)
repr_text.etable(obj, ..., digits = get_expss_digits())
repr_text.with_caption(obj, ..., digits = get_expss_digits())
x |
a data object of class 'etable' - result of fre/cro and etc. |
header |
Ignored. |
rnames |
Ignored. |
rowlabel |
Ignored. |
caption |
See manual for htmlTable. |
tfoot |
See manual for htmlTable. |
label |
See manual for htmlTable. |
rgroup |
Ignored. |
n.rgroup |
Ignored. |
cgroup |
Ignored. |
n.cgroup |
Ignored. |
tspanner |
See manual for htmlTable. |
n.tspanner |
See manual for htmlTable. |
total |
See manual for htmlTable. |
ctable |
See manual for htmlTable. |
compatibility |
See manual for htmlTable. |
cspan.rgroup |
See manual for htmlTable. |
escape.html |
logical: should HTML characters be escaped? Defaults to FALSE. |
... |
further parameters for htmlTable. |
digits |
integer By default, all numeric columns are rounded to one digit after
decimal separator. Also you can set this argument by setting option 'expss.digits'
- for example, |
row_groups |
logical Should we create row groups? TRUE by default. |
gap |
character Separator between tables if we output list of tables. By default it is line break '<br>'. |
obj |
a data object of class 'etable' - result of fre/cro and etc. |
Returns a string of class htmlTable
## Not run:
data(mtcars)
mtcars = apply_labels(mtcars,
mpg = "Miles/(US) gallon",
cyl = "Number of cylinders",
disp = "Displacement (cu.in.)",
hp = "Gross horsepower",
drat = "Rear axle ratio",
wt = "Weight (1000 lbs)",
qsec = "1/4 mile time",
vs = "Engine",
vs = c("V-engine" = 0,
"Straight engine" = 1),
am = "Transmission",
am = c("Automatic" = 0,
"Manual"=1),
gear = "Number of forward gears",
carb = "Number of carburetors"
)
expss_output_viewer()
mtcars %>%
tab_cols(total(), am %nest% vs) %>%
tab_cells(mpg, hp) %>%
tab_stat_mean() %>%
tab_cells(cyl) %>%
tab_stat_cpct() %>%
tab_pivot() %>%
set_caption("Table 1. Some variables from mtcars dataset.")
# several tables in a list
list(
cross_cpct(mtcars, list(am, vs, cyl), list(total(), am))
%>% set_caption("Table 1. Percent."),
cross_mean_sd_n(mtcars, list(mpg, hp, qsec), list(total(), am))
%>% set_caption("Table 2. Means.")
) %>%
htmlTable()
expss_output_default()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.