xtable

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

此生再无相见时 提交于 2019-12-04 19:08:46
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 table appears, but all hyperlinks bring me to the beginning of this table. My question is, in "List of Table" how can I just show the first page number at which this table appears. \documentclass{article} \usepackage{longtable} \usepackage{hyperref} <<setup, include=FALSE, cache=FALSE>>= library(knitr) library(xtable) @ \begin{document}

Repeat headers when using xtable with longtable option

試著忘記壹切 提交于 2019-12-04 18:28:01
问题 Is there a way to repeat the top row / set headers when generating an xtable with a longtable option ? For eg., if I have tableSb <- xtable(df, caption="A Very Long Table", label="ALongTable") print(tableSb, include.rownames=TRUE, tabular.environment="longtable", floating=FALSE) This works fine, but when the tables roll over into a new page the headers are not repeated. Any suggestions ? 回答1: In order to accomplish this, you'll need to use the add.to.row option of the print function (run

Printing nice cross-tabulations in knitr

亡梦爱人 提交于 2019-12-04 16:26:46
问题 What I want is to print nice crosstabulations, either in a pdf file, or in a html file, from RStudio, using R, Markdown and knitr. I suspect I am missing something really obvious, because I cannot believe this is so hard. I make cross-tabs with either xtabs or ftable. What I want is something like a nicely printed version of the R console output. > x Col Row A B C D 15 9 7 E 13 14 9 F 8 8 17 > f Col A B C Row D 15 9 7 E 13 14 9 F 8 8 17 I've tried several different solutions, none of which

Combining two tables and adding a header for each table in R

此生再无相见时 提交于 2019-12-04 15:55:07
I would like to display results of two regression analyses next to each other, let's say a logistic and a COX regression. Variables are presented in rows and corresponding data for p, OR/HR and confidence interval in columns. So, the column names don't match: it's OR on the left, HR on the right. I tried cbind, but I'm encountering the following problems: (1) What if one variable (row) is only present in one table due to variable selection? In that case, there would have to a blank row in the other table upon combination of the two. (2) After both tables are combined, how can you add a header

header on each page of big table of xtable?

好久不见. 提交于 2019-12-04 10:02:57
How do you put on a big table of xtable the table header on each page?, So that is easier to read the table the table between pages. I use the following in Sweave: test.big<- xtable(test,label="table",caption='test') align(test.big) <- "|c|c|c|c|l|c|c|c|" print(test.big,tabular.environment='longtable',include.colnames = TRUE,floating=FALSE) Thanks for your answers The longtable (LaTeX) package specification can be found at that URL. The section of code in the examples whose output appears on pages 2 and 3 is in section 8 and I have reproduced bit of it below: \caption[]{(continued)}\\ \hline

Column names on each page with xtable in Sweave

半城伤御伤魂 提交于 2019-12-04 09:31:04
问题 I want to have column names on each page of the xtable. \documentclass{article} \usepackage{graphicx} \usepackage{longtable} \begin{document} <<>>= x <- matrix(rnorm(1000), ncol = 10) x.big <- xtable(x,label='tabbig',caption='Example of longtable spanning several pages') @ <<label = tabSEM.S, echo = FALSE, results = tex >>= print(x.big,tabular.environment='longtable',floating=FALSE) @ \end{document} Any help will be highly appreciated. Thanks 回答1: I think this is really a LaTeX question,

How can I omit interactions using stargazer or xtable?

随声附和 提交于 2019-12-04 08:19:40
Is it possible to omit interactions in stargazer using the omit option? Normally I would write the variable name into the omit=c('varname') but in the case of an interaction I do not know what to write. Any hints on that? How do you solve this problem in other packages like xtable ? \documentclass{article} \begin{document} %Load dataset and run regression << lm, echo=FALSE >>= load('dataset.RData') library(stargazer) lm1 <- lm(y~ x + factor(v)*z ,data=dataset) @ << table_texstyle, echo=FALSE, comment=NA, results='asis' >>= stargazer(lm1 ,omit=c('???'), omit.labels=c('Omitted interactions'),

inset \\footnote{} into header with xtable and tabular.environment

心不动则不痛 提交于 2019-12-04 07:46:50
Can I control the add.to.row command in xtable to place an \footnote{} in the LaTeX table output header? This is how far I've gotten it. (I would like to find a solution using xtable and not `Hmisc') require(xtable) x <- matrix(rnorm(60), ncol = 10) x.big <- xtable(x,label='tabbig', caption='Example of longtable') names(x.big) <- LETTERS[1:10] print(x.big,tabular.environment='longtable',floating=FALSE, add.to.row = list(pos = list(seq(1,nrow(x.big), by = 2), 0, 1), command = c("\\rowcolor[gray]{.95} ", "\\hline \\endhead ", "\\footnote{This is the first footnote that I would like to have in

Adjust row height xtable R

烂漫一生 提交于 2019-12-04 04:05:38
There are couple of helpful posts round dealing with xtable but no one deals with this as far as my search abilities go. I would like to adjust row height in xtable (print). I'm printing a data.frame. print(xtable(...),...) Please note that I'm already using add.to.row addtorow <- list() addtorow$pos <- list() addtorow$pos[[1]] <- c(0) addtorow$command <- c(paste("\\hline \n","\\hline \n",sep="")) So what I would like to do is to widen the upper row space: I have tried all kind of things but always just messing around what I have already nicely done. You could simply use the booktabs option

xtable for conditional cell formatting significant p-values of table

别等时光非礼了梦想. 提交于 2019-12-03 17:39:09
问题 I'm using xtable to generate tables to put in Latex, and was wondering if there's a way to have conditional formatting of cells so that all significant p-values are in grey? I'm using Knitr in TexShop. Here's an example using the diamonds data in ggplot2, and running a TukeyHSD test to predict carat from cut . library(ggplot2) library(xtable) summary(data.aov <- aov(carat~cut, data = diamonds)) data.hsd<-TukeyHSD(data.aov) data.hsd.result<-data.frame(data.hsd$cut) data.hsd.result I can then