[R] a knitr question

Duncan Murdoch murdoch.duncan at gmail.com
Thu Jul 31 01:47:51 CEST 2014

On 30/07/2014, 2:20 PM, Yihui Xie wrote:
> As a reader, I often want to run the code by myself _while_ I'm
> reading a particular part of an article/report. I find it convenient
> to be able to copy the code as I'm reading it, instead of minimizing
> my current window, opening an R script, and running the part that I'm
> interested in. Of course, this may not work if the code I copy is not
> self-contained; your purl() approach certainly has an advantage
> sometimes.
> I do not see a whole lot of value in maintaining the same appearance
> of the R code in the R console and a report. You can teach your
> students what the prompt characters mean, and I think that is enough.
> Journal of Statistical Software requires "R> " as the prompt character
> (which is worse), and your students will probably be confused when
> reading JSS papers if they have been seeing the default prompts all
> the time. I see the point of keeping prompts (i.e. I do not completely
> disagree), but I do not think it is an essential or important thing to
> do. Personally I prefer reading "vanilla" code, and >/+ may confuse my
> eyes occasionally, e.g.
>> z > 5
>> x +
> + y
> (More on prompts:
> http://yihui.name/en/2013/01/code-pollution-with-command-prompts/)
> Re Rich: yes, I'm aware of approaches of post-processing the prompts,
> but this problem would not have existed in the first place if we do
> not include prompts at all. I'm not sure if it makes much sense to
> create some mess and clean it afterwards.

So your suggestion is that the R console should not prompt for input?
Do you know of *any* interactive system which doesn't prompt for input?
 How would users be able to tell the difference between R waiting for
input, and R busy on the last calculation?

Duncan Murdoch

> Regards,
> Yihui
> --
> Yihui Xie <xieyihui at gmail.com>
> Web: http://yihui.name
> On Wed, Jul 30, 2014 at 12:50 PM, Greg Snow <538280 at gmail.com> wrote:
>> My preference when teaching is to have the code and results look the
>> same as it appears in the R console window, so with the prompts and
>> without the output commented.  But then I also `purl` my knitr file to
>> create a script file to give to the students that they can copy and
>> paste from easily.
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list