3
I need to generate a report that has several sections and subsections, which depending on the month, may or may not appear in the database
To get around the problem, I created an appearance conditioner, a "sign", that along my code , when it is TRUE runs the sections and subsections and when it is FALSE, omits them from the HTML output.
The problem is that when plotting graphs, the subsections are being formatted correctly, but when they are tables, using kableExtra, the subsection is not formatted correctly.
I would like to know a method for the subsection to be formatted correctly, without having to put it on a separate Chunk, and understand why this happens.
---
title: "Teste"
author: "TEste"
date: "`r format(Sys.time(), '%d %B, %Y')`"
output:
rmdformats::material:
highlight: kate
self_contained: true
thumbnails: true
gallery: true
fig_width: 11
fig_height: 6
df_print: kable
---
```{r inputs, echo=FALSE, results='hide', warning=FALSE, message=FALSE}
library(tidyverse)
library(kableExtra)
sinal<-TRUE
```
```{r echo=FALSE, results='asis', eval= sinal}
cat("# Teste 01")
```
``` {r echo=FALSE, results = 'asis', eval = sinal }
cat("### Teste 02")
plot(mtcars$mpg)
```
``` {r echo=FALSE, results = 'asis', eval = sinal }
cat("### Teste 02")
plot(mtcars$mpg)
```
``` {r echo=FALSE, results = 'asis', eval = sinal }
cat("### Teste 03")
mtcars %>% kable(row.names = TRUE,format.args = list(decimal.mark = '.', big.mark = ",")) %>%
kable_styling(position = "center", full_width = FALSE,bootstrap_options = c("striped", "hover","condensed"), font_size = 14) %>% row_spec(0,bold = T, color = 'white',background = 'black')
```