kable

Renaming table's column name with Greek letters in kable

只谈情不闲聊 提交于 2021-01-28 21:30:40
问题 I am creating presentation using R Markdown with PDF (Beamer) as output. I am using library kableExtra for some formatting. The following code gives me the expected result library(knitr) # library(kableExtra) # create data frame df <- data.frame(mean = c(1,2,3), beta = c(5,6,7)) # print data frame to slide knitr::kable(df, col.names = c("mean", "$\\beta_t$")) However, when I use library(kableExtra) as in code below, the printed PDF show $\beta_t$ instead of the Greek letter beta. library

Rotating a table in PDF output from RMarkdown with more than one page

半腔热情 提交于 2021-01-28 12:01:18
问题 I want to rotate a wide table in my PDF output. I came across this fantastic question, but my table is longer. When I copy/paste one of the examples shown in that question, it works nice using RMarkdown. library(kableExtra) kable(iris[1:5,], format = "latex", booktabs = TRUE) %>% kableExtra::landscape() However, if we remove the subsetting we see that the table exceeds the dimension of the page. library(kableExtra) kable(iris, format = "latex", booktabs = TRUE) %>% kableExtra::landscape() So

Changing the latex_engine gets an error when trying to align images on kable

元气小坏坏 提交于 2021-01-28 02:22:16
问题 I am trying to copy the first answer in this question. The answer really meets what I wanted. But it get an error when the latex_engine is xelatex. But I really needs to show the output in chinese. Here's the code --- title: "Untitled" output: pdf_document: latex_engine: xelatex --- This example highlights the issue I am having with formatting a nice table with the graphics and the vertical alignment of text. ```{r echo=FALSE, results='hide', warning=FALSE, message=FALSE} ## Load modules

Changing the font size of headers of kableExtra table

廉价感情. 提交于 2021-01-27 13:21:53
问题 I am trying to change the font size of various headers in the following table. library(knitr) library(kableExtra) dt <- mtcars[1:5, 1:6] kable(dt) %>% kable_styling(c("striped", "bordered")) %>% add_header_above(c(" ", "Group 1" = 2, "Group 2" = 2, "Group 3" = 2)) %>% add_header_above(c(" ", "Group 4" = 4, "Group 5" = 2)) %>% add_header_above(c(" ", "Group 6" = 6)) Image of the table from the code above: However, I would like the header group 6 to be far bigger than Group 4 and 5 and groups 1

kableExtra: short.caption argument does not work if several dataframes are included in one table

孤者浪人 提交于 2021-01-27 07:43:32
问题 I have recently noticed that kable() from the kableExtra-package behaves oddly if more than one dataframe is included in the command. Short.caption argument is not used In this example, I create two data-frames and want to include them into one table. library(kableExtra) t1 <- c(68, 48, 50, 113, 98, 94) t2 <- c(26, 16, 22, 30, 16, 12) Group <- c("b1", "b2", "b3", "b4", "b5", "b6") cows <- data.frame(Group, t1, t2) colnames(cows) <- c("Group", "t1", "t2") kable(list(cows[1:3,], cows[4:6,]),

Is it possible to add vertical lines to tables produced with R knitr::kable in pdf?

荒凉一梦 提交于 2021-01-27 07:13:06
问题 I want to produce a table with knitr::kable with vertical lines on the borders and between certain columns. Is there a way to do it? My output document is pdf. Thanks! 回答1: Not too much clear, but maybe this could help: library(knitr) library(kableExtra) library(dplyr) dt <- mtcars[1:5, 1:6] dt %>% kable() %>% # here you can add the vertical line, in my example, for all the columns column_spec (1:7,border_left = T, border_right = T) %>% kable_styling() And if you need to save it as .pdf :

Is it possible to add vertical lines to tables produced with R knitr::kable in pdf?

痴心易碎 提交于 2021-01-27 07:12:25
问题 I want to produce a table with knitr::kable with vertical lines on the borders and between certain columns. Is there a way to do it? My output document is pdf. Thanks! 回答1: Not too much clear, but maybe this could help: library(knitr) library(kableExtra) library(dplyr) dt <- mtcars[1:5, 1:6] dt %>% kable() %>% # here you can add the vertical line, in my example, for all the columns column_spec (1:7,border_left = T, border_right = T) %>% kable_styling() And if you need to save it as .pdf :

kableExtra: short.caption argument not working if creating table from list or using list of dataframes

﹥>﹥吖頭↗ 提交于 2021-01-25 01:49:10
问题 The goal is to include a kableExtra table in a PDF/HTML report generated with Rmarkdown/bookdown. The short.caption argument allows displaying a shortened version of the caption in the list of tables. When generating a kableExtra table from a list or a list of dataframes, the short.caption argument does not function anymore. The long caption is shown in the list of tables of the PDF report. Also, using markdown expressions like **BOLD** do not work in the titles either. ```{r CHUNK, echo

kableExtra: short.caption argument not working if creating table from list or using list of dataframes

…衆ロ難τιáo~ 提交于 2021-01-25 01:47:40
问题 The goal is to include a kableExtra table in a PDF/HTML report generated with Rmarkdown/bookdown. The short.caption argument allows displaying a shortened version of the caption in the list of tables. When generating a kableExtra table from a list or a list of dataframes, the short.caption argument does not function anymore. The long caption is shown in the list of tables of the PDF report. Also, using markdown expressions like **BOLD** do not work in the titles either. ```{r CHUNK, echo

kableExtra: short.caption argument not working if creating table from list or using list of dataframes

六月ゝ 毕业季﹏ 提交于 2021-01-25 01:44:42
问题 The goal is to include a kableExtra table in a PDF/HTML report generated with Rmarkdown/bookdown. The short.caption argument allows displaying a shortened version of the caption in the list of tables. When generating a kableExtra table from a list or a list of dataframes, the short.caption argument does not function anymore. The long caption is shown in the list of tables of the PDF report. Also, using markdown expressions like **BOLD** do not work in the titles either. ```{r CHUNK, echo