[R] binning a vector

Andrew Robinson andrewr at uidaho.edu
Mon Jul 26 23:08:31 CEST 2004


Also, you can use cut and tapply to calculate means by bins.  

Andrew

----- Original Message -----
From: Deepayan Sarkar <deepayan at stat.wisc.edu>
Date: Tuesday, July 27, 2004 3:38 am
Subject: Re: [R] binning a vector

> On Monday 26 July 2004 10:11, Arne.Muller at aventis.com wrote:
> > Hello,
> >
> > I was wondering wether there's a function in R that takes two 
> vectors> (of same length) as input and computes mean values for bins
> > (intervals) or even a sliding window over these vectros.
> >
> > I've several x/y data set (input/response) that I'd like plot
> > together. Say the x-data for one data set goes from -5 to 14 with
> > 12,000 values, then I'd like to bin the x-vector in steps of +1 and
> > calculate and plot the mean of the x-values and the y-values within
> > each bin.
> >
> > I was browsing the R-docs but couldn't find anything appropiate.
> 
> Do you know about loess? It's not exactly what you describe, but 
> maybe 
> it's what you really want.
> 
> Deepayan
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-
> guide.html




More information about the R-help mailing list