tmrank.ft <- regulartable(data = tm.rank.out) %>%
theme_booktabs() %>%
autofit() %>%
merge_v(j=missing_species) %>%
align(align = 'center') %>%
align(align = 'center', part = 'header') %>%
bold(part = 'header') %>%
height(height = 1, part = 'header') %>%
fontsize(size = 14, part = 'all') %>%
width(j=1, width = 1.0 ) %>%
width(j=2:ncol(tm.rank.out), width = 2.5) %>%
(
function(x) {
## These for loop causes the issue. If I dont use for loop, it works great.
for (ii in 2:length(species)) {
group_result <- group_vector( tm.rank.out.temp, grp.type, 'human')
if(length(group_result) >0) {
for (jj in 1:length(group_result)) {
text_color <- grp.clr[names(group_result)[jj]]
color(x, i = group_result[[jj]], j = ~ human, color = text_color)
}
}
}
x
}
)