[R] t.test per line

David Winsemius dwinsemius at comcast.net
Wed May 5 18:29:26 CEST 2010




On May 5, 2010, at 12:15 PM, 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)
> }
>
> 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
>

You apparently think x has some variablity. R does not.

what does tapply(x group1, sd)  show?

>
> Any help would be appreciated
>
> ML
> Best
>
>
>
> -- 
>
>
> Mohamed Lajnef,IE INSERM U955 eq 15
> Pôle de Psychiatrie
> Hôpital CHENEVIER
> 40, rue Mesly
> 94010 CRETEIL Cedex FRANCE
> Mohamed.lajnef at inserm.fr
> tel : 01 49 81 31 31 (poste 18470)
> Sec : 01 49 81 32 90
> fax : 01 49 81 30 99
> ______________________________________________
> R-help at 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list