简体   繁体   English

是否可以在两个不同的R脚本上调用knitr :: spin并生成一个单独的html文件?

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

I have two different R scripts. 我有两个不同的R脚本。 I love the idea of knitr::spin. 我喜欢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. 我想知道是否有办法在这两个脚本上调用spin,这两个脚本都使用roxygen2格式化并生成一个报告。

You can use the text parameter in the spin function. 您可以在spin函数中使用text参数。 Use readLines to read the files and then cat to write the output: 使用readLines读取文件然后cat写入输出:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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