s-news
[Top] [All Lists]

Re: friend of mine's question

To: "'Leeds, Mark'" <mleeds@mlp.com>, s-news@lists.biostat.wustl.edu
Subject: Re: friend of mine's question
From: "Liaw, Andy" <andy_liaw@merck.com>
Date: Sun, 24 Apr 2005 13:55:41 -0400
One way or the other, the data need to be split into groups.  Here's one possible way:
 
sapply(split(mydata, mydata$code), colMeans)
 
Andy
-----Original Message-----
From: s-news-owner@lists.biostat.wustl.edu [mailto:s-news-owner@lists.biostat.wustl.edu] On Behalf Of Leeds, Mark
Sent: Sunday, April 24, 2005 1:18 PM
To: s-news@lists.biostat.wustl.edu
Subject: [S] friend of mine's question

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.

 

                                                mark

------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system.
------------------------------------------------------------------------------

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