Hi, Does anyone know if: with R can you take a set of numbers and aggregate them like you can in SPSS? For example, could you calculate the percentage of people who smoke based on a dataset like the following: smoke = 1 non-smoke = 2 variable 1 1 1 2 2 1 1 1 2 2 2 2 2 2 When aggregated, SPSS can tell you what percentage of persons are smokers based on the frequency of 1's and 2's. Can R statistical package do a similar thing? Thanks, Nat
?table On Wednesday 25 April 2007 14:32, Natalie O'Toole wrote:> Hi, > > Does anyone know if: with R can you take a set of numbers and aggregate > them like you can in SPSS? For example, could you calculate the percentage > of people who smoke based on a dataset like the following: > > smoke = 1 > non-smoke = 2 > > variable > 1 > 1 > 1 > 2 > 2 > 1 > 1 > 1 > 2 > 2 > 2 > 2 > 2 > 2 > > > When aggregated, SPSS can tell you what percentage of persons are smokers > based on the frequency of 1's and 2's. Can R statistical package do a > similar thing? > > Thanks, > > Nat > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html and provide commented, minimal, > self-contained, reproducible code.-- Dylan Beaudette Soil Resource Laboratory http://casoilresource.lawr.ucdavis.edu/ University of California at Davis 530.754.7341
Hi Nat, can I suggest, without offending, that you purchase and read Peter Dalgaard's "Introductory Statistics with R" or Michael Crawley's "Statistics: An Introduction using R" or Venables and Ripley's "Modern Applied Statistics with S" or Maindonald and Braun's "Data Analysis and Graphics Using R: An Example-based Approach", or download and read An Introduction to R http://cran.r-project.org/doc/manuals/R-intro.pdf or one of the numerous contributed documents at http://cran.r-project.org/other-docs.html ? I hope that this helps, Andrew. On Wed, Apr 25, 2007 at 03:32:11PM -0600, Natalie O'Toole wrote:> Hi, > > Does anyone know if: with R can you take a set of numbers and aggregate > them like you can in SPSS? For example, could you calculate the percentage > of people who smoke based on a dataset like the following: > > smoke = 1 > non-smoke = 2 > > variable > 1 > 1 > 1 > 2 > 2 > 1 > 1 > 1 > 2 > 2 > 2 > 2 > 2 > 2 > > > When aggregated, SPSS can tell you what percentage of persons are smokers > based on the frequency of 1's and 2's. Can R statistical package do a > similar thing? > > Thanks, > > Nat > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Andrew Robinson Department of Mathematics and Statistics Tel: +61-3-8344-9763 University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599 http://www.ms.unimelb.edu.au/~andrewpr http://blogs.mbs.edu/fishing-in-the-bay/
Andrew Robinson <A.Robinson@ms.unimelb.edu.au> wrote:> can I suggest, without offending, that you purchase and read Peter > Dalgaard's "Introductory Statistics with R" or Michael Crawley's > "Statistics: An Introduction using R" or Venables and Ripley's "Modern > Applied Statistics with S" or Maindonald and Braun's "Data Analysis > and Graphics Using R: An Example-based Approach", > or download and read An Introduction to R > http://cran.r-project.org/doc/manuals/R-intro.pdf > or one of the numerous contributed documents at > http://cran.r-project.org/other-docs.htmlFor Natalie, who is an SPSS user, may I strongly recommend "R FOR SAS AND SPSS USERS" by Bob Muenchen at http://oit.utk.edu/scc/RforSAS&SPSSusers.pdf This is a really, really excellent document which has proven to be an invaluable resource in introducing my SAS and SPSS using collegaues tot he delights or R. And it is free (as in available at no cost). Tim C> On Wed, Apr 25, 2007 at 03:32:11PM -0600, Natalie O'Toole wrote: > > Hi, > > > > Does anyone know if: with R can you take a set of numbers and > aggregate > > them like you can in SPSS? For example, could you calculate the > percentage > > of people who smoke based on a dataset like the following: > > > > smoke = 1 > > non-smoke = 2 > > > > variable > > 1 > > 1 > > 1 > > 2 > > 2 > > 1 > > 1 > > 1 > > 2 > > 2 > > 2 > > 2 > > 2 > > 2 > > > > > > When aggregated, SPSS can tell you what percentage of persons are > smokers > > based on the frequency of 1's and 2's. Can R statistical package do a > > similar thing? > > > > Thanks, > > > > Nat > > > > ______________________________________________ > > R-help@stat.math.ethz.ch mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > -- > Andrew Robinson > Department of Mathematics and Statistics Tel: +61-3-8344-9763 > University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599 > http://www.ms.unimelb.edu.au/~andrewpr > http://blogs.mbs.edu/fishing-in-the-bay/ > > ______________________________________________ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.