kable

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 ->

Problems rendering table using r Markdown, kable and kableExtra

亡梦爱人 提交于 2020-03-19 06:24:50
问题 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 ->

Table Cross-References in Bookdown with MS-Word Output?

大憨熊 提交于 2020-03-18 06:30:09
问题 How can I make table cross-references work in a bookdown document with all of the output formats pdf, docx, and html? Or maybe more specifically, how can I get table cross-references working for flextables ? Below is a minimal working example. The second table, using kable() , gets me almost all the way there. The problem is that the table rendering in docx output is completely unusable (not in this MWE, but in my actual use-case). I considered creating the table conditionally, using

kable/kableExtra Add superscript to group labels in group_rows

百般思念 提交于 2020-03-03 11:33:08
问题 I have a table that I am creating for a pdf presentation using kable and kableExtra. I am wanting to group the rows and I need to use superscripts in the row group labels. I have tried several different things. Here is an example of some of the methods I have tried so far. library(kable) library(kableExtra) foo <- data.frame(a = 1:10, b = 11:20, c = 21:30) kable(foo, format = "latex", booktabs = T, row.names = FALSE, linesep = "", escape = FALSE) %>% kable_styling(latex_options = c("striped")

kable/kableExtra Add superscript to group labels in group_rows

折月煮酒 提交于 2020-03-03 11:32:02
问题 I have a table that I am creating for a pdf presentation using kable and kableExtra. I am wanting to group the rows and I need to use superscripts in the row group labels. I have tried several different things. Here is an example of some of the methods I have tried so far. library(kable) library(kableExtra) foo <- data.frame(a = 1:10, b = 11:20, c = 21:30) kable(foo, format = "latex", booktabs = T, row.names = FALSE, linesep = "", escape = FALSE) %>% kable_styling(latex_options = c("striped")

How to create table in rmarkdown using greek letters in column headers?

*爱你&永不变心* 提交于 2020-03-02 12:24:45
问题 I am trying to create a table in rmarkdown with kable and kableExtra and I want to put greek letters in the add_header_above function. kable(a, format = "latex", booktabs = T, longtable = T) %>% kable_styling() %>% add_header_above(c("n", "$\\alpha$", "Estimates for $\\alpha$" = 4, "Estimates for $\\beta$" = 4), align = "l", escape = F) I tried using escape = F like here, but it seems it doesn't work for greek letters. I want that style of table in my rmarkdown document with the greek letters