To Arun;

Thanks although that link did not provide answers to me.. but I will never 
use the remove all syntax again while posting messages here, thanks again for 
the proper warning.. 



To all [R-SIG-Finance] family; 

My concern is to create an automated process from the beginning to the end. I 
want to copy all my code together in one piece and paste it to R console and sit 
back and relax :) except one moment in which the program should ask me to enter 
a number.. and only then (only after getting a valid number from me) it should 
continue to read and process the rest of the code. I tried lots of things 
(readline, readLines, scan, interactive, ask, switch,...) and read manuals and 
searched help forums.. I found several similar questions but never a satisfying 
answer.. so now it became a challenge.. any idea how to overcome this problem (R 
2.11.1 for Windows)? more specific info on my problem is in "Message 8" below. 

Best,
Fatih

------------------------------

Message: 8
Date: Tue, 28 Sep 2010 00:35:57 -0700 (PDT)

To: r-sig-finance@stat.math.ethz.ch
Subject: [R-SIG-Finance] interactive session
Message-ID: <989282.9524.qm@web52708.mail.re2.yahoo.com>
Content-Type: text/plain

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:

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]]



------------------------------

Message: 9
Date: Tue, 28 Sep 2010 01:00:31 -0700 (PDT)
From: "Arun.stat" <arun.kumar.saha@gmail.com>
To: r-sig-finance@stat.math.ethz.ch
Subject: Re: [R-SIG-Finance] interactive session
Message-ID: <1285660831654-2716756.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


Dear Fatih, if your problem is to let user to provide inputs of a function
interactively then perhaps
"http://r.789695.n4.nabble.com/Supplying-function-inputs-interactively-td2536003.html#a2536003"

may be with some help.

PS: please never use the syntax "rm(list=ls())" when you give any example.
User suddenly might find all his works gone if he tries to replicate your
code in his current work session without noticing each and every details.

Thanks,

-- 
View this message in context: 
http://r.789695.n4.nabble.com/interactive-session-tp2716730p2716756.html
Sent from the Rmetrics mailing list archive at Nabble.com.



------------------------------

_______________________________________________
R-SIG-Finance mailing list
R-SIG-Finance@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-finance


End of R-SIG-Finance Digest, Vol 76, Issue 24
*********************************************



      
	[[alternative HTML version deleted]]

