3

has anyone an idea how to add a line to this table created with the package kableextra?

Joe94
  • 91
  • 7
  • 1
    `row_spec(c(2,4),hline_after=TRUE)` – TJ87 Jun 16 '21 at 23:09
  • Thanks I just tried that but it doesnt work. could you post the whole code? that would be huge! – Joe94 Jun 16 '21 at 23:17
  • 1
    You could also try `kableExtra::row_spec(x, 2, extra_css = "border-bottom: 1px solid")` from https://stackoverflow.com/questions/53655983/row-spec-function-from-kableextra-does-not-create-a-horizontal-line-in-html-ou – TJ87 Jun 17 '21 at 00:37
  • Deleting sensitive information from the question is ok but you should atleast give some dummy data for the question so that it is useful for the future visitors. – Ronak Shah Jun 17 '21 at 13:00
  • Yes I am sorry for that. I will have to update. – Joe94 Jun 17 '21 at 22:41

1 Answers1

3

You can modify the solution suggested by @TJ87 in the comments to create a horizontal line after every 2 rows.

library(kableExtra)

dt %>%
  kbl(caption = "Ü") %>%
  kable_classic(full_width = T, html_font = "Cambria") %>%
  row_spec(seq(2, nrow(dt), 2), extra_css = "border-bottom: 1px solid;")
Ronak Shah
  • 377,200
  • 20
  • 156
  • 213