s-news
[Top] [All Lists]

Re: friend of mine's question

To: "Leeds, Mark" <mleeds@mlp.com>
Subject: Re: friend of mine's question
From: Tim Hesterberg <timh@insightful.com>
Date: 25 Apr 2005 15:54:13 -0700
Cc: <s-news@lists.biostat.wustl.edu>
In-reply-to: <54668D97C0199943A454516A5FF6481E58AAD2@EXCHUS001.AD.MLP.COM> (mleeds@mlp.com)
References: <54668D97C0199943A454516A5FF6481E58AAD2@EXCHUS001.AD.MLP.COM>
Use groupMeans, e.g.

> groupMeans(fuel.frame[1:4], fuel.frame$Type)
          Weight     Disp.  Mileage     Fuel 
Compact 2821.000 140.40000 24.13333 4.167655
  Large 3676.667 279.33333 20.33333 4.967794
 Medium 3195.769 175.84615 21.76923 4.601413
  Small 2257.692  97.30769 31.00000 3.273380
 Sporty 2798.889 164.11111 26.00000 3.957606
    Van 3517.143 164.42857 18.85714 5.313283

This is part of library(resample); see bottom for download.

>A friend of mine has a data set
>With variables :
> code  price volume yield
>where code is an integer and can take on
>say 20 different values.
>
>He wants the means of price, volume, yield
>But within each code value.
>
>Obviously, he can break it up by each code and then
>take the means but he was hoping
>there was a quicker
>way to do this ? Thanks.

========================================================
| Tim Hesterberg       Research Scientist              |
| timh@insightful.com  Insightful Corp.                |
| (206)802-2319        1700 Westlake Ave. N, Suite 500 |
| (206)283-8691 (fax)  Seattle, WA 98109-3012, U.S.A.  |
|                      www.insightful.com/Hesterberg   |
========================================================
Download the S+Resample library from www.insightful.com/downloads/libraries


<Prev in Thread] Current Thread [Next in Thread>