作者:紫岚蓝魂_578 | 来源:互联网 | 2023-05-17 11:30
I wrote a bash script in Mac OS that takes my .rnw file, knit it and then makes a .pdf. To knit my file, I'm using the command
我在Mac OS中写了一个bash脚本,它接受我的.rnw文件,编织它然后制作.pdf。要编织我的文件,我正在使用该命令
Rscript -e "library(knitr); knit('file.rnw', encoding='utf8')"
and everything works fine. However, I don't want the ## characters in my final document. I tested, using R prompt, the following commands
一切正常。但是,我不想在我的最终文档中使用##字符。我使用R提示符测试了以下命令
library(knitr)
opts_chunk$set(comment=NA)
knit('file.rnw', encoding='utf8')
and they give me exactly what I want: the document without comments in the R commands output. But if I try to run
他们给了我我想要的东西:R命令输出中没有注释的文件。但如果我试着跑
Rscript -e "library(knitr); opts_chunk$set(comment=NA); knit('livro.rnw', encoding='utf8')"
I get
我明白了
Error: could not find function "opts_chunk"
Execution halted
as result. What am I doing wrong? How can I ask for options for my chunk in knitr using the command line?
结果。我究竟做错了什么?如何使用命令行在knitr中为我的块请求选项?
1 个解决方案