Reputation: 435
I have monthly report generator that works fine with gt table inside a chunk, but not when the code for the chunk has a external source like the example below.
the main script
rmarkdown::render('report.Rmd', output_file = paste0('report_', i, '.html'))
this way the report.Rmd works fine and prints the gt table
---
title: "Report"
author: "Me"
date: "`r format(Sys.time(), '%d de %B de %Y')`"
output:
html_document
---
## Test
```{r first, echo=FALSE, message=FALSE, results='asis'}
library(tidyverse)
library(gt)
```
```{r second, results='asis', echo=FALSE, message=FALSE}
#source("mtcars_gt.R")
mtcars %>% gt()
```
but this way not
---
title: "Report"
author: "Me"
date: "`r format(Sys.time(), '%d de %B de %Y')`"
output:
html_document
---
## Test
```{r first, echo=FALSE, message=FALSE, results='asis'}
library(tidyverse)
library(gt)
```
```{r second, results='asis', echo=FALSE, message=FALSE}
source("mtcars_gt.R")
```
mtcars_gt.R is just the gt
mtcars %>% gt()
Upvotes: 0
Views: 361