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 not hiding rownames or hline after align

I am new to xtable and R in general. I have a pdf document that I want to include a table with specified column widths. I tried playing with some formatting by reading what I can find online. However, I am unable to remove the rownames and hline…
Larry Li
  • 73
  • 6
0
votes
0 answers

Is it possible to remove horizontal borders from xtable?

I have a bit of code from a shinyapp that determines what will be exported to a pdf document: special_ortho_table <- reactive({ if(input$ortho == "yes"){ sp_ortho_table <- drugsUI %>% filter(Ortho == "yes", Special_ortho == TRUE)…
Larry Li
  • 73
  • 6
0
votes
0 answers

R - How to use xtable to print a table() and keeping the row and column margin titles?

I need to generate many small tables from pairs of vectors like this: library(xtable) input1 <- c(0,0,0,1,1,1,1,2,2,2,2) input2 <- c(0,0,0,0,0,1,0,0,0,1,2) result <- table(input1, input2) xtable(result) The console output is OK. result …
skan
  • 7,423
  • 14
  • 59
  • 96
0
votes
1 answer

Save multiple tables in same .tex-file using xtable

Lets say I have six matrices of size 50*5 stored in an array, e.g., my.array<-array(1:1500, dim=c(50,5,6)) and want to save these as multiple tables in the same .tex-file. i.e., I want the final result to be a tex-file with six separate latex…
Tordir
  • 191
  • 6
0
votes
0 answers

creating frequency table in R

I have extracted some summary statistics from R: group_by(starters, starters$Programme, starters$Gender ) %>% summarise( count = n(), # mean = mean(Total_testscore, na.rm = TRUE), # sd = sd(Total_testscore, na.rm = TRUE), …
user1607
  • 531
  • 7
  • 28
0
votes
0 answers

print summary from dominanceAnalysis to latex in R

I have conduceted dominance analysis: library(dominanceanalysis) lm.attitude<-lm(rating~.,attitude) da.attitude<-dominanceAnalysis(lm.attitude) summary(da.attitude) how can i print this results to latex? something like this (ignore…
user1607
  • 531
  • 7
  • 28
0
votes
1 answer

Multiple dataframes to multiple html tables but all displayed one after the other

I have three dataframes and I want to convert each one to its own html and then display them one of top of the other, each with their own captions. I am using xtable and htmlTable to create a single table, but I can't figure out how to join them…
uncian
  • 25
  • 3
0
votes
1 answer

Tidyverse version of nested for loops

I am wondering if there is a tidyverse implementation of the nested for loop. I am trying to "walk" along the elements of two nested lists and print out formatted tables. library(xtable) for (i in 1:9) { for (j in 1:7) { result <-…
Hank Lin
  • 5,959
  • 2
  • 10
  • 17
0
votes
0 answers

(R) Summary Xtable is producing LaTex code?

I'm trying to produce a summary of a logistic regression Analysis of Deviance table, but the result is a block of what I think is LaTex. Here is my code: m1 <- glm(vote ~ factor(income), data = nes1992, family =…
samvoit4
  • 295
  • 2
  • 8
0
votes
1 answer

Exporting xtable to a pdf file

Hello all I am new to R and Latex and have been stuck on creating a PDF with the xtable function. The code runs fine and the table is generated in the console however I can not figure out how to save just the table as a pdf. Do I need to link R…
0
votes
1 answer

Putting Italics into an xtable caption

I am working on a project in R-markdown. I have been trying to get the 'n' to italicize but I keep getting error messages. Listed below is my latest attempt. ```{r, echo=FALSE, message=FALSE, warning=FALSE, results="asis"}…
asokol
  • 119
  • 1
  • 16
0
votes
1 answer

xtable output doesn't look like a table

I'd like to use the xtable package to make a neat table for a report. Using the code on pg 7 of http://users.stat.umn.edu/~geyer/Sweave/foo.pdf, I get some output but it doesn't look anything like the table they get. This is what I get: % latex…
LLL
  • 723
  • 1
  • 9
  • 27
0
votes
0 answers

Converting regression table to LaTeX format in R

According to this there is a package called biostatUZH that contains the function tableRegression which enables to print the outputs of all kind of regression models in LaTeX format. However, where do the the p-value for the results from…
user1607
  • 531
  • 7
  • 28
0
votes
2 answers

Placing table next to plot in R Markdown (to pdf / latex)

Is it possible to place a table generated with the xtable (or alternatively the pander) package and a generated plot side-by-side in R markdown knitting to pdf while the rest of the document is not in columns? The following simple example hopefully…
D.Wies
  • 53
  • 5
0
votes
0 answers

xtable kable html output in console

I am trying to produce some tables using xtable and kable. However, the output that comes out in the console shows the html code instead of the formatted html table, such as