Re: [R] Conditional Statistics

2013-01-08 Thread S Ellison
> ...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 m

Re: [R] Conditional Statistics

2013-01-08 Thread John Kane
ings very differently at times. John Kane Kingston ON Canada > -Original Message- > From: thoms...@email.arizona.edu > Sent: Mon, 7 Jan 2013 19:17:27 -0600 > To: r-help@r-project.org > Subject: [R] Conditional Statistics > > Hello, > > I am a new user of R. I

Re: [R] Conditional Statistics

2013-01-07 Thread Simon Blomberg
You can use the tapply function to do this. You can't type a line into the mean statement. (See ?mean for what you can type in there). The general approach is to have a vector of data (stock prices) and a categorical variable (day of week). Then break up the data vector according to the levels

[R] Conditional Statistics

2013-01-07 Thread Joseph Norman Thomson
Hello, I am a new user of R. I am coming from SAS and do statistics on stock market data, economic data, and social data. My question is this: How can you get the mean, standard dev, etc. of a variable based on a conditional statement on either the same variable or a different variable in the same