Re: [R] Summary grouped by factor

2009-03-06 Thread soeren . vogel
On 06.03.2009, at 16:48, soeren.vo...@eawag.ch wrote: ### example:start v <- sample(rnorm(200), 100, replace=T) k <- rep.int(c("locA", "locB", "locC", "locD"), 25) tapply(v, k, summary) ### example:end ... (hopefully) produces 4 summaries of v according to k group membership. How can I transf

Re: [R] Summary grouped by factor

2009-03-06 Thread Domenico Vistocco
soeren.vo...@eawag.ch wrote: ### example:start v <- sample(rnorm(200), 100, replace=T) k <- rep.int(c("locA", "locB", "locC", "locD"), 25) tapply(v, k, summary) ### example:end This one is better: do.call(cbind, tapply(v,k,summary)) Ciao, domenico ... (hopefully) produces 4 summaries of v acc

Re: [R] Summary grouped by factor

2009-03-06 Thread Jorge Ivan Velez
Dear Sören, How about this? do.call(cbind,tapply(v, k, summary)) HTH, Jorge On Fri, Mar 6, 2009 at 10:48 AM, wrote: > ### example:start > v <- sample(rnorm(200), 100, replace=T) > k <- rep.int(c("locA", "locB", "locC", "locD"), 25) > tapply(v, k, summary) > ### example:end > > ... (hopeful

Re: [R] Summary grouped by factor

2009-03-06 Thread Domenico Vistocco
soeren.vo...@eawag.ch wrote: ### example:start v <- sample(rnorm(200), 100, replace=T) k <- rep.int(c("locA", "locB", "locC", "locD"), 25) tapply(v, k, summary) ### example:end Maybe this could be a solution: t1 <- tapply(v, k, summary) t2 <- sapply(t1, cbind) rownames(t2) <- names(t1[[1]]) t2

[R] Summary grouped by factor

2009-03-06 Thread soeren . vogel
### example:start v <- sample(rnorm(200), 100, replace=T) k <- rep.int(c("locA", "locB", "locC", "locD"), 25) tapply(v, k, summary) ### example:end ... (hopefully) produces 4 summaries of v according to k group membership. How can I transform the output into a nice table with the croups as co