Hi,

I am trying to read some value from keyboard in one of my R program. I want
to do manipulation on data based on this value. But I am facing a problem
which is described below with the help of an example:

My code is similar to:

:
:
cat("\n","Enter value:: ","\n")
y<-scan(n=1)
a <- b*y
cat("\n","Enter new value::","\n")
y<-scan(n=1)
:
:

Now if I run the whole script then something like this happens:

:
:
cat("\n","Enter value::","\n")

 Enter value::
> y<-scan(n=1)
1: a <- b*y
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
:
        scan() expected 'a real', got 'a'
> cat("\n","Enter new value::","\n")

 Enter new value::
> y<-scan(n=1)
1: 2
Read 1 item
:
:

Is there any solution to this problem or shall I execute my script in two
parts:
First part:

:
:
cat("\n","Enter value:: ","\n")
y<-scan(n=1)

and second part:

a <- b*y
cat("\n","Enter new value::","\n")
y<-scan(n=1)
:
:

Any help will be greatly appreciated.
-- 
Thanks & Regards
Sarthi M.

	[[alternative HTML version deleted]]

