[R] How to make t.test handle NA and essentially constant values ?

2008-02-12 Thread Ng Stanley
Hi, First problem: test - matrix(c(1,1,2,1), 2,2) apply(test, 1, function(x) { t.test(x) $p.value }) Error in t.test.default(x) : data are essentially constant Second problem: test - matrix(c(1,0,NA,1), 2,2) apply(test, 1, function(x) { t.test(x) $p.value }) Error in t.test.default(x) : not

Re: [R] How to make t.test handle NA and essentially constant values ?

2008-02-12 Thread Ng Stanley
Thanks, that problem looks very similar to mine. try is a nice hack. I was thinking t.test would be intelligent enough to display NA if there are any problems than to terminated. On 2/12/08, Richard Pearson [EMAIL PROTECTED] wrote: Do you mean to deal with the situation where you're doing many

Re: [R] How to make t.test handle NA and essentially constant values ?

2008-02-12 Thread Richard Pearson
Do you mean to deal with the situation where you're doing many t-tests in a loop? If so there was a post very recently on this list about this: https://stat.ethz.ch/pipermail/r-help/2008-February/153254.html Richard. Ng Stanley wrote: Thanks. Someone please help to make t.test go through all

Re: [R] How to make t.test handle NA and essentially constant values ?

2008-02-12 Thread Ng Stanley
Thanks. Someone please help to make t.test go through all the data and not to be disrupted by the two problems. On 2/12/08, Petr PIKAL [EMAIL PROTECTED] wrote: Hi [EMAIL PROTECTED] napsal dne 12.02.2008 09:09:23: Hi, First problem: test - matrix(c(1,1,2,1), 2,2) apply(test, 1,

Re: [R] How to make t.test handle NA and essentially constant values ?

2008-02-12 Thread Ng Stanley
I met with a problem. The previous post dealt with loop, but mine is used in apply(). Please help. On 2/12/08, Ng Stanley [EMAIL PROTECTED] wrote: Thanks, that problem looks very similar to mine. try is a nice hack. I was thinking t.test would be intelligent enough to display NA if there are