xtable

How to place xtable object to the left side of page

天大地大妈咪最大 提交于 2019-12-31 04:30:31
问题 Question: How to place xtable object to the left side of page or how to disable centering globally. I'm struggling to figure out how to place xtable object on the left side. I have got a *.Rmd file and all this goes to the relevant r chunk. require(xtable) df <- data.frame(x=seq(1,10,1),y=rnorm(10)) Xtab <- xtable(df, digits=0, caption="\\textbf{MINIMAL/IDEAL}", floating=FALSE, latex.environments = c("left")) print(Xtab, size = "small", include.colnames=FALSE) I have included the following

how to export a dataframe to latex with some minimal formatting?

别来无恙 提交于 2019-12-24 19:23:31
问题 Consider this simple example library(dplyr) dataframe <- data_frame(mytext1 = c('HELLO', 'WORLD'), mytext2 = c('HELLO', 'AGAIN'), value1 = c(1,2), value2 = c(1,2)) # A tibble: 2 x 4 mytext1 mytext2 value1 value2 <chr> <chr> <dbl> <dbl> 1 HELLO HELLO 1 1 2 WORLD AGAIN 2 2 I would like to export this dataframe to a latex table, but with some little (but important) tweaks. In particular, I would like, in the latex output, to add a supercolumn that separates the text variables and another that

Formatting html table in R

ぃ、小莉子 提交于 2019-12-24 04:09:10
问题 I would like to improve the look of an html table that I generate in R using the package xtable : library(xtable) html.table = xtable(<mydataframe>) digits(html.table) = 2 I print the table using: html.tab = print(html.table, type = "html", floating = FALSE) cat(html.tab, file = <html link>) I would like to be able to justify the text in the table, modify the color of the header column, change the font, ... Is there any way i can achieve that in R? Thank you! 回答1: The idea is to : Create a

Error in applying a for loop to an xtable in knitr

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 17:04:03
问题 I'm preparing a pdf using knitr that contains a table produced using xtable. I'm adding a bold typeface to certain cells in the table so I've written the following function: bold <- function(x, matrix){ x[] <- lapply(x, as.character) for (i in 1:ncol(x)) { yes <- matrix[,i] x[yes,i] <- paste('\\textbf{', x[yes,i], '}', sep = "") } print(x, sanitize.text.function = identity) } My intention is that the object 'l.mat' is a logical matrix and by changing the 1's and 0's in the matrix I can change

Use xtable to produce a Latex table with significance stars (***)

主宰稳场 提交于 2019-12-23 10:09:00
问题 I am currently using xtable to generate Latex tables from R. It works fine, but in one of the tables I have significance stars to some of the numbers. Something like this dataframe X: 1 2 3 4 5 Test1 Test2 Test3 a "1.34" "0.43" "-0.26" "0.13" "0.05" "3.35^{.}" "343^{***}" "3244^{***}" b "2.02" "2.17" "-3.19" "4.43" "1.43" "390.1^{***}" "31.23^{***}" "24^{***}" c "23.07" "32.1" "24.3" "3.89" "0.4" "429.38^{***}" "17.04^{***}" "2424^{***}" d "21.48" "14.45" "14.19" "22.04" "0.15" "385.17^{***}"

xtable package: Skipping some rows in the output

廉价感情. 提交于 2019-12-22 22:22:56
问题 In the xtable output, if I want some rows to have nothing in them I will put NA 's in the elements of the matrix that correspond to the row that I want skipped. However this will lead to xtable output of something like & & & & & & & & \\ . What I want to know is how do I make it so it's ONLY \\ for that row that I wish to skip. 回答1: Still not sure whether I understand right but I give it a shot. The most important assumption I'm making here is that your multicolumn rows in that template are

Suppress automatic table name and number in an .Rmd file using xtable or knitr::kable

£可爱£侵袭症+ 提交于 2019-12-21 04:22:09
问题 I'd like to name my tables from R scripts without the automatic Table 1:... prefix when using xtable() or knitr::kable() in an .Rmd file. Output is a pdf document. Here's a reproducible example from an .Rmd file: --- title: "Suppress automatic table name and number" output: pdf_document --- ```{r myirischunk, results = 'asis', tab.cap = NULL, echo = TRUE} library(xtable) print(knitr::kable(head(iris), caption = "I sure wish it would say Table 1.a")) print(knitr::kable(head(iris), caption =

Suppress automatic table name and number in an .Rmd file using xtable or knitr::kable

匆匆过客 提交于 2019-12-21 04:22:07
问题 I'd like to name my tables from R scripts without the automatic Table 1:... prefix when using xtable() or knitr::kable() in an .Rmd file. Output is a pdf document. Here's a reproducible example from an .Rmd file: --- title: "Suppress automatic table name and number" output: pdf_document --- ```{r myirischunk, results = 'asis', tab.cap = NULL, echo = TRUE} library(xtable) print(knitr::kable(head(iris), caption = "I sure wish it would say Table 1.a")) print(knitr::kable(head(iris), caption =

Variables Overview with xtable in R

落爺英雄遲暮 提交于 2019-12-20 08:30:24
问题 I'm wondering if it's possible to create a xtable from the command str(x) to get an overview from the variables you use. This would be a nice feature to introduce someone to the dataset, but it's annoying to create it by yourself. So whta I tried is to make a xtable like this: str(cars) require(xtable) xtable(str(cars)) the cars dataset is given from R. Unfortunately xtable doesn't give a Latexcode for str() . Is it possible outsmart R here? Here are the main commands that xtable will

R: rendering xtable

落爺英雄遲暮 提交于 2019-12-20 02:43:09
问题 I have an .Rmd file containing: ```{r, echo=FALSE, message=FALSE, results='asis'} library(xtable) print(xtable(groupGrundALL)) ``` Using the "Knit Word" button in RStudio it creates and opens a Word file, but only shows the following text line instead of the intended (rendered) table itself: % latex table generated in R 3.2.2 by xtable 1.7-4 package % Wed Oct 2111:14:28 2015 When I run in the console... library(xtable) print(xtable(groupGrundALL)) I get LaTeX code: % latex table generated in