Make R (statistics package) wait for keyboard prompt when run within a bash script

前端 未结 5 914
别跟我提以往
别跟我提以往 2021-02-15 13:14

I am using R to generate a series of plots within a loop, with the user hitting the enter key to indicate they have seen the plot and it is time to move on. These are interacti

5条回答
  •  野的像风
    2021-02-15 13:46

    Use this:

    readLines("stdin", n = 1)
    

    That will get the real stdin instead of what stdin() uses.

    I'd invoke it with:

    Rscript myfile.r
    

提交回复
热议问题