Can I suppress the arrow (">") in the R/S output in Sweave?
whenever I run some R code with Sweave, it displays the terminal arrows (">") in the document. This is fine for session inputs, but sometimes I'd lik开发者_JAVA百科e to include custom functions. When arrows show up in the document, it is more difficult to copy and paste important snippets of code. Is there a quick way to do this?
I know I can run the code while suppressing the output all together, and then copy that code into a \Verbatim, but that requires extra typing.
Thanks
dumbo <- function(x)
2*x
instead of
> dumbo <- function(x)
> 2*x
Just add this to the top of the first chunk:
options(prompt=" ",continue=" ")
You can get back any moment with:
options(prompt="> ",continue="+ ")
options(prompt=" ")
You can set it back at the end. options(prompt="> ")
This is off by default in knitr
, the "next generation Sweave
". Other nice features include syntax coloring and PGF integration.
Sweave
code of average complexity needs only minor if any adaptions to run with knitr
.
精彩评论