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
3
votes
1 answer

How to print xtable without hlines

assume I have a simply xtable, made as follows: library(xtable) x <- as.data.frame(matrix(1:9,3,3)) x <- xtable(x) How can I print this table with only the columns (i.e. '&'s), but not anything around? I do not want hlines…
User878239
  • 649
  • 1
  • 7
  • 14
3
votes
2 answers

Double line in xtable

I am printing a LaTeX table in R with xtable. I would like to insert a double line (\\[-1.8ex]\hline \hline \\[-1.8ex]) instead of the first line (simple \hlineor \topline). How could I do it automatically? Example: table <-…
MCS
  • 1,071
  • 9
  • 23
3
votes
1 answer

Displaying \checkmark in latex table

In an old .Rnw file I was using the RODBC package to read an excel sheet and display a latex table containing checkmarks. Recently, I tried to change the way I used to read the excel file, and use the XLConnect package instead of RODBC, but I came…
gd047
  • 29,749
  • 18
  • 107
  • 146
3
votes
1 answer

Knitr HTML output formatting issues

My plots and most tables knit to HTML fine, but certain tables with "subcategories" have formatting issues that show HTML code instead of processed tables. The top table is what I want but the bottom table is not formatted correctly. Here is the…
Hank Lin
  • 5,959
  • 2
  • 10
  • 17
3
votes
0 answers

Any Lib or help to create the crosstab?

I am trying to develop a simple crosstab application using postgreSQL and .netcore. I need suggestion to get if any lib exists to provide the basic crosstab functions. May be a method where I will pass Rows, Columns and it will retun the response…
3
votes
1 answer

xtable for conditional cell formatting not with special characters

I'm apply solution from xtable for conditional cell formatting significant p-values of table to my data set; however, I can't use sanitize.text.function = function(x) x as per the suggested answer. Example Data set The data set contains text…
Konrad
  • 17,740
  • 16
  • 106
  • 167
3
votes
1 answer

Labels in xtable captions for crossreferencing in lyx

I am using pgfsweave with Lyx 1.6.8 and xtable. providing table captions by <>= print(xtable(,caption="Here is my caption")) @. How can I insert a label into the table caption that I can crossreference in the text from the…
3
votes
1 answer

xtable in Sweave: specify toprule or midrule in a table + alignement

I am producing an automatic report using Sweave in R. I would like: In position (nrow -1) I would like to have a toprule instead of a midrule Align the first row as being centered and then I would like to align number to the right in order to…
richpiana
  • 411
  • 1
  • 7
  • 16
3
votes
0 answers

Make xtable/pandoc.table fit to page size OR adjust cell height to text length

I am trying to create a publication quality table, that describes the variables I have used in the analysis. Thus the table has two columns and say 20 rows. The first column is short as it contains the variable name and the second column is rather…
3
votes
0 answers

Creating multilevel table for LaTeX in R

I have a factor survey data like: > sex <- sample(c('M','F'), 10, replace=T) > income <- sample(c('< 10,000','10,000-50,000','> 50,000'), 10, replace=T) > location <- sample(c('Chicago','New York','Los Angeles'), 10, replace=T) > > d <-…
Jeremy
  • 1,960
  • 4
  • 21
  • 42
3
votes
1 answer

How to add cellspacing and cellpadding in HTML tables generated by xtable?

I would like to add spacing or padding to a html table generated by xtable. The print.xtable() parameter html.table.attributes doesn't work for me. Here an example chunk that can be pasted in a Rmd document. ```{r…
Paul Rougieux
  • 10,289
  • 4
  • 68
  • 110
3
votes
1 answer

R: rendering xtable

I have an .Rmd file containing: ```{r, echo=FALSE, message=FALSE, results='asis'} library(xtable) print(xtable(groupGrundALL)) ``` Using the "Knit Word" button in RStudio it creates and opens a Word file, but only shows the following text line…
Andi Erni
  • 563
  • 7
  • 16
3
votes
1 answer

Boldify the contents of bottom row in xtable

How can I bold the contents of the last row of xtable?. The bottom row contains sums and I would like it boldified. I use the following: <>= test.xt <- xtable(test,…
gd047
  • 29,749
  • 18
  • 107
  • 146
3
votes
1 answer

How to only show table caption once in "list of table" for a table split onto multiple pages

I am using R packages (xtable and knitr) and Latex packages (longtable and hyperref) to prepare a document. One of my tables is very long and splits onto multiple pages. It turned out that the "List of Table" shows every page number at which this…
Yaming
  • 97
  • 6
3
votes
1 answer

How to set spaces in the column names of a table or data frame using xtable

So I want to use spaces among words in the names of the columns of a data frame and print the data frame to a pdf in latex format. However, when I use xtable() to do this, the names of the columns get joined. For example, I'd want the title of the…
intael
  • 508
  • 2
  • 7
  • 21