[R] vector of center of
Yves Brostaux
brostaux.y at fsagx.ac.be
Tue Nov 19 08:47:53 CET 2002
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list