[R] [Newbie] Is there any support for work with grouped frequencies?
Yves Brostaux
brostaux.y at fsagx.ac.be
Thu Nov 14 14:26:40 CET 2002
For the mean, there is a function called weighted.mean() and you can use it
as a start for custom functions.
An alternative is to expand your grouped data before applying your
function, e.a.
> x <- rep(wtc$MIDPOINT, wtc$FREQ)
> c(Mean=mean(x), Var=var(x))
but it isn't appropriate for some parameters (it doesn't give interpolated
median, etc)
At 04:01 14/11/02, you wrote:
>Date: Wed, 13 Nov 2002 10:04:00 -0500
>From: Matej Cepl <matej at ceplovi.cz>
>Subject: [R] [Newbie] Is there any support for work with grouped frequencies?
>
>Hi,
>
>I have this table (BTW, published by FBI and representing age
>distribution of the WTC tragedy victims):
>
> "LABEL" "FREQ" "MIDPOINT"
> "1" "Infant (under 1)" 0
> "2" "1 to 4" 5
> "3" "5 to 8" 1
> "4" "9 to 12" 3
> "5" "13 to 16" 0
> "6" "17 to 19" 3
> "7" "20 to 24" 117
> "8" "25 to 29" 341
> "9" "30 to 34" 503
> "10" "35 to 39" 578
> "11" "40 to 44" 510
> "12" "45 to 49" 369
> "13" "50 to 54" 272
> "14" "55 to 59" 177
> "15" "60 to 64" 79
> "16" "65 to 69" 29
> "17" "70 to 74" 15
> "18" "75 and over" 11
> "19" "Unknown" NA
>
>Are there any tools to work with grouped frequencies (i.e.,
>median, mean, chi-square test of normality of distribution) or do
>I have to calculate them ``by hand''?
>
>Thanks for any answer,
>
> Matej
>
>- --
>Matej Cepl, matej at ceplovi.cz,
>Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC
>138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488
>
>The ratio of literacy to illiteracy is a constant, but nowadays
>the illiterates can read.
> -- Alberto Moravia
--
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