xtable

Repeat headers when using xtable with longtable option

…衆ロ難τιáo~ 提交于 2019-12-03 12:04:55
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 ? In order to accomplish this, you'll need to use the add.to.row option of the print function (run ?print.xtable for more information). Try this (adapted from https://r-forge.r-project.org/tracker/?func=detail

How to put a newline into a column header in an xtable in R

放肆的年华 提交于 2019-12-03 03:54:44
问题 I have a dataframe that I am putting into a sweave document using xtable, however one of my column names is quite long, and I would like to break it over two lines to save space calqc_table<-structure(list(RUNID = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), ANALYTEINDEX = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), ID = structure(1:11, .Label = c("Cal A", "Cal B", "Cal C", "Cal D", "Cal E", "Cal F", "Cal G", "Cal H", "Cal High", "Cal Low", "Cal Mid"), class = "factor"), mean_conc = c

Column names on each page with xtable in Sweave

让人想犯罪 __ 提交于 2019-12-03 03:17:02
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 joran I think this is really a LaTeX question, which I simply Googled and ended up with a simple answer from tex.stackexchange.com here . Try this

How to set both column width and text alignment in align argument of xtable?

孤人 提交于 2019-12-02 13:33:35
问题 I would like to keep the width of columns I set using align argument of xtable and I would like to align all numeric columns to the right, others to the left and the headers to the center. I found some solutions using tables which are written directly in the rnw file but I want to load my data from file because my table is quite big and can change during creation of the knitr document. The code (I used the iris dataset in this example instead of my own data): <<table_symbionts_chunk, results=

Color Code Cells of xtable

流过昼夜 提交于 2019-12-02 12:09:39
问题 I've used R, sweave (but not knitr, and xtable, to create a table, where 1 column is an identifier, and the other three columns are "flag" columns that are either blank or contain a 1 (the flag). I want to be able to shad the last three columns so each cell is either green (if it is blank) or red (if it contains a 1). <<xtable3, results=tex>>= id <- c("1_1", "1_2", "2_1") a <- c(1,"","") b <- c("", 1, "") c <- c("", "", 1) d <- data.frame(id, a,b,c) dx <- xtable(d) align(dx) <- "|c|c|c|c|c|"

Color Code Cells of xtable

泄露秘密 提交于 2019-12-02 05:13:18
I've used R, sweave (but not knitr, and xtable, to create a table, where 1 column is an identifier, and the other three columns are "flag" columns that are either blank or contain a 1 (the flag). I want to be able to shad the last three columns so each cell is either green (if it is blank) or red (if it contains a 1). <<xtable3, results=tex>>= id <- c("1_1", "1_2", "2_1") a <- c(1,"","") b <- c("", 1, "") c <- c("", "", 1) d <- data.frame(id, a,b,c) dx <- xtable(d) align(dx) <- "|c|c|c|c|c|" print(dx, hline.after=-1:3) @ Edit: This is the output I get via Sumatra PDF Viewer: I have made

How to set both column width and text alignment in align argument of xtable?

徘徊边缘 提交于 2019-12-02 04:35:06
I would like to keep the width of columns I set using align argument of xtable and I would like to align all numeric columns to the right, others to the left and the headers to the center. I found some solutions using tables which are written directly in the rnw file but I want to load my data from file because my table is quite big and can change during creation of the knitr document. The code (I used the iris dataset in this example instead of my own data): <<table_symbionts_chunk, results="asis", echo=FALSE>>= library(xtable) irisX <-print (xtable (iris, digits=rep(0,6), align= c("p{0.015\

How to put a spacing of colors in a table of xtable?

匆匆过客 提交于 2019-12-01 11:16:55
How to put a spacing of colors in a table of xtable? I generate the tables with the following instructions: test.table<-xtable(summary(test),caption='test', floating = FALSE) align(test.table) <- "|c|l|" print(test.table,caption.placement='top') thanks for your answers 42- The html.table.attributes parameter needs a character vector of length equal to number of tables. This produces a bordered, centered table on a rather ugly yellow-orange background: data(tli) tli.table <- xtable(tli[1:20,]) digits(tli.table)[c(2,6)] <- 0 print(tli.table,type="html", html.table.attributes='border='1' align=

adding rows or boldify single row.names with print.xtables – add something in between rows?

巧了我就是萌 提交于 2019-12-01 06:10:42
I try to use print.xtable add.to.row to get table formatted like this: sports share of ballers 22.3 share of skiers 4.6 addiction share of smokers 20.3 share of drinkers 6.6 My R table does contain the additional row.names even if these rows don't contain any values. I used the add.to.row option to add colors to the different rows like suggested here which worked fine. But what does not work is to add bold text with xtable or add additional hline between the rows. I always get an error message like: Bad type area settings! The detected line width is about 52 % (typearea) larger than the

adding rows or boldify single row.names with print.xtables – add something in between rows?

雨燕双飞 提交于 2019-12-01 04:37:00
问题 I try to use print.xtable add.to.row to get table formatted like this: sports share of ballers 22.3 share of skiers 4.6 addiction share of smokers 20.3 share of drinkers 6.6 My R table does contain the additional row.names even if these rows don't contain any values. I used the add.to.row option to add colors to the different rows like suggested here which worked fine. But what does not work is to add bold text with xtable or add additional hline between the rows. I always get an error