Matej Cepl
2002-Nov-13 15:04 UTC
[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 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Dear R-masters! I have a database with 2400 patients and I need make a sample with 90 subjects. How to I make a random sample in this data base with R? Thanks in advance Bernardo Rangel Tura, MD, MSc National Institute of Cardiology Laranjeiras Rio de Janeiro Brazil -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Christian Schulz
2002-Nov-13 18:16 UTC
[R] [Newbie] Is there any support for work with grouped frequencies?
try this tapply(variable,group,summary) ...instead of "summary" you can use other functions like mean. help(tapply) (..use the online help!) regards,christian ----- Original Message ----- From: "Matej Cepl" <matej at ceplovi.cz> To: <r-help at stat.math.ethz.ch> Sent: Wednesday, November 13, 2002 4:04 PM 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 > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-> r-help mailing list -- Readhttp://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 >_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._. _._ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hola! Suppose your data base is a data.frame: ind <- sample(1:2400, 90) random.sample <- your.data.frame[ind, ] Kjetil Halvorsen Bernardo Rangel Tura wrote:> > Dear R-masters! > > I have a database with 2400 patients and I need make a sample with 90 subjects. > How to I make a random sample in this data base with R? > > Thanks in advance > > Bernardo Rangel Tura, MD, MSc > National Institute of Cardiology Laranjeiras > Rio de Janeiro Brazil > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > 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 > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Yves Brostaux
2002-Nov-14 13:26 UTC
[R] [Newbie] Is there any support for work with grouped frequencies?
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._