Hi thanks for the answer.
I have so vast majority of vectors that some distributions will not work for 
some cases but they work for others pretty well. This is the reason I store 
only those that worked to helpe get a coarse understanding how to proceed. If 
you have a better idea let me know





On Friday, February 14, 2014 10:35 AM, Frede Aakmann Tøgersen 
<fr...@vestas.com> wrote:
 
Hi

See

?try
?tryCatch

So you still want to do these distribution tests even though you have been 
warned not to?

Yours sincerely / Med venlig hilsen


Frede Aakmann Tøgersen
Specialist, M.Sc., Ph.D.
Plant Performance & Modeling

Technology & Service Solutions
T +45 9730 5135
M +45 2547 6050
fr...@vestas.com
http://www.vestas.com

Company reg. name: Vestas Wind Systems A/S
This e-mail is subject to our e-mail disclaimer statement.
Please refer to www.vestas.com/legal/notice
If you have received this e-mail in error please contact the sender. 



> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of Alaios
> Sent: 14. februar 2014 10:14
> To: R-help@r-project.org
> Subject: [R] Ignore errors and proceed to next
> 
> Hi all,
> I have a very large number of vectors that I want first to look fast which
> distribution might be considered candidate for fitting.
> I made a simple loop that checks for all vector (the code below is for one
> vector and being called for each vector separately). If a good fit is found 
> this
> is dumped to a txt file so to allow me later on, see results
> 
> distList<-c("norm","exp","gamma","lnorm")
>     for (dist in distList) {
> 
>         if (gofstat(fitdist(onVector,distr=dist))$kstest =="not rejected"){
>         # keep it
>           out<-capture.output(gofstat(fitdist(onVector,distr=distr))$ks)
>           print(sprintf("Saving to file %s ",filename))
>           cat(out,file=paste(filename,".txt",sep=""),sep="\n",append=TRUE)
> 
>         }
>     }
> the major problem is that these for loops return errors (sometimes for a
> given vector a specific distribution does not make sense or the vector might
> be zero or containing only many times the same element)    . The easiest
> would be in errors and warning just move to the next element of the for
> loop.
> Something like that
> 
> for ()
> {
>  if error==skip to next element
>  else do normal stuff
> }
> how I can do that in R?
> Regards
> Alex
>     [[alternative HTML version deleted]]
        [[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.

Reply via email to