writeTabular | R Documentation |
This is a simple function to create tabular environment in LaTeX
writeTabular(
table,
file = NULL,
format = "g",
bold = NULL,
italic = NULL,
mark = NULL,
mark.char = "*",
na.as = "n/a",
align = "l",
hrule = NULL,
vrule = NULL,
bty = c("t", "b", "l", "r"),
print.col.names = TRUE,
print.row.names = TRUE,
digits = 3,
wrap.as.table = FALSE,
table.position = "h",
caption = NULL,
caption.position = "b",
centering = FALSE,
label = NULL
)
table |
A data frame with the information to write |
file |
Path of a file. If provided, the tabular is wirten in the given file. Otherwise, it is writen to the standard output |
format |
Format for the numeric values. The accepted formats are those in the function |
bold |
A matrix that matches |
italic |
A matrix that matches |
mark |
A matrix that matches |
mark.char |
Character to be used to mark cells. Note that the superscript is included in a math environment, so this has to be either a character or a valid math command in LaTeX |
na.as |
Character to be used to write NA values in the table |
align |
Character indicating the alignment of the colums ( |
hrule |
A vector of positions for the horizontal lines in the tabular. All the lines are drawn after the indicated line. When the column names are included, 0 means drawing a line after the column names. The maximum value is the number of rows - 1 (for a line after the last line see parametr |
vrule |
Similar to |
bty |
Vector indicating which borders should be printed. The vector can contain any of subset of |
print.col.names |
Logical value indicating whether the column names have to be printed or not |
print.row.names |
Logical value indicating whether the row names have to be printed or not |
digits |
A single number or a numeric vector with the number of digits in each column. Its size has to match the number of the final table, i.e., the colums in |
wrap.as.table |
Logical value indicating whether the latex object has to be wrapped into a table enviroment |
table.position |
Character indicating the position of the table ( |
caption |
Character string containing the caption of the table. If NULL, no caption is printed |
caption.position |
Character indicating the possition of the caption ( |
centering |
Logical value indicating whether the table should be centered in the page |
label |
Character string containing the label of the table for further references. If NULL, no label is used |
LaTeX code to print the table
summarizeData
, filterData
and the vignette vignette(topic="Data_loading_and_manipulation",
package="scmamp")
data(data_blum_2015)
args <- list()
# Write the summarization of the data
args$table <- summarizeData(data.blum.2015, group.by=1:2)
# Set in bold the maximum values per row
bold <- apply(args$table[, -(1:2)], MARGIN=1,
FUN=function(x) {
return(x==max(x))
})
args$bold <- cbind(FALSE, FALSE, t(bold))
# Fixed width, 2 decimals for the values, 0 for the size and 3 for the radius
args$format <- "f"
args$digits <- c(0,3,rep(2, 8))
# Print the colum names but not the row names
args$print.row.names <- FALSE
# Only top and bottom borders
args$bty <- c("t","b")
# Add additional horizontal rules to separate the sizes
args$hrule <- c(0,10,20,30)
# An additional vertical rule to separate size and radius from the results
args$vrule <- 2
# Print the table
do.call(writeTabular, args)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.