Hello,

I'm not quite sure I understand, but something like this?

tapply(dat$Score, dat$Name, FUN = mean)
sapply(unique(dat$Name), function(un){
    with(dat, t.test(Score[Name == un], Score[Name != un])$p.value)})

My doubt is in what you mean by "mean for CTK and all". The ?t.test gives a confidence interval for the difference in the means, so maybe you'll have to look there for what you want.

Hope this helps,

Rui Barradas
Em 04-10-2012 10:34, Nico Met escreveu:
Dear Group,

I want to do a t-test calculation on a large data set.

I am pasting some part of it

structure(list(Name = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L), .Label = c("CTK100", "CTK103", "CTK121"), class = "factor"),
     Score = c(236.9726, 207.0055, 237.3464, 224.4774, 236.5034,
     206.7382, 233.94, 240.31, 240.9, 235.15, 223.36, 248.67,
     249.25, 201.4051, 244.1689, 182.2756, 229.001, 241.3211,
     196.0453, 232.6055, 225.0783, 196.0453, 232.6055, 225.0783
     )), .Names = c("Name", "Score"), class = "data.frame", row.names =
c(NA,
24L))


I want to compare groups with CTK100 and with all the groups and want to
save the p-values and mean for each of that particular group (for example:
mean for CTK and all)
Similarly, for other groups like that CTK121 etc...

Is there any way to automate this process?

Thanks for your advice !!!!!

Nico

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

______________________________________________
R-help@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.

Reply via email to