Hello I have a vector gd of 279 values of diameter of limpets. Using 'hist(gd, breaks=seq(10,60,5),plot=F)' I can obtain a vector of 10 centers of size-class ($mids). But I'd like to work on a vector of 279 values being the mids (centers of size-classes) corresponding to the respective 279 values in gd. I looked in the different manuals and in archives of list but didn't find how to obtain such a vector... I looked around in the manual of functions such as levels, density, ... but didn't find a simple solution, which may exists I believe. thanks so much for taking time to answer this (naive/newbie) question. Fred -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
cut will give you a factor identifying the class for each point, and if you have a vector of midpoints just index it by the factor. On Mon, 18 Nov 2002, Fred Jean wrote:> Hello > > I have a vector gd of 279 values of diameter of limpets. > > Using 'hist(gd, breaks=seq(10,60,5),plot=F)' I can obtain a vector of > 10 centers of size-class ($mids). > > But I'd like to work on a vector of 279 values being the mids (centers > of size-classes) corresponding to the respective 279 values in gd. > > I looked in the different manuals and in archives of list but didn't find how > to obtain such a vector... I looked around in the manual of functions such as > levels, density, ... but didn't find a simple solution, which may exists I > believe. > > thanks so much for taking time to answer this (naive/newbie) question. > > Fred > > > > > > > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
I use the following custom function for such a result :
midpoint <- function(x, dx) {
y <- (round((x-dx/2)/dx))*dx+dx/2
y
}
It gives the corresponding midpoints of your data, based on equally spaced
classes (width = dx) starting at the origin of the x axis.
Hope this helped,
Y. Brostaux
At 04:01 19/11/02, you wrote:>Date: Mon, 18 Nov 2002 14:21:31 +0100 (CET)
>From: Fred Jean <Frederic.Jean at univ-brest.fr>
>Subject: [R] vector of center of
>
>Hello
>
>I have a vector gd of 279 values of diameter of limpets.
>
>Using 'hist(gd, breaks=seq(10,60,5),plot=F)' I can obtain a vector
of
>10 centers of size-class ($mids).
>
>But I'd like to work on a vector of 279 values being the mids (centers
>of size-classes) corresponding to the respective 279 values in gd.
>
>I looked in the different manuals and in archives of list but didn't
find how
>to obtain such a vector... I looked around in the manual of functions such
as
>levels, density, ... but didn't find a simple solution, which may exists
I
>believe.
>
>thanks so much for taking time to answer this (naive/newbie) question.
>
>Fred
--
Ir. Yves Brostaux - Statistics and Computer Science Dpt.
Gembloux Agricultural University
8, avenue de la Facult? B-5030 Gembloux (Belgium)
T?l : +32 (0)81 62 24 69
E-mail : brostaux.y at fsagx.ac.be
Web : http://www.fsagx.ac.be/si/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._