Skip to content
Prev 173871 / 398506 Next

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

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
Are you a satisfied R user? yes
[1] "yes"

Under RTERM one gets
Are you a satisfied R user?
[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:
Are you a satisfied R user?
[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