Re: [R] How to generate table output of t-test

2008-02-06 Thread John Kane
There may be an easier way but you can extract the desired values from the list values in t str(t) to see the elements in t. test <- matrix(c(1, 1,2,2), 2,2) tt <- apply(test, 1, t.test) ttable <- function(tlist) { tframe <- data.frame(NULL) for(i in 1:length(tlist)){ t.value <- tlist[[i]]

Re: [R] How to generate table output of t-test

2008-02-05 Thread Peter Dalgaard
Uwe Ligges wrote: > Ng Stanley wrote: > >> Hi, >> >> Given >> >> test <- matrix(c(1, 1,2,2), 2,2) >> t <- apply(test, 1, t.test) >> > > > >> How can I obtain a table of p-values, confidence interval etc, instead of >> > > A quick hack would be: > > m <- t(sapply(t, function(x) c(x

Re: [R] How to generate table output of t-test

2008-02-05 Thread Uwe Ligges
Ng Stanley wrote: > Hi, > > Given > > test <- matrix(c(1, 1,2,2), 2,2) > t <- apply(test, 1, t.test) > > How can I obtain a table of p-values, confidence interval etc, instead of A quick hack would be: m <- t(sapply(t, function(x) c(x[["p.value"]], x[["conf.int"]]))) colnames(m) <- c("p", "

[R] How to generate table output of t-test

2008-02-05 Thread Ng Stanley
Hi, Given test <- matrix(c(1, 1,2,2), 2,2) t <- apply(test, 1, t.test) How can I obtain a table of p-values, confidence interval etc, instead of [[1]] One Sample t-test data: newX[, i] t = 3, df = 1, p-value = 0.2048 alternative hypothesis: true mean is not equal to 0 95 percent con