Ng Stanley
2008-Feb-12 08:09 UTC
[R] How to make t.test handle "NA" and "essentially constant values" ?
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 enough 'x' observations How to make t-test ignores this errors ? [[alternative HTML version deleted]]
Petr PIKAL
2008-Feb-12 08:42 UTC
[R] Odp: How to make t.test handle "NA" and "essentially constant values" ?
Hi r-help-bounces at r-project.org napsal dne 12.02.2008 09:09:23:> 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 constantmake your data not 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 enough 'x' observationsincrease number of observations> > How to make t-test ignores this errors ?Well, the procedure is complaining that you do not give it correct data. You shall be gratefull for a great software which prevent you from making silly things as try to compute t.test when data have zero variantion or number of observations is 1. Regards Petr> > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.
Maybe Matching Threads
- How to generate table output of t-test
- add/subtract matrices, ignoring NA or missing values
- counts of each column that are not NA, and/or greater than column means
- Is text(..., adj) upside down? (Or am I?)
- treatment of zero and negative elements in matrix indices