[R] how to ignore t.test error message

Liaw, Andy andy_liaw at merck.com
Mon Dec 27 20:08:01 CET 2004


See ?try (as Uwe said) or ?tryCatch.

Andy

> From: burak kutlu
> 
> Hi 
> Although t.test does not give an error with
> t.test(c(0, 0), c(0, 0));
> 
> if you try doing that with any number other than 0, 
> 
> > t.test(c(1,1),c(1,1))
> 
> (R gives the following error)
> 
> 
> Error in t.test.default(c(1, 1), c(1, 1)) : 
> 	data are essentially constant
> 
> The logic in insisting is that my data has different
> columns, and I'd like to tolerate if in one of the
> columns, the data fail to pass the t.test.
> 
> Thanks
> Burak
> 
> --- Uwe Ligges <ligges at statistik.uni-dortmund.de>
> wrote:
> 
> > burak kutlu wrote:
> > > Hello,
> > > I was wondering if there is a way to ignore the
> > error
> > > message you get when some of the data means you
> > > compare are constant in some lines of your data
> > frame.
> > 
> > What does the error message say exactly?
> > Do you have an example?
> > 
> > Even with the degenerated case
> >    t.test(c(0, 0), c(0, 0))
> > I don't get any error message.
> > 
> > 
> > > I'd like to go ahead with t.test 
> > 
> > See ?try
> > 
> > > and get the calculated p-values anyway in such a
> > case.
> > 
> > And what is the p-value in such a case?
> > 
> > I guess I haven't understood the problem correctly,
> > so please be more 
> > specific!
> > 
> > Uwe Ligges
> > 
> > 
> > > Thanks
> > > -burak
> > > 
> > > ______________________________________________
> > > R-help at 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
> > 
> >
> 
> ______________________________________________
> R-help at 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
> 
>




More information about the R-help mailing list