Skip to content
Prev 277763 / 398506 Next

Combining data

Well, for

" What is the command for combining certain number of data into their
average value?"

one way would be (calling the data vector, x)"

colMeans(matrix ( x[ seq_len(30 * floor(length(x)/30))], nrow=30))

Note that this will leave out the mean of any values with indices
beyond the largest multiple of 30 less than or equal to the length of
x.

There are probably 87 other ways to do this, many of which might be
better, simpler, faster, or slicker.

-- Bert
On Thu, Nov 17, 2011 at 1:15 PM, MacQueen, Don <macqueen1 at llnl.gov> wrote: