Skip to content
Prev 278133 / 398502 Next

Binned line plot

A fast way to get **only** means of successive bins of width k of a
vector z of length nk is:

m <- colMeans(matrix(z,nrow = k))

(you wanted k =50)
This was instantaneous for a length 1e6 numeric vector on my laptop.

However, for anything else, you have to use something like cut() as
others have previously advised.

-- Bert
On Mon, Nov 21, 2011 at 10:08 PM, Joshua Wiley <jwiley.psych at gmail.com> wrote: