[R] Help In Function

From: SUMANTA BASAK <r_econometrics_at_yahoo.co.in>
Date: Fri 12 May 2006 - 16:32:05 EST


Hi All,

I need a basic help from you. I've built a function like this,

windowlength<-function(x)
{

z <- rep(seq(0,331,by=x-1)+1, each=2)                      
zz <- z[-c(1,length(z))]                                   
ind <- as.data.frame(matrix(zz, nr=2))                     
j<-lapply(ind, function(x) mat[x[1]:x[2],])                
cat("For",x/4,"month number of windows is = ",length(ind),"\n") }
windowlength(x=12)

I need to know how can i give command in "R" so that instead of giving the last line, i.e "R" will ask the user to give the value of x? I mean to say, 1) It will ask user "Give the value of x" 2) Then user inputs 12, and R gives the ultimate result.

Thanks,
Sumanta Basak.                                 



 What makes Sachin India's highest paid sports celebrity?, Share your knowledge on Yahoo! India Answers  Send instant messages to your online friends - NOW

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri May 12 16:39:30 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 12 May 2006 - 18:10:05 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.