Re: [R] howto calculate column means in data frame

2011-04-10 Thread Berend Hasselman
jamaas wrote: > > Long story short, I have a big iterative procedure that produces a long > list of data.frames such as the one called > "results" here. Is there an easy way to produce a similar list of > data.frames comprised of the mean of each of the > columns in results, such that it ends up

Re: [R] howto calculate column means in data frame

2011-04-10 Thread Joshua Wiley
Hi Jim, Using ?lapply with ?colMeans should do the trick. Here is a little sample: eg <- list(mtcars, mtcars) # mtcars data frame twice in a list resultsmean <- lapply(eg, colMeans) # calculate column means for each element of "eg" resultsmean # show the results Hope this helps, Josh On Sun,

[R] howto calculate column means in data frame

2011-04-10 Thread Maas James Dr (MED)
Long story short, I have a big iterative procedure that produces a long list of data.frames such as the one called "results" here. Is there an easy way to produce a similar list of data.frames comprised of the mean of each of the columns in results, such that it ends up like the one I've shown i