[R] readline in function call with space in prompt.

Karl Ropkins K@Ropk|n@ @end|ng |rom |t@@|eed@@@c@uk
Tue Feb 9 12:24:49 CET 2021


Not on a machine with latest R at moment so not ruling out something there, but it is working fine for me.
Karl

R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)

------------------------------

Message: 9
Date: Tue, 9 Feb 2021 10:21:58 +1300
From: Rolf Turner <r.turner using auckland.ac.nz>
To: Jeremie Juste <jeremiejuste using gmail.com>
Cc: r-help using r-project.org
Subject: Re: [R] readline in function call with space in prompt.
Message-ID: <20210209102158.5b04117d using rolf-Latitude-E7470>
Content-Type: text/plain; charset="windows-1252"


On Mon, 08 Feb 2021 14:28:33 +0100
Jeremie Juste <jeremiejuste using gmail.com> wrote:

> Hello,
>
> I have noticed a behavior that I don't understand. When I call the
> following function from the prompt.
> test <- function(){
>     a <- readline("selection: ")
>     a
> }
>
> > test()
> > selection: |
> I can only type one character and the readline function exits before
> I can press enter.
>
> however
>
> test1 <- function(){
>     a <- readline("selection:")
>     a
> }
> > test1()
> > selection:|
> works as expected.
> > selection: abc[Ret]
>
> However calling directly readline with a space in the prompt does
> what I would expect.
>
> > a <- readline("selection: ")
> > selection: abc[Ret]
> > a
> > "abc"
>
> It is the expected behavior or am I missing something?

Works fine for me, with or without the space in the prompt string.
There *must* be something flaky in your system, but I'm damned if I can
come up with any useful suggestions for tracking down just where that
flakiness lies.  Sorry.

Perhaps try re-installing R???

cheers,

Rolf Turner

--
Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276





	[[alternative HTML version deleted]]



More information about the R-help mailing list