[R-SIG-Mac] query re ">" in Sweave output for Mac input

Douglas Bates bates at stat.wisc.edu
Thu Jun 14 01:42:18 CEST 2007


On 6/13/07, William Revelle <lists at revelle.net> wrote:
> Dear R Mac users,
>
> When writing examples for students, I typically use Sweave to
> integrate the R code with the output.  R code from Sweave
> conventionally is preceded by the  prompt character (typically ">").
> Although this can be suppressed in Sweave, it seems as if the
> conventional style is to include the prompt on every example line.
> This leads to a syntax error on every line copied from a Sweave
> example directly into R.
>
> Now my question:
>
> Is there some option in the Mac R-Gui that I have missed that allows
> me to directly paste Sweave output of commands (i.e., including the
> prompt) into R without first editing them out in the editor?  I think
> that this is possible in Windows (but have only been told that by my
> students).
>
> If it is not possible, then what do people think about example code
> not including the prompt?   It  makes it easier to cut and paste from
> sample text, but makes it harder to spot the code in the sample text.
> (For my web based examples I get around this by color coding the R
> commands , but I am worrying about pdf examples).

Do you know of

R CMD Stangle <filename>.Rnw

which extracts the R code into a file <filename>.R?



More information about the R-SIG-Mac mailing list