multiple (R) plotly figures generated in a rmarkdown (knitr chunk) document

前端 未结 3 703
情深已故
情深已故 2021-01-01 00:14

I try to create multiple plotly figures in a Rmarkdown document using loop or lapply.

The R script:

require(plotly)
data(iris)
b <- lapply(setdif         


        
3条回答
  •  不知归路
    2021-01-01 00:34

    I found a "dirty" solution by using temp file and kniting it :

    ```{r,echo=FALSE}
    mytempfile<-tempfile()
    write("```{r graphlist,echo=FALSE}\n",file=mytempfile)
    write(paste("p[[",1:length(p),"]]"),file=mytempfile,append = TRUE)
    write("\n```",file=mytempfile,append = TRUE)
    ```
    
    `r knit_child(mytempfile, quiet=T)`
    

    But it's unsatisfactory.

提交回复
热议问题