在Jnit的Knitr中更改提示字符 [英] Change prompt character in knitr for JSS
本文介绍了在Jnit的Knitr中更改提示字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
《统计软件杂志》 样式指南规定将R>
用作提示字符.在Sweave中,可以通过以下方式获得:
The Journal of Statistical Software style guide prescripes use of R>
as prompt character. In Sweave this can be obtained through:
options(prompt = "R> ", continue = "+ ", width = 70, useFancyQuotes = FALSE)
是否可以在knitr
中设置prompt
字符?似乎chunks$set
中的prompt
参数仅允许TRUE/FALSE
.
Is it possible to set the prompt
character in knitr
as well? It seems like the prompt
argument in chunks$set
only allows for TRUE/FALSE
.
推荐答案
在.Rnw文件中使用这种设置:
Use this kind of setup in the .Rnw file:
<<setup, include=FALSE, cache=FALSE>>=
library(knitr)
# set global chunk options
opts_chunk$set(prompt=TRUE)
options(replace.assign=TRUE, width=90, prompt="R> ")
@
注意,我在opts_chunk$set()
中说了prompt=TRUE
,然后在下一行的选项中指定了哪种提示类型.
Notice I say prompt=TRUE
in the opts_chunk$set()
and then specify what type of prompt in the options in the next line.
这篇关于在Jnit的Knitr中更改提示字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文