Displaying 1 result from an estimated 1 matches for "term2maturity".
2012 Jul 11
1
do I need plyr, apply or something else?
...is what I'd like to do (I have an implementation using for loops, which I designed before I realised just how slow R is at executing them - this process currently takes days to run).
I have a large dataframe containing corporate bond data, columns are:
BondID
Date (goes back 5years)
Var1
Var2
Term2Maturity
What I want to do is this:
1) For each bond, at each given date, look back over 1 year and append some statistics to each row ( sd(Var1), cor(Var1,Var2) over that year etc)
a. It seems I might be able to use ddply for this, but I can't work out how to code the stats function to on...