Re: [R] Readline

From: Jim Lemon <>
Date: Mon, 18 Jun 2007 21:43:23 +1000

Antje wrote:
> Hello,
> I also have problems to get to run the following lines. If I run the
> block instead of every single line, it simply does not wait for the input.
> Can anybody help me?
> ------------------------
> pos_name <- readline("Please type: ")
> r <- substr(pos_name, 1,1)
> c <- substr(pos_name, 2,nchar(pos_name))
> ------------------------
Hi Antje,
What you seem to be doing is pasting the lines into the R window. The second line looks like the input line that the first line is expecting, and if you remove the empty line, you will see that pos_name has been assigned the text of the second line.

If you put these lines into a text file and then use "source" to read it, it works as I think you expect.

Jim mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Mon 18 Jun 2007 - 11:48:15 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 18 Jun 2007 - 13:32:01 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.