Quantcast
Channel: Active questions tagged kable - Stack Overflow
Viewing all articles
Browse latest Browse all 105

How to remove the name of first column of a table with collapse rows with rmarkdown and kableExtra

$
0
0

I'm doing a table with a combination of collapsed and packed rows. I want to remove the name the firstof the column, but when I do so kable removes the collapsing.

Any ideas?

Here an reproducible example code with the same errror:

library(tidyverse)library(kableExtra)data("iris") Tbl <- iris %>%   pivot_longer(cols = c(Sepal.Length, Sepal.Width, Petal.Length, Petal.Width)) %>%   separate(name, sep = 5, into = c("Flower_part", "Measure")) %>%   group_by(Species, Flower_part, Measure) %>%   summarise(Mean = mean(value),            SD = sd(value)) #Table with colapsed rows and the name of columnTbl %>%   ungroup() %>%   select(-Species) %>%   kbl(digits = 3) %>%  kable_classic("striped", full_width = T) %>%   collapse_rows(columns = 1, valign = "top") %>%   pack_rows(index = table(Tbl$Species), indent = FALSE)

#Table with colapsed rows and the name of column

#Table with a "blank" name with the collapsing not working.Tbl %>%   ungroup() %>%   select(-Species) %>%   rename(" " = "Flower_part") %>%  kbl(digits = 3) %>%  kable_classic("striped", full_width = T) %>%   collapse_rows(columns = 1, valign = "top") %>%   pack_rows(index = table(Tbl$Species), indent = FALSE)

#Table with a "blank" name with the collapsing not working.


Viewing all articles
Browse latest Browse all 105

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>