Re: [R] Readline

From: Jim Lemon <jim_at_bitwrit.com.au>
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



R-help_at_stat.math.ethz.ch 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. 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 https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.