xtable

Changing the font size of table using print.xtable

↘锁芯ラ 提交于 2019-11-30 15:29:59
问题 I want to change the font size of the table using print.xtable. Using print(xT, size="\\tiny") works but I don't know other options for size. Something like size="7pt" would be nice. 回答1: You may choose a particular font size with the \fontsize{<size>}{<line space>} command: print(xt, size="\\fontsize{9pt}{10pt}\\selectfont") 来源: https://stackoverflow.com/questions/33994194/changing-the-font-size-of-table-using-print-xtable

Changing the font size of table using print.xtable

喜欢而已 提交于 2019-11-30 14:54:24
I want to change the font size of the table using print.xtable. Using print(xT, size="\\tiny") works but I don't know other options for size. Something like size="7pt" would be nice. You may choose a particular font size with the \fontsize{<size>}{<line space>} command: print(xt, size="\\fontsize{9pt}{10pt}\\selectfont") 来源: https://stackoverflow.com/questions/33994194/changing-the-font-size-of-table-using-print-xtable

Captions on tables in pdf documents generated by rmarkdown

女生的网名这么多〃 提交于 2019-11-30 14:05:47
How can I get captions on my table floats in pdf_document generated by rmarkdown? Using output: pdf_document: fig_caption: true and ```{r, fig.cap='a caption'} myplot ``` Generates a floating figure with myplot and the caption specified. How do I achieve the same thing with tables generated by xtable? ```{r, results='asis', fig.cap='table caption'} print(xtable(table), comment = FALSE) ``` I have tried using floating.environment = 'figure' in print.xtable, but to no avail. Or similarly, ```{r results='asis'} knitr::kable(head(mtcars), format = 'pandoc', caption = 'Title of the table') ``` The

Changing the Color of negative numbers to Red in a table generated with xtable()?

陌路散爱 提交于 2019-11-30 08:19:51
I'm writing a report in R with knitr. I'm using xtable() to generate tables in the report. One of my tables includes both negative and positive numbers. I'd like to change the color of negative numbers into red. How can I do that? Obviously, one easy solution is to change the latex code that xtable generates BUT note that I have an auto-report that numbers can change with new datasets and I don't want to manually set the colors. Here is a simple code: \documentclass{article} \begin{document} <<simpleExamp, results=tex, echo=FALSE>>= library(knitr) library(xtable) testMatrix <- matrix(c(sample(

Create a table in R with header expanding on two columns using xtable or any package

≡放荡痞女 提交于 2019-11-30 07:15:03
问题 I want to combine the tables from two dataframes and want to export that table to latex. The table that i want to create looks as follows. Note, the table below is created using excel. From xtable in R I was able to export the table for two individual stations. get the following for two stations T1 and T2. How can I combine the output of two stations to get the desired output as above? Station T1: > stT1 Observed-modeled |observed-modeled| Min. -1.5360000 0.0001891 1st Qu. 0.0002512 0.1633000

Combining several regression tables into one for use in xtable with Sweave in R

我的梦境 提交于 2019-11-30 05:10:13
xtable in Sweave works awesome, but does one table per regression. You can feed it a data frame, too, so I have been manually rbind ing and paste ing results into data frames, but that doesn't seem very scalable. Is there a more automated/robust solution that works like xtable , but on multiple lm objects? Are all of the tables that I see in papers/books generated manually? Is there a better solution to my janky code that generates a data frame to feed to xtable ? library(reshape2) data <- data.frame(matrix(rnorm(50), 10, 5)) names(data) <- letters[1:5] l.raw <- list() l.raw[["a"]] <- lm(a ~ d

Using xtable with R and Latex, math mode in column names?

孤者浪人 提交于 2019-11-30 04:54:52
I'm using xtable to compile tables from R automatically while compiling my TeX document. The question I have is how I get the variable names in the table (which in my case are the column names in a dataframe) to be in math mode. I have stored my results in the dataframe adf.results, and essentially what I want is colnames(adf.results) <- c(" ", "$m^r_t$", "$\delta p_t$", "$R^r_t$", "$R^b_t$", "$y^r_t$") but that simply inserts $m^r_t$ ... as the column names without interpreting them as being in math mode. Does anyone have a solution? as suggested in the xtable gallery vignette you should use

R, knitr, xtable, alternating row colors

落花浮王杯 提交于 2019-11-29 23:32:26
I'm trying to produce a table with xtable in R using knitr with alternating row colors. I can print a table in the PDF output but can't quite figure out the add.to.row command in the xtable manual along with the colortbl package. Roman Luštrik This figure was produced using the code at the bottom. I hope you don't break your eyes detecting the light grey color (I almost have, on one of my screens). library(xtable) mydf <- data.frame(id = 1:10, var1 = rnorm(10), var2 = runif(10)) rws <- seq(1, (nrow(mydf)-1), by = 2) col <- rep("\\rowcolor[gray]{0.95}", length(rws)) print(xtable(mydf), booktabs

How to remove the % lines in xtable table output by Knitr

梦想的初衷 提交于 2019-11-29 21:20:27
By using xtable and knitr, I add a table to my RMD document and export to PDF file. ```{r, results='asis'} library(xtable) xtable(matrixtable) ```` It looks great except there is a line % latex table generated in R 3.1.0 by xtable 1.7-3 package % Wed Jun 25 13:34:57 2014 How can I remove this line. I tried to set message=FALSE but it doesn't work. The inclusion of the comment in the final table is defined by the comment argument to print.xtable the default value for this is getOption('xtable.comment',TRUE) . so, if you set options(xtable.comment = FALSE) then for any future tables this comment

How to center LaTeX xtable output in full text width

左心房为你撑大大i 提交于 2019-11-29 13:15:40
I am using tufte-handout ( http://mirrors.ibiblio.org/CTAN/macros/latex/contrib/tufte-latex/sample-handout.pdf ) to create a small report in latex. I have a file code.Rnw that I knit into code.tex. Below is my code.Rnw: \documentclass[12pt,english,nohyper]{tufte-handout} \usepackage{longtable} \usepackage{geometry} \begin{document} <<include=FALSE>>= library(ggplot2) library(xtable) @ \centerline{\Large\bf This is my Main Title} <<echo=FALSE,results='asis'>>= fname='plot1.pdf' pdf(fname,width=4,height=4) print(qplot(mpg,cyl,data=mtcars)) {dev.off();invisible()} cat(sprintf('\\begin