Merge flextable cells horizontally when consecutive cells have identical values. Text of formatted values are used to compare values.
Arguments
- x
a 'flextable' object, see flextable-package to learn how to create 'flextable' object.
- i
row selector, see section Row selection with the
iparameter in <Selectors in flextable>.- part
part selector, see section Part selection with the
partparameter in <Selectors in flextable>. Value 'all' is not allowed by the function.
See also
Other cell merging functions:
merge_at(),
merge_h_range(),
merge_none(),
merge_v()
Examples
library(flextable)
schedule <- data.frame(
time = c("9h", "10h", "11h", "14h", "15h", "16h"),
monday = c("Math", "Math", "French", "History", "Science", "French"),
tuesday = c("English", "Math", "Art", "Math", "Math", "French"),
wednesday = c("Science", "Math", "Science", "English", "English", "French"),
stringsAsFactors = FALSE
)
ft <- flextable(schedule)
ft <- theme_box(ft)
ft <- merge_h(ft)
ft
time
monday
tuesday
wednesday
9h
Math
English
Science
10h
Math
11h
French
Art
Science
14h
History
Math
English
15h
Science
Math
English
16h
French
