Hi guys,

I examined lots of manuals' examples  but I could not exactly manage what I 
wanted. I want to insert a function in my test code and make it an interactive 
and semi-automatic process. I want the user to enter a valid number before being 
able to continue and then I want the code to use that number as an input to the 
next command. If the thing user supplied is not a valid number, I want the code 
ask again and again until the proper response comes. How can I do this. That 
part of my code looks like this:

rm(list=ls())
library(gtools)
library(YaleToolkit)
library(xts)
 
### start of my wrong function! 
f<-function(w){
 w<-readline("which data? ")
 w<-as.numeric(w)
 ifelse(is.numeric(w)=="TRUE", w, f())
 }
f()
##### end of my wrong function

v<- ## and output of my function should be a "v" for example which I can use it 
in the next line (v<-w  or something like that??)
 
##the rest works fine
p<-paste("t", v, ".txt", sep = "")
t<-read.table(p, header=FALSE, sep="\t", dec=",", 
blank.lines.skip=FALSE)
rownames(t)<-as.Date(t[,1],"%d.%m.%Y")
colnames(t)<-c("date","start","high","low","end","w.average","lot",
"volume")
x<-as.xts(t) 
whatis(x)   
.
.

Could you help me with this problem?

Best,
Fatih



      
	[[alternative HTML version deleted]]

