You could look into ' try' and set it up to catch errors and do the appropriate thing in your error handler. I don't have the exact syntax at hand right now but looking at ?try or ?tryCatch I think will do what you want.
Kevin ---- Alexandra Almeida <alexandra...@gmail.com> wrote: > Hi everybody! > > I´m with a problem that probably is easy for you, but I really don´t know > how to solve. > On the following script: > > for(j in 1:length(limiares)) > { > excessos<-limiares[j]-estacao[estacao<limiares[j]] > par.ests<-gpd(-(estacao),threshold=-limiares[j],method=c("pwm"))$par.est > > GOF.test<-ks.test(excessos,"pgpd",xi=par.ests[1],beta=par.ests[2])$p.value > > tabs[j,]<-c(par.ests,gpd(-(estacao),threshold=-limiares[j],method=c("pwm"))$par.ses,GOF.test,length(excessos)) > } > > I´ve found the error for some values of i: Erro em ks.test(excessos, "pgpd", > xi = par.ests[1], beta = par.ests[2]) : NA/NaN/Inf em chamada de função > externa (argumento 1) > > *My question is: This warning stop the "for" and I don´t want it, is there > some way to continue the "for", and for the cases where the function cannot > calculate the ks.test for the i just leave a NA as answer???* > > Thank you *very much*!!! > > Alexandra Almeida > > > > -- > Alexandra R M de Almeida > > [[alternative HTML version deleted]] > ______________________________________________ R-help@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.