a knitr question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

a knitr question

Erin Hodgess-2
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: [hidden email]

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: a knitr question

Erin Hodgess-2
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 <[hidden email]>
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: [hidden email]
>



--
Erin Hodgess
Associate Professor
Department of Mathematical and Statistics
University of Houston - Downtown
mailto: [hidden email]

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: a knitr question

Peter Alspach-2
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: [hidden email] [mailto:[hidden email]] On Behalf Of Erin Hodgess
Sent: Wednesday, 30 July 2014 10:28 a.m.
To: [hidden email]
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 <[hidden email]>
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: [hidden email]
>



--
Erin Hodgess
Associate Professor
Department of Mathematical and Statistics University of Houston - Downtown
mailto: [hidden email]

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
The contents of this e-mail are confidential and may be ...{{dropped:14}}

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: a knitr question

Yihui Xie-2
Yeah, it is just my personal opinion. Some users like it, and some do not.

Regards,
Yihui
--
Yihui Xie <[hidden email]>
Web: http://yihui.name


On Tue, Jul 29, 2014 at 5:36 PM, Peter Alspach
<[hidden email]> 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: [hidden email] [mailto:[hidden email]] On Behalf Of Erin Hodgess
> Sent: Wednesday, 30 July 2014 10:28 a.m.
> To: [hidden email]
> 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 <[hidden email]>
> 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: [hidden email]
>>
>
>
>
> --
> Erin Hodgess
> Associate Professor
> Department of Mathematical and Statistics University of Houston - Downtown
> mailto: [hidden email]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: a knitr question

Erin Hodgess-2
I was thinking that for teaching, it may be helpful for them to see the
whole thing.


On Tue, Jul 29, 2014 at 6:56 PM, Yihui Xie <[hidden email]> wrote:

> Yeah, it is just my personal opinion. Some users like it, and some do not.
>
> Regards,
> Yihui
> --
> Yihui Xie <[hidden email]>
> Web: http://yihui.name
>
>
> On Tue, Jul 29, 2014 at 5:36 PM, Peter Alspach
> <[hidden email]> 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: [hidden email] [mailto:[hidden email]]
> On Behalf Of Erin Hodgess
> > Sent: Wednesday, 30 July 2014 10:28 a.m.
> > To: [hidden email]
> > 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 <[hidden email]>
> > 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: [hidden email]
> >>
> >
> >
> >
> > --
> > Erin Hodgess
> > Associate Professor
> > Department of Mathematical and Statistics University of Houston -
> Downtown
> > mailto: [hidden email]
>



--
Erin Hodgess
Associate Professor
Department of Mathematical and Statistics
University of Houston - Downtown
mailto: [hidden email]

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: a knitr question

Richard M. Heiberger
on windows gui, right-click paste-without-prompt (or some similar phrasing) takes the prompts away.

on ESS c-u c-u c-y takes the prompts away

Rich


Sent from my iPhone

> On Jul 29, 2014, at 22:17, Erin Hodgess <[hidden email]> wrote:
>
> I was thinking that for teaching, it may be helpful for them to see the
> whole thing.
>
>
>> On Tue, Jul 29, 2014 at 6:56 PM, Yihui Xie <[hidden email]> wrote:
>>
>> Yeah, it is just my personal opinion. Some users like it, and some do not.
>>
>> Regards,
>> Yihui
>> --
>> Yihui Xie <[hidden email]>
>> Web: http://yihui.name
>>
>>
>> On Tue, Jul 29, 2014 at 5:36 PM, Peter Alspach
>> <[hidden email]> 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: [hidden email] [mailto:[hidden email]]
>> On Behalf Of Erin Hodgess
>>> Sent: Wednesday, 30 July 2014 10:28 a.m.
>>> To: [hidden email]
>>> 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 <[hidden email]>
>>> 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: [hidden email]
>>>
>>>
>>>
>>> --
>>> Erin Hodgess
>>> Associate Professor
>>> Department of Mathematical and Statistics University of Houston -
>> Downtown
>>> mailto: [hidden email]
>
>
>
> --
> Erin Hodgess
> Associate Professor
> Department of Mathematical and Statistics
> University of Houston - Downtown
> mailto: [hidden email]
>
>    [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: a knitr question

Ista Zahn
In reply to this post by Erin Hodgess-2
On Tue, Jul 29, 2014 at 10:17 PM, Erin Hodgess <[hidden email]> 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 <[hidden email]> wrote:
>
>> Yeah, it is just my personal opinion. Some users like it, and some do not.
>>
>> Regards,
>> Yihui
>> --
>> Yihui Xie <[hidden email]>
>> Web: http://yihui.name
>>
>>
>> On Tue, Jul 29, 2014 at 5:36 PM, Peter Alspach
>> <[hidden email]> 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: [hidden email] [mailto:[hidden email]]
>> On Behalf Of Erin Hodgess
>> > Sent: Wednesday, 30 July 2014 10:28 a.m.
>> > To: [hidden email]
>> > 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 <[hidden email]>
>> > 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: [hidden email]
>> >>
>> >
>> >
>> >
>> > --
>> > Erin Hodgess
>> > Associate Professor
>> > Department of Mathematical and Statistics University of Houston -
>> Downtown
>> > mailto: [hidden email]
>>
>
>
>
> --
> Erin Hodgess
> Associate Professor
> Department of Mathematical and Statistics
> University of Houston - Downtown
> mailto: [hidden email]
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: a knitr question

glsnow
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 <[hidden email]> wrote:

> On Tue, Jul 29, 2014 at 10:17 PM, Erin Hodgess <[hidden email]> 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 <[hidden email]> wrote:
>>
>>> Yeah, it is just my personal opinion. Some users like it, and some do not.
>>>
>>> Regards,
>>> Yihui
>>> --
>>> Yihui Xie <[hidden email]>
>>> Web: http://yihui.name
>>>
>>>
>>> On Tue, Jul 29, 2014 at 5:36 PM, Peter Alspach
>>> <[hidden email]> 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: [hidden email] [mailto:[hidden email]]
>>> On Behalf Of Erin Hodgess
>>> > Sent: Wednesday, 30 July 2014 10:28 a.m.
>>> > To: [hidden email]
>>> > 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 <[hidden email]>
>>> > 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: [hidden email]
>>> >>
>>> >
>>> >
>>> >
>>> > --
>>> > Erin Hodgess
>>> > Associate Professor
>>> > Department of Mathematical and Statistics University of Houston -
>>> Downtown
>>> > mailto: [hidden email]
>>>
>>
>>
>>
>> --
>> Erin Hodgess
>> Associate Professor
>> Department of Mathematical and Statistics
>> University of Houston - Downtown
>> mailto: [hidden email]
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] 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.
>
> ______________________________________________
> [hidden email] 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.
[hidden email]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: a knitr question

Yihui Xie-2
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.

Regards,
Yihui
--
Yihui Xie <[hidden email]>
Web: http://yihui.name


On Wed, Jul 30, 2014 at 12:50 PM, Greg Snow <[hidden email]> 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: a knitr question

Duncan Murdoch-2
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 <[hidden email]>
> Web: http://yihui.name
>
>
> On Wed, Jul 30, 2014 at 12:50 PM, Greg Snow <[hidden email]> 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.
>>
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: a knitr question

Joshua Wiley-2
On Thu, Jul 31, 2014 at 9:47 AM, Duncan Murdoch <[hidden email]>
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.



> Duncan Murdoch
>
>
> > Regards,
> > Yihui
> > --
> > Yihui Xie <[hidden email]>
> > Web: http://yihui.name
> >
> >
> > On Wed, Jul 30, 2014 at 12:50 PM, Greg Snow <[hidden email]> 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.
> >>
> >
> > ______________________________________________
> > [hidden email] 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.
> >
>
> ______________________________________________
> [hidden email] 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.
>



--
Joshua F. Wiley
Ph.D. Student, UCLA Department of Psychology
http://joshuawiley.com/
Senior Analyst, Elkhart Group Ltd.
http://elkhartgroup.com
Office: 260.673.5518

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: a knitr question

Michael Hannon-2
That's what I thought.  Also, just FYI, the "ed" editor on *nix
systems doesn't have a prompt (at least not by default).  My son
thought I was "trolling" him when I told him that.

-- Mike

On Wed, Jul 30, 2014 at 5:06 PM, Joshua Wiley <[hidden email]> wrote:

> On Thu, Jul 31, 2014 at 9:47 AM, Duncan Murdoch <[hidden email]>
> 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.
>
>
>
>> Duncan Murdoch
>>
>>
>> > Regards,
>> > Yihui
>> > --
>> > Yihui Xie <[hidden email]>
>> > Web: http://yihui.name
>> >
>> >
>> > On Wed, Jul 30, 2014 at 12:50 PM, Greg Snow <[hidden email]> 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.
>> >>
>> >
>> > ______________________________________________
>> > [hidden email] 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.
>> >
>>
>> ______________________________________________
>> [hidden email] 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.
>>
>
>
>
> --
> Joshua F. Wiley
> Ph.D. Student, UCLA Department of Psychology
> http://joshuawiley.com/
> Senior Analyst, Elkhart Group Ltd.
> http://elkhartgroup.com
> Office: 260.673.5518
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: a knitr question

Duncan Murdoch-2
In reply to this post by Joshua Wiley-2
On 30/07/2014, 8:06 PM, Joshua Wiley wrote:

> On Thu, Jul 31, 2014 at 9:47 AM, Duncan Murdoch
> <[hidden email] <mailto:[hidden email]>> 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

>
>  
>
>     Duncan Murdoch
>
>
>     > Regards,
>     > Yihui
>     > --
>     > Yihui Xie <[hidden email] <mailto:[hidden email]>>
>     > Web: http://yihui.name
>     >
>     >
>     > On Wed, Jul 30, 2014 at 12:50 PM, Greg Snow <[hidden email]
>     <mailto:[hidden email]>> 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.
>     >>
>     >
>     > ______________________________________________
>     > [hidden email] <mailto:[hidden email]> 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.
>     >
>
>     ______________________________________________
>     [hidden email] <mailto:[hidden email]> 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.
>
>
>
>
> --
> Joshua F. Wiley
> Ph.D. Student, UCLA Department of Psychology
> http://joshuawiley.com/
> Senior Analyst, Elkhart Group Ltd.
> http://elkhartgroup.com
> Office: 260.673.5518

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: a knitr question

Yihui Xie-2
In reply to this post by Duncan Murdoch-2
No. That is not my suggestion. Joshua Wiley correctly explained what I
was suggesting. Prompts are useful in the R console, but not
necessarily in a report.

Regards,
Yihui
--
Yihui Xie <[hidden email]>
Web: http://yihui.name


On Wed, Jul 30, 2014 at 6:47 PM, Duncan Murdoch
<[hidden email]> wrote:
> 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

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: a knitr question

Rolf Turner
In reply to this post by Joshua Wiley-2
On 31/07/14 12:06, Joshua Wiley wrote:

<SNIP>

> 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.

Surely that should be left up to the user.  And as Erin pointed out in
her second message, it is.  The default is no prompt --- which seems to
be the style desired by you and Yihui --- but setting prompt=TRUE inside
the << >> gives prompts for those who want them in their documents.

Since the default is "no prompt", the only meaningful interpretation of
Yihui's post was the way that Duncan interpreted it.

cheers,

Rolf Turner

--
Rolf Turner
Technical Editor ANZJS

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: a knitr question

Ista Zahn
On Thu, Jul 31, 2014 at 4:28 AM, Rolf Turner <[hidden email]> wrote:

> On 31/07/14 12:06, Joshua Wiley wrote:
>
> <SNIP>
>
>
>> 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.
>
>
> Surely that should be left up to the user.  And as Erin pointed out in her
> second message, it is.  The default is no prompt --- which seems to be the
> style desired by you and Yihui --- but setting prompt=TRUE inside the << >>
> gives prompts for those who want them in their documents.
>
> Since the default is "no prompt", the only meaningful interpretation of
> Yihui's post was the way that Duncan interpreted it.

I have no idea why we are parsing Yihui's sentence so carefully and
critically. Yes, in isolation it is ambiguous, but in the context of
the thread it is perfectly clear. The whole conversation is whether it
is a good idea for the user to set <<prompt=TRUE>>.

Best,
Ista

>
> cheers,
>
> Rolf Turner
>
> --
> Rolf Turner
> Technical Editor ANZJS
>
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: a knitr question

Duncan Murdoch-2
In reply to this post by Yihui Xie-2
On 30/07/2014, 11:12 PM, Yihui Xie wrote:
> No. That is not my suggestion. Joshua Wiley correctly explained what I
> was suggesting. Prompts are useful in the R console, but not
> necessarily in a report.

Okay, then we agree.  For Erin's purpose (teaching), it is helpful to
beginners if the document looks the same as what they see in the
console.  More sophisticated users don't need the prompts.

Duncan Murdoch

>
> Regards,
> Yihui
> --
> Yihui Xie <[hidden email]>
> Web: http://yihui.name
>
>
> On Wed, Jul 30, 2014 at 6:47 PM, Duncan Murdoch
> <[hidden email]> wrote:
>> 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

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: a knitr question

Yihui Xie-2
Great.

I also said "I see the point of keeping prompts", and that is why the
chunk option prompt=TRUE is provided in knitr. I may not agree with
your preference, but that does not mean I should stop you completely
from having your own preference.

Regards,
Yihui
--
Yihui Xie <[hidden email]>
Web: http://yihui.name


On Thu, Jul 31, 2014 at 6:34 AM, Duncan Murdoch
<[hidden email]> wrote:

> On 30/07/2014, 11:12 PM, Yihui Xie wrote:
>> No. That is not my suggestion. Joshua Wiley correctly explained what I
>> was suggesting. Prompts are useful in the R console, but not
>> necessarily in a report.
>
> Okay, then we agree.  For Erin's purpose (teaching), it is helpful to
> beginners if the document looks the same as what they see in the
> console.  More sophisticated users don't need the prompts.
>
> Duncan Murdoch

______________________________________________
[hidden email] 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.