export2word.Rd
This function creates automatically a Word file with the table.
export2word(x, file, which.table="descr", nmax=TRUE, header.labels=c(),
caption=NULL, strip=FALSE, first.strip=FALSE, background="#D2D2D2",
size=NULL, header.background=NULL, header.color=NULL)
an object of class 'createTable' or that inherits it.
character specifying the word file (.doc or .docx) resulting after compiling the Markdown code corresponding to the table specified in the 'x' argument.
character indicating which table is printed. Possible values are 'descr' or 'avail'(partial matching allowed), exporting descriptives by groups table or availability data table, respectively. Default value is 'descr'.
logical, indicating whether to show the number of subjects with at least one valid value across all row-variables. Default value is TRUE.
see the 'header.labels' argument from createTable
.
character specifying the table caption for descriptives and available data table. If which.table='both' the first element of 'caption' will be assigned to descriptives table and the second to available data table. If it is set to "", no caption is inserted. Default value is NULL, which writes 'Summary descriptives table by groups of 'y'' for descriptives table and 'Available data by groups of 'y'' for the available data table.
logical. It shadows table lines corresponding to each variable.
logical. It determines whether to shadow the first variable (TRUE) or the second (FALSE). It only applies when strip
argument is true.
color code in HEX format for shadowed lines. You can use rgb
function to convert red, green and blue to HEX code. Default color is '#D2D2D2'.
numeric. Size of descriptive table. Default value is NULL which creates the table in default size.
color character for table header or 'NULL'. Default value is 'NULL'.
color character for table header text. Default color is 'NULL'.
Word file is created after compiling Markdown code created by export2md
. To compile it it calls render
function which requires pandoc to be installed.
if (FALSE) {
require(compareGroups)
data(regicor)
# example on an ordinary table
res <- createTable(compareGroups(year ~ . -id, regicor), hide = c(sex=1), hide.no = 'no')
export2word(res, file = tempfile(fileext=".docx"))
}