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
0 answers

xtable parsing conditional symbols

I'd like to load a table and print it by using xtable library. Unfortunately this table has some conditions on the first column that are not parsed corrctely. and some "$" appear on it here's the…
Stefano
  • 361
  • 1
  • 4
  • 21
0
votes
1 answer

Newline in tableOutput for Shiny

I have a dataframe of the following form: myDf <- data.frame(doc = c(1, 2, 3), text = c("Statement 1: ok
Statement 2: not ok", "Statement 1: true\n Statement 2: false", "Statement 1: yes Statement 2: no")) Which I would like to render as the…
info_seekeR
  • 1,296
  • 1
  • 15
  • 33
0
votes
0 answers

xTable Error inspite of object in memory

Created a Data Frame ofp.1 which contains 13 rows and 2 columns using normal R file. The Data Frame is present in memory . Now I want to use this table in xtable to print in R Markdown file. `--- title: "abc" output: html_document ---
Mukesh Kumar Singh
  • 623
  • 1
  • 10
  • 18
0
votes
1 answer

How do I remove HTML tags inside an xtable when using knitr?

When I test an xtable using the following code to print to a separate HTML document, it works fine. print(MyXtable, type = "html", file = "test.html", sanitize.text.function = force) However, when I try to print that same xtable in an R chunk in…
torenunez
  • 120
  • 1
  • 8
0
votes
0 answers

How to make publishable tables and plots using R?

Suppose I want a table that looks something like this: https://tex.stackexchange.com/questions/265764/a-booktabs-question-how-to-get-rid-of-the-blank-column And I have all the numbers from R results. What I can do now is use booktabs in latex to…
Chubing
  • 187
  • 1
  • 3
  • 10
0
votes
2 answers

Change variable name in xtable

I want to change the name of the variable I'm tabulating using xtable() in Sweave. I suppose that it's trivial, but I can't find out how to do it. Here's an example: I want to edit "conv" (it is the name of the variable I'm tabulating) and write…
intael
  • 508
  • 2
  • 7
  • 21
0
votes
1 answer

How to center LaTeX xtable (And Figure) output in full text width

This is a follow-up to a question I posted earlier (How to center LaTeX xtable output in full text width). I realize that my MWE from this previous post was incomplete. In an effort to make it as minimal of an example as possible, I did leave out…
user1830307
0
votes
1 answer

R xtable: Wrap overflowing columns into subtables

This question is related to the one here, but I feel that the solutions provided there don't answer the question. Split xtable ouput into sub tables My question is nearly the same. In R, I have the following aggregated data table: > agg2 …
Nick Ruiz
  • 1,405
  • 4
  • 18
  • 28
0
votes
1 answer

Unexpected xtable output (in html) when formatting numbers

In the following code, when I enable the prettyNum(formatC... command, I get the strange output that you see in the picture. The code worked OK with R 3.1.1. There is no problem when output format is pdf. --- title: "Untitled" output:…
gd047
  • 29,749
  • 18
  • 107
  • 146
0
votes
2 answers

Cross tabulation with n>2 categories in R: hide rows with zero cases

I'm trying to make a cross tabulation in R, and having its output resemble as much as possible what I'd get in an Excel pivot table. So, given this code: set.seed(2) df<-data.frame("ministry"=paste("ministry…
s_a
  • 885
  • 3
  • 9
  • 22
0
votes
1 answer

Controlling output while printing data.table with xtable

Here is a data.table with lots of records / rows: dt <- data.table(a=sample(letters,1000,replace = T), b=rnorm(1000)) We can view it using simply: dt ... and a very convenient view is generated with first and last 5 rows. However, when using…
Shambho
  • 3,250
  • 1
  • 24
  • 37
0
votes
1 answer

How to print symbols with parenthesis in latex using xtable and Sweave

I am trying to generate a tex table using xtable. In R, the table contains: >tvPre p\\_1 p\\_2 p\\_3 FV "\\textuparrow M" "" "\\textuparrow R" a "\\textuparrow WH" ""…
0
votes
1 answer

Each xtable produced in R-loops should have \begin{table}..\end{table} environment in Sweave

I try to write an R-function which produces xtables in a loop. Later I want to call my function in a Sweave document- but a single chunk can't support multiple tables. I would have to put each table in a single chunk and wrap it with the Latex Code…
Novice
  • 307
  • 2
  • 11
0
votes
1 answer

Create a table from a couple of summary statistics

I'm using R Studio Version 0.98.1062 on Mac(OS X Yosemite 10.10.1). I want to create a table (preferably to transfer it to excel or pdf format) from the data for several summary statistics describing the proportion of women enrolled in different…
Nanna
  • 11
  • 1
  • 2
0
votes
1 answer

Label to reference to a table generated by xtable in lyx

In order to be able to use a label tab:my_title, I would like to place a table generated by xtable in a Lyx table float, but I cannot get a table to be generated inside the float. This chunk produces correct output in Lyx: <
Paul Rougieux
  • 10,289
  • 4
  • 68
  • 110