Hello,

I am trying write a script that includes a prompt for user input using
readlines() and was told that folks at R-devel might be able to help.

 I am running into the problem that when I run readlines() as a single line
the prompt works perfectly, but when I try to run a block of code which
includes the readline function, the script doesn't wait for the user input.
I have seen this question posted before when I did a search, but I didn't
find an suitable answer. Is there a means of ensuring that the script does
not proceed until a value has been entered to readline(). Can I put readline
in a function that will wait for input?

Are there other options for getting user input that allow require that the
script wait for user input?

In the code I want the user to input the value for O2sat using
O2sat=as.numeric(readline("What is the O2 saturation in umole/L?"))

The problem is that when I run this entire block of code rather than running
individual functions, the program doesn't wait for the user input and just
continues to the next line of code. Does anyone have a work around for this
type of problem?

Thanks for your help,

Nate

#################


O2sat=as.numeric(readline("What is the O2 saturation in umole/L?"))

r=function(x) {
        deltaO2=meanblank-q[2]
        umoleO2=(deltaO2/100)*O2sat
    }

umoleO2perL=r(minO2mean)
umolesO2consumed=umoleO2perL*Vial_vol
names(umoleO2consumed)="umoleO2consumed"
O2consumed=data.frame(filenames,umoleO2consumed)
O2consumed

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to