Last chance! 50% off unlimited learning
Sale ends in
hmisc::latex
or htmlTable::htmlTable
.
qable(x, rtitle, rgroup, rnames = rownames(x), cnames = colnames(x), markup = getOption("qwraps2_markup", "latex"), ...)
matrix
or data.frame
to be turned into a qablesum(rowgroup) == nrow(x)
.format
argument of knitr::kable
.knitr::kable
qable
is used as the printing method for qwraps2_summary_table
objects. Check the vignettes for examples on building data summary tables.rtitle
can be used to add a title to the column constructed by the
rgroup
and rnames
. The basic layout of a table generated by
qable
is:
rtitle | cnames[1] |
cnames[2] | rgroup[1] |
rnames[1] | x[1, 1] |
x[1, 2] | rnames[2] |
x[2, 1] | x[2, 2] |
rnames[3] | x[3, 1] |
x[3, 2] | rgroup[2] |
rnames[4] | x[4, 1] |
x[4, 1] | rnames[5] |
x[5, 1] | x[5, 1] |
It should be noted that escape = !(markup == "latex")
is passed to
kable
.
kable
summary_table
, for an example of build a data summary table, i.e., a
“Table 1”.
For more detail on arguments you can pass to ...
look at the
non-exported functions form the knitr package knitr:::kable_latex
,
knitr:::kable_markdown
, or others.
data(mtcars)
qable(mtcars)
qable(mtcars, markup = "markdown")
# by make
make <- sub("^(\\w+)\\s?(.*)$", "\\1", rownames(mtcars))
make <- c(table(make))
# A LaTeX table with a verticle bar between each column
qable(mtcars[sort(rownames(mtcars)), ], rgroup = make)
# A LaTeX table with no verticle bars between columns
qable(mtcars[sort(rownames(mtcars)), ], rgroup = make, vline = "")
# a markdown table
qable(mtcars[sort(rownames(mtcars)), ], rgroup = make, markup = "markdown")
# define your own column names
qable(mtcars[sort(rownames(mtcars)), ],
rgroup = make,
cnames = toupper(colnames(mtcars)),
markup = "markdown")
# define your own column names and add a title
qable(mtcars[sort(rownames(mtcars)), ],
rtitle = "Make & Model",
rgroup = make,
cnames = toupper(colnames(mtcars)),
markup = "markdown")
Run the code above in your browser using DataLab