user12703198
user12703198

Reputation: 433

How to make the output recognizable in Sweave

I am using Sweave to be able to combine LaTeX and R. I find useful to be able to remove the prefix ">" and "+" from the input writing options(prompt=" ", continue=" ") .

I would like to find a way to make the output recognizable from the input, for instance adding a prefix "#" to the output (as it happens with R Markdown).

Any help?

Upvotes: 0

Views: 80

Answers (1)

Yihui Xie
Yihui Xie

Reputation: 30114

I'm not sure if you know that knitr can also compile .Rnw documents (Sweave), in addition to .Rmd (R Markdown). You just pass the file path to knitr::knit(), e.g.,

knitr::knit('test.Rnw')

And you will get the .tex output file. If you want to get the PDF output directly, you may call:

knitr::knit2pdf('test.Rnw')

By default, knitr doesn't add the prompt character > or + to your code in the output.

Upvotes: 1

Related Questions