Re: [R] Ignore error t.test in a loop

2008-02-02 Thread Christian Ritz
Hi,

have a look at ?try which leads to using a construct of the following 
form:

myTtest <- try(t.test(...))
if (inherits(myTtest, "try-error"))
{
 cat(myTtest)
 myTtest <- NA
}


Christian

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


Re: [R] Ignore error t.test in a loop

2008-02-02 Thread jim holtman
?try

e.g.,

for(i in x) try(t.test(...))



On Feb 2, 2008 7:43 AM, My Coyne <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I place a t.test in a loop and would like to continue to process the loop
> even when t.test encounter error.  How do I do that?For example, in one
> iteration, the data is completely constant and t.test gives error, the
> entire program terminates.  I would like to write the information out to a
> file, and the loop should continue.
>
>
>
> Thanks
>
>
>
> My D. Coyne
>
>
>[[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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

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


[R] Ignore error t.test in a loop

2008-02-02 Thread My Coyne
Hi,

I place a t.test in a loop and would like to continue to process the loop
even when t.test encounter error.  How do I do that?For example, in one
iteration, the data is completely constant and t.test gives error, the
entire program terminates.  I would like to write the information out to a
file, and the loop should continue.

 

Thanks

 

My D. Coyne


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