merge_colnames: For use with 'xtable"s 'add.to.row' when column names are...

View source: R/merge_colnames.R

merge_colnamesR Documentation

For use with xtable's add.to.row when column names are repeated and should be merged.

Description

Removes consecutive duplicate column names and uses LaTeX's ⁠\multicolumn⁠ to merge the cells. Shuld be passed to add.to.row in print.xtable().

Usage

merge_colnames(xtab)

Arguments

xtab

an object of class xtable

Value

a list with components 'pos' and 'command'

Examples


iris2 <- split_colnames(iris, sep = "\\.")

xtab <- xtable::xtable(iris2)
xtable::print.xtable(xtab, add.to.row = merge_colnames(xtab))


EstherHerbert/Useful.functions documentation built on Jan. 31, 2025, 10:41 a.m.