Re: [R] exces return by mktcap decile for each year

2007-07-11 Thread jim holtman
here is one way of doing it using 'ave': dat - read.table(textConnection(mc yrret + 32902.233 01/01/1995 0.426 + 15793.691 01/01/1995 0.024 + 2375.868 01/01/1995 0.660 + 54586.558 01/01/1996 0.497 + 10674.900 01/01/1996 0.405 +859.656 01/01/1996 -0.033 +

[R] exces return by mktcap decile for each year

2007-07-10 Thread Frank Hansen
I have a data frame, lets call it dat, with 3 columns ( mc, yr, ret) which represent market cap, year, and return. mc is a factor, mc, and ret are real numbers. I want to add a column to the data calculated as follows. For each year, I want to split the data by mc decile, then calculate the mean