-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kaushik Krishnan wrote:
> Is there any way to make R stop for the user to enter values when
> running in batch mode either by changing the way I invoke scan() or
> readLines() or by using any other function?

At least on linux this works:

be...@t40:~/r-test $ cat test.R

readline2 = function(prompt=""){
        cat(prompt)
        readLines("stdin", 1)
}

print(readline2("enter a number: "))

be...@t40:~/r-test $ Rscript test.R
enter a number: 42
[1] "42"


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFK5xUSxT6R4jlFoh0RAkhTAKCB4qUjPlULL9vjUaLLxarTor2z1QCeNGHA
4B2VmkqtyEKMKKGUnt8sjiY=
=VYJs
-----END PGP SIGNATURE-----

______________________________________________
R-help@r-project.org 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.

Reply via email to