[R] putting stuff into bins...
Stefano Calza
stecalza at tiscali.it
Tue Sep 26 13:59:40 CEST 2006
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:
<Federico>Hi All,
<Federico>
<Federico>I have a vector of data, a vector of bin breakpoints and I want to put my data
<Federico>in the bins and then extract fanciful informations like the mean value of each bin.
<Federico>
<Federico>I know I can write my own function, but I would have thought that R should have
<Federico>somewhere a function that took as arguments something like (data, breaks, what
<Federico>to do with the data in the bins). I surey could not find it trawling the R-help
<Federico>archives though.
<Federico>
<Federico>If such a function exists I'd be grateful to anyone pointing it out to me.
<Federico>
<Federico>Cheers,
<Federico>
<Federico>Fede
<Federico>
<Federico>--
<Federico>Federico C. F. Calboli
<Federico>Department of Epidemiology and Public Health
<Federico>Imperial College, St Mary's Campus
<Federico>Norfolk Place, London W2 1PG
<Federico>
<Federico>Tel +44 (0)20 7594 1602 Fax (+44) 020 7594 3193
<Federico>
<Federico>f.calboli [.a.t] imperial.ac.uk
<Federico>f.calboli [.a.t] gmail.com
<Federico>
<Federico>______________________________________________
<Federico>R-help a stat.math.ethz.ch mailing list
<Federico>https://stat.ethz.ch/mailman/listinfo/r-help
<Federico>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
<Federico>and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list