Learn R Programming

compareGroups (version 3.3)

export2pdf: Exports tables to PDF files.

Description

This function creates automatically a PDF with the table. Also, the LaTeX code is stored in the specified file.

Usage

export2pdf(x, file, compile = TRUE, openfile = TRUE, margin = c(2,2,1,1), ...)

Arguments

x

an object of class 'createTable' or that inherits it.

file

character specifying the PDF file resulting after compiling the LaTeX code corresponding to the table specified in the 'x' argument. LaTeX code is also stored in the same folder with the same name but .tex extension. When 'compile' argument is FALSE, only .tex file is saved.

compile

logical indicating whether tex file is compiled using texi2pdf function. Default value is TRUE.

openfile

logical indicating whether to open the compiled pdf file or not. It uses the sys function and does not apply when 'compile' argument is FALSE. Default value is TRUE.

margin

an integer vector specifying the margins in cm. Its components refer to 'top', 'bottom', 'left' and 'right' sides. Default values are 2, 2, 1 and 1, respectively.

Arguments passed to export2latex.

See Also

createTable, export2latex, export2csv, export2html, export2md, export2word

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
require(compareGroups)
data(regicor)

 # example on an ordinary table
res <- createTable(compareGroups(year ~ . -id, regicor), hide = c(sex=1), hide.no = 'no')
export2pdf(res, "table.pdf", size="small")

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab