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
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
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
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
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
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