'When rendering Rmarkdown from another script, tables not appearing
When I use the knit button in Rstudio the .RMD file renders perfectly into a HTML and all my tables appear.
My r script that automates my reports looks like the following
source("users/some_name/some_file/get_some_data.R")
render("users/some_name/some_file/foo.Rmd")
source("users/some_name/some_file/email_data_report.R")
When run the above r script the tables do not appear in the HTML file produced.
Even when I tried the various table producing packages (base,KableExtra,reactable,DT, etc)
If I run the following in my foo.Rmd file -
datatable(iris)
I get a table underneath the code chunk in the Rstudio viewer and it appears when I use the knit button but as mentioned not when I call render for another r script.
Thanks
Solution 1:[1]
Try it with the child chunk option instead of render(), e.g.
```{r table, child = 'users/some_name/some_file/foo.Rmd'}
```
Another example, this is how I picuture the RMD-file where df is created by the data r-file:
```{r}
source("data.R")
```
```{r table}
DT::datatable(df)
```
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
