kableextra

kableExtra: Dynamic add_header_above labeling

不打扰是莪最后的温柔 提交于 2020-07-04 08:58:07
问题 I would like to create a pdf with rmarkdown. The PDF should contain a table. The table should have a dynamic column label. The tabhead should display the calendar week. However, the calendar week (e.g., KW29) is not displayed but the variable name "kw0". What is my error? library(knitr) library(kableExtra) library(lubridate) options(knitr.table.format = "latex") loadData <- function() {# load some data} myData<- loadData () kw0 <- paste("KW", week(Sys.Date()) - 1, sep = "") kw1 <- paste("KW",

kableExtra::pack_rows() - grouping not working for last row in long table and no indentation for wrapped text

断了今生、忘了曾经 提交于 2020-07-03 05:25:11
问题 I use the kableExtra package to generate a long table in an R markdown documents knitted to PDF. Sets of rows of the table are grouped together using kableExtra::pack_rows() (formerly kableExtra::group_rows() ) Two issues arise: If the last row forms a set, its grouping is not displayed if one sets longtable = TRUE to allow the long table to span across multiple pages and at the same time uses kable_styling(..., latex_options = c("repeat_header")) to repeat the header of the table on each

kableExtra: Vertical alignment not working in PDF output with many columns

南楼画角 提交于 2020-06-13 07:08:22
问题 The bounty expires in 2 days . Answers to this question are eligible for a +50 reputation bounty. mavericks wants to draw more attention to this question. I would like to align all columns in a kableExtra table to the top. The valign = "top" option does not seem to solve the issue here. Also, the third column is somehow dropped on top of the second for some reason, and citations are not working too. The MWE below is based on this related SO question, which only needs 2 columns: kable:

kableExtra: Vertical alignment not working in PDF output with many columns

扶醉桌前 提交于 2020-06-13 07:06:28
问题 The bounty expires in 2 days . Answers to this question are eligible for a +50 reputation bounty. mavericks wants to draw more attention to this question. I would like to align all columns in a kableExtra table to the top. The valign = "top" option does not seem to solve the issue here. Also, the third column is somehow dropped on top of the second for some reason, and citations are not working too. The MWE below is based on this related SO question, which only needs 2 columns: kable:

Increase line/row spacing with kableExtra

≡放荡痞女 提交于 2020-06-12 04:35:22
问题 Is there a way to increase the line spacing with kableExtra for a pdf output in r-markdown or bookdown? library(knitr) library(kableExtra) kable( head(iris, 5), caption = 'Iris Table', booktabs = TRUE) %>% kable_styling(latex_options = "striped") 回答1: You can just do it using the LaTeX command \arraystretch : --- output: pdf_document --- ```{r setup, include=FALSE} library(kableExtra) library(tidyverse) ``` \renewcommand{\arraystretch}{2} ```{r, echo=FALSE} library(knitr) library(kableExtra)

Replace column names in kable/R markdown

谁说胖子不能爱 提交于 2020-06-10 02:59:05
问题 My data frame has ugly column names, but when displaying the table in my report, I want to their "real" names including special characters '(', new lines, greek letters, repeated names, etc. Is there an easy way of replacing the names in knitr to allow such formatting? Proposed solution What I have tried to do is suppress the printing of the data frame names and use add_header_above for better names and names that span several columns. Some advice I've seen says to use: x <- kable(df) gsub("

Is it possible to remove horizontal lines in Kable kableextra with html option?

风格不统一 提交于 2020-05-15 12:28:10
问题 I am trying to create a table using kable/kableextra without showing the horizontal lines in the table except for the first row which is the row names. ``` {r echo=FALSE} library(knitr) library(kableExtra) options(knitr.kable.NA = '') dt <- mtcars[1:5, 1:6] kable(dt, "html") %>% kable_styling(full_width = F, position = "left") %>% row_spec(0, align = "c",bold=T ) %>% column_spec(1, bold = T) ``` In the code above there is a line below the first row, which I like since those are row names, but

Is it possible to remove horizontal lines in Kable kableextra with html option?

断了今生、忘了曾经 提交于 2020-05-15 12:27:43
问题 I am trying to create a table using kable/kableextra without showing the horizontal lines in the table except for the first row which is the row names. ``` {r echo=FALSE} library(knitr) library(kableExtra) options(knitr.kable.NA = '') dt <- mtcars[1:5, 1:6] kable(dt, "html") %>% kable_styling(full_width = F, position = "left") %>% row_spec(0, align = "c",bold=T ) %>% column_spec(1, bold = T) ``` In the code above there is a line below the first row, which I like since those are row names, but

Sudden collapse of kableExtra in [R]

北城以北 提交于 2020-05-15 08:05:41
问题 I should probably point out that I am still fairly new to working with RMarkdown and the kableExtra R package, but I have a document that was knitable last week and now no longer knits despite no physical changes to the document. The error message I receive is the following Error in save_kable_latex(x, file, latex_header_includes, keep_tex) : We hit an error when trying to use magick to read the generated PDF file. You may check your magick installation and try to use the magick::image_read

Problems rendering table using r Markdown, kable and kableExtra

[亡魂溺海] 提交于 2020-03-19 06:25:33
问题 I am attempting to output a latex table using r markdown, kable and kableExtra. I get an error in the table rendering code that is not part of the latex code produced by R. The code: outTab <- m.OutTab %>% kable(format='latex', booktabs=T , #caption = "Population Trend", digits=1, row.names=FALSE, align='lccccc', col.names = names_spaced, escape = FALSE) where "m.OutTab" is an matrix that contains the table to be rendered, The error: Error producing PDF. ! Misplaced \noalign. \addlinespace ->