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

unable to get the right tex output from xtable R package

I have been unable to get a correct tex output with xtable R package: This is the R code in the chunk of a knitr document attr(p_val_table_list, "subheadings") <- paste0("Hemisphere : ",c("Left","Right")) xtablelist <-…
0
votes
1 answer

r xtable and table of frequencies, printing rowwise

xtable doesn't know at the moment how to print tables of frequencies from base::table. What I do now is I convert it to a dataframe and then I change the headings using colnames as needed: dset <- data.frame(rpois(100, 1)) dset.print <-…
green diod
  • 1,399
  • 3
  • 14
  • 29
0
votes
2 answers

xtable align right and set width Rmarkdown

I have a dataframe that I want to turn into a table with right alignment in Rmarkdown --- title: "Test" output: pdf_document --- ```{r testing, results='asis'} library(xtable) df <- structure(list(ID = c(101L, 102L, 103L, 104L, 105L, 106L), …
pluke
  • 3,832
  • 5
  • 45
  • 68
0
votes
1 answer

xtable same headers for a long narrow table break in two

I,m new to R and LATEX(sorry for the spelling, but I don't know how to generate the classic version of latex here on OS). Anyway, here is my question. I have a little bit long but narrow table, so I want to break them in two and make them look like…
Jia Gao
  • 1,172
  • 3
  • 13
  • 26
0
votes
0 answers

print(xtable(myTable) does not print the expected output in the console

I am trying to use R to convert some excel spreadsheet in Latex table to be used in publications. I was following the vignette by Jonathan Swinton (see link below) The xtable Gallery In pag 10. show this: example code in the vignette However when…
ALejandro
  • 45
  • 3
0
votes
1 answer

Xtable grey rows overwritting vertical lines

--- title: "Title" author: '' date: '' output: pdf_document: template: default.tex geometry: top=0.5cm, bottom=0.5cm, left=0.5cm, right=0.5cm header-includes: null fontsize: 4pt classoption: portrait sansfont: Calibri Light --- #Name1: `r…
Anon.user111
  • 468
  • 1
  • 5
  • 16
0
votes
1 answer

How do you get dates to show up in a date format when working with a Shiny Table?

I'm stuck trying to get dates to show up in a Shiny table. I have done some research and see that in the past xtable does not work nicely with Shiny. There are a couple of questions on SO that dealt with this issue. The one routinely reference can…
Scott Hunter
  • 254
  • 2
  • 14
0
votes
1 answer

Include a CSV containing math symbols within a knitr xtable

Im trying to generate an xtable of a .csv file within a knitr document. The csv file contains cells which have several math symbols such as '±'.I do not know how to tell xtable to include that math symbol within the knitr document. Thus far i have…
kribby
  • 45
  • 7
0
votes
0 answers

Control multiple column header formatting parameters xtable

I have this example below where I create a basic data frame then output it to PDF through LaTeX using knitr. I am controlling some of the basic formatting and have used the function bold to bold the column headers and have redefined my column names…
Prevost
  • 677
  • 5
  • 20
0
votes
1 answer

Aligning XTable Output in R Markdown

I am putting an assignment together in R Markdown to PDF (through Latex) and been using xtable to nicely format my output. The below code generates a small table that I would like to align right in the document and have text wrap around it. Is there…
Syzorr
  • 587
  • 1
  • 5
  • 17
0
votes
0 answers

Sweave xtable too big

Currently I have the following code: <>= xtab<-xtable(Flag) align( xtab ) <- "|c|c|c|c|c|" print(xtab) @ However, when I run this and it creates a pdf the table extends off of the page--like this. How do I change it so it…
Amanda R.
  • 287
  • 1
  • 2
  • 17
0
votes
0 answers

How to make a xtable readable?

I would like to get a table formatted like this: I have used "xtable" but I don´t understand how to get it from the print(table) command: > test % latex table generated in R 3.2.3 by xtable 1.8-0 package % \begin{tabular}{lrrrrr} \hline & Df &…
Luisa
  • 35
  • 2
  • 12
0
votes
1 answer

Output TukeyHSD or model.tables output as tables using xtable

I'm dealing with ANOVA tables which I am outputting in my R Markdown using xtable and outputting to PDF. However, when I'm using functions like TukeyHSD or model.tables to do comparative analysis, xtable is giving me the error (in the case of…
Syzorr
  • 587
  • 1
  • 5
  • 17
0
votes
1 answer

R, Latex and RMarkdown: table() input for xtable() missing column and row labels?

I am trying to create a pretty LaTeX table where the names of the row and column variables of a table are included when using the xtable library. MWE: ```{r results="asis"} test <- data.frame(Apples=c(1,2,3), Oranges=c(4,5,6),…
user2205916
  • 3,196
  • 11
  • 54
  • 82
0
votes
2 answers

Rendering xtable with significant digits

I'd like to be able to render an xtable in an automatically run piece of code, i.e. NOT via copy-and-paste, while controlling the number of significant digits. The only way that I know to render an xtable on a standard plot device is by using…
rimorob
  • 624
  • 1
  • 5
  • 16