Using knitr/sweave, I need to format the R code output that gets echoed, according to editorial journal requirements.

For example, the following chunk


Is formatted as follows:

> library(plyr)

However, I would like it to be formatted like this:

R> library(plyr)

How can I modify the leading chevron?

Sweave format is being used via the following chunk:

%Read the Script into File

I am using the following sweave.sty




%% inspired by an earlier version of upquote.sty
\catcode`'=\active \catcode``=\active
\g@addto@macro\@noligs{\let`\textasciigrave \let'\textquotesingle}



  \message{\string Environment Schunk is already defined, stay with former definition}%

  \csname newcount\endcsname\pdfoutput\fi%
     \immediate\pdfobj stream{#1}%
     \pdfcatalog{/SweaveConcordance \the\pdflastobj\space 0 R}%

1 Answer 1


Figured it out, need to set the options used in the R session:

    options(prompt   = "R> ",
            continue = "+    ")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.