This function creates a latex table
Arguments
- data
data frame for which the table should be created
- ret
a character vector to define what kind of output should be returned (either "dfrm", "tbl", "file")
- capt
character with the caption of the table
- align
alignment of the table passed to R3port::ltx_list or xtable::print.xtable (see details below)
- outnm
character with the name of the tex file to generate and compile, e.g. "define.tex" (only applicable in case file is returned)
- tabenv
character with the tabular environment passed to xtable::print.xtable
- float
logical defining float passed to xtable::print.xtable
- hlineafter
a vector indicating the rows after which a horizontal line should appear passed to xtable::print.xtable
- addtorow
A list containing the position of rows and commands passed to xtable::print.xtable
- ...
additional arguments passed to either R3port::ltx_list or xtable::print.xtable depending on what is returned
Details
This function is a general function to create a xtable suitable for documentation, or directly creates an compiles a
latex file using the R3port package. The align argument can be used to change the column widths of a table to be able to fit a table
on a page (e.g. in latex wide tables can fall off a page). The way this should be used is to provide a vector of one with
a specification for each column. For example lp{3cm}r can be used for left align first column, second column of 3 cm
and third column right aligned. In case align is set to NULL a default alignment is used
Examples
general_tbl(head(Theoph))
#> \begin{longtable}{lrrrr}
#> \caption{General table} \\
#> \toprule Subject & Wt & Dose & Time & conc \\
#> \midrule\endhead 1 & 79.60 & 4.02 & 0.00 & 0.74 \\
#> 1 & 79.60 & 4.02 & 0.25 & 2.84 \\
#> 1 & 79.60 & 4.02 & 0.57 & 6.57 \\
#> 1 & 79.60 & 4.02 & 1.12 & 10.50 \\
#> 1 & 79.60 & 4.02 & 2.02 & 9.66 \\
#> 1 & 79.60 & 4.02 & 3.82 & 8.58 \\
#> \hline
#> \end{longtable}
