This function takes the result of createTable
and exports the tables to LaTeX format.
export2latex(x, ...)
# S3 method for createTable
export2latex(x, file, which.table = 'descr', size = 'same',
nmax = TRUE, header.labels = c(), caption = NULL, loc.caption = 'top', label = NULL,
landscape = NA, colmax = 10, ...)
# S3 method for cbind.createTable
export2latex(x, file, which.table = 'descr', size = 'same',
nmax = TRUE, header.labels = c(), caption = NULL, loc.caption = 'top', label = NULL,
landscape = NA, colmax = 10, ...)
an object of class 'createTable'.
Name of file where the resulting code should be saved. If file is missing, output is displayed on screen. Also, another file with the extension '_appendix' is written with the available data table.
character indicating which table is exported. Possible values are 'descr', 'avail' or 'both' (partial matching allowed), exporting descriptives by groups table, availability data table or both tables, respectively. Default value is 'descr'.
character indicating the size of the table elements. Possible values are: 'tiny', 'scriptsize', 'footnotesize', 'small', 'normalsize', 'large', 'Large', 'LARGE','huge', 'Huge' or 'same' (partial matching allowed). Default value is 'same' which means that font size of the table is the same as specified in the main LaTeX document.
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.
character specifying the table label for descriptives and available data table. This may be useful to cite the tables elsewhere in the LaTeX document. If which.table='both' the first element of 'label' will be assigned to descriptives table and the second to available data table. Default value is NULL, which assigns no label to the table/s.
character specifying the table caption location. Possible values are 'top' or 'bottom' (partial matching allowed). Default value is 'top'.
logical indicating whether the table must be placed in landscape, or NA that places the table in landscape when there are more than 'colmax' columns. Default value is NA.
integer indicating the maximum number of columns to make the table not to be placed in landscape. This argument is only applied when 'landscape' argument is NA. Default value is 10.
currently ignored.
List of two possible components corresponding to the code of 'descr' table and 'avail' table. Each component of the list is a character corresponding to the LaTeX code of these tables which can be helpful for post-processing.
createTable
, export2csv
, export2html
, export2pdf
, export2md
, export2word
# NOT RUN {
# }
# NOT RUN {
require(compareGroups)
data(regicor)
res <- compareGroups(sex ~. -id-todeath-death-tocv-cv, regicor)
export2latex(createTable(res, hide.no = 'n'), file=tempfile(fileext=".tex"))
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab