I'm trying to generate a report from a Shiny application using R-Markdown. I have a series of DT tables created in a for-loop to be rendered in my RMD HTML output file: RMD setup:
```{r setup, include=FALSE}
library(knitr)
library(DT)
library(plotly)
library(htmltools)
knitr::opts_chunk$set(echo = FALSE)
```
When I create the data table by itself, there is no problem:
```{r table1, echo=FALSE}
DT::datatable(
params$table1_data,
rownames= FALSE,
class = 'cell-border stripe',
options = list(searching = FALSE, paging = FALSE, info = FALSE)
)
```
Lorem ipsum is placeholder text commonly used in the graphic, print, and publishing industries for previewing layouts and visual mockups.
The HTML output file came out just right
However, when I create multiple data tables in a for loop:
::: {style="margin-bottom:30px;"}
```{r dataframes, echo = FALSE}
# Building list of outputs
dt_list <- htmltools::tagList()
for(i in 1:params$n_files){
# Extracting data
df_input_data = params$langmuir_freundlich[[i]][[1]]
# Creating tables
dt_list[[i]] <- DT::datatable(
df_input_data[,1:3],
caption = params$table1_data[i, 2],
rownames = FALSE,
class = 'cell-border stripe',
options = list(pageLength =15, searching = FALSE, paging = TRUE, info = TRUE)
)
}
dt_list
```
:::
### Next section
Lorem ipsum is placeholder text commonly used in the graphic, print, and publishing industries for previewing layouts and visual mockups.
$$
I = \frac{kC^{b}}{1+kC^{b}}
$$
The tables look great, BUT for some reason, the last table (even if it´s just one table) is overlapping my NEXT SECTION, I'm actually only able to see the latex equation included.
I have tried many versions of the for loop, but I believe the problem is somewhere else. I even tried adding a div<> with a style to add some space between the tables and the next paragraph with no success. Can anyone please help me to find out where the problem is?