This may be asking too much, but I've recently used add_header_above to add a multicolumn header to a table. I'd like to separate two headers in the same row with a vertical border. I've successfully added the border to the table body and to the column names (col.names), but the extra header confounds me. t6 is a 12 column x 6 row table and the following creates the table.
The pipe to column_spec(7,border_left=T) draws a vertical border in the main body and in the column names row. The extra header from add_header_above(...) has no border. Is there a way to add one using kable?
This may be asking too much, but I've recently used add_header_above to add a multicolumn header to a table. I'd like to separate two headers in the same row with a vertical border. I've successfully added the border to the table body and to the column names (col.names), but the extra header confounds me. t6 is a 12 column x 6 row table and the following creates the table.
col.names <- c('Year','Beginning\nUnrecovered\nBalance', 'Interest on\nUnrecovered\nBalance', 'Cash Flow','Recovered\nAmount', 'Ending\nUnrecovered\nBalance') col.names <- c(col.names,col.names) hdr.above <- c('Basis: Unrecovered balance'=6,'Basis: Initial Principal'=6)
x <- knitr::kable(t6,format=TableFormat,align=a, col.names=c(col.names,col.names),caption='ROR Results', booktabs=T, escape=F) %>% kable_styling(bootstrap_options=c('striped','hover','condensed','responsive'), position='center',latex_options = "hold_position", font_size = font.size,full_width=F) %>% column_spec(7,border_left=T) hdr.above.2 <- NULL x %>% add_header_above(hdr.above,align='l') %>% cline(c(2,5))
The pipe to column_spec(7,border_left=T) draws a vertical border in the main body and in the column names row. The extra header from add_header_above(...) has no border. Is there a way to add one using kable?