[R] t.test per line

Erik Iverson eriki at ccbr.umn.edu
Wed May 5 18:23:10 CEST 2010



Mohamed Lajnef wrote:
> Dear All,
> 
> I apologize for this trivial question, I can not find the solution
> I try to use t.test function per line  in the data.frame, But i 
> dont'understand the error message
> 
> my program is as follows
> 
> group1<-gl(2,20)
> fun<-function(x){
> m<-data.frame(group1,x)
>   #anova(aov(x ~ group1, m))
> t.est(x ~ group1,m)
> }

Are you sure this is your code? What is t.est?  What is m?   Please 
provide a reproducible example.


> 
> ttest<- apply(data, 1, fun)
> Error in  t.test.default(x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  :
>  data are essentially constant

What is data?

The error is explained in the help page, which says:

      If the input data are effectively constant (compared to the larger
      of the two means) an error is generated.

It looks like your input data are all '1' as shown in the error message.



More information about the R-help mailing list