pxtable | R Documentation |
This function adds to the print function of the xtable
package by providing predefined add.to.row
code for the longtable
LaTeX package: 'continued on/from ...' and 'end of table' lines that can switched on or off. This functionality can only be used with the longtable
environment. When scalebox
is specified the tabular
environment is used and add.to.row
code is not available. If the longtable
package is not available then set scalebox=1
or another appropriate value.
pxtable(
df,
tablabel = "",
tabcap = "",
adef = "l",
ap = c(),
av = c(),
ddef = 0,
dp = c(),
dv = c(),
tco = T,
tcf = tco,
te = F,
newpage = F,
scalebox = NULL,
include.colnames = T,
colnames = NA,
rotate.colnames = T,
include.rownames = F,
sanitize.colnames.function = xtable::sanitize,
booktabs = F,
...
)
df |
data.frame that will be printed. |
tablabel |
Character string that can be used to reference the table as |
tabcap |
Character string that is as caption for the table. Default: ” |
adef |
Character string with the default alignment. Default: "l" |
ap |
Integer vector with the positions of the columns for which an alignment specification is given in |
av |
Character vector with aligment specifications for the positions in |
ddef |
Integer with the default number of digits to display. Default: 0 |
dp |
Integer vector with the positions of the columns for which an digit specification is given in |
dv |
Integer vector with digit specifications for the positions in |
tco |
Boolean indicating if 'continued on' should be displayed at the bottom of a page(only) when using the |
tcf |
Boolean indicating if 'continued from' should be displayed at the top of a page(only) when using the |
te |
Boolean indicating if 'end of table' should be displayed at the end of the table (only) when using the |
newpage |
Boolean indicating if the table should start on a new page. Default: F |
scalebox |
Positive number for scaling the table. Forces the |
include.colnames |
Boolean indicating if column names will be printed. See |
colnames |
Character vector with column headers to use instead of field names. Default: NA |
rotate.colnames |
Boolean indicating if column names will be printed vertically. See |
include.rownames |
Boolean indicating if row names will be printed. See |
sanitize.colnames.function |
Function used for nicer printing of column names. See |
booktabs |
Boolean indicating if LaTeX package |
... |
Additional arguments that are passed to |
See xtable::print.xtable
as this function prepares only its function arguments. Using this function in a knitr
chunk with results ='markup'
will show the generated LaTeX text. With results ='asis'
the text is transfered to the intermediate output file and interpreted as LaTeX in the final pdf document.
## Not run:
df1 = data.frame(
v1 = rep(c(1,NA),50),
v2 = rep(c('R version 3.5.0', 'R is free software'),50),
v3 = rep(c('Copyright (C) 2019', 'You are welcome'),50),
v4 = rep(c('a','b'),50),
v5 = rep(c(pi,NA),50),
stringsAsFactors = F
)
pxtable (df1,tablabel='tab1',tabcap='mycaption',
ap = 1:4, av = c("r", "p{6cm}", "p{6cm}", "c"), adef = "l",
dp = c(1, 5), dv = c(2, 3), ddef = 0, te = F,
include.rownames = T,
rotate.rownames = T # example of an argument that will be passed to xtable::print.xtable
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.