Re: [R] putting stuff into bins...

2006-09-26 Thread Peter Dalgaard
Federico Calboli [EMAIL PROTECTED] writes: Hi All, I have a vector of data, a vector of bin breakpoints and I want to put my data in the bins and then extract fanciful informations like the mean value of each bin. I know I can write my own function, but I would have thought that R

[R] putting stuff into bins...

2006-09-26 Thread Federico Calboli
Hi All, I have a vector of data, a vector of bin breakpoints and I want to put my data in the bins and then extract fanciful informations like the mean value of each bin. I know I can write my own function, but I would have thought that R should have somewhere a function that took as

Re: [R] putting stuff into bins...

2006-09-26 Thread Dietrich Trenkler
Federico Calboli schrieb: Hi All, I have a vector of data, a vector of bin breakpoints and I want to put my data in the bins and then extract fanciful informations like the mean value of each bin. I know I can write my own function, but I would have thought that R should have

Re: [R] putting stuff into bins...

2006-09-26 Thread Stefano Calza
I don't know about such a function, but tapply(data,cut(data,breaks),what to do) should give you what you need. HIH Ciao, Stefano On Tue, Sep 26, 2006 at 12:44:35PM +0100, Federico Calboli wrote: FedericoHi All, Federico FedericoI have a vector of data, a vector of bin breakpoints and I want

Re: [R] putting stuff into bins...

2006-09-26 Thread David Barron
This would work. The point is to make a factor from the breakpoints using cut, then use this to calculate the statistics on the binned data. x - rnorm(500) f - cut(x,10) aggregate(x,list(f),mean) Group.1 x 1(-2.71,-2.09] -2.3668991 2(-2.09,-1.46] -1.7332011 3

Re: [R] putting stuff into bins...

2006-09-26 Thread Dimitris Rizopoulos
Subject: [R] putting stuff into bins... Hi All, I have a vector of data, a vector of bin breakpoints and I want to put my data in the bins and then extract fanciful informations like the mean value of each bin. I know I can write my own function, but I would have thought that R should