Yes, thats right, readline will give you character and now you need to
convert it to numeric to make it work.

Thanks
SmartG

On 25 July 2011 08:51, Ista Zahn <iz...@psych.rochester.edu> wrote:

> readline always returns a character. See ?readline for details.
>
> Best,
> Ista
>
> On Sun, Jul 24, 2011 at 10:59 PM, Bansal, Vikas <vikas.ban...@kcl.ac.uk>
> wrote:
> > 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: ")
> >  if(is.numeric(value)==T)
> > {return(value)
> > break}
> > else
> > 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
> > ______________________________________________
> > 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.
> >
>
>
>
> --
> Ista Zahn
> Graduate student
> University of Rochester
> Department of Clinical and Social Psychology
> http://yourpsyche.org
>
> ______________________________________________
> 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.
>



-- 
SmartG

        [[alternative HTML version deleted]]

______________________________________________
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