Re: [Rd] R --interactive and readline() creates infinite loop

2008-09-26 Thread Jon Clayden
2008/9/25 Peter Dalgaard <[EMAIL PROTECTED]>: > John Chambers wrote: >> >> My application, at least, wanted to show (my class) individual commands >> from the file and then optionally insert some typed commands before going on >> to the next part of the source file. As far as I can see, the piped s

Re: [Rd] R --interactive and readline() creates infinite loop

2008-09-25 Thread Peter Dalgaard
John Chambers wrote: My application, at least, wanted to show (my class) individual commands from the file and then optionally insert some typed commands before going on to the next part of the source file. As far as I can see, the piped shell command approach will have to treat the whole file

Re: [Rd] R --interactive and readline() creates infinite loop

2008-09-25 Thread Jon Clayden
Many thanks for the suggestions. The use case I had in mind is more along the lines of what Peter Dalgaard mentioned, and his solution looks ideal. I know in advance exactly what code I want to run, but some of that code may require user input. Jon 2008/9/25 John Chambers <[EMAIL PROTECTED]>: >

Re: [Rd] R --interactive and readline() creates infinite loop

2008-09-25 Thread John Chambers
My application, at least, wanted to show (my class) individual commands from the file and then optionally insert some typed commands before going on to the next part of the source file. As far as I can see, the piped shell command approach will have to treat the whole file at one time. John Pe

Re: [Rd] R --interactive and readline() creates infinite loop

2008-09-25 Thread Peter Dalgaard
hadley wickham wrote: >> I assume, given this outcome, that this is not the intended use of >> --interactive, but I still wonder if there is any way to achieve an >> interactive session based on a predefined set of commands without writing a >> completely new front-end (overkill, surely?). >>

Re: [Rd] R --interactive and readline() creates infinite loop

2008-09-25 Thread hadley wickham
> I assume, given this outcome, that this is not the intended use of > --interactive, but I still wonder if there is any way to achieve an > interactive session based on a predefined set of commands without writing a > completely new front-end (overkill, surely?). When you say an interactive sessi

Re: [Rd] R --interactive and readline() creates infinite loop

2008-09-25 Thread Peter Dalgaard
One canonical way of doing it is: (echo 'print(readline("Input:"))'; cat -) | R --interactive --no-save (you don't want to leave out --no-save ) John Chambers wrote: > For an alternative approach to your original goal, take a look at > demoSource() in the SoDA package from CRAN. It's a bit

Re: [Rd] R --interactive and readline() creates infinite loop

2008-09-25 Thread John Chambers
For an alternative approach to your original goal, take a look at demoSource() in the SoDA package from CRAN. It's a bit tedious to set up (see the Details section of the help file) but uses standard R sessions to mix lines from a demo file and interactive input. John Jon Clayden wrote: Dea