[R] readline() is reading the entire line and not just the user input

jim holtman jholtman at gmail.com
Thu Mar 19 02:31:04 CET 2009


It might be.  I use Tinn-R, but always start my RGUI session
separately and not as part of Tinn-R.

On Wed, Mar 18, 2009 at 9:14 PM, Farrel Buchinsky <fjbuch at gmail.com> wrote:
> Indeed. I can also get it to work if I type directly in Rterm. But not when
> running from Tinn-R. If this is a Tinn-R problem (relating to however
> command lines get from Tinn-R to the Rterm) then perhaps I should post it in
> the Tinn-R problem.
> Farrel Buchinsky
>
>
> Sent from: Pittsburgh Pennsylvania United States.
>
> On Mon, Mar 16, 2009 at 13:08, jim holtman <jholtman at gmail.com> wrote:
>>
>> Seems to work fine with RTERM under my Windows:
>>
>> > ANSWER <- readline(prompt="Are you a satisfied R user? ")
>> Are you a satisfied R user? yes
>> > ANSWER
>> [1] "yes"
>> >
>>
>> > sessionInfo()
>> R version 2.8.1 (2008-12-22)
>> i386-pc-mingw32
>>
>> On Mon, Mar 16, 2009 at 12:44 PM, Farrel Buchinsky <fjbuch at gmail.com>
>> wrote:
>> > I just discovered readline to provide user input. It is working as one
>> > would expect in Rgui but not in Rterm. In Rterm it reads the entire
>> > line of code not just the user input. How do I fix and what is the
>> > issue that I should read about?
>> >
>> >
>> > Here is my two line script:
>> > ANSWER <- readline(prompt="Are you a satisfied R user? ")
>> > ANSWER
>> > So under RGUI one gets the following
>> >> ANSWER <- readline(prompt="Are you a satisfied R user? ")
>> > Are you a satisfied R user? yes
>> >> ANSWER
>> > [1] "yes"
>> >
>> > Under RTERM one gets
>> >> ANSWER <- readline(prompt="Are you a satisfied R user? ")yes
>> > Are you a satisfied R user?
>> >> ANSWER
>> > [1] "ANSWER <- readline(prompt=\"Are you a satisfied R user? \")yes"
>> >
>> > So I tried to hit enter after I saw the line in the terminal and this
>> > is what I got:
>> >
>> >> ANSWER <- readline(prompt="Are you a satisfied R user? ")
>> > Are you a satisfied R user?
>> >> ANSWER
>> > [1] "ANSWER <- readline(prompt=\"Are you a satisfied R user? \")"
>> >
>> > My R environment: Windows XP with service pack 3; R 2.8.1, tinn-R
>> > 2.2.0.2
>> >
>> >
>> > Farrel Buchinsky
>> >
>> > ______________________________________________
>> > 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.
>> >
>>
>>
>>
>> --
>> Jim Holtman
>> Cincinnati, OH
>> +1 513 646 9390
>>
>> What is the problem that you are trying to solve?
>
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list