kable

Is it possible to change the column width using kable without kableExtra?

烈酒焚心 提交于 2020-02-28 09:50:00
问题 Continue from this question. I want to modify the result's column width, but it can't be done without using the kableExtra . If I load the kableExtra package, the image will become text format. Here's the code: --- title: "Untitled" output: pdf_document: latex_engine: xelatex --- ```{r echo=FALSE, results='hide', warning=FALSE, message=FALSE} ## Load modules library(dplyr) library(tidyr) library(ggplot2) options(tinytex.verbose = TRUE) ## Create a local function to plot the z score

Is it possible to change the column width using kable without kableExtra?

爷,独闯天下 提交于 2020-02-28 09:47:10
问题 Continue from this question. I want to modify the result's column width, but it can't be done without using the kableExtra . If I load the kableExtra package, the image will become text format. Here's the code: --- title: "Untitled" output: pdf_document: latex_engine: xelatex --- ```{r echo=FALSE, results='hide', warning=FALSE, message=FALSE} ## Load modules library(dplyr) library(tidyr) library(ggplot2) options(tinytex.verbose = TRUE) ## Create a local function to plot the z score

Scale kable table to fit page width

China☆狼群 提交于 2020-02-19 09:39:12
问题 How do you format a table in pdf using kable function? Because my output table width exceeds the width of the pdf. Here is an example: --- output: pdf_document --- ```{r} df <- cbind(mtcars[1:5,], mtcars[1:5,]) knitr::kable(df) ``` 回答1: One option is to use kable_styling from the kableExtra package. The option latex_options="scale_down" will fit the table within the paper margins. See the vignette for detailed examples on all of the formatting options. --- output: pdf_document --- ```{r setup

rmarkdown: kable, xtable or tab_df tables in Word doc

旧街凉风 提交于 2020-02-05 04:22:28
问题 --- output: word_document: default --- ```{r setup, include=FALSE} data("mtcars") library(tidyverse) library(xtable) library(sjPlot) library(kableExtra) ``` ```{r, results='asis'} df <- mtcars %>% group_by(cyl) %>% summarise(disp = mean(disp), wt = mean(wt), n = n() ) kable(df) # tab_df(df) # xtable(df) ``` I have tried xtable , tab_df , and kable to generate a word document with a table. When "knit to HTML document", all tables looked fine. When "knit to Word", xtable didn't show the table

How to make kable table reactive() in shiny app? Shiny + kable

天大地大妈咪最大 提交于 2020-01-22 19:31:32
问题 I am trying to make kable table reactive and export it in shiny app. already gave a try with renderDataTable / renderTable inside server and output functions as datatableOutput / tableOutput , but of no luck and following is the line of code. output$tableset <- renderDataTable({ kable(spread_bole) %>% kable_styling(font_size = 15 ,bootstrap_options = c("striped","hover", "condensed")) }) tableOutput("tableset") 回答1: Since kable returns HTML, you can render your table using htmlOutput in ui

column_spec function in kableExtra in R doesn't work

眉间皱痕 提交于 2020-01-15 10:16:29
问题 I want co change column width in pdf with kable ( , 'latex') but the fucntion doesn't work. Anybody know why? here is my code: table = knitr::kable(jeden, "latex" , row.names = F , align = "llrrrrrrrrrr" , escape = F, booktabs = F, caption = '1. Sprzedaz uslug i towarow razem') kableExtra::column_spec(table, 1, width = "1cm", bold = TRUE, italic = TRUE) 回答1: It's not a bug but rather a relatively strange setting for align in knitr::kable() . In xtable you can put align in a string but for

Efficient way to wrap column names of proportion tables in rmarkdown pdf output

白昼怎懂夜的黑 提交于 2020-01-03 19:33:07
问题 I'm making weighted tables of row proportions using the questionr package. I want to wrap the column names when they are too long. Because I'm making hundreds of tables, the solution needs to work on tables with varying numbers of columns. I also want to avoid setting all columns to a specific width. Ideally, short column names would remain at their normal width while names exceeding the specified maximum length would be wrapped. Here are a bunch of solutions I've tried so far, written as

Make html table columns wider / prevent words from wrapping in RMarkdown

拥有回忆 提交于 2020-01-03 01:22:47
问题 I'm creating an html document with R markdown which has some tables. In situations where one column of a table has character values, how can I ensure the column is wide enough to contain the entire character string without wrapping? I tried using kableExtra below, but it seems like the width argument of column_spec is not being used even though the bold argument is. library(data.table) csd <- fread(' Oct-17 Sep-17 Aug-17 Jul-17 Jun-17 May-17 Apr-17 Mar-17 Feb-17 Jan-17 Dec-16 Nov-16 Oct-16

latex kable side-by-side tables “Not in outer par mode”

倖福魔咒の 提交于 2020-01-01 07:30:38
问题 I am trying to create a page with side-by-side tables. I used other SO answers to do this for a simple table ```{r start-block, include=F,echo=F} library(dplyr) library(knitr) library(kableExtra) ``` ```{r sample, echo=FALSE, results='asis'} t1 <- kable(head(mtcars)[1:3], format = "latex", booktabs = TRUE) %>% kable_styling(latex_options = c("striped"), font_size=5) t2 <- kable(head(mtcars)[4:6], format = "latex", booktabs = TRUE) %>% kable_styling(latex_options = c("striped"), font_size=5)

R markdown: How to create a table with images and text which should be knitted as PDF?

只愿长相守 提交于 2019-12-29 01:53:10
问题 I would like to include a table with 2 columns including images and text (image descriptions) in PDF report compiled with R markdown. In doing so, I have the following requirements for my table: width: fixed column or table width alignment: content alignment in columns top center alignment of an image in column 1 top left alignment of text in column 2 text content: is at best easy and good to read also in code text formatting: text formatting required, at best using markdown syntax, i.e, bold