[R] Which "apply" function to use?

2009-09-14 Thread Masca, N.
Dear All, I have a problem which *should* be pretty straightforward to resolve - but I can't work out how! I have a list of 3 coefficient estimates for 4 different datasets: Coefs<-list(c(1,0.6,0.5),c(0.98,0.65,0.4),c(1.05,0.55,0.45),c(0.99,0.50,0.47)) All I want to do is take the sum (or mean

Re: [R] Which "apply" function to use?

2009-09-14 Thread baptiste auguie
Hi, try this, rowMeans(as.data.frame(Coefs)) # or apply(as.data.frame(Coefs), 1, mean) HTH, baptiste 2009/9/14 Masca, N. > Dear All, > > I have a problem which *should* be pretty straightforward to resolve - but > I can't work out how! > > I have a list of 3 coefficient estimates for 4 diffe

Re: [R] Which "apply" function to use?

2009-09-14 Thread cls59
Masca, N. wrote: > > Dear All, > > I have a problem which *should* be pretty straightforward to resolve - but > I can't work out how! > > I have a list of 3 coefficient estimates for 4 different datasets: > > Coefs<-list(c(1,0.6,0.5),c(0.98,0.65,0.4),c(1.05,0.55,0.45),c(0.99,0.50,0.47)) > >

Re: [R] Which "apply" function to use?

2009-09-14 Thread Masca, N.
Excellent - the "as.data.frame" trick was just what I needed! Many thanks, Nick From: baptiste auguie [baptiste.aug...@googlemail.com] Sent: 14 September 2009 17:48 To: Masca, N. Cc: r-h...@stat.math.ethz.ch Subject: Re: [R] Which "apply&q