[R] Getting scan() -command to work during the program run

Atte Tenkanen attenka at utu.fi
Tue Dec 20 17:11:23 CET 2016


Hi Bert,

I tried using the function, but still the same problem. If there is 
something after the scan-line, scan does not let me to enter any input 
but the program just run forward like before.

I have OSX 10.9.5. and R 3.3.2.

Atte

20.12.2016, 17.19, Bert Gunter kirjoitti:
> ??
>
>> f <- function() {X <- scan(n =1); X}
>> f()
> 1: 3
> Read 1 item
>
>
>
> -- Bert
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along
> and sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On Tue, Dec 20, 2016 at 12:37 AM, Atte Tenkanen <attenka at utu.fi> wrote:
>> Hi,
>>
>> How to get scan(file="") command to ask my input from the keyboard?
>>
>> If I put the command straight to the console it works
>>
>>> X1 <- scan(n=1)
>> 1: 22
>> Read 1 item
>>
>> but as a part of a program it just continues without asking my value?
>>
>>> X1 <- scan(n=1)
>> 1:
>> Read 0 items
>>
>> Yours,
>>
>> Atte Tenkanen
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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.

-- 
Atte Tenkanen, FT MuM
Turun Martinseurakunnan kanttori
p. 040-3417125



More information about the R-help mailing list