Hello,
First of all, x and y don't seem to be lists, they seem to be matrices.
Second, the instrucions a<<-x[,i] and b<<-y[,j] change the variables
a
and b that exist outside the function. Why?
Third, exactly what do you mean by "crash"? What is the error message?
Finally, your example, as is, is not reproducible. Your function has no
name? How are you calling it?
Hope this helps,
Rui Barradas
Em 01-03-2014 16:26, Levent TERLEMEZ escreveu:> Dear Users,
>
> I have a problem with cvm.test using with for loop. It makes R crash while
calculating. In the function, x and y are lists, also for loops controls the
columns that will be tested:
>
> function (x,y)
> {
> cval=matrix(ncol=dim(x)[2],nrow=dim(x)[2])
> for(i in 1:(ncol(x)-1))
> {
> a<<-x[,i]
> #print('a')
> #print(a)
> for(j in (i+1):ncol(x))
> {
> b<<-y[,j]
> #print('b')
> #print(b)
> cval[i,j]<-cvmts.test(a,b)
> #print(ab)
> }
> }
> return(cval)
> }
>
> Thanks for your kind helps in advanced,
> Levent TERLEMEZ.
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>