# Re: [R] computing the average and standard deviation for many sets of triplicates, using "R-approach"

From: stephen sefick <ssefick_at_gmail.com>
Date: Wed, 18 Jun 2008 11:56:03 -0400

#is this what you want?
t <- matrix(rnorm(120), ncol=12)
(colnames(t) <- paste(rep(LETTERS[1:4], each=3), 1:3, sep=".")) f<-as.matrix(cbind(c(t[,1:3]), c(t[,4:6]), c(t[7:9]), c(t[10:12]))) colnames(f)<-paste(rep(LETTERS[1:4]))
library(prettyR)
describe(f, num.desc=c("mean", "sd"))

On Wed, Jun 18, 2008 at 10:17 AM, Daren Tan <daren76_at_hotmail.com> wrote:

>
> Below example has 4 sets of triplicates, without using for loop and
> iteratively cbind the columns, what is the "R-approach" of generating a
> matrix of 8 columns that are the averages and standard deviations ? The
> average and standard deviation columns should be side by side i.e. A.mean
> A.sd B.mean B.sd C.mean C.sd D.mean D.sd
>
> > t <- matrix(rnorm(120), ncol=12)> (colnames(t) <- paste(rep(LETTERS[1:4],
> each=3), 1:3, sep=".")) [1] "A.1" "A.2" "A.3" "B.1" "B.2" "B.3" "C.1" "C.2"
> "C.3" "D.1" "D.2" "D.3"
> _________________________________________________________________
> [[elided Hotmail spam]]
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

```--
Let's not spend our time and resources thinking about things that are so
little or so large that all they really do for us is puff us up and make us
feel like gods. We are mammals, and have not exhausted the annoying little
problems of being mammals.

-K. Mullis

[[alternative HTML version deleted]]

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
and provide commented, minimal, self-contained, reproducible code.
```
Received on Wed 18 Jun 2008 - 16:21:09 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 18 Jun 2008 - 16:30:48 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.