On Fri, 12 May 2006, SUMANTA BASAK wrote:

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

as.numeric(readline("Give the value of x: "))


-- 
Brian D. Ripley,                  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
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

Reply via email to