I'm trying to produce a table using the huxtable package but I'm missing something :
First I tried the following code (which is the example in git):
<<test>>=
color_demo <- matrix('text', 7, 2)
rainbow <- c('red', 'orange', 'yellow', 'green', 'blue', 'turquoise', 'violet')
color_demo <- as_hux(color_demo) %>%
set_text_color(rainbow) %>% # text rainbow goes down columns
set_background_color(rainbow, byrow = TRUE) %>% # background color rainbow goes along rows
set_all_borders(1) %>%
set_all_border_colors('white') %>%
print_latex()
@
Which produced the following output, the table content was escaped with a double ##
character.
I've also tried to use the asis
chunk option but then I obtain the following, so the test is probably no meant to be run with this option :
Here is my reproducible code :
\documentclass[a4paper]{article}
\title{test for huxtable}
\begin{document}
\maketitle
<<load_libraries, echo = FALSE, eval = TRUE, results ="hide">>=
library(knitr)
library(huxtable)
@
<<test>>=
color_demo <- matrix('text', 7, 2)
rainbow <- c('red', 'orange', 'yellow', 'green', 'blue', 'turquoise', 'violet')
color_demo <- as_hux(color_demo) %>%
set_text_color(rainbow) %>% # text rainbow goes down columns
set_background_color(rainbow, byrow = TRUE) %>% # background color rainbow goes along rows
set_all_borders(1) %>%
set_all_border_colors('white') %>%
print_latex()
@
<<test2,results ="asis">>=
color_demo <- matrix('text', 7, 2)
rainbow <- c('red', 'orange', 'yellow', 'green', 'blue', 'turquoise', 'violet')
color_demo <- as_hux(color_demo) %>%
set_text_color(rainbow) %>% # text rainbow goes down columns
set_background_color(rainbow, byrow = TRUE) %>% # background color rainbow goes along rows
set_all_borders(1) %>%
set_all_border_colors('white') %>%
print_latex()
@
\end{document}