r - kableExtra rmarkdown tables - aligning grouping row labels and footnotes -


i using kableextra format tables in rmarkdown document. when running code below, without position argument kable_styling, grouping row labels (the rows in table says "group 1" , "group 2") , footnotes remain left aligned in relation table. it.

```{r cars-table, results='asis'} kable(mtcars[1:10, 1:2], format = "html", caption = "group rows",       col.names = c("mpg[note]", "cyl[note]")) %>% kable_styling("striped", full_width = f) %>% group_rows("group 1", 4, 7) %>% group_rows("group 2", 8, 10) %>%  add_footnote(c("some footnote", "some other footnote")) ``` 

kableextra_workingtable

but when position argument provided kable_styling, grouping row labels , footnotes seem take opposite alignment, rather remaining left aligned in relation table. opposite alignment, when use position = "right", grouping row labels , footnotes become left aligned.

the code below demonstrates issue when using position = "left".

```{r cars-table, results='asis'} kable(mtcars[1:10, 1:2], format = "html", caption = "group rows",       col.names = c("mpg[note]", "cyl[note]")) %>% kable_styling("striped", full_width = f, position = "left") %>% group_rows("group 1", 4, 7) %>% group_rows("group 2", 8, 10) %>%  add_footnote(c("some footnote", "some other footnote")) ``` 

kableextra_notworkingtable

i load 2 libraries make example , use defaults when opening .rmd document in rstudio.

library(knitr) library(kableextra) 

what can make grouping row labels , footnotes left aligned in relation table? thanks.

in kableextra 0.3.0 or earlier, there bug in position section of kable_styling. corresponding css left positioning mistakenly set text-align:right... thank you, @meenaparam, bringing up!

now bug has been addressed in current dev version , cran version updated in week.


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -