latextable {miscFuncs} | R Documentation |
latextable function
Description
A very useful function to create a LaTeX table from a matrix. Rounds numeric entries and also replaces small numbers with standard index form equivalents.
Usage
latextable(
x,
digits = 3,
scientific = -3,
colnames = NULL,
rownames = NULL,
caption = NULL,
narep = " ",
laststr = "",
intable = TRUE,
manualalign = NULL,
file = "",
...
)
Arguments
x |
a matrix, or object that can be coerced to a matrix. x can include mixed character and numeric entries. |
digits |
see help file for format |
scientific |
see help file for format |
colnames |
optional column names set to NULL (default) to automatically use column names of x. NOTE! if rownames is not NULL present, colnames must include an entry for the rownames i.e. it should be a vector of length the number of columns of x plus 1. |
rownames |
optional row names set to NULL (default) to automatically use row names of x |
caption |
optional caption, not normally used |
narep |
string giving replacement for NA entries in the matrix |
laststr |
string to write at end, eg note the double backslash!! |
intable |
output in a table environment? |
manualalign |
manual align string e.g. 'ccc' or 'l|ccc' |
file |
connection to write to, default is ” which writes to the console; see ?write for further details |
... |
additional arguments passed to format |
Details
To get a backslash to appear, use a double backslash
Just copy and paste the results into your LaTeX document.
Value
prints the LaTeX table to screen, so it can be copied into reports
Examples
latextable(as.data.frame(matrix(1:4,2,2)))