简体   繁体   中英

Is it possible to call knitr::spin on two different R scripts and produce a single html file?

I have two different R scripts. I love the idea of knitr::spin. I wanted to know if there's a way to call spin on these two scripts which are both formatted with roxygen2 and produce a single report.

You can use the text parameter in the spin function. Use readLines to read the files and then cat to write the output:

cat (spin (text = c (readLines ("file_one.r"),
                     readLines ("file_two.r"))),
     file = "output.html")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM