[R] For is.numeric condition in user input

Bansal, Vikas vikas.bansal at kcl.ac.uk
Mon Jul 25 04:59:33 CEST 2011

Dear all,

I am using the following function so that user can input a numerical value.

readnumber<- function() 
for(j in 1:10){
 value=readline("enter the threshold for number of reads: ")
print("wrong number Please enter numerical value ")} 

But if by chance user tries to put character it will show the message-
 wrong number Please enter numerical value

now when I am calling this function and entering numerical value,then also it is showing the message-wrong number Please enter numerical value

Can you please tell me what mistake I am doing?

Thanking you,
Warm Regards
Vikas Bansal
Msc Bioinformatics
Kings College London

More information about the R-help mailing list