[R] a knitr question

Greg Snow 538280 at gmail.com
Wed Jul 30 19:50:13 CEST 2014


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.

On Wed, Jul 30, 2014 at 8:45 AM, Ista Zahn <istazahn at gmail.com> wrote:
> On Tue, Jul 29, 2014 at 10:17 PM, Erin Hodgess <erinm.hodgess at gmail.com> wrote:
>> I was thinking that for teaching, it may be helpful for them to see the
>> whole thing.
>
> Hopefully you're teaching them to write their code in a script, in
> which case the prompt will not be helpful.
>
> Best,
> Ista
>>
>>
>> On Tue, Jul 29, 2014 at 6:56 PM, Yihui Xie <xie at yihui.name> wrote:
>>
>>> Yeah, it is just my personal opinion. Some users like it, and some do not.
>>>
>>> Regards,
>>> Yihui
>>> --
>>> Yihui Xie <xieyihui at gmail.com>
>>> Web: http://yihui.name
>>>
>>>
>>> On Tue, Jul 29, 2014 at 5:36 PM, Peter Alspach
>>> <Peter.Alspach at plantandfood.co.nz> wrote:
>>> > Kia ora Erin
>>> >
>>> > But beware - to quote from Yihui 2013 introduction to knitr
>>> >
>>> > "It is easy to revert to the output with prompts (set option
>>> prompt=TRUE), and you will quickly realize the inconvenience to the readers
>>> if they want to copy and run the code ..."
>>> >
>>> > Peter Alspach
>>> >
>>> > -----Original Message-----
>>> > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
>>> On Behalf Of Erin Hodgess
>>> > Sent: Wednesday, 30 July 2014 10:28 a.m.
>>> > To: r-help at r-project.org
>>> > Subject: Re: [R] a knitr question
>>> >
>>> > Sorry:  just solved it.
>>> >
>>> > You simply include "prompt=TRUE" in the <<>> section
>>> >
>>> > Thanks,
>>> > Erin
>>> >
>>> >
>>> >
>>> > On Tue, Jul 29, 2014 at 6:22 PM, Erin Hodgess <erinm.hodgess at gmail.com>
>>> > wrote:
>>> >
>>> >> Hello!
>>> >>
>>> >> When constructing code using knitr, is there a way to get the ">"
>>> >> prompt to appear, please?
>>> >>
>>> >> Everything else works great!!
>>> >>
>>> >> Thank you!
>>> >>
>>> >> Sincerely,
>>> >> Erin
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> Erin Hodgess
>>> >> Associate Professor
>>> >> Department of Mathematical and Statistics University of Houston -
>>> >> Downtown
>>> >> mailto: erinm.hodgess at gmail.com
>>> >>
>>> >
>>> >
>>> >
>>> > --
>>> > Erin Hodgess
>>> > Associate Professor
>>> > Department of Mathematical and Statistics University of Houston -
>>> Downtown
>>> > mailto: erinm.hodgess at gmail.com
>>>
>>
>>
>>
>> --
>> Erin Hodgess
>> Associate Professor
>> Department of Mathematical and Statistics
>> University of Houston - Downtown
>> mailto: erinm.hodgess at gmail.com
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> 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.
>
> ______________________________________________
> 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.



-- 
Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com



More information about the R-help mailing list