[R] a knitr question
murdoch.duncan at gmail.com
Thu Jul 31 03:15:57 CEST 2014
On 30/07/2014, 8:06 PM, Joshua Wiley wrote:
> On Thu, Jul 31, 2014 at 9:47 AM, Duncan Murdoch
> <murdoch.duncan at gmail.com <mailto:murdoch.duncan at gmail.com>> wrote:
> 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?
> I don't think that this is about prompts in interactive R, but when a
> document is knit, should the echoed code in the report have prompts or not.
"this problem would not have existed in the first place if we do
not include prompts at all" seems to indicate otherwise.
> Duncan Murdoch
> > Regards,
> > Yihui
> > --
> > Yihui Xie <xieyihui at gmail.com <mailto:xieyihui at gmail.com>>
> > Web: http://yihui.name
> > On Wed, Jul 30, 2014 at 12:50 PM, Greg Snow <538280 at gmail.com
> <mailto: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 <mailto:R-help at r-project.org> mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > and provide commented, minimal, self-contained, reproducible code.
> R-help at r-project.org <mailto:R-help at r-project.org> mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
> Joshua F. Wiley
> Ph.D. Student, UCLA Department of Psychology
> Senior Analyst, Elkhart Group Ltd.
> Office: 260.673.5518
More information about the R-help