Skip to content
Back to formatted view

Raw Message

Message-ID: <A4E5A0B016B8CB41A485FC629B633CED4A31450BF2@GOLD.corp.lgc-group.com>
Date: 2013-01-08T13:43:01Z
From: S Ellison
Subject: Conditional Statistics
In-Reply-To: <CAA-SW6aKXWUVsg_rG0L2_SZR-228-QtQi1Z=ddhiTvYbCv-YCA@mail.gmail.com>

> ...if I had the closing prices of the
> S&P from 01/01/1990-12/31/1990, how could I get the average price of
> the S&P from 02/01/1990-03/15/1990? Or the average price of the S&P on
> Mondays (assuming a dummy var is created for 1 = Monday, 0 = else). 

tapply has already been referred to. You may also find aggregate() useful, as it gives you back a data frame that includes the conditioning variables if you tell it to. Alse ave, if you want to do something like mean-centring a data set based on group means rather than the grad mean.

S Ellison

*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}