Questions tagged [xtable]

A function of an R package of the same name, used to convert an R object into an object that may be printed as a LaTeX or HTML table.

This function extracts tabular information from x and returns an object of class "xtable". The nature of the table generated depends on the class of x. For example, aov objects produce ANOVA tables while data.frame objects produce a table of the entire data.frame. One can optionally provide a caption (called a title in HTML) or label (called an anchor in HTML), as well as formatting specifications. Default values for align, digits, and display are class dependent.

The available method functions for xtable are given by methods(xtable). Users can extend the list of available classes by writing methods for the generic function xtable. These methods functions should have x as their first argument with additional arguments to specify caption, label, align, digits, and display. Optionally, other arguments may be present to specify how the object x should be manipulated. All method functions should return an object whose class if given by c("xtable","data.frame"). The resulting object can have attributes caption and label, but must have attributes align, digits, and display. It is strongly recommended that you set these attributes through the provided replacement functions as they perform validity checks.

The xtable package is a creation of David Dahl with contributions and suggestions from many others.

396 questions
2
votes
1 answer

Merge several confusion matrix with xtable

I have trained several models and want to summarise their performance with three confusion matrix. What I want to do is to combine three different confusion matrix into one table using xtable. I want to combine table 1, 2 and 3. See an example…
ecl
  • 369
  • 1
  • 15
2
votes
1 answer

Sanitize latex commands and special symbol together

We want to process many paragraphs of text from R automatically into LaTex. Those paragraphs originally are stored in entries in an excel file. We read it and want to port each entry into LaTex. But in those paragraphs, we have special symbols like…
Sikun
  • 23
  • 3
2
votes
1 answer

Tables not knitting and printing out within Rmd notebook?

I am trying to preview a table within my Rmd notebook without knitting the whole document. When I call: xtable(anthro_table_f) I get: % latex table generated in R 3.5.1 by xtable 1.8-3 package % Sun Sep 16 16:10:36…
Hank Lin
  • 5,959
  • 2
  • 10
  • 17
2
votes
1 answer

R - have xtable interpret HTML tags within strings as HTML tags rather than literals

Assuming I don't want to or cannot modify the stylesheet or the HTML internally, how can I make xtable interpret a section of a string in R as a html tag rather than a literal? For example, I have: df <- as.data.frame(c("Foo", "Bar", "Box"),…
R. Rengold
  • 193
  • 13
2
votes
0 answers

Generating a Table of Tables with R Markdown

In part of an assignment, I am outputting 14 tables (expected to use a particular package to generate them rather than just table) and they are all relatively small. It'd be nice to output them in 3 columns, for example, but can't find anything that…
Syzorr
  • 587
  • 1
  • 5
  • 17
2
votes
2 answers

Summary table (using tables or xtable package) with counts at 3 level of depth

I am using the tabular function from tables package to get a summary table of the "df" dataframe. I need to get an output that can be processed to get a Latex table with multirow-cells capability. Here below is the dummy "df" dataframe: age <- c(62,…
Syl33
  • 97
  • 5
2
votes
0 answers

Change font size caption or title in xtable in markdown

I want to change the font size for my title/caption in the table made using xtable. The following code changes the size of the text in the table, but not the caption/title. Tab <- xtable::xtable(myTable, caption="\\tt Title") print(Tab,…
milan
  • 4,782
  • 2
  • 21
  • 39
2
votes
1 answer

How to use stargazer/xtable with pggls objects from the plm package?

I'm trying to convert the output of some regression to latex with xtable or stargazer. I never had issues before, and the results of multiple regressions are organized neatly in a latex table. I'm using Fixed Effects FGLS. Therefore, I'm using the…
Mario GS
  • 859
  • 8
  • 22
2
votes
2 answers

How to put a spacing of colors in a table of xtable?

How to put a spacing of colors in a table of xtable? I generate the tables with the following instructions: test.table<-xtable(summary(test),caption='test', floating = FALSE) align(test.table) <-…
Ricardo Rod
  • 8,453
  • 9
  • 27
  • 39
2
votes
1 answer

How to add a check mark to a xtable in an Rmd. file used to create a pdf

I know I am being very picky here, but I am making a table using the following code using knitr in r markdown: --- title: "Test table" author: "Derek Corcoran" date: "February 20, 2017" output: pdf_document --- ```{r setup,…
Derek Corcoran
  • 3,930
  • 2
  • 25
  • 54
2
votes
0 answers

xtable with latex math symbols in the table

I'm trying to write this table with checkboxes using the xtable package. It would seem that the checkboxes that I've chosen are what is throwing the error. I'm just at a loss how to fix it. library(xtable) ## I want to create a table with the…
wolfste4
  • 39
  • 7
2
votes
1 answer

More than three xtables on a page in knitr

I am trying to place more than three tables on one page of a pdf using knitr and xtable. The following code places the fourth table on the second page. If they are size appropriate, is there a way to include all of the tables on one page? The…
2
votes
0 answers

Summary of each column of data.table or data.frame for xtable

I want to use summary of each column of a data.table or data.frame to be used for sweave with xtable package. Here is MWE. summary(iris) Sepal.Length Sepal.Width Petal.Length Petal.Width Species Min. :4.300 Min. :2.000 …
MYaseen208
  • 22,666
  • 37
  • 165
  • 309
2
votes
1 answer

xtable with various column types

I am trying to use xtable on my table with various column types including numbers, latex commands and string. Example: a1 <- paste("\\multirow{2}{*}{", c(1, 2, 3, 4),"}", sep = "") a2 <- rep(NA, 4) riffle <- function (a,b) { n <- min(length(a),…
Adela
  • 1,757
  • 19
  • 37
2
votes
1 answer

xtable and knitr: How to center table on full page width?

(This question does not solve this because that was about centering within linewidth. I'm interested in the full page width.) I'm producing a table like this: \documentclass{article} \begin{document} <
L42
  • 3,052
  • 4
  • 28
  • 49