[R] Better way to create tables of mean standard deviations

2006-11-07 Thread Benjamin Dickgiesser
Hi I'm trying to create tables of means, standard deviations and numbers of observations (i) for each laboratory (ii) for each batch number (iii) for each batch at each laboratory for the attached data. I created these functions: summary.aggregate - function(y, label, ...) { temp.mean

Re: [R] Better way to create tables of mean standard deviations

2006-11-07 Thread Chuck Cleland
Benjamin Dickgiesser wrote: Hi I'm trying to create tables of means, standard deviations and numbers of observations (i) for each laboratory (ii) for each batch number (iii) for each batch at each laboratory for the attached data. I created these functions: summary.aggregate -

Re: [R] Better way to create tables of mean standard deviations

2006-11-07 Thread hadley wickham
I can only think of rather complex ways to solve the labeling issue... I would appreciate it if someone could point out if there are better/cleaner/easier ways of achieving what I'm trying todo. Does this help? g - function(y) { s - apply(y, 2, function(z) {

Re: [R] Better way to create tables of mean standard deviations

2006-11-07 Thread Benjamin Dickgiesser
Thank you, that was exactly what I was looking for. On 11/7/06, hadley wickham [EMAIL PROTECTED] wrote: I can only think of rather complex ways to solve the labeling issue... I would appreciate it if someone could point out if there are better/cleaner/easier ways of achieving what

Re: [R] Better way to create tables of mean standard deviations

2006-11-07 Thread hadley wickham
With the reshape package, I'd do it like this: df - data.frame(LAB = rep(1:8, each=60), BATCH = rep(c(1,2), 240), Y =rnorm(480)) dfm - melt(df, measured=Y) Should be dfm - melt(df, measure.var=Y) (thanks to Chuck for pointing that out) cast(dfm, LAB ~ ., c(mean, sd, length)) cast(dfm,