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

William Revelle lists at revelle.net
Thu Jun 14 01:57:08 CEST 2007


Doug,

I don't think Stangle is what I am looking for, for I want my 
students to read (e.g.) a chapter I am writing (set in pdf after 
Sweave and LateX), copy the R code from the chapter and then run it.

I can just  have the Sweave not issue the prompt for every line, but 
that seems to violate the conventional style of writing examples.

Thanks

Bill

At 6:42 PM -0500 6/13/07, Douglas Bates wrote:
>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?


-- 
William Revelle		http://personality-project.org/revelle.html
Professor			http://personality-project.org/personality.html
Department of Psychology             http://www.wcas.northwestern.edu/psych/
Northwestern University	http://www.northwestern.edu/
Use R for statistics:                          http://personality-project.org/r



More information about the R-SIG-Mac mailing list